diff --git a/.agents/skills/add-block/SKILL.md b/.agents/skills/add-block/SKILL.md index 7de2fa0e872..60778644da4 100644 --- a/.agents/skills/add-block/SKILL.md +++ b/.agents/skills/add-block/SKILL.md @@ -15,23 +15,9 @@ When the user asks you to create a block: 2. Configure all subBlocks with proper types, conditions, and dependencies 3. Wire up tools correctly -## Hard Rule: No Guessed Tool Outputs +## No guessed tool outputs -Blocks depend on tool outputs. If the underlying tool response schema is not documented or live-verified, you MUST tell the user instead of guessing block outputs. - -When block work changes tool execution, same-process work must use a registered -`InternalToolConfig.operation`. Never add a Sim `/api/...` self-hop or the retired -`directExecution` property. - -- Do NOT invent block outputs for undocumented tool responses -- Do NOT describe unknown JSON shapes as if they were confirmed -- Do NOT wire fields into the block just because they seem likely to exist - -If the tool outputs are not known, do one of these instead: -1. Ask the user for sample tool responses -2. Ask the user for test credentials so the tool responses can be verified -3. Limit the block to operations whose outputs are documented -4. Leave uncertain outputs out and explicitly tell the user what remains unknown +Block outputs mirror tool outputs. When a tool's response schema is neither documented nor live-verified, don't infer field names or JSON shapes — ask the user for sample responses or test credentials, limit the block to operations whose outputs are documented, or leave the uncertain outputs out and say exactly what remains unknown. ## Block Configuration Structure @@ -323,12 +309,10 @@ When several fields are mutually exclusive alternatives, mark them all `required "exactly one" at execution — a conditionally-required canonical pair rejects the workflow before the other paths ever get a chance to supply the value. -**Critical constraints:** -- `canonicalParamId` must NOT match any subblock's `id` in the same block -- A canonical group is **block-wide**, not per-operation: `buildCanonicalIndex` keys groups by - `canonicalParamId` across every subblock, and a group has exactly one `basicId`. Two operations - that each need a file pair need two distinct `canonicalParamId` values. -- All members of a group must share the same `required` status +**Constraints (block-wide):** +- `canonicalParamId` must not equal any subblock `id` in the block. +- One canonical id links exactly one basic/advanced pair for one logical parameter. Groups are keyed by canonical id across every subblock and hold one `basicId`, so two operations that each need a pair need two canonical ids. +- All members of a group share the same `required` status. ### Normalizing File Input in tools.config @@ -548,12 +532,6 @@ Maps multiple UI fields to a single serialized parameter: - In advanced mode: `channelId` input value → `params.channel` - The serializer consolidates based on current mode -**Critical constraints:** -- `canonicalParamId` must NOT match any other subblock's `id` in the same block (causes conflicts) -- A `canonicalParamId` links exactly one basic/advanced pair for a single logical parameter. Do NOT reuse the same `canonicalParamId` for different parameters, even under mutually-exclusive conditions/operations -- ONLY use `canonicalParamId` to link basic/advanced mode alternatives for the same logical parameter -- Do NOT use it for any other purpose - ## WandConfig Pattern Enables AI-assisted field generation. @@ -581,9 +559,9 @@ Enables AI-assisted field generation. - `'sql-query'` - SQL statements - `'timestamp'` - Adds current date/time context -## Tools Configuration +Use `wandConfig` on fields that are hard to fill by hand — timestamps (`generationType: 'timestamp'` injects the current date), comma-separated ID lists, complex query strings. Keep the prompt specific about the return format (e.g. 'Return ONLY the ISO 8601 timestamp string'). -**Important:** `tools.config.tool` runs during serialization before variable resolution. Put `Number()` and other type coercions in `tools.config.params` instead, which runs at execution time after variables are resolved. +## Tools Configuration **Preferred:** Use tool names directly as dropdown option IDs to avoid switch cases: ```typescript @@ -654,19 +632,12 @@ outputs: { // Use type: 'json' for complex objects or arrays (NOT type: 'array' with items) items: { type: 'json', description: 'List of items' }, metadata: { type: 'json', description: 'Response metadata' }, - - // Nested outputs (for structured data) - user: { - id: { type: 'string', description: 'User ID' }, - name: { type: 'string', description: 'User name' }, - email: { type: 'string', description: 'User email' }, - }, } ``` ### Typed JSON Outputs -When using `type: 'json'` and you know the object shape in advance, **describe the inner fields in the description** so downstream blocks know what properties are available. Block outputs have no nested `properties` form — always keep the output flat and put the shape in the `description`: +When using `type: 'json'` and you know the object shape in advance, **describe the inner fields in the description** so downstream blocks know what properties are available. Keep the output flat and put the shape in the `description`: ```typescript outputs: { @@ -681,10 +652,6 @@ outputs: { } ``` -Nested object outputs (`plan: { id: { type: 'string' }, ... }`) are a **tool-output** feature only — `OutputFieldDefinition` for blocks does not allow them and they fail TypeScript at build time. - -If the output shape is unknown because the underlying tool response is undocumented, you MUST tell the user and stop. Unknown is not the same as variable. Never guess block outputs. - ## V2 Block Pattern When creating V2 blocks (alongside legacy V1): @@ -727,7 +694,7 @@ export const ServiceV2Block: BlockConfig = { ## Registering Blocks -After creating the block, remind the user to register it in `apps/sim/blocks/registry-maps.ts` (the data maps live here; `registry.ts` holds only the accessor functions). Add the import and an entry to each map alphabetically: +Register the block in `apps/sim/blocks/registry-maps.ts` — add the import and an entry to each map alphabetically: ```typescript import { ServiceBlock, ServiceBlockMeta } from '@/blocks/blocks/service' @@ -887,41 +854,6 @@ Optional fields that are rarely used should be set to `mode: 'advanced'` so they } ``` -## WandConfig for Complex Inputs - -Use `wandConfig` for fields that are hard to fill out manually, such as timestamps, comma-separated lists, and complex query strings. This gives users an AI-assisted input experience. - -```typescript -// Timestamps - use generationType: 'timestamp' to inject current date context -{ - id: 'startTime', - title: 'Start Time', - type: 'short-input', - mode: 'advanced', - wandConfig: { - enabled: true, - prompt: 'Generate an ISO 8601 timestamp based on the user description. Return ONLY the timestamp string.', - generationType: 'timestamp', - }, -} - -// Comma-separated lists - simple prompt without generationType -{ - id: 'mediaIds', - title: 'Media IDs', - type: 'short-input', - mode: 'advanced', - wandConfig: { - enabled: true, - prompt: 'Generate a comma-separated list of media IDs. Return ONLY the comma-separated values.', - }, -} -``` - -## Naming Convention - -All tool IDs referenced in `tools.access` and returned by `tools.config.tool` MUST use `snake_case` (e.g., `x_create_tweet`, `slack_send_message`). Never use camelCase or PascalCase. - ## BlockMeta (Required) Every block file must export a `{Service}BlockMeta` alongside the block — **minimum 7 templates**. Look at existing examples in `apps/sim/blocks/blocks/` (e.g. `browser_use.ts`, `google_sheets.ts`) for the pattern. @@ -998,7 +930,7 @@ bun run apps/sim/scripts/check-canvas-sentences.ts --block={service} Adding a block on its own needs no **tool metadata** regeneration — a block references existing tool IDs through `tools.access` and does not change any tool's shape. -But if the same change also adds, edits **or removes** a tool, run `bun run tool-metadata:generate` and commit the result, or CI fails on stale artifacts. That matters here because a block's `outputs` are authored to match its tools' outputs, and the UI now reads those from the generated metadata rather than the executable registry — an unregenerated tool change makes the block's outputs disagree with what the panel renders. See `.agents/skills/tool-registry-boundary/SKILL.md`. +But if the same change also adds, edits **or removes** a tool, run `bun run tool-metadata:generate` and commit the result, or CI fails on stale artifacts. That matters here because a block's `outputs` are authored to match its tools' outputs, and the UI reads those from the generated metadata, not the executable registry — an unregenerated tool change makes the block's outputs disagree with what the panel renders. See `.agents/skills/tool-registry-boundary/SKILL.md`. A visible integration block does require the generated integration catalog and docs to be refreshed. After adding or changing one, run: @@ -1052,9 +984,9 @@ changes. ## Final Validation (Required) -After creating the block, you MUST validate it against every tool it references: +Validate the block against every tool in `tools.access`: -1. **Read every tool definition** that appears in `tools.access` — do not skip any +1. **Read each tool definition** in `tools.access` 2. **For each tool, verify the block has correct:** - SubBlock inputs that cover all required tool params (with correct `condition` to show for that operation) - SubBlock input types that match the tool param types (e.g., dropdown for enums, short-input for strings) @@ -1063,11 +995,11 @@ After creating the block, you MUST validate it against every tool it references: 3. **Verify block outputs** cover the key fields returned by all tools 4. **Verify conditions** — each subBlock should only show for the operations that actually use it 5. **Verify `{Service}BlockMeta` is exported** with at least 7 templates, each having `icon`, `title`, `prompt`, `modules`, `category`, and `tags` -6. **If any tool outputs are still unknown**, explicitly tell the user instead of guessing block outputs +6. **List any tool outputs still unknown** rather than guessing block outputs 7. **Verify the tool execution boundary** — blocks never create or call API routes. Every referenced tool must already be either a registered `InternalToolConfig.operation` or an absolute external - HTTP(S) `ToolConfig.request`. If transport needs to change, use the `add-tools` skill; do not add a - same-origin `/api/...` hop from the block. + HTTP(S) `ToolConfig.request`. If transport needs to change, use the `add-tools` skill; never add a + same-origin `/api/...` hop or a `directExecution` property from the block. ## Option Lists: `selectorKey` or `options`, never a per-block fetcher @@ -1103,7 +1035,7 @@ options: (params) => { } ``` -**Never fetch inside `options`, and never reach into the stores from a block definition.** A fetcher that resolves its credential with `readSubBlockValue(blockId, ...)` only works on the canvas — every surface that is not the editor gets an empty list. `fetchOptions`/`fetchOptionById` were removed for exactly this reason. +**Never fetch inside `options`, and never reach into the stores from a block definition.** A fetcher that resolves its credential with `readSubBlockValue(blockId, ...)` only works on the canvas — every surface that is not the editor gets an empty list. Two rules the checks enforce: diff --git a/.agents/skills/add-column-type/SKILL.md b/.agents/skills/add-column-type/SKILL.md index 1c54b12cb3a..4462dacb060 100644 --- a/.agents/skills/add-column-type/SKILL.md +++ b/.agents/skills/add-column-type/SKILL.md @@ -8,7 +8,7 @@ argument-hint: A column type is **one file** in `apps/sim/lib/table/column-types/` plus a registry entry. Everything that varies per type — label, icon, storage cast, coercion, validation, conversion compatibility, formatting, editor, filter operators — lives on that one object, so no consumer needs editing. -This was not always true: adding `currency` originally took ~40 edits across 32 `switch` arms and 26 UI branches, each of which failed **silently** when missed. The registry exists to make that impossible, so the rule is absolute: **if you find yourself adding a `case 'yourtype':` anywhere outside `column-types/`, the registry is missing a field. Add the field instead.** +A `case 'yourtype':` outside `column-types/` fails **silently** when missed (a wrong `jsonbCast` breaks every filter on the column). The registry exists to make that impossible, so the rule is absolute with one documented exception (`import.ts`'s `coerceValue`, see "Traps" below): **if you find yourself adding a `case 'yourtype':` anywhere else outside `column-types/`, the registry is missing a field. Add the field instead.** ## Hard Rule: the compiler tells you what to do @@ -116,9 +116,9 @@ Prefer set-based SQL. When the transform genuinely needs JS (`currency`'s separa ## Watch out -- **Import cycles.** `column-types/select.ts` imports `select-values.ts`, so `select-values.ts` must **not** import the registry — that closes a cycle and fails at module init. Inside a type's own helper module the string literal is the implementation, not a config leak. +- **Import cycles.** `column-types/select.ts` imports `lib/table/select-values.ts`, so `select-values.ts` must **not** import the registry — that closes a cycle and fails at module init. Inside a type's own helper module the string literal is the implementation, not a config leak. - **The client-safe boundary.** `registry.ts` and everything it imports must stay free of `@sim/db`, `drizzle-orm`, and `next/server` — the tables grid imports it directly. A React icon is fine (it's a component *reference*, never called server-side). Only `registry.server.ts` may touch drizzle. -- **Don't re-export the registry from `@/lib/table`.** 44 server modules import that barrel; routing this through it pulls `@sim/emcn/icons` into all of them. Deep-import `@/lib/table/column-types`. +- **Don't re-export the registry from `@/lib/table`.** Dozens of server modules import that barrel; routing this through it pulls `@sim/emcn/icons` into all of them. Deep-import `@/lib/table/column-types`. - **`import.ts`'s `coerceValue` is a SECOND write path and is not opt-in.** Importing into a column of your type always hits it, and its `default` arm silently `String(value)`s — so a missing `case` stores text in a column whose `jsonbCast` is numeric, and then every filter and sort on that column errors in Postgres. Add a `case`, even though the switch compiles without one. (It is deliberately separate from the registry's `coerce`: an import wants an unparseable value to survive as its raw string so the row error can name it.) - **CSV inference** is an ordered heuristic in `import.ts`, deliberately not registry-driven. A new type is not inferred from a CSV unless you extend `inferColumnType` — usually you should not, since inference cannot supply configuration (an option set, a currency code). diff --git a/.agents/skills/add-connector/SKILL.md b/.agents/skills/add-connector/SKILL.md index c14c5a11ade..6d7ef0b2930 100644 --- a/.agents/skills/add-connector/SKILL.md +++ b/.agents/skills/add-connector/SKILL.md @@ -469,7 +469,7 @@ The assigned mapping (`semantic id → slot`) is stored in `sourceConfig.tagSlot ## `@/connectors/utils` Helpers -Reuse these instead of inlining the same logic (the validator enforces them): +Reuse these instead of inlining the same logic: - `htmlToPlainText(html)` — strip HTML to plain text before indexing `ExternalDocument.content`. Never index raw HTML. - `computeContentHash(content)` — stable content hash for change detection. @@ -538,7 +538,7 @@ If `ExternalDocument.sourceUrl` is set, the sync engine stores it on the documen If `listDocuments` can ever return **less than the full source set** on a non-incremental sync — a `maxItems`/`maxDocuments`-style cap, or a transient per-item error that drops a still-existing document from the listing — it MUST set `syncContext.listingCapped = true` when that happens. -The sync engine reconciles deletions by comparing the full listing against stored documents: anything not seen is **hard-deleted** (sync-engine.ts, gated on `!syncContext?.listingCapped`). A truncated listing without this flag deletes every real document beyond the cap. This was the single most common bug found when auditing connectors — do not omit it. +The sync engine reconciles deletions by comparing the full listing against stored documents (`shouldReconcileDeletions` in `lib/knowledge/connectors/sync-engine.ts`, gated on `!syncContext?.listingCapped`). Anything not seen is tombstoned on that sync and hard-deleted when the next sync still does not see it — so a truncated listing without this flag eventually removes every real document beyond the cap. ```typescript if (hitLimit && syncContext) { @@ -565,7 +565,7 @@ You never need to modify the sync engine when adding a connector. ## Icon -The `icon` field on `ConnectorConfig` is used throughout the UI — in the connector list, the add-connector modal, and as the document icon in the knowledge base table (replacing the generic file type icon for connector-sourced documents). The icon is read from `CONNECTOR_REGISTRY[connectorType].icon` at runtime — no separate icon map to maintain. +The `icon` field on `ConnectorConfig` is used throughout the UI — in the connector list, the add-connector modal, and as the document icon in the knowledge base table (replacing the generic file type icon for connector-sourced documents). The icon is read from `CONNECTOR_META_REGISTRY[connectorType].icon` (the client-safe registry) at runtime — no separate icon map to maintain. If the service already has an icon in `apps/sim/components/icons.tsx` (from a tool integration), reuse it. Otherwise, ask the user to provide the SVG. @@ -602,7 +602,8 @@ export const CONNECTOR_META_REGISTRY: ConnectorMetaRegistry = { - **OAuth + contentDeferred**: `apps/sim/connectors/google-drive/google-drive.ts` — file download with metadata-based hash, `orderBy` for deterministic pagination - **OAuth + contentDeferred (blocks API)**: `apps/sim/connectors/notion/notion.ts` — complex block content extraction deferred to `getDocument` - **OAuth + contentDeferred (git)**: `apps/sim/connectors/github/github.ts` — blob SHA hash, tree listing -- **OAuth + inline content**: `apps/sim/connectors/confluence/confluence.ts` — multiple config field types, `mapTags`, label fetching +- **OAuth + inline content**: `apps/sim/connectors/slack/slack.ts` — list API returns message content inline, metadata-derived `contentHash` +- **OAuth + contentDeferred + config fields**: `apps/sim/connectors/confluence/confluence.ts` — multiple config field types, `mapTags`, label fetching - **API key**: `apps/sim/connectors/fireflies/fireflies.ts` — GraphQL API with Bearer token auth ## Checklist diff --git a/.agents/skills/add-enrichment/SKILL.md b/.agents/skills/add-enrichment/SKILL.md index 8ea6117db57..34810e72f41 100644 --- a/.agents/skills/add-enrichment/SKILL.md +++ b/.agents/skills/add-enrichment/SKILL.md @@ -22,9 +22,9 @@ Because enrichments run on Sim's hosted keys by default, **every provider tool y ## Architecture (what you're plugging into) -- **`enrichments/types.ts`** — `EnrichmentConfig { id, name, description, icon, inputs, outputs, providers }` and `EnrichmentProvider { id, label, toolId, buildParams, mapOutput }`. Providers are **plain data** (no `@/tools` import) so the catalog stays client-safe. -- **`enrichments/providers.ts`** — `toolProvider(...)` (typed passthrough) plus shared input helpers: `str(v)`, `normalizeDomain(v)`, `firstNonEmpty(arr)`, `splitName(fullName)`. -- **`enrichments/run.ts`** — the server-only cascade runner. Calls `executeTool(provider.toolId, { ...params, _context: { workspaceId } })`, accumulates hosted-key cost, returns the first non-empty mapped result. **You do not edit this** — it works for any registry entry. +- **`enrichments/types.ts`** — `EnrichmentConfig { id, name, description, icon, inputs, outputs, providers }` and `EnrichmentProvider { id, label, toolId, buildParams, projectFailure, mapOutput }` — `toolProvider` fills `projectFailure` with the standard HTTP projection; override it only for a provider whose failure shape is nonstandard (see `enrichments/provider-failures/`). Providers are **plain data** (no `@/tools` import) so the catalog stays client-safe. +- **`enrichments/providers.ts`** — `toolProvider(...)` (typed passthrough) plus shared input helpers: `str(v)`, `normalizeDomain(v)`, `firstNonEmpty(arr)`, `splitName(fullName)`, and `projectEnrichmentProviderFailure`. +- **`enrichments/run.ts`** — the server-only cascade runner. Calls `executeTool(provider.toolId, { ...params, _context: { workspaceId, userId } })`, accumulates hosted-key cost, returns the first non-empty mapped result. **You do not edit this** — it works for any registry entry. - **`enrichments/registry.ts`** — `ENRICHMENT_REGISTRY` / `ALL_ENRICHMENTS` / `getEnrichment`. Register new entries here. Outputs automatically become table columns; billing, the catalog/sidebar UI, the column meta-header icon, and per-row execution all work with no extra wiring. @@ -60,7 +60,7 @@ Why it matters: the cascade runner only bills (and only reads `output.cost.total ## Step 3: Write the enrichment definition -Create `apps/sim/enrichments/{name}/{name}.ts` and a barrel `index.ts`. Mirror the existing entries (`work-email`, `phone-number`, `company-domain`, `company-info`). +Create `apps/sim/enrichments/{name}/{name}.ts` and a barrel `index.ts`. Mirror the entries registered in `enrichments/registry.ts`. ```typescript import { SomeIcon } from '@sim/emcn/icons' diff --git a/.agents/skills/add-hosted-key/SKILL.md b/.agents/skills/add-hosted-key/SKILL.md index 78f127b10f8..a90895d5a46 100644 --- a/.agents/skills/add-hosted-key/SKILL.md +++ b/.agents/skills/add-hosted-key/SKILL.md @@ -202,7 +202,7 @@ The visibility is controlled by `isSubBlockHidden()` in `lib/workflows/subblocks ### Excluding Specific Operations from Hosted Key Support -When a block has multiple operations but some operations should **not** use a hosted key (e.g., the underlying API is deprecated, unsupported, or too expensive), use the **duplicate apiKey subblock** pattern. This is the same pattern Exa uses for its `research` operation: +When a block has multiple operations but some operations should **not** use a hosted key (e.g., the underlying API is deprecated, unsupported, or too expensive), use the **duplicate apiKey subblock** pattern: 1. **Remove the `hosting` config** from the tool definition for that operation — it must not have a `hosting` object at all. 2. **Duplicate the `apiKey` subblock** in the block config with opposing conditions: @@ -235,9 +235,7 @@ Both subblocks share the same `id: 'apiKey'`, so the same value flows to the too To exclude multiple operations, use an array: `{ field: 'operation', value: ['op_a', 'op_b'] }`. -**Reference implementations:** -- **Exa** (`blocks/blocks/exa.ts`): `exa_research` operation excluded from hosting — duplicate `apiKey` pair around lines ~348-365 -- **Google Maps** (`blocks/blocks/google_maps.ts`): `speed_limits` operation excluded from hosting (deprecated Roads API) +**Reference implementation:** `blocks/blocks/google_maps.ts` — `speed_limits` (deprecated Roads API) is excluded from hosting with the duplicate `apiKey` pair. ## Step 5: Add to the BYOK Settings UI diff --git a/.agents/skills/add-integration/SKILL.md b/.agents/skills/add-integration/SKILL.md index b727fa06bb3..850571a9cef 100644 --- a/.agents/skills/add-integration/SKILL.md +++ b/.agents/skills/add-integration/SKILL.md @@ -68,7 +68,7 @@ Choose the tool boundary before writing the declaration: - Use `ToolConfig.request` only for an absolute external HTTP(S) provider endpoint. Never point a tool at `/api/...`, construct an absolute URL back to Sim, declare -`request.internal`, add the retired `directExecution` property, or add an API route merely to reuse code, normalize files, or authorize +`request.internal`, add a `directExecution` property (it fails `bun run check:tool-request-boundary`), or add an API route merely to reuse code, normalize files, or authorize resources. A real external/browser route and an in-process tool may share the same operation, but neither calls the other. Follow the full transport and handler rules in the `add-tools` skill. @@ -92,31 +92,7 @@ export interface {Service}Response extends ToolResponse { } ``` -**Tool file pattern:** -```typescript -export const {service}{Action}Tool: InternalToolConfig = { - id: '{service}_{action}', - name: '{Service} {Action}', - description: '...', - version: '1.0.0', - - oauth: { required: true, provider: '{service}' }, // If OAuth - - params: { - accessToken: { type: 'string', required: true, visibility: 'hidden', description: '...' }, - // ... other params - }, - - operation: { - input: (params) => ({ - accessToken: params.accessToken, - // Map only the semantic operation input. - }), - }, - - outputs: { /* ... */ }, -} -``` +**Tool file pattern:** an external provider API uses `ToolConfig` with `request` (absolute `https://` URL, headers, body, `transformResponse`); same-process Sim work uses `InternalToolConfig` with `operation`. Both full templates, param visibility rules, and output typing live in `.agents/skills/add-tools/SKILL.md` — read it before writing the first tool. ### Critical Rules - `visibility: 'hidden'` for OAuth tokens @@ -127,226 +103,38 @@ export const {service}{Action}Tool: InternalToolConfig = { - Set `optional: true` for outputs that may not exist - Never output raw JSON dumps - extract meaningful fields - When using `type: 'json'` and you know the object shape, define `properties` with the inner fields so downstream consumers know the structure. Only use bare `type: 'json'` when the shape is truly dynamic -- If you do not know the response JSON shape from docs or verified examples, you MUST tell the user and stop. Never guess outputs or response mappings. ### Resolved Secrets at Model and Persistence Boundaries -Classify every request field before implementing the tool: - -This is opt-in, not a blanket integration migration. Add a model-input declaration only when the -service's official documentation or an unambiguous local execution path proves that the exact -field is consumed by an AI model. If that cannot be established, preserve existing tool behavior -and leave the field unannotated. - -- **Ordinary provider/API input:** leave it unchanged. Explicit `{{...}}` references resolve and are - sent with their normal request semantics. A URL, domain, resource ID, control field, or opaque - payload is not model-visible merely because the provider is AI-backed or may process the - referenced resource later. -- **Text or structured content consumed by an AI model:** declare `request.modelInput` for an - external provider request or `operation.modelInput` for an in-process operation, with - `mode: 'project'` and select only the exact model-visible fields. The shared executor replaces - activated Sim secrets with canonical `{{NAME}}` labels before request formatting. For nested or - JSON-string fields, use a small shared selector plus `applyProjected`; verify that selecting the - rebuilt params reproduces the projected selection. -- **Serialized model content sent directly to an external provider:** include the serialized - top-level param in `request.modelInput`. Project the private copy before the existing request - formatter parses it; keep formatter behavior deterministic when a whole-value placeholder is not - valid in the serialized grammar. Do not introduce a second hard-rejection path. -- **Opaque model input owned by an in-process operation** such as inline audio, image, video, or - document bytes: add `privateProvenance` to the operation model-input declaration, or use - `mode: 'private-provenance'` when there is no textual projection. Do not select storage keys, - paths, signed URLs, or ordinary remote URLs as byte provenance; the owning operation must - authorize stored bytes independently at model egress. The operation must call - `validateOpaqueModelInputProvenance` before downloading or sending content to the model and must - apply the workspace-file provenance guard before reading a persisted workspace file. -- **Sim-owned durable storage or internal execution handoff** that can later enter a workflow/model - (table cells, Agent memory, knowledge documents/chunks, workspace-file contents, or child-workflow - input): transport encrypted field-scoped provenance with `operation.secretProvenance`. The - operation validates the exact selection and trusted scope, then persists, imports, or propagates - it at the owning boundary. Preserve shared legacy behavior for rows/files whose provenance marker - is `NULL`; never invent a tool-local migration rule. - -Hard rules: - -- Never substitute secret plaintext into source or serialize plaintext provenance. -- Never hand-roll private provenance headers/envelopes; the shared `executeTool` boundary owns - transport and strips private metadata from functional results. -- Never attach private provenance to an external URL. Project proven - model-visible external fields with `request.modelInput`; otherwise preserve ordinary request - semantics. Use a registered in-process operation when encrypted provenance must cross the - boundary. -- Never sanitize arbitrary third-party tool results. Projection applies only to secrets activated - by Sim's resolved-secret provenance for that execution/tool call. -- Do not add provenance merely because a value is persisted, returned by a tool, or appears in a - filename. Require a concrete Sim `{{...}}` resolution path and a later model/log boundary. If an - unsupported field can resolve a secret but does not justify durable tracking (for example a - `file_write` path), reject it at that exact ingress. -- At diagnostic boundaries, project only values carrying execution-scoped provenance. Ordinary - provider responses, filenames, URLs, and errors remain unchanged when Sim did not resolve a - secret into them. - -Add focused tests covering named projection, ordinary identical text without provenance, nested and -serialized shape handling, unchanged ordinary external inputs, malformed/incomplete private metadata -failing closed, headerless legacy requests, and absence of private metadata in the public tool result. -For durable sinks, also cover legacy `NULL` markers, exact-empty new writes, tracked secret writes, -stale/missing sidecars, and scope isolation. +Classify every request field (ordinary provider input / AI-consumed text / opaque model bytes / +Sim-durable storage) before implementing the tool and apply the shared projection or provenance +mechanism only where a concrete Sim `{{...}}` resolution path reaches a later model or log boundary. +Full rules and the required tests are in `.agents/skills/add-tools/SKILL.md` → "Resolved Secrets and +Provenance Boundaries". ## Step 3: Create Block ### File Location `apps/sim/blocks/blocks/{service}.ts` -### Block Structure -```typescript -import { {Service}Icon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' -import { AuthMode, IntegrationType } from '@/blocks/types' -import { getScopesForService } from '@/lib/oauth/utils' - -export const {Service}Block: BlockConfig = { - type: '{service}', - name: '{Service}', - description: '...', - longDescription: '...', - docsLink: 'https://docs.sim.ai/integrations/{service}', - category: 'tools', - integrationType: IntegrationType.X, // Primary category (see IntegrationType enum) - tags: ['oauth', 'api'], // Cross-cutting tags (see IntegrationTag type) - bgColor: '#HEXCOLOR', - icon: {Service}Icon, - authMode: AuthMode.OAuth, // or AuthMode.ApiKey - - subBlocks: [ - // Operation dropdown - { - id: 'operation', - title: 'Operation', - type: 'dropdown', - options: [ - { label: 'Operation 1', id: 'action1' }, - { label: 'Operation 2', id: 'action2' }, - ], - value: () => 'action1', - }, - // Credential field - { - id: 'credential', - title: '{Service} Account', - type: 'oauth-input', - serviceId: '{service}', - requiredScopes: getScopesForService('{service}'), - required: true, - }, - // Conditional fields per operation - // ... - ], - - tools: { - access: ['{service}_action1', '{service}_action2'], - config: { - tool: (params) => `{service}_${params.operation}`, - }, - }, - - outputs: { /* ... */ }, -} -``` - -### Key SubBlock Patterns - -**Condition-based visibility:** -```typescript -{ - id: 'resourceId', - title: 'Resource ID', - type: 'short-input', - condition: { field: 'operation', value: ['read', 'update', 'delete'] }, - required: { field: 'operation', value: ['read', 'update', 'delete'] }, -} -``` - -**DependsOn for cascading selectors:** -```typescript -{ - id: 'project', - type: 'project-selector', - selectorKey: '{service}.projects', - dependsOn: ['credential'], -}, -{ - id: 'issue', - type: 'file-selector', - selectorKey: '{service}.issues', - dependsOn: ['credential', 'project'], -} -``` - -Every remote `selectorKey` must use the unified server selector path. Apply the `add-selector` skill: -add browser-safe metadata to `apps/sim/lib/selectors/manifest.ts`, reuse or extract a server-only -provider listing primitive, and add a credential- and destination-bound server attachment. Do not -add code under `hooks/selectors/providers`, a provider-specific query key, browser token acquisition, -or a selector-only API route. The shared context builder sends only active `dependsOn` values and -preserves exact `{{KEY}}` environment references for server-side resolution. - -**Basic/Advanced mode for dual UX:** -```typescript -// Basic: Visual selector -{ - id: 'channelSelector', - type: 'channel-selector', - mode: 'basic', - canonicalParamId: 'channel', - dependsOn: ['credential'], -}, -// Advanced: Manual input -{ - id: 'channelId', - type: 'short-input', - mode: 'advanced', - canonicalParamId: 'channel', -} -``` - -Note neither subblock `id` is `channel` — the canonical id is a third name that both members map -onto, and it is the only one that survives serialization. - -**Critical Canonical Param Rules:** -- `canonicalParamId` must NOT match any subblock's `id` in the block -- `canonicalParamId` must be unique **block-wide**, not per operation. `buildCanonicalIndex` keys - groups by `canonicalParamId` across all subblocks and a group holds exactly one `basicId`, so two - operations that each need their own pair must use two different canonical ids -- Only use `canonicalParamId` to link basic/advanced alternatives for the same logical parameter. - A pair carries ONE concept — for files that means upload (basic) + file reference (advanced), as - in Gmail attachments (`blocks/blocks/gmail.ts`). Never overload the advanced side with alternate - identifiers like a URL or a provider asset ID; give those their own subblocks, mark all the - mutually exclusive sources `required: false`, and enforce "exactly one" at execution -- `mode` only controls UI visibility, NOT serialization. Without `canonicalParamId`, both basic and advanced field values would be sent -- Every subblock `id` must be unique within the block. Duplicate IDs cause conflicts even with different conditions -- **Required consistency:** If one subblock in a canonical group has `required: true`, ALL subblocks in that group must have `required: true` (prevents bypassing validation by switching modes) -- **Inputs section:** Must list canonical param IDs (e.g., `fileId`), NOT raw subblock IDs (e.g., `fileSelector`, `manualFileId`) -- **Params function:** Must use canonical param IDs, NOT raw subblock IDs (raw IDs are deleted after canonical transformation) - -### BlockMeta (Required) - -Export a `{Service}BlockMeta` in the same file as the block — **minimum 7 templates**. See `.agents/skills/add-block/SKILL.md` → "BlockMeta (Required)" for valid `modules` and `category` values and the full pattern. - -```typescript -export const {Service}BlockMeta = { - tags: ['tag1', 'tag2'], - templates: [ - { - icon: {Service}Icon, - title: '{Service} ', - prompt: 'Build a workflow that...', // concrete trigger → transformation → output - modules: ['agent', 'workflows'], - category: 'operations', - tags: ['automation'], - alsoIntegrations: ['slack'], // when the prompt references another service - }, - // ... at least 6 more - ], -} as const satisfies BlockMeta -``` +Follow `.agents/skills/add-block/SKILL.md` for the block structure, subBlock types, +`condition`/`dependsOn`/`required`/`mode` syntax, outputs, `canvasPresentation` sentences, and the +`{Service}BlockMeta` export (minimum 7 templates, plus `url` and `skills`). Every block declares +`canvasPresentation`; `bun run apps/sim/scripts/check-canvas-sentences.ts --block={service}` must +pass (CI runs `check:canvas-sentences --require-coverage`). + +Two rules that are easy to get wrong when copying from existing blocks: + +- Every remote `selectorKey` must use the unified server selector path. Apply the `add-selector` skill: + add browser-safe metadata to `apps/sim/lib/selectors/manifest.ts`, reuse or extract a server-only + provider listing primitive, and add a credential- and destination-bound server attachment. Do not + add code under `hooks/selectors/providers`, a provider-specific query key, browser token acquisition, + or a selector-only API route. The shared context builder sends only active `dependsOn` values and + preserves exact `{{KEY}}` environment references for server-side resolution. +- A `canonicalParamId` is a third name that neither member of a basic/advanced pair uses as its `id` + (e.g. `channelSelector` + `channelId` → `canonicalParamId: 'channel'`). It is the only key that + survives serialization, so `inputs` and `tools.config.params` reference the canonical id, never the + subblock ids. It is unique block-wide, and every member of a group shares the same `required` value. ## Step 4: Add Icon @@ -370,14 +158,7 @@ export function {Service}Icon(props: SVGProps) { ``` ### Getting Icons -**Do NOT search for icons yourself.** At the end of implementation, ask the user to provide the SVG: - -``` -I've completed the integration. Before I can add the icon, please provide the SVG for {Service}. -You can usually find this in the service's brand/press kit page, or copy it from their website. - -Paste the SVG code here and I'll convert it to a React component. -``` +**Do not search for icons yourself.** At the end of implementation, ask the user to paste the service's SVG (usually on its brand/press kit page). Once the user provides the SVG: 1. Extract the SVG paths/content @@ -411,69 +192,10 @@ in both light and dark mode. ## Step 5: Create Triggers (Optional) -If the service supports webhooks, create triggers using the generic `buildTriggerSubBlocks` helper. - -### Directory Structure -``` -apps/sim/triggers/{service}/ -├── index.ts # Barrel exports -├── utils.ts # Trigger options, setup instructions, extra fields -├── {event_a}.ts # Primary trigger (includes dropdown) -├── {event_b}.ts # Secondary triggers (no dropdown) -└── webhook.ts # Generic webhook (optional) -``` - -### Key Pattern - -```typescript -import { buildTriggerSubBlocks } from '@/triggers' -import { {service}TriggerOptions, {service}SetupInstructions, build{Service}ExtraFields } from './utils' - -// Primary trigger - includeDropdown: true -export const {service}EventATrigger: TriggerConfig = { - id: '{service}_event_a', - subBlocks: buildTriggerSubBlocks({ - triggerId: '{service}_event_a', - triggerOptions: {service}TriggerOptions, - includeDropdown: true, // Only for primary trigger! - setupInstructions: {service}SetupInstructions('Event A'), - extraFields: build{Service}ExtraFields('{service}_event_a'), - }), - // ... -} - -// Secondary triggers - no dropdown -export const {service}EventBTrigger: TriggerConfig = { - id: '{service}_event_b', - subBlocks: buildTriggerSubBlocks({ - triggerId: '{service}_event_b', - triggerOptions: {service}TriggerOptions, - // No includeDropdown! - setupInstructions: {service}SetupInstructions('Event B'), - extraFields: build{Service}ExtraFields('{service}_event_b'), - }), - // ... -} -``` - -### Connect to Block -```typescript -import { getTrigger } from '@/triggers' - -export const {Service}Block: BlockConfig = { - triggers: { - enabled: true, - available: ['{service}_event_a', '{service}_event_b'], - }, - subBlocks: [ - // Tool fields... - ...getTrigger('{service}_event_a').subBlocks, - ...getTrigger('{service}_event_b').subBlocks, - ], -} -``` - -See `/add-trigger` skill for complete documentation. +If the service supports webhooks or needs polling, follow `.agents/skills/add-trigger/SKILL.md` +(directory layout, `buildTriggerSubBlocks`, provider handler, polling handler); then wire +`triggers.enabled` / `triggers.available` into the block and spread each trigger's +`getTrigger(id).subBlocks` after the tool subBlocks. ## Step 6: Register Everything @@ -623,8 +345,8 @@ If creating V2 versions (API-aligned outputs): - [ ] Created tool file for each operation - [ ] Chose exactly one boundary per tool: registered `InternalToolConfig.operation` or absolute external HTTP(S) `ToolConfig.request` -- [ ] No tool points to `/api/...`, constructs a URL back to Sim, declares `request.internal` or the - retired `directExecution` property, or has an HTTP fallback for an in-process operation +- [ ] No tool points to `/api/...`, constructs a URL back to Sim, declares `request.internal` or a + `directExecution` property (fails `bun run check:tool-request-boundary`), or has an HTTP fallback for an in-process operation - [ ] All params have correct visibility - [ ] All nullable fields use `?? null` - [ ] All optional outputs have `optional: true` @@ -658,6 +380,8 @@ If creating V2 versions (API-aligned outputs): - [ ] If triggers: set `triggers.enabled` and `triggers.available` - [ ] If triggers: spread trigger subBlocks with `getTrigger()` - [ ] Exported `{Service}BlockMeta` with at least 7 templates +- [ ] `canvasPresentation.sentences` covers every operation; `bun run apps/sim/scripts/check-canvas-sentences.ts --block={service}` passes +- [ ] `{Service}BlockMeta` also sets `url` (verified external homepage) and `skills` (grounded in `tools.access`, sourced from real use cases) — see add-block → BlockMeta ### OAuth Scopes (if OAuth service) - [ ] Defined scopes in `lib/oauth/oauth.ts` under `OAUTH_PROVIDERS` @@ -707,52 +431,13 @@ If creating V2 versions (API-aligned outputs): - [ ] If any response schema remained unknown, explicitly told the user instead of guessing - [ ] `{Service}BlockMeta` exported with at least 7 templates, each having `icon`, `title`, `prompt`, `modules`, `category`, and `tags` -## Example Command - -When the user asks to add an integration: - -``` -User: Add a Stripe integration - -You: I'll add the Stripe integration. Let me: - -1. First, research the Stripe API using Context7 -2. Create the tools for key operations (payments, subscriptions, etc.) -3. Create the block with operation dropdown -4. Register everything -5. Generate docs -6. Ask you for the Stripe icon SVG - -[Proceed with implementation...] - -[After completing steps 1-5...] - -I've completed the Stripe integration. Before I can add the icon, please provide the SVG for Stripe. -You can usually find this in the service's brand/press kit page, or copy it from their website. - -Paste the SVG code here and I'll convert it to a React component. -``` - ## File Handling When your integration handles file uploads or downloads, follow these patterns to work with `UserFile` objects consistently. ### What is a UserFile? -A `UserFile` is the standard file representation in Sim: - -```typescript -interface UserFile { - id: string // Unique identifier - name: string // Original filename - url: string // Presigned URL for download - size: number // File size in bytes - type: string // MIME type (e.g., 'application/pdf') - base64?: string // Optional base64 content (if small file) - key?: string // Internal storage key - context?: object // Storage context metadata -} -``` +`UserFile` (`apps/sim/executor/types.ts`) is the standard file representation in Sim — id, name, an access `url` (not guaranteed presigned — `remoteUrl` is the short-lived signed one, set only for providers that fetch by URL), size, MIME `type`, storage `key`, and optional inline `base64` / provider file handles. Read file bytes through the documented upload helpers, never by fetching `url` directly. Read the interface rather than relying on a copy here. ### File Input Pattern (Uploads) @@ -819,13 +504,11 @@ export const {service}UploadTool: InternalToolConfig = { // ... params: { file: { type: 'file', required: false, visibility: 'user-or-llm' }, - fileContent: { type: 'string', required: false, visibility: 'hidden' }, // Legacy }, operation: { input: (params) => ({ accessToken: params.accessToken, file: params.file, - fileContent: params.fileContent, }), }, } @@ -939,17 +622,7 @@ requiredScopes: getScopesForService('{service}'), ### Common Gotchas 1. **OAuth serviceId must match** - The `serviceId` in oauth-input must match the OAuth provider configuration -2. **All tool IDs MUST be snake_case** - `stripe_create_payment`, not `stripeCreatePayment`. This applies to tool `id` fields, registry keys, `tools.access` arrays, and `tools.config.tool` return values -3. **Block type is snake_case** - `type: 'stripe'`, not `type: 'Stripe'` -4. **Alphabetical ordering** - Keep imports and registry entries alphabetically sorted -5. **Required can be conditional** - Use `required: { field: 'op', value: 'create' }` instead of always true -6. **DependsOn clears options** - When an active dependency changes, the shared selector facade +2. **DependsOn clears options** - When an active dependency changes, the shared selector facade refetches with an opaque query revision; dependency values and references never enter query keys -7. **Never pass Buffer directly to fetch** - Convert to `new Uint8Array(buffer)` for TypeScript compatibility -8. **Always handle legacy file params** - Keep hidden `fileContent` params for backwards compatibility -9. **Optional fields use advanced mode** - Set `mode: 'advanced'` on rarely-used optional fields -10. **Complex inputs need wandConfig** - Timestamps, JSON arrays, and other hard-to-type values should have `wandConfig` enabled -11. **Never hardcode scopes** - Use `getScopesForService()` in blocks and `getCanonicalScopesForProvider()` in auth.ts -12. **Always add scope descriptions** - New scopes must have entries in `SCOPE_DESCRIPTIONS` within `lib/oauth/utils.ts` -13. **OAuth service IDs need deployment capabilities** - Every visible OAuth integration must resolve through `OAUTH_CLIENT_CAPABILITIES`; shared Google/Microsoft aliases map to their provider capability -14. **Keep runtime and presentation separate** - Runtime OAuth fields live in `packages/deployment-config/src/env-capabilities.ts`; CLI input modes live in the exhaustively checked `packages/sim-setup/src/capability-config.ts` mapping +3. **Never pass Buffer directly to fetch** - Convert to `new Uint8Array(buffer)` for TypeScript compatibility +4. **Legacy `fileContent` params** - Only an existing tool that already accepted base64 `fileContent` keeps that hidden param; new tools take `file` only diff --git a/.agents/skills/add-model/SKILL.md b/.agents/skills/add-model/SKILL.md index d418773ff2e..c7630651b10 100644 --- a/.agents/skills/add-model/SKILL.md +++ b/.agents/skills/add-model/SKILL.md @@ -31,7 +31,7 @@ In priority order — fetch all that exist for the provider: | Provider | Models index | Pricing | Reasoning/parameter caveats | |---|---|---|---| | OpenAI | platform.openai.com/docs/models | openai.com/api/pricing | platform.openai.com/docs/guides/reasoning | -| Anthropic | docs.anthropic.com/en/docs/about-claude/models | anthropic.com/pricing | docs.anthropic.com/en/docs/build-with-claude/extended-thinking | +| Anthropic | platform.claude.com/docs/en/about-claude/models/overview | claude.com/pricing (API section) | platform.claude.com/docs/en/build-with-claude/extended-thinking | | Google (Gemini) | ai.google.dev/gemini-api/docs/models | ai.google.dev/pricing | ai.google.dev/gemini-api/docs/thinking | | xAI | docs.x.ai/developers/models | docs.x.ai/developers/models (per-model detail page) | docs.x.ai/developers/model-capabilities/text/reasoning | | Mistral | docs.mistral.ai/getting-started/models/models_overview | mistral.ai/pricing | n/a | @@ -49,13 +49,13 @@ Use a precise WebFetch prompt: *"Extract for {model_id}: exact model id string, |---|---|---| | `temperature` | All providers (passed through if set) | Safe but inert on always-reasoning models that reject it | | `toolUsageControl` | All providers (provider-level, not per-model) | n/a — set on `ProviderDefinition`, not models | -| `reasoningEffort` | `openai/core.ts`, `azure-openai`, `anthropic/core.ts` (mapped to thinking), `gemini/core.ts` | **Dead on xai, deepseek, mistral, groq, cerebras, openrouter, fireworks, bedrock, vertex** unless their core consumes it — re-grep before assuming | +| `reasoningEffort` | `openai/core.ts`, `azure-openai`, `xai`, `deepseek`, `groq`, `zai`, `meta`, `litellm` (each `index.ts`) | Not read by anthropic/gemini (they use `thinking`) or by mistral, cerebras, openrouter, fireworks, vertex — re-grep before assuming | | `verbosity` | `openai/core.ts`, `azure-openai/index.ts` only | Dead elsewhere | -| `thinking` | `anthropic/core.ts`, `gemini/core.ts` | Dead elsewhere | +| `thinking` | `anthropic/core.ts`, `gemini/core.ts`; `deepseek`, `groq`, `zai`, `kimi` (each `index.ts`) read the resolved `thinkingLevel` | Dead elsewhere | | `thinking.streamed` | Docs generator + `getThinkingStreamVisibility` (`models.ts`); `anthropic/core.ts` uses `'summary'` to request `display: 'summarized'` on agent-events runs | **Mandatory on Anthropic-family thinking models** (`agent-stream-docs:check` fails without it); other families fall back to provider defaults | -| `nativeStructuredOutputs` | `anthropic/core.ts`, `fireworks/index.ts`, `openrouter/index.ts` | Dead on openai, xai, google, vertex, bedrock, azure-openai, deepseek, mistral, groq, cerebras | +| `nativeStructuredOutputs` | `anthropic/core.ts`, `bedrock/index.ts` (via `models.ts` `supportsNativeStructuredOutputs`, which reads the flag) | Dead elsewhere — fireworks/baseten/together/openrouter call their own provider-level `supportsNativeStructuredOutputs` that ignores the model flag (always on, always off, or OpenRouter API metadata) | | `maxOutputTokens` | Read by UI + executor for token estimation | Always meaningful — set if provider documents a cap | -| `computerUse` | `anthropic/core.ts` | Dead elsewhere | +| `computerUse` | `providers/utils.ts` (`getComputerUseModels` → `computerUseModels` routing) | Set only on actual computer-use SKUs | | `deepResearch` | UI flag for routing to deep-research SKUs | Set only on actual deep-research model IDs | | `memory: false` | Conversation persistence opt-out | Set only when model genuinely cannot maintain history (e.g., deep-research) | @@ -98,13 +98,15 @@ Model id MUST be prefixed: `azure/`, `azure-anthropic/`, `vertex/`, `bedrock/`, ### Insertion order -Within a family, newest first (matches existing convention: GPT-5.5 above GPT-5.4 above GPT-5.2). Across families, biggest/flagship at top of list. +Within a family, newest first (as the existing entries are ordered). Across families, biggest/flagship at top of list. ### `recommended` / `speedOptimized` - At most one or two `recommended: true` per provider — the current flagship(s). - If you're adding a new flagship, ask the user before removing `recommended` from the previous flagship. Never silently flip it. - `speedOptimized: true` only on the smallest/fastest tier (nano, flash-lite, haiku class). +- Use today's date for `pricing.updatedAt`; never copy a sibling's. +- `cachedInput` is an explicit documented number — never derived from `input` (ratios vary by provider). ## Step 4: Repo-side touchpoints beyond the entry @@ -112,21 +114,9 @@ Adding the `models.ts` entry is most of the job because nearly every consumer is ### Hosted = auto-billed, by provider -`getHostedModels()` in `apps/sim/providers/models.ts` returns **every** model under `openai`, `anthropic`, and `google`: +`getHostedModels()` in `apps/sim/providers/models.ts` returns the model IDs served with Sim's rotating hosted key and billed to the workspace via `shouldBillModelUsage()` (`providers/utils.ts`). It builds that list by expanding whole providers (`getProviderModels('openai')`, `'anthropic'`, `'google'`, and others) plus the static Fireworks catalog, so any model added under one of those providers is hosted automatically. Read the function before inserting — the provider set changes. Before you insert: -```ts -export function getHostedModels(): string[] { - return [ - ...getProviderModels('openai'), - ...getProviderModels('anthropic'), - ...getProviderModels('google'), - ] -} -``` - -So a model added to any of those three providers is **automatically served with Sim's rotating hosted key and billed** to the workspace via `shouldBillModelUsage()` (`providers/utils.ts`). Before you insert: - -- **If the model should be BYOK-only / never-billed**, do NOT drop it under `openai`/`anthropic`/`google` as-is — that silently enrolls it in hosted billing. Confirm hosting/billing intent with the user. (Precedent: Ollama Cloud is a deliberately separate `isReseller` provider specifically to stay BYOK-only/never-billed.) +- **If the model should be BYOK-only / never-billed**, do not add it under a provider that `getHostedModels()` expands — that silently enrolls it in hosted billing. After inserting, verify with `getHostedModels().includes('')` (a one-line `bun -e` or the assertion in `providers/utils.test.ts`). Confirm hosting/billing intent with the user. (Ollama Cloud is a deliberately separate `isReseller` provider specifically to stay BYOK-only/never-billed.) - **If the model should be hosted**, the deployment must actually have a key for it — the provider's `{PREFIX}_COUNT` / `{PREFIX}_1..N` env vars must be set, or hosted runs fail at execution time. - State the hosted/billing status explicitly in the verification report. @@ -145,7 +135,7 @@ If anything matches, run the affected provider tests and update assertions as ne ### New API behavior is NOT data-driven -The Consumption Matrix (Step 2) tells you which capability *flags* are honored by existing provider code. But if the new model needs **net-new** request handling that the provider doesn't implement yet — a new beta header (e.g. Anthropic's `anthropic-beta` structured-outputs header in `anthropic/index.ts`), a new thinking/reasoning encoding, a Responses-API quirk — you must edit `apps/sim/providers//core.ts` / `index.ts`. Setting a flag whose behavior isn't implemented is a silent no-op. When you do edit provider code, reuse the shared helpers rather than hand-rolling: streaming responses are assembled via `createStreamingExecution` (`@/providers/streaming-execution`) and tool schemas via `adaptOpenAIChatToolSchema` / `adaptAnthropicToolSchema` (`@/providers/tool-schema-adapter`). +The Consumption Matrix (Step 2) tells you which capability *flags* are honored by existing provider code. But if the new model needs **net-new** request handling that the provider doesn't implement yet — a new beta header, a new thinking/reasoning encoding, a Responses-API quirk — you must edit `apps/sim/providers//core.ts` / `index.ts`. Setting a flag whose behavior isn't implemented is a silent no-op. When you do edit provider code, reuse the shared helpers rather than hand-rolling: streaming responses are assembled via `createStreamingExecution` (`@/providers/streaming-execution`) and tool schemas via `adaptOpenAIChatToolSchema` / `adaptAnthropicToolSchema` (`@/providers/tool-schema-adapter`). ### Thinking/reasoning models: `streamed` visibility + generated docs @@ -168,7 +158,7 @@ bun run lint bun run agent-stream-docs:generate # only when the entry has thinking/reasoningEffort ``` -Lint must pass before reporting done. **If lint fails:** read the error, fix the syntax/typing issue in the entry you just wrote (do not delete the entry — it's the work product), re-run lint, and note the fix in a "Lint adjustments" line in the verification report. Never report done with lint failing. +Lint must pass before you report done — fix the entry you wrote, never delete it to make lint pass. ## Step 6: Verification report (mandatory format) @@ -187,7 +177,7 @@ End with this exact structure: | `capabilities.temperature` | `{ min: 0, max: 1 }` | matches sibling entries | — pattern-match only | | `capabilities.reasoningEffort` | NOT SET | provider docs say API rejects it for this model | ✓ correctly omitted | | `releaseDate` | 2026-04-30 | https://docs.x.ai/... announcement | ✓ verified | -| hosted/billing | BYOK-only (xai not in `getHostedModels`) | `providers/models.ts` | — confirmed intent | +| hosted/billing | hosted (`getHostedModels().includes(id)`) or BYOK-only | `providers/models.ts` | — confirmed intent | **Disagreements** - _none_ OR _OpenRouter says X, provider docs say Y — used Y per provider rule_ @@ -206,17 +196,3 @@ Omitting a field is **not the same as verifying it**. Any field you cannot confi - Context window missing → do NOT guess. Ask the user; mark ❓ UNVERIFIED. - Release date missing → omit the field; mark ❓ UNVERIFIED in the report. - Capability uncertain → omit the flag (safer than setting a dead/wrong one); mark ❓ UNVERIFIED so the user knows you didn't confirm it either way. - -## Anti-patterns this skill exists to prevent - -- ❌ Trusting a marketing email (xAI's grok-4.3 email claimed "3 reasoning efforts" but the API rejects `reasoning_effort` — verified by official docs only) -- ❌ Setting `nativeStructuredOutputs: true` on xai/openai/google (dead — only anthropic/fireworks/openrouter consume it) -- ❌ Setting `thinking` on non-Anthropic/non-Gemini providers -- ❌ Adding an Anthropic-family thinking model without `thinking.streamed` (CI `agent-stream-docs:check` fails), or skipping `bun run agent-stream-docs:generate` after adding any thinking/reasoning model -- ❌ Setting `verbosity` on anything other than OpenAI gpt-5.x -- ❌ Copying `pricing.updatedAt` from a sibling instead of using today's date -- ❌ Inventing a `cachedInput` price by dividing input by 4 (varies by provider — find an explicit number) -- ❌ Stamping `recommended: true` on the new model without removing it from the previous flagship -- ❌ Adding a BYOK-only model under `openai`/`anthropic`/`google` (silently enrolls it in hosted billing via `getHostedModels()`) -- ❌ Reporting "done" after only `bun run lint` when you touched a hosted (openai/anthropic/google) or flagship model with assertions in `providers/utils.test.ts` -- ❌ Reporting "done" with any UNVERIFIED row in the table diff --git a/.agents/skills/add-permission-group-item/SKILL.md b/.agents/skills/add-permission-group-item/SKILL.md index c218ddf7a38..e413adcd70f 100644 --- a/.agents/skills/add-permission-group-item/SKILL.md +++ b/.agents/skills/add-permission-group-item/SKILL.md @@ -109,11 +109,11 @@ Capability ids are **domain-shaped** (`tables.create`); config keys are **surfac Use `'PERMISSION_GROUP_CAPABILITY_BLOCKED'` for `detailCode`. Four rules carry a more specific one — `deploy.chat.auth_mode` (`CHAT_AUTH_MODE_NOT_PERMITTED`), `file_share.publish` / `file_share.auth_mode` (`PUBLIC_SHARING_NOT_ALLOWED`), `personal_api_key.use` (`PERSONAL_API_KEYS_DISABLED`) — which is why a call site reads the code off the rule and never spells one out. The set in `lib/core/application/forbidden.ts` is closed **over remedies, not causes** — a new code is warranted only when the remedy differs from "ask an organization admin", and requires an entry in `FORBIDDEN_DETAIL_CODE_DESCRIPTIONS` (a compile-time gate) plus a new value in the generated OpenAPI 403 description. -A **parameterized** rule is the same shape with `kind: 'parameterized'` and a `deniedBy` taking the request value second — `'knowledge.connectors'` is `(config, connectorType) => allowlistDenies(config.allowedKnowledgeConnectors, connectorType)`. It **cannot be declared on an operation**: the funnel decides from principal, workspace and operation, never request input, and widening it would touch all ~315 operations for the sake of two keys. `defineWorkspaceOperation` throws at definition time (`Operation declares parameterized capability ; assert it from the use case instead`) rather than letting the operation read as gated while the gate never fires. +A **parameterized** rule is the same shape with `kind: 'parameterized'` and a `deniedBy` taking the request value second — `'knowledge.connectors'` is `(config, connectorType) => allowlistDenies(config.allowedKnowledgeConnectors, connectorType)`. It **cannot be declared on an operation**: the funnel decides from principal, workspace and operation, never request input, and widening it would touch every one of the hundreds of operations for the sake of two keys. `defineWorkspaceOperation` throws at definition time (`Operation declares parameterized capability ; assert it from the use case instead`) rather than letting the operation read as gated while the gate never fires. ## Step 4: Declare it on the operations it governs, or assert it at the call site -`capability` is **required on the `ApplicationOperation` base type** (`lib/core/application/operation.ts:31`), typed `StaticPermissionGroupCapability | 'none'` — required there, not only on `defineWorkspaceOperation`, so a bare object literal minted by a domain factory does not compile without it (five OAuth-connection operations once shipped capability-less that way) — *and* guarded at definition time (`Operation declares no capability; name one, or 'none' with a reason`). The guard is not redundant: **`apps/sim/tsconfig.json` excludes `*.test.ts` / `*.test.tsx` from type-checking** and the enforcement audit walks past test files, so a fixture is the one construction site no static check reads. An absent capability does not deny — it throws `Cannot read properties of undefined` inside `capabilityDeniedBy`, and **only for a caller whose organization actually has a permission group**. It passes CI and every personal workspace, then fails in the tenants that bought the feature. +`capability` is **required on the `ApplicationOperation` base type** (the `capability` field in `lib/core/application/operation.ts`), typed `StaticPermissionGroupCapability | 'none'` — required there, not only on `defineWorkspaceOperation`, so a bare object literal minted by a domain factory does not compile without it — *and* guarded at definition time (`Operation declares no capability; name one, or 'none' with a reason`). The guard is not redundant: **`apps/sim/tsconfig.json` excludes `*.test.ts` / `*.test.tsx` from type-checking** and the enforcement audit walks past test files, so a fixture is the one construction site no static check reads. An absent capability does not deny — it throws `Cannot read properties of undefined` inside `capabilityDeniedBy`, and **only for a caller whose organization actually has a permission group**. It passes CI and every personal workspace, then fails in the tenants that bought the feature. **Static, and the operation is the whole decision** — set `capability` and write no gate code: @@ -127,7 +127,7 @@ export const shareWidget = defineWorkspaceOperation({ }) ``` -**The factory trap.** An operation minted by a factory that does not call `defineWorkspaceOperation` — a hand-frozen object — bypasses the required type *and*, once bypassed, the audit; twenty-one operations across six domains were invisible that way, and the file still printed a tick because some other operation in it was counted. The audit now matches the whole `defineOperation` family, resolves a same-file `function` factory (capability fixed in the body or taken as a positional second argument — `lib/table/application/operations.ts` shows both, with **no default** on the positional form so nothing inherits `tables.use` unreviewed), and cross-checks the members of every exported `*Operations` registry against what it parsed. Keep new operations inside an exported `*Operations` registry, mint them through a `define*Operation` builder taking an object literal with a string `id`, and use a `function` factory rather than an arrow const. +**The factory trap.** An operation minted by a factory that does not call `defineWorkspaceOperation` — a hand-frozen object — bypasses the required type *and*, once bypassed, the audit. The audit therefore matches the whole `defineOperation` family, resolves a same-file `function` factory (capability fixed in the body or taken as a positional second argument — `lib/table/application/operations.ts` shows both, with **no default** on the positional form so nothing inherits `tables.use` unreviewed), and cross-checks the members of every exported `*Operations` registry against what it parsed, so a registry member it read no operation from is a finding rather than a tick. Keep new operations inside an exported `*Operations` registry, mint them through a `define*Operation` builder taking an object literal with a string `id`, and use a `function` factory rather than an arrow const. **Static, but no operation to hang it on** — a raw route or an organization-level action. @@ -179,7 +179,7 @@ Always route through `CAPABILITY_RULES` and raise with `refuseCapability` — a When the subject is **persisted and read back later** — the table dispatch pipeline stamps it on `table_run_dispatches` / `table_row_executions` so auto-fired cells run under the person the write was gated for — declare it `capabilityGovernedUserId: string | null`, required with an explicit `null` and never optional. An optional field with a fallback is how every producer that had not been taught the distinction silently inherited `triggeredByUserId`, an *attribution* naming the billed account; making omission a compile error is the whole enforcement. A persisted subject also has a lifecycle: `lib/users/account-deletion.ts` cancels the dispatches stamped with a deleted user. - **`/api/v1`** authorizes in `app/api/v1/middleware.ts`. Every route threads a `V1RouteCapability` (`StaticPermissionGroupCapability | 'none'`, required and spelled out) whose value must match what its v2 or internal counterpart declares — v1 gets no mapping of its own. `check-capability-subject.ts` audits v1's subjects only, because the bug has shipped and been fixed twice there. -- **Raw internal table routes** (`/api/table/**`) share one gate in `checkAccess` (`app/api/table/utils.ts`), whose signature takes a `TableAccessPrincipal` union — `{ kind: 'user'; userId }` or `{ kind: 'workspace_api_key'; keyCreatorUserId }` — so a bare id no longer type-checks and only the kind that says so skips the gate. `tableAccessPrincipal(rateLimit)` builds it for v1. +- **Raw internal table routes** (`/api/table/**`) share one gate in `checkAccess` (`app/api/table/utils.ts`), whose signature takes a `TableAccessPrincipal` union — `{ kind: 'user'; userId }` or `{ kind: 'workspace_api_key'; keyCreatorUserId }` — so a bare id does not type-check and only the kind that says so skips the gate. `tableAccessPrincipal(rateLimit)` builds it for v1. - **The route-wrapper graph.** `withRouteHandler` imports `request-scope.server.ts` and nothing heavier. Import a resolver at the *call site*, never from the wrapper or `lib/core/application` — see Step 6. ## Step 5: Add it to the golden corpus @@ -215,12 +215,12 @@ cd apps/sim && bunx vitest run lib/permission-groups Also `bun run check:api-validation` if you touched a contract or the group routes. `bun run check:audits` runs all of these; it derives its list from the `check:*` scripts in `package.json`, so a new audit is opted *out* deliberately rather than opted in. -Read the success lines, not the exit codes — the counts should have grown by your operation and capability: +Read the success lines, not the exit codes — compare the counts against the previous run and check they grew by exactly what you added: an operation-declared capability adds one operation and one capability; a raw-route or parameterized capability adds one capability and no operation; an executor-gated or UI-only item adds neither: ``` -✓ permission-group enforcement: 322 operations declare a capability, 35 capabilities all enforced -✅ Application graph clean: 5 roots reach none of 11 forbidden module trees -check:capability-subject — 32 v1 files, 5 capability subjects resolved through capabilityGovernedUserId. +✓ permission-group enforcement: operations declare a capability, capabilities all enforced +✅ Application graph clean: roots reach none of forbidden module trees +check:capability-subject — v1 files, capability subjects resolved through capabilityGovernedUserId. ``` The enforcement audit is all-or-nothing — one success line or findings, no migration mode that exits 0 with work outstanding. Because it reads source text it also refuses success when its own parsers come up empty or disagree with each other; if a self-check fires, teach the parsers the new form rather than working around it. diff --git a/.agents/skills/add-tools/SKILL.md b/.agents/skills/add-tools/SKILL.md index 985073b2b5d..e0f68e70c34 100644 --- a/.agents/skills/add-tools/SKILL.md +++ b/.agents/skills/add-tools/SKILL.md @@ -54,7 +54,7 @@ Every tool must use exactly one of these configurations: HTTP(S) provider endpoint. Never set a tool URL to `/api/...`, construct an absolute URL back to Sim, declare -`request.internal`, add the retired `directExecution` property, import a route module, or create an API route merely to normalize files, +`request.internal`, add a `directExecution` property (it fails `bun run check:tool-request-boundary`), import a route module, or create an API route merely to normalize files, authorize access, or reuse server code. A real browser/API route may remain as a thin adapter, but the route and the tool must call the same operation directly. A true cross-process/capability boundary uses an explicit server client and is not disguised as a tool self-hop. @@ -93,7 +93,7 @@ export const {serviceName}{Action}Tool: ToolConfig< }, params: { - // Hidden params (system-injected, only use hidden for oauth accessToken) + // Hidden params (system-injected, e.g. the OAuth accessToken) accessToken: { type: 'string', required: true, @@ -201,23 +201,66 @@ fallback, or caller-controlled `_context` authority. ## Resolved Secrets and Provenance Boundaries -- Leave ordinary external API inputs and third-party results unchanged. Add provenance handling only - when an exact field is proven to cross a Sim model, durable-storage, or internal-execution boundary. -- Project AI-consumed text/structured fields with the smallest exact model-input selector: - `request.modelInput` for an external request or `operation.modelInput` for an in-process operation. -- Treat URLs, domains, resource IDs, and control fields as ordinary request values unless the exact - field is proven model-visible. For serialized external model content, project the serialized - top-level param through `request.modelInput` before the existing formatter parses it; do not add a - separate hard-rejection mechanism. -- For in-process operations, use `operation.modelInput` for actual inline/raw model bytes or - `operation.secretProvenance` for durable writes and execution handoffs. Do not treat a storage key, - path, signed URL, or remote URL as provenance for fetched bytes; authorize tracked stored bytes at - the owning model-egress boundary. Validate the exact selection and trusted scope, then import or - propagate provenance at the receiving operation boundary. -- Never substitute secret plaintext into source, serialize plaintext provenance, hand-roll private - headers, or blanket-sanitize tool results. -- Add focused tests for named projection, identical unproven public text, malformed/incomplete - metadata, metadata stripping, scope isolation, and legacy compatibility where applicable. +Classify every request field before implementing the tool. + +This is opt-in, not a blanket integration migration. Add a model-input declaration only when the +service's official documentation or an unambiguous local execution path proves that the exact +field is consumed by an AI model. If that cannot be established, preserve existing tool behavior +and leave the field unannotated. + +- **Ordinary provider/API input:** leave it unchanged. Explicit `{{...}}` references resolve and are + sent with their normal request semantics. A URL, domain, resource ID, control field, or opaque + payload is not model-visible merely because the provider is AI-backed or may process the + referenced resource later. +- **Text or structured content consumed by an AI model:** declare `request.modelInput` for an + external provider request or `operation.modelInput` for an in-process operation, with + `mode: 'project'` and select only the exact model-visible fields. The shared executor replaces + activated Sim secrets with canonical `{{NAME}}` labels before request formatting. For nested or + JSON-string fields, use a small shared selector plus `applyProjected`; verify that selecting the + rebuilt params reproduces the projected selection. +- **Serialized model content sent directly to an external provider:** include the serialized + top-level param in `request.modelInput`. Project the private copy before the existing request + formatter parses it; keep formatter behavior deterministic when a whole-value placeholder is not + valid in the serialized grammar. Do not introduce a second hard-rejection path. +- **Opaque model input owned by an in-process operation** such as inline audio, image, video, or + document bytes: add `privateInputPaths` to the `mode: 'project'` operation model-input + declaration, or use `mode: 'private-provenance'` with `inputPaths` when there is no textual + projection (see the `modelInput` union in `apps/sim/tools/types.ts`). Do not select storage keys, + paths, signed URLs, or ordinary remote URLs as byte provenance; the owning operation must + authorize stored bytes independently at model egress. The operation must call + `validateOpaqueModelInputProvenance` before downloading or sending content to the model and must + apply the workspace-file provenance guard before reading a persisted workspace file. +- **Sim-owned durable storage or internal execution handoff** that can later enter a workflow/model + (table cells, Agent memory, knowledge documents/chunks, workspace-file contents, or child-workflow + input): transport encrypted field-scoped provenance with `operation.secretProvenance`. The + operation validates the exact selection and trusted scope, then persists, imports, or propagates + it at the owning boundary. Preserve shared legacy behavior for rows/files whose provenance marker + is `NULL`; never invent a tool-local migration rule. + +Hard rules: + +- Never substitute secret plaintext into source or serialize plaintext provenance. +- Never hand-roll private provenance headers/envelopes; the shared `executeTool` boundary owns + transport and strips private metadata from functional results. +- Never attach private provenance to an external URL. Project proven + model-visible external fields with `request.modelInput`; otherwise preserve ordinary request + semantics. Use a registered in-process operation when encrypted provenance must cross the + boundary. +- Never sanitize arbitrary third-party tool results. Projection applies only to secrets activated + by Sim's resolved-secret provenance for that execution/tool call. +- Do not add provenance merely because a value is persisted, returned by a tool, or appears in a + filename. Require a concrete Sim `{{...}}` resolution path and a later model/log boundary. If an + unsupported field can resolve a secret but does not justify durable tracking (for example a + `file_write` path), reject it at that exact ingress. +- At diagnostic boundaries, project only values carrying execution-scoped provenance. Ordinary + provider responses, filenames, URLs, and errors remain unchanged when Sim did not resolve a + secret into them. + +Add focused tests covering named projection, ordinary identical text without provenance, nested and +serialized shape handling, unchanged ordinary external inputs, malformed/incomplete private metadata +failing closed, headerless legacy requests, and absence of private metadata in the public tool result. +For durable sinks, also cover legacy `NULL` markers, exact-empty new writes, tracked secret writes, +stale/missing sidecars, and scope isolation. ## Critical Rules for Outputs @@ -275,9 +318,7 @@ items: { }, ``` -Only use bare `type: 'json'` without `properties` when the shape is truly dynamic or unknown. - -If the response shape is unknown because the docs do not provide it, you MUST tell the user and stop. Unknown is not the same as dynamic. Never guess outputs. +Only use bare `type: 'json'` without `properties` when the shape is truly dynamic. Unknown is not the same as dynamic — see the Hard Rule above. ## Critical Rules for transformResponse @@ -513,10 +554,6 @@ If creating V2 tools (API-aligned outputs), use `_v2` suffix: - Version: `'2.0.0'` - Outputs: Flat, API-aligned (no content/metadata wrapper) -## Naming Convention - -All tool IDs MUST use `snake_case`: `{service}_{action}` (e.g., `x_create_tweet`, `slack_send_message`). Never use camelCase or PascalCase for tool IDs. - ## Checklist Before Finishing - [ ] All tool IDs use snake_case @@ -544,9 +581,9 @@ All tool IDs MUST use `snake_case`: `{service}_{action}` (e.g., `x_create_tweet` ## Final Validation (Required) -After creating all tools, you MUST validate every tool before finishing: +Before finishing, validate each tool file against the API docs: -1. **Read every tool file** you created — do not skip any +1. **Re-read each tool file** you created 2. **Cross-reference with the API docs** to verify: - All required params are marked `required: true` - All optional params are marked `required: false` diff --git a/.agents/skills/add-trigger/SKILL.md b/.agents/skills/add-trigger/SKILL.md index c648b9d0d61..2e784a7f318 100644 --- a/.agents/skills/add-trigger/SKILL.md +++ b/.agents/skills/add-trigger/SKILL.md @@ -218,7 +218,7 @@ If none apply, you don't need a handler. The default handler provides bearer tok ```typescript import crypto from 'crypto' import { createLogger } from '@sim/logger' -import { safeCompare } from '@/lib/core/security/encryption' +import { safeCompare } from '@sim/security/compare' import type { EventMatchContext, FormatInputContext, FormatInputResult, WebhookProviderHandler } from '@/lib/webhooks/providers/types' import { createHmacVerifier } from '@/lib/webhooks/providers/utils' @@ -252,7 +252,7 @@ export const {service}Handler: WebhookProviderHandler = { return { input: { eventType: b.type, - resourceId: (b.data as Record)?.id || '', + resourceId: (b.data as Record)?.id ?? null, resource: b.data, }, } @@ -460,11 +460,17 @@ Add to `helm/sim/values.yaml` under the existing polling cron jobs: ```yaml {service}WebhookPoll: + enabled: true + name: {service}-webhook-poll schedule: "*/1 * * * *" + path: "/api/webhooks/poll/{service}" concurrencyPolicy: Forbid - url: "http://sim:3000/api/webhooks/poll/{service}" + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 1 ``` +Mirror the existing `rssWebhookPoll` entry. + ### Reference Implementations - Simple: `apps/sim/lib/webhooks/polling/rss.ts` + `apps/sim/triggers/rss/poller.ts` @@ -490,8 +496,10 @@ through `selectors.execute`; never add a client provider module or selector-only `canonicalParamId: 'oauthCredential'` on the credential sub-block is the line people forget. The shared context builder uses trigger mode and projects only active `dependsOn` values under their canonical ids. Exact `{{KEY}}` environment references remain unresolved until the authorized server -executor. A credential field is also recognized by its `oauth-input` type as a compatibility -fallback. +executor. The builder does not infer a credential from `type: 'oauth-input'`; only the legacy ids +`credential` / `botCredential` / `customBotCredential` / `manualBotCredential` are aliased. Give the +field `canonicalParamId: 'oauthCredential'`, or declare a manifest `sourceFields` alias when a +legacy source id must be retained. **`options` — everything else.** A static array, or a pure function of the block's own values for a list that narrows to a sibling's selection. No I/O. @@ -516,7 +524,8 @@ Webhook and polling routes are legitimate external ingress boundaries. They must Sim app's own API routes to reuse provider or business logic. Extract the shared provider operation or authorized application use case and call it directly from the trigger handler and any other server adapter. HTTP is reserved for an actual cross-process/capability boundary. Tool work uses a -registered `InternalToolConfig.operation`; the retired `directExecution` property must not return. +registered `InternalToolConfig.operation`; a `directExecution` property fails +`bun run check:tool-request-boundary`. ### Trigger Definition - [ ] Created `utils.ts` with options, instructions, extra fields, and output builders diff --git a/.agents/skills/babysit/SKILL.md b/.agents/skills/babysit/SKILL.md index 16f8cef5b32..d7bf60a75e4 100644 --- a/.agents/skills/babysit/SKILL.md +++ b/.agents/skills/babysit/SKILL.md @@ -73,10 +73,8 @@ conditions freshly after every push. reviewThreads(first: 50) { pageInfo { hasNextPage endCursor } nodes { id isResolved path line comments(first: 5) { nodes { id databaseId author { login } body } } } } } } }' ``` - `[.comments[]] | last | .body`, not `... | .body | tail -1` — the latter pipes every matching - comment's full multi-line body through the pipeline and keeps only the final *line* of that - combined output (usually the "Reviews (n): Last reviewed commit..." footer), not the last - *comment*, so it silently misses the actual "Confidence Score: X/5" line. + The score is a line inside the body of Greptile's *latest* comment (`| last | .body`), which + it edits in place across rounds. `reviewThreads(first: 50)` is a single page — check `pageInfo.hasNextPage`. If `true`, don't stop yet: re-run the same query with `after: ""` and keep paging until `hasNextPage` is `false` before evaluating "clean." A PR with more than 50 threads is rare but @@ -142,9 +140,6 @@ conditions freshly after every push. git fetch origin staging && git log --oneline --reverse origin/staging..HEAD gh pr view --json commits -q '.commits[].messageHeadline' ``` - `--reverse` makes `git log` oldest-first, matching the PR commit list's order — plain - `git log` is newest-first, so without it a positional comparison can spuriously fail on any - multi-commit branch. These two lists must describe the same commits. A review loop runs many pushes across many rounds; checking sync only before the push (step 6) and never after is how a bad push or a PR whose commit history quietly went stale between rounds goes unnoticed. @@ -177,13 +172,10 @@ thread count across both bots, and whether every check finished and passed. ## Public-repo hygiene Every reply, comment and commit you post here is public and permanent, and review bots quote -your replies back so a leak propagates. Before each post, strip anything that ties the change to -a tenant: customer/company names, workspace/user/org/KB/connector IDs, emails, tenant hostnames, -verbatim document/sheet/folder names, log lines, and per-tenant DB output. Cite the mechanism and -aggregate numbers instead — see `/ship`'s "What to Omit" for the full list and the pre-publish -grep. Triaging a finding often means pasting evidence you gathered from prod; that is exactly the -moment this gets violated. Check before posting, not after: editing a comment does not unsend its -notification email. +your replies back, so a leak propagates. `/ship`'s "What to Omit" (the category list and the +pre-publish grep) applies to every post in this loop. Triaging a finding often means pasting +evidence gathered from prod — that is exactly the moment it gets violated. Run the grep on the +reply before posting, not after: editing a comment does not unsend its notification email. ## Hard rules diff --git a/.agents/skills/cleanup/SKILL.md b/.agents/skills/cleanup/SKILL.md index c2b6fdf8de7..4a286d701ed 100644 --- a/.agents/skills/cleanup/SKILL.md +++ b/.agents/skills/cleanup/SKILL.md @@ -14,11 +14,11 @@ User arguments: $ARGUMENTS ## Step 1 — Parallel analysis (read-only) -First parse the user's `$ARGUMENTS` into `scope` and `fix`: extract the `fix=true|false` token wherever it appears in the string (start, middle, or end), and treat everything else — with that token removed — as `scope`. Defaults: `scope` = your current changes, `fix` = true. The `fix` value is consumed by Step 3 — it does NOT propagate to these passes, which always run `fix=false`. +Parse `$ARGUMENTS` into `scope` and `fix`: extract the `fix=true|false` token wherever it appears in the string and strip it from `scope`; defaults are the current changes and `fix=true`. `fix` is consumed by Step 3 only — the passes below always run `fix=false`. Spawn all eight passes concurrently as subagents in a **single message** (multiple Agent tool calls). Each runs its skill on the parsed `scope` with `fix=false` — analysis and proposals ONLY, no edits. Instruct each agent to return its findings as a structured list: for every proposed change, the file path, line range, a one-line description of the change, and the exact before/after so the orchestrator can apply it without re-deriving. -Run these eight in parallel, substituting the parsed `scope` for `` in each invocation (pass the real scope text, never the literal ``): +Run these eight in parallel on the parsed `scope`: 1. `/you-might-not-need-an-effect fix=false` 2. `/you-might-not-need-a-memo fix=false` @@ -57,7 +57,6 @@ After all edits, run `bun run lint:check` (it runs `turbo run lint:check` across Output a summary across all eight passes: what each found, what was applied vs. skipped-as-redundant, and any proposals that need a human decision. -## Boundary Audit Guidance +## Boundary findings -- When removing route-local Zod schemas, replacing raw `fetch(` calls in hooks, or removing `as unknown as X` casts, do not introduce `// boundary-raw-fetch: ` or `// double-cast-allowed: ` annotations to silence the audit. Fix the underlying call instead — adopt a contract from `@/lib/api/contracts/**` and use `requestJson(contract, ...)` from `@/lib/api/client/request`, or refine the type so the double cast is unnecessary. -- Annotations are reserved for legitimate exceptions only: streaming responses, binary downloads, multipart uploads, signed-URL flows, OAuth redirects, external-origin requests, and double casts where no narrower type is available. Each annotation requires a non-empty reason; empty reasons fail `bun run check:api-validation:strict`. +Never resolve a boundary finding by adding a `// boundary-raw-fetch` / `// double-cast-allowed` annotation — fix the call (adopt the contract + `requestJson`, or narrow the type). Annotations are only for the documented exceptions in CLAUDE.md → Boundary annotations. diff --git a/.agents/skills/design-taste-frontend/SKILL.md b/.agents/skills/design-taste-frontend/SKILL.md index 319e5200abf..f7f472a74e9 100644 --- a/.agents/skills/design-taste-frontend/SKILL.md +++ b/.agents/skills/design-taste-frontend/SKILL.md @@ -4,6 +4,8 @@ source: https://github.com/leonxlnx/taste-skill — skills/taste-skill/SKILL.md description: Anti-slop frontend skill for landing pages, portfolios, and redesigns. The agent reads the brief, infers the right design direction, and ships interfaces that do not look templated. Real design systems when applicable, audit-first on redesigns, strict pre-flight check. --- +> **In this repo:** Tailwind 3.4 (`apps/sim/tailwind.config.ts`); animation via `import { motion } from 'framer-motion'` (not `motion/react` — rewrite every `motion/react` import in the samples below); icons from `@sim/emcn/icons`; colors through the CSS-variable tokens in `.claude/rules/sim-styling.md` (no hardcoded `text-gray-*`/hex/`zinc` utilities, no paired `dark:` utilities). This note overrides any conflicting guidance or code sample anywhere in this file. + # tasteskill: Anti-Slop Frontend Skill > Landing pages, portfolios, and redesigns. Not dashboards, not data tables, not multi-step product UI. @@ -130,7 +132,7 @@ Unless the design read picks a real design system (Section 2.A), these are the d * **INTERACTIVITY ISOLATION:** Any component using Motion, scroll listeners, or pointer physics MUST be an isolated leaf with `'use client'` at the top. Server Components render static layouts only. * **Styling:** **Tailwind v4** (default). Tailwind v3 only if the existing project demands it. * For v4: do NOT use `tailwindcss` plugin in `postcss.config.js`. Use `@tailwindcss/postcss` or the Vite plugin. -* **Animation:** **Motion** (the library formerly known as Framer Motion). Import from `motion/react` (`import { motion } from "motion/react"`). The `framer-motion` package still works as a legacy alias - prefer `motion/react` in new code. +* **Animation:** **Motion** (the library formerly known as Framer Motion). Outside this repo import from `motion/react`; in this repo import from `framer-motion` (see the note at the top). * **Fonts:** Always use `next/font` (Next.js) or self-host with `@font-face` + `font-display: swap`. Never link Google Fonts via `` in production. ### 3.B State @@ -139,11 +141,7 @@ Unless the design read picks a real design system (Section 2.A), these are the d * **NEVER** use `useState` to track continuous values driven by user input (mouse position, scroll progress, pointer physics, magnetic hover). Use Motion's `useMotionValue` / `useTransform` / `useScroll`. `useState` re-renders the React tree on every change and collapses on mobile. ### 3.C Icons -* **Allowed libraries (priority order):** `@phosphor-icons/react`, `hugeicons-react`, `@radix-ui/react-icons`, `@tabler/icons-react`. -* **Discouraged:** `lucide-react`. Acceptable only when the user explicitly asks for it or the project already depends on it. -* **NEVER hand-roll SVG icons.** If a glyph is missing, install a second library or compose from primitives - do not draw icon paths from scratch. -* **One family per project.** Do not mix Phosphor with Lucide in the same component tree. -* **Standardize `strokeWidth` globally** (e.g. `1.5` or `2.0`). +* **Icons:** in this repo, `@sim/emcn/icons` only — one family per tree, `strokeWidth` standardized. Outside this repo, pick one maintained library and standardize on it. ### 3.D Emoji Policy Discouraged by default in code, markup, and visible text. Replace symbols with icon-library glyphs. **Override:** allow emojis only when the user explicitly asks for a playful / chat-style / social-native vibe - and even then use them sparingly with intent. @@ -171,51 +169,28 @@ LLMs default to clichés. Override these defaults proactively. Each rule has a c * **Override:** Inter is acceptable when the user explicitly asks for a neutral / standard / Linear-style feel, or when the brief is a public-sector / accessibility-first site. * **Pairings to know:** `Geist` + `Geist Mono`, `Satoshi` + `JetBrains Mono`, `Cabinet Grotesk` + `Inter Tight`, `GT America` + `IBM Plex Mono`. -* **SERIF DISCIPLINE (VERY DISCOURAGED AS DEFAULT):** - * Serif is **very discouraged as the default font for any project.** "It feels creative / premium / editorial" is NOT a reason to reach for serif. The agent's default mental model that "creative brief = serif" is the single most-tested AI tell in production rounds. - * **Serif is only acceptable when ONE of these is explicitly true:** - - The brand brief literally names a serif font, OR - - The aesthetic family is genuinely editorial / luxury / publication / manuscript / heritage / vintage AND you can articulate why this specific serif fits this specific brand - * For everything else (creative agency, design studio, modern brand, premium consumer, portfolio, lifestyle), **default sans-serif display** (Geist Display, ABC Diatype, Söhne Breit, Cabinet Grotesk Display, Migra Sans, GT Walsheim, Inter Display, PP Neue Montreal). Sans display fonts are not "boring" — they are the default for the same reason black is the default in fashion. - * **EMPHASIS RULE (related):** When you want to emphasize a word within a headline (the kinetic "and `spatial` design" type move), use **italic or bold of the SAME font**. Do NOT inject a random serif word into a sans headline (or vice versa) just to add visual interest. Mixed-family emphasis is amateur. Italic/bold emphasis in the same family is the right move. - * **Specifically BANNED as defaults:** `Fraunces` and `Instrument_Serif` (the two LLM-favorite display serifs). - * **If a serif is justified** (rare, per the above), rotate from this pool, do NOT reuse the same serif across consecutive projects: PP Editorial New, GT Sectra Display, Cardinal Grotesque, Reckless Neue, Tiempos Headline, Recoleta, Cormorant Garamond, Playfair Display, EB Garamond, IvyPresto, Migra, Editorial Old, Saol Display, Söhne Breit Kursiv, Domaine Display, Canela, Schnyder, Tobias, NB Architekt, ITC Galliard. +* **Serif discipline:** Default to a sans display face (Geist Display, ABC Diatype, Söhne Breit, Cabinet Grotesk Display, Migra Sans, GT Walsheim, Inter Display, PP Neue Montreal). Use a serif only when the brand names one or the aesthetic is genuinely editorial/luxury/heritage and you can say in one line why this serif fits this brand; `Fraunces` and `Instrument Serif` are the generic picks, so prefer another (PP Editorial New, GT Sectra Display, Reckless Neue, Tiempos Headline, Cormorant Garamond, EB Garamond, Domaine Display, Canela). Emphasize a word with italic or bold of the same family, not a second family. -* **ITALIC DESCENDER CLEARANCE (mandatory):** When italic is used in display type and the word contains a descender letter (`y g j p q`), `leading-[1]` or `leading-none` will clip the descender. Use `leading-[1.1]` minimum and add `pb-1` or `mb-1` reserve on the wrapping element. Audit every italic word in display headlines before shipping. +* **Italic descender clearance:** When italic is used in display type and the word contains a descender letter (`y g j p q`), `leading-[1]` or `leading-none` will clip the descender. Use `leading-[1.1]` minimum and add `pb-1` or `mb-1` reserve on the wrapping element. Audit every italic word in display headlines before shipping. ### 4.2 Color Calibration * Max 1 accent color. Saturation < 80% by default. -* **THE LILA RULE:** The "AI Purple / Blue glow" aesthetic is discouraged as a default. No automatic purple button glows, no random neon gradients. Use neutral bases (Zinc / Slate / Stone) with high-contrast singular accents (Emerald, Electric Blue, Deep Rose, Burnt Orange, etc.). +* **The lila rule:** The "AI Purple / Blue glow" aesthetic is discouraged as a default. No automatic purple button glows, no random neon gradients. Use neutral bases (Zinc / Slate / Stone) with high-contrast singular accents (Emerald, Electric Blue, Deep Rose, Burnt Orange, etc.). * **Override:** if the brand or brief explicitly asks for purple / violet / lila, embrace it. But execute with intent: consistent palette, harmonised neutrals, restrained gradients. Not generic AI gradient slop. * **One palette per project.** Do not fluctuate between warm and cool grays within the same project. -* **COLOR CONSISTENCY LOCK (mandatory):** Once an accent color is chosen for a page, it is used on the WHOLE page. A warm-grey site does not suddenly get a blue CTA in section 7. A rose-accented site does not get a teal status badge in the footer. Pick one accent, lock it, audit every component before shipping. - -* **PREMIUM-CONSUMER PALETTE BAN (mandatory, second-most-recurring AI-tell):** - * For premium-consumer briefs (cookware, wellness, artisan, luxury, heritage craft, DTC home goods, etc.) the LLM default is **warm beige/cream + brass/clay/oxblood/ochre + espresso/ink dark text**. Concretely banned hex families as default backgrounds and accents: - - Backgrounds: `#f5f1ea`, `#f7f5f1`, `#fbf8f1`, `#efeae0`, `#ece6db`, `#faf7f1`, `#e8dfcb` (all "warm paper / cream / chalk / bone") - - Accents: `#b08947`, `#b6553a`, `#9a2436`, `#9c6e2a`, `#bc7c3a`, `#7d5621` (all "brass / clay / oxblood / ochre") - - Text: `#1a1714`, `#1a1814`, `#1b1814` (all "espresso / warm near-black") - * This palette is BANNED as the default reach for premium-consumer briefs. Every premium-consumer site you have ever shipped uses this exact palette. The brand becomes invisible. - * **Default alternatives (rotate, do not reuse):** - - **Cold Luxury:** silver-grey + chrome + smoke (think Tesla, Apple Watch Hermes-without-the-leather) - - **Forest:** deep green + bone + amber accent (think Filson, Patagonia premium) - - **Black and Tan:** true off-black + warm tan, sharp contrast, no beige - - **Cobalt + Cream:** saturated blue against a single neutral, no brass - - **Terracotta + Slate:** warm rust against cool grey, no brass - - **Olive + Brick + Paper:** muted olive plus brick-red accent - - **Pure monochrome + single saturated pop:** off-white + off-black + one bright accent (electric blue, emerald, hot pink, etc.) - * **Palette-rotation rule:** if the previous premium-consumer project you generated used the beige+brass family, this one MUST use a different family. Do not ship the same warm-craft palette twice in a row. - * **Override:** the beige+brass+espresso palette is acceptable ONLY when the brand brief explicitly names those colors, or when the brand identity is genuinely vintage / artisan / warm-craft AND you can articulate why this specific palette fits this specific brand. Default-reaching for it because "this is a cookware brief" is banned. +* **Color consistency lock:** Once an accent color is chosen for a page, it is used on the whole page. A warm-grey site does not suddenly get a blue CTA in section 7. A rose-accented site does not get a teal status badge in the footer. Pick one accent, lock it, audit every component before shipping. + +* **Premium-consumer palettes:** For premium-consumer briefs (cookware, wellness, artisan, DTC home goods), the warm cream + brass/clay/oxblood + espresso palette is the generic default; choose the palette from the brand's own assets and state the reason in one line. Alternatives that read as premium without the cliché: cold silver/chrome, deep green + bone + amber, off-black + tan, cobalt + one neutral, terracotta + slate, olive + brick, monochrome + one saturated accent. ### 4.3 Layout Diversification -* **ANTI-CENTER BIAS:** Centered Hero / H1 sections are avoided when `DESIGN_VARIANCE > 4`. Force "Split Screen" (50/50), "Left-aligned content / right-aligned asset", "Asymmetric white-space", or scroll-pinned structures. +* **Anti-center bias:** Centered Hero / H1 sections are avoided when `DESIGN_VARIANCE > 4`. Prefer "Split Screen" (50/50), "Left-aligned content / right-aligned asset", "Asymmetric white-space", or scroll-pinned structures. * **Override:** centered hero is OK for editorial / manifesto / launch-announcement briefs where the message itself is the design. ### 4.4 Materiality, Shadows, Cards -* Use cards ONLY when elevation communicates real hierarchy. Otherwise group with `border-t`, `divide-y`, or negative space. +* Use cards only when elevation communicates real hierarchy. Otherwise group with `border-t`, `divide-y`, or negative space. * When a shadow is used, tint it to the background hue. No pure-black drop shadows on light backgrounds. -* For `VISUAL_DENSITY > 7`: generic card containers are banned. Data metrics breathe in plain layout. -* **SHAPE CONSISTENCY LOCK (mandatory):** Pick ONE corner-radius scale for the page and stick to it. Options: all-sharp (radius 0), all-soft (radius 12-16px), all-pill (full radius for interactive). Mixed systems are allowed only when there is a documented rule (e.g. "buttons are full-pill, cards are 16px, inputs are 8px") and that rule is followed everywhere. Round buttons in a square layout, or square cards on a pill-button page, is broken design. +* For `VISUAL_DENSITY > 7`: no generic card containers. Data metrics breathe in plain layout. +* **Shape consistency lock:** Pick one corner-radius scale for the page and stick to it. Options: all-sharp (radius 0), all-soft (radius 12-16px), all-pill (full radius for interactive). Mixed systems are allowed only when there is a documented rule (e.g. "buttons are full-pill, cards are 16px, inputs are 8px") and that rule is followed everywhere. Round buttons in a square layout, or square cards on a pill-button page, is broken design. ### 4.5 Interactive UI States LLMs default to "static successful state only." Always implement full cycles: @@ -223,63 +198,63 @@ LLMs default to "static successful state only." Always implement full cycles: * **Empty States:** Beautifully composed; indicate how to populate. * **Error States:** Clear, inline (forms), or contextual (toasts only for transient). * **Tactile Feedback:** On `:active`, use `-translate-y-[1px]` or `scale-[0.98]` to simulate a physical push. -* **BUTTON CONTRAST CHECK (mandatory, a11y):** Before shipping any button, verify the button text is readable against the button background. White button + white text, `bg-white` CTA with `text-white` label, transparent button against the page background with no border → all banned. Audit every CTA: contrast ratio WCAG AA min (4.5:1 for body, 3:1 for large text 18px+). Same rule applies to ghost buttons over photographic backgrounds (use a backdrop, scrim, or stroke). -* **CTA BUTTON WRAP BAN (mandatory):** Button text MUST fit on one line at desktop. If a label like "VIEW SELECTED WORK" wraps to 2 or 3 lines, the button is broken. Fix by EITHER shortening the label (3 words max for primary CTAs, ideally 1-2) OR widening the button (do not artificially constrain `max-width` on CTAs). Wrapped CTAs at desktop are a Pre-Flight Fail. -* **NO DUPLICATE CTA INTENT (mandatory):** Two CTAs with the same intent on one page is a Pre-Flight Fail. Examples of same intent: "Get in touch" + "Contact us" + "Let's talk" + "Start a project" + "Start something" + "Reach out" = all "contact" intent → pick ONE label and use it everywhere on the page (nav, hero, footer). Same for "Try free" + "Get started" + "Sign up free" (all "signup" intent) and "View work" + "See selected work" + "Browse projects" (all "portfolio" intent). One label per intent. -* **FORM CONTRAST CHECK (mandatory, a11y):** Form inputs, placeholder text, focus rings, helper text, and error text all pass WCAG AA contrast against the section background. Light placeholders on a near-white form, white form on white page section, form labels grayer than 4.5:1 contrast → all banned. Audit every form before shipping. +* **Button contrast check (a11y):** Before shipping any button, verify the button text is readable against the button background: no white button + white text, no `bg-white` CTA with `text-white` label, no transparent button against the page background without a border. Audit every CTA: contrast ratio WCAG AA min (4.5:1 for body, 3:1 for large text 18px+). Same rule applies to ghost buttons over photographic backgrounds (use a backdrop, scrim, or stroke). +* **CTA button wrap:** Button text fits on one line at desktop. If a label like "VIEW SELECTED WORK" wraps to 2 or 3 lines, the button is broken. Fix by either shortening the label (3 words max for primary CTAs, ideally 1-2) OR widening the button (do not artificially constrain `max-width` on CTAs). Wrapped CTAs at desktop are a Pre-Flight Fail. +* **No duplicate CTA intent:** Two CTAs with the same intent on one page is a Pre-Flight Fail. Examples of same intent: "Get in touch" + "Contact us" + "Let's talk" + "Start a project" + "Start something" + "Reach out" = all "contact" intent → pick ONE label and use it everywhere on the page (nav, hero, footer). Same for "Try free" + "Get started" + "Sign up free" (all "signup" intent) and "View work" + "See selected work" + "Browse projects" (all "portfolio" intent). One label per intent. +* **Form contrast check (a11y):** Form inputs, placeholder text, focus rings, helper text, and error text all pass WCAG AA contrast against the section background: no light placeholders on a near-white form, no white form on a white section, no labels below 4.5:1. Audit every form before shipping. ### 4.6 Data & Form Patterns * Label ABOVE input. Helper text optional but present in markup. Error text BELOW input. Standard `gap-2` for input blocks. * No placeholder-as-label. Ever. -### 4.7 Layout Discipline (Hard Rules. Failing any of these is shipping broken work) +### 4.7 Layout Discipline -* **Hero MUST fit in the initial viewport.** Headline max 2 lines on desktop, subtext max **20 words** AND max 3-4 lines, CTAs visible without scroll. If the copy is too long: reduce font scale OR cut copy. If you cannot describe the value-prop in 20 words of subtext, the value-prop is unclear, not the rule too tight. Never let the hero overflow and force scroll to find the CTA. +* **Hero fits in the initial viewport.** Headline max 2 lines on desktop, subtext max **20 words** AND max 3-4 lines, CTAs visible without scroll. If the copy is too long: reduce font scale OR cut copy. If you cannot describe the value-prop in 20 words of subtext, the value-prop is unclear, not the rule too tight. Never let the hero overflow and force scroll to find the CTA. * **Hero font-scale discipline.** Plan font size and image size *together*. If the hero asset is large and the headline is more than 6 words, do not start at `text-7xl/text-8xl`. Default sensible range: `text-4xl md:text-5xl lg:text-6xl` for most heroes; `text-6xl md:text-7xl` only when the headline is 3-5 words. A 4-line hero headline is always a font-size error, never a copy-length error. -* **HERO TOP PADDING CAP (mandatory):** Hero top padding max `pt-24` (≈6rem) at desktop. More than that means the hero content floats halfway down the viewport and reads as a layout bug, not as intentional space. If your hero needs more breathing room, increase font scale or asset size, not top padding. -* **HERO STACK DISCIPLINE (max 4 text elements).** The hero is a single moment, not a feature list. Allowed text elements, max 4 in total: +* **Hero top padding cap:** Hero top padding max `pt-24` (≈6rem) at desktop. More than that means the hero content floats halfway down the viewport and reads as a layout bug, not as intentional space. If your hero needs more breathing room, increase font scale or asset size, not top padding. +* **Hero stack discipline (max 4 text elements).** The hero is a single moment, not a feature list. Allowed text elements, max 4 in total: 1. Eyebrow (small uppercase label) OR brand strip OR neither - pick zero or one 2. Headline (max 2 lines, see above) 3. Subtext (max 20 words, max 4 lines) 4. CTAs (1 primary + max 1 secondary) - - **BANNED in the hero:** tiny tagline below CTAs ("Works with GitHub, GitLab, and self-hosted Git"), trust micro-strip ("Used by engineering teams at..."), pricing teaser ("Free for solo, $10/user for teams"), feature bullet list, social-proof avatar row. All of those move to dedicated sections directly below the hero. + - **Not in the hero:** tiny tagline below CTAs ("Works with GitHub, GitLab, and self-hosted Git"), trust micro-strip ("Used by engineering teams at..."), pricing teaser ("Free for solo, $10/user for teams"), feature bullet list, social-proof avatar row. All of those move to dedicated sections directly below the hero. - If you have an eyebrow AND a tagline below CTAs in the same hero, drop the tagline. If you have a brand strip AND a tagline, drop the tagline. One small text element per hero, max. -* **"Used by" / "Trusted by" logo wall belongs UNDER the hero, never inside it.** The hero is for the value prop and primary CTA. The logo wall is a separate section directly below. Do not stuff trust logos into the same flex row as the hero copy. -* **Navigation MUST render on a single line on desktop.** If items don't fit at `lg` (1024px), condense labels, drop secondary items, or move to a hamburger. A two-line nav at desktop is broken design. +* **"Used by" / "Trusted by" logo wall belongs under the hero, not inside it.** The hero is for the value prop and primary CTA. The logo wall is a separate section directly below. Do not stuff trust logos into the same flex row as the hero copy. +* **Navigation renders on a single line on desktop.** If items don't fit at `lg` (1024px), condense labels, drop secondary items, or move to a hamburger. A two-line nav at desktop is broken design. * **Navigation height cap: 80px max desktop, default 64-72px.** No huge "agency" nav bars that eat 15% of the viewport. -* **Bento grids MUST have rhythm, not one-sided repetition.** Do not stack 6 left-image / right-text rows. Vary the composition: alternate full-width feature rows, asymmetric tile sizes, vertical breaks. -* **BENTO CELL COUNT RULE (mandatory):** A bento grid has EXACTLY as many cells as you have content for. 3 items → 3 cells (1+2 split, or 2+1, or asymmetric trio). 5 items → 5 cells (2+3, 3+2, hero+4, etc.). If your grid has an empty cell in the middle or at the end, you planned wrong. Re-shape the grid; do not paste a blank tile. +* **Bento grids have rhythm, not one-sided repetition.** Do not stack 6 left-image / right-text rows. Vary the composition: alternate full-width feature rows, asymmetric tile sizes, vertical breaks. +* **Bento cell count:** A bento grid has exactly as many cells as you have content for. 3 items → 3 cells (1+2 split, or 2+1, or asymmetric trio). 5 items → 5 cells (2+3, 3+2, hero+4, etc.). If your grid has an empty cell in the middle or at the end, you planned wrong. Re-shape the grid; do not paste a blank tile. * **Section-Layout-Repetition Ban.** Once you use a layout family for a section (e.g., 3-column-image-cards, full-width-quote, split-text-image), that family can appear at most ONCE on the page. "Selected commissions" must not look like "What we do." A landing page with 8 sections must use at least 4 different layout families. -* **ZIGZAG ALTERNATION CAP (mandatory).** Alternating "left-image + right-text" then "left-text + right-image" zigzag layout = banal. Max 2 sections in a row with this image+text-split pattern. The 3rd consecutive image+text split is a Pre-Flight Fail. Break the pattern with a full-width section, a vertical-stack section, a bento grid, a marquee, or a different layout family. -* **EYEBROW RESTRAINT (mandatory, the #1 violated rule in production tests).** An "eyebrow" is the small uppercase wide-tracking label sitting above a section headline (e.g. `FOUR COLORWAYS`, `SELECTED WORK`, `THE HARDWARE`, `Git-native task management`). Typical CSS signature: `text-[11px] uppercase tracking-[0.18em]`, `font-mono text-[10.5px] uppercase tracking-[0.22em]`. Every AI-built site puts an eyebrow above EVERY section header, producing the same templated rhythm. Hard rule: +* **Zigzag alternation cap.** Alternating "left-image + right-text" then "left-text + right-image" zigzag layout = banal. Max 2 sections in a row with this image+text-split pattern. The 3rd consecutive image+text split is a Pre-Flight Fail. Break the pattern with a full-width section, a vertical-stack section, a bento grid, a marquee, or a different layout family. +* **Eyebrow restraint.** An "eyebrow" is the small uppercase wide-tracking label sitting above a section headline (e.g. `FOUR COLORWAYS`, `SELECTED WORK`, `THE HARDWARE`, `Git-native task management`). Typical CSS signature: `text-[11px] uppercase tracking-[0.18em]`, `font-mono text-[10.5px] uppercase tracking-[0.22em]`. Every AI-built site puts an eyebrow above EVERY section header, producing the same templated rhythm. Hard rule: - **Maximum 1 eyebrow per 3 sections.** Hero counts as 1. So a page with 9 sections may use at most 3 eyebrows total. - If section A has an eyebrow, the next 2 sections cannot have one. - **Pre-Flight Check is mechanical:** count instances of `uppercase tracking` (or similar small-caps mono labels above headlines) across all section components. If count > ceil(sectionCount / 3), the output fails. - **What to do instead of an eyebrow:** drop it entirely. The headline alone is enough. If you need to categorize a section, the section's location on the page already categorizes it; no label needed. -* **SPLIT-HEADER BAN (mandatory).** The pattern "left big headline + right small explainer paragraph" as a section header (left col-span-7/8, right col-span-4/5 with a small body paragraph floating in the right column) is **banned as default**. Sections should have ONE focused message. If you genuinely need both a headline and an explainer paragraph, stack them vertically (headline on top, body below, max-width 65ch). Reach for the split-header pattern only when there is a real compositional reason (e.g., the right column carries a visual or interactive element, not just filler text). -* **Bento Background Diversity (mandatory).** Bento and feature-grid sections cannot be 6 white-on-white cards with text inside. At least 2-3 cells in any multi-cell grid need real visual variation: a real image, a brand-appropriate gradient (not AI-purple), a pattern, a tinted background. A cream-on-cream bento with only typography inside reads as boring AI default, even when the rest of the page is good. +* **Split-header.** The pattern "left big headline + right small explainer paragraph" as a section header (left col-span-7/8, right col-span-4/5 with a small body paragraph floating in the right column) is not a default. Sections should have ONE focused message. If you genuinely need both a headline and an explainer paragraph, stack them vertically (headline on top, body below, max-width 65ch). Reach for the split-header pattern only when there is a real compositional reason (e.g., the right column carries a visual or interactive element, not just filler text). +* **Bento background diversity.** Bento and feature-grid sections cannot be 6 white-on-white cards with text inside. At least 2-3 cells in any multi-cell grid need real visual variation: a real image, a brand-appropriate gradient (not AI-purple), a pattern, a tinted background. A cream-on-cream bento with only typography inside reads as boring AI default, even when the rest of the page is good. * **Mobile collapse must be explicit per section.** For every multi-column layout, declare the `< 768px` fallback in the same component. No "it'll work, Tailwind handles it" assumptions. ### 4.8 Image & Visual Asset Strategy -Landing pages and portfolios are **visual products**. Text-only pages with fake-screenshot divs are slop. +Landing pages and portfolios are **visual products**. Text-only pages with fake-screenshot divs read as unfinished. **Priority order for visual assets:** -1. **Image-generation tool first.** If ANY image-gen tool is available in the environment (`generate_image`, MCP image tool, IDE-integrated gen, OpenAI image tools, etc.) you MUST use it to create section-specific assets: hero photography, product shots, texture backgrounds, mood images. Generate at the right aspect ratio for the section. Do not skip this step because hand-rolled CSS feels faster. +1. **Image-generation tool first.** When an image-gen tool is available, use it for section-specific assets (hero photography, product shots, textures) at the section's aspect ratio. 2. **Real web images second.** When no gen tool is available, use real photography sources. Acceptable defaults: * `https://picsum.photos/seed/{descriptive-seed}/{w}/{h}` for placeholder photography (seed should describe the section, e.g. `marrow-cookware-kitchen`) * Actual stock or brand URLs when the brief provides them * Open-license sources (Unsplash via direct URL, Pexels) if explicitly allowed -3. **Last resort: tell the user.** If neither is possible, do NOT fill the page with hand-rolled SVG illustrations or div-based "fake screenshots." Instead, leave clearly-labeled placeholder slots (``) and at the end of the response say: *"This page needs real images at: \[list of placements\]. Please generate or provide them."* +3. **Last resort: tell the user.** If neither is possible, do not fill the page with hand-rolled SVG illustrations or div-based "fake screenshots." Instead, leave clearly-labeled placeholder slots (``) and at the end of the response say: *"This page needs real images at: \[list of placements\]. Please generate or provide them."* **Even minimalist sites need real images.** A pure-text page is not minimalism. It is incomplete work. Even an editorial Linear-style site needs at least 2-3 real images (hero, one product/lifestyle shot, one supporting image). Generate B&W minimalist photography if the brief is restrained; do not skip images entirely because the dial is low. -**Real company logos for social proof.** When the brief calls for a "Trusted by / Used by / Customers" logo wall, do NOT default to plain text wordmarks (`Acme Co` styled in a row). Use real SVG logos: +**Real company logos for social proof.** When the brief calls for a "Trusted by / Used by / Customers" logo wall, do not default to plain text wordmarks (`Acme Co` styled in a row). Use real SVG logos: * **Source: Simple Icons** (`https://cdn.simpleicons.org/{slug}/ffffff` for any color, or `simple-icons` npm package). Covers most known brands. * **Alternative: devicon** for tech-stack logos (`@svgr/cli` or CDN). * **Make-up the brand name? Then make-up an SVG mark too.** Generate a simple monogram (one letter in a circle, two-letter ligature, abstract glyph) rendered as an inline `` matching the page style. Plain text wordmarks for invented brand names look generic. * **Always** ensure logos render in both light and dark mode (white-on-dark, black-on-light, or single-color theme variable). -* **LOGO-ONLY rule (mandatory):** logo wall = logos and nothing else. Do NOT print industry / category labels below each logo (no `Vercel` + `hosting` underneath, no `Stripe` + `payments`, no `Cloudflare` + `infra`). The logo is the credibility, the label adds nothing the user does not already know. Optional: brand name as alt-text for screen readers, optional link to the brand's site. That is it. +* **Logo-only rule:** logo wall = logos and nothing else. Do not print industry / category labels below each logo (no `Vercel` + `hosting` underneath, no `Stripe` + `payments`, no `Cloudflare` + `infra`). The logo is the credibility, the label adds nothing the user does not already know. Optional: brand name as alt-text for screen readers, optional link to the brand's site. That is it. **Hand-rolled illustrations:** * SVG icons from libraries: fine (see Section 3.C). @@ -288,7 +263,7 @@ Landing pages and portfolios are **visual products**. Text-only pages with fake- - It's a single, simple geometric mark (a square, a circle, a wordmark in display type) - You're confident in the output quality -**Div-based fake screenshots are banned.** A "hand-built product preview" rendered with `
` rectangles, fake task lists, fake dashboards, fake terminal windows is a Tell. If you need to show a product: +**No div-based fake screenshots.** A "hand-built product preview" rendered with `
` rectangles, fake task lists, fake dashboards, fake terminal windows is a Tell. If you need to show a product: * Use a real screenshot URL if one exists * Generate one via image tool * Use a real component preview (an actual mini-version of the UI inside the page) @@ -313,13 +288,13 @@ Landing pages live on the **first impression**, not the full read. Cut ruthlessl - Carousel for breadth-heavy lists (testimonials, logos, capabilities) - Marquee for "lots-of-things-that-don't-need-individual-attention" A spec sheet with 10 rows + a hairline under every row is the WORST default. Either group rows into 2-3 chunks with sparse dividers, or move to a card-per-spec layout. -* **Spec sheets specifically (the Marrow-cookware pattern).** A long product specification table with `border-b` on every row is the AI default for cookware / hardware / apparel / artisan-goods briefs. Banned. Concrete alternatives: +* **Spec sheets specifically.** A long product specification table with `border-b` on every row is the generic default for cookware / hardware / apparel / artisan-goods briefs. Concrete alternatives: - **2-col card grid:** each spec gets its own card with the spec name, the value (large display number), and a one-line "why it matters" body. Cards arranged 2-col on desktop, 1-col mobile. - **Scroll-snap horizontal pills:** each spec is a pill, user can flick through. - **Grouped chunks:** group 10 specs into 3 logical clusters (e.g. "Materials", "Cooking", "Warranty"), each cluster gets ONE soft divider and a cluster heading. - **Featured-vs-rest:** 3-4 hero specs visualised as large display tiles, the rest collapsed under a "View full specifications" disclosure. -* **COPY SELF-AUDIT (mandatory before ship):** Before declaring any task done, re-read every visible string on the page (headlines, subheads, eyebrows, button labels, body copy, captions, alt text, footer text, error messages). Flag any string that is: +* **Copy self-audit before ship:** Before declaring any task done, re-read every visible string on the page (headlines, subheads, eyebrows, button labels, body copy, captions, alt text, footer text, error messages). Flag any string that is: - **Grammatically broken** ("free on its past", "two plans but one is honest", "to put it on the table" out of context) - **Has unclear referents** ("we plan to stay that way" without prior context) - **Sounds like AI hallucination** (cute-but-wrong wordplay, forced metaphors that don't track, "elegant nothing" phrases) @@ -335,15 +310,15 @@ Landing pages live on the **first impression**, not the full read. Cut ruthlessl * **Max 3 lines** of quote body. Never 6. If the original quote is longer → cut it. A landing-page quote is a snippet, not the full review. * For very small font sizes (e.g. footer-style testimonials), the line cap can stretch slightly. Spirit: "fits in a glance." -* **No em-dashes inside the quote text** as design flourish (long pauses, kinetic em-dashes, em-dash-bullets). See Section 9.G - em-dash is completely banned. +* No em-dashes in quote text (Section 9.G). * Attribution: name + role + (optionally) company. Never name only ("- Sarah"). * Quote marks: use real typographic quotes ( " " ) or none at all. Not straight ASCII ( " ). ### 4.11 Page Theme Lock (Light / Dark Mode Consistency) -The page has ONE theme. Sections do not invert. +The page has one theme. Sections do not invert. -* If the page is dark mode, ALL sections are dark mode. No light-mode-warm-paper section sandwiched between dark sections (or vice versa). The user must not feel they walked into a different website mid-scroll. +* If the page is dark mode, all sections are dark mode. No light-mode-warm-paper section sandwiched between dark sections (or vice versa). The user must not feel they walked into a different website mid-scroll. * The exception: if the brief explicitly calls for a "Color Block Story" or "Theme Switch on Scroll" device AND that is a deliberate composition (one full theme switch with a strong transition, not random alternation), it is allowed once per page. * Default behaviour: pick light, dark, or auto (`prefers-color-scheme`) at the page level and lock it. Section-level background tints within the same theme family are fine (`bg-zinc-950` next to `bg-zinc-900`); flipping to `bg-amber-50` in the middle of a `bg-zinc-950` page is broken. * When using a design system with built-in theming (Radix Themes, shadcn/ui with ``), set the theme ONCE in `layout.tsx` or the page root. Do not let individual sections override. @@ -355,11 +330,11 @@ The page has ONE theme. Sections do not invert. These are tools, not defaults. Use them when the design read calls for them. **None of these fire automatically.** * **Liquid Glass / Glassmorphism:** Appropriate for premium consumer, Apple-adjacent, luxury brand, or media-overlay vibes. Inappropriate for dashboards, public-sector, or "boring B2B." When used, go beyond `backdrop-blur`: add a 1px inner border (`border-white/10`) and a subtle inner shadow (`shadow-[inset_0_1px_0_rgba(255,255,255,0.1)]`) for physical edge refraction. Provide a solid-fill fallback under `prefers-reduced-transparency`. -* **Magnetic Micro-physics:** Use when `MOTION_INTENSITY > 5` AND the brief reads premium / playful / agency. Implement EXCLUSIVELY with Motion's `useMotionValue` / `useTransform` outside the React render cycle. Never `useState`. See Section 3.B. +* **Magnetic Micro-physics:** Use when `MOTION_INTENSITY > 5` and the brief reads premium / playful / agency. Implement with Motion's `useMotionValue` / `useTransform` outside the React render cycle, not `useState`. See Section 3.B. * **Perpetual Micro-Interactions** (Pulse, Typewriter, Float, Shimmer, Carousel): Use when `MOTION_INTENSITY > 5` AND the section actively benefits from motion (status indicators, live feeds, AI-feel). **Not every card needs an infinite loop.** If a section is informational, leave it still. Apply Spring Physics (`type: "spring", stiffness: 100, damping: 20`) - no linear easing. * **"Motion claimed, motion shown."** If `MOTION_INTENSITY > 4`, the page must actually move: entry transitions on hero, scroll-reveal on key sections, hover physics on CTAs, at minimum. A static page that claims `MOTION_INTENSITY: 7` is broken. Conversely, if you cannot ship working motion in the available scope, drop the dial to 3 and ship a clean static page. Never half-build motion that breaks (cut-off ScrollTriggers, jumpy enters, missing cleanups). -* **MOTION MUST BE MOTIVATED (mandatory).** Before adding any animation, ask: "what does this animation communicate?" Valid answers: hierarchy (drawing attention to the right thing), storytelling (revealing content in sequence that matches a narrative), feedback (acknowledging a user action), state transition (showing something changed). Invalid answer: "it looked cool". GSAP everywhere because GSAP is available is amateur. Each ScrollTrigger, each marquee, each pinned section needs a reason. If you cannot articulate the reason in one sentence, drop the animation. -* **MARQUEE MAX-ONE-PER-PAGE (mandatory).** Horizontal scrolling text marquees ("logos endlessly scrolling", "manifesto scrolling sideways", "kinetic word strip") are appropriate at most ONCE per page. Two or more marquees on the same page reads as lazy filler. Pick the one section where the marquee actually serves the content; the others get a different layout. +* **Motion is motivated.** Before adding any animation, ask: "what does this animation communicate?" Valid answers: hierarchy (drawing attention to the right thing), storytelling (revealing content in sequence that matches a narrative), feedback (acknowledging a user action), state transition (showing something changed). Invalid answer: "it looked cool". GSAP everywhere because GSAP is available is amateur. Each ScrollTrigger, each marquee, each pinned section needs a reason. If you cannot articulate the reason in one sentence, drop the animation. +* **Marquee: at most one per page.** Horizontal scrolling text marquees ("logos endlessly scrolling", "manifesto scrolling sideways", "kinetic word strip") are appropriate at most ONCE per page. Two or more marquees on the same page reads as lazy filler. Pick the one section where the marquee actually serves the content; the others get a different layout. * **GSAP Sticky-Stack Pattern (when scroll-stack is used).** A "card stack on scroll" must be a REAL sticky-stack, not a sequential reveal list. See Section 5.A below for the canonical code skeleton. Common failure: trigger fires halfway through scroll instead of pinning at viewport top. Fix: `start: "top top"` not `start: "top center"` or `"top 80%"`. * **GSAP Horizontal-Pan Pattern (when horizontal scroll-hijack is used).** See Section 5.B below for the canonical skeleton. Common failure: animation starts before the section is pinned, so the user sees half a slide. Same fix: `start: "top top"`, pin the wrapper, scrub the inner track. @@ -509,28 +484,28 @@ Use this for: feature lists, testimonial grids, logo walls, anything that just n ### 5.D Forbidden Animation Patterns -* **`window.addEventListener("scroll", ...)`** is banned. It runs on every scroll frame, jank-prone, no batching. Use Motion's `useScroll()`, GSAP's `ScrollTrigger`, IntersectionObserver, or CSS `scroll-driven animations` (`animation-timeline: view()`). +* **`window.addEventListener("scroll", ...)`.** It runs on every scroll frame, jank-prone, no batching. Use Motion's `useScroll()`, GSAP's `ScrollTrigger`, IntersectionObserver, or CSS `scroll-driven animations` (`animation-timeline: view()`). * **Custom scroll progress calculations using `window.scrollY`** in React state. Same reason. Re-renders on every frame. * **`requestAnimationFrame` loops that touch React state.** Use motion values (`useMotionValue` + `useTransform`) instead. * **Layout Transitions:** Use Motion's `layout` and `layoutId` props for visible state changes (re-ordering lists, expanding modals, shared elements between routes). Do not wrap static content in `layout` props "for safety" - it costs measurement work. -* **Staggered Orchestration:** Use `staggerChildren` (Motion) or CSS cascade (`animation-delay: calc(var(--index) * 100ms)`) for reveal moments where sequence matters. For `staggerChildren`, parent (`variants`) and children MUST share the same Client Component tree. +* **Staggered Orchestration:** Use `staggerChildren` (Motion) or CSS cascade (`animation-delay: calc(var(--index) * 100ms)`) for reveal moments where sequence matters. For `staggerChildren`, parent (`variants`) and children share the same Client Component tree. --- ## 6. PERFORMANCE & ACCESSIBILITY GUARDRAILS ### 6.A Hardware Acceleration -* Animate ONLY `transform` and `opacity`. Never animate `top`, `left`, `width`, `height`. +* Animate only `transform` and `opacity`, not `top`, `left`, `width`, `height`. * Use `will-change: transform` sparingly - only on elements that will actually animate. -### 6.B Reduced Motion (mandatory) -* **Any motion above `MOTION_INTENSITY > 3` MUST honor `prefers-reduced-motion`.** This is non-negotiable. +### 6.B Reduced Motion +* **Any motion above `MOTION_INTENSITY > 3` honors `prefers-reduced-motion`.** * In Motion: wrap with `useReducedMotion()` and degrade to static. * In CSS: gate animations behind `@media (prefers-reduced-motion: no-preference)` or provide an override block under `@media (prefers-reduced-motion: reduce)` that disables. -* Infinite loops, parallax, scroll-hijack, and magnetic physics MUST collapse to static / instant under reduced motion. +* Infinite loops, parallax, scroll-hijack, and magnetic physics collapse to static / instant under reduced motion. -### 6.C Dark Mode (mandatory for any consumer-facing page) -* Design for **both modes from the start**. Never ship light-only or dark-only without explicit user instruction. +### 6.C Dark Mode (consumer-facing pages) +* Design for **both modes from the start**; ship light-only or dark-only only on explicit user instruction. * Use Tailwind `dark:` variant OR CSS variables for tokens. Pick one strategy per project. * **Do not prescribe specific dark-mode colors here.** The brief decides. Maintain visual hierarchy, brand identity, and WCAG AA contrast (AAA for body) across both modes. * Respect `prefers-color-scheme: dark`. Default to system preference unless the brand insists on one mode. @@ -542,11 +517,11 @@ Use this for: feature lists, testimonial grids, logo walls, anything that just n * Run Lighthouse before declaring a page done. ### 6.E DOM Cost -* Apply grain / noise filters EXCLUSIVELY to fixed, `pointer-events-none` pseudo-elements (e.g., `fixed inset-0 z-[60] pointer-events-none`). NEVER on scrolling containers - continuous GPU repaints destroy mobile FPS. +* Apply grain / noise filters only to fixed, `pointer-events-none` pseudo-elements (e.g., `fixed inset-0 z-[60] pointer-events-none`), not to scrolling containers - continuous GPU repaints destroy mobile FPS. * Be aware of bundle size. Motion is not tiny. Three.js is large. Lazy-load anything that's not above-the-fold. ### 6.F Z-Index Restraint -NEVER spam arbitrary `z-50` or `z-10`. Use z-index strictly for systemic layer contexts (sticky navbars, modals, overlays, grain). Document the z-index scale in a project constants file. +No arbitrary `z-50` or `z-10`. Use z-index only for systemic layer contexts (sticky navbars, modals, overlays, grain). Document the z-index scale in a project constants file. --- @@ -556,17 +531,17 @@ NEVER spam arbitrary `z-50` or `z-10`. Use z-index strictly for systemic layer c * **1-3 (Predictable):** Symmetrical CSS Grid (12-col, equal fr-units), equal paddings, centered alignment. * **4-7 (Offset):** `margin-top: -2rem` overlaps, varied image aspect ratios (4:3 next to 16:9), left-aligned headers over center-aligned data. * **8-10 (Asymmetric):** Masonry layouts, CSS Grid with fractional units (`grid-template-columns: 2fr 1fr 1fr`), massive empty zones (`padding-left: 20vw`). -* **MOBILE OVERRIDE:** For levels 4-10, asymmetric layouts above `md:` MUST collapse to strict single-column (`w-full`, `px-4`, `py-8`) on viewports `< 768px`. +* **Mobile override:** For levels 4-10, asymmetric layouts above `md:` collapse to strict single-column (`w-full`, `px-4`, `py-8`) on viewports `< 768px`. ### MOTION_INTENSITY (Level 1-10) * **1-3 (Static):** No automatic animations. CSS `:hover` and `:active` states only. `prefers-reduced-motion` is the default mode anyway. -* **4-7 (Fluid CSS):** `transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1)`. `animation-delay` cascades for load-ins. Focus on `transform` and `opacity`. -* **8-10 (Advanced Choreography):** Complex scroll-triggered reveals, parallax, scroll-driven animation (CSS `animation-timeline` or GSAP ScrollTrigger). Use Motion hooks. **NEVER use `window.addEventListener('scroll')`** - it is a hard ban, not a "prefer-not." See Section 5.D for the allowed alternatives. +* **4-7 (Fluid CSS):** `transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1)`; never `transition: all`. `animation-delay` cascades for load-ins. Focus on `transform` and `opacity`. +* **8-10 (Advanced Choreography):** Complex scroll-triggered reveals, parallax, scroll-driven animation (CSS `animation-timeline` or GSAP ScrollTrigger). Use Motion hooks, never `window.addEventListener('scroll')` (Section 5.D has the alternatives). ### VISUAL_DENSITY (Level 1-10) * **1-3 (Art Gallery):** Lots of white space. Huge section gaps (`py-32` to `py-48`). Expensive, clean. * **4-7 (Daily App):** Standard web app spacing (`py-16` to `py-24`). -* **8-10 (Cockpit):** Tight paddings. No card boxes; 1px lines separate data. Mandatory: `font-mono` for all numbers. +* **8-10 (Cockpit):** Tight paddings. No card boxes; 1px lines separate data. `font-mono` for all numbers. --- @@ -621,16 +596,15 @@ Avoid these signatures unless the brief explicitly asks for them. * **NO filler verbs.** "Elevate", "Seamless", "Unleash", "Next-Gen", "Revolutionize" → concrete verbs only. ### 9.E External Resources & Components -* **NO hand-rolled SVG icons.** Use Phosphor / HugeIcons / Radix / Tabler. Lucide on explicit request only. * **Hand-rolled decorative SVGs strongly discouraged** as default (see Section 4.8). * **NO div-based fake screenshots.** Never build a fake product UI out of `
` rectangles to simulate a screenshot. Use real images, generated images, or skip the preview. * **NO broken Unsplash links.** Use `https://picsum.photos/seed/{descriptive-string}/{w}/{h}`, or generated photo placeholders, or actual assets. * **shadcn/ui customization:** Allowed, but NEVER in default state. Customize radii, colors, shadows, typography to the project aesthetic. * **Production-Ready Cleanliness:** Code visually clean, memorable, meticulously refined. -### 9.F Production-Test Tells (banned outright) +### 9.F Production Tells -These patterns came out of real LLM-generated landing-page tests. They are the signatures the model defaults to when it tries to "look designed." Treat them as hard bans unless the brief explicitly calls for one. +Common signatures of generated landing pages. Skip them unless the brief asks for one. **Hero & top-of-page** * **NO version labels in the hero.** `V0.6`, `v2.0`, `BETA`, `INVITE-ONLY PREVIEW`, `EARLY ACCESS`, `ALPHA` - banned as default eyebrows. Only acceptable when the brief is explicitly about a product launch / preview status. @@ -647,7 +621,7 @@ These patterns came out of real LLM-generated landing-page tests. They are the s * **NO decorative colored status dots on every list/nav/badge.** A colored dot before "ONE Q4 SLOT OPEN" or before every nav link, or every task row - banned by default. Acceptable only when the dot conveys actual semantic state (a server status, an availability flag) and is used sparingly. **Em-dashes & typography flourishes** -* **NO em-dash (`—`) as a design element OR anywhere else.** See Section 9.G below for the complete, non-negotiable ban. The em-dash character is forbidden in headlines, eyebrows, pills, body copy, quotes, attribution, captions, button text, and alt text. Use the regular hyphen (`-`). +* **No em-dashes.** See Section 9.G. * **NO `
`-broken-and-italicized headlines** as a default "design move." "for thirty\*years.*" type splits. Headlines should read naturally first, get clever only when the brief demands it. * **NO vertical rotated text** ("INDEX OF WORK, 2018 - 2026" rotated 90°). Agency-portfolio cliché. Use it only when the brief is explicitly agency / Awwwards / experimental AND it serves a real composition purpose. * **NO crosshair / hairline grid lines as decoration.** Vertical and horizontal lines drawn just to make the page "feel designed" - banned. Use them only when they organize real content. @@ -681,31 +655,17 @@ These patterns came out of real LLM-generated landing-page tests. They are the s **Locale, time, scroll cues** * **Locale / city-name / time / weather strips are banned for 99% of briefs.** "Lisbon, working with founders" in the hero, "1200-690 Lisbon, Portugal" in the footer, "Lisbon 14:23 · 18°C" in the nav. These are agency-portfolio decoration tells. Allowed ONLY when: the brief explicitly describes a globally-distributed studio with timezone-relevant work, OR a travel-focused brand, OR a real-world physical venue. A single contact-address mention in the footer is fine; an atmospheric locale strip is not. * **Scroll cues are banned.** `Scroll`, `↓ scroll`, `Scroll to explore`, `Scroll to walk through it`, animated mouse-wheel icons. If the user has not scrolled yet, they are looking at the hero. They know what scroll is. The bottom of the viewport does not need a label. -* **ZERO decorative status dots by default.** A coloured dot before nav items, before list rows, before badges, before status labels is a Tell. Only acceptable when conveying real semantic state (a live indicator on actual server status, a live availability flag) and limited to one per page section. - -### 9.G EM-DASH BAN (the single most-violated Tell) - -**Em-dash (`—`) is COMPLETELY banned.** It is the LLM's signature stylistic crutch and it is the #1 visual Tell in production tests. There is no "limited use" allowance, no "natural language frequency" allowance, no "in body copy is fine" allowance. None. - -* **Banned in headlines.** Use a period or a comma. -* **Banned in eyebrows / labels / pills / button text / image captions / nav items.** Replace with line breaks, columns, or hairlines. -* **Banned in body copy.** Restructure the sentence: two sentences with a period, OR a comma, OR parentheses, OR a colon. -* **Banned in quote attribution.** Use a normal hyphen with spaces (` - `) or a line break + smaller-weight name. -* **Banned in en-dash form too (`–`) when used as a separator.** Date ranges (`2018-2026`) use a hyphen. Number ranges (`€40-80k`) use a hyphen. +* **No decorative status dots by default.** A coloured dot before nav items, before list rows, before badges, before status labels is a Tell. Only acceptable when conveying real semantic state (a live indicator on actual server status, a live availability flag) and limited to one per page section. -The ONLY permitted dash characters on the page are: -* Regular hyphen `-` (for compound words, ranges, line dividers in markup) -* Minus sign in math (`-5°C`) +### 9.G Dashes -If your output contains a single `—` or `–` anywhere visible to the user, the output fails the Pre-Flight Check and must be rewritten. - -This rule is non-negotiable. The agent has historically ignored em-dash limits when phrased as "use sparingly." The phrasing here is binary: zero em-dashes. +Visible copy uses hyphens, commas, periods, colons, or parentheses; no em-dashes (`—`) or en-dash separators (`–`). Date and number ranges use a hyphen. --- ## 10. REFERENCE VOCABULARY (Pattern Names the Agent Should Know) -This is a vocabulary, not a library. The agent should KNOW these pattern names to communicate about them, design with them in mind, and reach for them when the design read calls for them. **Implementations and code sketches live in the Block Library (Section 12), which is populated iteratively.** +This is a vocabulary, not a library. Know these pattern names to communicate about them, design with them in mind, and reach for them when the design read calls for them. ### Hero Paradigms * **Asymmetric Split Hero** - Text on one side, asset on the other, generous white space. @@ -777,7 +737,7 @@ This is a vocabulary, not a library. The agent should KNOW these pattern names t * **Motion (`motion/react`)** - default for UI / Bento / state-change motion. * **GSAP + ScrollTrigger** - for full-page scrolltelling and scroll hijacks. Isolate in dedicated leaf components with `useEffect` cleanup. * **Three.js / WebGL** - for canvas backgrounds and 3D scenes. Same isolation rule. -* **NEVER mix GSAP / Three.js with Motion in the same component tree.** They fight over the same frames. +* **Do not mix GSAP / Three.js with Motion in the same component tree.** They fight over the same frames. --- @@ -833,67 +793,6 @@ Never modify without explicit user approval: --- -## 12. THE BLOCK LIBRARY (Contract - Implementations Land Here Iteratively) - -The Reference Vocabulary (Section 10) names patterns. The Block Library implements them with real props, real motion specs, and real code sketches. - -**Status:** schema defined here. Blocks will be added iteratively. Do not freelance new blocks without following this schema. - -### 12.A File Location -``` -skills/taste-skill/blocks/ - hero/ - asymmetric-split.md - editorial-manifesto.md - kinetic-type.md - ... - feature/ - bento-grid.md - sticky-scroll-stack.md - zig-zag.md - ... - social-proof/ - pricing/ - cta/ - footer/ - navigation/ - portfolio/ - transition/ -``` - -### 12.B Required Frontmatter -```yaml ---- -name: asymmetric-split-hero -category: hero -dial_compatibility: - variance: [6, 10] - motion: [3, 10] - density: [2, 5] -when_to_use: "Landing pages with one strong asset and one strong message. Default hero for SaaS, agency, premium consumer." -not_for: "Editorial / manifesto launches where the message IS the design." -stack: ["react", "next", "tailwind", "motion"] ---- -``` - -### 12.C Required Body Sections -1. **Visual sketch** - short ASCII or description of the layout. -2. **Props API** - the component's interface. -3. **Code sketch** - minimal working implementation (Server Component default, Client island for motion). -4. **Mobile fallback** - explicit collapse rules for `< 768px`. -5. **Motion variants** - one variant per `MOTION_INTENSITY` band (1-3, 4-7, 8-10). Reduced-motion fallback explicit. -6. **Dark-mode notes** - token strategy specific to this block. -7. **Anti-patterns** - common ways this block goes wrong. -8. **References** - links to real examples in production. - -### 12.D Block-Library Discipline -* One block per file. No multi-block files. -* Every block must work standalone (drop it into a page, it renders). -* Every block must pass the Pre-Flight Check (Section 14). -* Blocks that depend on a design system from Section 2.A live under `blocks//--.md` (e.g. `feature/bento-grid--material.md`). - ---- - ## 13. OUT OF SCOPE This skill is NOT for: @@ -912,21 +811,21 @@ If the brief is one of the above, **say so explicitly**, point to the right tool Run this matrix before outputting code. This is the last filter. -**THIS IS NOT OPTIONAL. Run every box. If any box fails, the output is not done.** +Run through this list before delivering; fix what applies to the brief. - [ ] **Brief inference** declared (Section 0.B one-liner)? - [ ] **Dial values** explicit and reasoned from the brief, not silently using baseline? - [ ] **Design system** chosen from Section 2 if applicable, or aesthetic labeled honestly? - [ ] **Redesign mode** detected and audit performed (if applicable, Section 11)? -- [ ] **ZERO em-dashes (`—`) anywhere on the page.** Headlines, eyebrows, pills, body, quotes, attribution, captions, buttons, alt text. Zero. (Section 9.G - non-negotiable.) +- [ ] No em/en-dashes in visible copy (Section 9.G)? - [ ] **Page Theme Lock**: ONE theme (light, dark, or auto) for the whole page. No section flips to inverted mode mid-page (Section 4.11)? - [ ] **Color Consistency Lock**: one accent color used identically across all sections (Section 4.2)? - [ ] **Shape Consistency Lock**: one corner-radius system applied consistently (Section 4.4)? - [ ] **Button Contrast Check**: every CTA text is readable against its background (no white-on-white, WCAG AA 4.5:1)? - [ ] **CTA Button Wrap**: no CTA label wraps to 2+ lines at desktop? - [ ] **Form Contrast Check**: form inputs, placeholders, focus rings, labels all pass WCAG AA against the section background? -- [ ] **Serif discipline**: if a serif is used, it is NOT Fraunces or Instrument_Serif (or it is, with explicit brand justification)? Different serif from your previous project? -- [ ] **Premium-consumer palette check**: if the brief is premium-consumer (cookware / wellness / artisan / luxury), the palette is NOT the AI-default beige+brass+oxblood+espresso family? Different family from your previous premium-consumer project? +- [ ] **Serif discipline**: if a serif is used, there is a one-line brand reason for it (Section 4.1)? +- [ ] **Premium-consumer palette**: chosen from the brand, not the category default (Section 4.2)? - [ ] **Italic descender clearance**: every italic word with `y g j p q` has `leading-[1.1]` min + `pb-1` reserve? - [ ] **Hero fits the viewport**: headline ≤ 2 lines, subtext ≤ 20 words AND ≤ 4 lines, CTA visible without scroll, font scale planned around image? - [ ] **Hero top padding**: max `pt-24` at desktop, hero content does not float halfway down the viewport? @@ -971,14 +870,11 @@ Run this matrix before outputting code. This is the last filter. - [ ] **`useEffect` animations** have strict cleanup functions? - [ ] **Empty / loading / error** states provided? - [ ] **Cards omitted** in favor of spacing where possible? -- [ ] **Icons** from an allowed library only (Phosphor / HugeIcons / Radix / Tabler), no hand-rolled SVG paths? - [ ] **Motion** isolated in client-leaf components with `'use client'` at the top, memoized? - [ ] **No AI Tells** from Section 9 (Inter as default, AI-purple, three-equal cards, Jane Doe, Acme, "Quietly in use at")? - [ ] **Core Web Vitals** plausibly hit (LCP < 2.5s, INP < 200ms, CLS < 0.1)? - [ ] **One design system** per project (no Material + shadcn mixed)? -If a single checkbox cannot be honestly ticked, the page is not done. Fix it before delivering. - --- # APPENDICES - Real Source-Backed Reference Material diff --git a/.agents/skills/emcn-design-review/SKILL.md b/.agents/skills/emcn-design-review/SKILL.md index 09a9932d4b1..2f14b66c83c 100644 --- a/.agents/skills/emcn-design-review/SKILL.md +++ b/.agents/skills/emcn-design-review/SKILL.md @@ -27,9 +27,8 @@ This codebase uses **emcn**, a custom component library built on Radix UI primit ## Imports -- Import from `@/components/emcn` barrel, never subpaths +- Components, `cn`, and tokens from the `@sim/emcn` barrel, never component subpaths - Icons from `@sim/emcn/icons` -- Use `cn` from `@/lib/core/utils/cn` for conditional classes ## Design Tokens @@ -37,7 +36,7 @@ Use CSS variable pattern (`text-[var(--text-primary)]`), never Tailwind semantic **Text**: `--text-primary`, `--text-secondary`, `--text-tertiary`, `--text-muted`, `--text-body` (canonical value text), `--text-icon`, `--text-placeholder`, `--text-subtle`, `--text-inverse`, `--text-error` **Surfaces**: `--bg`, `--surface-1` through `--surface-7`, `--surface-hover`, `--surface-active` -**Borders**: `--border`, `--border-1`, `--border-muted` +**Borders**: `--border` (`--border-1`/`--border-muted` are legacy aliases resolving to it — flag new uses) **Brand/accent**: `--brand-secondary`, `--brand-accent` **Z-Index**: `--z-dropdown` (100), `--z-toast` (150), `--z-modal` (200), `--z-popover` (300), `--z-tooltip` (400), `--z-takeover` (500), `--z-shell-gate` (600) **Shadows**: `shadow-subtle`, `shadow-medium`, `shadow-overlay`, `shadow-card` @@ -62,7 +61,7 @@ Intent-to-variant mapping (read the actual `buttonVariants` in `packages/emcn/sr ## Toast -`toast.success()`, `toast.error()`, `toast()` from `@/components/emcn`. Never custom notification UI. +`toast.success()`, `toast.error()`, `toast()` from `@sim/emcn`. Never custom notification UI. ## Badges diff --git a/.agents/skills/emil-design-eng/SKILL.md b/.agents/skills/emil-design-eng/SKILL.md index b919c161db2..05a5b4991e3 100644 --- a/.agents/skills/emil-design-eng/SKILL.md +++ b/.agents/skills/emil-design-eng/SKILL.md @@ -6,14 +6,6 @@ description: This skill encodes Emil Kowalski's philosophy on UI polish, compone # Design Engineering -## Initial Response - -When this skill is first invoked without a specific question, respond only with: - -> I'm ready to help you build interfaces that feel right, my knowledge comes from Emil Kowalski's design engineering philosophy. If you want to dive even deeper, check out Emil’s course: [animations.dev](https://animations.dev/). - -Do not provide any other information until the user asks a question. - You are a design engineer with the craft sensibility. You build interfaces where every detail compounds into something that feels right. You understand that in a world where everyone's software is good enough, taste is the differentiator. ## Core Philosophy @@ -36,9 +28,9 @@ Every decision below exists because the aggregate of invisible correctness creat People select tools based on the overall experience, not just functionality. Good defaults and good animations are real differentiators. Beauty is underutilized in software. Use it as leverage to stand out. -## Review Format (Required) +## Review Format -When reviewing UI code, you MUST use a markdown table with Before/After columns. Do NOT use a list with "Before:" and "After:" on separate lines. Always output an actual markdown table like this: +Present review findings as one markdown table with `Before | After | Why` columns, one row per issue: | Before | After | Why | | --- | --- | --- | @@ -48,18 +40,6 @@ When reviewing UI code, you MUST use a markdown table with Before/After columns. | No `:active` state on button | `transform: scale(0.97)` on `:active` | Buttons must feel responsive to press | | `transform-origin: center` on popover | `transform-origin: var(--radix-popover-content-transform-origin)` | Popovers should scale from their trigger (not modals — modals stay centered) | -Wrong format (never do this): - -``` -Before: transition: all 300ms -After: transition: transform 200ms ease-out -──────────────────────────── -Before: scale(0) -After: scale(0.95) -``` - -Correct format: A single markdown table with | Before | After | Why | columns, one row per issue found. The "Why" column briefly explains the reasoning. - ## The Animation Decision Framework Before writing any animation code, answer these questions in order: diff --git a/.agents/skills/make-interfaces-feel-better/SKILL.md b/.agents/skills/make-interfaces-feel-better/SKILL.md index 41a30dc1263..38e81ff26c4 100644 --- a/.agents/skills/make-interfaces-feel-better/SKILL.md +++ b/.agents/skills/make-interfaces-feel-better/SKILL.md @@ -29,7 +29,7 @@ When geometric centering looks off, align optically. Buttons with icons, play tr ### 3. Shadows Over Borders -Layer multiple transparent `box-shadow` values for natural depth. Shadows adapt to any background; solid borders don't. +For elevation (dropdowns, modals, cards) use the `shadow-subtle`/`shadow-medium`/`shadow-overlay`/`shadow-card` tokens. In this repo neutral edges and dividers stay as `--border` borders (`.claude/rules/sim-styling.md`, Line weight) — do not swap them for `0 0 0 1px` shadow rings. ### 4. Interruptible Animations @@ -45,7 +45,7 @@ Use a small fixed `translateY` instead of full height. Exits should be softer th ### 7. Contextual Icon Animations -Animate icons with `opacity`, `scale`, and `blur` instead of toggling visibility. Use exactly these values: scale from `0.25` to `1`, opacity from `0` to `1`, blur from `4px` to `0px`. If the project has `motion` or `framer-motion` in `package.json`, use `transition: { type: "spring", duration: 0.3, bounce: 0 }` — bounce must always be `0`. If no motion library is installed, keep both icons in the DOM (one absolute-positioned) and cross-fade with CSS transitions using `cubic-bezier(0.2, 0, 0, 1)` — this gives both enter and exit animations without any dependency. +Animate contextual icons with opacity, scale, and blur instead of toggling visibility; see animations.md for the Motion and CSS cross-fade patterns. ### 8. Font Smoothing @@ -61,11 +61,11 @@ Use `text-wrap: balance` on headings. Use `text-wrap: pretty` for body text to a ### 11. Image Outlines -Add a subtle `1px` outline with low opacity to images for consistent depth. The color must be pure black in light mode (`rgba(0, 0, 0, 0.1)`) and pure white in dark mode (`rgba(255, 255, 255, 0.1)`) — never a near-black like slate, zinc, or any tinted neutral. A tinted outline picks up the surface color underneath it and reads as dirt on the image edge. +Add a subtle 1px low-opacity outline to images (`outline-black/10` light, `outline-white/10` dark); see surfaces.md. ### 12. Scale on Press -A subtle `scale(0.96)` on click gives buttons tactile feedback. Always use `0.96`. Never use a value smaller than `0.95` — anything below feels exaggerated. Add a `static` prop to disable it when motion would be distracting. +A subtle scale-down (about 0.96-0.97) on press gives tactile feedback. In this repo a press affordance belongs in the emcn `Button`/`Chip` chrome (`packages/emcn`), not in consumer classes — neither component implements one today, so propose it there rather than adding per-call-site transforms. ### 13. Skip Animation on Page Load @@ -89,7 +89,7 @@ Interactive elements need at least 40×40px hit area. Extend with a pseudo-eleme | --- | --- | | Same border radius on parent and child | Calculate `outerRadius = innerRadius + padding` | | Icons look off-center | Adjust optically with padding or fix SVG directly | -| Hard borders between sections | Use layered `box-shadow` with transparency | +| Hard borders between sections | In this repo, the `--border` hairline token; elsewhere, layered `box-shadow` with transparency | | Jarring enter/exit animations | Split, stagger, and keep exits subtle | | Numbers cause layout shift | Apply `tabular-nums` | | Heavy text on macOS | Apply `antialiased` to root | @@ -100,7 +100,7 @@ Interactive elements need at least 40×40px hit area. Extend with a pseudo-eleme ## Review Output Format -Always present changes as a markdown table with **Before** and **After** columns. Include every change you made — not just a subset. Never list findings as separate "Before:" / "After:" lines outside of a table. Group changes by principle using a heading above each table, and keep each row focused on a single diff so the reader can scan the whole list quickly. +Present changes as markdown tables with **Before** and **After** columns, one table per principle with a heading above it, one diff per row, and cite file and property when the snippet is not self-explanatory. ### Example diff --git a/.agents/skills/make-interfaces-feel-better/animations.md b/.agents/skills/make-interfaces-feel-better/animations.md index e0515e02dcf..2c4c8291027 100644 --- a/.agents/skills/make-interfaces-feel-better/animations.md +++ b/.agents/skills/make-interfaces-feel-better/animations.md @@ -272,15 +272,11 @@ The non-absolute icon (InactiveIcon) defines the layout size. The absolute icon | Icons in contextual toolbars | Icons that are always visible | | Loading/success state indicators | Icon labels (text next to icon) | -**Important:** Always use exactly these values for contextual icon animations — do not deviate: -- `scale`: `0.25` → `1` (never use `0.5` or `0.6`) -- `opacity`: `0` → `1` -- `filter`: `"blur(4px)"` → `"blur(0px)"` -- `transition`: `{ type: "spring", duration: 0.3, bounce: 0 }` — **bounce must always be `0`**, never `0.1` or any other value +Default values: scale 0.25→1, opacity 0→1, blur 4px→0, `{ type: "spring", duration: 0.3, bounce: 0 }`. ## Scale on Press -A subtle scale-down on click gives buttons tactile feedback. Always use `scale(0.96)`. Never use a value smaller than `0.95` — anything below feels exaggerated. Use CSS transitions for interruptibility — if the user releases mid-press, it should smoothly return. +A subtle scale-down on click (about 0.96-0.97) gives buttons tactile feedback. Use CSS transitions for interruptibility — if the user releases mid-press, it should smoothly return. Not every button needs this. Add a `static` prop to your button component that disables the scale effect when the motion would be distracting. diff --git a/.agents/skills/make-interfaces-feel-better/surfaces.md b/.agents/skills/make-interfaces-feel-better/surfaces.md index 180de509a48..1f3cd6b4a5c 100644 --- a/.agents/skills/make-interfaces-feel-better/surfaces.md +++ b/.agents/skills/make-interfaces-feel-better/surfaces.md @@ -116,6 +116,8 @@ Some icons have uneven visual weight. The best fix is adjusting the SVG directly ## Shadows Instead of Borders +> In this repo, use the `shadow-subtle`/`shadow-medium`/`shadow-overlay`/`shadow-card` tokens for elevation and keep neutral edges as `--border` borders (`.claude/rules/sim-styling.md`, Line weight); do not replace them with `0 0 0 1px` shadow rings. The pattern below is for projects without that token system. + For **buttons, cards, and containers** that use a border for depth or elevation, prefer replacing it with a subtle `box-shadow`. Shadows adapt to any background since they use transparency; solid borders don't. This also helps when using images or multiple colors as backgrounds — solid border colors don't work well on backgrounds other than the ones they were designed for. **Do not apply this to dividers** (`border-b`, `border-t`, side borders) or any border whose purpose is layout separation rather than element depth. Those should stay as borders. @@ -179,12 +181,11 @@ Apply the variable and add `transition-[box-shadow]` for a smooth hover: Add a subtle `1px` outline with low opacity to images. This creates consistent depth, especially in design systems where other elements use borders or shadows. -### Color rules (non-negotiable) +### Color -- **Light mode**: pure black — `rgba(0, 0, 0, 0.1)`. Exact values: R=0, G=0, B=0. -- **Dark mode**: pure white — `rgba(255, 255, 255, 0.1)`. Exact values: R=255, G=255, B=255. -- Never use a near-black or near-white from the project palette (e.g. slate-900, zinc-900, `#0a0a0a`, `#111827`, `#f5f5f7`). Tinted outlines pick up the surrounding surface color and read as dirt on the image edge. -- Never match the outline to the project's accent or ink color. The outline is a neutral separator, not a themed element. +- **Light mode**: pure black — `rgba(0, 0, 0, 0.1)`. +- **Dark mode**: pure white — `rgba(255, 255, 255, 0.1)`. +- Tinted neutrals (slate-900, zinc-900, `#0a0a0a`, `#f5f5f7`) and accent/ink colors pick up the surrounding surface color and read as dirt on the image edge; the outline is a neutral separator, not a themed element. ### Light Mode diff --git a/.agents/skills/memory-load-check/SKILL.md b/.agents/skills/memory-load-check/SKILL.md index 340f6b9757c..157e7a89db8 100644 --- a/.agents/skills/memory-load-check/SKILL.md +++ b/.agents/skills/memory-load-check/SKILL.md @@ -31,7 +31,7 @@ Read these when doing a deeper pass: - `chunkedBatchDelete`: bounded SELECT -> optional side effect -> DELETE loop. - `batchDeleteByWorkspaceAndTimestamp`: common workspace/timestamp cleanup wrapper. - `selectRowsByIdChunks`: chunks large ID sets and enforces an overall row cap. - - `chunkArray`: use only after the input set itself is already bounded. +- `chunkArray` from `@sim/utils/helpers`: use only after the input set itself is already bounded. - `apps/sim/lib/core/utils/stream-limits.ts` - `PayloadSizeLimitError` - `assertKnownSizeWithinLimit` @@ -45,7 +45,7 @@ Read these when doing a deeper pass: - dispatch concrete chunks (`workspaceIds`, retention, label) instead of one giant scope - prefer Trigger.dev queue/concurrency keys when available - execute inline fallback chunks sequentially, not with unbounded `Promise.all` -- File parse route pattern in `apps/sim/app/api/files/parse/route.ts` +- File parse pattern in `apps/sim/lib/internal/file/parser.ts` and `apps/sim/lib/uploads/contexts/workspace/fetch-external-url.ts` - cap downloads and parsed output separately - preserve partial results when a later item exceeds the cap - never read untrusted response bodies without a byte cap diff --git a/.agents/skills/migrate-application-operation/SKILL.md b/.agents/skills/migrate-application-operation/SKILL.md index 2786721895c..d8be0eaf32c 100644 --- a/.agents/skills/migrate-application-operation/SKILL.md +++ b/.agents/skills/migrate-application-operation/SKILL.md @@ -156,6 +156,7 @@ rename: defineWorkspaceOperation({ id: 'widgets.rename', minimumRole: 'write', workspaceApiKey: 'allow', + capability: 'widgets.use', principalKinds: ['session', 'personal_api_key', 'workspace_api_key', 'delegated'], delegatedServices: ['copilot'], }) @@ -165,6 +166,8 @@ Do not create internal-, public-, or Copilot-specific versions of the same seman Choose principal kinds from actual behavior. Do not accept every principal merely because the use case is shared. Workspace API keys have a write ceiling and cannot satisfy admin operations. The operation definition must fail fast when its role, workspace-key policy, and principal kinds disagree. +`capability` is required — name the permission-group capability that governs the operation, or `'none'` with a `// permission-group-exempt: ` comment directly above it. `defineWorkspaceOperation` throws at definition time when it is absent. See `add-permission-group-item`. + Route declarations, tool adapters, and use cases must use the same literal operation. Runtime operation selection is permitted only from a trusted, code-defined registry. Never accept an operation ID or permission tag from an HTTP body, model argument, or other untrusted input. ### Unified selector execution is one operation @@ -237,7 +240,7 @@ Keep the route module declarative. If several internal routes repeat authenticat ## Adapt public or versioned APIs -Use the appropriate public/versioned route builder, such as `defineV2JsonRoute`, with API-key authentication, explicit semantic operation and rate policy, external error projection, input mapping, application use case, and an external presenter. V2 rollout admission is centralized by the builder; do not invent a route-local rollout policy. +Use the appropriate public/versioned route builder, such as `defineV2JsonRoute`, with API-key authentication, explicit semantic operation and rate policy, external error projection, input mapping, application use case, and an external presenter. Authentication and HTTP formatting may differ from internal APIs; authorization and business behavior must not. Rate-limit using the credential or principal subject, never a billed owner. Resolve billing attribution only for billing, quota, or legacy required-user fields. @@ -320,7 +323,7 @@ Add focused tests for every migrated surface and principal kind allowed by the o - Operation registry: role/workspace-key/principal-kind/delegated-service consistency and fail-fast rejection of invalid definitions. - Repository: canonical active lookup, workspace-predicated writes, archived resources, authoritative affected rows, and database error propagation. - Internal API: authentication before parsing, exact contract, typed errors, and surface analytics only after success. -- Public API: personal and workspace keys, rate and rollout behavior, concealment, exact external envelope, and rate headers. +- Public API: personal and workspace keys, rate behavior, concealment, exact external envelope, and rate headers. - Copilot or tools: trusted context, exact registered operation membership, rejected forged scope, aliases and resume paths, permission re-check, safe errors, and unchanged tool result shapes. - Side effects: audit derives from authoritative results; shared notifications follow audit; neither occurs for rejection or no-op. - Compatibility characterization: legacy normalization, exact response/redirect/cookie behavior, concealment, error subclass precedence, and branch-specific output. diff --git a/.agents/skills/react-query-best-practices/SKILL.md b/.agents/skills/react-query-best-practices/SKILL.md index 2bce17ad86f..99f96b259ce 100644 --- a/.agents/skills/react-query-best-practices/SKILL.md +++ b/.agents/skills/react-query-best-practices/SKILL.md @@ -25,15 +25,9 @@ Read these before analyzing: ## Rules to enforce -### Query key factories -- Every file in `hooks/queries/` must have a hierarchical key factory with an `all` root key -- Keys must include intermediate plural keys (`lists`, `details`) for prefix invalidation -- Key factories are colocated with their query hooks, not in a global keys file - -### Query hooks -- Every `queryFn` must forward `signal` for request cancellation -- Every query must have an explicit `staleTime` (default 0 is almost never correct), assigned from a named exported constant — never an inline numeric literal. A server-side prefetch hydrating the same query key must import and reuse that constant instead of restating the number -- `keepPreviousData` / `placeholderData` only on variable-key queries (where params change), never on static keys +### Query keys and hooks +Enforce CLAUDE.md "React Query" and `.claude/rules/sim-queries.md` (key factory with `all` + plural prefixes, `signal` forwarding, named `staleTime` constants reused by prefetches, `keepPreviousData` only on variable keys, `requestJson` boundary). Additionally: +- Key factories live next to their hooks — except a factory, standalone fetcher/mapper, or `staleTime` constant that a server module (a `prefetch.ts`, route, block, trigger) imports, which must live in a non-`'use client'` module under `hooks/queries/utils/` per `.claude/rules/sim-queries.md` (a `'use client'` export called from the server crashes SSR) - Use `enabled` to prevent queries from running without required params - Warm data for hover/focus intent with `queryClient.prefetchQuery` and shared `queryOptions`; never temporarily enable a mounted hidden observer, which can remain active after focus restoration and refetch data for closed UI - When gating a query by view or modal state, move every consumer to the active query too: imperative refresh/pagination, loading and error feedback, and data-derived controls must never read a disabled query or placeholder data from a previous key @@ -43,16 +37,14 @@ Read these before analyzing: - Server prefetches must call the authorized use case, apply the route presenter/response schema, and reuse the client's exact key, mapper, and stale time. Keep all fallible auth/read/parse work inside `queryFn` so an optional warm cannot fail the page, and never bypass a route that redacts fields. ### Mutations -- Use `onSettled` (not `onSuccess`) for cache reconciliation — it fires on both success and error -- For optimistic updates: save previous data in `onMutate`, roll back in `onError` -- Use targeted invalidation (`entityKeys.lists()`) not broad (`entityKeys.all`) when possible -- Don't include mutation objects in `useCallback` deps — `.mutate()` is stable +Enforce CLAUDE.md "Mutation Hooks" (targeted invalidation, `onMutate`/`onError` rollback, mutation objects out of `useCallback` deps). Additionally: +- Plain mutations invalidate in `onSuccess`; optimistic mutations reconcile in `onSettled` (fires on success and error) with rollback in `onError` — see `.claude/rules/sim-queries.md` "Mutation Hook" / "Optimistic Updates" ### Server state ownership - Never copy query data into useState. Use query data directly in components. - Never copy query data into Zustand stores (exception: mutation callbacks that coordinate cross-store state like temp ID replacement) -- The query cache is not a local state manager — `setQueryData` is for optimistic updates only -- Forms are the one deliberate exception: once query data exists, initialize a keyed form subtree from it with lazy state initializers. Do not synchronize query data into draft state with an Effect; key the form by resource identity so switching resources resets every draft/modal/upload field together. Keep independent queries in the outer wrapper so they still start in parallel. +- The query cache is not a local state manager — `setQueryData` is for optimistic updates and the server-prefetch seeding case in `.claude/rules/sim-queries.md` "Server prefetching", nothing else +- Forms are the one deliberate exception (a keyed form child initialized lazily from loaded query data) — the pattern is owned by `/you-might-not-need-an-effect` "Query-backed forms"; do not duplicate its finding ## Steps diff --git a/.agents/skills/ship/SKILL.md b/.agents/skills/ship/SKILL.md index f9e8aef93bf..bb6ccff5bb8 100644 --- a/.agents/skills/ship/SKILL.md +++ b/.agents/skills/ship/SKILL.md @@ -13,25 +13,25 @@ You help ship code by creating commits, pushing to the remote branch, and creati When the user runs `/ship`: 1. **Check git status** - See what files have changed -2. **Sync check**: `git fetch origin staging && git log --oneline origin/staging..HEAD`. Read the actual commit list, not just how many there are — it must show ONLY commits you can attribute to this session (recognizable subjects/SHAs). A worktree/branch can silently be cut from a stale local `staging`, dragging in unrelated commits; a corrupted branch's inflated commit *count* can coincidentally match a later check even when the *commits* are wrong, so always compare content, never just a number. +2. **Sync check**: `git fetch origin staging && git log --oneline origin/staging..HEAD`. The list must contain ONLY commits you can attribute to this session (recognizable subjects/SHAs) — a worktree/branch cut from a stale local `staging` silently drags in unrelated commits. - If it shows commits you don't recognize, fix it now, **before** staging/committing any new work (step 7 hasn't run yet): - If the working tree has uncommitted changes, stash them first — `git stash push -u -m ship-sync-fix` — so the rebase below isn't blocked by dirty state. Restore with `git stash pop` once the branch is fixed. - Try `git rebase origin/staging` first. - **A rebase finishing without conflicts does NOT by itself mean the branch is clean** — it can replay stray commits onto the new base with no conflict at all. After the rebase (clean or not), re-run `git log --oneline origin/staging..HEAD` and re-check the commit list against what you recognize. - - If the rebase conflicted on commits you don't recognize, OR it finished cleanly but the re-checked log still shows commits you don't recognize, abandon that result (`git rebase --abort` if still mid-rebase) and rebuild instead, in this exact order: - 1. **While still on ``**, identify the SHA(s) to preserve — **not** the whole range. `git log --oneline --reverse origin/staging..` lists everything ahead of `origin/staging`, but in exactly this scenario that range also contains the unrecognized/stray commits you're trying to leave behind — blindly cherry-picking the full range recreates the same polluted branch. Read the list and write down only the SHA(s) you recognize as your own session's work (e.g. `abc1234 def5678`); do this *before* touching any temp branch, since once you check out `ship-sync-tmp` at `origin/staging` in step 4, `HEAD` no longer contains these commits and the same lookup at that point returns nothing. - 2. `git checkout ` — harmless no-op if you're already there, but required if an earlier interrupted attempt left you sitting on `ship-sync-tmp`: git refuses to delete the branch you're currently on, so deleting it before switching away silently fails and blocks the rest of the rebuild. - 3. Delete any leftover from an earlier attempt: `git branch -D ship-sync-tmp 2>/dev/null || true` — always succeeds, including when there's nothing to delete (a first attempt), so it never blocks the rest of the rebuild on its own exit code. - 4. `git checkout -b ship-sync-tmp origin/staging`. - 5. `git cherry-pick` the SHAs captured in step 1, **in that oldest-first order** — cherry-picking more than one session commit out of order can fail or produce the wrong history. Resolve conflicts. - 6. `git branch -f HEAD`, `git checkout `, and delete `ship-sync-tmp` (`git branch -D ship-sync-tmp`). + - If the rebase conflicted on unrecognized commits, OR finished cleanly but the log still shows them, abandon it (`git rebase --abort` if mid-rebase) and rebuild, in this exact order: + 1. Still on ``, list `git log --oneline --reverse origin/staging..` and write down ONLY the SHA(s) that are this session's work — the range also contains the stray commits, so cherry-picking the whole range recreates the polluted branch. Capture them now; after step 4 they are no longer in `HEAD`. + 2. `git checkout ` (required if an interrupted attempt left you on `ship-sync-tmp`) + 3. `git branch -D ship-sync-tmp 2>/dev/null || true` + 4. `git checkout -b ship-sync-tmp origin/staging` + 5. `git cherry-pick` the captured SHAs, oldest-first. Resolve conflicts. + 6. `git branch -f HEAD && git checkout && git branch -D ship-sync-tmp` - Re-verify with `git log --oneline origin/staging..HEAD` — it must list only commits you recognize before you proceed to committing new work. 3. **Generate a commit message** following this format: `type(scope): description` - Types: `fix`, `feat`, `improvement`, `chore` - Scope: short identifier (e.g., `undo-redo`, `api`, `ui`) - Keep it concise 4. **Run the cleanup pass** — only if the diff modifies UI code (any `.tsx` file, or anything under `apps/sim/components/`, `apps/sim/hooks/`, or `apps/sim/stores/`): `/cleanup` - - The six code-quality skills (effects, memo, callbacks, state, React Query, emcn) only apply to React code, so skip this step entirely when no UI was touched. When it runs, it applies fixes so they land in this commit. + - `/cleanup` fans out the React/UI passes (effects, memo, callbacks, state, React Query, emcn, url-state) plus the comment pass; skip it when no UI was touched. When it runs, it applies fixes so they land in this commit. 5. **Run migration safety** — only if the diff touches `packages/db/migrations/**` or `packages/db/schema.ts`: - Run `/db-migrate` to review the migration for zero-downtime safety (expand/contract phasing, backward-compatibility with the deployed app version). - `bun run check:migrations origin/staging` must pass (staging is the PR base). Do not silence a flagged statement with a `-- migration-safe:` annotation unless `/db-migrate` confirmed the old code no longer depends on it; otherwise split the destructive change into a later deploy. @@ -45,10 +45,8 @@ When the user runs `/ship`: done wait # any non-zero line is a FAILED generator — read /tmp/ship-gen-.log and fix before shipping; - # a silently-failed generate leaves a stale artifact that Phase B / CI then rejects. - # The `exit 1` makes this block itself exit non-zero on failure, so anything gating on the - # command's status (an agent, or a wrapping script) actually stops — do NOT collapse it to - # `grep … && echo ❌ || echo ✅`, which always exits 0 and silently lets ship continue. + # a silently-failed generate leaves a stale artifact that Phase B / CI then rejects. Keep the + # `exit 1`: it is what makes the block's own status non-zero so a caller actually stops. if grep -vE '^0 ' /tmp/ship-gen-results; then echo "❌ generator(s) failed — do not ship"; exit 1; fi echo "✅ artifacts regenerated" ``` @@ -66,8 +64,7 @@ When the user runs `/ship`: exit 1 } # Runs every audit CI runs, concurrently, and replays the output of any that fail. - # Do not hand-list the audits here: the list is derived in scripts/run-audits.ts, and the - # copy that used to live in this file had already drifted five audits behind package.json. + # The audit list is derived in scripts/run-audits.ts — do not hand-list audits here. bun run check:audits || { echo "❌ audit(s) failed — do not ship"; exit 1; } ``` If Phase A regenerated a file, its matching `:check` in Phase B now passes trivially — that parity is the point. Do not ship with any generator or audit failing; fix the cause (never silence it) and re-run. `check:migrations` and `type-check` are covered by steps 5 and CI respectively and are not repeated here. diff --git a/.agents/skills/tool-registry-boundary/SKILL.md b/.agents/skills/tool-registry-boundary/SKILL.md index ca22f8c856d..af54a09ad35 100644 --- a/.agents/skills/tool-registry-boundary/SKILL.md +++ b/.agents/skills/tool-registry-boundary/SKILL.md @@ -5,18 +5,18 @@ description: Keep the executable tool registry out of client-reachable module gr # Tool Registry Boundary Skill -You keep the 4,300-tool executable registry out of module graphs that don't execute tools. +You keep the 5,000+-tool executable registry out of module graphs that don't execute tools. ## The rule > Client-reachable code reads tool **metadata**. Only code that actually executes a tool imports the **registry**. -`@/tools/registry` is a ~9,000-line barrel importing every tool. External `ToolConfig` entries mix +`@/tools/registry` is a 10,000+-line barrel importing every tool. External `ToolConfig` entries mix plain data (`params`, `outputs`, `name`) with request/response closures, while `InternalToolConfig` entries contain semantic input projection and load their server implementation through `lib/internal/tool-operations/registry.server.ts`. Request closures can still reach SDK clients, API helpers, and parsers, which is what makes the executable barrel expensive: reaching it -costs ~4,700 additional modules. +costs roughly 4,700 additional modules (measured; re-measure with `--verbose`). `getTool()` returns the whole `ToolConfig`, so a single `getTool` import anywhere in a client-reachable file drags all of it in. @@ -33,7 +33,7 @@ costs ~4,700 additional modules. Three modules, cheapest first. Ids are their own artifact because resolution and existence checks need only the key set; outputs are their own because they are the larger half of the data with a single consumer. `@/tools/metadata` and `@/tools/metadata-outputs` both resolve ids through `@/tools/tool-ids`, which is what keeps them independent of each other — do not "helpfully" re-export one from another, or every caller pays for all three. -All lookups guard with `Object.hasOwn`. `JSON.parse` yields an object with the normal prototype, so a bare bracket lookup returns inherited members: `getToolMetadata('constructor')` returned a *function* typed as tool metadata before that was fixed. +All lookups guard with `Object.hasOwn`. `JSON.parse` yields an object with the normal prototype, so a bare bracket lookup returns inherited members: a bare bracket lookup would answer `getToolMetadata('constructor')` with a *function* typed as tool metadata. ## The generated artifacts @@ -48,10 +48,10 @@ Never hand-edit them. If you add a tool or change a tool's `params`/`outputs`, r Three non-obvious properties, each of which was measured and is easy to undo by accident: -- **The data is a JSON string parsed at runtime, not an imported `.json` and not an object literal.** With `resolveJsonModule` (which this repo enables), a `.json` import makes TypeScript infer a literal type for all 4,300+ entries and takes `tsc --noEmit` from **12.6s to 8m07s** — a 38x regression. An ambient `declare module` does *not* short-circuit it, and an object literal costs the same. A single string literal is one cheap token for both the compiler and the bundler, and `JSON.parse` beats evaluating the equivalent literal at runtime. Do not "clean this up" into a `.json` import. +- **The data is a JSON string parsed at runtime, not an imported `.json` and not an object literal.** With `resolveJsonModule` (which this repo enables), a `.json` import makes TypeScript infer a literal type for all 5,000+ entries and takes `tsc --noEmit` from **12.6s to 8m07s** — a 38x regression. An ambient `declare module` does *not* short-circuit it, and an object literal costs the same. A single string literal is one cheap token for both the compiler and the bundler, and `JSON.parse` beats evaluating the equivalent literal at runtime. Do not "clean this up" into a `.json` import. - **The generator refuses to emit function values.** If you add a field to `METADATA_FIELDS` that contains a closure, generation fails loudly rather than shipping executable config to the client. `hosting` and `schemaEnrichment` are excluded for exactly this reason (`hosting.enabled`, `pricing`, and `enrichSchema` are functions) — they are server-only. - **Empty param entries are stripped.** The registry contains one (`stt_deepgram_v2`), which crashes callers that read `param.type` while iterating. -- **Lookups resolve versions.** `getTool` maps an unversioned name onto the newest version, and 246 tools are versioned. A plain key lookup would silently report them missing — a quiet correctness bug, not a crash. `resolveToolId` reproduces that against the id set and is differentially tested against the original. +- **Lookups resolve versions.** `getTool` maps an unversioned name onto the newest version, and a few hundred tools are versioned. A plain key lookup would silently report them missing — a quiet correctness bug, not a crash. `resolveToolId` reproduces that against the id set and is differentially tested against the original. ## Testing code that reads tool metadata diff --git a/.agents/skills/v2-api-conventions/SKILL.md b/.agents/skills/v2-api-conventions/SKILL.md index 44d0b298e6c..a7174f61e30 100644 --- a/.agents/skills/v2-api-conventions/SKILL.md +++ b/.agents/skills/v2-api-conventions/SKILL.md @@ -31,7 +31,6 @@ Each was one line. The rules below are the generalisations. | Concern | File | |---|---| | Envelope + error codes + cursor codecs | `apps/sim/app/api/v2/lib/response.ts` | -| Rollout gate (`v2-api` flag) | `apps/sim/app/api/v2/lib/gate.ts` | | Cross-tenant concealment | `apps/sim/lib/api/server/routes/resource-concealment.ts` | | Route builder | `apps/sim/lib/api/server/routes/v2-json-route.ts` | | Contracts | `apps/sim/lib/api/contracts/v2/**` | @@ -51,9 +50,9 @@ A route built with `defineV2JsonRoute` gets this for free: its `present` returns |---|---|---| | 200 / 201 | — | Success. 201 only for a created resource. | | 400 | `BAD_REQUEST` | Contract validation. Carries field-level `details` from `serializeZodIssues`. | -| 401 | `UNAUTHORIZED` | No/!valid API key. **Runs before the rollout gate.** | +| 401 | `UNAUTHORIZED` | No/!valid API key. | | 403 | `FORBIDDEN` | Authenticated, same tenant, insufficient rights. Where the cause is one a caller can act on it is named in `details.code`, from the closed set in `lib/core/application/forbidden.ts` (e.g. `INSUFFICIENT_WORKSPACE_ROLE`, `PERSONAL_API_KEYS_DISABLED`). A few domain refusals still reach the wire without one. | -| 404 | `NOT_FOUND` | Not found, **and** cross-tenant concealment, **and** the rollout gate, **and** an unknown path. | +| 404 | `NOT_FOUND` | Not found, **and** cross-tenant concealment, **and** an unknown path. | | 409 | `CONFLICT` | Uniqueness/state conflict, human-readable message. | | 413 | `PAYLOAD_TOO_LARGE` | Body over the route's `maxBodyBytes` — **and** a collection the response must materialize that is over *its* ceiling. Fourteen bodyless `GET`/`DELETE` operations publish it for the folder-tree cap (`FolderCollectionLimitExceededError`) or the rendered-artifact cap. | | 429 | `RATE_LIMITED` | With `Retry-After` and `X-RateLimit-*`. | @@ -61,7 +60,7 @@ A route built with `defineV2JsonRoute` gets this for free: its `present` returns Two of these carry real design weight: -**404 is deliberately overloaded.** A workspace the caller cannot reach answers `404 "Workspace not found"`, never 403 — a 403 would confirm the resource exists. `createV2ResourceConcealmentPolicy` does this by mapping a cross-tenant authorization failure to `v2Error('NOT_FOUND', ...)`. The rollout gate answers the same way for the same reason (`gate.ts`: "an ungated caller cannot distinguish 'not in the rollout cohort' from 'no such endpoint'"), and so does the unknown-path catch-all at `app/api/v2/[[...segments]]/route.ts` — its body is byte-identical to the gate's on purpose. +**404 is deliberately overloaded.** A workspace the caller cannot reach answers `404 "Workspace not found"`, never 403 — a 403 would confirm the resource exists. `createV2ResourceConcealmentPolicy` does this by mapping a cross-tenant authorization failure to `v2Error('NOT_FOUND', ...)`. The unknown-path catch-all at `app/api/v2/[[...segments]]/route.ts` answers with the same body on purpose. **500 is never caller-reachable.** Any input a caller can send must be rejected at the contract boundary with a 400. If you can construct a query string or body that produces a 500, that is a bug in the contract, not something to wrap in a `try`/`catch`. `v2ErrorForOrchestration` also replaces the message on an unclassified failure with a generic one, so internal detail never leaks. A caller-reachable 500 has shipped three times — a fractional `limit` reaching `LIMIT 2.5`, a plain `HEAD` tripping the builder's method guard, and a keyset cursor's timestamp reaching `date_trunc` as an untyped placeholder — so treat "a well-formed request produced a 500" as the highest-severity class of defect on this surface. @@ -84,7 +83,7 @@ Use the shared sets in `contracts/v2/openapi/shared.ts` — `RESOURCE_ERRORS`, ` **HEAD is answered by the `GET` handler, not rejected.** Next aliases a missing `HEAD` export onto `GET` and drops the body when sending, so a route's `GET` legitimately runs with `request.method === 'HEAD'`. The builders' method guard accepts that pairing via `methodMatchesContract`; any other mismatch stays a hard error. Never hand-write a `HEAD` export to "fix" this. -**A `GET` with side effects must declare `headSafe: false`.** The aliasing above is only sound because RFC 9110 §9.2.1 defines `HEAD` as safe. A `GET` that writes a row or opens an outbound connection is not, and an uptime monitor or link checker walking the documented URL list would drive those effects on every probe — `GET /files/{fileId}` records a `FILE_DOWNLOADED` audit event, so a `HEAD` used to fabricate a download that never happened. Both the JSON and binary builders take `headSafe`: a route that sets it `false` still authenticates and rate-limits a `HEAD`, then answers `v2HeadNoEffect()` — a bodiless 200 — before parsing or executing. Nothing observable is lost, because `HEAD` carries no body either way. Audit this whenever a read acquires an audit projection or an outbound call. +**A `GET` with side effects must declare `headSafe: false`.** The aliasing above is only sound because RFC 9110 §9.2.1 defines `HEAD` as safe. A `GET` that writes a row or opens an outbound connection is not, and an uptime monitor or link checker walking the documented URL list would drive those effects on every probe — `GET /files/{fileId}` records a `FILE_DOWNLOADED` audit event, so without `headSafe: false` a `HEAD` would fabricate a download that never happened. Both the JSON and binary builders take `headSafe`: a route that sets it `false` still authenticates and rate-limits a `HEAD`, then answers `v2HeadNoEffect()` — a bodiless 200 — before parsing or executing. Nothing observable is lost, because `HEAD` carries no body either way. Audit this whenever a read acquires an audit projection or an outbound call. ## Rule 3 — a collection that returns `nextCursor` must accept `limit` + `cursor`, and must apply them @@ -103,9 +102,9 @@ Three cursor schemes exist. Two are the shared codecs in `response.ts`, both opa - **Keyset** (`readSortedCursor` in, `encodeSortedCursor` out) — the default. Requires the page to come from one ordered SQL read. The sort AND the filters are stamped into the cursor and re-checked on replay, so changing `sortBy` or any filter mid-pagination is a 400, not a silently skipped page. - **Offset** (`decodeOffsetCursor` / `encodeOffsetCursor`) — only when a keyset is impossible. Two lists qualify: `GET /skills` merges a static in-code registry with DB rows and re-sorts in JS, and `GET /knowledge/{id}/documents` sits on a limit/offset query. A bare offset replayed against a re-sorted or re-filtered sequence names a different row, which skips or repeats results. -Both take the same two stamps: `cursorSortKey(sortBy, sortOrder)` for the ordering, and `cursorFilterScope({ ... })` for every param that filters the sequence. **`limit` is never a stamp** — it selects how much of the sequence to return, not what the sequence is, and binding it strands every cursor the moment a caller changes page size. Params that only shape the response body are out for the same reason. +Both take the same two stamps: `cursorSortKey(sortBy, sortOrder)` for the ordering, and `cursorScopeKey(cursorRoute(contract, pathParams), { ... })` for every param that filters the sequence — the route identity is the first argument, the filter parts the second. **`limit` is never a stamp** — it selects how much of the sequence to return, not what the sequence is, and binding it strands every cursor the moment a caller changes page size. Params that only shape the response body are out for the same reason. -The third is **per-domain**: a list whose read predates the shared codecs, or whose page boundary is not expressible as one, mints its own — a bare `encodeCursor({ version })` on `GET /workflows/{id}/versions` and `encodeCursor({ email })` on the workspace member list, the local codecs in `lib/audit-logs/query.ts`, `lib/logs/list-logs.ts`, and `lib/table/rows/cursor.ts`, and a usage-event id passed straight through by `GET /billing/logs`. Those tokens stay opaque and untouched, but a domain-minted cursor on a list a caller can re-filter is wrapped at the surface with `encodeScopedCursor(cursorFilterScope({...}), token)` and unwrapped with `readScopedCursor`, so it carries the same binding as the shared schemes. **A new list picks one of the two shared schemes.** Do not add a fourth. +The third is **per-domain**: a list whose read predates the shared codecs, or whose page boundary is not expressible as one, mints its own — a bare `encodeCursor({ version })` on `GET /workflows/{id}/versions` and `encodeCursor({ email })` on the workspace member list, the local codecs in `lib/audit-logs/query.ts`, `lib/logs/list-logs.ts`, and `lib/table/rows/cursor.ts`, and a usage-event id passed straight through by `GET /billing/logs`. Those tokens stay opaque and untouched, but a domain-minted cursor on a list a caller can re-filter is wrapped at the surface with `encodeScopedCursor(cursorScopeKey(cursorRoute(contract, pathParams), {...}), token)` and unwrapped with `readScopedCursor`, so it carries the same binding as the shared schemes. **A new list picks one of the two shared schemes.** Do not add a fourth. Every paged list's binding is declared in `lib/api/contracts/v2/__tests__/list-pagination.test.ts` and checked against what the contract actually accepts, in both directions. A new list, or a new filter on an existing one, fails that test until its binding is declared or the param is explicitly recorded as unable to change the sequence. @@ -115,15 +114,15 @@ Return `nextCursor: null` on the last page and only then. Never construct a curs **Ordering is `sortBy` + `sortOrder`, except where there is nothing to sort by.** Nearly every paged list takes the pair; `CURSOR_BINDINGS` in `contracts/v2/__tests__/list-pagination.test.ts` is the authoritative set. Exactly one — `GET /workflows/{workflowId}/runs` — has a single sortable column (start time), so there is no `sortBy` to pair with and the direction rides on a single `order` param; `sortBy`/`sortOrder` are not accepted there. That is the *only* sanctioned deviation, and it is documented in its contract. A new list picks the pair. Do not "fix" it by accepting `sortOrder` as an alias: an alias is a second spelling of one thing with undefined precedence when both arrive, which is its own inconsistency. -`GET /logs` was the second exception until it absorbed `POST /logs/query`. That fold is the cautionary tale for this rule: the justification for the `order` spelling was "logs have exactly one sortable column", and a second endpoint sorting the same rows four ways had already disproved it. When a rule's premise is contradicted by another endpoint on the same collection, fix the premise rather than documenting the exception. +Before documenting a second `order`-style exception, check every other endpoint on the same collection: if one of them already sorts those rows more than one way, the "exactly one sortable column" premise is false — fix the premise rather than documenting the exception. -**A boolean query param is a real boolean**, declared with `booleanQueryFlagSchema` from `contracts/primitives.ts`. It coerces `'true'`/`'1'` and `'false'`/`'0'`/`''`, so it is a strict widening of a `z.enum(['true','false'])` — which is what two v2 params used to be, purely by inheritance from the internal shapes they reused. Reusing an internal `.shape.x` inherits the internal spelling; re-declare instead when the internal one is not the v2 convention. +**A boolean query param is a real boolean**, declared with `booleanQueryFlagSchema` from `contracts/primitives.ts`; it coerces `'true'`/`'1'` and `'false'`/`'0'`/`''`. Reusing an internal `.shape.x` inherits the internal spelling (often a `z.enum(['true','false'])`); re-declare instead when the internal one is not the v2 convention. ## Rule 4 — reject what you do not implement **Every contract declares a `query`, even when the endpoint takes none** — `query: noInputSchema` (`z.object({}).strict()`), never omission. `parseRequest` validates the query slice only when the contract declares one, so an omitted `query` means "never look at the query string", not "takes no query params". The two were indistinguishable, which is how 69 contracts ended up accepting anything without anyone deciding they should: `GET /workflows/{id}?bogus=1` answered 200 while every list answered 400 for the same shape. `query-declaration.test.ts` sweeps the tree so contract 70 fails at authoring time rather than shipping unvalidated. -Declaring them is a **deliberate tightening** of endpoints that previously ignored an unknown param. It was weighed and kept: the v2 body slice on those same endpoints was already strict, so the split was arbitrary rather than a promise to callers; a mistyped param that is silently dropped is the bug class this rule exists to prevent; and no first-party caller sends an undeclared v2 query param (the two SDKs send only `includeOutput`/`selectedOutputs`, both declared; the UI makes no v2 calls at all; `requestJson` appends nothing implicitly and no v2 cache buster exists). Third-party callers appending a tracking tag or cache buster do break, which is why `api-reference/getting-started.mdx` documents the behavior rather than leaving it to be discovered from a 400. +Unknown query params are a 400. That is safe for first-party callers — the two SDKs send only `includeOutput`/`selectedOutputs`, both declared; the UI makes no v2 calls; `requestJson` appends nothing implicitly and there is no v2 cache buster — and it matches the already-strict body slice. Third-party callers appending a tracking tag or cache buster do break, which is why `api-reference/getting-started.mdx` documents the behavior rather than leaving it to be discovered from a 400. Query and body schemas are **`.strict()`** — and `.strict()` binds the **top level only**. A strict body containing a non-strict nested object still drops unknown keys one level down, which is the headline `filter` bug at a smaller scale: `sort: [{ field, direction, nulls: 'last' }]` answered 200 and ordered by the default. Strictness belongs on the shared nested schema (`sortSpecSchema`'s element, `tableViewConfigSchema`), not restated per body. @@ -163,7 +162,7 @@ The 503 default is applied by `v2Error` keyed on the response *status* — `Retr Do not add a default for any other code. 400/403/404/409 are not fixed by waiting, and 402 (`USAGE_LIMIT_EXCEEDED`) is resolved by a billing change, not by time. -**Where a policy already knows the wait, carry it — do not re-guess it at the transport.** The admission descriptors in `lib/core/admission/transient-failure` declare `retryAfterSeconds` per denial. That value used to be dropped when the descriptor was mapped onto a preprocess error, so a concurrency denial arrived as a bare 429 with no `Retry-After` even though the policy had named the wait. It now travels `descriptor.retryAfterSeconds → PreprocessExecutionError.retryAfterMs → ExecuteWorkflowServiceFailure.retryAfterMs → serviceFailureResponse`. The `v2Error` default is the floor for paths with *no* policy signal, not the source of truth. +**Where a policy already knows the wait, carry it — do not re-guess it at the transport.** The admission descriptors in `lib/core/admission/transient-failure` declare `retryAfterSeconds` per denial. Carry it the whole way: `descriptor.retryAfterSeconds → PreprocessExecutionError.retryAfterMs → ExecuteWorkflowServiceFailure.retryAfterMs → serviceFailureResponse`; a mapping that drops it turns a concurrency denial into a bare 429 with no `Retry-After` even though the policy named the wait. The `v2Error` default is the floor for paths with *no* policy signal, not the source of truth. **A failure whose outcome is unknown must not advise a retry.** `ASYNC_ENQUEUE_AMBIGUOUS` is a 503 whose enqueue may have succeeded — it deliberately retains its execution-ID claim. Telling that caller to come back in 5 seconds invites a client with no `X-Run-Id` to start and bill a second run. It passes `omitRetryAfter: true` and returns the run id so the caller reconciles instead. Any future "we don't know if it happened" failure does the same. @@ -176,7 +175,7 @@ Audited against the primary specs and against Stripe, GitHub, and Google's AIPs. | Practice | Verdict | Why | |---|---|---| | **RFC 9457 `application/problem+json`** | No | 9457 §4 steers APIs with an existing format toward keeping it: "Problem details are intended to avoid the necessity of establishing new 'fault' or 'error' document formats, **not to replace existing domain-specific formats**." Nothing in it is a `MUST` to adopt, and none of Stripe, GitHub, or Google use it. Our envelope is load-bearing for every client. **The default error shape does not change.** | -| **`RateLimit`/`RateLimit-Policy` (IETF draft)** | No | Still an unpublished draft (`-11`, May 2026), returned "Not ready" at HTTPDIR review, and on its **third mutually incompatible wire format** — anything built against `-07` or earlier is already broken. None of the three surveyed APIs emit it; GitHub uses `x-ratelimit-*`, as we do. | +| **`RateLimit`/`RateLimit-Policy` (IETF draft)** | No | Still an unpublished IETF draft whose wire format has changed incompatibly across revisions — anything built against an earlier revision is already broken. None of the three surveyed APIs emit it; GitHub uses `x-ratelimit-*`, as we do. Re-check the draft's status before re-opening. | | **Renaming `X-RateLimit-*` per RFC 6648** | No | 6648 is a `SHOULD NOT` binding *creators of new* parameters, and §1 item 4 "**makes no recommendation as to whether existing 'X-' parameters ought to remain in use or be migrated**". Appendix B argues the migration is itself the interoperability harm. A rename is a client-visible break bought with nothing. | | **`X-RateLimit-Reset` as delta-seconds** | No | It is an absolute ISO 8601 timestamp, so it is clock-skew sensitive — but the response where timing actually decides behaviour (429) also carries `Retry-After`, which is skew-free. The absolute value stays useful for scheduling. | | **422 for semantic validation** | No | RFC 9110 §15.5.21 defines 422, but Appendix B.3 records that 9110 **deleted** RFC 4918's clause saying 400 was inappropriate. 400 covers "cannot or will not process… perceived to be a client error". The split is convention, not requirement — GitHub splits, Stripe and Google do not. Our machine-readable `error.code` already carries the distinction, and restatusing now breaks clients. | diff --git a/.agents/skills/validate-connector/SKILL.md b/.agents/skills/validate-connector/SKILL.md index 81070a8e2a3..9e25db59753 100644 --- a/.agents/skills/validate-connector/SKILL.md +++ b/.agents/skills/validate-connector/SKILL.md @@ -159,11 +159,11 @@ For each API endpoint the connector calls: - [ ] The connector does NOT hit known API pagination limits silently (e.g., HubSpot search 10k cap) ### Deletion-Reconciliation Safety (`listingCapped`) — CRITICAL -The sync engine hard-deletes any stored document absent from a full listing. Audit every path where `listDocuments` can return less than the full source set: +The sync engine tombstones, then hard-deletes, any stored document absent from a full listing. Audit every path where `listDocuments` can return less than the full source set: - [ ] `syncContext.listingCapped = true` is set when a `maxItems`-style cap truncates the listing while more documents exist - [ ] `listingCapped` is set when a transient per-item error drops a still-existing document from the listing - [ ] `listingCapped` is NOT set when the source is genuinely exhausted (deleted documents must reconcile) or for intentional scope filters (date cutoffs) -This is the most common connector bug class — verify it explicitly against `sync-engine.ts`'s reconciliation gate. +Verify it explicitly against `shouldReconcileDeletions` in `sync-engine.ts`. ### Pagination State Across Pages - [ ] `syncContext` is used to cache state across pages (user names, field maps, instance URLs, portal IDs, etc.) @@ -311,7 +311,7 @@ Group findings by severity: - Incorrect response field mapping (accessing wrong path) - SOQL/query fields that don't exist on the target object - Pagination that silently hits undocumented API limits -- Missing `syncContext.listingCapped = true` when a cap or transient error truncates the listing — the sync engine hard-deletes the documents absent from the partial listing +- Missing `syncContext.listingCapped = true` when a cap or transient error truncates the listing — the sync engine tombstones and later hard-deletes the documents absent from the partial listing - Missing error handling that would crash the sync - `requiredScopes` not a subset of OAuth provider scopes - Query/filter injection: user-controlled values interpolated into OData `$filter`, SOQL, or query strings without escaping diff --git a/.agents/skills/validate-integration/SKILL.md b/.agents/skills/validate-integration/SKILL.md index 541f9e37846..308df1d6691 100644 --- a/.agents/skills/validate-integration/SKILL.md +++ b/.agents/skills/validate-integration/SKILL.md @@ -215,7 +215,7 @@ For **each tool** in `tools.access`: - Enum/fixed options → `dropdown` - Free text → `short-input` - Long text/content → `long-input` - - True/false → `dropdown` with Yes/No options (not `switch` unless purely UI toggle) + - True/false → `switch` (a Yes/No `dropdown` only when the tool needs a third "unset" state) - Credentials → `oauth-input` with correct `serviceId` - [ ] Dropdown `value: () => 'default'` is set for dropdowns with a sensible default @@ -235,19 +235,18 @@ For **each tool** in `tools.access`: - [ ] Timestamp fields have `wandConfig` with `generationType: 'timestamp'` - [ ] Comma-separated list fields have `wandConfig` with a descriptive prompt - [ ] Complex filter/query fields have `wandConfig` with format examples in the prompt -- [ ] All `wandConfig` prompts end with "Return ONLY the [format] - no explanations, no extra text." +- [ ] All `wandConfig` prompts end with an explicit `Return ONLY the ` instruction so the generated value can be pasted directly into the field - [ ] `wandConfig.placeholder` describes what to type in natural language ### Tools Config - [ ] `tools.access` lists **every** tool ID the block can use — none missing - [ ] `tools.config.tool` returns the correct tool ID for each operation -- [ ] Type coercions are in `tools.config.params` (runs at execution time), NOT in `tools.config.tool` (runs at serialization time before variable resolution) +- [ ] Type coercions are in `tools.config.params` (runs at execution time), NOT in `tools.config.tool` (runs at serialization time before variable resolution — coercing there destroys dynamic references like ``) - [ ] `tools.config.params` handles: - `Number()` conversion for numeric params that come as strings from inputs - `Boolean` / string-to-boolean conversion for toggle params - Empty string → `undefined` conversion for optional dropdown values - Any subBlock ID → tool param name remapping -- [ ] No `Number()`, `JSON.parse()`, or other coercions in `tools.config.tool` — these would destroy dynamic references like `` ### Block Outputs - [ ] Outputs cover the key fields returned by ALL tools (not just one operation) @@ -481,7 +480,7 @@ After fixing, confirm: - [ ] Reported all issues grouped by severity - [ ] Fixed all critical and warning issues - [ ] Ran `bun run tool-metadata:generate` if any tool outputs/params changed, and confirmed `bun run tool-metadata:check` passes -- [ ] Ran `bun run generate-docs` if any block metadata changed, and committed the full generated diff — including stale-page catch-up for other integrations (`bun run docs:check` fails CI on reverted generator output) +- [ ] Ran `bun run scripts/generate-docs.ts` if any block metadata changed, and committed the full generated diff — including stale-page catch-up for other integrations (`bun run docs:check` fails CI on reverted generator output) - [ ] Ran `bun run lint` after fixes - [ ] Verified TypeScript compiles clean - [ ] Verified added tests fail without their fix diff --git a/.agents/skills/validate-model/SKILL.md b/.agents/skills/validate-model/SKILL.md index d7d9cc88c6f..06d982ebe10 100644 --- a/.agents/skills/validate-model/SKILL.md +++ b/.agents/skills/validate-model/SKILL.md @@ -43,27 +43,7 @@ If a fetch fails (404, timeout, paywall), record the URL attempted and mark depe ## Step 3: Build the consumption map for this provider -Re-grep before trusting the snapshot below: - -```bash -rg "reasoningEffort|reasoning_effort" apps/sim/providers// -rg "verbosity" apps/sim/providers// -rg "request\.thinking|thinking:" apps/sim/providers// -rg "supportsNativeStructuredOutputs|nativeStructuredOutputs" apps/sim/providers// -``` - -Snapshot (verify before relying): - -| Capability | Consumed by | -|---|---| -| `reasoningEffort` | `openai/core.ts`, `azure-openai`, `anthropic/core.ts` (mapped via thinking), `gemini/core.ts` | -| `verbosity` | `openai/core.ts`, `azure-openai/index.ts` | -| `thinking` | `anthropic/core.ts`, `gemini/core.ts` | -| `nativeStructuredOutputs` | `anthropic/core.ts`, `fireworks/index.ts`, `openrouter/index.ts` | -| `computerUse` | `anthropic/core.ts` | -| `temperature` | All providers (passthrough) | - -A flag set in `models.ts` but not in the consumption list for this provider = **warning: dead flag**. +Use the Consumption Matrix in `.agents/skills/add-model/SKILL.md` Step 2 and run its re-grep commands for the target provider before relying on it. A flag set in `models.ts` that the provider's code does not read = **warning: dead flag**. ## Step 4: Run the checklist @@ -90,7 +70,7 @@ For each model, evaluate every row. Statuses: ✓ matches docs, ✗ disagrees, - [ ] `verbosity.values` — only on OpenAI gpt-5.x family; values match docs - [ ] `thinking.levels` + `thinking.default` — only on Anthropic/Gemini; values match docs - [ ] `thinking.streamed` — REQUIRED on Anthropic-family thinking models (`'full'` for generations returning full thinking deltas, `'summary'` for omitted-display generations like Opus 4.7+/Sonnet 5/Fable 5 where Sim requests `display: 'summarized'`); verify against the provider's thinking-display docs. After any change, run `bun run agent-stream-docs:generate` so the Agent block docs table stays in sync (CI diffs it) -- [ ] `nativeStructuredOutputs` — only on anthropic/fireworks/openrouter; provider must document Structured Outputs / JSON-mode for this model +- [ ] `nativeStructuredOutputs` — only on providers whose code consumes it (see the Consumption Matrix); provider must document Structured Outputs / JSON-mode for this model - [ ] `toolUsageControl` — provider supports `tool_choice` semantics - [ ] `computerUse` — provider implements computer-use loop AND model is a computer-use SKU - [ ] `deepResearch` — only on actual deep-research SKUs @@ -101,7 +81,7 @@ For each model, evaluate every row. Statuses: ✓ matches docs, ✗ disagrees, - [ ] `speedOptimized: true` — only on smallest/fastest tier (nano / flash-lite / haiku class) ### Hosting / billing -- [ ] If the model is under `openai`/`anthropic`/`google`, it is automatically in `getHostedModels()` → served with Sim's rotating key and billed via `shouldBillModelUsage()`. Confirm that is the intent (a BYOK-only model parked under one of these providers is a billing bug — warning). +- [ ] If `getHostedModels()` includes the model ID (`providers/models.ts` expands whole providers — more than openai/anthropic/google — plus the static Fireworks catalog), the model is served with Sim's rotating key and billed via `shouldBillModelUsage()`. Confirm that is the intent (a BYOK-only model parked under a hosted provider is a billing bug — warning). - [ ] If the model is hosted, the deployment is expected to have its `{PREFIX}_COUNT` / `{PREFIX}_1..N` env vars set (ops concern; note if it looks unset for a model claiming hosted support). ## Step 5: Report (mandatory format) @@ -148,17 +128,9 @@ After reporting, ask: *"Want me to fix the critical and warning items? I'll prin - 🔵 **suggestion** — style/consistency. Examples: field order, missing `speedOptimized` on a clearly smallest-tier model. - ❓ **unverified** — could not fetch an authoritative source for this field. Surface it; never silently confirm. -## Common bugs this skill catches - -- Pricing drift after a provider price cut (very common — providers cut quarterly) -- `reasoningEffort` set on always-reasoning models that reject the parameter (grok-4.3, o3-pro pattern) -- `nativeStructuredOutputs` set on providers that don't consume the flag (dead) -- `thinking` set on non-Anthropic/non-Gemini providers -- `verbosity` set on non-gpt-5.x models -- Wrong context window (e.g., 128k claimed vs 200k actual) -- Stale `pricing.updatedAt` -- Multiple `recommended: true` per provider after a flagship swap -- Missing `deprecated: true` on retired models (e.g., the xAI batch retiring May 15, 2026) +## Common drift + +Pricing changes after provider price cuts; `reasoningEffort`/`thinking`/`verbosity` set on a model whose provider code or API does not accept them; stale `pricing.updatedAt`; wrong context window; more than one `recommended` after a flagship swap; missing `deprecated: true` after a provider retirement announcement. ## What "I cannot verify this" looks like diff --git a/.agents/skills/validate-permission-group-item/SKILL.md b/.agents/skills/validate-permission-group-item/SKILL.md index febb6c278ec..3488765cdf2 100644 --- a/.agents/skills/validate-permission-group-item/SKILL.md +++ b/.agents/skills/validate-permission-group-item/SKILL.md @@ -77,7 +77,7 @@ The second grep misses a gate whose annotation sits in a TSDoc block above the e Classify into exactly one of: 1. **Declared on operations.** The funnel enforces in `requireCurrentHumanAccess` → `requireCapability`. Verify the set is *complete*: enumerate every route and tool reaching the same behavior. One declaring `capability: 'none'` is the hole. -2. **Asserted at a call site** with a `// permission-group-enforced: ` annotation. Verify it goes through `capability-assertions.ts` (`assertWorkspaceCapability`, `isWorkspaceCapabilityWithheld`, `isOrganizationCapabilityWithheld`, `capabilityDeniedBy`), through `isCapabilityWithheldForUser` (`lib/permission-groups/user-scope.server.ts` — workspace group first, else the organization's default, for a user-level act that may or may not name a workspace; outside `capability-assertions.ts` on purpose because it reads org membership through the billing graph, a guarded root of `check:application-graph`; `app/api/cli/auth/approve/route.ts` is the shape), or a direct `CAPABILITY_RULES[''].deniedBy(...)` rather than reading `config.disableX` inline, **and** that it *raises* through `refuseCapability` / renders `capabilityRefusal(cap)` rather than building its own `ForbiddenOperationError` with a hand-written message — the easy half to miss, because the decision looks right. Use-case shape: `validatePublicFileSharing`, `validateChatDeployAuth` (`ee/access-control/utils/permission-check.ts`), `assertConnectorTypeAllowed` (`lib/knowledge/application/connectors.ts`). Raw-route shape: `app/api/logs/stats/route.ts`, `app/api/table/[tableId]/export/route.ts`. A raw route should render through `capabilityRefusalResponse` (`lib/permission-groups/capability-response.ts`), which reads `details.code` off the rule — a hand-rolled `NextResponse.json({ error: capabilityRefusal(cap) }, { status: 403 })` drops it, reporting the four specifically-coded capabilities (`deploy.chat.auth_mode`, `file_share.publish`, `file_share.auth_mode`, `personal_api_key.use`) as the generic block. Convergence is partial — the inbox, api-keys, oauth-credentials, cli-approve and `logs/export` routes still hand-roll it, harmlessly today because all of their capabilities carry the generic code, so report one only if its capability gains a specific code. v1 is deliberately not converged on it (`resolveCapabilityRefusal` in `app/api/v1/middleware.ts`). +2. **Asserted at a call site** with a `// permission-group-enforced: ` annotation. Verify it goes through `capability-assertions.ts` (`assertWorkspaceCapability`, `isWorkspaceCapabilityWithheld`, `isOrganizationCapabilityWithheld`, `capabilityDeniedBy`), through `isCapabilityWithheldForUser` (`lib/permission-groups/user-scope.server.ts` — workspace group first, else the organization's default, for a user-level act that may or may not name a workspace; outside `capability-assertions.ts` on purpose because it reads org membership through the billing graph, a guarded root of `check:application-graph`; `app/api/cli/auth/approve/route.ts` is the shape), or a direct `CAPABILITY_RULES[''].deniedBy(...)` rather than reading `config.disableX` inline, **and** that it *raises* through `refuseCapability` / renders `capabilityRefusal(cap)` rather than building its own `ForbiddenOperationError` with a hand-written message — the easy half to miss, because the decision looks right. Use-case shape: `validatePublicFileSharing`, `validateChatDeployAuth` (`ee/access-control/utils/permission-check.ts`), `assertConnectorTypeAllowed` (`lib/knowledge/application/connectors.ts`). Raw-route shape: `app/api/logs/stats/route.ts`, `app/api/table/[tableId]/export/route.ts`. A raw route should render through `capabilityRefusalResponse` (`lib/permission-groups/capability-response.ts`), which reads `details.code` off the rule — a hand-rolled `NextResponse.json({ error: capabilityRefusal(cap) }, { status: 403 })` drops it, reporting the four specifically-coded capabilities (`deploy.chat.auth_mode`, `file_share.publish`, `file_share.auth_mode`, `personal_api_key.use`) as the generic block. Convergence is partial: `grep -rln "capabilityRefusal(" apps/sim/app --include=route.ts` lists the raw routes that still hand-roll it (ignore `*.test.ts`, `app/api/v1/middleware.ts`, `app/api/table/utils.ts`, and the v2 envelope, which are not raw-route responses). A raw route you add or touch renders through `capabilityRefusalResponse`; report an untouched hand-rolled one as a finding when its capability carries a specific code, otherwise as a note. v1 is deliberately not converged on it (`resolveCapabilityRefusal` in `app/api/v1/middleware.ts`). 3. **Executor-gated** by `assertPermissionsAllowed`, per block / tool / model, matching through the shared primitives in `lib/permission-groups/` — `block-access.ts`, `operation-access.ts`, `model-access.ts`, `integration-allowlist.ts` — which the editor and Copilot projections read too, so a second copy of a match rule is a finding. Verify the branch throws a real error and that the id it compares against is the vocabulary the admin UI writes — `deniedTools` holds block `tools.access` ids verbatim, version suffix included. `allowedIntegrations` is *also* enforced off the run, by `assertSelectorIntegrationAllowed` (`lib/selectors/server/integration-access.ts`), so an executor key's coverage is not complete until every non-run path that reaches the third party is checked too. 4. **A field projection, not a gate.** `logs.trace_spans` and `logs.cost` withhold fields, so the logs routes correctly declare `capability: 'none'`. Single owner: `lib/logs/log-projection.ts` (`resolveLogFieldProjection`, `projectExecutionData`, `projectCostTotal`), which carries both annotations. A **second** implementation of the same redaction is the finding — as is a query that lets a caller filter or sort on a withheld field, which turns the projection into an oracle. 5. **Nothing.** Report as a defect: "an organization that sets this believes it applied a restriction that does not exist". @@ -93,8 +93,8 @@ For an allowlist the three states must be tested separately — `null` permits e **Read the subject, not the nearest user id.** Every capability sink must take its subject from the `capabilityGoverned*` helper for the identity the surface holds — `capabilityGovernedPrincipalUserId` for a `Principal` (`lib/core/application`), `capabilityGovernedUserId` for a v1 `RateLimitResult` or a `TableAccessPrincipal`, `capabilityGovernedAuthUserId` for a `checkSessionOrInternalAuth` result. Each returns `null` where no group governs, and `null` is a pass. Reading `rateLimit.userId`, `auth.userId`, `subjectUserId` or `triggeredByUserId` into a sink is the finding: for a workspace key the first is the key's *creator*, for an internal JWT the second is the run's actor, and the last is a billing *attribution*. `check-capability-subject.ts` audits **v1 only**, so every other surface is on you. Where the subject is persisted and read back later (`capabilityGovernedUserId` on `table_run_dispatches` / `table_row_executions`), it must be declared required as `string | null` — an optional field with a fallback is exactly how producers re-inherited `triggeredByUserId`, so a proposal to make it optional is a finding. - **`/api/v1`** authorizes in `app/api/v1/middleware.ts`, not through `authorizeWorkspaceOperation`; `capabilityGovernedUserId(rateLimit)` branches on `keyType`, never on the presence of a user id. Each route also threads a required, spelled-out `V1RouteCapability`. -- **Raw internal table routes** gate `tables.use` in `checkAccess` (`app/api/table/utils.ts`) via a `TableAccessPrincipal` union — `{ kind: 'user'; userId }` or `{ kind: 'workspace_api_key'; keyCreatorUserId }` — so a bare id no longer type-checks. `tableAccessPrincipal(rateLimit)` is the one place v1 builds it. -- **The definition-time `undefined` guard** on `defineWorkspaceOperation` is not redundant even though `capability` is required on the `ApplicationOperation` **base type** (`lib/core/application/operation.ts:31`, not merely on the builder — which is what stops a bare-literal factory from compiling): `apps/sim/tsconfig.json` excludes `*.test.ts` / `*.test.tsx` and the enforcement audit walks past test files, so a fixture is the one construction site no static check reads. Without it a capability-less operation defines cleanly and then throws `Cannot read properties of undefined` inside `capabilityDeniedBy` **only for tenants that actually have a permission group**, passing CI and every personal workspace. A proposal to drop it is a finding. +- **Raw internal table routes** gate `tables.use` in `checkAccess` (`app/api/table/utils.ts`) via a `TableAccessPrincipal` union — `{ kind: 'user'; userId }` or `{ kind: 'workspace_api_key'; keyCreatorUserId }` — so a bare id does not type-check. `tableAccessPrincipal(rateLimit)` is the one place v1 builds it. +- **The definition-time `undefined` guard** on `defineWorkspaceOperation` is not redundant even though `capability` is required on the `ApplicationOperation` **base type** (the `capability` field in `lib/core/application/operation.ts`, not merely on the builder — which is what stops a bare-literal factory from compiling): `apps/sim/tsconfig.json` excludes `*.test.ts` / `*.test.tsx` and the enforcement audit walks past test files, so a fixture is the one construction site no static check reads. Without it a capability-less operation defines cleanly and then throws `Cannot read properties of undefined` inside `capabilityDeniedBy` **only for tenants that actually have a permission group**, passing CI and every personal workspace. A proposal to drop it is a finding. ## Step 6: Tests @@ -112,12 +112,12 @@ bun run check:capability-subject cd apps/sim && bun run type-check && bunx vitest run lib/permission-groups ``` -All three are inside `check:audits`, which derives its list from the `check:*` scripts in `package.json` — a new audit is opted *out* deliberately. Read the output, not the exit codes. Reference success lines (counts grow): +All three are inside `check:audits`, which derives its list from the `check:*` scripts in `package.json` — a new audit is opted *out* deliberately. Read the output, not the exit codes. Success-line shapes (the counts must include the item under audit): ``` -✓ permission-group enforcement: 322 operations declare a capability, 35 capabilities all enforced -✅ Application graph clean: 5 roots reach none of 11 forbidden module trees -check:capability-subject — 32 v1 files, 5 capability subjects resolved through capabilityGovernedUserId. +✓ permission-group enforcement: operations declare a capability, capabilities all enforced +✅ Application graph clean: roots reach none of forbidden module trees +check:capability-subject — v1 files, capability subjects resolved through capabilityGovernedUserId. ``` | Audit | What it catches | @@ -128,7 +128,7 @@ check:capability-subject — 32 v1 files, 5 capability subjects resolved through Two ways the enforcement audit passes without proving what you want: -- **Vacuous parse.** It reads source text with regexes, so it refuses success when the three registries parse to nothing, cross-checks rule count against capability count, reports per call any unreadable `id`, fails a file that mints an operation but parses to **zero** declarations, and flags any exported `*Operations` registry member it read no operation from. If one fires the audit is broken, not the code — fix the parsers rather than leaving it green. (That last guard exists because an operation minted by a factory that never calls the builder bypasses the required type *and* the audit; twenty-one operations across six domains were invisible that way while the file still printed a tick.) +- **Vacuous parse.** It reads source text with regexes, so it refuses success when the three registries parse to nothing, cross-checks rule count against capability count, reports per call any unreadable `id`, fails a file that mints an operation but parses to **zero** declarations, and flags any exported `*Operations` registry member it read no operation from. If one fires the audit is broken, not the code — fix the parsers rather than leaving it green. (That last guard is what catches an operation minted by a factory that never calls the builder, which bypasses the required type *and* the audit.) - **A capability declared on an operation nothing routes to.** Assertion C is satisfied by the declaration alone. The audits prove *reachability*, never correctness — that a capability is named, a key is read by some rule, a subject came from the right helper. Step 5 is what covers the rest. diff --git a/.agents/skills/validate-trigger/SKILL.md b/.agents/skills/validate-trigger/SKILL.md index 715a6642d28..e2855c3d26c 100644 --- a/.agents/skills/validate-trigger/SKILL.md +++ b/.agents/skills/validate-trigger/SKILL.md @@ -222,7 +222,7 @@ After reporting, fix every **critical** and **warning** issue. Apply **suggestio After fixing, confirm: 1. `bun run type-check` passes 2. Re-read all modified files to verify fixes are correct -3. Provider handler tests pass (if they exist): `bun test {service}` +3. Provider handler tests pass (if they exist): `bun run --cwd apps/sim test lib/webhooks/providers/` — handler files are kebab-case (`azure-devops.ts`) while trigger directories are snake_case (`azure_devops`), so use the handler's actual basename 4. Any remaining unknown webhook payload schemas were explicitly reported to the user instead of guessed ## Checklist Summary diff --git a/.agents/skills/you-might-not-need-a-callback/SKILL.md b/.agents/skills/you-might-not-need-a-callback/SKILL.md index 51962f68201..46507b99628 100644 --- a/.agents/skills/you-might-not-need-a-callback/SKILL.md +++ b/.agents/skills/you-might-not-need-a-callback/SKILL.md @@ -38,14 +38,11 @@ If none of those apply — if the function is only called inline, or passed to a 4. **useCallback wrapping functions that return new objects/arrays**: Stable function identity, unstable return value — memoization is at the wrong level. Use `useMemo` on the return value instead, or restructure. 5. **useCallback with empty deps when deps are needed**: Stale closure — reads initial values forever. This is a correctness bug, not just a performance issue. 6. **Pairing useCallback + React.memo on trivially cheap renders**: If the child renders in < 1ms and re-renders rarely, the memo infrastructure costs more than it saves. -7. **useCallback in custom hooks that don't need stable references**: Not every hook return needs to be memoized. Only stabilize callbacks when consumers depend on referential equality. +7. **Internal helpers inside custom hooks wrapped for no observer**: functions a hook only calls internally need no `useCallback`. Functions a hook *returns* are wrapped by convention (`.claude/rules/sim-hooks.md` Rule 4, matching react.dev) — do not flag those for lacking an observer, but still check their dependency arrays (patterns 2-5 apply to them as much as to any other `useCallback`). ## Patterns that ARE correct — do not flag -- `useCallback` whose result is in a `useEffect` dep array — prevents the effect from re-running on every render -- `useCallback` whose result is in a `useMemo` dep array — prevents the memo from recomputing on every render -- `useCallback` whose result is a dep of another `useCallback` — stabilises a callback chain -- `useCallback` passed to a `React.memo`-wrapped child — the whole point of the pattern +- Any `useCallback` with an observer from the list above - This codebase's ref pattern: `useRef` + callback with empty deps that reads the ref inside — correct, do not flag: ```tsx diff --git a/.agents/skills/you-might-not-need-a-comment/SKILL.md b/.agents/skills/you-might-not-need-a-comment/SKILL.md index 2ea2290197c..788bbbda174 100644 --- a/.agents/skills/you-might-not-need-a-comment/SKILL.md +++ b/.agents/skills/you-might-not-need-a-comment/SKILL.md @@ -32,7 +32,7 @@ This codebase's convention: **TSDoc for documentation, no non-TSDoc comments, no - A `//` comment that explains a **non-obvious why**: a workaround for an upstream bug, an ordering constraint, a perf reason, a spec/edge-case the code can't self-document (`// first-match wins — matches the old find() semantics`). - Existing TSDoc `/** ... */` blocks on declarations — leave them (only tighten if verbose). -- `// boundary-raw-fetch:`, `// double-cast-allowed:`, `// boundary-raw-json:`, `// untyped-response:`, `// migration-safe:` and other **machine-read annotations** — these are load-bearing, never touch them. +- `// boundary-raw-fetch:`, `// double-cast-allowed:`, `// boundary-raw-json:`, `// untyped-response:`, `// migration-safe:`, `// rq-lint-allow:`, `// client-boundary-allow:` and any other `: ` annotation a script under `scripts/` greps for, in line-comment or block-comment form (e.g. the `/** svg-path-precision-exception: ... */` directive on icon paths) — these are load-bearing, never touch them. - `// biome-ignore`, `// eslint-disable`, `// @ts-expect-error` and other tooling directives. - `// TODO` / `// FIXME` that point at real, still-open work. diff --git a/.agents/skills/you-might-not-need-state/SKILL.md b/.agents/skills/you-might-not-need-state/SKILL.md index 8c9a43458d3..6006a2b3362 100644 --- a/.agents/skills/you-might-not-need-state/SKILL.md +++ b/.agents/skills/you-might-not-need-state/SKILL.md @@ -27,7 +27,7 @@ Read these before analyzing: 1. **Derived state stored in useState**: If a value can be computed from props, other state, or query data, compute it inline during render instead of storing it in state. 2. **Server state copied into useState**: Never `useState` + `useEffect` to sync React Query data into local state. Use query data directly. The only exception is forms where users edit server data. -3. **Props mirrored into state**: Never `useState(prop)` + `useEffect(() => setState(prop))`. Use the prop directly, or use a key to reset component state. +3. **Props mirrored into state**: Never `useState(prop)` + `useEffect(() => setState(prop))`. Use the prop directly, reset with a remount `key`, or — for seed-on-transition (e.g. a modal opening) — adjust during render with the `useState` prev-tracker in `.claude/rules/sim-hooks.md` "State shape" (mind its sentinel-on-mount and no-`useRef` rules). 4. **Chained useEffect state updates**: Never chain Effects that set state to trigger other Effects. Calculate all derived values in the event handler or inline during render. 5. **Storing objects when an ID suffices**: Store `selectedId` not a copy of the selected object. Derive the object: `items.find(i => i.id === selectedId)`. 6. **State that duplicates Zustand or React Query**: If the data already lives in a store or query cache, don't create a parallel useState. diff --git a/.agents/skills/you-might-not-need-url-state/SKILL.md b/.agents/skills/you-might-not-need-url-state/SKILL.md index 561829e4152..7eeec0b1b37 100644 --- a/.agents/skills/you-might-not-need-url-state/SKILL.md +++ b/.agents/skills/you-might-not-need-url-state/SKILL.md @@ -16,10 +16,6 @@ User arguments: $ARGUMENTS Shareable client view-state (active tab/panel, filters, search query, sort, pagination, selected-entity id, an open "view" modal/drawer that is a destination) lives in the URL via [`nuqs`](https://nuqs.dev) — driven by a co-located `search-params.ts`, never read via `useSearchParams().get(...)` and never mutated by hand-built query strings. Remote data stays in React Query; high-frequency / large / ephemeral / socket-synced state stays in Zustand; purely local UI stays in `useState`. -Shared helpers own the two repeated wirings — never hand-roll them inline: -- Sort: `createSortParams` from `@/lib/url-state` (in `search-params.ts`) + `useUrlSort` from `@/hooks/use-url-sort` (in the component) — defaulted mode for lists with a fixed default ordering, nullable mode when "no active sort" is distinct from the default column. -- Debounced search: `useDebouncedSearchSetter` from `@/hooks/use-debounced-search-setter` (grouped or single-param); settings list search boxes use `useSettingsSearch()` from `settings/components/use-settings-search`. Never write a trimmed value to a param that controls the input — trim on read. - `.claude/rules/sim-url-state.md` is the source of truth — read it first. ## References @@ -32,7 +28,7 @@ Read these before analyzing: ## Anti-patterns to detect -1. **Manual param reads for state**: `useSearchParams().get(...)` or `new URLSearchParams(window.location.search)` used to *read* view-state. Replace with `useQueryState`/`useQueryStates` bound to a `search-params.ts`. (Read-once auth/invite/redirect tokens — `token`, `callbackUrl`, `redirect`, `error`, `invite_flow`, `code` — are NOT view-state; leave them on `useSearchParams`.) +1. **Manual param reads for state**: `useSearchParams().get(...)` or `new URLSearchParams(window.location.search)` used to *read* view-state. Replace with `useQueryState`/`useQueryStates` bound to a `search-params.ts`. (Read-once auth/invite/redirect signals are NOT view-state — the list and the per-surface `new` caveat are in `.claude/rules/sim-url-state.md` "Read-once auth / redirect signals"; leave those on `useSearchParams`.) 2. **Hand-built query mutation**: constructing a query string + `router.replace`/`router.push` to change a param on the current path. Use a nuqs setter. (A `router.push` that changes the route *path* is fine; an outbound `new URLSearchParams` building an `href`/`window.open`/download/API URL is fine.) 3. **`window.history.replaceState`/`pushState`** to mutate a param. 4. **URL state duplicated into a store/useState + synced with an effect** (or a `popstate` listener). The URL is the single source of truth; derive from it, don't mirror it. diff --git a/.claude/skills/add-settings-page/SKILL.md b/.claude/skills/add-settings-page/SKILL.md index f3440cda8fd..02af76f3a8f 100644 --- a/.claude/skills/add-settings-page/SKILL.md +++ b/.claude/skills/add-settings-page/SKILL.md @@ -5,13 +5,16 @@ description: Add a new Sim settings page, or audit existing settings pages for d # Settings Page (add / audit) -Sim settings pages all render through the shared **`SettingsPanel`** primitive, -which owns the page chrome and renders a nav-driven title + description. The full +Settings page chrome (header bar, scroll region, content column, nav-driven +title + description) is owned by the `settings/[section]/layout.tsx` shell. Each +page renders through **`SettingsPanel`**, which registers the page's header data +(actions, search, back) with that shell and renders only the body. The full convention lives in `.claude/rules/sim-settings-pages.md` — read it first; this skill is the procedure. Key paths: -- Layout primitive: `apps/sim/app/workspace/[workspaceId]/settings/components/settings-panel/settings-panel.tsx` +- Chrome shell: `apps/sim/app/workspace/[workspaceId]/settings/[section]/layout.tsx` (`SettingsHeaderShell`) +- `SettingsPanel` registrar: `apps/sim/components/settings/settings-panel.tsx` - Nav metadata (titles + descriptions): `apps/sim/components/settings/navigation.ts` - Section switch + provider: `apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx` - Pages: `apps/sim/app/workspace/[workspaceId]/settings/components//.tsx` and EE pages under `apps/sim/ee//components/` @@ -25,10 +28,8 @@ Key paths: `requiresEnterprise`, etc.). 2. **Wire the switch.** Add the component to the `effectiveSection` render switch in `settings/[section]/settings.tsx` (lazy `dynamic(...)` like its siblings). -3. **Build the body inside `SettingsPanel`.** Never hand-roll the shell, header - bar, scroll region, content column, or title block. Put header buttons in - `actions`, a standalone search in `search={{ value, onChange, placeholder }}`, - and the page content as `children`. Modals go beside the panel inside a `<>`. +3. **Build the body inside `SettingsPanel`** per the rule's canonical page shape: + `actions`, `search`, `children`, modal siblings in a fragment. 4. **If the page has editable state**, wire the shared save/discard stack — put `SaveDiscardActions` (dirty-gated Discard+Save chips) in `actions`, and call `useSettingsUnsavedGuard({ isDirty })` **before any early-return gate**. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfac30a378a..82f4b3299cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -732,9 +732,7 @@ jobs: # release-only simstudioai/sim-desktop-releases repository. Keeping these # builds out of this source repository prevents its followers from receiving # every internal shell release. Each environment's /api/desktop/update feed - # still offers only its own stream. Unlike stable releases, prereleases build - # before the Apple signing secrets exist — unsigned, so the update pipeline - # remains testable end to end with a manual download. + # still offers only its own signed stream. create-desktop-prerelease: name: Create Desktop Prerelease runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }} @@ -742,7 +740,13 @@ jobs: needs: [detect-desktop-changes, check-desktop-signing] # Requires the signing probe to have actually succeeded (not just "not # cancelled") so a probe failure can't produce a release with no build. - if: ${{ !cancelled() && needs.detect-desktop-changes.outputs.changed == 'true' && needs.check-desktop-signing.result == 'success' }} + if: >- + ${{ + !cancelled() && + needs.detect-desktop-changes.outputs.changed == 'true' && + needs.check-desktop-signing.result == 'success' && + needs.check-desktop-signing.outputs.configured == 'true' + }} permissions: contents: read outputs: @@ -758,13 +762,12 @@ jobs: GH_TOKEN: ${{ github.token }} PRERELEASE_REPOSITORY: simstudioai/sim-desktop-releases SOURCE_REPOSITORY: ${{ github.repository }} - SIGNED: ${{ needs.check-desktop-signing.outputs.configured }} run: | if [ -z "$DESKTOP_RELEASE_TOKEN" ]; then echo "::error::DESKTOP_RELEASE_TOKEN is required to publish desktop prereleases." exit 1 fi - if [ "$GITHUB_REF" = "refs/heads/dev" ]; then CHANNEL=dev; APP_NAME="Sim Dev"; else CHANNEL=staging; APP_NAME="Sim Staging"; fi + if [ "$GITHUB_REF" = "refs/heads/dev" ]; then CHANNEL=dev; else CHANNEL=staging; fi # Prerelease core = next patch after the latest stable release, so # channel builds always outrank the stable they are built on top of # and are always superseded by the next stable. The run-attempt @@ -786,11 +789,6 @@ jobs: IFS='.' read -r MAJOR MINOR PATCH <<< "${LATEST#v}" TAG="v${MAJOR}.${MINOR}.$((PATCH + 1))-${CHANNEL}.${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}" NOTES="Automated ${CHANNEL}-channel desktop build from ${GITHUB_REF_NAME} @ ${GITHUB_SHA::7}." - if [ "$SIGNED" != "true" ]; then - NOTES="$NOTES - - ⚠️ Unsigned test build (Apple signing secrets not configured). Gatekeeper will quarantine a downloaded copy: right-click → Open, or clear the flag with \`xattr -dr com.apple.quarantine \"/Applications/${APP_NAME}.app\"\`." - fi # Draft until the build uploads its artifacts: drafts are invisible # to the update feed, so a failed or in-flight build can never take # the channel down with an assetless release. The release-only repo @@ -818,7 +816,7 @@ jobs: with: version: ${{ needs.create-desktop-prerelease.outputs.version }} publish: true - sign: ${{ needs.check-desktop-signing.outputs.configured == 'true' }} + sign: true secrets: inherit # The draft only becomes visible to the update feed once its artifacts are diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml index b3c51213545..fd9d8584687 100644 --- a/.github/workflows/desktop-release.yml +++ b/.github/workflows/desktop-release.yml @@ -19,10 +19,8 @@ on: type: boolean default: true sign: - description: Sign and notarize with the Apple Developer identity. When - false (prerelease testing before the signing secrets exist) the build - is packaged unsigned; installed shells detect this and offer manual - downloads instead of Squirrel installs. + description: Sign and notarize with the Apple Developer identity. Unsigned + builds are workflow artifacts only and cannot be published. required: false type: boolean default: true @@ -50,6 +48,7 @@ jobs: build-sign-notarize: name: Build, Sign, Notarize runs-on: macos-26 + timeout-minutes: 60 steps: - name: Checkout code uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 @@ -101,8 +100,8 @@ jobs: echo "::error::Manual desktop releases must use a stable source-repository tag." exit 1 fi - if [ "$TOKEN_KIND" = stable ] && [ "$PUBLISH" = true ] && [ "$SIGN" != true ]; then - echo "::error::Stable desktop releases must be signed before publication." + if [ "$PUBLISH" = true ] && [ "$SIGN" != true ]; then + echo "::error::Desktop releases must be signed before publication." exit 1 fi if [ "$TOKEN_KIND" = stable ]; then @@ -206,10 +205,9 @@ jobs: bunx electron-builder --mac --publish never -c.productName="$PRODUCT_NAME" -c.appId="$APP_ID" - # Unsigned prerelease path: no Developer ID, no notarization. The - # binaries are explicitly ad-hoc signed with Hardened Runtime off, which - # runs locally but gets quarantined when downloaded — fine for testing - # the update pipeline without Developer ID credentials. + # Unsigned artifact-only path: no Developer ID or notarization. The bundle + # is ad-hoc signed with Hardened Runtime off for local workflow testing and + # must never be published. - name: Package unsigned if: ${{ !inputs.sign }} working-directory: apps/desktop @@ -274,6 +272,9 @@ jobs: - name: Validate signature and notarization if: ${{ inputs.sign }} env: + APP_ID: ${{ steps.channel.outputs.app_id }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + PRODUCT_NAME: ${{ steps.channel.outputs.name }} VERSION: ${{ inputs.version }} run: | SEMVER="${VERSION#v}" @@ -281,6 +282,25 @@ jobs: ZIP="apps/desktop/release/Sim-${SEMVER}-universal.zip" MOUNT_POINT="$RUNNER_TEMP/sim-dmg" ZIP_DIR="$(mktemp -d "$RUNNER_TEMP/sim-zip.XXXXXX")" + validate_identity() { + local APP_BUNDLE="$1" + local ACTUAL_APP_ID ACTUAL_NAME SIGNATURE + ACTUAL_APP_ID="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$APP_BUNDLE/Contents/Info.plist")" + ACTUAL_NAME="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleName' "$APP_BUNDLE/Contents/Info.plist")" + SIGNATURE="$(codesign -dv --verbose=4 "$APP_BUNDLE" 2>&1)" + if [ "$ACTUAL_APP_ID" != "$APP_ID" ] || [ "$ACTUAL_NAME" != "$PRODUCT_NAME" ]; then + echo "::error::Unexpected packaged identity: $ACTUAL_NAME ($ACTUAL_APP_ID)." + exit 1 + fi + if ! grep -Fxq "TeamIdentifier=$APPLE_TEAM_ID" <<< "$SIGNATURE"; then + echo "::error::The app was not signed by the expected Apple team." + exit 1 + fi + if ! grep -Eq 'flags=.*runtime' <<< "$SIGNATURE"; then + echo "::error::The app was not signed with Hardened Runtime." + exit 1 + fi + } mkdir -p "$MOUNT_POINT" hdiutil attach "$DMG" -mountpoint "$MOUNT_POINT" -nobrowse -quiet trap 'hdiutil detach "$MOUNT_POINT" -quiet || true; rm -rf "$ZIP_DIR"' EXIT @@ -292,6 +312,7 @@ jobs: xcrun stapler validate "$APP_BUNDLE" spctl --assess --type execute --verbose "$APP_BUNDLE" codesign --verify --deep --strict "$APP_BUNDLE" + validate_identity "$APP_BUNDLE" unzip -q "$ZIP" -d "$ZIP_DIR" ZIP_APP="$(find "$ZIP_DIR" -maxdepth 2 -name '*.app' -print -quit)" if [ -z "$ZIP_APP" ]; then @@ -301,6 +322,7 @@ jobs: xcrun stapler validate "$ZIP_APP" spctl --assess --type execute --verbose "$ZIP_APP" codesign --verify --deep --strict "$ZIP_APP" + validate_identity "$ZIP_APP" hdiutil detach "$MOUNT_POINT" -quiet rm -rf "$ZIP_DIR" trap - EXIT diff --git a/apps/desktop/README.md b/apps/desktop/README.md index c8deeb969d1..bd3e9dffc5d 100644 --- a/apps/desktop/README.md +++ b/apps/desktop/README.md @@ -171,7 +171,7 @@ Raw local file bytes are never exposed through the preload bridge and cannot be ## Auto-update, channels, rollout, rollback -- `electron-updater` reads the deployment's `/api/desktop/update` feed; production resolves stable releases from `simstudioai/sim`, while dev/staging resolve prereleases from `simstudioai/sim-desktop-releases`. Artifact downloads go directly to GitHub and deltas use `.zip.blockmap`. Install is prompt-based (Restart Now / Later; Later installs on quit) — never forced mid-session. +- `electron-updater` reads the deployment's `/api/desktop/update` feed; production resolves stable releases from `simstudioai/sim`, while dev/staging resolve prereleases from `simstudioai/sim-desktop-releases`. Artifact downloads go directly to GitHub and deltas use `.zip.blockmap`. Sim validates every candidate before starting its download. Developer ID builds installed under `/Applications` use a prompt (Restart and update / Later; Later installs on quit); other packaged builds offer a validated installer download — never forced mid-session. - Streams: production follows stable `X.Y.Z` releases, dev follows `-dev.N`, and staging follows `-staging.N`. The feed still recognizes legacy `-alpha.N`/`-beta.N` releases during migration. - Staged rollout: after publishing, edit `stagingPercentage: 10` into the release's `latest-mac.yml`, then raise as crash metrics stay clean. - Rollback: a pulled release must be superseded by a **higher** version — users on the broken build will not reinstall an equal one. (A blocked-versions kill-switch was removed as unwired dead code; reintroduce it in `updater.ts` if a remote config source ever exists to feed it.) diff --git a/apps/desktop/scripts/ensure-pty-prebuilds.ts b/apps/desktop/scripts/ensure-pty-prebuilds.ts index a41f94cfae8..a08856a51f2 100644 --- a/apps/desktop/scripts/ensure-pty-prebuilds.ts +++ b/apps/desktop/scripts/ensure-pty-prebuilds.ts @@ -14,10 +14,23 @@ * one. That is why this build needs no `x64ArchFiles` rule. */ import { execFileSync } from 'node:child_process' -import { existsSync, mkdirSync, mkdtempSync, renameSync, rmSync, writeFileSync } from 'node:fs' +import { createHash, timingSafeEqual } from 'node:crypto' +import { + existsSync, + mkdirSync, + mkdtempSync, + readFileSync, + renameSync, + rmSync, + writeFileSync, +} from 'node:fs' import { tmpdir } from 'node:os' import { dirname, join } from 'node:path' import { fileURLToPath } from 'node:url' +import { createLogger } from '@sim/logger' +import { getErrorMessage } from '@sim/utils/errors' + +const logger = createLogger('DesktopPtyPrebuilds') const REQUIRED_ARCHES = ['darwin-arm64', 'darwin-x64'] as const @@ -49,8 +62,30 @@ function packageDir(arch: string): string { return join(workspaceRoot, 'node_modules', '@lydell', `node-pty-${arch}`) } +function expectedIntegrity(arch: string, version: string): string { + const packageName = `@lydell/node-pty-${arch}` + const prefix = `"${packageName}": ["${packageName}@${version}"` + const entry = readFileSync(join(workspaceRoot, 'bun.lock'), 'utf8') + .split('\n') + .find((line) => line.trimStart().startsWith(prefix)) + const integrity = entry ? /,\s*"(sha512-[^"]+)"\],?$/.exec(entry)?.[1] : undefined + if (!integrity) { + throw new Error(`Could not find the pinned integrity for ${packageName}@${version}`) + } + return integrity +} + +function verifyIntegrity(bytes: Buffer, integrity: string, packageName: string): void { + const expected = Buffer.from(integrity.slice('sha512-'.length), 'base64') + const actual = createHash('sha512').update(bytes).digest() + if (expected.length !== actual.length || !timingSafeEqual(expected, actual)) { + throw new Error(`Integrity check failed for ${packageName}`) + } +} + async function fetchPrebuild(arch: string, version: string): Promise { const name = `node-pty-${arch}` + const packageName = `@lydell/${name}` const url = `https://registry.npmjs.org/@lydell/${name}/-/${name}-${version}.tgz` const response = await fetch(url) if (!response.ok) { @@ -60,7 +95,9 @@ async function fetchPrebuild(arch: string, version: string): Promise { const staging = mkdtempSync(join(tmpdir(), 'sim-pty-prebuild-')) try { const tarball = join(staging, 'package.tgz') - writeFileSync(tarball, Buffer.from(await response.arrayBuffer())) + const bytes = Buffer.from(await response.arrayBuffer()) + verifyIntegrity(bytes, expectedIntegrity(arch, version), packageName) + writeFileSync(tarball, bytes) execFileSync('tar', ['-xzf', tarball, '-C', staging], { stdio: 'pipe' }) const target = packageDir(arch) @@ -77,10 +114,10 @@ async function run(): Promise { for (const arch of REQUIRED_ARCHES) { const dir = packageDir(arch) if (existsSync(join(dir, 'prebuilds', arch, 'pty.node'))) { - console.log(`• node-pty prebuild present: ${arch}`) + logger.info('node-pty prebuild present', { arch }) continue } - console.log(`• Fetching node-pty prebuild: ${arch}@${version}`) + logger.info('Fetching node-pty prebuild', { arch, version }) await fetchPrebuild(arch, version) if (!existsSync(join(dir, 'prebuilds', arch, 'pty.node'))) { throw new Error(`Downloaded @lydell/node-pty-${arch} but pty.node is missing`) @@ -89,6 +126,6 @@ async function run(): Promise { } run().catch((error) => { - console.error(error) + logger.error('Could not ensure node-pty prebuilds', { message: getErrorMessage(error) }) process.exit(1) }) diff --git a/apps/desktop/src/main/index.ts b/apps/desktop/src/main/index.ts index fc60d931d18..9cfcc37b401 100644 --- a/apps/desktop/src/main/index.ts +++ b/apps/desktop/src/main/index.ts @@ -157,7 +157,7 @@ function main(): void { let appSession: Session | null = null let sessionLifecycle: ReturnType | null = null let resumingQuitAfterTeardown = false - let mandatoryRelaunchPending = false + let committedRelaunchPending = false let tray: TrayHandle | null = null let updater: UpdaterHandle | null = null let startupReady: Promise | null = null @@ -383,7 +383,7 @@ function main(): void { preloadPath, isPackaged: app.isPackaged, restorePosition, - isMandatoryRelaunchPending: () => mandatoryRelaunchPending, + isCommittedRelaunchPending: () => committedRelaunchPending, onFullScreenChange: (isFullScreen) => { if (!win.isDestroyed()) { win.webContents.send('desktop:window-state:changed', { isFullScreen }) @@ -418,7 +418,7 @@ function main(): void { } }, allowHttpLocalhost: allowHttpLocalhost(), - isMandatoryRelaunchPending: () => mandatoryRelaunchPending, + isCommittedRelaunchPending: () => committedRelaunchPending, }) attachContextMenu(win.webContents, { isDev: !app.isPackaged, @@ -554,7 +554,7 @@ function main(): void { }, completeDeploymentScopedStateChange: completeDeploymentScopedTeardown, relaunch: () => { - mandatoryRelaunchPending = true + committedRelaunchPending = true relaunchApp() }, }) @@ -585,11 +585,11 @@ function main(): void { if (!resumingQuitAfterTeardown && sessionLifecycle?.isTeardownActive()) { event.preventDefault() void sessionLifecycle.awaitTeardown().then((clean) => { - if (!clean && !mandatoryRelaunchPending) { + if (!clean && !committedRelaunchPending) { logger.error('Quit cancelled because account teardown did not finish safely') return } - if (!mandatoryRelaunchPending && !prepareAccountDataTeardownForQuit()) { + if (!committedRelaunchPending && !prepareAccountDataTeardownForQuit()) { logger.error('Quit cancelled because account-data recovery could not be persisted') return } @@ -603,36 +603,27 @@ function main(): void { }) return } - /** - * A mandatory relaunch is requested only after the server-switch transaction - * has cleared deployment-scoped capabilities and committed the replacement - * origin. The ordinary quit guard must not strand that committed process on - * its old partition; any retained marker is startup retry metadata. - */ - if (!mandatoryRelaunchPending && !prepareAccountDataTeardownForQuit()) { + // A committed relaunch is requested only after its prerequisite teardown has + // succeeded. The ordinary quit guard must not strand that committed process; + // any retained marker is startup retry metadata. + if (!committedRelaunchPending && !prepareAccountDataTeardownForQuit()) { event.preventDefault() logger.error('Quit cancelled because account-data recovery could not be persisted') return } - // Stops the tray's background chat refresh alongside the OS handles. + }) + + app.on('will-quit', () => { + // Renderer unload guards have accepted the quit, so native resources can + // now be released without leaving a cancelled quit in a degraded state. tray?.destroy() tray = null localFilesystem.close() - // Quiesce native pages before publishing the final encrypted descriptor - // set. This prevents a navigation event racing the synchronous quit flush. quiesceBrowserSessions() terminal.dispose() uninstallDocumentationHelpSearch() - flushDesktopChatSessions('before-quit') - // Settings writes coalesce, so a change made in the last moments before - // quit is still pending here. - config.flush() - }) - - app.on('will-quit', () => { - // Final backstop for any descriptor dirtied while Electron was closing - // windows after before-quit. flushDesktopChatSessions('will-quit') + config.flush() }) app.on('activate', () => { @@ -868,6 +859,9 @@ function main(): void { events, appOrigin, autoDownload: () => config.get('autoDownloadUpdates') ?? true, + setRelaunchPending: (pending) => { + committedRelaunchPending = pending + }, beforeInstall: async () => { if (!prepareAccountDataTeardownForQuit()) { throw new Error( diff --git a/apps/desktop/src/main/updater.test.ts b/apps/desktop/src/main/updater.test.ts index a95d2839873..7f49db4fb9a 100644 --- a/apps/desktop/src/main/updater.test.ts +++ b/apps/desktop/src/main/updater.test.ts @@ -158,6 +158,7 @@ describe('initUpdater state machine', () => { feedAvailable?: boolean | 'no-release' probeOriginFeed?: (feedUrl: string) => Promise beforeInstall?: () => Promise + setRelaunchPending?: (pending: boolean) => void }) { const states: DesktopUpdateState[] = [] const handle = initUpdater({ @@ -172,6 +173,7 @@ describe('initUpdater state machine', () => { canSelfUpdate: async () => true, platform: 'darwin', beforeInstall: options?.beforeInstall, + setRelaunchPending: options?.setRelaunchPending, }) // Engine selection (signature detection) resolves asynchronously. await vi.advanceTimersByTimeAsync(0) @@ -188,14 +190,14 @@ describe('initUpdater state machine', () => { autoUpdaterMock.quitAndInstall.mockClear() autoUpdaterMock.autoRunAppAfterInstall = false updaterChannel = '' - vi.mocked(dialog.showMessageBox).mockResolvedValue({ response: 1, checkboxChecked: false }) + vi.mocked(dialog.showMessageBox).mockResolvedValue({ response: 0, checkboxChecked: false }) }) afterEach(() => { vi.useRealTimers() }) - it('walks check -> download -> ready and installs only from ready', async () => { + it('walks check -> validated download -> ready and installs only after confirmation', async () => { const { handle, states } = await createUpdater() expect(handle.getState()).toEqual({ status: 'idle' }) @@ -216,12 +218,30 @@ describe('initUpdater state machine', () => { ]) expect(dialog.showMessageBox).not.toHaveBeenCalled() expect(autoUpdaterMock.quitAndInstall).not.toHaveBeenCalled() + expect(autoUpdaterMock.autoDownload).toBe(false) + expect(autoUpdaterMock.downloadUpdate).toHaveBeenCalledTimes(1) + + handle.install() + await vi.advanceTimersByTimeAsync(0) + expect(dialog.showMessageBox).toHaveBeenCalledWith( + expect.objectContaining({ + buttons: ['Later', 'Restart and update'], + defaultId: 0, + cancelId: 0, + }) + ) + expect(autoUpdaterMock.quitAndInstall).not.toHaveBeenCalled() + vi.mocked(dialog.showMessageBox).mockResolvedValueOnce({ + response: 1, + checkboxChecked: false, + }) handle.install() + await vi.advanceTimersByTimeAsync(0) expect(autoUpdaterMock.quitAndInstall).toHaveBeenCalledTimes(1) }) - it('downloads, installs, and relaunches from one Update action', async () => { + it('downloads from an Update action and waits at ready for an explicit restart', async () => { autoUpdaterMock.autoDownload = false const { handle } = await createUpdater({ autoDownload: false }) @@ -241,11 +261,53 @@ describe('initUpdater state machine', () => { expect(handle.getState()).toEqual({ status: 'downloading', version: '2.0.0', percent: 42 }) emit('update-downloaded', { version: '2.0.0' }) - expect(dialog.showMessageBox).not.toHaveBeenCalled() expect(autoUpdaterMock.autoRunAppAfterInstall).toBe(true) + expect(handle.getState()).toEqual({ status: 'ready', version: '2.0.0' }) + expect(autoUpdaterMock.quitAndInstall).not.toHaveBeenCalled() + }) + + it('keeps one restart confirmation in flight across repeated install requests', async () => { + let resolveConfirmation: (result: { response: number; checkboxChecked: boolean }) => void = + () => { + throw new Error('Restart confirmation did not initialize') + } + vi.mocked(dialog.showMessageBox).mockImplementationOnce( + () => + new Promise((resolve) => { + resolveConfirmation = resolve + }) + ) + const { handle } = await createUpdater() + + handle.check() + await vi.advanceTimersByTimeAsync(0) + emit('update-available', { version: '2.0.0' }) + emit('update-downloaded', { version: '2.0.0' }) + vi.mocked(dialog.showMessageBox).mockClear() + handle.install() + handle.install() + + expect(dialog.showMessageBox).toHaveBeenCalledTimes(1) + expect(autoUpdaterMock.quitAndInstall).not.toHaveBeenCalled() + + resolveConfirmation({ response: 1, checkboxChecked: false }) + await vi.advanceTimersByTimeAsync(0) expect(autoUpdaterMock.quitAndInstall).toHaveBeenCalledTimes(1) }) + it('applies the download preference without enabling unvalidated library downloads', async () => { + const { handle } = await createUpdater() + handle.setAutoDownload(false) + + handle.check() + await vi.advanceTimersByTimeAsync(0) + emit('update-available', { version: '2.0.0' }) + + expect(autoUpdaterMock.autoDownload).toBe(false) + expect(handle.getState()).toEqual({ status: 'available', version: '2.0.0' }) + expect(autoUpdaterMock.downloadUpdate).not.toHaveBeenCalled() + }) + it('surfaces a manually started download failure without installing', async () => { autoUpdaterMock.downloadUpdate.mockRejectedValueOnce(new Error('download failed')) const { handle } = await createUpdater({ autoDownload: false }) @@ -276,6 +338,11 @@ describe('initUpdater state machine', () => { emit('update-available', { version: '2.0.0' }) handle.check() emit('update-downloaded', { version: '2.0.0' }) + vi.mocked(dialog.showMessageBox).mockResolvedValueOnce({ + response: 1, + checkboxChecked: false, + }) + handle.install() await vi.advanceTimersByTimeAsync(0) expect(beforeInstall).toHaveBeenCalledTimes(1) @@ -286,6 +353,60 @@ describe('initUpdater state machine', () => { expect(autoUpdaterMock.quitAndInstall).toHaveBeenCalledTimes(1) }) + it('does not install when the updater fails during pre-install teardown', async () => { + let finishTeardown: (() => void) | undefined + const setRelaunchPending = vi.fn() + const { handle } = await createUpdater({ + beforeInstall: () => + new Promise((resolve) => { + finishTeardown = resolve + }), + setRelaunchPending, + }) + + handle.check() + await vi.advanceTimersByTimeAsync(0) + emit('update-available', { version: '2.0.0' }) + emit('update-downloaded', { version: '2.0.0' }) + vi.mocked(dialog.showMessageBox).mockResolvedValueOnce({ + response: 1, + checkboxChecked: false, + }) + handle.install() + await vi.advanceTimersByTimeAsync(0) + + emit('error', new Error('native staging failed')) + finishTeardown?.() + await vi.advanceTimersByTimeAsync(0) + + expect(handle.getState()).toEqual({ status: 'error', version: '2.0.0' }) + expect(setRelaunchPending).not.toHaveBeenCalledWith(true) + expect(autoUpdaterMock.quitAndInstall).not.toHaveBeenCalled() + }) + + it('bypasses renderer unload guards only after teardown succeeds', async () => { + const setRelaunchPending = vi.fn() + vi.mocked(dialog.showMessageBox).mockResolvedValueOnce({ + response: 1, + checkboxChecked: false, + }) + const { handle } = await createUpdater({ + beforeInstall: async () => {}, + setRelaunchPending, + }) + + handle.check() + await vi.advanceTimersByTimeAsync(0) + emit('update-available', { version: '2.0.0' }) + emit('update-downloaded', { version: '2.0.0' }) + handle.install() + + expect(setRelaunchPending).not.toHaveBeenCalled() + await vi.advanceTimersByTimeAsync(0) + expect(setRelaunchPending).toHaveBeenCalledWith(true) + expect(autoUpdaterMock.quitAndInstall).toHaveBeenCalledTimes(1) + }) + it('does not install when pre-install teardown fails', async () => { const beforeInstall = vi.fn(async () => { throw new Error('flush failed') @@ -296,6 +417,10 @@ describe('initUpdater state machine', () => { await vi.advanceTimersByTimeAsync(0) emit('update-available', { version: '2.0.0' }) emit('update-downloaded', { version: '2.0.0' }) + vi.mocked(dialog.showMessageBox).mockResolvedValueOnce({ + response: 1, + checkboxChecked: false, + }) handle.install() await vi.advanceTimersByTimeAsync(0) @@ -304,6 +429,22 @@ describe('initUpdater state machine', () => { expect(handle.getState()).toEqual({ status: 'error', version: '2.0.0' }) }) + it('surfaces a staging error after a validated download is ready', async () => { + const { handle } = await createUpdater() + handle.check() + await vi.advanceTimersByTimeAsync(0) + emit('update-available', { version: '2.0.0' }) + emit('update-downloaded', { version: '2.0.0' }) + + emit('error', new Error('native staging failed')) + + expect(autoUpdaterMock.autoInstallOnAppQuit).toBe(false) + expect(handle.getState()).toEqual({ status: 'error', version: '2.0.0' }) + expect(events.record).toHaveBeenCalledWith('update_error', { + message: 'native staging failed', + }) + }) + it('checks from idle and ignores re-entrant checks while busy', async () => { const { handle } = await createUpdater() handle.check() @@ -424,6 +565,7 @@ describe('initUpdater state machine', () => { }) expect(handle.getState()).toEqual({ status: 'idle' }) + expect(autoUpdaterMock.downloadUpdate).not.toHaveBeenCalled() expect(autoUpdaterMock.autoInstallOnAppQuit).toBe(false) expect(events.record).toHaveBeenCalledWith('update_blocked_version', { version: '2.0.0', @@ -981,6 +1123,21 @@ describe('checkForUpdatesInteractive', () => { ) }) + it('opens the restart confirmation when an update is already ready', () => { + const handle: UpdaterHandle = { + setAutoDownload: () => {}, + getState: () => ({ status: 'ready', version: '2.0.0' }), + check: vi.fn(), + install: vi.fn(), + onState: () => () => {}, + } + + checkForUpdatesInteractive({ getWindow: () => null, events, handle }) + + expect(handle.install).toHaveBeenCalledTimes(1) + expect(handle.check).not.toHaveBeenCalled() + }) + it('only explains packaged-build updates when unpackaged', async () => { ;(app as unknown as { isPackaged: boolean }).isPackaged = false checkForUpdatesInteractive({ getWindow: () => null, events, handle: null }) diff --git a/apps/desktop/src/main/updater.ts b/apps/desktop/src/main/updater.ts index aaa2f3a360e..a185f6c1669 100644 --- a/apps/desktop/src/main/updater.ts +++ b/apps/desktop/src/main/updater.ts @@ -238,10 +238,7 @@ export interface UpdaterDeps { loadAutoUpdater?: () => typeof import('electron-updater')['autoUpdater'] /** Test seam: overrides the origin feed availability probe. */ probeOriginFeed?: (feedUrl: string) => Promise - /** - * Test seam: overrides Squirrel self-update capability detection (whether - * the running bundle carries a real Developer ID signature). - */ + /** Test seam: overrides Applications-folder and Developer ID eligibility detection. */ canSelfUpdate?: () => Promise /** Test seam: overrides the manual-mode manifest fetch (body or null). */ fetchManifest?: (url: string) => Promise @@ -249,6 +246,8 @@ export interface UpdaterDeps { platform?: NodeJS.Platform /** Flushes desktop-owned state before Squirrel terminates the process. */ beforeInstall?: () => Promise + /** Bypasses renderer unload guards only after the user confirms a relaunch. */ + setRelaunchPending?: (pending: boolean) => void } export interface UpdaterHandle { @@ -256,8 +255,8 @@ export interface UpdaterHandle { /** Current pipeline state for the renderer update UI. */ getState(): DesktopUpdateState /** - * Renderer-initiated advance: checks for an update, or starts the download - * when one is already known to be available (auto-download off / manual). + * Renderer-initiated advance: checks for an update, downloads an available + * self-update, or opens an available manual installer. */ check(): void /** @@ -285,7 +284,7 @@ export function isNewerVersion(candidateVersion: string, currentVersion: string) return isDowngrade(candidateVersion, currentVersion) } -/** A signed shell may only install a strictly newer build from its own environment stream. */ +/** Accepts only strictly newer builds from the running shell's environment stream. */ function isValidUpdateCandidate(candidateVersion: string, currentVersion: string): boolean { return ( resolveUpdateChannel(candidateVersion) === resolveUpdateChannel(currentVersion) && @@ -294,17 +293,17 @@ function isValidUpdateCandidate(candidateVersion: string, currentVersion: string } /** - * Whether Squirrel.Mac can swap this bundle in place. It validates a - * downloaded update against the running app's code signature, so only builds - * carrying a real Developer ID (a TeamIdentifier) can self-update. Local - * `install:local` builds and pre-signing CI prereleases are ad-hoc signed - * (`TeamIdentifier=not set`) and would fail the swap — those shells get the - * manual pipeline instead. + * Squirrel.Mac can update only an app installed under /Applications whose + * running bundle carries a Developer ID TeamIdentifier. Other packaged builds + * use the manual-download pipeline. */ async function detectSelfUpdateCapability(): Promise { if (process.platform !== 'darwin') { return true } + if (!app.isInApplicationsFolder()) { + return false + } const exe = app.getPath('exe') const bundleEnd = exe.indexOf('.app/') if (bundleEnd < 0) { @@ -342,11 +341,9 @@ interface UpdateEngine { * thirty minutes for production builds, and mirrors pipeline state to the * renderer for the settings update UI and the minimum-shell-version gate. * - * Developer-ID-signed builds use electron-updater (background download, - * then install and relaunch from an explicit Update action). Builds - * that can't self-update (ad-hoc signed: local installs, pre-signing CI - * prereleases) still poll the same feed but surface `available` as a manual - * download link, so the whole pipeline is testable before signing exists. + * Developer-ID-signed builds installed under /Applications use electron-updater. + * Other packaged builds still poll the same feed but surface available updates + * as manual downloads. */ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { if ((deps.platform ?? process.platform) !== 'darwin') { @@ -358,7 +355,6 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { const currentVersion = app.getVersion() let state: DesktopUpdateState = { status: 'idle' } - let installAfterDownload = false const listeners = new Set<(state: DesktopUpdateState) => void>() const setState = (next: DesktopUpdateState) => { state = next @@ -384,7 +380,9 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { autoUpdater.allowDowngrade = false } setChannelWithoutDowngrades(resolveUpdateChannel(currentVersion)) - autoUpdater.autoDownload = deps.autoDownload?.() ?? true + let autoDownloadEnabled = deps.autoDownload?.() ?? true + // Prevents the library from fetching a candidate before Sim validates its asset URLs. + autoUpdater.autoDownload = false // Explicit Update actions must reopen Sim after Squirrel swaps the bundle. autoUpdater.autoRunAppAfterInstall = true // Never install without vetting the downloaded version first. Enabled per @@ -394,18 +392,24 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { autoUpdater.autoInstallOnAppQuit = false autoUpdater.logger = null let installInFlight = false + let installConfirmationInFlight = false - const quitAndInstall = () => { + const quitAndInstall = (version: string | undefined) => { if (installInFlight) return - if (!deps.beforeInstall) { - autoUpdater.quitAndInstall() - return - } installInFlight = true void Promise.resolve() .then(() => deps.beforeInstall?.()) - .then(() => autoUpdater.quitAndInstall()) + .then(() => { + if (state.status !== 'ready' || state.version !== version) { + autoUpdater.autoInstallOnAppQuit = false + installInFlight = false + return + } + deps.setRelaunchPending?.(true) + autoUpdater.quitAndInstall() + }) .catch((error) => { + deps.setRelaunchPending?.(false) autoUpdater.autoInstallOnAppQuit = false installInFlight = false logger.error('Pre-install teardown failed', { @@ -416,6 +420,39 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { }) } + const confirmAndInstall = () => { + if (installInFlight || installConfirmationInFlight || state.status !== 'ready') return + installConfirmationInFlight = true + const version = state.version + const options: Electron.MessageBoxOptions = { + type: 'question', + buttons: ['Later', 'Restart and update'], + defaultId: 0, + cancelId: 0, + message: version ? `Restart to install Sim ${version}?` : 'Restart to update Sim?', + detail: + 'Sim will close all app windows while it updates. Running terminal commands, browser activity, downloads, uploads, and unsaved edits may be interrupted. Choose Later to install the update the next time you quit Sim.', + } + const win = deps.getWindow() + const confirmation = win + ? dialog.showMessageBox(win, options) + : dialog.showMessageBox(options) + void confirmation + .then(({ response }) => { + if (response === 1 && state.status === 'ready' && state.version === version) { + quitAndInstall(version) + } + }) + .catch((error) => { + logger.warn('Could not show update restart confirmation', { + message: getErrorMessage(error, 'unknown'), + }) + }) + .finally(() => { + installConfirmationInFlight = false + }) + } + let activeProbeId: number | null = null let nextProbeId = 0 let probeTimeout: ReturnType | null = null @@ -452,7 +489,6 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { if (checkId === null) return finishUpdaterCheck(checkId) if (updaterRequestId === checkId) updaterRequestId = null - installAfterDownload = false setState({ status: 'idle' }) }) @@ -468,7 +504,6 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { info.files.every((file) => isReleaseAssetUrl(file.url, info.version, channel))) if (!isValidUpdateCandidate(info.version, currentVersion) || !validOriginAssets) { acceptedUpdateVersion = null - installAfterDownload = false autoUpdater.autoInstallOnAppQuit = false deps.events.record('update_blocked_version', { version: info.version, @@ -479,12 +514,17 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { } acceptedUpdateVersion = info.version deps.events.record('update_check', { available: info.version }) - // With auto-download on, download-progress events follow immediately; - // `available` is the terminal state only when downloads are manual. setState({ - status: autoUpdater.autoDownload ? 'downloading' : 'available', + status: autoDownloadEnabled ? 'downloading' : 'available', version: info.version, }) + if (autoDownloadEnabled) { + void autoUpdater.downloadUpdate().catch((error) => { + logger.warn('Update download failed', { message: getErrorMessage(error, 'unknown') }) + deps.events.record('update_error', { message: getErrorMessage(error, 'unknown') }) + setState({ status: 'error', version: info.version }) + }) + } }) autoUpdater.on('download-progress', (progress) => { @@ -497,13 +537,12 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { }) autoUpdater.on('update-downloaded', (info) => { - if (state.status !== 'downloading' && !installAfterDownload) return + if (state.status !== 'downloading') return if ( acceptedUpdateVersion !== info.version || !isValidUpdateCandidate(info.version, currentVersion) ) { acceptedUpdateVersion = null - installAfterDownload = false autoUpdater.autoInstallOnAppQuit = false deps.events.record('update_blocked_version', { version: info.version }) setState({ status: 'idle' }) @@ -513,10 +552,6 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { autoUpdater.autoInstallOnAppQuit = true deps.events.record('update_downloaded', { version: info.version }) setState({ status: 'ready', version: info.version }) - if (installAfterDownload) { - installAfterDownload = false - quitAndInstall() - } }) autoUpdater.on('error', (error) => { @@ -524,10 +559,12 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { if (checkId !== null) { finishUpdaterCheck(checkId) if (updaterRequestId === checkId) updaterRequestId = null - } else if (state.status !== 'downloading') { + } else if (state.status !== 'downloading' && state.status !== 'ready' && !installInFlight) { return } - installAfterDownload = false + installInFlight = false + deps.setRelaunchPending?.(false) + autoUpdater.autoInstallOnAppQuit = false deps.events.record('update_error', { message: getErrorMessage(error, 'unknown') }) setState({ status: 'error', version: state.version }) }) @@ -662,16 +699,16 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { advance() { setState({ status: 'downloading', version: state.version }) autoUpdater.downloadUpdate().catch((error) => { - installAfterDownload = false logger.warn('Update download failed', { message: getErrorMessage(error, 'unknown') }) + deps.events.record('update_error', { message: getErrorMessage(error, 'unknown') }) setState({ status: 'error', version: state.version }) }) }, install() { - quitAndInstall() + confirmAndInstall() }, setAutoDownload(enabled) { - autoUpdater.autoDownload = enabled + autoDownloadEnabled = enabled }, } } @@ -830,7 +867,6 @@ export function initUpdater(deps: UpdaterDeps): UpdaterHandle { return } if (state.status === 'available') { - installAfterDownload = !state.manual engine.advance() return } @@ -917,7 +953,7 @@ export function checkForUpdatesInteractive( }) return case 'ready': - // The download pipeline already shows its own restart prompt. + handle.install() return case 'error': void showDialog({ diff --git a/apps/desktop/src/main/window.test.ts b/apps/desktop/src/main/window.test.ts index b529d9a37c4..a92e177bc5a 100644 --- a/apps/desktop/src/main/window.test.ts +++ b/apps/desktop/src/main/window.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' vi.mock('electron', () => import('@/test/electron-mock')) -import { BrowserWindow, dialog, systemPreferences } from 'electron' +import { BrowserWindow, dialog, screen, systemPreferences } from 'electron' import type { ConfigStore } from '@/main/config' import type { EventRecorder } from '@/main/observability' import { @@ -10,6 +10,7 @@ import { createMainWindow, createSecureWebPreferences, ensureMicrophoneAccess, + fitBoundsToWorkArea, resolvePermission, sanitizeBounds, setupPermissionHandlers, @@ -24,8 +25,8 @@ describe('resolvePermission', () => { expect(resolvePermission('clipboard-sanitized-write', '', APP)).toBe(false) }) - it('allows clipboard reads from the trusted origin only, so terminal Paste works', () => { - expect(resolvePermission('clipboard-read', APP, APP)).toBe(true) + it('denies clipboard reads, including from the trusted origin', () => { + expect(resolvePermission('clipboard-read', APP, APP)).toBe(false) expect(resolvePermission('clipboard-read', 'https://evil.example', APP)).toBe(false) expect(resolvePermission('clipboard-read', '', APP)).toBe(false) }) @@ -166,13 +167,13 @@ describe('setupPermissionHandlers', () => { expect(systemPreferences.getMediaAccessStatus).not.toHaveBeenCalled() }) - it('answers a clipboard request synchronously', () => { + it('denies a clipboard read request synchronously', () => { const { request } = createSession() const callback = vi.fn() request(null, 'clipboard-read', callback, { requestingUrl: `${APP}/workspace` }) - expect(callback).toHaveBeenCalledWith(true) + expect(callback).toHaveBeenCalledWith(false) }) it('reports microphone as permitted on the check path', () => { @@ -217,6 +218,26 @@ describe('sanitizeBounds', () => { }) }) +describe('fitBoundsToWorkArea', () => { + it('clamps an off-screen window into the matched display work area', () => { + expect( + fitBoundsToWorkArea( + { x: 3000, y: -800, width: 1200, height: 800 }, + { x: 0, y: 25, width: 1440, height: 875 } + ) + ).toEqual({ x: 240, y: 25, width: 1200, height: 800 }) + }) + + it('shrinks oversized bounds to fit the available work area', () => { + expect( + fitBoundsToWorkArea( + { x: -200, y: -100, width: 1800, height: 1200 }, + { x: 0, y: 25, width: 1440, height: 875 } + ) + ).toEqual({ x: 0, y: 25, width: 1440, height: 875 }) + }) +}) + describe('createSecureWebPreferences', () => { it('locks down the renderer', () => { const prefs = createSecureWebPreferences('persist:sim', '/tmp/preload.cjs', true) @@ -246,9 +267,12 @@ describe('createSecureWebPreferences', () => { describe('createMainWindow', () => { beforeEach(() => { vi.clearAllMocks() + vi.mocked(screen.getDisplayMatching).mockReturnValue({ + workArea: { x: 0, y: 0, width: 1440, height: 900 }, + } as never) }) - function createTestWindow(isMandatoryRelaunchPending: () => boolean = () => false) { + function createTestWindow(isCommittedRelaunchPending: () => boolean = () => false) { const config = { filePath: '/tmp/settings.json', getOrigin: vi.fn(() => APP), @@ -268,7 +292,7 @@ describe('createMainWindow', () => { preloadPath: '/tmp/preload.cjs', isPackaged: false, onClosed: vi.fn(), - isMandatoryRelaunchPending, + isCommittedRelaunchPending, }) const contentHandlers = new Map( vi.mocked(win.webContents.on).mock.calls as unknown as Array< @@ -364,7 +388,7 @@ describe('createMainWindow', () => { preloadPath: '/tmp/preload.cjs', isPackaged: false, onClosed: vi.fn(), - isMandatoryRelaunchPending: () => false, + isCommittedRelaunchPending: () => false, platform: 'darwin', }) @@ -431,7 +455,7 @@ describe('createMainWindow', () => { preloadPath: '/tmp/preload.cjs', isPackaged: false, onClosed: vi.fn(), - isMandatoryRelaunchPending: () => false, + isCommittedRelaunchPending: () => false, restorePosition: false, }) @@ -441,5 +465,46 @@ describe('createMainWindow', () => { expect(MockBrowserWindow.lastOptions).toMatchObject({ width: 1200, height: 800 }) expect(MockBrowserWindow.lastOptions?.x).toBeUndefined() expect(MockBrowserWindow.lastOptions?.y).toBeUndefined() + expect(screen.getDisplayMatching).not.toHaveBeenCalled() + }) + + it('restores the first window within the closest connected display', () => { + const config = { + filePath: '/tmp/settings.json', + getOrigin: vi.fn(() => APP), + setOrigin: vi.fn(), + get: vi.fn(() => ({ x: 3000, y: -400, width: 1200, height: 800 })), + set: vi.fn(), + } as unknown as ConfigStore + vi.mocked(screen.getDisplayMatching).mockReturnValue({ + workArea: { x: 1440, y: 25, width: 1440, height: 875 }, + } as never) + + createMainWindow({ + config, + events: { filePath: '/tmp/events.jsonl', record: vi.fn() }, + appOrigin: () => APP, + partition: 'persist:sim', + preloadPath: '/tmp/preload.cjs', + isPackaged: false, + onClosed: vi.fn(), + isCommittedRelaunchPending: () => false, + }) + + const MockBrowserWindow = BrowserWindow as typeof BrowserWindow & { + lastOptions?: Record + } + expect(screen.getDisplayMatching).toHaveBeenCalledWith({ + x: 3000, + y: -400, + width: 1200, + height: 800, + }) + expect(MockBrowserWindow.lastOptions).toMatchObject({ + x: 1680, + y: 25, + width: 1200, + height: 800, + }) }) }) diff --git a/apps/desktop/src/main/window.ts b/apps/desktop/src/main/window.ts index dc9390056a5..90f93e6882c 100644 --- a/apps/desktop/src/main/window.ts +++ b/apps/desktop/src/main/window.ts @@ -1,7 +1,7 @@ import { createLogger } from '@sim/logger' import { getErrorMessage } from '@sim/utils/errors' -import type { Session, WebPreferences } from 'electron' -import { app, BrowserWindow, dialog, nativeTheme, systemPreferences } from 'electron' +import type { Event, Rectangle, Session, WebPreferences } from 'electron' +import { app, BrowserWindow, dialog, nativeTheme, screen, systemPreferences } from 'electron' import { type ConfigStore, isSafeInternalPath, type WindowBounds } from '@/main/config' import { isAppOrigin, isAuthSurfacePath } from '@/main/navigation' import type { EventRecorder } from '@/main/observability' @@ -52,12 +52,10 @@ export function createSecureWebPreferences( } /** - * The permission matrix: clipboard and microphone access for the trusted app - * origin, default-deny for everything else including unknown future - * permissions (camera and screen capture stay denied). + * The permission matrix: sanitized clipboard writes and microphone access for + * the trusted app origin, default-deny for everything else including unknown + * future permissions (clipboard reads, camera, and screen capture stay denied). * - * Clipboard reads are what the terminal's Paste action runs on — xterm has no - * native paste target to fall back to, so a denied read is a Paste that fails. * `media` is what the composer's voice input runs on, and is narrowed to * audio-only requests so a `getUserMedia({ video: true })` still gets nothing. * Both grants are scoped to the app's own origin, which already reaches far @@ -84,7 +82,7 @@ export function resolvePermission( mediaTypes.every((type) => type === 'audio') ) } - return permission === 'clipboard-sanitized-write' || permission === 'clipboard-read' + return permission === 'clipboard-sanitized-write' } /** @@ -190,6 +188,44 @@ export function sanitizeBounds(bounds: WindowBounds | undefined): WindowBounds | return bounds } +/** Keeps restored bounds fully visible within the display Electron matched to them. */ +export function fitBoundsToWorkArea(bounds: WindowBounds, workArea: Rectangle): WindowBounds { + const width = Math.min(bounds.width, workArea.width) + const height = Math.min(bounds.height, workArea.height) + const x = Math.min( + Math.max(bounds.x ?? workArea.x, workArea.x), + workArea.x + workArea.width - width + ) + const y = Math.min( + Math.max(bounds.y ?? workArea.y, workArea.y), + workArea.y + workArea.height - height + ) + return { x, y, width, height } +} + +/** Applies the shared renderer unload decision to main and child windows. */ +export function handleWillPreventUnload( + win: BrowserWindow, + event: Event, + committedRelaunchPending: boolean +): void { + if (committedRelaunchPending) { + event.preventDefault() + return + } + const choice = dialog.showMessageBoxSync(win, { + type: 'question', + buttons: ['Stay', 'Leave'], + defaultId: 0, + cancelId: 0, + message: 'Leave Sim?', + detail: 'Changes you made may not be saved.', + }) + if (choice === 1) { + event.preventDefault() + } +} + export interface CreateMainWindowDeps { config: ConfigStore events: EventRecorder @@ -199,7 +235,7 @@ export interface CreateMainWindowDeps { isPackaged: boolean onClosed: () => void /** A committed process restart must not be cancelled by a renderer's beforeunload handler. */ - isMandatoryRelaunchPending: () => boolean + isCommittedRelaunchPending: () => boolean onFullScreenChange?: (isFullScreen: boolean) => void /** * Restores the persisted screen position for the first window. Secondary @@ -219,13 +255,18 @@ export interface CreateMainWindowDeps { export function createMainWindow(deps: CreateMainWindowDeps): BrowserWindow { const bounds = sanitizeBounds(deps.config.get('windowBounds')) const restorePosition = deps.restorePosition ?? true + let restoredBounds = bounds + if (restorePosition && bounds?.x !== undefined && bounds.y !== undefined) { + const savedRectangle = { x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height } + restoredBounds = fitBoundsToWorkArea(bounds, screen.getDisplayMatching(savedRectangle).workArea) + } const platform = deps.platform ?? process.platform const win = new BrowserWindow({ title: WINDOW_TITLE, - width: bounds?.width ?? DEFAULT_WIDTH, - height: bounds?.height ?? DEFAULT_HEIGHT, - x: restorePosition ? bounds?.x : undefined, - y: restorePosition ? bounds?.y : undefined, + width: restoredBounds?.width ?? DEFAULT_WIDTH, + height: restoredBounds?.height ?? DEFAULT_HEIGHT, + x: restorePosition ? restoredBounds?.x : undefined, + y: restorePosition ? restoredBounds?.y : undefined, minWidth: MIN_WIDTH, minHeight: MIN_HEIGHT, // No separate title bar: the page renders full-bleed to the window's top @@ -285,21 +326,7 @@ export function createMainWindow(deps: CreateMainWindowDeps): BrowserWindow { }) win.webContents.on('will-prevent-unload', (event) => { - if (deps.isMandatoryRelaunchPending()) { - event.preventDefault() - return - } - const choice = dialog.showMessageBoxSync(win, { - type: 'question', - buttons: ['Stay', 'Leave'], - defaultId: 0, - cancelId: 0, - message: 'Leave Sim?', - detail: 'Changes you made may not be saved.', - }) - if (choice === 1) { - event.preventDefault() - } + handleWillPreventUnload(win, event, deps.isCommittedRelaunchPending()) }) let recoveryDialog: 'crash' | 'hang' | null = null diff --git a/apps/desktop/src/main/windows.test.ts b/apps/desktop/src/main/windows.test.ts index c508f8b47ae..98c11a32518 100644 --- a/apps/desktop/src/main/windows.test.ts +++ b/apps/desktop/src/main/windows.test.ts @@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' vi.mock('electron', () => import('@/test/electron-mock')) import type { WebContents } from 'electron' -import { shell } from 'electron' +import { dialog, shell } from 'electron' import { attachWindowOpenPolicy, isPopupContents, registerPopupContents } from '@/main/windows' const APP = 'https://sim.ai' @@ -29,14 +29,14 @@ describe('attachWindowOpenPolicy', () => { vi.mocked(shell.openExternal).mockClear() }) - function setup(isMandatoryRelaunchPending: () => boolean = () => false) { + function setup(isCommittedRelaunchPending: () => boolean = () => false) { const contents = makeContents() const openAppWindow = vi.fn() attachWindowOpenPolicy(contents as unknown as WebContents, { appOrigin: () => APP, openAppWindow, allowHttpLocalhost: false, - isMandatoryRelaunchPending, + isCommittedRelaunchPending, }) return { contents, openAppWindow } } @@ -98,7 +98,7 @@ describe('attachWindowOpenPolicy', () => { expect(didCreateWindow).toBeDefined() }) - it('allows a mandatory relaunch through a child beforeunload', () => { + it('allows a committed relaunch through a child beforeunload', () => { const { contents } = setup(() => true) const childContents = makeContents() const child = { webContents: childContents } @@ -114,7 +114,7 @@ describe('attachWindowOpenPolicy', () => { expect(event.preventDefault).toHaveBeenCalledOnce() }) - it('leaves child beforeunload untouched during ordinary use', () => { + it('asks before leaving a child window during ordinary use', () => { const { contents } = setup() const childContents = makeContents() const child = { webContents: childContents } @@ -128,6 +128,14 @@ describe('attachWindowOpenPolicy', () => { willPreventUnload?.[1](event) expect(event.preventDefault).not.toHaveBeenCalled() + expect(dialog.showMessageBoxSync).toHaveBeenCalledWith( + child, + expect.objectContaining({ + buttons: ['Stay', 'Leave'], + defaultId: 0, + cancelId: 0, + }) + ) }) }) diff --git a/apps/desktop/src/main/windows.ts b/apps/desktop/src/main/windows.ts index d5e84a971d7..fcb9c41f115 100644 --- a/apps/desktop/src/main/windows.ts +++ b/apps/desktop/src/main/windows.ts @@ -6,6 +6,7 @@ import { openExternalSafe, } from '@/main/navigation' import { scrubUrl } from '@/main/observability' +import { handleWillPreventUnload } from '@/main/window' const logger = createLogger('DesktopWindows') @@ -44,7 +45,7 @@ export interface WindowPolicyDeps { appOrigin: () => string openAppWindow: (url: string) => void allowHttpLocalhost: boolean - isMandatoryRelaunchPending: () => boolean + isCommittedRelaunchPending: () => boolean } /** @@ -81,9 +82,7 @@ export function attachWindowOpenPolicy(contents: WebContents, deps: WindowPolicy registerPopupContents(child.webContents) attachWindowOpenPolicy(child.webContents, deps) child.webContents.on('will-prevent-unload', (event) => { - if (deps.isMandatoryRelaunchPending()) { - event.preventDefault() - } + handleWillPreventUnload(child, event, deps.isCommittedRelaunchPending()) }) const kind = classifyWindowOpen(details.url, details.frameName, deps.appOrigin()) if (kind === 'popup-blank') { diff --git a/apps/desktop/src/test/electron-mock.ts b/apps/desktop/src/test/electron-mock.ts index bb4d81ddc57..2c27d51322f 100644 --- a/apps/desktop/src/test/electron-mock.ts +++ b/apps/desktop/src/test/electron-mock.ts @@ -19,6 +19,7 @@ export const app = { getPath: vi.fn(() => '/tmp/sim-desktop-test'), getAppPath: vi.fn(() => '/tmp/sim-desktop-test/app'), isReady: vi.fn(() => true), + isInApplicationsFolder: vi.fn(() => true), on: vi.fn(), once: vi.fn(), quit: vi.fn(), @@ -74,6 +75,12 @@ export const nativeTheme = { on: vi.fn(), } +export const screen = { + getDisplayMatching: vi.fn(() => ({ + workArea: { x: 0, y: 0, width: 1440, height: 900 }, + })), +} + export const Menu = { buildFromTemplate: vi.fn((template: unknown[]) => ({ popup: vi.fn(), items: template })), setApplicationMenu: vi.fn(), diff --git a/apps/docs/app/openapi.json/route.ts b/apps/docs/app/openapi.json/route.ts new file mode 100644 index 00000000000..b668de90a90 --- /dev/null +++ b/apps/docs/app/openapi.json/route.ts @@ -0,0 +1,11 @@ +import { createOpenApiDownloadDocument } from '@/lib/openapi-download' + +export const revalidate = false + +export function GET() { + return Response.json(createOpenApiDownloadDocument(), { + headers: { + 'Content-Disposition': 'attachment; filename="sim-openapi-v2.json"', + }, + }) +} diff --git a/apps/docs/components/docs-layout/sidebar-components.tsx b/apps/docs/components/docs-layout/sidebar-components.tsx index a899be3a730..2e4112f69f4 100644 --- a/apps/docs/components/docs-layout/sidebar-components.tsx +++ b/apps/docs/components/docs-layout/sidebar-components.tsx @@ -69,23 +69,12 @@ export function SidebarItem({ item }: { item: Item }) { ) } -function isApiReferenceFolder(node: Folder): boolean { - if (node.index?.url.includes('/api-reference/')) return true - for (const child of node.children) { - if (child.type === 'page' && child.url.includes('/api-reference/')) return true - if (child.type === 'folder' && isApiReferenceFolder(child)) return true - } - return false -} - export function SidebarFolder({ item, children }: { item: Folder; children: ReactNode }) { const pathname = usePathname() const { prefetch } = useSidebar() const hasActiveChild = checkHasActiveChild(item, pathname) - const isApiRef = isApiReferenceFolder(item) - const isOnApiRefPage = pathname.startsWith('/api-reference') const hasChildren = item.children.length > 0 - const defaultOpen = hasActiveChild || (isApiRef && isOnApiRefPage) + const defaultOpen = hasActiveChild const [manualOpen, setManualOpen] = useState<{ pathname: string; open: boolean } | null>(null) const open = manualOpen?.pathname === pathname ? manualOpen.open : defaultOpen const toggleOpen = () => setManualOpen({ pathname, open: !open }) @@ -131,6 +120,7 @@ export function SidebarFolder({ item, children }: { item: Folder; children: Reac chipHoverSurfaceClass )} aria-label={open ? 'Collapse' : 'Expand'} + aria-expanded={open} > @@ -139,6 +129,7 @@ export function SidebarFolder({ item, children }: { item: Folder; children: Reac ) : (
diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/chat-context-kind-registry/chat-context-kind-registry.tsx b/apps/sim/app/workspace/[workspaceId]/home/components/chat-context-kind-registry/chat-context-kind-registry.tsx index 122040a0483..d20098720e7 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/chat-context-kind-registry/chat-context-kind-registry.tsx +++ b/apps/sim/app/workspace/[workspaceId]/home/components/chat-context-kind-registry/chat-context-kind-registry.tsx @@ -11,6 +11,7 @@ import { } from '@sim/emcn/icons' import { AgentSkillsIcon, McpIcon } from '@/components/icons' import { getDocumentIcon } from '@/components/icons/document-icons' +import { getManagedMcpConnectorIcon } from '@/lib/credential-groups/managed-mcp-connector-icons' import type { ChatContextKind, ChatMessageContext } from '@/app/workspace/[workspaceId]/home/types' import { BrandIcon } from '@/blocks/brand-icon' import { getBlockRegistry } from '@/blocks/registry' @@ -118,6 +119,12 @@ export const CHAT_CONTEXT_KIND_REGISTRY: Record , + renderIcon: ({ context, className }) => { + const McpServerIcon = + context.kind === 'mcp' && context.managedConnectorId + ? getManagedMcpConnectorIcon(context.managedConnectorId) + : McpIcon + return + }, }, } diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/prompt-editor.test.tsx b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/prompt-editor.test.tsx index 63aa2852877..cc8c6431457 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/prompt-editor.test.tsx +++ b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/prompt-editor.test.tsx @@ -7,7 +7,7 @@ import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' vi.mock('@/hooks/queries/skills', () => ({ useSkills: () => ({ data: [] }) })) -vi.mock('@/hooks/queries/mcp', () => ({ useMcpServers: () => ({ data: [] }) })) +vi.mock('@/hooks/queries/mcp', () => ({ useMcpToolServers: () => ({ data: [] }) })) vi.mock('@/blocks/integration-matcher', () => ({ getIntegrationMatcher: () => ({ regex: null, byName: new Map() }), })) diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx index 6c69d935511..407bbd11202 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx +++ b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx @@ -6,7 +6,7 @@ import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' vi.mock('@/hooks/queries/skills', () => ({ useSkills: () => ({ data: [] }) })) -vi.mock('@/hooks/queries/mcp', () => ({ useMcpServers: () => ({ data: [] }) })) +vi.mock('@/hooks/queries/mcp', () => ({ useMcpToolServers: () => ({ data: [] }) })) vi.mock('@/blocks/integration-matcher', () => ({ getIntegrationMatcher: () => ({ regex: null, byName: new Map() }), })) diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.ts b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.ts index 823150e9255..7b8ca833ca2 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.ts +++ b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.ts @@ -33,7 +33,7 @@ import { restoreSkillTriggerText, SKILL_CHIP_TRIGGER, } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/utils' -import { type McpServer, useMcpServers } from '@/hooks/queries/mcp' +import { type McpServer, useMcpToolServers } from '@/hooks/queries/mcp' import { type SkillDefinition, useSkills } from '@/hooks/queries/skills' import type { ChatContext } from '@/stores/panel' @@ -165,7 +165,7 @@ export function usePromptEditor({ onPasteFiles, }: UsePromptEditorProps) { const { data: skills = [] } = useSkills(workspaceId) - const { data: allMcpServers = [] } = useMcpServers(workspaceId) + const { data: allMcpServers = [] } = useMcpToolServers(workspaceId) const mcpServers = useMemo( () => allMcpServers.filter((server) => server.enabled && server.workspaceId === workspaceId), [allMcpServers, workspaceId] @@ -527,7 +527,12 @@ export function usePromptEditor({ setValueState(newValue) } - addContextNotified({ kind: 'mcp', serverId: server.id, label: server.name }) + addContextNotified({ + kind: 'mcp', + serverId: server.id, + label: server.name, + ...(server.managedConnectorId ? { managedConnectorId: server.managedConnectorId } : {}), + }) }, [textareaRef, addContextNotified] ) diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/skills-menu-dropdown/skills-menu-dropdown.tsx b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/skills-menu-dropdown/skills-menu-dropdown.tsx index a6190e1b4e4..25fbe9eef4d 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/skills-menu-dropdown/skills-menu-dropdown.tsx +++ b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/skills-menu-dropdown/skills-menu-dropdown.tsx @@ -9,6 +9,7 @@ import { dropdownMenuRowClass, } from '@sim/emcn' import { AgentSkillsIcon, McpIcon } from '@/components/icons' +import { getManagedMcpConnectorIcon } from '@/lib/credential-groups/managed-mcp-connector-icons' import type { McpServer } from '@/hooks/queries/mcp' import type { SkillDefinition } from '@/hooks/queries/skills' @@ -201,6 +202,10 @@ export const SkillsMenuDropdown = React.memo( {filteredItems.length > 0 ? ( filteredItems.map((target, index) => { const isActive = index === activeIndex + const McpServerIcon = + target.kind === 'mcp' && target.item.managedConnectorId + ? getManagedMcpConnectorIcon(target.item.managedConnectorId) + : McpIcon return ( ) diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/hooks/use-skill-auto-mention.ts b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/hooks/use-skill-auto-mention.ts index 6aa5006ba54..2ce6adcf83e 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/user-input/hooks/use-skill-auto-mention.ts +++ b/apps/sim/app/workspace/[workspaceId]/home/components/user-input/hooks/use-skill-auto-mention.ts @@ -89,7 +89,12 @@ export function useSkillAutoMention({ for (const server of mcpServers) { const key = server.name.toLowerCase() if (!byName.has(key)) { - byName.set(key, { kind: 'mcp', serverId: server.id, label: server.name }) + byName.set(key, { + kind: 'mcp', + serverId: server.id, + label: server.name, + ...(server.managedConnectorId ? { managedConnectorId: server.managedConnectorId } : {}), + }) } } const names = [...byName.values()] diff --git a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts index 8a9a6399493..6114e8057bd 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts +++ b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts @@ -3876,7 +3876,12 @@ export function useChat( ...('folderId' in c && c.folderId ? { folderId: c.folderId } : {}), ...(c.kind === 'skill' && 'skillId' in c ? { skillId: c.skillId } : {}), ...(c.kind === 'integration' && 'blockType' in c ? { blockType: c.blockType } : {}), - ...(c.kind === 'mcp' && 'serverId' in c ? { serverId: c.serverId } : {}), + ...(c.kind === 'mcp' && 'serverId' in c + ? { + serverId: c.serverId, + ...(c.managedConnectorId ? { managedConnectorId: c.managedConnectorId } : {}), + } + : {}), ...(c.kind === 'file_selection' ? { fileName: c.fileName, diff --git a/apps/sim/app/workspace/[workspaceId]/home/types.ts b/apps/sim/app/workspace/[workspaceId]/home/types.ts index 9634055b5e5..983cc4eba67 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/types.ts +++ b/apps/sim/app/workspace/[workspaceId]/home/types.ts @@ -1,3 +1,4 @@ +import type { ManagedMcpConnectorId } from '@/lib/credential-groups/managed-mcp-connectors' import type { ChatContext } from '@/stores/panel' import type { BrowserTextSelection, TerminalTextSelection } from '@/stores/panel/types' @@ -152,6 +153,7 @@ export interface ChatMessageContext { blockType?: string skillId?: string serverId?: string + managedConnectorId?: ManagedMcpConnectorId /** Selected passage for a `file_selection` context. */ text?: string /** Source file name for a `file_selection` context. */ diff --git a/apps/sim/app/workspace/[workspaceId]/settings/[section]/prefetch.test.ts b/apps/sim/app/workspace/[workspaceId]/settings/[section]/prefetch.test.ts index e8cee8a1a54..daf315dc569 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/[section]/prefetch.test.ts +++ b/apps/sim/app/workspace/[workspaceId]/settings/[section]/prefetch.test.ts @@ -78,6 +78,7 @@ describe('credential-groups prefetch', () => { name: 'Engineering', description: null, options: [], + mcpServers: [], status: 'active', createdAt: '2026-01-01T00:00:00.000Z', updatedAt: '2026-01-01T00:00:00.000Z', diff --git a/apps/sim/app/workspace/[workspaceId]/settings/components/desktop/desktop.tsx b/apps/sim/app/workspace/[workspaceId]/settings/components/desktop/desktop.tsx index c322ba5d78f..20d72828869 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/components/desktop/desktop.tsx +++ b/apps/sim/app/workspace/[workspaceId]/settings/components/desktop/desktop.tsx @@ -1,16 +1,13 @@ 'use client' -import { useCallback, useEffect, useState } from 'react' -import type { - DesktopPreferenceKey, - DesktopPreferences, - DesktopUpdateState, -} from '@sim/desktop-bridge' +import { useEffect, useState } from 'react' +import type { DesktopPreferenceKey, DesktopPreferences } from '@sim/desktop-bridge' import { Label, Switch, toast } from '@sim/emcn' import { useParams, useRouter } from 'next/navigation' -import { getDesktopBridge, getDesktopShellVersion, getDesktopUpdates } from '@/lib/desktop' +import { getDesktopBridge, getDesktopShellVersion } from '@/lib/desktop' import { SettingsPanel } from '@/app/workspace/[workspaceId]/settings/components/settings-panel' import { SettingsSection } from '@/app/workspace/[workspaceId]/settings/components/settings-section/settings-section' +import { useDesktopUpdateState } from '@/hooks/use-desktop-update-state' interface PreferenceRowProps { id: string @@ -35,8 +32,8 @@ export function Desktop() { const workspaceId = params.workspaceId as string const [preferences, setPreferences] = useState(null) const [pendingPreference, setPendingPreference] = useState(null) - const [updateState, setUpdateState] = useState({ status: 'idle' }) - const [shellVersion, setShellVersion] = useState(undefined) + const updateState = useDesktopUpdateState() + const shellVersion = getDesktopShellVersion() useEffect(() => { const bridge = getDesktopBridge() @@ -50,19 +47,7 @@ export function Desktop() { .catch(() => toast.error('Could not load desktop settings')) }, [router, workspaceId]) - useEffect(() => { - setShellVersion(getDesktopShellVersion()) - const updates = getDesktopUpdates() - if (!updates) return - const unsubscribe = updates.onState(setUpdateState) - void updates - .getState() - .then(setUpdateState) - .catch(() => {}) - return unsubscribe - }, []) - - const updatePreference = useCallback(async (key: DesktopPreferenceKey, value: boolean) => { + const updatePreference = async (key: DesktopPreferenceKey, value: boolean) => { const settings = getDesktopBridge()?.settings if (!settings) return setPendingPreference(key) @@ -73,7 +58,7 @@ export function Desktop() { } finally { setPendingPreference(null) } - }, []) + } if (!preferences) { return null @@ -88,7 +73,9 @@ export function Desktop() {
{shellVersion && (
- + {updateState.status === 'ready' && updateState.version ? `${shellVersion} → ${updateState.version} on restart` diff --git a/apps/sim/app/workspace/[workspaceId]/settings/components/mcp/mcp.tsx b/apps/sim/app/workspace/[workspaceId]/settings/components/mcp/mcp.tsx index 55678e16cbc..29aff5fb184 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/components/mcp/mcp.tsx +++ b/apps/sim/app/workspace/[workspaceId]/settings/components/mcp/mcp.tsx @@ -11,6 +11,7 @@ import { McpIcon } from '@/components/icons' import { canMutateWorkspaceSettingsSection } from '@/components/settings/navigation' import { requestJson } from '@/lib/api/client/request' import { getWorkflowStateContract } from '@/lib/api/contracts/workflows' +import { getManagedMcpConnectorIcon } from '@/lib/credential-groups/managed-mcp-connector-icons' import { getIssueBadgeLabel, getIssueBadgeVariant, @@ -35,6 +36,7 @@ import { import { SettingsSection } from '@/app/workspace/[workspaceId]/settings/components/settings-section/settings-section' import { useSettingsSearch } from '@/app/workspace/[workspaceId]/settings/components/use-settings-search' import { useMcpOauthPopup } from '@/hooks/mcp/use-mcp-oauth-popup' +import { useCredentialGroups } from '@/hooks/queries/credential-groups' import { type McpServer, type McpTool, @@ -75,6 +77,7 @@ interface ServerListItemProps { isLoadingTools?: boolean isRefreshing?: boolean discoveryError?: string | null + ownerName?: string onViewDetails: () => void onAuthorize: () => void } @@ -87,10 +90,14 @@ function ServerListItem({ isLoadingTools = false, isRefreshing = false, discoveryError = null, + ownerName, onViewDetails, onAuthorize, }: ServerListItemProps) { const transportLabel = formatTransportLabel(server.transport || 'http') + const ServerIcon = server.managedConnectorId + ? getManagedMcpConnectorIcon(server.managedConnectorId) + : McpIcon const toolsLabel = getServerToolsLabel( tools, server.connectionStatus, @@ -113,20 +120,22 @@ function ServerListItem({ const serverName = server.name || 'Unnamed server' // Transport rides on the description rather than beside the name — inside the // row's truncating title a long name would clip it away entirely. - const statusText = isConnecting - ? 'Waiting for authorization...' - : isRefreshing - ? 'Refreshing...' - : isLoadingTools && tools.length === 0 - ? 'Loading...' - : showDiscoveryError - ? discoveryError - : toolsLabel + const statusText = server.managedConnectorId + ? `Managed by ${ownerName ?? 'a Credential Group'}` + : isConnecting + ? 'Waiting for authorization...' + : isRefreshing + ? 'Refreshing...' + : isLoadingTools && tools.length === 0 + ? 'Loading...' + : showDiscoveryError + ? discoveryError + : toolsLabel return ( } - iconFilled + icon={} + iconFilled={!server.managedConnectorId} title={serverName} description={ <> @@ -145,7 +154,10 @@ function ServerListItem({ clickLabel={`Open ${serverName}`} navigable trailing={ - canManage && server.authType === 'oauth' && server.connectionStatus !== 'connected' ? ( + canManage && + !server.managedConnectorId && + server.authType === 'oauth' && + server.connectionStatus !== 'connected' ? ( {isConnecting ? 'Reopen authorization' : 'Authorize'} ) : undefined } @@ -194,6 +206,9 @@ export function MCP() { isLoading: serversLoading, error: serversError, } = useMcpServers(workspaceId) + const credentialGroups = useCredentialGroups( + workspacePermissions.canAdmin ? workspaceId : undefined + ) const { data: mcpToolsData = [], toolsStateByServer } = useMcpToolsQuery(workspaceId) const { data: storedTools = [], refetch: refetchStoredTools } = useStoredMcpTools(workspaceId, { enabled: selectedServerId !== null, @@ -276,6 +291,9 @@ export function MCP() { const filteredServers = (servers || []).filter((server) => server.name?.toLowerCase().includes(searchTerm.toLowerCase()) ) + const credentialGroupNameById = new Map( + credentialGroups.data?.credentialGroups.map((group) => [group.id, group.name] as const) ?? [] + ) const handleViewDetails = (serverId: string) => { setSelectedServerId(serverId) @@ -440,7 +458,7 @@ export function MCP() { back={{ text: 'MCP tools', icon: ArrowLeft, onSelect: handleBackToList }} title={server.name || 'Unnamed server'} actions={ - canEdit + canEdit && !server.managedConnectorId ? [ { text: refreshAction.text, @@ -474,6 +492,14 @@ export function MCP() { )} + {server.managedConnectorId && ( + + {server.credentialGroupId + ? (credentialGroupNameById.get(server.credentialGroupId) ?? 'Credential Group') + : 'Credential Group'} + + )} + {server.connectionStatus !== 'connected' && (

@@ -487,20 +513,23 @@ export function MCP() { )} - {canEdit && server.authType === 'oauth' && server.connectionStatus !== 'connected' && ( - -

- { - await startOauthForServer(server.id) - }} - > - {connectingOauthServers.has(server.id) ? 'Reopen authorization' : 'Authorize'} - -
-
- )} + {canEdit && + !server.managedConnectorId && + server.authType === 'oauth' && + server.connectionStatus !== 'connected' && ( + +
+ { + await startOauthForServer(server.id) + }} + > + {connectingOauthServers.has(server.id) ? 'Reopen authorization' : 'Authorize'} + +
+
+ )}
@@ -702,6 +731,11 @@ export function MCP() { key={server.id} canManage={canEdit} server={server} + ownerName={ + server.credentialGroupId + ? credentialGroupNameById.get(server.credentialGroupId) + : undefined + } tools={tools} isConnecting={connectingOauthServers.has(server.id)} isLoadingTools={isLoadingTools} diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.test.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.test.tsx index 296da0f8df2..144d5afe4df 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.test.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.test.tsx @@ -64,12 +64,14 @@ vi.mock('@sim/emcn', () => ({ groups, multiSelectValues, onMultiSelectChange, + disablePortal, }: { groups: Array<{ section?: string; items: Array<{ label: string; value: string }> }> multiSelectValues?: string[] onMultiSelectChange?: (values: string[]) => void + disablePortal?: boolean }) => ( -
+
{groups.flatMap((group) => group.items.map((option) => (
) } @@ -133,25 +134,7 @@ export function SidebarFooter({ const { data: session } = useSession() const hostContext = useWorkspaceHostContext() const { isInvitationsDisabled } = useWorkspaceInvitePolicy(workspaceId) - const [updateState, setUpdateState] = useState({ status: 'idle' }) - - useEffect(() => { - const updates = getDesktopUpdates() - if (!updates) return - - let stateEventReceived = false - const unsubscribe = updates.onState((state) => { - stateEventReceived = true - setUpdateState(state) - }) - void updates - .getState() - .then((state) => { - if (!stateEventReceived) setUpdateState(state) - }) - .catch(() => {}) - return unsubscribe - }, []) + const updateState = useDesktopUpdateState() const name = profile ? profile.name?.trim() || profile.email : '' const updateAvailable = hasAvailableDesktopUpdate(updateState) diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx index da5bdaeed8e..46a2e7b6a6f 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx @@ -854,15 +854,12 @@ export const Sidebar = memo(function Sidebar({ files: { hover: filesHover, content: }, } - const handleOpenSettings = useCallback( - (section: SettingsSection) => { - if (!isCollapsedRef.current) { - setSidebarWidth(SIDEBAR_WIDTH.MIN) - } - navigateToSettings({ section }) - }, - [navigateToSettings, setSidebarWidth] - ) + const handleOpenSettings = (section: SettingsSection) => { + if (!isCollapsedRef.current) { + setSidebarWidth(SIDEBAR_WIDTH.MIN) + } + navigateToSettings({ section }) + } const { data: fetchedChats = EMPTY_CHATS, isLoading: chatsLoading } = useMothershipChats( workspaceId, @@ -1239,17 +1236,17 @@ export const Sidebar = memo(function Sidebar({ [isCollapsed, toggleCollapsed] ) - const handleOpenHelpFromMenu = useCallback(() => setIsHelpModalOpen(true), []) + const handleOpenHelpFromMenu = () => setIsHelpModalOpen(true) - const handleOpenDocs = useCallback(() => { + const handleOpenDocs = () => { window.open('https://docs.sim.ai', '_blank', 'noopener,noreferrer') captureEvent(posthog, 'docs_opened', { source: 'help_menu' }) - }, [posthog]) + } - const handleOpenSlackCommunity = useCallback(() => { + const handleOpenSlackCommunity = () => { window.open(SLACK_COMMUNITY_URL, '_blank', 'noopener,noreferrer') captureEvent(posthog, 'slack_community_opened', { source: 'help_menu' }) - }, [posthog]) + } const handleChatRenameBlur = useCallback( () => void chatFlyoutRename.saveRename(), diff --git a/apps/sim/blocks/blocks/credential-group.ts b/apps/sim/blocks/blocks/credential-group.ts index 46a9c28f042..18cc264fb12 100644 --- a/apps/sim/blocks/blocks/credential-group.ts +++ b/apps/sim/blocks/blocks/credential-group.ts @@ -64,6 +64,14 @@ interface CredentialGroupBlockOutput { providerSubjectId: string providerTenantId: string | null }> + mcpConnections: Array<{ + credentialId: string + email: string + displayName: string + mcpServerId: string + mcpServerName: string + toolNames: string[] + }> credentialGroups: Array<{ id: string name: string @@ -94,21 +102,32 @@ interface CredentialGroupBlockOutput { } const INVITE_OPERATIONS = ['send_invite', 'get_invite_link'] as const -const GROUP_OPERATIONS = ['list_credentials', ...INVITE_OPERATIONS, 'list_people'] as const -const LIST_OPERATIONS = ['list_credentials', 'list_people', 'list_groups'] as const +const GROUP_OPERATIONS = [ + 'list_credentials', + 'list_mcp_connections', + ...INVITE_OPERATIONS, + 'list_people', +] as const +const LIST_OPERATIONS = [ + 'list_credentials', + 'list_mcp_connections', + 'list_people', + 'list_groups', +] as const export const CredentialGroupBlock: BlockConfig = { type: 'credential_group', name: 'Credential Groups', - description: 'Invite people and use credentials collected by Credential Groups', + description: 'Invite people and use credentials or MCP connections from Credential Groups', longDescription: - 'List usable managed credentials, inspect invited people, send or generate an account-connection invitation, or discover Credential Groups in the current workspace. The block returns credential IDs and account metadata without exposing OAuth tokens.', + 'List usable managed credentials or MCP connections, inspect invited people, send or generate an account-connection invitation, or discover Credential Groups in the current workspace. The block returns credential IDs and account metadata without exposing OAuth tokens.', bestPractices: ` - "List Credentials" returns every active credential. Filter by email to select one enrolled person, by provider to select one account type, or by both for an exact match. - Provider blocks can use the current actor's enrolled credential by default. Using another enrollment requires an explicit workflow access grant. - With a workflow access grant, use "List Credentials" with a ForEach loop to run a provider block once for every connected account. - Continue with nextCursor until hasMore is false when a list operation returns multiple pages. - "List Credentials" returns active, usable credentials only. Reconnect-needed and revoked credentials are excluded. + - "List MCP Connections" returns explicit managed MCP credential IDs and tool names. Pass one credentialId to an advanced MCP server tool. - Use "List People" to inspect invitation and connection progress without exposing credential secrets. - "Send Invite" sends one email. Use a loop when invitations should come from a dynamic list. - "Get Invite Link" issues a fresh seven-day bearer link without sending email. It invalidates the previous link for that email, so treat the output as a secret. @@ -130,6 +149,16 @@ export const CredentialGroupBlock: BlockConfig = { { text: ', from', field: ['providerFilter', 'manualProviderIds'] }, { text: ', up to', field: 'limit', after: 'credentials' }, ], + list_mcp_connections: [ + { + text: 'List MCP connections from', + field: ['credentialGroup', 'manualCredentialGroup'], + core: true, + }, + { text: ', for', field: 'email' }, + { text: ', on server', field: 'mcpServerId' }, + { text: ', up to', field: 'limit', after: 'connections' }, + ], send_invite: [ { text: 'Invite', field: 'email', core: true }, { @@ -167,6 +196,7 @@ export const CredentialGroupBlock: BlockConfig = { type: 'dropdown', options: [ { label: 'List Credentials', id: 'list_credentials' }, + { label: 'List MCP Connections', id: 'list_mcp_connections' }, { label: 'Send Invite', id: 'send_invite' }, { label: 'Get Invite Link', id: 'get_invite_link' }, { label: 'List People', id: 'list_people' }, @@ -226,6 +256,15 @@ export const CredentialGroupBlock: BlockConfig = { placeholder: '["google-email", "slack"] — leave empty for all providers', condition: { field: 'operation', value: 'list_credentials' }, }, + { + id: 'mcpServerId', + title: 'MCP Server ID', + type: 'short-input', + required: false, + mode: 'advanced', + placeholder: 'mcp-... — leave empty for all MCP servers', + condition: { field: 'operation', value: 'list_mcp_connections' }, + }, { id: 'peopleStatuses', title: 'Status', @@ -265,7 +304,7 @@ export const CredentialGroupBlock: BlockConfig = { operation: { type: 'string', description: - "'list_credentials', 'send_invite', 'get_invite_link', 'list_people', or 'list_groups'", + "'list_credentials', 'list_mcp_connections', 'send_invite', 'get_invite_link', 'list_people', or 'list_groups'", }, credentialGroupId: { type: 'string', description: 'Credential Group ID' }, email: { @@ -276,6 +315,10 @@ export const CredentialGroupBlock: BlockConfig = { type: 'json', description: 'Optional OAuth provider IDs to include when listing credentials', }, + mcpServerId: { + type: 'string', + description: 'Optional root MCP server ID to include when listing MCP connections', + }, peopleStatuses: { type: 'json', description: 'Optional invitation statuses to include when listing people', @@ -290,6 +333,12 @@ export const CredentialGroupBlock: BlockConfig = { 'Usable credential references (credentialId, email, displayName, providerId, providerSubjectId, providerTenantId)', condition: { field: 'operation', value: 'list_credentials' }, }, + mcpConnections: { + type: 'json', + description: + 'Usable MCP connection references (credentialId, email, displayName, mcpServerId, mcpServerName, toolNames)', + condition: { field: 'operation', value: 'list_mcp_connections' }, + }, credentialGroups: { type: 'json', description: diff --git a/apps/sim/blocks/blocks/start_trigger.ts b/apps/sim/blocks/blocks/start_trigger.ts index 377f320328d..37bd1f2ece2 100644 --- a/apps/sim/blocks/blocks/start_trigger.ts +++ b/apps/sim/blocks/blocks/start_trigger.ts @@ -32,7 +32,7 @@ export const StartTriggerBlock: BlockConfig = { mode: 'advanced', defaultValue: false, description: - 'Expose trusted, server-injected run metadata under : userEmail, workspaceId, workflowId, executionId, executionType, executionMode, startTime. Fields describe the invoking run — inside a custom block they identify the calling user and workflow.', + 'Expose trusted, server-injected run metadata under : subject, workspaceId, workflowId, executionId, executionType, executionMode, startTime. The subject identifies the authenticated Sim user, chat email, or external provider user without exposing credentials.', }, ], tools: { diff --git a/apps/sim/ee/credential-groups/components/credential-group-access.tsx b/apps/sim/ee/credential-groups/components/credential-group-access.tsx index 5d061f2ac4c..915171b5b86 100644 --- a/apps/sim/ee/credential-groups/components/credential-group-access.tsx +++ b/apps/sim/ee/credential-groups/components/credential-group-access.tsx @@ -5,7 +5,7 @@ import { Chip, toast } from '@sim/emcn' import { Workflow } from '@sim/emcn/icons' import { getErrorMessage } from '@sim/utils/errors' import type { CredentialGroupAccessResponse } from '@/lib/api/contracts/credential-groups' -import { CREDENTIAL_GROUP_WORKFLOW_ACCESS_LIMIT } from '@/lib/credential-groups/workflow-access-limits' +import { CREDENTIAL_GROUP_WORKFLOW_ACCESS_LIMIT } from '@/lib/credential-groups/limits' import { RowActionsMenu } from '@/app/workspace/[workspaceId]/settings/components/row-actions-menu' import { SettingsEmptyState } from '@/app/workspace/[workspaceId]/settings/components/settings-empty-state' import { diff --git a/apps/sim/ee/credential-groups/components/credential-group-detail.tsx b/apps/sim/ee/credential-groups/components/credential-group-detail.tsx index a6a76bf9ab4..0884035e701 100644 --- a/apps/sim/ee/credential-groups/components/credential-group-detail.tsx +++ b/apps/sim/ee/credential-groups/components/credential-group-detail.tsx @@ -5,10 +5,12 @@ import { Chip, ChipConfirmModal, ChipModalTabs, toast } from '@sim/emcn' import { ArrowLeft, Plus, User } from '@sim/emcn/icons' import { getErrorMessage } from '@sim/utils/errors' import { useQueryState } from 'nuqs' +import { McpIcon } from '@/components/icons' import { saveDiscardActions } from '@/components/settings/save-discard-actions' import type { CredentialGroupEnrollment, CredentialGroupEnrollmentConnection, + CredentialGroupEnrollmentMcpConnection, } from '@/lib/api/contracts/credential-groups' import type { CredentialGroupProvider } from '@/lib/credential-groups/providers' import { getCredentialGroupProviderService } from '@/lib/credential-groups/providers' @@ -62,6 +64,7 @@ const CREDENTIAL_GROUP_TABS = [ interface EnrollmentConnectionsProps { connections: CredentialGroupEnrollmentConnection[] + mcpConnections: CredentialGroupEnrollmentMcpConnection[] } interface CredentialProviderIconProps { @@ -73,9 +76,11 @@ function CredentialProviderIcon({ provider }: CredentialProviderIconProps) { return } -function EnrollmentConnections({ connections }: EnrollmentConnectionsProps) { +function EnrollmentConnections({ connections, mcpConnections }: EnrollmentConnectionsProps) { const connected = connections.filter((connection) => connection.status === 'active') - const count = connected.reduce((total, connection) => total + connection.count, 0) + const connectedMcp = mcpConnections.filter((connection) => connection.status === 'active') + const count = + connected.reduce((total, connection) => total + connection.count, 0) + connectedMcp.length const providers = [...new Set(connected.map((connection) => connection.provider))] return ( @@ -83,8 +88,9 @@ function EnrollmentConnections({ connections }: EnrollmentConnectionsProps) { {providers.map((provider) => { return })} + {connectedMcp.length > 0 ? : null} - {count} connected {count === 1 ? 'account' : 'accounts'} + {count} connected {count === 1 ? 'connection' : 'connections'} ) @@ -130,7 +136,13 @@ export function CredentialGroupDetail({ ? (enrollments.find((enrollment) => enrollment.id === deletingEnrollmentId) ?? null) : null const configurationReady = - Boolean(credentialGroup?.options.length) && + Boolean( + credentialGroup && + (credentialGroup.options.length || + credentialGroup.mcpServers.some( + (server) => server.enabled && server.authType === 'oauth' + )) + ) && credentialGroup?.options.every( (option) => option.provider !== 'slack' || @@ -275,7 +287,7 @@ export function CredentialGroupDetail({ ? { value: providerSearch, onChange: setProviderSearch, - placeholder: 'Search account types...', + placeholder: 'Search accounts and MCP servers...', disabled: detail.isPending, } : undefined @@ -332,7 +344,10 @@ export function CredentialGroupDetail({ iconFilled title={enrollment.email} description={ - + } trailing={ (null) const [removingProvider, setRemovingProvider] = useState(null) + const [databricksSetupOpen, setDatabricksSetupOpen] = useState(false) + const [removingMcpConnector, setRemovingMcpConnector] = useState( + null + ) - const isUpdating = updateGroup.isPending + const isUpdating = + updateGroup.isPending || createMcpConnector.isPending || deleteMcpConnector.isPending const updateOptions = async ( options: NonNullable, @@ -142,6 +163,35 @@ export function CredentialGroupDetails({ if (await updateOptions(options, `${service.name} removed`)) setRemovingProvider(null) } + const addMcpConnector = async (connectorId: Exclude) => { + try { + await createMcpConnector.mutateAsync({ + workspaceId, + groupId: credentialGroup.id, + body: { connectorId }, + }) + toast.success(`${MANAGED_MCP_CONNECTORS[connectorId].name} added`) + } catch (error) { + toast.error(getErrorMessage(error, 'Could not add managed MCP connector')) + } + } + + const handleRemoveMcpConnector = async () => { + if (!removingMcpConnector) return + const connector = MANAGED_MCP_CONNECTORS[removingMcpConnector] + try { + await deleteMcpConnector.mutateAsync({ + workspaceId, + groupId: credentialGroup.id, + connectorId: removingMcpConnector, + }) + toast.success(`${connector.name} removed`) + setRemovingMcpConnector(null) + } catch (error) { + toast.error(getErrorMessage(error, 'Could not remove managed MCP connector')) + } + } + /** * A provider whose OAuth client this deployment has not configured can never finish an * enrollment, so it is not offered — but one already on the group stays listed regardless, or @@ -161,6 +211,20 @@ export function CredentialGroupDetails({ if (!providerQuery) return true return getCredentialGroupProviderService(provider).name.toLowerCase().includes(providerQuery) }) + const shownMcpConnectors = MANAGED_MCP_CONNECTOR_IDS.filter((connectorId) => { + if (!providerQuery) return true + const connector = MANAGED_MCP_CONNECTORS[connectorId] + return ( + connector.name.toLowerCase().includes(providerQuery) || + connector.description.toLowerCase().includes(providerQuery) + ) + }) + const databricksServerSummary = credentialGroup.mcpServers.find( + (server) => server.managedConnectorId === 'databricks' + ) + const databricksServer = databricksServerSummary + ? mcpServers.data?.find((server) => server.id === databricksServerSummary.id) + : undefined return ( <> @@ -283,6 +347,68 @@ export function CredentialGroupDetails({
+ + {shownMcpConnectors.length === 0 ? ( + + {providerSearch.trim() + ? `No MCP apps found matching "${providerSearch}"` + : 'No managed MCP apps are available.'} + + ) : null} +
+ {shownMcpConnectors.map((connectorId) => { + const connector = MANAGED_MCP_CONNECTORS[connectorId] + const server = credentialGroup.mcpServers.find( + (candidate) => candidate.managedConnectorId === connectorId + ) + const ConnectorIcon = getManagedMcpConnectorIcon(connectorId) + return ( + } + title={server?.name ?? connector.name} + description={connector.description} + badge={server ? Added : undefined} + trailing={ + server ? ( + setDatabricksSetupOpen(true), + disabled: isUpdating || !databricksServer, + }, + ] + : []), + { + label: 'Remove', + destructive: true, + onSelect: () => setRemovingMcpConnector(connectorId), + disabled: isUpdating, + }, + ]} + /> + ) : ( + { + if (connectorId === 'databricks') setDatabricksSetupOpen(true) + else void addMcpConnector(connectorId) + }} + > + {connectorId === 'databricks' ? 'Set up' : 'Add'} + + ) + } + /> + ) + })} +
+
+ + + !open && !isUpdating && setRemovingProvider(null)} @@ -312,6 +446,23 @@ export function CredentialGroupDetails({ disabled: isUpdating, }} /> + + !open && !isUpdating && setRemovingMcpConnector(null)} + srTitle='Remove MCP app' + title={`Remove ${ + removingMcpConnector ? MANAGED_MCP_CONNECTORS[removingMcpConnector].name : 'MCP app' + }`} + defaultAction='confirm' + text='People will no longer be able to connect this app. Existing OAuth grants and saved tool metadata will be revoked.' + dismissLabel='Cancel' + confirm={{ + label: isUpdating ? 'Removing...' : 'Remove', + onClick: handleRemoveMcpConnector, + disabled: isUpdating, + }} + /> ) } diff --git a/apps/sim/ee/credential-groups/components/databricks-mcp-connector-modal.tsx b/apps/sim/ee/credential-groups/components/databricks-mcp-connector-modal.tsx new file mode 100644 index 00000000000..7908646500d --- /dev/null +++ b/apps/sim/ee/credential-groups/components/databricks-mcp-connector-modal.tsx @@ -0,0 +1,165 @@ +'use client' + +import { useState } from 'react' +import { + ChipModal, + ChipModalBody, + ChipModalError, + ChipModalField, + ChipModalFooter, + ChipModalHeader, + toast, +} from '@sim/emcn' +import { getErrorMessage } from '@sim/utils/errors' +import { DatabricksIcon } from '@/components/icons' +import type { McpServer } from '@/lib/api/contracts/mcp' +import { + useCreateCredentialGroupMcpConnector, + useUpdateCredentialGroupMcpConnector, +} from '@/hooks/queries/credential-groups' + +interface DatabricksMcpConnectorModalProps { + credentialGroupId: string + onOpenChange: (open: boolean) => void + open: boolean + server?: McpServer + workspaceId: string +} + +export function DatabricksMcpConnectorModal({ + credentialGroupId, + onOpenChange, + open, + server, + workspaceId, +}: DatabricksMcpConnectorModalProps) { + const createConnector = useCreateCredentialGroupMcpConnector() + const updateConnector = useUpdateCredentialGroupMcpConnector() + const [nameInput, setNameInput] = useState(null) + const [urlInput, setUrlInput] = useState(null) + const [clientIdInput, setClientIdInput] = useState(null) + const [clientSecret, setClientSecret] = useState('') + const name = nameInput ?? server?.name ?? 'Databricks' + const url = urlInput ?? server?.url ?? '' + const clientId = clientIdInput ?? server?.oauthClientId ?? '' + const pending = createConnector.isPending || updateConnector.isPending + const error = createConnector.error ?? updateConnector.error + + const reset = () => { + setNameInput(null) + setUrlInput(null) + setClientIdInput(null) + setClientSecret('') + createConnector.reset() + updateConnector.reset() + } + + const handleOpenChange = (nextOpen: boolean) => { + if (pending && !nextOpen) return + onOpenChange(nextOpen) + if (!nextOpen) reset() + } + + const handleSubmit = async () => { + if (!name.trim() || !url.trim() || !clientId.trim() || pending) return + try { + if (server) { + await updateConnector.mutateAsync({ + workspaceId, + groupId: credentialGroupId, + connectorId: 'databricks', + body: { + name: name.trim(), + url: url.trim(), + oauthClientId: clientId.trim(), + ...(clientSecret.trim() ? { oauthClientSecret: clientSecret.trim() } : {}), + }, + }) + } else { + await createConnector.mutateAsync({ + workspaceId, + groupId: credentialGroupId, + body: { + connectorId: 'databricks', + name: name.trim(), + url: url.trim(), + oauthClientId: clientId.trim(), + ...(clientSecret.trim() ? { oauthClientSecret: clientSecret.trim() } : {}), + }, + }) + } + toast.success(server ? 'Databricks updated' : 'Databricks added') + handleOpenChange(false) + } catch (submitError) { + toast.error(getErrorMessage(submitError, 'Could not save Databricks')) + } + } + + return ( + + handleOpenChange(false)} + closeDisabled={pending} + > + {server ? 'Edit Databricks MCP' : 'Add Databricks MCP'} + + + + + + + {error ? getErrorMessage(error) : null} + + handleOpenChange(false)} + cancelDisabled={pending} + primaryAction={{ + label: pending ? 'Saving...' : 'Save', + onClick: () => void handleSubmit(), + disabled: pending || !name.trim() || !url.trim() || !clientId.trim(), + }} + /> + + ) +} diff --git a/apps/sim/ee/workspace-forking/lib/remap/remap-references.ts b/apps/sim/ee/workspace-forking/lib/remap/remap-references.ts index 916acd6ecdf..6886502536d 100644 --- a/apps/sim/ee/workspace-forking/lib/remap/remap-references.ts +++ b/apps/sim/ee/workspace-forking/lib/remap/remap-references.ts @@ -4,7 +4,7 @@ import { isRecordLike, omit } from '@sim/utils/object' import type { SubBlockType } from '@sim/workflow-types/blocks' import type { z } from 'zod' import type { forkRemapKindSchema } from '@/lib/api/contracts/workspace-fork' -import { createMcpToolId } from '@/lib/mcp/shared' +import { createMcpToolId, MCP_SERVER_ADVANCED_TOOL_TYPE } from '@/lib/mcp/shared' import { coerceObjectArray, type SubBlockRecord, @@ -954,7 +954,7 @@ function remapForkToolInputValue( return } if ( - tool.type === 'mcp' && + (tool.type === 'mcp' || tool.type === MCP_SERVER_ADVANCED_TOOL_TYPE) && isRecordLike(tool.params) && typeof tool.params.serverId === 'string' ) { @@ -981,7 +981,8 @@ function remapForkToolInputValue( keep({ ...tool, params: nextParams, - toolId: toolName ? createMcpToolId(target, toolName) : tool.toolId, + toolId: + tool.type === 'mcp' && toolName ? createMcpToolId(target, toolName) : tool.toolId, }) return } diff --git a/apps/sim/executor/handlers/agent/agent-handler.test.ts b/apps/sim/executor/handlers/agent/agent-handler.test.ts index c3026f5db06..820c30217de 100644 --- a/apps/sim/executor/handlers/agent/agent-handler.test.ts +++ b/apps/sim/executor/handlers/agent/agent-handler.test.ts @@ -126,9 +126,19 @@ vi.mock('@/executor/utils/http', () => ({ /** Connected MCP servers every workspace-server lookup in this suite resolves. */ const MCP_SERVER_ROWS = [ - { id: 'mcp-search-server', connectionStatus: 'connected' }, - { id: 'same-server', connectionStatus: 'connected' }, - { id: 'mcp-legacy-server', connectionStatus: 'connected' }, + { + id: 'mcp-search-server', + connectionStatus: 'connected', + credentialGroupId: null, + enabled: true, + }, + { id: 'same-server', connectionStatus: 'connected', credentialGroupId: null, enabled: true }, + { + id: 'mcp-legacy-server', + connectionStatus: 'connected', + credentialGroupId: null, + enabled: true, + }, ] const mockReadAvailableCustomToolByIdOrTitleAsExecutor = vi.fn() @@ -3701,6 +3711,100 @@ describe('AgentBlockHandler', () => { ) }) + it('expands every live tool from an explicitly selected managed MCP connection', async () => { + const credentialId = 'mcp-cg-123456789012345678901' + mockDiscoverMcpServerToolsAsExecutor.mockResolvedValue([ + { + name: 'search_transcripts', + description: 'Search transcripts', + inputSchema: { + type: 'object', + properties: { query: { type: 'string' } }, + required: ['query'], + }, + serverId: credentialId, + serverName: 'Fireflies', + }, + { + name: 'get_transcript', + description: 'Get one transcript', + inputSchema: { + type: 'object', + properties: { transcriptId: { type: 'string' } }, + required: ['transcriptId'], + }, + serverId: credentialId, + serverName: 'Fireflies', + }, + ]) + + await handler.execute( + { + ...mockContext, + userId: 'permission-check-user', + workspaceId: 'test-workspace-123', + workflowId: 'test-workflow-456', + }, + mockBlock, + { + model: 'gpt-4o', + userPrompt: 'Use Fireflies', + apiKey: 'test-api-key', + tools: [ + { + type: 'mcp-server-advanced', + params: { serverId: credentialId }, + usageControl: 'auto' as const, + }, + ], + } + ) + + expect(mockDiscoverMcpServerToolsAsExecutor).toHaveBeenCalledWith( + expect.objectContaining({ + serverId: credentialId, + workspaceId: 'test-workspace-123', + }) + ) + const providerTools = mockExecuteProviderRequest.mock.calls[0][1].tools + expect(providerTools).toEqual([ + expect.objectContaining({ + id: `${credentialId}-search_transcripts`, + params: {}, + }), + expect.objectContaining({ + id: `${credentialId}-get_transcript`, + params: {}, + }), + ]) + }) + + it('does not create tools for a blank advanced MCP server binding', async () => { + await handler.execute( + { + ...mockContext, + workspaceId: 'test-workspace-123', + workflowId: 'test-workflow-456', + }, + mockBlock, + { + model: 'gpt-4o', + userPrompt: 'Continue without MCP tools', + apiKey: 'test-api-key', + tools: [ + { + type: 'mcp-server-advanced', + params: { serverId: '' }, + usageControl: 'auto' as const, + }, + ], + } + ) + + expect(mockDiscoverMcpServerToolsAsExecutor).not.toHaveBeenCalled() + expect(mockExecuteProviderRequest.mock.calls[0][1].tools).toEqual([]) + }) + describe('customToolId resolution - DB as source of truth', () => { const staleInlineSchema = { function: { diff --git a/apps/sim/executor/handlers/agent/agent-handler.ts b/apps/sim/executor/handlers/agent/agent-handler.ts index ef359254ea6..ca3098dde42 100644 --- a/apps/sim/executor/handlers/agent/agent-handler.ts +++ b/apps/sim/executor/handlers/agent/agent-handler.ts @@ -17,8 +17,13 @@ import { readWorkflowInputFieldsForTool, readWorkflowMetadataForTool, } from '@/lib/internal/workflows/read-tool-enrichment' +import { assertValidMcpServerToolBindings, MCP_SERVER_ADVANCED_TOOL_TYPE } from '@/lib/mcp/shared' import type { McpToolSchema } from '@/lib/mcp/types' -import { createMcpToolId } from '@/lib/mcp/utils' +import { + createMcpToolId, + isManagedMcpConnectionId, + MANAGED_MCP_CONNECTION_PREFIX, +} from '@/lib/mcp/utils' import { type AutoMediaKind, type AutoRoutingResult, @@ -595,7 +600,9 @@ export class AgentBlockHandler implements BlockHandler { private async validateToolPermissions(ctx: ExecutionContext, tools: ToolInput[]): Promise { if (!Array.isArray(tools) || tools.length === 0) return - const hasMcpTools = tools.some((t) => t.type === 'mcp') + const hasMcpTools = tools.some( + (t) => t.type === 'mcp' || t.type === MCP_SERVER_ADVANCED_TOOL_TYPE + ) const hasCustomTools = tools.some((t) => t.type === 'custom-tool') if (hasMcpTools) { @@ -635,21 +642,41 @@ export class AgentBlockHandler implements BlockHandler { } const availableServerIds = new Set() - if (serverIds.length > 0) { + const sharedServerIds: string[] = [] + for (const serverId of serverIds) { + if (serverId.startsWith(MANAGED_MCP_CONNECTION_PREFIX)) { + if (!isManagedMcpConnectionId(serverId)) { + throw new Error('Invalid managed MCP connection ID') + } + availableServerIds.add(serverId) + } else { + sharedServerIds.push(serverId) + } + } + if (sharedServerIds.length > 0) { try { const servers = await db - .select({ id: mcpServers.id, connectionStatus: mcpServers.connectionStatus }) + .select({ + id: mcpServers.id, + connectionStatus: mcpServers.connectionStatus, + credentialGroupId: mcpServers.credentialGroupId, + enabled: mcpServers.enabled, + }) .from(mcpServers) .where( and( eq(mcpServers.workspaceId, ctx.workspaceId), - inArray(mcpServers.id, serverIds), + inArray(mcpServers.id, sharedServerIds), isNull(mcpServers.deletedAt) ) ) for (const server of servers) { - if (server.connectionStatus === 'connected') { + if ( + server.enabled && + !server.credentialGroupId && + server.connectionStatus === 'connected' + ) { availableServerIds.add(server.id) } } @@ -662,7 +689,7 @@ export class AgentBlockHandler implements BlockHandler { getErrorDiagnosticFallback(error) ) ) - for (const serverId of serverIds) { + for (const serverId of sharedServerIds) { availableServerIds.add(serverId) } } @@ -723,8 +750,11 @@ export class AgentBlockHandler implements BlockHandler { const root = ['tools', String(toolIndex)] as const const paths: ResolvedSecretInputPath[] = [[...root, 'type']] if (tool.operation !== undefined) paths.push([...root, 'operation']) + if (tool.type === 'mcp' || tool.type === MCP_SERVER_ADVANCED_TOOL_TYPE) { + paths.push([...root, 'params', 'serverId']) + } if (tool.type === 'mcp') { - paths.push([...root, 'params', 'serverId'], [...root, 'params', 'toolName']) + paths.push([...root, 'params', 'toolName']) } if (tool.type === 'custom-tool' && !tool.customToolId) { paths.push([...root, 'title'], [...root, 'schema', 'function', 'name']) @@ -735,6 +765,7 @@ export class AgentBlockHandler implements BlockHandler { ) const mcpTools: IndexedToolInput[] = [] + const advancedMcpServers: IndexedToolInput[] = [] const otherTools: IndexedToolInput[] = [] const inputProvenance = new Map< ProviderToolConfig, @@ -767,9 +798,14 @@ export class AgentBlockHandler implements BlockHandler { return formattedTool } + assertValidMcpServerToolBindings(filtered.map(({ tool }) => tool)) for (const entry of filtered) { if (entry.tool.type === 'mcp') { mcpTools.push(entry) + } else if (entry.tool.type === MCP_SERVER_ADVANCED_TOOL_TYPE) { + const serverId = entry.tool.params?.serverId + if (typeof serverId === 'string' && !serverId.trim()) continue + advancedMcpServers.push(entry) } else { otherTools.push(entry) } @@ -820,8 +856,13 @@ export class AgentBlockHandler implements BlockHandler { trackInputProvenance, projectedToolInputs ) + const advancedMcpResults = await this.processAdvancedMcpServers( + ctx, + advancedMcpServers, + trackInputProvenance + ) - const allTools = [...otherResults, ...mcpResults] + const allTools = [...otherResults, ...mcpResults, ...advancedMcpResults] const tools = allTools.filter( (tool): tool is ProviderToolConfig => tool !== null && tool !== undefined ) @@ -880,7 +921,10 @@ export class AgentBlockHandler implements BlockHandler { // An MCP tool has no block, so its only structured keys are the ones its own // `paramsTransform` decodes. A custom tool has neither. const blockInputs = - tool.type && tool.type !== 'mcp' && tool.type !== 'custom-tool' + tool.type && + tool.type !== 'mcp' && + tool.type !== MCP_SERVER_ADVANCED_TOOL_TYPE && + tool.type !== 'custom-tool' ? getBlock(tool.type)?.inputs : undefined return prepareResolvedSecretProjectedInputs(alignedParams, blockInputs, formattedParams, { @@ -1145,6 +1189,37 @@ export class AgentBlockHandler implements BlockHandler { return results } + private async processAdvancedMcpServers( + ctx: ExecutionContext, + entries: IndexedToolInput[], + trackInputProvenance: ( + formattedTool: ProviderToolConfig | null, + entry: IndexedToolInput + ) => ProviderToolConfig | null + ): Promise> { + const results = await Promise.all( + entries.map(async (entry) => { + const serverId = entry.tool.params?.serverId + if (!serverId) throw new Error('MCP Server (Advanced) requires params.serverId') + const tools = await this.discoverMcpToolsForServer(ctx, serverId) + return Promise.all( + tools.map(async (tool) => { + const created = await this.buildMcpTool({ + serverId, + toolName: tool.name, + description: tool.description || `MCP tool ${tool.name} from ${tool.serverName}`, + schema: tool.inputSchema || { type: 'object', properties: {} }, + userProvidedParams: {}, + usageControl: entry.tool.usageControl, + }) + return trackInputProvenance(created, entry) + }) + ) + }) + ) + return results.flat() + } + /** * Create MCP tool from cached schema. No MCP server connection required. */ @@ -1296,9 +1371,6 @@ export class AgentBlockHandler implements BlockHandler { /** Discovers one server's tools through the authorized MCP operation. */ private async discoverMcpToolsForServer(ctx: ExecutionContext, serverId: string): Promise { - if (!ctx.userId) { - throw new Error('userId is required for MCP tool discovery') - } if (!ctx.workspaceId) { throw new Error('workspaceId is required for MCP tool discovery') } @@ -1344,7 +1416,7 @@ export class AgentBlockHandler implements BlockHandler { schema: McpToolSchema userProvidedParams: Record usageControl?: 'auto' | 'force' | 'none' - }) { + }): Promise { const filteredSchema = filterSchemaForLLM(config.schema, config.userProvidedParams) const toolId = createMcpToolId(config.serverId, config.toolName) @@ -1360,7 +1432,11 @@ export class AgentBlockHandler implements BlockHandler { return { id: toolId, description: config.description, - parameters: filteredSchema, + parameters: { + type: filteredSchema.type, + properties: filteredSchema.properties ?? {}, + required: filteredSchema.required ?? [], + }, params: config.userProvidedParams, usageControl: config.usageControl || 'auto', paramsTransform: (params: Record) => decodeToolParams(params, paramShapes), diff --git a/apps/sim/executor/handlers/agent/types.ts b/apps/sim/executor/handlers/agent/types.ts index 4c311b190dd..35f97a6cd29 100644 --- a/apps/sim/executor/handlers/agent/types.ts +++ b/apps/sim/executor/handlers/agent/types.ts @@ -51,6 +51,7 @@ export interface AgentInputs { * - Standard block types (e.g., 'api', 'search', 'function') * - 'custom-tool': User-defined tools with custom code * - 'mcp': Individual MCP tool from a connected server + * - 'mcp-server-advanced': All tools available to the executing subject from one MCP server */ export interface ToolInput { /** Tool type identifier */ diff --git a/apps/sim/executor/handlers/credential-group/credential-group-handler.test.ts b/apps/sim/executor/handlers/credential-group/credential-group-handler.test.ts index f1bdeaa44d5..02b2080019a 100644 --- a/apps/sim/executor/handlers/credential-group/credential-group-handler.test.ts +++ b/apps/sim/executor/handlers/credential-group/credential-group-handler.test.ts @@ -13,6 +13,7 @@ const mocks = vi.hoisted(() => ({ enforceInviteRateLimit: vi.fn(), listCredentials: vi.fn(), listGroups: vi.fn(), + listMcpConnections: vi.fn(), listPeople: vi.fn(), sendInvite: vi.fn(), })) @@ -29,6 +30,10 @@ vi.mock('@/lib/credential-groups/application/list-groups', () => ({ listCredentialGroupsForWorkflow: { execute: mocks.listGroups }, })) +vi.mock('@/lib/credential-groups/application/list-mcp-connections', () => ({ + listCredentialGroupMcpConnections: { execute: mocks.listMcpConnections }, +})) + vi.mock('@/lib/credential-groups/application/list-people', () => ({ CREDENTIAL_GROUP_PEOPLE_STATUSES: [ 'invited', @@ -201,6 +206,36 @@ describe('CredentialGroupBlockHandler', () => { }) }) + it('lists explicit MCP connection references for an advanced MCP tool', async () => { + mocks.listMcpConnections.mockResolvedValue({ + mcpConnections: [], + count: 0, + hasMore: false, + nextCursor: null, + }) + + const result = await new CredentialGroupBlockHandler().execute(context, block, { + operation: 'list_mcp_connections', + credentialGroupId: ' group-1 ', + email: ' person@example.com ', + mcpServerId: ' mcp-server-1 ', + limit: '25', + cursor: ' mcp-cg-connection-1 ', + }) + + expect(mocks.listMcpConnections).toHaveBeenCalledWith({ + principal, + input: { + credentialGroupId: 'group-1', + email: 'person@example.com', + mcpServerId: 'mcp-server-1', + limit: 25, + cursor: 'mcp-cg-connection-1', + }, + }) + expect(result).toEqual({ mcpConnections: [], count: 0, hasMore: false, nextCursor: null }) + }) + it('lists groups under workspace-scoped delegation', async () => { mocks.listGroups.mockResolvedValue({ credentialGroups: [], diff --git a/apps/sim/executor/handlers/credential-group/credential-group-handler.ts b/apps/sim/executor/handlers/credential-group/credential-group-handler.ts index 0bc0c24169a..44d90ea3bd5 100644 --- a/apps/sim/executor/handlers/credential-group/credential-group-handler.ts +++ b/apps/sim/executor/handlers/credential-group/credential-group-handler.ts @@ -3,6 +3,7 @@ import { CREDENTIAL_GROUP_DELEGATION_AUDIENCE } from '@/lib/credential-groups/ap import { createCredentialGroupInviteLink } from '@/lib/credential-groups/application/create-invite-link' import { listCredentialGroupCredentials } from '@/lib/credential-groups/application/list-credentials' import { listCredentialGroupsForWorkflow } from '@/lib/credential-groups/application/list-groups' +import { listCredentialGroupMcpConnections } from '@/lib/credential-groups/application/list-mcp-connections' import { CREDENTIAL_GROUP_PEOPLE_STATUSES, listCredentialGroupPeople, @@ -21,6 +22,7 @@ const logger = createLogger('CredentialGroupBlockHandler') const CREDENTIAL_GROUP_OPERATION_IDS = [ 'list_credentials', + 'list_mcp_connections', 'send_invite', 'get_invite_link', 'list_people', @@ -132,6 +134,24 @@ export class CredentialGroupBlockHandler implements BlockHandler { }) return result } + case 'list_mcp_connections': { + const result = await listCredentialGroupMcpConnections.execute({ + principal, + input: { + credentialGroupId: credentialGroupId!, + limit: parseLimit(inputs.limit), + cursor: parseOptionalString(inputs.cursor, 'Cursor'), + email: parseOptionalString(inputs.email, 'Email'), + mcpServerId: parseOptionalString(inputs.mcpServerId, 'MCP Server ID'), + }, + }) + logger.info('Listed Credential Group MCP connections', { + credentialGroupId, + count: result.count, + hasMore: result.hasMore, + }) + return result + } case 'send_invite': { await enforceCredentialGroupInvitationExecutionRateLimit(principal.workspaceId) const result = await sendCredentialGroupInvite.execute({ diff --git a/apps/sim/executor/handlers/mothership/mothership-handler.test.ts b/apps/sim/executor/handlers/mothership/mothership-handler.test.ts index d66264203fc..858bd02788d 100644 --- a/apps/sim/executor/handlers/mothership/mothership-handler.test.ts +++ b/apps/sim/executor/handlers/mothership/mothership-handler.test.ts @@ -33,6 +33,7 @@ const { mockAreModelSafeWorkspaceFileKeys, mockBuildAuthHeaders, mockBuildAPIUrl, + mockDiscoverMcpServerToolsAsExecutor, mockExtractAPIErrorMessage, mockGenerateId, mockReadUserFileContent, @@ -40,6 +41,7 @@ const { mockAreModelSafeWorkspaceFileKeys: vi.fn(), mockBuildAuthHeaders: vi.fn(), mockBuildAPIUrl: vi.fn(), + mockDiscoverMcpServerToolsAsExecutor: vi.fn(), mockExtractAPIErrorMessage: vi.fn(), mockGenerateId: vi.fn(), mockReadUserFileContent: vi.fn(), @@ -51,6 +53,10 @@ vi.mock('@/lib/uploads/contexts/workspace/workspace-file-secret-provenance', () 'File cannot be sent to a model because its secret provenance is unavailable', })) +vi.mock('@/lib/internal/mcp/discover-tools', () => ({ + discoverMcpServerToolsAsExecutor: mockDiscoverMcpServerToolsAsExecutor, +})) + vi.mock('@/executor/utils/http', () => ({ buildAuthHeaders: mockBuildAuthHeaders, buildAPIUrl: mockBuildAPIUrl, @@ -982,6 +988,67 @@ describe('MothershipBlockHandler', () => { expect(body.contexts).toEqual([{ kind: 'skill', skillId: 'skill-1', label: 'sales-playbook' }]) }) + it('expands an explicitly selected managed MCP connection for the request', async () => { + const credentialId = 'mcp-cg-123456789012345678901' + mockDiscoverMcpServerToolsAsExecutor.mockResolvedValueOnce([ + { + name: 'search_transcripts', + description: 'Search transcripts', + inputSchema: { type: 'object', properties: { query: { type: 'string' } } }, + serverId: credentialId, + serverName: 'Fireflies', + }, + ]) + fetchMock.mockResolvedValue(createJsonResponse({ content: 'done', toolCalls: [] })) + + await handler.execute(context, block, { + prompt: 'Search Fireflies', + tools: [ + { + type: 'mcp-server-advanced', + params: { serverId: credentialId }, + usageControl: 'force', + }, + ], + }) + + expect(mockDiscoverMcpServerToolsAsExecutor).toHaveBeenCalledWith( + expect.objectContaining({ serverId: credentialId, workspaceId: context.workspaceId }) + ) + const [, options] = fetchMock.mock.calls[0] as [string, RequestInit] + expect(JSON.parse(String(options.body)).mcpTools).toEqual([ + { + type: 'mcp', + usageControl: 'force', + schema: { type: 'object', properties: { query: { type: 'string' } } }, + params: { + serverId: credentialId, + toolName: 'search_transcripts', + serverName: 'Fireflies', + }, + }, + ]) + }) + + it('does not forward tools for a blank advanced MCP server binding', async () => { + fetchMock.mockResolvedValue(createJsonResponse({ content: 'done', toolCalls: [] })) + + await handler.execute(context, block, { + prompt: 'Continue without MCP tools', + tools: [ + { + type: 'mcp-server-advanced', + params: { serverId: '' }, + usageControl: 'auto', + }, + ], + }) + + expect(mockDiscoverMcpServerToolsAsExecutor).not.toHaveBeenCalled() + const [, options] = fetchMock.mock.calls[0] as [string, RequestInit] + expect(JSON.parse(String(options.body))).not.toHaveProperty('mcpTools') + }) + it('does not scan arbitrary Mothership metadata, attachment names, or payloads', async () => { const secret = 'boundary-secret' const registry = new ResolvedSecretTraceRegistry([ diff --git a/apps/sim/executor/handlers/mothership/mothership-handler.ts b/apps/sim/executor/handlers/mothership/mothership-handler.ts index e75a1814c41..0d758bfd1f4 100644 --- a/apps/sim/executor/handlers/mothership/mothership-handler.ts +++ b/apps/sim/executor/handlers/mothership/mothership-handler.ts @@ -20,6 +20,8 @@ import { RESOLVED_SECRET_PROVENANCE_FIELD, RESOLVED_SECRET_PROVENANCE_METADATA_V1, } from '@/lib/execution/private-tool-metadata' +import { discoverMcpServerToolsAsExecutor } from '@/lib/internal/mcp/discover-tools' +import { assertValidMcpServerToolBindings, MCP_SERVER_ADVANCED_TOOL_TYPE } from '@/lib/mcp/shared' import { areModelSafeWorkspaceFileKeys, MODEL_UNSAFE_WORKSPACE_FILE_ERROR_MESSAGE, @@ -144,6 +146,65 @@ function selectMothershipMcpTools(tools: unknown): MothershipMcpToolSelection[] return selectIndexedMothershipMcpTools(tools).map(({ selection }) => selection) } +async function expandMothershipMcpTools( + ctx: ExecutionContext, + tools: unknown +): Promise { + if (!Array.isArray(tools)) return [] + assertValidMcpServerToolBindings(tools) + const individual = selectMothershipMcpTools(tools) + const advanced: Array<{ serverId: string; usageControl: 'auto' | 'force' }> = tools.flatMap( + (candidate) => { + if (!isPlainRecord(candidate) || candidate.type !== MCP_SERVER_ADVANCED_TOOL_TYPE) return [] + if (candidate.usageControl === 'none') return [] + if (!isPlainRecord(candidate.params)) { + throw new Error('MCP Server (Advanced) requires params.serverId') + } + const serverId = candidate.params.serverId + if (typeof serverId !== 'string') { + throw new Error('MCP Server (Advanced) requires params.serverId') + } + if (!serverId.trim()) return [] + const usageControl: 'auto' | 'force' = candidate.usageControl === 'force' ? 'force' : 'auto' + return [{ serverId, usageControl }] + } + ) + if (advanced.length === 0) return individual + if (!ctx.workspaceId || !ctx.workflowId) { + throw new Error('Workspace and workflow context are required for MCP Server (Advanced)') + } + const workspaceId = ctx.workspaceId + const workflowId = ctx.workflowId + + const expanded = await Promise.all( + advanced.map(async ({ serverId, usageControl }) => { + const discovered = await discoverMcpServerToolsAsExecutor({ + workspaceId, + context: { + workflowId, + workspaceId, + executionId: ctx.executionId, + userId: ctx.userId, + executorDelegationOrigin: ctx.executorDelegationOrigin, + }, + serverId, + signal: ctx.abortSignal, + }) + return discovered.map((tool) => ({ + type: 'mcp' as const, + usageControl, + schema: tool.inputSchema, + params: { + serverId, + toolName: tool.name, + serverName: tool.serverName, + }, + })) + }) + ) + return [...individual, ...expanded.flat()] +} + function selectIndexedMothershipSkillContexts( skills: unknown, privateSelectorIndexes: ReadonlySet = new Set() @@ -288,6 +349,12 @@ function selectMothershipMetadataModelInputPaths( modelInputPaths.push([...root, 'params', 'serverName']) } } + if (Array.isArray(tools)) { + tools.forEach((candidate, inputIndex) => { + if (!isPlainRecord(candidate) || candidate.type !== MCP_SERVER_ADVANCED_TOOL_TYPE) return + structuralInputPaths.push(['tools', String(inputIndex), 'params', 'serverId']) + }) + } for (const { inputIndex, hasExplicitLabel } of selectIndexedMothershipSkillContexts(skills)) { const root = ['skills', String(inputIndex)] as const @@ -827,7 +894,7 @@ export class MothershipBlockHandler implements BlockHandler { secretScope: inputs.secretScope, mountedSecrets: inputs.mountedSecrets, }) - const mcpTools = selectMothershipMcpTools(modelInputProjection.value.tools) + const mcpTools = await expandMothershipMcpTools(ctx, modelInputProjection.value.tools) const skillContexts = selectMothershipSkillContexts( modelInputProjection.value.skills, privateSkillSelectors.inputIndexes diff --git a/apps/sim/executor/handlers/workflow/workflow-handler.test.ts b/apps/sim/executor/handlers/workflow/workflow-handler.test.ts index 2cd95e2c907..6b1d4283ef3 100644 --- a/apps/sim/executor/handlers/workflow/workflow-handler.test.ts +++ b/apps/sim/executor/handlers/workflow/workflow-handler.test.ts @@ -801,6 +801,7 @@ describe('WorkflowBlockHandler', () => { const ctx = { ...mockContext, userId: 'consumer-1', + principal: { kind: 'session', userId: 'consumer-1', sessionId: 'session-consumer' }, workspaceId: 'workspace-consumer', executionId: 'exec-1', } as ExecutionContext @@ -873,7 +874,11 @@ describe('WorkflowBlockHandler', () => { expect(executorOptions).toHaveLength(1) const startRunMetadata = executorOptions[0].contextExtensions.startRunMetadata expect(startRunMetadata).toMatchObject({ - userEmail: 'a@corp.com', + subject: { + kind: 'sim_user', + userId: 'consumer-1', + email: 'a@corp.com', + }, workspaceId: 'workspace-consumer', workflowId: 'parent-workflow-id', executionId: 'exec-1', @@ -891,7 +896,11 @@ describe('WorkflowBlockHandler', () => { metadata: { id: 'custom_block_abc', name: 'Published Block' }, } const inheritedMetadata = { - userEmail: 'original@corp.com', + subject: { + kind: 'sim_user' as const, + userId: 'original-user', + email: 'original@corp.com', + }, workspaceId: 'workspace-original', workflowId: 'workflow-original', executionId: 'exec-1', @@ -971,7 +980,11 @@ describe('WorkflowBlockHandler', () => { expect(executorOptions).toHaveLength(1) expect(executorOptions[0].contextExtensions.startRunMetadata).toMatchObject({ - userEmail: 'original@corp.com', + subject: { + kind: 'sim_user', + userId: 'original-user', + email: 'original@corp.com', + }, workspaceId: 'workspace-original', workflowId: 'workflow-original', executionMode: 'async', @@ -979,13 +992,13 @@ describe('WorkflowBlockHandler', () => { expect(mockGetUserEmailById).not.toHaveBeenCalled() }) - it('preserves a fail-soft null inherited email instead of re-resolving it', async () => { + it('preserves an actorless inherited subject instead of inventing an identity', async () => { const ctx = { ...mockContext, userId: 'publisher-1', workspaceId: 'workspace-parent', startRunMetadata: { - userEmail: null, + subject: null, workspaceId: 'workspace-original', workflowId: 'workflow-original', }, @@ -1025,13 +1038,16 @@ describe('WorkflowBlockHandler', () => { await handler.execute(ctx, mockBlock, inputs) expect(executorOptions).toHaveLength(1) - expect(executorOptions[0].contextExtensions.startRunMetadata.userEmail).toBeNull() + expect(executorOptions[0].contextExtensions.startRunMetadata.subject).toBeNull() expect(mockGetUserEmailById).not.toHaveBeenCalled() }) it('recovers inherited metadata from the seeded start-block state after resume', async () => { const seededMetadata = { - userEmail: 'original@corp.com', + subject: { + kind: 'authenticated_email' as const, + email: 'original@corp.com', + }, workspaceId: 'workspace-original', workflowId: 'workflow-original', executionMode: 'sync', @@ -1093,7 +1109,10 @@ describe('WorkflowBlockHandler', () => { expect(executorOptions).toHaveLength(1) expect(executorOptions[0].contextExtensions.startRunMetadata).toMatchObject({ - userEmail: 'original@corp.com', + subject: { + kind: 'authenticated_email', + email: 'original@corp.com', + }, workspaceId: 'workspace-original', workflowId: 'workflow-original', }) @@ -1102,7 +1121,10 @@ describe('WorkflowBlockHandler', () => { it('passes inherited metadata through a toggle-off child so deeper children keep it', async () => { const inheritedMetadata = { - userEmail: 'original@corp.com', + subject: { + kind: 'authenticated_email' as const, + email: 'original@corp.com', + }, workspaceId: 'workspace-original', workflowId: 'workflow-original', } diff --git a/apps/sim/executor/handlers/workflow/workflow-handler.ts b/apps/sim/executor/handlers/workflow/workflow-handler.ts index 8e44c7f25fb..3eb08c62779 100644 --- a/apps/sim/executor/handlers/workflow/workflow-handler.ts +++ b/apps/sim/executor/handlers/workflow/workflow-handler.ts @@ -13,7 +13,6 @@ import { LoggingSession } from '@/lib/logs/execution/logging-session' import { snapshotService } from '@/lib/logs/execution/snapshot/service' import { buildTraceSpans } from '@/lib/logs/execution/trace-spans/trace-spans' import type { TraceSpan } from '@/lib/logs/types' -import { getUserEmailById } from '@/lib/users/queries' import { admitCustomBlockChildExecution, buildCustomBlockCorrelation, @@ -21,6 +20,10 @@ import { trackChildRun, } from '@/lib/workflows/custom-blocks/child-execution' import { getCustomBlockAuthority } from '@/lib/workflows/custom-blocks/operations' +import { + resolveStartBlockRunIdentity, + type StartBlockRunIdentity, +} from '@/lib/workflows/executor/start-run-identity' import { extractInputFieldsFromBlocks } from '@/lib/workflows/input-format' import { scopeOutputBlockId, @@ -716,14 +719,21 @@ export class WorkflowBlockHandler implements BlockHandler { // When the parent run already carries trusted metadata, propagate ALL of // it so nested children see one consistent invoking identity (the // original consumer) instead of a mix of original and intermediate. - // Inherited email is taken verbatim — a fail-soft null must stay null, - // not be re-resolved to the intermediate (publisher) identity. + // New metadata carries the complete projected subject. Legacy snapshots + // without it are re-projected from the preserved execution principal. + let invokingIdentity: StartBlockRunIdentity + if (inherited && Object.hasOwn(inherited, 'subject')) { + invokingIdentity = { + subject: inherited.subject ?? null, + } + } else { + if (!ctx.principal) { + throw new Error('Execution principal is required for Start block run metadata') + } + invokingIdentity = await resolveStartBlockRunIdentity(ctx.principal) + } childStartRunMetadata = { - userEmail: inherited - ? (inherited.userEmail ?? null) - : ctx.userId - ? await getUserEmailById(ctx.userId) - : null, + ...invokingIdentity, workspaceId: inherited?.workspaceId ?? ctx.workspaceId ?? null, workflowId: inherited?.workflowId ?? ctx.workflowId ?? null, executionId: ctx.executionId, diff --git a/apps/sim/executor/types.ts b/apps/sim/executor/types.ts index d3e2fc366e0..36c7256967b 100644 --- a/apps/sim/executor/types.ts +++ b/apps/sim/executor/types.ts @@ -241,6 +241,17 @@ export type ExecutionControlOutputFieldName = (typeof EXECUTION_CONTROL_OUTPUT_F /** Start block output key that carries trusted, server-injected run metadata. */ export const START_BLOCK_METADATA_FIELD = 'metadata' +/** Authenticated human or provider subject safe to expose to workflow authors. */ +export type StartBlockRunSubject = + | { kind: 'sim_user'; userId: string; email: string } + | { kind: 'authenticated_email'; email: string } + | { + kind: 'external_user' + provider: string + tenantId: string + subjectId: string + } + /** * Trusted run metadata surfaced under `` when the Start * block's "Add run metadata" toggle is enabled. Built server-side from the @@ -251,7 +262,7 @@ export const START_BLOCK_METADATA_FIELD = 'metadata' * authoring-time-known identity. */ export interface StartBlockRunMetadata { - userEmail?: string | null + subject?: StartBlockRunSubject | null workspaceId?: string | null workflowId?: string | null executionId?: string diff --git a/apps/sim/executor/utils/start-block.test.ts b/apps/sim/executor/utils/start-block.test.ts index 41e4488177b..fdb3bdcd347 100644 --- a/apps/sim/executor/utils/start-block.test.ts +++ b/apps/sim/executor/utils/start-block.test.ts @@ -848,7 +848,11 @@ describe('start-block utilities', () => { describe('run metadata injection', () => { const runMetadata = { - userEmail: 'real@sim.ai', + subject: { + kind: 'sim_user' as const, + userId: 'user-1', + email: 'real@sim.ai', + }, workspaceId: 'ws-1', workflowId: 'wf-1', executionId: 'exec-1', @@ -872,7 +876,9 @@ describe('start-block utilities', () => { const output = buildStartBlockOutput({ resolution, workflowInput: { - metadata: { userEmail: 'attacker@x.com' }, + metadata: { + subject: { kind: 'authenticated_email', email: 'attacker@x.com' }, + }, simUserEmail: 'attacker@x.com', payload: 'value', }, @@ -889,7 +895,11 @@ describe('start-block utilities', () => { const output = buildStartBlockOutput({ resolution, - workflowInput: { metadata: { userEmail: 'attacker@x.com' } }, + workflowInput: { + metadata: { + subject: { kind: 'authenticated_email', email: 'attacker@x.com' }, + }, + }, }) expect(output).not.toHaveProperty('metadata') diff --git a/apps/sim/hooks/mcp/use-mcp-oauth-popup.test.tsx b/apps/sim/hooks/mcp/use-mcp-oauth-popup.test.tsx index d7720a3971c..ae76a1fde93 100644 --- a/apps/sim/hooks/mcp/use-mcp-oauth-popup.test.tsx +++ b/apps/sim/hooks/mcp/use-mcp-oauth-popup.test.tsx @@ -17,6 +17,7 @@ vi.mock('@/hooks/queries/mcp', () => ({ useStartMcpOauth: () => ({ mutateAsync: mockStartOauth }), mcpKeys: { serversList: (workspaceId: string) => ['mcp', 'servers', workspaceId], + managedCatalogList: (workspaceId: string) => ['mcp', 'managed-catalog', workspaceId], serverToolsList: (workspaceId: string, serverId: string) => [ 'mcp', 'server-tools', diff --git a/apps/sim/hooks/mcp/use-mcp-oauth-popup.ts b/apps/sim/hooks/mcp/use-mcp-oauth-popup.ts index d1e76921b48..ba5a82f04fd 100644 --- a/apps/sim/hooks/mcp/use-mcp-oauth-popup.ts +++ b/apps/sim/hooks/mcp/use-mcp-oauth-popup.ts @@ -88,6 +88,7 @@ export function useMcpOauthPopup({ workspaceId }: UseMcpOauthPopupProps) { const invalidateServer = useCallback( (serverId: string) => { queryClient.invalidateQueries({ queryKey: mcpKeys.serversList(workspaceId) }) + queryClient.invalidateQueries({ queryKey: mcpKeys.managedCatalogList(workspaceId) }) queryClient.invalidateQueries({ queryKey: mcpKeys.serverToolsList(workspaceId, serverId) }) queryClient.invalidateQueries({ queryKey: mcpKeys.storedToolsList(workspaceId) }) }, diff --git a/apps/sim/hooks/mcp/use-mcp-tools.ts b/apps/sim/hooks/mcp/use-mcp-tools.ts index a6e816b038b..cc5eb1d49b2 100644 --- a/apps/sim/hooks/mcp/use-mcp-tools.ts +++ b/apps/sim/hooks/mcp/use-mcp-tools.ts @@ -10,6 +10,7 @@ import { useCallback, useMemo } from 'react' import { createLogger } from '@sim/logger' import { useQueryClient } from '@tanstack/react-query' import { McpIcon } from '@/components/icons' +import { getManagedMcpConnectorIcon } from '@/lib/credential-groups/managed-mcp-connector-icons' import { createMcpToolId } from '@/lib/mcp/shared' import type { McpToolSchema } from '@/lib/mcp/types' import { mcpKeys, useMcpToolsQuery } from '@/hooks/queries/mcp' @@ -51,7 +52,7 @@ export function useMcpTools(workspaceId: string): UseMcpToolsResult { type: 'mcp' as const, inputSchema: tool.inputSchema, bgColor: '#6366F1', - icon: McpIcon, + icon: tool.managedConnectorId ? getManagedMcpConnectorIcon(tool.managedConnectorId) : McpIcon, })) }, [mcpToolsData]) diff --git a/apps/sim/hooks/queries/credential-groups.ts b/apps/sim/hooks/queries/credential-groups.ts index 868dc0156b9..c7a82929492 100644 --- a/apps/sim/hooks/queries/credential-groups.ts +++ b/apps/sim/hooks/queries/credential-groups.ts @@ -6,8 +6,10 @@ import type { ContractBodyInput } from '@/lib/api/contracts' import { type CredentialGroupAccessResponse, createCredentialGroupContract, + createCredentialGroupMcpConnectorContract, deleteCredentialGroupContract, deleteCredentialGroupEnrollmentContract, + deleteCredentialGroupMcpConnectorContract, getCredentialGroupAccessContract, getCredentialGroupContract, inviteCredentialGroupEnrollmentsContract, @@ -15,8 +17,10 @@ import { startSlackCredentialGroupConfigurationContract, updateCredentialGroupAccessContract, updateCredentialGroupContract, + updateCredentialGroupMcpConnectorContract, } from '@/lib/api/contracts/credential-groups' import type { ContractJsonResponse } from '@/lib/api/contracts/types' +import { mcpKeys } from '@/hooks/queries/mcp' import { CREDENTIAL_GROUP_ACCESS_STALE_TIME, CREDENTIAL_GROUP_DETAIL_STALE_TIME, @@ -145,6 +149,9 @@ export function useCreateCredentialGroup() { queryClient.invalidateQueries({ queryKey: credentialGroupKeys.list(variables.workspaceId), }), + queryClient.invalidateQueries({ + queryKey: mcpKeys.managedCatalogList(variables.workspaceId), + }), invalidateSelectorQueries(queryClient), ]), }) @@ -165,6 +172,9 @@ export function useDeleteCredentialGroup() { queryClient.invalidateQueries({ queryKey: credentialGroupKeys.list(variables.workspaceId), }), + queryClient.invalidateQueries({ + queryKey: mcpKeys.managedCatalogList(variables.workspaceId), + }), invalidateSelectorQueries(queryClient), ]) }, @@ -198,11 +208,92 @@ export function useUpdateCredentialGroup() { queryClient.invalidateQueries({ queryKey: credentialGroupKeys.detail(variables.workspaceId, variables.groupId), }), + queryClient.invalidateQueries({ + queryKey: mcpKeys.managedCatalogList(variables.workspaceId), + }), invalidateSelectorQueries(queryClient), ]), }) } +function invalidateManagedMcpConnectorQueries( + queryClient: ReturnType, + workspaceId: string, + groupId: string +) { + return Promise.all([ + queryClient.invalidateQueries({ queryKey: credentialGroupKeys.list(workspaceId) }), + queryClient.invalidateQueries({ queryKey: credentialGroupKeys.detail(workspaceId, groupId) }), + queryClient.invalidateQueries({ queryKey: mcpKeys.serversList(workspaceId) }), + queryClient.invalidateQueries({ queryKey: mcpKeys.managedCatalogList(workspaceId) }), + invalidateSelectorQueries(queryClient), + ]) +} + +export function useCreateCredentialGroupMcpConnector() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: async ({ + workspaceId, + groupId, + body, + }: { + workspaceId: string + groupId: string + body: ContractBodyInput + }) => + requestJson(createCredentialGroupMcpConnectorContract, { + params: { id: workspaceId, groupId }, + body, + }), + onSettled: (_data, _error, variables) => + invalidateManagedMcpConnectorQueries(queryClient, variables.workspaceId, variables.groupId), + }) +} + +export function useUpdateCredentialGroupMcpConnector() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: async ({ + workspaceId, + groupId, + connectorId, + body, + }: { + workspaceId: string + groupId: string + connectorId: 'fireflies' | 'granola' | 'databricks' + body: ContractBodyInput + }) => + requestJson(updateCredentialGroupMcpConnectorContract, { + params: { id: workspaceId, groupId, connectorId }, + body, + }), + onSettled: (_data, _error, variables) => + invalidateManagedMcpConnectorQueries(queryClient, variables.workspaceId, variables.groupId), + }) +} + +export function useDeleteCredentialGroupMcpConnector() { + const queryClient = useQueryClient() + return useMutation({ + mutationFn: async ({ + workspaceId, + groupId, + connectorId, + }: { + workspaceId: string + groupId: string + connectorId: 'fireflies' | 'granola' | 'databricks' + }) => + requestJson(deleteCredentialGroupMcpConnectorContract, { + params: { id: workspaceId, groupId, connectorId }, + }), + onSettled: (_data, _error, variables) => + invalidateManagedMcpConnectorQueries(queryClient, variables.workspaceId, variables.groupId), + }) +} + export function useStartSlackCredentialGroupConfiguration() { return useMutation({ mutationFn: async ({ @@ -242,6 +333,9 @@ export function useInviteCredentialGroupEnrollments() { queryClient.invalidateQueries({ queryKey: credentialGroupKeys.detail(variables.workspaceId, variables.groupId), }), + queryClient.invalidateQueries({ + queryKey: mcpKeys.managedCatalogList(variables.workspaceId), + }), invalidateSelectorQueries(queryClient), ]), }) @@ -267,6 +361,9 @@ export function useResendCredentialGroupEnrollment() { queryClient.invalidateQueries({ queryKey: credentialGroupKeys.detail(variables.workspaceId, variables.groupId), }), + queryClient.invalidateQueries({ + queryKey: mcpKeys.managedCatalogList(variables.workspaceId), + }), invalidateSelectorQueries(queryClient), ]), }) @@ -292,6 +389,9 @@ export function useDeleteCredentialGroupEnrollment() { queryClient.invalidateQueries({ queryKey: credentialGroupKeys.detail(variables.workspaceId, variables.groupId), }), + queryClient.invalidateQueries({ + queryKey: mcpKeys.managedCatalogList(variables.workspaceId), + }), invalidateSelectorQueries(queryClient), ]), }) diff --git a/apps/sim/hooks/queries/mcp.test.tsx b/apps/sim/hooks/queries/mcp.test.tsx index 638172515eb..a3972024483 100644 --- a/apps/sim/hooks/queries/mcp.test.tsx +++ b/apps/sim/hooks/queries/mcp.test.tsx @@ -18,6 +18,7 @@ vi.mock('@/lib/api/client/request', () => ({ import { discoverMcpToolsContract, getAllowedMcpDomainsContract, + listManagedMcpCatalogContract, listMcpServersContract, listStoredMcpToolsContract, type McpServer, @@ -103,6 +104,7 @@ function mockServers(servers: McpServer[]) { if (contract === discoverMcpToolsContract) { return { success: true, data: { tools: [], totalCount: 0, byServer: {} } } } + if (contract === listManagedMcpCatalogContract) return { servers: [], tools: [] } throw new Error('Unexpected MCP request') }) } @@ -141,7 +143,7 @@ describe('useMcpToolsQuery', () => { const { unmount } = renderHookWithClient(() => useMcpToolsQuery(WORKSPACE_ID)) await flush() - expect(mockRequestJson).toHaveBeenCalledTimes(1) + expect(mockRequestJson).toHaveBeenCalledTimes(2) expect(mockRequestJson).toHaveBeenCalledWith( listMcpServersContract, expect.objectContaining({ query: { workspaceId: WORKSPACE_ID } }) @@ -150,6 +152,65 @@ describe('useMcpToolsQuery', () => { unmount() }) + it('includes managed Credential Group connection snapshots without upstream discovery', async () => { + const managedServer = server('mcp-cg-123456789012345678901', { + name: 'Fireflies — alex@example.com', + authType: 'oauth', + url: undefined, + }) + mockRequestJson.mockImplementation(async (contract) => { + if (contract === listMcpServersContract) { + return { success: true, data: { servers: [] } } + } + if (contract === listManagedMcpCatalogContract) { + return { + servers: [managedServer], + tools: [ + { + name: 'search_transcripts', + description: 'Search transcripts', + inputSchema: { type: 'object', properties: {} }, + serverId: managedServer.id, + serverName: managedServer.name, + }, + ], + } + } + throw new Error('Managed MCP snapshots must not trigger discovery') + }) + + const hook = renderHookWithClient(() => useMcpToolsQuery(WORKSPACE_ID)) + await flush() + + expect(hook.getResult().data).toEqual([ + expect.objectContaining({ + name: 'search_transcripts', + serverId: managedServer.id, + }), + ]) + expect(mockRequestJson).toHaveBeenCalledTimes(2) + + hook.unmount() + }) + + it('surfaces a shared server-list failure when the managed catalog is empty', async () => { + const serverListError = new Error('server list failed') + mockRequestJson.mockImplementation(async (contract) => { + if (contract === listMcpServersContract) throw serverListError + if (contract === listManagedMcpCatalogContract) return { servers: [], tools: [] } + throw new Error('Unexpected MCP request') + }) + + const hook = renderHookWithClient(() => useMcpToolsQuery(WORKSPACE_ID)) + await flush() + + expect(hook.getResult().data).toEqual([]) + expect(hook.getResult().error).toBe(serverListError) + expect(hook.getResult().isLoading).toBe(false) + + hook.unmount() + }) + it('defers detail and form metadata queries while their surfaces are closed', async () => { mockRequestJson.mockImplementation(async (contract) => { if (contract === listStoredMcpToolsContract || contract === getAllowedMcpDomainsContract) { diff --git a/apps/sim/hooks/queries/mcp.ts b/apps/sim/hooks/queries/mcp.ts index e3134e3f8d2..78b22793780 100644 --- a/apps/sim/hooks/queries/mcp.ts +++ b/apps/sim/hooks/queries/mcp.ts @@ -16,8 +16,10 @@ import { deleteMcpServerContract, discoverMcpToolsContract, getAllowedMcpDomainsContract, + listManagedMcpCatalogContract, listMcpServersContract, listStoredMcpToolsContract, + type ManagedMcpCatalog, type McpServer, type McpServerTestBody, type McpServerTestResult, @@ -52,6 +54,9 @@ export const mcpKeys = { all: ['mcp'] as const, servers: () => [...mcpKeys.all, 'servers'] as const, serversList: (workspaceId?: string) => [...mcpKeys.servers(), workspaceId ?? ''] as const, + managedCatalog: () => [...mcpKeys.all, 'managedCatalog'] as const, + managedCatalogList: (workspaceId?: string) => + [...mcpKeys.managedCatalog(), workspaceId ?? ''] as const, serverTools: () => [...mcpKeys.all, 'serverTools'] as const, serverToolsWorkspace: (workspaceId?: string) => [...mcpKeys.serverTools(), workspaceId ?? ''] as const, @@ -114,6 +119,42 @@ export function useMcpServers(workspaceId: string) { }) } +async function fetchManagedMcpCatalog( + workspaceId: string, + signal?: AbortSignal +): Promise { + return requestJson(listManagedMcpCatalogContract, { + query: { workspaceId }, + signal, + }) +} + +export function useManagedMcpCatalog(workspaceId: string) { + return useQuery({ + queryKey: mcpKeys.managedCatalogList(workspaceId), + queryFn: ({ signal }) => fetchManagedMcpCatalog(workspaceId, signal), + enabled: Boolean(workspaceId), + retry: false, + staleTime: MCP_SERVER_LIST_STALE_TIME, + }) +} + +export function useMcpToolServers(workspaceId: string) { + const shared = useMcpServers(workspaceId) + const managed = useManagedMcpCatalog(workspaceId) + return useMemo( + () => ({ + data: [ + ...(shared.data ?? []).filter((server) => !server.credentialGroupId), + ...(managed.data?.servers ?? []), + ], + isLoading: shared.isLoading || managed.isLoading, + error: shared.error ?? managed.error, + }), + [shared.data, shared.error, shared.isLoading, managed.data, managed.error, managed.isLoading] + ) +} + async function fetchMcpTools( workspaceId: string, forceRefresh = false, @@ -142,6 +183,7 @@ function isServerEligibleForDiscovery(server: McpServer, workspaceId: string): b return ( server.enabled && server.workspaceId === workspaceId && + !server.credentialGroupId && (server.authType !== 'oauth' || server.connectionStatus === 'connected') ) } @@ -152,7 +194,12 @@ function isServerEligibleForDiscovery(server: McpServer, workspaceId: string): b */ export function useMcpToolsQuery(workspaceId: string) { const queryClient = useQueryClient() - const { data: servers, isLoading: serversLoading } = useMcpServers(workspaceId) + const { + data: servers, + isLoading: serversLoading, + error: serversError, + } = useMcpServers(workspaceId) + const managedCatalog = useManagedMcpCatalog(workspaceId) // Push is intrinsic to consuming the tools query: every surface that reads tools (settings, // tool picker, dynamic args, tool selector, canvas block) gets real-time `list_changed` // refresh via the shared, reference-counted subscription — so the 5-min stale time is always @@ -196,11 +243,21 @@ export function useMcpToolsQuery(workspaceId: string) { }) return useMemo(() => { - const tools: McpTool[] = [] - let hasData = false + const tools: McpTool[] = [...(managedCatalog.data?.tools ?? [])] + let hasData = Boolean(managedCatalog.data?.tools.length) let anyServerLoading = false - let firstError: Error | null = null - const statusById = new Map(servers?.map((s) => [s.id, s.connectionStatus])) + let firstError: Error | null = + managedCatalog.error instanceof Error + ? managedCatalog.error + : serversError instanceof Error + ? serversError + : null + const statusById = new Map( + [...(servers ?? []), ...(managedCatalog.data?.servers ?? [])].map((server) => [ + server.id, + server.connectionStatus, + ]) + ) const toolsStateByServer = new Map< string, { isLoading: boolean; isFetching: boolean; error: Error | null } @@ -231,13 +288,13 @@ export function useMcpToolsQuery(workspaceId: string) { } return { data: tools, - isLoading: (serversLoading || anyServerLoading) && !hasData, - isFetching: serversLoading || results.some((r) => r.isFetching), + isLoading: (serversLoading || managedCatalog.isLoading || anyServerLoading) && !hasData, + isFetching: serversLoading || managedCatalog.isFetching || results.some((r) => r.isFetching), // Suppress when any healthy server rendered; per-server errors live in `toolsStateByServer`. error: hasData ? null : firstError, toolsStateByServer, } - }, [results, serversLoading, serverIds, servers]) + }, [results, serversLoading, serversError, serverIds, servers, managedCatalog]) } export function useForceRefreshMcpTools() { @@ -273,6 +330,7 @@ export function useForceRefreshMcpTools() { }, onSettled: (_data, _error, workspaceId) => { queryClient.invalidateQueries({ queryKey: mcpKeys.serversList(workspaceId) }) + queryClient.invalidateQueries({ queryKey: mcpKeys.managedCatalogList(workspaceId) }) queryClient.invalidateQueries({ queryKey: mcpKeys.storedToolsList(workspaceId) }) }, }) @@ -576,6 +634,7 @@ export function useMcpToolsEvents(workspaceId: string) { queryClient.invalidateQueries({ queryKey: mcpKeys.serverToolsWorkspace(workspaceId) }) } queryClient.invalidateQueries({ queryKey: mcpKeys.serversList(workspaceId) }) + queryClient.invalidateQueries({ queryKey: mcpKeys.managedCatalogList(workspaceId) }) queryClient.invalidateQueries({ queryKey: mcpKeys.storedToolsList(workspaceId) }) queryClient.invalidateQueries({ queryKey: workflowMcpServerKeys.all }) } diff --git a/apps/sim/hooks/queries/workflow-search-replace.ts b/apps/sim/hooks/queries/workflow-search-replace.ts index 0335a8a8563..4f837b3117d 100644 --- a/apps/sim/hooks/queries/workflow-search-replace.ts +++ b/apps/sim/hooks/queries/workflow-search-replace.ts @@ -6,6 +6,7 @@ import { type DiscoverMcpToolsResponse, discoverMcpToolsContract, type ListMcpServersResponse, + listManagedMcpCatalogContract, listMcpServersContract, } from '@/lib/api/contracts/mcp' import { @@ -400,11 +401,19 @@ export function useWorkflowSearchMcpServerDetails( const serversQuery = useQuery({ queryKey: workflowSearchReplaceKeys.mcpServerListDetails(workspaceId), - queryFn: ({ signal }: { signal: AbortSignal }) => - requestJson(listMcpServersContract, { - query: { workspaceId: workspaceId as string }, - signal, - }), + queryFn: async ({ signal }: { signal: AbortSignal }) => { + const [shared, managed] = await Promise.all([ + requestJson(listMcpServersContract, { + query: { workspaceId: workspaceId as string }, + signal, + }), + requestJson(listManagedMcpCatalogContract, { + query: { workspaceId: workspaceId as string }, + signal, + }), + ]) + return [...shared.data.servers, ...managed.servers] + }, enabled: Boolean(workspaceId && serverMatches.length > 0), staleTime: WORKFLOW_SEARCH_MCP_SERVER_LIST_STALE_TIME, }) @@ -412,7 +421,7 @@ export function useWorkflowSearchMcpServerDetails( return useMemo( () => serverMatches.map((match) => { - const server = serversQuery.data?.data.servers.find((item) => item.id === match.rawValue) + const server = serversQuery.data?.find((item) => item.id === match.rawValue) return { data: serversQuery.data ? { @@ -437,11 +446,19 @@ export function useWorkflowSearchMcpToolDetails( const toolsQuery = useQuery({ queryKey: workflowSearchReplaceKeys.mcpToolListDetails(workspaceId), - queryFn: ({ signal }: { signal: AbortSignal }) => - requestJson(discoverMcpToolsContract, { - query: { workspaceId: workspaceId as string }, - signal, - }), + queryFn: async ({ signal }: { signal: AbortSignal }) => { + const [shared, managed] = await Promise.all([ + requestJson(discoverMcpToolsContract, { + query: { workspaceId: workspaceId as string }, + signal, + }), + requestJson(listManagedMcpCatalogContract, { + query: { workspaceId: workspaceId as string }, + signal, + }), + ]) + return [...shared.data.tools, ...managed.tools] + }, enabled: Boolean(workspaceId && toolMatches.length > 0), staleTime: WORKFLOW_SEARCH_MCP_TOOL_LIST_STALE_TIME, }) @@ -449,7 +466,7 @@ export function useWorkflowSearchMcpToolDetails( return useMemo( () => toolMatches.map((match) => { - const tool = toolsQuery.data?.data.tools.find( + const tool = toolsQuery.data?.find( (item) => createMcpToolId(item.serverId, item.name) === match.rawValue ) return { @@ -706,16 +723,30 @@ export function useWorkflowSearchMcpServerReplacementOptions( queries: [ { queryKey: workflowSearchReplaceKeys.mcpServerReplacementOptions(workspaceId), - queryFn: ({ signal }: { signal: AbortSignal }) => - requestJson(listMcpServersContract, { - query: { workspaceId: workspaceId as string }, - signal, - }), + queryFn: async ({ + signal, + }: { + signal: AbortSignal + }): Promise => { + const [shared, managed] = await Promise.all([ + requestJson(listMcpServersContract, { + query: { workspaceId: workspaceId as string }, + signal, + }), + requestJson(listManagedMcpCatalogContract, { + query: { workspaceId: workspaceId as string }, + signal, + }), + ]) + return [...shared.data.servers, ...managed.servers] + }, enabled: Boolean(workspaceId && serverGroups.length > 0), staleTime: WORKFLOW_SEARCH_MCP_SERVER_REPLACEMENT_STALE_TIME, - select: (response: ListMcpServersResponse): WorkflowSearchReplacementOption[] => + select: ( + servers: ListMcpServersResponse['data']['servers'] + ): WorkflowSearchReplacementOption[] => serverGroups.flatMap((match) => - response.data.servers.map((server) => ({ + servers.map((server) => ({ kind: 'mcp-server', value: server.id, label: server.name, @@ -754,15 +785,29 @@ export function useWorkflowSearchMcpToolReplacementOptions( queries: [ { queryKey: workflowSearchReplaceKeys.mcpToolReplacementOptions(workspaceId), - queryFn: ({ signal }: { signal: AbortSignal }) => - requestJson(discoverMcpToolsContract, { - query: { workspaceId: workspaceId as string }, - signal, - }), + queryFn: async ({ + signal, + }: { + signal: AbortSignal + }): Promise => { + const [shared, managed] = await Promise.all([ + requestJson(discoverMcpToolsContract, { + query: { workspaceId: workspaceId as string }, + signal, + }), + requestJson(listManagedMcpCatalogContract, { + query: { workspaceId: workspaceId as string }, + signal, + }), + ]) + return [...shared.data.tools, ...managed.tools] + }, enabled: Boolean(workspaceId && toolGroups.length > 0), staleTime: WORKFLOW_SEARCH_MCP_TOOL_REPLACEMENT_STALE_TIME, - select: (response: DiscoverMcpToolsResponse): WorkflowSearchReplacementOption[] => - buildWorkflowSearchMcpToolReplacementOptions(toolGroups, response.data.tools), + select: ( + tools: DiscoverMcpToolsResponse['data']['tools'] + ): WorkflowSearchReplacementOption[] => + buildWorkflowSearchMcpToolReplacementOptions(toolGroups, tools), }, ], }) diff --git a/apps/sim/hooks/use-desktop-update-state.test.tsx b/apps/sim/hooks/use-desktop-update-state.test.tsx new file mode 100644 index 00000000000..0d67de0d5b2 --- /dev/null +++ b/apps/sim/hooks/use-desktop-update-state.test.tsx @@ -0,0 +1,90 @@ +/** + * @vitest-environment jsdom + */ + +import { act } from 'react' +import type { DesktopUpdateState } from '@sim/desktop-bridge' +import { createRoot, type Root } from 'react-dom/client' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +const desktopMocks = vi.hoisted(() => ({ + getState: vi.fn(), + onState: vi.fn(), + unsubscribe: vi.fn(), + listener: null as ((state: DesktopUpdateState) => void) | null, +})) + +vi.mock('@/lib/desktop', () => ({ + getDesktopUpdates: () => ({ + getState: desktopMocks.getState, + onState: desktopMocks.onState, + }), +})) + +import { useDesktopUpdateState } from '@/hooks/use-desktop-update-state' + +let container: HTMLDivElement +let root: Root +let currentState: DesktopUpdateState + +function Harness() { + currentState = useDesktopUpdateState() + return null +} + +describe('useDesktopUpdateState', () => { + beforeEach(() => { + vi.clearAllMocks() + desktopMocks.listener = null + desktopMocks.onState.mockImplementation((listener) => { + desktopMocks.listener = listener + return desktopMocks.unsubscribe + }) + ;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true + container = document.createElement('div') + document.body.appendChild(container) + root = createRoot(container) + }) + + afterEach(() => { + if (container.isConnected) { + act(() => root.unmount()) + container.remove() + } + }) + + it('does not let a stale snapshot replace a newer state event', async () => { + let resolveSnapshot: (state: DesktopUpdateState) => void = () => { + throw new Error('Update-state snapshot did not initialize') + } + desktopMocks.getState.mockReturnValue( + new Promise((resolve) => { + resolveSnapshot = resolve + }) + ) + await act(async () => root.render()) + + act(() => desktopMocks.listener?.({ status: 'ready', version: '2.0.0' })) + await act(async () => resolveSnapshot({ status: 'checking' })) + + expect(currentState).toEqual({ status: 'ready', version: '2.0.0' }) + }) + + it('unsubscribes and ignores a snapshot after unmount', async () => { + let resolveSnapshot: (state: DesktopUpdateState) => void = () => { + throw new Error('Update-state snapshot did not initialize') + } + desktopMocks.getState.mockReturnValue( + new Promise((resolve) => { + resolveSnapshot = resolve + }) + ) + await act(async () => root.render()) + act(() => root.unmount()) + container.remove() + + await act(async () => resolveSnapshot({ status: 'ready', version: '2.0.0' })) + + expect(desktopMocks.unsubscribe).toHaveBeenCalledTimes(1) + }) +}) diff --git a/apps/sim/hooks/use-desktop-update-state.ts b/apps/sim/hooks/use-desktop-update-state.ts new file mode 100644 index 00000000000..32ccb904f1a --- /dev/null +++ b/apps/sim/hooks/use-desktop-update-state.ts @@ -0,0 +1,37 @@ +'use client' + +import { useEffect, useState } from 'react' +import type { DesktopUpdateState } from '@sim/desktop-bridge' +import { getDesktopUpdates } from '@/lib/desktop' + +const INITIAL_UPDATE_STATE: DesktopUpdateState = { status: 'idle' } + +export function useDesktopUpdateState(): DesktopUpdateState { + const [state, setState] = useState(INITIAL_UPDATE_STATE) + + useEffect(() => { + const updates = getDesktopUpdates() + if (!updates) return + + let active = true + let eventReceived = false + const unsubscribe = updates.onState((next) => { + if (!active) return + eventReceived = true + setState(next) + }) + void updates + .getState() + .then((next) => { + if (active && !eventReceived) setState(next) + }) + .catch(() => {}) + + return () => { + active = false + unsubscribe() + } + }, []) + + return state +} diff --git a/apps/sim/hooks/use-execution-stream.ts b/apps/sim/hooks/use-execution-stream.ts index fb156950e88..b4bcc38d3b4 100644 --- a/apps/sim/hooks/use-execution-stream.ts +++ b/apps/sim/hooks/use-execution-stream.ts @@ -1,6 +1,7 @@ import { useCallback } from 'react' import { createLogger } from '@sim/logger' import { getErrorMessage } from '@sim/utils/errors' +import { isRecordLike } from '@sim/utils/object' import type { WorkflowStateContractInput } from '@/lib/api/contracts/workflows' import { readSSEEvents } from '@/lib/core/utils/sse' import type { @@ -67,18 +68,58 @@ export class SSEStreamInterruptedError extends Error { * Detects errors caused by the browser killing a fetch (page refresh, navigation, tab close). * These should be treated as clean disconnects, not execution errors. */ -function isClientDisconnectError(error: any): boolean { - return error.name === 'AbortError' +function isClientDisconnectError(error: unknown): boolean { + return isRecordLike(error) && error.name === 'AbortError' } -function isRecoverableStreamError(error: any): boolean { - if (isClientDisconnectError(error)) return false - const msg = (error.message ?? '').toLowerCase() +/** + * Messages browsers put on the TypeError a fetch or body read rejects with when + * the connection drops: Chrome's "network error" and "Failed to fetch", + * Firefox's "NetworkError when attempting to fetch resource.", and Safari's + * "Load failed". + */ +const TRANSPORT_FAILURE_MESSAGE_PATTERNS = [ + /network\s?error/, + /failed to fetch/, + /load failed/, +] as const + +/** + * Errors the stream layer raises itself carry their own meaning (an HTTP + * rejection, a handler failure, an already classified drop), so their message + * text must never be mistaken for a transport failure. + */ +function isStreamLayerError(error: unknown): boolean { return ( - msg.includes('network error') || msg.includes('failed to fetch') || msg.includes('load failed') + error instanceof ExecutionStreamHttpError || + error instanceof SSEEventHandlerError || + error instanceof SSEStreamInterruptedError ) } +function isRecoverableStreamError(error: unknown): boolean { + if (!isRecordLike(error) || isClientDisconnectError(error) || isStreamLayerError(error)) { + return false + } + const msg = typeof error.message === 'string' ? error.message.toLowerCase() : '' + return TRANSPORT_FAILURE_MESSAGE_PATTERNS.some((pattern) => pattern.test(msg)) +} + +/** + * Wraps a transport failure that cut a live execution stream before its + * terminal event, so every consumer of a live stream classifies interruptions + * the same way and recovery code can rely on one error type. Returns null for + * client aborts and for anything that is not a transport failure. + */ +export function toStreamInterruptedError( + error: unknown, + executionId: string | undefined, + message: string +): SSEStreamInterruptedError | null { + if (!isRecoverableStreamError(error)) return null + return new SSEStreamInterruptedError(message, executionId, error) +} + /** * Processes SSE events from a response body and invokes appropriate callbacks. * Exported for use by standalone (non-hook) execution paths like executeWorkflowWithFullLogging. @@ -318,16 +359,17 @@ export function useExecutionStream() { logger.info('Execution stream disconnected (page unload or abort)') return } - if (isRecoverableStreamError(error)) { + const interrupted = toStreamInterruptedError( + error, + serverExecutionId, + 'Execution stream interrupted before a terminal event was received' + ) + if (interrupted) { logger.warn('Execution stream interrupted; preserving execution for reconnect', { executionId: serverExecutionId, error: error.message, }) - throw new SSEStreamInterruptedError( - 'Execution stream interrupted before a terminal event was received', - serverExecutionId, - error - ) + throw interrupted } logger.error('Execution stream error:', error) if (!(error instanceof SSEEventHandlerError)) { @@ -423,16 +465,17 @@ export function useExecutionStream() { logger.info('Run-from-block stream disconnected (page unload or abort)') return } - if (isRecoverableStreamError(error)) { + const interrupted = toStreamInterruptedError( + error, + serverExecutionId, + 'Run-from-block stream interrupted before a terminal event was received' + ) + if (interrupted) { logger.warn('Run-from-block stream interrupted; preserving execution for reconnect', { executionId: serverExecutionId, error: error.message, }) - throw new SSEStreamInterruptedError( - 'Run-from-block stream interrupted before a terminal event was received', - serverExecutionId, - error - ) + throw interrupted } logger.error('Run-from-block execution error:', error) if (!(error instanceof SSEEventHandlerError)) { diff --git a/apps/sim/lib/api/contracts/credential-groups.test.ts b/apps/sim/lib/api/contracts/credential-groups.test.ts index 5f7edf584e3..7ca0cd7b232 100644 --- a/apps/sim/lib/api/contracts/credential-groups.test.ts +++ b/apps/sim/lib/api/contracts/credential-groups.test.ts @@ -14,7 +14,7 @@ import { import { CREDENTIAL_GROUP_WORKFLOW_ACCESS_LIMIT, CREDENTIAL_GROUP_WORKFLOW_CATALOG_LIMIT, -} from '@/lib/credential-groups/workflow-access-limits' +} from '@/lib/credential-groups/limits' describe('credential group contracts', () => { it('describes the shared managed OAuth callback as a redirect', () => { @@ -204,9 +204,13 @@ describe('credential group contracts', () => { createdAt: '2026-08-11T12:00:00.000Z', updatedAt: '2026-08-11T12:05:00.000Z', connections: [{ provider: 'gmail', status: 'active', count: 2 }], + mcpConnections: [{ mcpServerId: 'mcp-server-1', name: 'Fireflies', status: 'active' }], }) expect(result.connections).toEqual([{ provider: 'gmail', status: 'active', count: 2 }]) + expect(result.mcpConnections).toEqual([ + { mcpServerId: 'mcp-server-1', name: 'Fireflies', status: 'active' }, + ]) }) it('accepts a bounded unique workflow access selection', () => { diff --git a/apps/sim/lib/api/contracts/credential-groups.ts b/apps/sim/lib/api/contracts/credential-groups.ts index 94fba1f1e92..b96b71c8afd 100644 --- a/apps/sim/lib/api/contracts/credential-groups.ts +++ b/apps/sim/lib/api/contracts/credential-groups.ts @@ -2,14 +2,16 @@ import { z } from 'zod' import { workflowIdSchema, workspaceIdSchema } from '@/lib/api/contracts/primitives' import { defineRouteContract } from '@/lib/api/contracts/types' import { - CREDENTIAL_GROUP_PROVIDER_IDS, - CREDENTIAL_GROUP_STANDARD_OAUTH_PROVIDER_IDS, -} from '@/lib/credential-groups/providers' -import { + CREDENTIAL_GROUP_MCP_SERVER_LIMIT, CREDENTIAL_GROUP_WORKFLOW_ACCESS_LIMIT, CREDENTIAL_GROUP_WORKFLOW_CATALOG_LIMIT, CREDENTIAL_GROUP_WORKFLOW_NAME_MAX_LENGTH, -} from '@/lib/credential-groups/workflow-access-limits' +} from '@/lib/credential-groups/limits' +import { MANAGED_MCP_CONNECTOR_IDS } from '@/lib/credential-groups/managed-mcp-connectors' +import { + CREDENTIAL_GROUP_PROVIDER_IDS, + CREDENTIAL_GROUP_STANDARD_OAUTH_PROVIDER_IDS, +} from '@/lib/credential-groups/providers' export const credentialGroupProviderSchema = z.enum(CREDENTIAL_GROUP_PROVIDER_IDS) export const credentialGroupStatusSchema = z.enum(['active', 'disabled']) @@ -25,6 +27,7 @@ export const credentialGroupOptionConfigurationStatusSchema = z.enum([ 'ready', 'needs_update', ]) +export const managedMcpConnectorIdSchema = z.enum(MANAGED_MCP_CONNECTOR_IDS) const credentialGroupOptionFields = { label: z.string().trim().min(1, 'Option label is required').max(100), @@ -71,12 +74,22 @@ export const credentialGroupOptionUpdateInputSchema = z.discriminatedUnion('prov slackCredentialGroupOptionInputSchema.extend({ id: z.string().min(1).max(128).optional() }), ]) +export const credentialGroupMcpServerSchema = z.object({ + id: z.string().min(1).max(128), + name: z.string().min(1), + description: z.string().nullable(), + authType: z.string().min(1), + enabled: z.boolean(), + managedConnectorId: managedMcpConnectorIdSchema, +}) + export const credentialGroupSchema = z.object({ id: z.string(), workspaceId: z.string(), name: z.string(), description: z.string().nullable(), options: z.array(credentialGroupOptionSchema).max(CREDENTIAL_GROUP_PROVIDER_IDS.length), + mcpServers: z.array(credentialGroupMcpServerSchema).max(CREDENTIAL_GROUP_MCP_SERVER_LIMIT), status: credentialGroupStatusSchema, createdAt: z.string(), updatedAt: z.string(), @@ -85,6 +98,7 @@ export const credentialGroupSchema = z.object({ export type CredentialGroup = z.output export type CredentialGroupOption = z.output export type CredentialGroupOptionInput = z.input +export type CredentialGroupMcpServer = z.output export const credentialGroupEnrollmentSchema = z.object({ id: z.string(), @@ -109,15 +123,27 @@ export const credentialGroupEnrollmentConnectionSchema = z.object({ count: z.number().int().positive(), }) +export const credentialGroupEnrollmentMcpConnectionSchema = z.object({ + mcpServerId: z.string().min(1).max(128), + name: z.string().min(1).max(255), + status: z.enum(['active', 'needs_reauth', 'revoked']), +}) + export const credentialGroupEnrollmentDetailSchema = credentialGroupEnrollmentSchema.extend({ connections: z .array(credentialGroupEnrollmentConnectionSchema) .max(CREDENTIAL_GROUP_PROVIDER_IDS.length * 3), + mcpConnections: z + .array(credentialGroupEnrollmentMcpConnectionSchema) + .max(CREDENTIAL_GROUP_MCP_SERVER_LIMIT), }) export type CredentialGroupEnrollmentConnection = z.output< typeof credentialGroupEnrollmentConnectionSchema > +export type CredentialGroupEnrollmentMcpConnection = z.output< + typeof credentialGroupEnrollmentMcpConnectionSchema +> export type CredentialGroupEnrollmentDetail = z.output export const credentialGroupAccessPolicySchema = z @@ -183,6 +209,10 @@ export const credentialGroupDetailParamsSchema = credentialGroupWorkspaceParamsS groupId: z.string().min(1, 'Credential group ID is required').max(128), }) +export const credentialGroupMcpConnectorParamsSchema = credentialGroupDetailParamsSchema.extend({ + connectorId: managedMcpConnectorIdSchema, +}) + export const credentialGroupEnrollmentParamsSchema = credentialGroupDetailParamsSchema.extend({ enrollmentId: z.string().min(1, 'Enrollment ID is required').max(128), }) @@ -196,6 +226,11 @@ export const startCredentialGroupOAuthParamsSchema = optionId: z.string().min(1, 'Credential option ID is required').max(128), }) +export const startCredentialGroupMcpOAuthParamsSchema = + publicCredentialGroupEnrollmentParamsSchema.extend({ + mcpServerId: z.string().min(1, 'MCP server ID is required').max(128), + }) + export const credentialGroupOAuthCallbackQuerySchema = z .object({ state: z.string().min(1, 'OAuth state is required').max(512), @@ -357,6 +392,40 @@ export const updateCredentialGroupBodySchema = z export type UpdateCredentialGroupBody = z.input +export const createCredentialGroupMcpConnectorBodySchema = z.discriminatedUnion('connectorId', [ + z.object({ connectorId: z.literal('fireflies') }).strict(), + z.object({ connectorId: z.literal('granola') }).strict(), + z + .object({ + connectorId: z.literal('databricks'), + name: z.string().trim().min(1, 'Name is required').max(100), + url: z.string().trim().url('Enter a valid Databricks MCP URL').max(2048), + oauthClientId: z.string().trim().min(1, 'OAuth Client ID is required').max(512), + oauthClientSecret: z.string().trim().min(1).max(2048).optional(), + }) + .strict(), +]) + +export type CreateCredentialGroupMcpConnectorBody = z.input< + typeof createCredentialGroupMcpConnectorBodySchema +> + +export const updateCredentialGroupMcpConnectorBodySchema = z + .object({ + name: z.string().trim().min(1, 'Name is required').max(100).optional(), + url: z.string().trim().url('Enter a valid Databricks MCP URL').max(2048).optional(), + oauthClientId: z.string().trim().min(1, 'OAuth Client ID is required').max(512).optional(), + oauthClientSecret: z.string().trim().min(1).max(2048).nullable().optional(), + }) + .strict() + .refine((body) => Object.keys(body).length > 0, { + message: 'At least one field must be updated', + }) + +export type UpdateCredentialGroupMcpConnectorBody = z.input< + typeof updateCredentialGroupMcpConnectorBodySchema +> + const listCredentialGroupsResponseSchema = z.object({ credentialGroups: z.array(credentialGroupSchema), /** @@ -458,6 +527,36 @@ export const updateCredentialGroupContract = defineRouteContract({ }, }) +export const createCredentialGroupMcpConnectorContract = defineRouteContract({ + method: 'POST', + path: '/api/workspaces/[id]/credential-groups/[groupId]/mcp-connectors', + params: credentialGroupDetailParamsSchema, + body: createCredentialGroupMcpConnectorBodySchema, + response: { + mode: 'json', + status: 201, + schema: z.object({ mcpServer: credentialGroupMcpServerSchema }), + }, +}) + +export const updateCredentialGroupMcpConnectorContract = defineRouteContract({ + method: 'PATCH', + path: '/api/workspaces/[id]/credential-groups/[groupId]/mcp-connectors/[connectorId]', + params: credentialGroupMcpConnectorParamsSchema, + body: updateCredentialGroupMcpConnectorBodySchema, + response: { + mode: 'json', + schema: z.object({ mcpServer: credentialGroupMcpServerSchema }), + }, +}) + +export const deleteCredentialGroupMcpConnectorContract = defineRouteContract({ + method: 'DELETE', + path: '/api/workspaces/[id]/credential-groups/[groupId]/mcp-connectors/[connectorId]', + params: credentialGroupMcpConnectorParamsSchema, + response: { mode: 'json', schema: z.object({ success: z.literal(true) }) }, +}) + export const getCredentialGroupAccessContract = defineRouteContract({ method: 'GET', path: '/api/workspaces/[id]/credential-groups/[groupId]/access', @@ -501,6 +600,13 @@ export const startCredentialGroupOAuthContract = defineRouteContract({ response: { mode: 'empty' }, }) +export const startCredentialGroupMcpOAuthContract = defineRouteContract({ + method: 'GET', + path: '/api/credential-groups/enroll/[token]/mcp/[mcpServerId]', + params: startCredentialGroupMcpOAuthParamsSchema, + response: { mode: 'empty' }, +}) + export const completeCredentialGroupEnrollmentContract = defineRouteContract({ method: 'POST', path: '/api/credential-groups/enroll/[token]/complete', diff --git a/apps/sim/lib/api/contracts/mcp.ts b/apps/sim/lib/api/contracts/mcp.ts index d720802b55c..523cbc01e59 100644 --- a/apps/sim/lib/api/contracts/mcp.ts +++ b/apps/sim/lib/api/contracts/mcp.ts @@ -1,6 +1,7 @@ import { z } from 'zod' import { type ContractJsonResponse, defineRouteContract } from '@/lib/api/contracts/types' import { v2TimestampSchema } from '@/lib/api/contracts/v2/shared' +import { MANAGED_MCP_CONNECTOR_IDS } from '@/lib/credential-groups/managed-mcp-connectors' import type { McpToolSchema, McpToolSchemaProperty } from '@/lib/mcp/types' const MAX_MCP_REFRESH_SERVER_IDS = 100 @@ -53,6 +54,7 @@ export const mcpTransportSchema = z.enum(['streamable-http']) const mcpTransportResponseSchema = mcpTransportSchema.catch('streamable-http') export const mcpAuthTypeSchema = z.enum(['none', 'headers', 'oauth']) +export const managedMcpConnectorIdSchema = z.enum(MANAGED_MCP_CONNECTOR_IDS) const consecutiveFailuresSchema = z.preprocess( (value) => (typeof value === 'number' ? value : undefined), @@ -97,6 +99,7 @@ export const mcpToolSchema = z.object({ inputSchema: mcpToolInputSchema, serverId: z.string(), serverName: z.string(), + managedConnectorId: managedMcpConnectorIdSchema.optional(), }) export const storedMcpToolSchema = z.object({ @@ -143,10 +146,22 @@ export const mcpServerSchema = z deletedAt: optionalDateStringFromNullableSchema, oauthClientId: optionalStringFromNullableSchema, hasOauthClientSecret: z.boolean().optional(), + credentialGroupId: optionalStringFromNullableSchema, + managedConnectorId: z.preprocess( + (value) => (value === null ? undefined : value), + managedMcpConnectorIdSchema.optional() + ), }) .passthrough() export type McpServer = z.output +export const managedMcpCatalogSchema = z.object({ + servers: z.array(mcpServerSchema).max(500), + tools: z.array(mcpToolSchema).max(500_000), +}) + +export type ManagedMcpCatalog = z.output + export const mcpWorkspaceQuerySchema = z.object({ workspaceId: z.string().min(1), }) @@ -170,6 +185,7 @@ export const createMcpServerBodySchema = z workspaceId: z.string().optional(), oauthClientId: z.string().nullable().optional(), oauthClientSecret: z.string().nullable().optional(), + managedConnectorId: z.never().optional(), }) .passthrough() @@ -317,6 +333,16 @@ export const listMcpServersContract = defineRouteContract({ ), }, }) + +export const listManagedMcpCatalogContract = defineRouteContract({ + method: 'GET', + path: '/api/mcp/managed-connections', + query: mcpWorkspaceQuerySchema, + response: { + mode: 'json', + schema: managedMcpCatalogSchema, + }, +}) export type ListMcpServersResponse = ContractJsonResponse export const createMcpServerContract = defineRouteContract({ diff --git a/apps/sim/lib/api/contracts/v2/__tests__/workflow-agent-tools.test.ts b/apps/sim/lib/api/contracts/v2/__tests__/workflow-agent-tools.test.ts index dd5c2a1c115..7a00015bb7f 100644 --- a/apps/sim/lib/api/contracts/v2/__tests__/workflow-agent-tools.test.ts +++ b/apps/sim/lib/api/contracts/v2/__tests__/workflow-agent-tools.test.ts @@ -11,7 +11,7 @@ import { import { MAX_MCP_TOOL_NAME_BYTES } from '@/lib/mcp/constants' describe('v2AgentToolInputSchema', () => { - it('accepts catalog integration, custom-tool reference, and MCP tool shapes', () => { + it('accepts catalog integration, custom-tool reference, and both MCP tool shapes', () => { const tools = [ { type: 'cloudwatch', @@ -29,6 +29,11 @@ describe('v2AgentToolInputSchema', () => { params: { serverId: 'mcp_123', toolName: 'search_docs', collection: 'incidents' }, usageControl: 'none', }, + { + type: 'mcp-server-advanced', + params: { serverId: 'mcp_456' }, + usageControl: 'auto', + }, ] expect(v2AgentToolInputSchema.parse(tools)).toEqual(tools) @@ -56,6 +61,8 @@ describe('v2AgentToolInputSchema', () => { it.each([ [{ type: 'custom-tool', usageControl: 'auto' }], [{ type: 'mcp', params: { serverId: 'mcp_123' }, usageControl: 'auto' }], + [{ type: 'mcp-server-advanced', params: {}, usageControl: 'auto' }], + [{ type: 'mcp-server-advanced', params: { serverId: 'mcp_123', toolName: 'lookup' } }], [{ type: 'slack', operation: 'send', usageControl: 'sometimes' }], ])('rejects a malformed reserved tool shape', (tools) => { expect(v2AgentToolInputSchema.safeParse(tools).success).toBe(false) @@ -98,6 +105,13 @@ describe('v2AgentToolInputSchema', () => { }, }, ], + [ + 'advanced MCP server id', + { + type: 'mcp-server-advanced', + params: { serverId: 'a'.repeat(MAX_ID_LENGTH + 1) }, + }, + ], [ 'MCP multibyte tool name', { diff --git a/apps/sim/lib/api/contracts/v2/workflows.ts b/apps/sim/lib/api/contracts/v2/workflows.ts index 6a78ce0f8bf..2a2e828361b 100644 --- a/apps/sim/lib/api/contracts/v2/workflows.ts +++ b/apps/sim/lib/api/contracts/v2/workflows.ts @@ -2659,8 +2659,8 @@ export const v2AgentIntegrationToolSchema = z .min(1, 'Agent integration tool type cannot be empty') .max(255, 'Agent integration tool type must be at most 255 characters') .regex( - /^(?!(?:custom-tool|mcp)$).+$/, - 'Agent integration tool type must be a catalog block id, not `custom-tool` or `mcp`' + /^(?!(?:custom-tool|mcp|mcp-server-advanced)$).+$/, + 'Agent integration tool type must be a catalog block id, not a reserved custom or MCP type' ) .describe( 'Catalog block id, such as `cloudwatch` or `slack`. Use the block id, never an underlying tool id.' @@ -2820,9 +2820,49 @@ export const v2AgentMcpToolSchema = z ], }) +/** Every tool currently available through one workspace MCP server. */ +export const v2AgentMcpServerAdvancedSchema = z + .object({ + type: z.literal('mcp-server-advanced').describe('Server-wide MCP binding discriminator.'), + params: z + .object({ + serverId: z + .string() + .trim() + .min(1, 'Agent MCP serverId cannot be empty') + .max(MAX_ID_LENGTH, `Agent MCP serverId must be at most ${MAX_ID_LENGTH} characters`) + .describe( + 'Workspace MCP server ID or explicit credential-group managed MCP connection ID.' + ), + }) + .strict() + .describe('Server identity for discovering and invoking every available MCP tool.'), + usageControl: v2AgentToolUsageControlSchema.optional(), + }) + .catchall( + z.unknown().describe('Forward-compatible MCP server metadata preserved by the workflow editor.') + ) + .meta({ + id: 'AgentMcpServerAdvanced', + title: 'Agent MCP server (advanced)', + description: 'All tools available to the executing subject from one MCP server.', + examples: [ + { + type: 'mcp-server-advanced', + params: { serverId: 'mcp_01J9X2ABCDEF' }, + usageControl: 'auto', + }, + ], + }) + /** One callable tool attached directly to an Agent block. */ export const v2AgentToolSchema = z - .xor([v2AgentIntegrationToolSchema, v2AgentCustomToolSchema, v2AgentMcpToolSchema]) + .xor([ + v2AgentIntegrationToolSchema, + v2AgentCustomToolSchema, + v2AgentMcpToolSchema, + v2AgentMcpServerAdvancedSchema, + ]) .meta({ id: 'AgentTool', title: 'Agent tool', diff --git a/apps/sim/lib/auth/connectors/managed-oauth.test.ts b/apps/sim/lib/auth/connectors/managed-oauth.test.ts index 329278549c5..6987f1498cb 100644 --- a/apps/sim/lib/auth/connectors/managed-oauth.test.ts +++ b/apps/sim/lib/auth/connectors/managed-oauth.test.ts @@ -296,6 +296,14 @@ describe('userinfo-backed managed OAuth connectors', () => { } ) + it('requires PKCE and refresh-token persistence for Monday OAuth 2.1', () => { + expect(policyFor('monday')).toMatchObject({ + pkce: true, + requiresRefreshToken: true, + nonceVerification: 'state_only', + }) + }) + it.each(['linear', 'monday'])( 'treats a partial %s GraphQL response as no identity at all', async (providerId) => { diff --git a/apps/sim/lib/auth/connectors/managed-oauth.ts b/apps/sim/lib/auth/connectors/managed-oauth.ts index 0c6410aa710..d43d9cf56e3 100644 --- a/apps/sim/lib/auth/connectors/managed-oauth.ts +++ b/apps/sim/lib/auth/connectors/managed-oauth.ts @@ -798,8 +798,8 @@ const USER_INFO_MANAGED_OAUTH_CONNECTORS = new Map ManagedOAuthCon () => createUserInfoManagedOAuthConnector({ providerId: 'monday', - /** monday.com access tokens do not expire and no refresh token is issued. */ - requiresRefreshToken: false, + requiresRefreshToken: true, + pkce: true, scopes: { from: 'token_response' }, userInfo: { url: MONDAY_API_URL, diff --git a/apps/sim/lib/auth/connectors/providers.ts b/apps/sim/lib/auth/connectors/providers.ts index 435285d952d..314e71b0631 100644 --- a/apps/sim/lib/auth/connectors/providers.ts +++ b/apps/sim/lib/auth/connectors/providers.ts @@ -10,6 +10,7 @@ import { syntheticConnectorEmail } from '@/lib/auth/connector-email' import { env } from '@/lib/core/config/env' import { inspectConfiguredOAuthClient } from '@/lib/core/config/env-capabilities.server' import { + DEFAULT_MAX_ERROR_BODY_BYTES, readResponseJsonWithLimit, readResponseTextWithLimit, } from '@/lib/core/utils/stream-limits' @@ -22,6 +23,11 @@ import { getBoundMicrosoftDataverseEnvironment, resolveMicrosoftDataverseOAuthCallbackScopes, } from '@/lib/oauth/microsoft-dataverse' +import { + exchangeMondayAuthorizationCode, + MONDAY_OAUTH_AUTHORIZATION_URL, + MONDAY_OAUTH_TOKEN_URL, +} from '@/lib/oauth/monday' import { SALESFORCE_LOGIN_HOSTS } from '@/lib/oauth/salesforce' import { getCanonicalScopesForProvider } from '@/lib/oauth/utils' import { MONDAY_API_URL, MONDAY_API_VERSION } from '@/tools/monday/utils' @@ -86,6 +92,17 @@ interface AttioWorkspaceMemberResponse { } } +interface MondayUserInfoResponse { + data?: { + me?: { + id?: string | number + name?: string | null + email?: string | null + } | null + } + errors?: unknown[] +} + /** * Shape of `GET https://api.bitbucket.org/2.0/user` for the authenticated user. * @see https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-user-get @@ -1729,15 +1746,29 @@ export function buildConnectorProviders(): GenericOAuthConfig[] { providerId: 'monday', clientId: env.MONDAY_CLIENT_ID as string, clientSecret: env.MONDAY_CLIENT_SECRET as string, - authorizationUrl: 'https://auth.monday.com/oauth2/authorize', - tokenUrl: 'https://auth.monday.com/oauth2/token', + authorizationUrl: MONDAY_OAUTH_AUTHORIZATION_URL, + tokenUrl: MONDAY_OAUTH_TOKEN_URL, userInfoUrl: 'https://api.monday.com/v2', scopes: getCanonicalScopesForProvider('monday'), responseType: 'code', - pkce: false, + pkce: true, + authentication: 'post', redirectURI: `${getBaseUrl()}/api/auth/oauth2/callback/monday`, + getToken: async ({ code, codeVerifier, redirectURI }) => { + if (!codeVerifier) { + throw new Error('Monday OAuth token exchange requires a PKCE verifier') + } + return exchangeMondayAuthorizationCode({ + clientId: env.MONDAY_CLIENT_ID as string, + clientSecret: env.MONDAY_CLIENT_SECRET as string, + code, + codeVerifier, + redirectUri: redirectURI, + }) + }, getUserInfo: async (tokens) => { try { + const signal = AbortSignal.timeout(15_000) const response = await fetch(MONDAY_API_URL, { method: 'POST', headers: { @@ -1746,10 +1777,15 @@ export function buildConnectorProviders(): GenericOAuthConfig[] { Authorization: tokens.accessToken ?? '', }, body: JSON.stringify({ query: '{ me { id name email } }' }), + signal, }) if (!response.ok) { - await response.text().catch(() => {}) + await readResponseTextWithLimit(response, { + maxBytes: DEFAULT_MAX_ERROR_BODY_BYTES, + label: 'Monday OAuth user info error response', + signal, + }).catch(() => {}) logger.error('Error fetching Monday.com user info:', { status: response.status, statusText: response.statusText, @@ -1757,16 +1793,33 @@ export function buildConnectorProviders(): GenericOAuthConfig[] { return null } - const data = await response.json() + const data = await readResponseJsonWithLimit(response, { + maxBytes: DEFAULT_MAX_ERROR_BODY_BYTES, + label: 'Monday OAuth user info response', + signal, + }) + if (data.errors?.length) { + logger.error('Monday.com user info returned GraphQL errors', { + errorCount: data.errors.length, + }) + return null + } const user = data.data?.me - if (!user) return null + const userId = + typeof user?.id === 'string' || typeof user?.id === 'number' + ? String(user.id) + : undefined + if (!user || !userId) return null + + const email = typeof user.email === 'string' ? user.email : undefined + const name = typeof user.name === 'string' ? user.name : undefined const now = new Date() return { - id: `${user.id.toString()}-${generateId()}`, - name: user.name || 'Monday.com User', - email: user.email || syntheticConnectorEmail('monday', user.id), - emailVerified: !!user.email, + id: `${userId}-${generateId()}`, + name: name || 'Monday.com User', + email: email || syntheticConnectorEmail('monday', userId), + emailVerified: !!email, createdAt: now, updatedAt: now, } diff --git a/apps/sim/lib/auth/internal.test.ts b/apps/sim/lib/auth/internal.test.ts index 6bf619889b0..d5a279c6b62 100644 --- a/apps/sim/lib/auth/internal.test.ts +++ b/apps/sim/lib/auth/internal.test.ts @@ -2,9 +2,11 @@ * @vitest-environment node */ +import { serializePrincipal } from '@sim/auth/principal' import { resetEnvMock } from '@sim/testing' -import { decodeJwt } from 'jose' +import { decodeJwt, SignJWT } from 'jose' import { afterAll, describe, expect, it, vi } from 'vitest' +import { env } from '@/lib/core/config/env' vi.unmock('@/lib/auth/internal') @@ -181,7 +183,32 @@ describe('internal executor delegation claims', () => { ).rejects.toBeInstanceOf(InvalidInternalDelegationTokenError) }) - it('rejects laundering actorless or external principals into a Sim user subject', async () => { + it('round-trips an authenticated chat subject without inventing a Sim user', async () => { + const token = await generateInternalDelegationToken({ + workflowId: 'workflow-1', + principal: { + kind: 'system', + serviceId: 'chat', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + subject: { kind: 'authenticated_email', email: 'person@example.com' }, + }, + }) + + await expect(verifyInternalDelegationToken(token)).resolves.toMatchObject({ + workflowId: 'workflow-1', + principal: { + kind: 'system', + serviceId: 'chat', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + subject: { kind: 'authenticated_email', email: 'person@example.com' }, + }, + }) + expect(decodeJwt(token).sub).toBeUndefined() + }) + + it('rejects laundering actorless or non-Sim principals into a Sim user subject', async () => { await expect( generateInternalDelegationToken({ subjectUserId: 'billing-owner', @@ -213,7 +240,49 @@ describe('internal executor delegation claims', () => { }, }, }) - ).rejects.toThrow('External workflow subjects cannot be represented as Sim users') + ).rejects.toThrow('Non-Sim workflow subjects cannot be represented as Sim users') + + await expect( + generateInternalDelegationToken({ + subjectUserId: 'unrelated-user', + workflowId: 'workflow-1', + principal: { + kind: 'system', + serviceId: 'chat', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + subject: { kind: 'authenticated_email', email: 'person@example.com' }, + }, + }) + ).rejects.toThrow('Non-Sim workflow subjects cannot be represented as Sim users') + }) + + it('rejects a signed delegation that pairs a non-Sim principal with a Sim user subject', async () => { + const issuedAt = Math.floor(Date.now() / 1000) + const token = await new SignJWT({ + type: 'internal_delegation', + serviceId: 'executor', + workflowId: 'workflow-1', + principal: serializePrincipal({ + kind: 'system', + serviceId: 'chat', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + subject: { kind: 'authenticated_email', email: 'person@example.com' }, + }), + }) + .setProtectedHeader({ alg: 'HS256' }) + .setJti('delegation-1') + .setSubject('unrelated-user') + .setIssuedAt(issuedAt) + .setExpirationTime(issuedAt + 5 * 60) + .setIssuer('sim-internal') + .setAudience('sim-api') + .sign(new TextEncoder().encode(env.INTERNAL_API_SECRET)) + + await expect(verifyInternalDelegationToken(token)).rejects.toBeInstanceOf( + InvalidInternalDelegationTokenError + ) }) it('derives issued-at and expiry from one timestamp', async () => { diff --git a/apps/sim/lib/auth/internal.ts b/apps/sim/lib/auth/internal.ts index fe410edf9a4..6930e5a377e 100644 --- a/apps/sim/lib/auth/internal.ts +++ b/apps/sim/lib/auth/internal.ts @@ -138,8 +138,8 @@ export async function generateInternalDelegationToken( ? requireNonEmptyDelegationClaim(input.subjectUserId, 'subjectUserId') : undefined const principalSubject = input.principal ? resolvePrincipalSubject(input.principal) : null - if (principalSubject?.kind === 'external_user' && suppliedSubjectUserId) { - throw new Error('External workflow subjects cannot be represented as Sim users') + if (principalSubject && principalSubject.kind !== 'sim_user' && suppliedSubjectUserId) { + throw new Error('Non-Sim workflow subjects cannot be represented as Sim users') } if (!principalSubject && input.principal && suppliedSubjectUserId) { throw new Error('Actorless workflow principals cannot be represented as Sim users') @@ -247,7 +247,7 @@ export async function verifyInternalDelegationToken( if ( (!principal && !subjectUserId) || (principalSubject?.kind === 'sim_user' && principalSubject.userId !== subjectUserId) || - (principalSubject?.kind === 'external_user' && subjectUserId) || + (principalSubject && principalSubject.kind !== 'sim_user' && subjectUserId) || (principal && !principalSubject && subjectUserId) ) { throw new InvalidInternalDelegationTokenError() diff --git a/apps/sim/lib/auth/principal.test.ts b/apps/sim/lib/auth/principal.test.ts index 8e5e4c108c9..265ce224b41 100644 --- a/apps/sim/lib/auth/principal.test.ts +++ b/apps/sim/lib/auth/principal.test.ts @@ -277,6 +277,21 @@ describe('principal persistence', () => { expect(parsePrincipal(serializePrincipal(principal))).toEqual(principal) }) + it('round trips an authenticated chat email subject', () => { + const principal = { + kind: 'system' as const, + serviceId: 'chat' as const, + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + subject: { + kind: 'authenticated_email' as const, + email: 'person@example.com', + }, + } + + expect(parsePrincipal(serializePrincipal(principal))).toEqual(principal) + }) + it('rejects incomplete or cross-provider webhook identity', () => { expect(() => parsePrincipal({ @@ -309,10 +324,43 @@ describe('principal persistence', () => { }) ).toThrow('subject provider must match') }) + + it('rejects subjects on the wrong system surface', () => { + expect(() => + parsePrincipal({ + version: 1, + principal: { + kind: 'system', + serviceId: 'chat', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + subject: { + kind: 'external_user', + provider: 'slack', + tenantId: 'T123', + subjectId: 'U123', + }, + }, + }) + ).toThrow('Unsupported serialized principal subject kind external_user') + + expect(() => + parsePrincipal({ + version: 1, + principal: { + kind: 'system', + serviceId: 'schedule', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + subject: { kind: 'authenticated_email', email: 'person@example.com' }, + }, + }) + ).toThrow('cannot carry a subject') + }) }) describe('principal subjects', () => { - it('keeps Sim and external subjects distinct', () => { + it('keeps Sim, external, and authenticated-email subjects distinct', () => { expect( resolvePrincipalSubject({ kind: 'session', userId: 'user-1', sessionId: 'session-1' }) ).toEqual({ kind: 'sim_user', userId: 'user-1' }) @@ -337,6 +385,15 @@ describe('principal subjects', () => { tenantId: 'T123', subjectId: 'U123', }) + expect( + resolvePrincipalSubject({ + kind: 'system', + serviceId: 'chat', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + subject: { kind: 'authenticated_email', email: 'person@example.com' }, + }) + ).toEqual({ kind: 'authenticated_email', email: 'person@example.com' }) expect( resolvePrincipalSubject({ kind: 'system', diff --git a/apps/sim/lib/billing/sandbox-pricing.test.ts b/apps/sim/lib/billing/sandbox-pricing.test.ts index e523120bc32..2a38f397d4c 100644 --- a/apps/sim/lib/billing/sandbox-pricing.test.ts +++ b/apps/sim/lib/billing/sandbox-pricing.test.ts @@ -1,6 +1,20 @@ -import { describe, expect, it } from 'vitest' +/** + * @vitest-environment node + */ +import { resetEnvMock, setEnv } from '@sim/testing/mocks/env.mock' +import { afterAll, afterEach, describe, expect, it, vi } from 'vitest' + +vi.hoisted(() => { + vi.stubEnv('NODE_ENV', 'production') +}) + +vi.unmock('@/lib/core/config/env-flags') + import { createSandboxPricing, priceSandboxUsage } from '@/lib/billing/sandbox-pricing' +afterEach(resetEnvMock) +afterAll(() => vi.unstubAllEnvs()) + describe('sandbox pricing', () => { it.each([ ['e2b', 0.1656], @@ -33,4 +47,32 @@ describe('sandbox pricing', () => { 'finite nonnegative' ) }) + + describe('default multiplier from the production environment', () => { + it('coerces the string COST_MULTIPLIER that process.env delivers', () => { + setEnv({ COST_MULTIPLIER: '1.1' }) + + const pricing = createSandboxPricing('e2b') + + expect(pricing.multiplier).toBe(1.1) + expect(priceSandboxUsage(pricing, 1000, 1000).billedCost).toBeCloseTo(0.0000506, 8) + }) + + it('falls back to 1 when COST_MULTIPLIER is unset', () => { + setEnv({ COST_MULTIPLIER: undefined }) + + expect(createSandboxPricing('daytona').multiplier).toBe(1) + }) + + it('falls back to 1 instead of throwing when COST_MULTIPLIER is not a nonnegative number', () => { + setEnv({ COST_MULTIPLIER: 'abc' }) + expect(createSandboxPricing('e2b').multiplier).toBe(1) + + setEnv({ COST_MULTIPLIER: '-2' }) + expect(createSandboxPricing('e2b').multiplier).toBe(1) + + setEnv({ COST_MULTIPLIER: ' ' }) + expect(createSandboxPricing('e2b').multiplier).toBe(1) + }) + }) }) diff --git a/apps/sim/lib/copilot/tools/client/run-tool-execution.test.ts b/apps/sim/lib/copilot/tools/client/run-tool-execution.test.ts index 12fc1b480a0..4df007c34cd 100644 --- a/apps/sim/lib/copilot/tools/client/run-tool-execution.test.ts +++ b/apps/sim/lib/copilot/tools/client/run-tool-execution.test.ts @@ -3,6 +3,7 @@ */ import { beforeEach, describe, expect, it, vi } from 'vitest' +import type { WorkflowExecutionOptions } from '@/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils' const { clearExecutionPointer, @@ -66,6 +67,12 @@ vi.mock('@/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-u executeWorkflowWithFullLogging, })) +/** The abort signal the run tool wires into every client-side execution. */ +function requireAbortSignal(options: WorkflowExecutionOptions): AbortSignal { + if (!options.abortSignal) throw new Error('run tool did not pass an abort signal') + return options.abortSignal +} + vi.mock('@/stores/execution/store', () => ({ useExecutionStore: { getState: () => ({ @@ -115,7 +122,9 @@ import { cancelRunToolExecution, executeRunToolOnClient, isRunToolActiveForId, + isRunToolActiveForWorkflow, reportManualRunToolStop, + subscribeToRunToolRelease, } from './run-tool-execution' describe('run tool execution cancellation', () => { @@ -130,16 +139,18 @@ describe('run tool execution cancellation', () => { it('passes an abort signal into executeWorkflowWithFullLogging and aborts it', async () => { let capturedSignal: AbortSignal | undefined - executeWorkflowWithFullLogging.mockImplementationOnce(async (options: any) => { - capturedSignal = options.abortSignal - await new Promise((_, reject) => { - options.abortSignal.addEventListener( - 'abort', - () => reject(new DOMException('Aborted', 'AbortError')), - { once: true } - ) - }) - }) + executeWorkflowWithFullLogging.mockImplementationOnce( + async (options: WorkflowExecutionOptions) => { + capturedSignal = requireAbortSignal(options) + await new Promise((_, reject) => { + capturedSignal?.addEventListener( + 'abort', + () => reject(new DOMException('Aborted', 'AbortError')), + { once: true } + ) + }) + } + ) executeRunToolOnClient('tool-1', 'run_workflow', { workflowId: 'wf-1' }) await Promise.resolve() @@ -150,6 +161,96 @@ describe('run tool execution cancellation', () => { expect(capturedSignal?.aborted).toBe(true) }) + it('owns the workflow for exactly as long as the client run is in flight', async () => { + executeWorkflowWithFullLogging.mockImplementationOnce( + async (options: WorkflowExecutionOptions) => { + await new Promise((_, reject) => { + requireAbortSignal(options).addEventListener( + 'abort', + () => reject(new DOMException('Aborted', 'AbortError')), + { once: true } + ) + }) + } + ) + let ownedWhenPointerSaved: boolean | undefined + saveExecutionPointer.mockImplementationOnce(() => { + ownedWhenPointerSaved = isRunToolActiveForWorkflow('wf-1') + }) + expect(isRunToolActiveForWorkflow('wf-1')).toBe(false) + + executeRunToolOnClient('tool-1', 'run_workflow', { workflowId: 'wf-1' }) + await Promise.resolve() + const ownedWhileInFlight = isRunToolActiveForWorkflow('wf-1') + const otherWorkflowOwnedWhileInFlight = isRunToolActiveForWorkflow('wf-2') + + cancelRunToolExecution('wf-1') + await vi.waitFor(() => expect(clearExecutionPointer).toHaveBeenCalledWith('wf-1')) + + expect(ownedWhenPointerSaved).toBe(true) + expect(ownedWhileInFlight).toBe(true) + expect(otherWorkflowOwnedWhileInFlight).toBe(false) + expect(saveExecutionPointer).toHaveBeenCalledWith( + expect.objectContaining({ workflowId: 'wf-1', lastEventId: 0 }) + ) + expect(isRunToolActiveForWorkflow('wf-1')).toBe(false) + }) + + it.each([ + ['handler', new MockSSEEventHandlerError('Block handler failed on event 7', 'exec-1')], + ['transport', new MockSSEStreamInterruptedError('Execution stream interrupted', 'exec-1')], + ])( + 'releases a run whose stream was cut by a %s failure only after giving up ownership', + async (_kind, interruption) => { + const ownedAtRelease: boolean[] = [] + const listener = vi.fn((workflowId: string) => { + ownedAtRelease.push(isRunToolActiveForWorkflow(workflowId)) + }) + const unsubscribe = subscribeToRunToolRelease(listener) + executeWorkflowWithFullLogging.mockRejectedValueOnce(interruption) + + try { + executeRunToolOnClient('tool-1', 'run_workflow', { workflowId: 'wf-1' }) + await vi.waitFor(() => expect(listener).toHaveBeenCalledWith('wf-1')) + + expect(listener).toHaveBeenCalledTimes(1) + expect(ownedAtRelease).toEqual([false]) + expect(setIsExecuting).toHaveBeenCalledWith('wf-1', false) + expect(setCurrentExecutionId).toHaveBeenCalledWith('wf-1', null) + expect(setIsExecuting.mock.invocationCallOrder.at(-1)).toBeLessThan( + listener.mock.invocationCallOrder[0] + ) + expect(clearExecutionPointer).not.toHaveBeenCalled() + expect(fetch).toHaveBeenCalledWith( + '/api/copilot/confirm', + expect.objectContaining({ + body: expect.stringContaining('"status":"background"'), + }) + ) + expect(vi.mocked(fetch).mock.calls[0][1]?.body).toContain('"executionId":"exec-1"') + } finally { + unsubscribe() + } + } + ) + + it('does not release a run it observed to completion, even when the report fails', async () => { + const listener = vi.fn() + const unsubscribe = subscribeToRunToolRelease(listener) + vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: false, status: 500 })) + executeWorkflowWithFullLogging.mockResolvedValueOnce({ success: true }) + + try { + executeRunToolOnClient('tool-1', 'run_workflow', { workflowId: 'wf-1' }) + await vi.waitFor(() => expect(isRunToolActiveForWorkflow('wf-1')).toBe(false)) + + expect(listener).not.toHaveBeenCalled() + expect(clearExecutionPointer).not.toHaveBeenCalled() + } finally { + unsubscribe() + } + }) + it('can report a manual stop using the explicit toolCallId override', async () => { const fetchMock = vi.fn().mockResolvedValue({ ok: true }) vi.stubGlobal('fetch', fetchMock) @@ -252,12 +353,11 @@ describe('run tool execution cancellation', () => { expect(fetchMock.mock.calls[1][0]).toBe('/api/copilot/confirm') expect(fetchMock.mock.calls[1][1]?.body).toContain('"status":"background"') expect(fetchMock.mock.calls[1][1]?.body).toContain('"executionId":"exec-async"') - expect(saveExecutionPointer).toHaveBeenCalledWith({ - workflowId: 'wf-1', - executionId: 'exec-async', - lastEventId: 0, - }) - expect(clearExecutionPointer).toHaveBeenCalledWith('wf-1') + // An async run has no reconnectable stream, so it must never leave the + // terminal a pointer that a reconnect would 404 against. + expect(saveExecutionPointer).not.toHaveBeenCalled() + expect(clearExecutionPointer).not.toHaveBeenCalled() + expect(window.sessionStorage.getItem('sim:copilot:run-tool-completion:tool-async')).toBeNull() }) it('recovers a queued async launch by re-reporting it without enqueueing again', async () => { @@ -283,11 +383,10 @@ describe('run tool execution cancellation', () => { await vi.waitFor(() => expect(fetchMock).toHaveBeenCalledTimes(6)) await vi.waitFor(() => expect(isRunToolActiveForId('tool-recover-async')).toBe(false)) - loadExecutionPointer.mockResolvedValueOnce({ - workflowId: 'wf-1', - executionId: 'exec-recover-async', - lastEventId: 0, - }) + expect(saveExecutionPointer).not.toHaveBeenCalled() + expect( + window.sessionStorage.getItem('sim:copilot:run-tool-completion:tool-recover-async') + ).toContain('"executionId":"exec-recover-async"') await expect(bindRunToolToExecution('tool-recover-async', 'wf-1')).resolves.toBe(true) @@ -298,6 +397,34 @@ describe('run tool execution cancellation', () => { expect( fetchMock.mock.calls.filter(([url]) => url === '/api/workflows/wf-1/execute') ).toHaveLength(1) + expect(clearExecutionPointer).not.toHaveBeenCalled() + expect( + window.sessionStorage.getItem('sim:copilot:run-tool-completion:tool-recover-async') + ).toBeNull() + }) + + it('cleans up the terminal pointer an earlier client left for an async launch', async () => { + const fetchMock = vi.fn().mockResolvedValue({ ok: true }) + vi.stubGlobal('fetch', fetchMock) + loadExecutionPointer.mockResolvedValueOnce({ + workflowId: 'wf-1', + executionId: 'exec-legacy-async', + lastEventId: 0, + }) + window.sessionStorage.setItem( + 'sim:copilot:run-tool-completion:tool-legacy-async', + JSON.stringify({ + status: 'background', + executionId: 'exec-legacy-async', + clearExecutionPointerAfterReport: true, + }) + ) + + await expect(bindRunToolToExecution('tool-legacy-async', 'wf-1')).resolves.toBe(true) + + expect(fetchMock).toHaveBeenCalledTimes(1) + expect(fetchMock.mock.calls[0][1]?.body).toContain('"status":"background"') + expect(fetchMock.mock.calls[0][1]?.body).toContain('"executionId":"exec-legacy-async"') expect(clearExecutionPointer).toHaveBeenCalledWith('wf-1') }) diff --git a/apps/sim/lib/copilot/tools/client/run-tool-execution.ts b/apps/sim/lib/copilot/tools/client/run-tool-execution.ts index ec341f1491a..99ca035e6c2 100644 --- a/apps/sim/lib/copilot/tools/client/run-tool-execution.ts +++ b/apps/sim/lib/copilot/tools/client/run-tool-execution.ts @@ -45,11 +45,23 @@ const logger = createLogger('CopilotRunToolExecution') const activeRunToolByWorkflowId = new Map() const activeRunAbortByWorkflowId = new Map() const manuallyStoppedToolCallIds = new Set() +type RunToolReleaseListener = (workflowId: string) => void +const runToolReleaseListeners = new Set() const PENDING_COMPLETION_STORAGE_PREFIX = 'sim:copilot:run-tool-completion:' +/** + * Tab-local record of a completion this tab still owes Sim for a tool call, + * written just before the report is sent and cleared once it lands, so a reload + * mid-report can re-send it instead of re-running the tool. + */ interface PendingCompletionReport { status: AsyncConfirmationStatus executionId?: string + /** + * Written by earlier clients for async launches, which also wrote a terminal + * execution pointer for a run that has no reconnectable stream. Honoured so + * that pointer is cleaned up once the pending report is delivered. + */ clearExecutionPointerAfterReport?: boolean } @@ -165,13 +177,7 @@ async function enqueueAsyncWorkflowRun( const pendingCompletion: PendingCompletionReport = { status: ASYNC_TOOL_CONFIRMATION_STATUS.background, executionId: responseExecutionId, - clearExecutionPointerAfterReport: true, } - await saveExecutionPointer({ - workflowId, - executionId: responseExecutionId, - lastEventId: 0, - }) savePendingCompletionReport(toolCallId, pendingCompletion) try { @@ -183,7 +189,6 @@ async function enqueueAsyncWorkflowRun( pendingCompletion.executionId ) clearPendingCompletionReport(toolCallId) - await clearExecutionPointer(workflowId) } catch (error) { logger.error( '[RunTool] Async workflow was queued but background status could not be reported', @@ -249,6 +254,15 @@ function clearPendingCompletionReport(toolCallId: string): void { } } +/** + * Re-binds a tool call that the server still shows as executing to whatever + * this tab already knows about it, instead of running the tool again. + * + * Two tab-local records can answer: a pending completion report (a report this + * tab owed Sim and never delivered) is re-sent as is, and otherwise a terminal + * execution pointer (a live run this tab was observing) is reported as + * continuing in the background. With neither, the caller runs the tool. + */ export async function bindRunToolToExecution( toolCallId: string, workflowId: string @@ -271,21 +285,15 @@ export async function bindRunToolToExecution( } const pointer = await loadExecutionPointer(workflowId).catch(() => null) - if (!pointer?.executionId) { - logger.info('[RunTool] Recovery skipped: no tab-local execution pointer', { + const pendingCompletion = loadPendingCompletionReport(toolCallId) + if (pendingCompletion) { + const executionId = pendingCompletion.executionId ?? pointer?.executionId + logger.info('[RunTool] Recovery re-sending pending completion report', { workflowId, toolCallId, + executionId, + status: pendingCompletion.status, }) - return false - } - - logger.info('[RunTool] Recovery moved to background for existing execution pointer', { - workflowId, - toolCallId, - executionId: pointer.executionId, - }) - const pendingCompletion = loadPendingCompletionReport(toolCallId) - if (pendingCompletion) { try { await reportCompletion( toolCallId, @@ -294,7 +302,7 @@ export async function bindRunToolToExecution( pendingCompletion.status === MothershipStreamV1ToolOutcome.cancelled ? { reason: 'user_cancelled', cancelledByUser: true } : undefined, - pendingCompletion.executionId ?? pointer.executionId + executionId ) clearPendingCompletionReport(toolCallId) if (pendingCompletion.clearExecutionPointerAfterReport) { @@ -304,13 +312,27 @@ export async function bindRunToolToExecution( logger.warn('[RunTool] Failed to report recovered terminal completion', { workflowId, toolCallId, - executionId: pointer.executionId, + executionId, error: toError(error).message, }) } return true } + if (!pointer?.executionId) { + logger.info('[RunTool] Recovery skipped: no tab-local execution pointer', { + workflowId, + toolCallId, + }) + return false + } + + logger.info('[RunTool] Recovery moved to background for existing execution pointer', { + workflowId, + toolCallId, + executionId: pointer.executionId, + }) + try { await reportCompletion( toolCallId, @@ -375,6 +397,38 @@ export function isRunToolActiveForId(toolCallId: string): boolean { return false } +/** + * Whether a client run tool in this tab currently owns the workflow's run. + * + * While it does, its live execute stream is the source of truth for the run and + * for the completion it reports to Sim, so the terminal's reconnect flow must + * not claim the execution pointer the tool writes before the server has + * acknowledged the run. + */ +export function isRunToolActiveForWorkflow(workflowId: string): boolean { + return activeRunToolByWorkflowId.has(workflowId) +} + +/** + * Subscribes to a client run tool releasing a workflow run whose stream dropped + * before the run finished. The run keeps executing server-side and its + * execution pointer is retained, so a subscriber that can re-attach to the + * execution stream should do so once this fires. It does not fire for runs the + * tool observed to completion, even when reporting that completion failed. + */ +export function subscribeToRunToolRelease(listener: RunToolReleaseListener): () => void { + runToolReleaseListeners.add(listener) + return () => { + runToolReleaseListeners.delete(listener) + } +} + +function notifyRunToolReleased(workflowId: string): void { + for (const listener of runToolReleaseListeners) { + listener(workflowId) + } +} + export function cancelRunToolExecution(workflowId: string): void { const controller = activeRunAbortByWorkflowId.get(workflowId) if (!controller) return @@ -566,6 +620,7 @@ async function doExecuteRunTool( }) let leaveExecutionRecoverable = false + let streamInterrupted = false try { const result = await executeWorkflowWithFullLogging({ @@ -649,6 +704,7 @@ async function doExecuteRunTool( const msg = toError(err).message if (err instanceof SSEEventHandlerError || err instanceof SSEStreamInterruptedError) { leaveExecutionRecoverable = true + streamInterrupted = true logger.warn( '[RunTool] Execution stream interrupted; leaving workflow execution in background', { @@ -719,5 +775,8 @@ async function doExecuteRunTool( setIsExecuting(targetWorkflowId, false) setActiveBlocks(targetWorkflowId, new Set()) } + if (streamInterrupted && activeToolCallId === toolCallId) { + notifyRunToolReleased(targetWorkflowId) + } } } diff --git a/apps/sim/lib/core/config/env-flags.ts b/apps/sim/lib/core/config/env-flags.ts index a501ceb7a5e..1a954327eea 100644 --- a/apps/sim/lib/core/config/env-flags.ts +++ b/apps/sim/lib/core/config/env-flags.ts @@ -14,7 +14,7 @@ import { resolveEnterpriseEntitlement, resolveSandboxFeatureAvailability, } from './enterprise-entitlements' -import { env, envBoolean, getEnv, isFalsy, isTruthy } from './env' +import { env, envBoolean, envNumber, getEnv, isFalsy, isTruthy } from './env' import { hasEnvCapabilityValue, inspectCapability, SANDBOX_CAPABILITY } from './env-capabilities' /** @@ -684,8 +684,13 @@ export function getAllowedMcpDomainsFromEnv(): string[] | null { } /** - * Get cost multiplier based on environment + * Get cost multiplier based on environment. + * + * `COST_MULTIPLIER` is declared as a number but arrives as a string from + * `process.env` because `createEnv` skips validation, so it is normalized + * through {@link envNumber}. Unset, empty, non-numeric, and negative values + * fall back to 1. */ export function getCostMultiplier(): number { - return isProd ? (env.COST_MULTIPLIER ?? 1) : 1 + return isProd ? envNumber(env.COST_MULTIPLIER, 1) : 1 } diff --git a/apps/sim/lib/core/config/env.test.ts b/apps/sim/lib/core/config/env.test.ts index ea792ba42d8..d0a5b98d8d6 100644 --- a/apps/sim/lib/core/config/env.test.ts +++ b/apps/sim/lib/core/config/env.test.ts @@ -12,4 +12,11 @@ describe('envNumber', () => { expect(envNumber('5.5', 1, { min: 1, integer: true })).toBe(1) expect(envNumber(5.5, 1, { min: 1, integer: true })).toBe(1) }) + + it('treats whitespace-only values as unset instead of coercing them to 0', () => { + expect(envNumber(' ', 1)).toBe(1) + expect(envNumber('', 1)).toBe(1) + expect(envNumber(' 1.1 ', 1)).toBe(1.1) + expect(envNumber('0', 1)).toBe(0) + }) }) diff --git a/apps/sim/lib/core/config/env.ts b/apps/sim/lib/core/config/env.ts index a3992c6cbd9..833ad743b79 100644 --- a/apps/sim/lib/core/config/env.ts +++ b/apps/sim/lib/core/config/env.ts @@ -813,7 +813,7 @@ export function envNumber( ) { return value } - if (value === undefined || value === null || value === '') return fallback + if (value === undefined || value === null || String(value).trim() === '') return fallback const parsed = Number(value) return Number.isFinite(parsed) && parsed >= min && (!options.integer || Number.isInteger(parsed)) ? parsed diff --git a/apps/sim/lib/core/security/deployment-auth.ts b/apps/sim/lib/core/security/deployment-auth.ts index 29da0392bd7..23e94fdcdb1 100644 --- a/apps/sim/lib/core/security/deployment-auth.ts +++ b/apps/sim/lib/core/security/deployment-auth.ts @@ -1,5 +1,6 @@ import { createLogger } from '@sim/logger' import { safeCompare } from '@sim/security/compare' +import { normalizeEmail } from '@sim/utils/string' import type { NextRequest } from 'next/server' import type { TokenBucketConfig } from '@/lib/core/rate-limiter' import { RateLimiter } from '@/lib/core/rate-limiter' @@ -8,7 +9,7 @@ import { type DeploymentAuthResource, deploymentAuthCookieName, isEmailAllowed, - validateAuthToken, + readDeploymentAuthToken, } from '@/lib/core/security/deployment' import { decryptSecret } from '@/lib/core/security/encryption' import { getClientIp } from '@/lib/core/utils/request' @@ -58,6 +59,7 @@ export interface DeploymentAuthBody { export interface DeploymentAuthResult { authorized: boolean + authenticatedEmail?: string error?: string status?: number retryAfterMs?: number @@ -85,8 +87,9 @@ export async function validateDeploymentAuth( if (authType === 'password' || authType === 'email') { const authCookie = request.cookies.get(deploymentAuthCookieName(cookiePrefix, resource.id)) - if (authCookie && validateAuthToken({ token: authCookie.value, resource })) { - return { authorized: true } + if (authCookie) { + const claims = await readDeploymentAuthToken({ token: authCookie.value, resource }) + if (claims) return { authorized: true, ...claims } } } @@ -213,7 +216,7 @@ export async function validateDeploymentAuth( } if (isEmailAllowed(userEmail, resource.allowedEmails)) { - return { authorized: true } + return { authorized: true, authenticatedEmail: normalizeEmail(userEmail) } } return { authorized: false, error: 'Your email is not authorized to access this resource' } diff --git a/apps/sim/lib/core/security/deployment.test.ts b/apps/sim/lib/core/security/deployment.test.ts index 18b379fb521..d1f701f0c88 100644 --- a/apps/sim/lib/core/security/deployment.test.ts +++ b/apps/sim/lib/core/security/deployment.test.ts @@ -1,21 +1,34 @@ /** * @vitest-environment node */ +import { hmacSha256Hex } from '@sim/security/hmac' +import { resetEnvMock, setEnv } from '@sim/testing' import { NextResponse } from 'next/server' -import { afterEach, describe, expect, it, vi } from 'vitest' +import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' +import { env } from '@/lib/core/config/env' import { type DeploymentAuthResource, deploymentAuthCookieName, isEmailAllowed, + readDeploymentAuthToken, setDeploymentAuthCookie, validateAuthToken, } from '@/lib/core/security/deployment' const DAY_MS = 24 * 60 * 60 * 1000 -function mintToken(resource: DeploymentAuthResource, verifiedEmail?: string): string { +beforeAll(() => { + setEnv({ ENCRYPTION_KEY: '0'.repeat(64) }) +}) + +afterAll(resetEnvMock) + +async function mintToken( + resource: DeploymentAuthResource, + verifiedEmail?: string +): Promise { const response = NextResponse.json({}) - setDeploymentAuthCookie({ + await setDeploymentAuthCookie({ response, cookiePrefix: 'file', resource, @@ -26,107 +39,135 @@ function mintToken(resource: DeploymentAuthResource, verifiedEmail?: string): st return token } +function withoutEncryptedEmailClaim(token: string): string { + const [encodedPayload] = token.split('.') + if (!encodedPayload) throw new Error('Expected encoded deployment auth payload') + const payload = JSON.parse(Buffer.from(encodedPayload, 'base64url').toString('utf8')) + payload.encryptedEmail = undefined + const encodedLegacyPayload = Buffer.from(JSON.stringify(payload), 'utf8').toString('base64url') + const signature = hmacSha256Hex(encodedLegacyPayload, env.BETTER_AUTH_SECRET) + return `${encodedLegacyPayload}.${signature}` +} + describe('deployment auth tokens', () => { afterEach(() => { vi.restoreAllMocks() }) - it('binds a password token to the resource, auth mode, and current password', () => { + it('binds a password token to the resource, auth mode, and current password', async () => { const resource = { id: 'share-1', authType: 'password', password: 'encrypted-password-1', } - const token = mintToken(resource) - - expect(validateAuthToken({ token, resource })).toBe(true) - expect(validateAuthToken({ token, resource: { ...resource, id: 'share-2' } })).toBe(false) - expect(validateAuthToken({ token, resource: { ...resource, authType: 'email' } })).toBe(false) - expect( + const token = await mintToken(resource) + + await expect(validateAuthToken({ token, resource })).resolves.toBe(true) + await expect( + validateAuthToken({ token, resource: { ...resource, id: 'share-2' } }) + ).resolves.toBe(false) + await expect( + validateAuthToken({ token, resource: { ...resource, authType: 'email' } }) + ).resolves.toBe(false) + await expect( validateAuthToken({ token, resource: { ...resource, password: 'encrypted-password-2' }, }) - ).toBe(false) + ).resolves.toBe(false) + await expect(readDeploymentAuthToken({ token, resource })).resolves.toEqual({}) + }) + + it('round-trips a normalized email without exposing it in the signed payload', async () => { + const resource = { + id: 'share-1', + authType: 'email', + password: null, + allowedEmails: ['person@example.com'], + } + const token = await mintToken(resource, ' Person@Example.com ') + const [encodedPayload] = token.split('.') + const decodedPayload = Buffer.from(encodedPayload, 'base64url').toString('utf8') + + expect(decodedPayload).not.toContain('person') + expect(decodedPayload).not.toContain('example.com') + await expect(readDeploymentAuthToken({ token, resource })).resolves.toEqual({ + authenticatedEmail: 'person@example.com', + }) }) - it('revokes an exact-address email token as soon as that address is removed', () => { + it('accepts a rollout token without inventing an email identity', async () => { + const resource = { + id: 'share-1', + authType: 'email', + password: null, + allowedEmails: ['viewer@example.test'], + } + const token = withoutEncryptedEmailClaim(await mintToken(resource, 'viewer@example.test')) + + await expect(readDeploymentAuthToken({ token, resource })).resolves.toEqual({}) + }) + + it('revokes an exact-address email token as soon as that address is removed', async () => { const resource = { id: 'share-1', authType: 'email', password: null, allowedEmails: ['viewer@example.test', 'other@example.test'], } - const token = mintToken(resource, 'Viewer@Example.Test') + const token = await mintToken(resource, 'Viewer@Example.Test') - expect(validateAuthToken({ token, resource })).toBe(true) - expect( + await expect(validateAuthToken({ token, resource })).resolves.toBe(true) + await expect( validateAuthToken({ token, resource: { ...resource, allowedEmails: ['other@example.test'] }, }) - ).toBe(false) + ).resolves.toBe(false) }) - it('keeps an email token valid while its exact or domain grant remains current', () => { + it('keeps an email token valid while its exact or domain grant remains current', async () => { const resource = { id: 'share-1', authType: 'email', password: null, allowedEmails: ['viewer@example.test'], } - const token = mintToken(resource, 'viewer@example.test') + const token = await mintToken(resource, 'viewer@example.test') - expect( + await expect( validateAuthToken({ token, resource: { ...resource, allowedEmails: ['new@example.test', 'viewer@example.test'] }, }) - ).toBe(true) - expect( + ).resolves.toBe(true) + await expect( validateAuthToken({ token, resource: { ...resource, allowedEmails: ['@example.test'] }, }) - ).toBe(true) + ).resolves.toBe(true) }) - it('revokes a domain-granted token when the domain is removed', () => { + it('revokes a domain-granted token when the domain is removed', async () => { const resource = { id: 'share-1', authType: 'email', password: null, allowedEmails: ['@example.test'], } - const token = mintToken(resource, 'viewer@example.test') + const token = await mintToken(resource, 'viewer@example.test') - expect(validateAuthToken({ token, resource })).toBe(true) - expect( + await expect(validateAuthToken({ token, resource })).resolves.toBe(true) + await expect( validateAuthToken({ token, resource: { ...resource, allowedEmails: ['@other.test'] }, }) - ).toBe(false) - }) - - it('does not expose the verified email address in the signed payload', () => { - const token = mintToken( - { - id: 'share-1', - authType: 'email', - password: null, - allowedEmails: ['viewer@example.test'], - }, - 'viewer@example.test' - ) - const [encodedPayload] = token.split('.') - const decodedPayload = Buffer.from(encodedPayload, 'base64url').toString('utf8') - - expect(decodedPayload).not.toContain('viewer') - expect(decodedPayload).not.toContain('example.test') + ).resolves.toBe(false) }) - it('rejects expired, future-dated, malformed, and legacy tokens', () => { + it('rejects expired, future-dated, malformed, and legacy tokens', async () => { const now = 1_700_000_000_000 const nowSpy = vi.spyOn(Date, 'now').mockReturnValue(now) const resource = { @@ -134,33 +175,33 @@ describe('deployment auth tokens', () => { authType: 'password', password: 'encrypted-password-1', } - const token = mintToken(resource) + const token = await mintToken(resource) nowSpy.mockReturnValue(now + DAY_MS + 1) - expect(validateAuthToken({ token, resource })).toBe(false) + await expect(validateAuthToken({ token, resource })).resolves.toBe(false) nowSpy.mockReturnValue(now - 60_001) - expect(validateAuthToken({ token, resource })).toBe(false) - expect(validateAuthToken({ token: `${token}tampered`, resource })).toBe(false) - expect(validateAuthToken({ token: 'legacy-token', resource })).toBe(false) + await expect(validateAuthToken({ token, resource })).resolves.toBe(false) + await expect(validateAuthToken({ token: `${token}tampered`, resource })).resolves.toBe(false) + await expect(validateAuthToken({ token: 'legacy-token', resource })).resolves.toBe(false) }) - it('requires the credential that corresponds to the selected auth mode', () => { + it('requires the credential that corresponds to the selected auth mode', async () => { const response = NextResponse.json({}) - expect(() => + await expect( setDeploymentAuthCookie({ response, cookiePrefix: 'chat', resource: { id: 'chat-1', authType: 'email', allowedEmails: ['viewer@example.test'] }, }) - ).toThrow('verified email') - expect(() => + ).rejects.toThrow('verified email') + await expect( setDeploymentAuthCookie({ response, cookiePrefix: 'chat', resource: { id: 'chat-1', authType: 'password', password: null }, }) - ).toThrow('configured password') + ).rejects.toThrow('configured password') }) }) diff --git a/apps/sim/lib/core/security/deployment.ts b/apps/sim/lib/core/security/deployment.ts index b9bac6a739a..55c75aaf841 100644 --- a/apps/sim/lib/core/security/deployment.ts +++ b/apps/sim/lib/core/security/deployment.ts @@ -5,6 +5,7 @@ import { isValidEmailSyntax, normalizeEmail } from '@sim/utils/string' import type { NextResponse } from 'next/server' import { env } from '@/lib/core/config/env' import { isDev } from '@/lib/core/config/env-flags' +import { decryptSecret, encryptSecret } from '@/lib/core/security/encryption' const DEPLOYMENT_AUTH_TOKEN_VERSION = 1 const DEPLOYMENT_AUTH_TOKEN_TTL_MS = 24 * 60 * 60 * 1000 @@ -37,6 +38,7 @@ interface EmailAuthTokenPayload extends DeploymentAuthTokenBase { authType: 'email' emailSlot: string emailDomainSlot: string + encryptedEmail?: string } type DeploymentAuthTokenPayload = PasswordAuthTokenPayload | EmailAuthTokenPayload @@ -103,7 +105,10 @@ function emailGrants(allowedEmails: unknown): EmailGrant[] { return grants } -function generateAuthToken(resource: DeploymentAuthResource, verifiedEmail?: string): string { +async function generateAuthToken( + resource: DeploymentAuthResource, + verifiedEmail?: string +): Promise { const base = { version: DEPLOYMENT_AUTH_TOKEN_VERSION, resourceId: resource.id, @@ -124,10 +129,16 @@ function generateAuthToken(resource: DeploymentAuthResource, verifiedEmail?: str if (!verifiedEmail) { throw new Error('Cannot create email auth token without a verified email address') } + const normalizedEmail = normalizeEmail(verifiedEmail) + if (!isValidEmailSyntax(normalizedEmail)) { + throw new Error('Cannot create deployment auth token for an invalid email address') + } + const { encrypted: encryptedEmail } = await encryptSecret(normalizedEmail) payload = { ...base, authType: 'email', - ...emailIdentitySlots(verifiedEmail), + ...emailIdentitySlots(normalizedEmail), + encryptedEmail, } } else { throw new Error(`Cannot create auth token for unsupported auth type: ${resource.authType}`) @@ -158,7 +169,12 @@ function isDeploymentAuthTokenPayload(value: unknown): value is DeploymentAuthTo return isSha256Hex(payload.passwordSlot) } if (payload.authType === 'email') { - return isSha256Hex(payload.emailSlot) && isSha256Hex(payload.emailDomainSlot) + return ( + isSha256Hex(payload.emailSlot) && + isSha256Hex(payload.emailDomainSlot) && + (payload.encryptedEmail === undefined || + (typeof payload.encryptedEmail === 'string' && payload.encryptedEmail.length > 0)) + ) } return false } @@ -170,58 +186,89 @@ function isEmailTokenAllowed(payload: EmailAuthTokenPayload, allowedEmails: unkn }) } +export interface DeploymentAuthTokenClaims { + authenticatedEmail?: string +} + /** - * Validates a signed deployment cookie against the resource's current auth policy. - * Email tokens carry HMAC-derived identity slots so allow-list removals take effect - * immediately without exposing the verified address in the cookie. + * Validates a signed deployment cookie and recovers any confidential identity claim. + * Email identity remains encrypted in the cookie while its HMAC slots make current + * allow-list removals take effect immediately. Tokens minted before the encrypted + * claim was added remain valid but carry no workflow-visible identity. */ -export function validateAuthToken({ token, resource }: ValidateAuthTokenParams): boolean { +export async function readDeploymentAuthToken({ + token, + resource, +}: ValidateAuthTokenParams): Promise { try { const [encodedPayload, signature, extra] = token.split('.') - if (!encodedPayload || !signature || extra !== undefined) return false + if (!encodedPayload || !signature || extra !== undefined) return null const expectedSignature = signPayload(encodedPayload) - if (!safeCompare(signature, expectedSignature)) return false + if (!safeCompare(signature, expectedSignature)) return null const decoded: unknown = JSON.parse(Buffer.from(encodedPayload, 'base64url').toString('utf8')) - if (!isDeploymentAuthTokenPayload(decoded)) return false - if (decoded.resourceId !== resource.id || decoded.authType !== resource.authType) return false + if (!isDeploymentAuthTokenPayload(decoded)) return null + if (decoded.resourceId !== resource.id || decoded.authType !== resource.authType) return null const now = Date.now() if ( decoded.issuedAt > now + DEPLOYMENT_AUTH_TOKEN_CLOCK_SKEW_MS || now - decoded.issuedAt > DEPLOYMENT_AUTH_TOKEN_TTL_MS ) { - return false + return null } if (decoded.authType === 'password') { - return Boolean( - resource.password && safeCompare(decoded.passwordSlot, passwordSlot(resource.password)) - ) + if ( + !resource.password || + !safeCompare(decoded.passwordSlot, passwordSlot(resource.password)) + ) { + return null + } + return {} } - return isEmailTokenAllowed(decoded, resource.allowedEmails) + if (!isEmailTokenAllowed(decoded, resource.allowedEmails)) return null + if (!decoded.encryptedEmail) return {} + + const { decrypted } = await decryptSecret(decoded.encryptedEmail) + const authenticatedEmail = normalizeEmail(decrypted) + if (!isValidEmailSyntax(authenticatedEmail)) return null + + const slots = emailIdentitySlots(authenticatedEmail) + if ( + !safeCompare(decoded.emailSlot, slots.emailSlot) || + !safeCompare(decoded.emailDomainSlot, slots.emailDomainSlot) + ) { + return null + } + return { authenticatedEmail } } catch { - return false + return null } } +/** Validates a signed deployment cookie against the resource's current auth policy. */ +export async function validateAuthToken(params: ValidateAuthTokenParams): Promise { + return (await readDeploymentAuthToken(params)) !== null +} + /** Canonical auth cookie name for a deployed resource (`{kind}_auth_{id}`). */ export function deploymentAuthCookieName(cookiePrefix: DeploymentAuthKind, id: string): string { return `${cookiePrefix}_auth_${id}` } /** Sets a signed, resource-bound authentication cookie for a deployment. */ -export function setDeploymentAuthCookie({ +export async function setDeploymentAuthCookie({ response, cookiePrefix, resource, verifiedEmail, -}: SetDeploymentAuthCookieParams): void { +}: SetDeploymentAuthCookieParams): Promise { response.cookies.set({ name: deploymentAuthCookieName(cookiePrefix, resource.id), - value: generateAuthToken(resource, verifiedEmail), + value: await generateAuthToken(resource, verifiedEmail), httpOnly: true, secure: !isDev, sameSite: 'lax', diff --git a/apps/sim/lib/credential-groups/application/enrollment-operations.ts b/apps/sim/lib/credential-groups/application/enrollment-operations.ts index eb17a758bca..c34ed537056 100644 --- a/apps/sim/lib/credential-groups/application/enrollment-operations.ts +++ b/apps/sim/lib/credential-groups/application/enrollment-operations.ts @@ -34,6 +34,18 @@ export const credentialGroupEnrollmentOperations = { principalKind: 'credential_group_enrollment', }), // permission-group-exempt: the enrollment principal is a one-time credential-connect token, not a workspace member, so no permission group governs it + startMcpOAuth: defineCredentialGroupEnrollmentOperation({ + id: 'credential_groups.enrollment.mcp_oauth.start', + capability: 'none', + principalKind: 'credential_group_enrollment', + }), + // permission-group-exempt: the enrollment principal is a one-time credential-connect token, not a workspace member, so no permission group governs it + completeMcpOAuth: defineCredentialGroupEnrollmentOperation({ + id: 'credential_groups.enrollment.mcp_oauth.complete', + capability: 'none', + principalKind: 'credential_group_enrollment', + }), + // permission-group-exempt: the enrollment principal is a one-time credential-connect token, not a workspace member, so no permission group governs it complete: defineCredentialGroupEnrollmentOperation({ id: 'credential_groups.enrollment.complete', capability: 'none', diff --git a/apps/sim/lib/credential-groups/application/list-mcp-connections.test.ts b/apps/sim/lib/credential-groups/application/list-mcp-connections.test.ts new file mode 100644 index 00000000000..b543cafb4d8 --- /dev/null +++ b/apps/sim/lib/credential-groups/application/list-mcp-connections.test.ts @@ -0,0 +1,203 @@ +/** + * @vitest-environment node + */ +import type { SessionPrincipal, WorkflowExecutionDelegatedPrincipal } from '@sim/auth/principal' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + getWorkspaceOwnerSubscriptionAccess: vi.fn(), + listMcpConnections: vi.fn(), + loadGroup: vi.fn(), + loadWorkspace: vi.fn(), + resolveCredentialGroupsAvailability: vi.fn(), + resolvePermission: vi.fn(), +})) + +vi.mock('@/lib/billing/core/workspace-access', () => ({ + getWorkspaceOwnerSubscriptionAccess: mocks.getWorkspaceOwnerSubscriptionAccess, +})) + +vi.mock('@/lib/credential-groups/availability', () => ({ + resolveCredentialGroupsAvailability: mocks.resolveCredentialGroupsAvailability, +})) + +vi.mock('@/lib/credential-groups/credentials', () => ({ + loadCredentialGroupCredentialListContext: mocks.loadGroup, +})) + +vi.mock('@/lib/credential-groups/mcp-connections', () => ({ + CredentialGroupMcpConnectionCursorNotFoundError: class extends Error { + constructor() { + super('Credential group MCP connection cursor not found') + this.name = 'CredentialGroupMcpConnectionCursorNotFoundError' + } + }, + listCredentialGroupMcpConnectionReferences: mocks.listMcpConnections, + MAX_CREDENTIAL_GROUP_MCP_CONNECTION_PAGE_SIZE: 100, +})) + +vi.mock('@/lib/workspaces/application/workspace-context', () => ({ + loadActiveWorkspaceApplicationContext: mocks.loadWorkspace, +})) + +vi.mock('@sim/platform-authz/workspace', () => ({ + permissionSatisfies: (permission: string | null, required: string) => + permission === 'admin' || permission === 'write' || permission === required, + resolveEffectiveWorkspacePermission: mocks.resolvePermission, +})) + +import { listCredentialGroupMcpConnections } from '@/lib/credential-groups/application/list-mcp-connections' +import { CredentialGroupMcpConnectionCursorNotFoundError } from '@/lib/credential-groups/mcp-connections' + +const groupContext = { + credentialGroupId: 'group-1', + workspaceId: 'workspace-1', + name: 'Credential Group', + status: 'active' as const, + options: [], +} +const workspaceContext = { + workspaceId: 'workspace-1', + workspaceOrganizationId: null, + allowPersonalApiKeys: true, + billedAccountUserId: 'billing-owner-1', +} +const input = { credentialGroupId: 'group-1', limit: 50 } + +function executorPrincipal(credentialGroupId = 'group-1'): WorkflowExecutionDelegatedPrincipal { + return { + kind: 'delegated', + serviceId: 'executor', + subjectUserId: 'user-1', + workspaceId: 'workspace-1', + delegationId: 'delegation-1', + audience: 'sim:credential-groups', + issuedAt: new Date(Date.now() - 1_000), + expiresAt: new Date(Date.now() + 60_000), + resourceScope: { credentialGroupId }, + delegationContext: { + kind: 'workflow_execution', + workflowId: 'workflow-1', + principal: { kind: 'session', userId: 'user-1', sessionId: 'session-1' }, + currentWorkflow: { + workflowId: 'workflow-1', + mode: 'deployment', + deploymentVersionId: 'deployment-version-1', + }, + }, + } +} + +describe('listCredentialGroupMcpConnections', () => { + beforeEach(() => { + vi.clearAllMocks() + mocks.loadGroup.mockResolvedValue(groupContext) + mocks.loadWorkspace.mockResolvedValue(workspaceContext) + mocks.resolvePermission.mockResolvedValue('read') + mocks.getWorkspaceOwnerSubscriptionAccess.mockResolvedValue({ isEnterprise: true }) + mocks.resolveCredentialGroupsAvailability.mockResolvedValue({ available: true }) + mocks.listMcpConnections.mockResolvedValue({ + mcpConnections: [ + { + credentialId: 'mcp-cg-connection-1', + email: 'person@example.com', + displayName: 'Fireflies', + mcpServerId: 'mcp-server-1', + mcpServerName: 'Fireflies', + toolNames: ['list_transcripts'], + }, + ], + nextCursor: null, + }) + }) + + it('rejects unsupported principals before loading the group', async () => { + const principal: SessionPrincipal = { + kind: 'session', + userId: 'user-1', + sessionId: 'session-1', + } + + await expect( + listCredentialGroupMcpConnections.execute({ principal, input }) + ).rejects.toMatchObject({ code: 'forbidden' }) + expect(mocks.loadGroup).not.toHaveBeenCalled() + }) + + it('rejects executor delegation scoped to another group', async () => { + await expect( + listCredentialGroupMcpConnections.execute({ + principal: executorPrincipal('group-2'), + input, + }) + ).rejects.toMatchObject({ code: 'forbidden' }) + expect(mocks.listMcpConnections).not.toHaveBeenCalled() + }) + + it('lists bounded MCP connection references after authorization and entitlement checks', async () => { + const result = await listCredentialGroupMcpConnections.execute({ + principal: executorPrincipal(), + input: { + ...input, + email: ' Person@Example.COM ', + mcpServerId: ' mcp-server-1 ', + }, + }) + + expect(mocks.listMcpConnections).toHaveBeenCalledWith({ + workspaceId: 'workspace-1', + credentialGroupId: 'group-1', + limit: 50, + cursor: undefined, + email: 'person@example.com', + mcpServerId: 'mcp-server-1', + }) + expect(result).toEqual({ + mcpConnections: [ + { + credentialId: 'mcp-cg-connection-1', + email: 'person@example.com', + displayName: 'Fireflies', + mcpServerId: 'mcp-server-1', + mcpServerName: 'Fireflies', + toolNames: ['list_transcripts'], + }, + ], + count: 1, + hasMore: false, + nextCursor: null, + }) + }) + + it('rejects invalid filters before querying MCP connections', async () => { + await expect( + listCredentialGroupMcpConnections.execute({ + principal: executorPrincipal(), + input: { ...input, email: 'not-an-email' }, + }) + ).rejects.toMatchObject({ code: 'validation', message: 'Email must be a valid address' }) + expect(mocks.listMcpConnections).not.toHaveBeenCalled() + }) + + it('fails before listing when the group is disabled', async () => { + mocks.loadGroup.mockResolvedValue({ ...groupContext, status: 'disabled' }) + + await expect( + listCredentialGroupMcpConnections.execute({ principal: executorPrincipal(), input }) + ).rejects.toMatchObject({ code: 'conflict' }) + expect(mocks.listMcpConnections).not.toHaveBeenCalled() + }) + + it('classifies a stale or cross-group cursor as invalid input', async () => { + mocks.listMcpConnections.mockRejectedValueOnce( + new CredentialGroupMcpConnectionCursorNotFoundError() + ) + + await expect( + listCredentialGroupMcpConnections.execute({ + principal: executorPrincipal(), + input: { ...input, cursor: 'mcp-cg-other' }, + }) + ).rejects.toMatchObject({ code: 'validation' }) + }) +}) diff --git a/apps/sim/lib/credential-groups/application/list-mcp-connections.ts b/apps/sim/lib/credential-groups/application/list-mcp-connections.ts new file mode 100644 index 00000000000..4eda63879fe --- /dev/null +++ b/apps/sim/lib/credential-groups/application/list-mcp-connections.ts @@ -0,0 +1,87 @@ +import { isValidEmailSyntax, normalizeEmail } from '@sim/utils/string' +import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { credentialGroupDelegationPolicy } from '@/lib/credential-groups/application/authorization' +import { + requireCredentialGroupsAvailable, + resolveCredentialGroupContext, +} from '@/lib/credential-groups/application/context' +import { credentialGroupOperations } from '@/lib/credential-groups/application/operations' +import { + CredentialGroupMcpConnectionCursorNotFoundError, + type CredentialGroupMcpConnectionReference, + listCredentialGroupMcpConnectionReferences, + MAX_CREDENTIAL_GROUP_MCP_CONNECTION_PAGE_SIZE, +} from '@/lib/credential-groups/mcp-connections' + +export interface ListCredentialGroupMcpConnectionsInput { + credentialGroupId: string + limit: number + cursor?: string + email?: string + mcpServerId?: string +} + +export interface ListCredentialGroupMcpConnectionsResult { + mcpConnections: CredentialGroupMcpConnectionReference[] + count: number + hasMore: boolean + nextCursor: string | null +} + +export const listCredentialGroupMcpConnections = defineAuthorizedWorkspaceUseCase({ + operation: credentialGroupOperations.listMcpConnections, + resolveContext: ({ input }: { input: ListCredentialGroupMcpConnectionsInput }) => + resolveCredentialGroupContext(input.credentialGroupId), + authorizationOptions: { delegation: credentialGroupDelegationPolicy }, + execute: async ({ input, context }): Promise => { + if ( + !Number.isInteger(input.limit) || + input.limit < 1 || + input.limit > MAX_CREDENTIAL_GROUP_MCP_CONNECTION_PAGE_SIZE + ) { + throw new OrchestrationError( + 'validation', + `Limit must be an integer between 1 and ${MAX_CREDENTIAL_GROUP_MCP_CONNECTION_PAGE_SIZE}` + ) + } + if (context.status !== 'active') { + throw new OrchestrationError('conflict', 'Credential group is disabled') + } + + const email = input.email ? normalizeEmail(input.email) : undefined + if (email && !isValidEmailSyntax(email)) { + throw new OrchestrationError('validation', 'Email must be a valid address') + } + const mcpServerId = input.mcpServerId?.trim() + if (input.mcpServerId !== undefined && !mcpServerId) { + throw new OrchestrationError('validation', 'MCP server ID must not be empty') + } + + await requireCredentialGroupsAvailable(context.workspaceId) + + let page + try { + page = await listCredentialGroupMcpConnectionReferences({ + workspaceId: context.workspaceId, + credentialGroupId: context.credentialGroupId, + limit: input.limit, + cursor: input.cursor, + email, + mcpServerId, + }) + } catch (error) { + if (error instanceof CredentialGroupMcpConnectionCursorNotFoundError) { + throw new OrchestrationError('validation', error.message) + } + throw error + } + + return { + mcpConnections: page.mcpConnections, + count: page.mcpConnections.length, + hasMore: page.nextCursor !== null, + nextCursor: page.nextCursor, + } + }, +}) diff --git a/apps/sim/lib/credential-groups/application/manage-access.test.ts b/apps/sim/lib/credential-groups/application/manage-access.test.ts index b333ef02b0c..f5cceaadf7d 100644 --- a/apps/sim/lib/credential-groups/application/manage-access.test.ts +++ b/apps/sim/lib/credential-groups/application/manage-access.test.ts @@ -10,7 +10,7 @@ import { credentialGroupWorkflowAccessPolicyCodec, decodeCredentialGroupWorkflowAccessPolicy, } from '@/lib/credential-groups/application/workflow-access-policy' -import { CREDENTIAL_GROUP_WORKFLOW_CATALOG_LIMIT } from '@/lib/credential-groups/workflow-access-limits' +import { CREDENTIAL_GROUP_WORKFLOW_CATALOG_LIMIT } from '@/lib/credential-groups/limits' const mocks = vi.hoisted(() => ({ requirePolicy: vi.fn(), diff --git a/apps/sim/lib/credential-groups/application/manage-access.ts b/apps/sim/lib/credential-groups/application/manage-access.ts index dbbbcd63c69..cdb3b5e03f1 100644 --- a/apps/sim/lib/credential-groups/application/manage-access.ts +++ b/apps/sim/lib/credential-groups/application/manage-access.ts @@ -17,7 +17,7 @@ import { import { CREDENTIAL_GROUP_WORKFLOW_CATALOG_LIMIT, CREDENTIAL_GROUP_WORKFLOW_NAME_MAX_LENGTH, -} from '@/lib/credential-groups/workflow-access-limits' +} from '@/lib/credential-groups/limits' import { ResourcePolicyRevisionConflictError, requireResourcePolicy, diff --git a/apps/sim/lib/credential-groups/application/manage-enrollments.ts b/apps/sim/lib/credential-groups/application/manage-enrollments.ts index b4220f4a18c..970a98d74b3 100644 --- a/apps/sim/lib/credential-groups/application/manage-enrollments.ts +++ b/apps/sim/lib/credential-groups/application/manage-enrollments.ts @@ -14,6 +14,7 @@ import { loadCredentialGroupInviterIdentity, resendCredentialGroupEnrollment, } from '@/lib/credential-groups/enrollments' +import { mcpService } from '@/lib/mcp/service' interface CredentialGroupEnrollmentSettingsInput { assertedWorkspaceId: string @@ -122,12 +123,11 @@ export const deleteCredentialGroupEnrollmentSettings = defineAuthorizedWorkspace async execute({ input, context }) { await requireCredentialGroupSettingsAvailable(context.workspaceId) try { - const credentialGroupEnrollment = await deleteCredentialGroupEnrollment( + return await deleteCredentialGroupEnrollment( context.workspaceId, context.credentialGroupId, input.enrollmentId ) - return { credentialGroupEnrollment } } catch (error) { normalizeEnrollmentError(error) } @@ -140,4 +140,10 @@ export const deleteCredentialGroupEnrollmentSettings = defineAuthorizedWorkspace description: `Deleted ${result.credentialGroupEnrollment.email} from the Credential Group`, metadata: { enrollmentId: result.credentialGroupEnrollment.id }, }), + afterSuccess: ({ result }) => + Promise.all( + result.retiredMcpConnectionIds.map((connectionId) => + mcpService.evictServerConnections(connectionId, 'credential_group_enrollment_deleted') + ) + ).then(() => undefined), }) diff --git a/apps/sim/lib/credential-groups/application/manage-groups.ts b/apps/sim/lib/credential-groups/application/manage-groups.ts index 3825bf52b69..2ab02cb8528 100644 --- a/apps/sim/lib/credential-groups/application/manage-groups.ts +++ b/apps/sim/lib/credential-groups/application/manage-groups.ts @@ -17,6 +17,7 @@ import { CredentialGroupEnrollmentError, listCredentialGroupEnrollments, } from '@/lib/credential-groups/enrollments' +import { clearCredentialGroupMcpOAuthAttempts } from '@/lib/credential-groups/mcp-oauth-state' import { listConfiguredCredentialGroupProviders } from '@/lib/credential-groups/provider-availability' import { createCredentialGroup, @@ -29,6 +30,8 @@ import type { CreateCredentialGroupInput, UpdateCredentialGroupInput, } from '@/lib/credential-groups/types' +import { evictMcpServerConnections } from '@/lib/mcp/connection-pool' +import { mcpService } from '@/lib/mcp/service' function throwCredentialGroupConflict(error: unknown): never { if (getPostgresErrorCode(error) === '23505') { @@ -137,15 +140,15 @@ export const updateCredentialGroupSettings = defineAuthorizedWorkspaceUseCase({ async execute({ input, context }) { await requireCredentialGroupSettingsAvailable(context.workspaceId) try { - const credentialGroup = await updateCredentialGroup( + const result = await updateCredentialGroup( context.workspaceId, context.credentialGroupId, validateUpdateCredentialGroupInput(input.update) ) - if (!credentialGroup) { + if (!result) { throw new OrchestrationError('not_found', 'Credential group not found') } - return { credentialGroup } + return result } catch (error) { throwCredentialGroupConflict(error) } @@ -157,6 +160,12 @@ export const updateCredentialGroupSettings = defineAuthorizedWorkspaceUseCase({ resourceName: result.credentialGroup.name, description: 'Updated a Credential Group', }), + afterSuccess: ({ result }) => + Promise.all( + result.retiredMcpConnectionIds.map((connectionId) => + evictMcpServerConnections(connectionId, 'credential_group_mcp_unlinked') + ) + ).then(() => undefined), }) export const deleteCredentialGroupSettings = defineAuthorizedWorkspaceUseCase({ @@ -166,9 +175,13 @@ export const deleteCredentialGroupSettings = defineAuthorizedWorkspaceUseCase({ authorizationOptions: {}, async execute({ context }) { await requireCredentialGroupSettingsAvailable(context.workspaceId) - const deleted = await deleteCredentialGroup(context.workspaceId, context.credentialGroupId) - if (!deleted) throw new OrchestrationError('not_found', 'Credential group not found') - return { success: true as const } + const result = await deleteCredentialGroup(context.workspaceId, context.credentialGroupId) + if (!result.deleted) throw new OrchestrationError('not_found', 'Credential group not found') + return { + success: true as const, + retiredMcpConnectionIds: result.retiredMcpConnectionIds, + retiredMcpServerIds: result.retiredMcpServerIds, + } }, projectAudit: ({ context }) => ({ action: AuditAction.CREDENTIAL_GROUP_UPDATED, @@ -177,4 +190,16 @@ export const deleteCredentialGroupSettings = defineAuthorizedWorkspaceUseCase({ resourceName: context.name, description: 'Deleted a Credential Group', }), + async afterSuccess({ context, result }) { + await mcpService.clearCache(context.workspaceId) + await clearCredentialGroupMcpOAuthAttempts(result.retiredMcpServerIds) + await Promise.all([ + ...result.retiredMcpServerIds.map((serverId) => + evictMcpServerConnections(serverId, 'credential_group_deleted') + ), + ...result.retiredMcpConnectionIds.map((connectionId) => + evictMcpServerConnections(connectionId, 'credential_group_deleted') + ), + ]) + }, }) diff --git a/apps/sim/lib/credential-groups/application/manage-mcp-connectors.ts b/apps/sim/lib/credential-groups/application/manage-mcp-connectors.ts new file mode 100644 index 00000000000..e2974b868be --- /dev/null +++ b/apps/sim/lib/credential-groups/application/manage-mcp-connectors.ts @@ -0,0 +1,165 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { + requireCredentialGroupSettingsAvailable, + resolveCredentialGroupSettingsContext, +} from '@/lib/credential-groups/application/context' +import { credentialGroupOperations } from '@/lib/credential-groups/application/operations' +import type { ManagedMcpConnectorId } from '@/lib/credential-groups/managed-mcp-connectors' +import { + type CreateManagedMcpConnectorInput, + createManagedMcpConnector, + deleteManagedMcpConnector, + ManagedMcpConnectorError, + type UpdateManagedMcpConnectorInput, + updateManagedMcpConnector, +} from '@/lib/credential-groups/managed-mcp-service' +import { clearCredentialGroupMcpOAuthAttempts } from '@/lib/credential-groups/mcp-oauth-state' +import { evictMcpServerConnections } from '@/lib/mcp/connection-pool' +import { mcpService } from '@/lib/mcp/service' + +interface ManagedMcpConnectorTargetInput { + assertedWorkspaceId: string + credentialGroupId: string +} + +function projectManagedMcpConnectorError(error: unknown): never { + if (error instanceof ManagedMcpConnectorError) { + throw new OrchestrationError( + error.code === 'bad_gateway' ? 'validation' : error.code, + error.message + ) + } + throw error +} + +async function applyManagedMcpConnectorEffects(params: { + workspaceId: string + serverIds: string[] + connectionIds: string[] + reason: string +}): Promise { + await mcpService.clearCache(params.workspaceId) + await clearCredentialGroupMcpOAuthAttempts(params.serverIds) + await Promise.all([ + ...params.serverIds.map((serverId) => evictMcpServerConnections(serverId, params.reason)), + ...params.connectionIds.map((connectionId) => + evictMcpServerConnections(connectionId, params.reason) + ), + ]) +} + +export interface CreateCredentialGroupMcpConnectorInput extends ManagedMcpConnectorTargetInput { + connector: CreateManagedMcpConnectorInput +} + +export const createCredentialGroupMcpConnector = defineAuthorizedWorkspaceUseCase({ + operation: credentialGroupOperations.createMcpConnector, + resolveContext: ({ input }: { input: CreateCredentialGroupMcpConnectorInput }) => + resolveCredentialGroupSettingsContext(input.credentialGroupId, input.assertedWorkspaceId), + authorizationOptions: {}, + async execute({ principal, input, context }) { + await requireCredentialGroupSettingsAvailable(context.workspaceId) + try { + return await createManagedMcpConnector({ + workspaceId: context.workspaceId, + credentialGroupId: context.credentialGroupId, + userId: principal.userId, + input: input.connector, + }) + } catch (error) { + projectManagedMcpConnectorError(error) + } + }, + projectAudit: ({ result }) => ({ + action: AuditAction.MCP_SERVER_ADDED, + resourceType: AuditResourceType.MCP_SERVER, + resourceId: result.mcpServer.id, + resourceName: result.mcpServer.name, + description: `Added managed MCP connector "${result.mcpServer.name}"`, + }), + afterSuccess: ({ context, result }) => + applyManagedMcpConnectorEffects({ + workspaceId: context.workspaceId, + serverIds: [], + connectionIds: [], + reason: 'managed connector added', + }), +}) + +export interface UpdateCredentialGroupMcpConnectorInput extends ManagedMcpConnectorTargetInput { + connectorId: ManagedMcpConnectorId + update: UpdateManagedMcpConnectorInput +} + +export const updateCredentialGroupMcpConnector = defineAuthorizedWorkspaceUseCase({ + operation: credentialGroupOperations.updateMcpConnector, + resolveContext: ({ input }: { input: UpdateCredentialGroupMcpConnectorInput }) => + resolveCredentialGroupSettingsContext(input.credentialGroupId, input.assertedWorkspaceId), + authorizationOptions: {}, + async execute({ input, context }) { + await requireCredentialGroupSettingsAvailable(context.workspaceId) + try { + return await updateManagedMcpConnector({ + workspaceId: context.workspaceId, + credentialGroupId: context.credentialGroupId, + connectorId: input.connectorId, + input: input.update, + }) + } catch (error) { + projectManagedMcpConnectorError(error) + } + }, + projectAudit: ({ result }) => ({ + action: AuditAction.MCP_SERVER_UPDATED, + resourceType: AuditResourceType.MCP_SERVER, + resourceId: result.mcpServer.id, + resourceName: result.mcpServer.name, + description: `Updated managed MCP connector "${result.mcpServer.name}"`, + }), + afterSuccess: ({ context, result }) => + applyManagedMcpConnectorEffects({ + workspaceId: context.workspaceId, + serverIds: result.resetMcpServerIds, + connectionIds: result.retiredMcpConnectionIds, + reason: 'managed connector configuration changed', + }), +}) + +export interface DeleteCredentialGroupMcpConnectorInput extends ManagedMcpConnectorTargetInput { + connectorId: ManagedMcpConnectorId +} + +export const deleteCredentialGroupMcpConnector = defineAuthorizedWorkspaceUseCase({ + operation: credentialGroupOperations.deleteMcpConnector, + resolveContext: ({ input }: { input: DeleteCredentialGroupMcpConnectorInput }) => + resolveCredentialGroupSettingsContext(input.credentialGroupId, input.assertedWorkspaceId), + authorizationOptions: {}, + async execute({ input, context }) { + await requireCredentialGroupSettingsAvailable(context.workspaceId) + try { + return await deleteManagedMcpConnector({ + workspaceId: context.workspaceId, + credentialGroupId: context.credentialGroupId, + connectorId: input.connectorId, + }) + } catch (error) { + projectManagedMcpConnectorError(error) + } + }, + projectAudit: ({ result }) => ({ + action: AuditAction.MCP_SERVER_REMOVED, + resourceType: AuditResourceType.MCP_SERVER, + resourceId: result.mcpServer.id, + resourceName: result.mcpServer.name, + description: `Removed managed MCP connector "${result.mcpServer.name}"`, + }), + afterSuccess: ({ context, result }) => + applyManagedMcpConnectorEffects({ + workspaceId: context.workspaceId, + serverIds: result.serverIds, + connectionIds: result.retiredMcpConnectionIds, + reason: 'managed connector removed', + }), +}) diff --git a/apps/sim/lib/credential-groups/application/operations.ts b/apps/sim/lib/credential-groups/application/operations.ts index 409920b039e..633a7689349 100644 --- a/apps/sim/lib/credential-groups/application/operations.ts +++ b/apps/sim/lib/credential-groups/application/operations.ts @@ -72,6 +72,30 @@ export const credentialGroupOperations = { principalKinds: ['session'], }), // permission-group-exempt: workspace admin already decides this, and no group key names the credential-groups section + createMcpConnector: defineWorkspaceOperation({ + id: 'credential_groups.mcp_connectors.create', + minimumRole: 'admin', + workspaceApiKey: 'deny', + capability: 'none', + principalKinds: ['session'], + }), + // permission-group-exempt: workspace admin already decides this, and no group key names the credential-groups section + updateMcpConnector: defineWorkspaceOperation({ + id: 'credential_groups.mcp_connectors.update', + minimumRole: 'admin', + workspaceApiKey: 'deny', + capability: 'none', + principalKinds: ['session'], + }), + // permission-group-exempt: workspace admin already decides this, and no group key names the credential-groups section + deleteMcpConnector: defineWorkspaceOperation({ + id: 'credential_groups.mcp_connectors.delete', + minimumRole: 'admin', + workspaceApiKey: 'deny', + capability: 'none', + principalKinds: ['session'], + }), + // permission-group-exempt: workspace admin already decides this, and no group key names the credential-groups section inviteBatch: defineWorkspaceOperation({ id: 'credential_groups.invites.send_batch', minimumRole: 'admin', @@ -104,6 +128,15 @@ export const credentialGroupOperations = { principalKinds: ['delegated'], delegatedServices: ['executor'], }), + // permission-group-exempt: read by the executor to resolve an enrolled person's MCP connection; use is enforced by the Credential Group policy + listMcpConnections: defineWorkspaceOperation({ + id: 'credential_groups.mcp_connections.list', + minimumRole: 'read', + workspaceApiKey: 'deny', + capability: 'none', + principalKinds: ['delegated'], + delegatedServices: ['executor'], + }), // permission-group-exempt: read by the executor to resolve an enrolled person's credential; the group's enrollment rows are the gate, and no group key names them listGroups: defineWorkspaceOperation({ id: 'credential_groups.list', diff --git a/apps/sim/lib/credential-groups/application/public-enrollment.test.ts b/apps/sim/lib/credential-groups/application/public-enrollment.test.ts index f6cc790ef10..3a023ed69ea 100644 --- a/apps/sim/lib/credential-groups/application/public-enrollment.test.ts +++ b/apps/sim/lib/credential-groups/application/public-enrollment.test.ts @@ -10,16 +10,24 @@ const mocks = vi.hoisted(() => ({ completeOAuth: vi.fn(), fireTrigger: vi.fn(), getEnrollment: vi.fn(), + getMcpOAuthContext: vi.fn(), getOAuthContext: vi.fn(), + startMcpOAuth: vi.fn(), startOAuth: vi.fn(), })) vi.mock('@/lib/credential-groups/enrollments', () => ({ completeAuthorizedCredentialGroupEnrollment: mocks.completeEnrollment, + getAuthorizedCredentialGroupMcpOAuthContext: mocks.getMcpOAuthContext, getAuthorizedCredentialGroupOAuthContext: mocks.getOAuthContext, getAuthorizedPublicCredentialGroupEnrollment: mocks.getEnrollment, })) +vi.mock('@/lib/credential-groups/mcp-oauth', () => ({ + completeCredentialGroupMcpOAuth: vi.fn(), + startCredentialGroupMcpOAuth: mocks.startMcpOAuth, +})) + vi.mock('@/lib/credential-groups/oauth', () => ({ completeCredentialGroupOAuth: mocks.completeOAuth, startCredentialGroupOAuth: mocks.startOAuth, @@ -33,6 +41,7 @@ import { completePublicCredentialGroupEnrollment, completePublicCredentialGroupOAuth, readPublicCredentialGroupEnrollment, + startPublicCredentialGroupMcpOAuth, startPublicCredentialGroupOAuth, } from '@/lib/credential-groups/application/public-enrollment' @@ -90,7 +99,13 @@ describe('public Credential Group enrollment application operations', () => { displayName: 'person@example.com', enrollmentStatus: 'in_progress', }) + mocks.getMcpOAuthContext.mockResolvedValue({ + enrollmentId: 'enrollment-1', + credentialGroupId: 'group-1', + server: { id: 'mcp-server-1' }, + }) mocks.startOAuth.mockResolvedValue('https://accounts.example/authorize') + mocks.startMcpOAuth.mockResolvedValue('https://mcp.example/authorize') }) it('rejects a workspace session before resolving invitation data', async () => { @@ -147,6 +162,30 @@ describe('public Credential Group enrollment application operations', () => { expect(result).toEqual({ authorizationUrl: 'https://accounts.example/authorize' }) }) + it('rejects a substituted bearer before creating managed MCP state', async () => { + await expect( + startPublicCredentialGroupMcpOAuth.execute({ + principal, + input: { invitationToken: 'different-token', mcpServerId: 'mcp-server-1' }, + }) + ).rejects.toMatchObject({ code: 'not_found' }) + expect(mocks.startMcpOAuth).not.toHaveBeenCalled() + }) + + it('starts managed MCP OAuth only for a server linked to the current invitation', async () => { + const result = await startPublicCredentialGroupMcpOAuth.execute({ + principal, + input: { invitationToken, mcpServerId: 'mcp-server-1' }, + }) + + expect(mocks.getMcpOAuthContext).toHaveBeenCalledWith(identity, 'mcp-server-1') + expect(mocks.startMcpOAuth).toHaveBeenCalledWith( + expect.objectContaining({ server: { id: 'mcp-server-1' } }), + invitationToken + ) + expect(result).toEqual({ authorizationUrl: 'https://mcp.example/authorize' }) + }) + it('fires form submitted only for the first completion transition', async () => { mocks.completeEnrollment.mockResolvedValue({ completed: true, transitioned: true }) diff --git a/apps/sim/lib/credential-groups/application/public-enrollment.ts b/apps/sim/lib/credential-groups/application/public-enrollment.ts index 5b3023aad8f..a8d50fa48e7 100644 --- a/apps/sim/lib/credential-groups/application/public-enrollment.ts +++ b/apps/sim/lib/credential-groups/application/public-enrollment.ts @@ -6,10 +6,16 @@ import { OrchestrationError } from '@/lib/core/orchestration/types' import { credentialGroupEnrollmentOperations } from '@/lib/credential-groups/application/enrollment-operations' import { completeAuthorizedCredentialGroupEnrollment, + getAuthorizedCredentialGroupMcpOAuthContext, getAuthorizedCredentialGroupOAuthContext, getAuthorizedPublicCredentialGroupEnrollment, type PublicCredentialGroupEnrollmentIdentity, } from '@/lib/credential-groups/enrollments' +import { + completeCredentialGroupMcpOAuth, + startCredentialGroupMcpOAuth, +} from '@/lib/credential-groups/mcp-oauth' +import type { CredentialGroupMcpOAuthAttempt } from '@/lib/credential-groups/mcp-oauth-state' import { completeCredentialGroupOAuth, startCredentialGroupOAuth, @@ -214,3 +220,60 @@ export const completePublicCredentialGroupOAuth = defineAuthorizedCredentialGrou return { connectedOptionId: context.oauth.option.id } }, }) + +interface PublicCredentialGroupMcpOAuthInput { + invitationToken: string + mcpServerId: string +} + +interface PublicCredentialGroupMcpOAuthContext extends PublicCredentialGroupEnrollmentIdentity { + oauth: NonNullable>> +} + +async function resolvePublicMcpOAuthContext( + principal: CredentialGroupEnrollmentPrincipal, + mcpServerId: string +): Promise { + const identity = identityFromPrincipal(principal) + const oauth = await getAuthorizedCredentialGroupMcpOAuthContext(identity, mcpServerId) + if (!oauth) throw new OrchestrationError('not_found', 'Invitation is invalid or expired') + return { ...identity, oauth } +} + +export const startPublicCredentialGroupMcpOAuth = defineAuthorizedCredentialGroupEnrollmentUseCase({ + operation: credentialGroupEnrollmentOperations.startMcpOAuth, + resolveContext: ({ + principal, + input, + }: { + principal: CredentialGroupEnrollmentPrincipal + input: PublicCredentialGroupMcpOAuthInput + }) => resolvePublicMcpOAuthContext(principal, input.mcpServerId), + async execute({ principal, input, context }) { + requireInvitationToken(principal, input.invitationToken) + return { + authorizationUrl: await startCredentialGroupMcpOAuth(context.oauth, input.invitationToken), + } + }, +}) + +interface CompletePublicCredentialGroupMcpOAuthInput { + attempt: CredentialGroupMcpOAuthAttempt + code: string +} + +export const completePublicCredentialGroupMcpOAuth = + defineAuthorizedCredentialGroupEnrollmentUseCase({ + operation: credentialGroupEnrollmentOperations.completeMcpOAuth, + resolveContext: ({ + principal, + input, + }: { + principal: CredentialGroupEnrollmentPrincipal + input: CompletePublicCredentialGroupMcpOAuthInput + }) => resolvePublicMcpOAuthContext(principal, input.attempt.mcpServerId), + async execute({ principal, input, context }) { + requireInvitationToken(principal, input.attempt.invitationToken) + return completeCredentialGroupMcpOAuth(context.oauth, input.attempt.codeVerifier, input.code) + }, + }) diff --git a/apps/sim/lib/credential-groups/application/workflow-access-policy.test.ts b/apps/sim/lib/credential-groups/application/workflow-access-policy.test.ts index abd5feb5c50..151608c4f6c 100644 --- a/apps/sim/lib/credential-groups/application/workflow-access-policy.test.ts +++ b/apps/sim/lib/credential-groups/application/workflow-access-policy.test.ts @@ -10,7 +10,7 @@ import { evaluateCredentialGroupWorkflowAccess, requireDefaultCredentialGroupWorkflowAccessPolicy, } from '@/lib/credential-groups/application/workflow-access-policy' -import { CREDENTIAL_GROUP_WORKFLOW_ACCESS_LIMIT } from '@/lib/credential-groups/workflow-access-limits' +import { CREDENTIAL_GROUP_WORKFLOW_ACCESS_LIMIT } from '@/lib/credential-groups/limits' import type { ResourcePolicyBindingFor } from '@/lib/resource-policies/registry' const GROUP_ID = 'group-1' diff --git a/apps/sim/lib/credential-groups/application/workflow-access-policy.ts b/apps/sim/lib/credential-groups/application/workflow-access-policy.ts index f0e3248ceac..29faac88e46 100644 --- a/apps/sim/lib/credential-groups/application/workflow-access-policy.ts +++ b/apps/sim/lib/credential-groups/application/workflow-access-policy.ts @@ -1,6 +1,6 @@ import type { WorkflowExecutionAuthority } from '@sim/auth/principal' import { z } from 'zod' -import { CREDENTIAL_GROUP_WORKFLOW_ACCESS_LIMIT } from '@/lib/credential-groups/workflow-access-limits' +import { CREDENTIAL_GROUP_WORKFLOW_ACCESS_LIMIT } from '@/lib/credential-groups/limits' import { CREDENTIAL_GROUP_ACTOR_OWNS_CREDENTIAL_CONDITION_KEY } from '@/lib/resource-policies/conditions' import { WORKFLOW_MODE_RESOURCE_POLICY_CONDITION_KEY } from '@/lib/resource-policies/conditions/workflow-mode' import { diff --git a/apps/sim/lib/credential-groups/credentials.test.ts b/apps/sim/lib/credential-groups/credentials.test.ts index 02e5195908a..98077cea353 100644 --- a/apps/sim/lib/credential-groups/credentials.test.ts +++ b/apps/sim/lib/credential-groups/credentials.test.ts @@ -90,6 +90,16 @@ describe('listCredentialGroupCredentialReferences', () => { ).resolves.toEqual({ enrollmentId: 'enrollment-1', email: 'person@example.com' }) }) + it('does not treat a chat-authenticated email as Credential Group enrollment access', async () => { + await expect( + loadCredentialGroupEnrollmentAccessForSubject('group-1', { + kind: 'authenticated_email', + email: 'person@example.com', + }) + ).resolves.toBeNull() + expect(dbChainMockFns.select).not.toHaveBeenCalled() + }) + it('fails fast when one external subject resolves to multiple enrollments', async () => { dbChainMockFns.limit.mockResolvedValueOnce([ { enrollmentId: 'enrollment-1', email: 'first@example.com' }, diff --git a/apps/sim/lib/credential-groups/credentials.ts b/apps/sim/lib/credential-groups/credentials.ts index 1ffe32740af..15d20929d5a 100644 --- a/apps/sim/lib/credential-groups/credentials.ts +++ b/apps/sim/lib/credential-groups/credentials.ts @@ -86,6 +86,7 @@ export async function loadCredentialGroupEnrollmentAccessForSubject( if (subject.kind === 'sim_user') { return loadCredentialGroupEnrollmentAccess(credentialGroupId, subject.userId) } + if (subject.kind !== 'external_user') return null if (!isCredentialGroupProvider(subject.provider)) return null const providerId = getCredentialGroupProviderId(subject.provider) const rows = await db diff --git a/apps/sim/lib/credential-groups/enrollments.test.ts b/apps/sim/lib/credential-groups/enrollments.test.ts index 48657895ca4..6424f0e1c17 100644 --- a/apps/sim/lib/credential-groups/enrollments.test.ts +++ b/apps/sim/lib/credential-groups/enrollments.test.ts @@ -331,12 +331,14 @@ describe('deleteCredentialGroupEnrollment', () => { }) it('deletes the enrollment and lets its foreign-key cascade remove managed credentials', async () => { - dbChainMockFns.limit.mockResolvedValueOnce([{ email: ENROLLMENT.email }]) + queueTableRows(schemaMock.credentialGroupEnrollment, [{ email: ENROLLMENT.email }]) + queueTableRows(schemaMock.credential, [{ id: 'mcp-cg-connection-1' }]) dbChainMockFns.returning.mockResolvedValueOnce([ENROLLMENT]) const result = await deleteCredentialGroupEnrollment('workspace-1', 'group-1', ENROLLMENT.id) - expect(result.id).toBe(ENROLLMENT.id) + expect(result.credentialGroupEnrollment.id).toBe(ENROLLMENT.id) + expect(result.retiredMcpConnectionIds).toEqual(['mcp-cg-connection-1']) expect(dbChainMockFns.update).not.toHaveBeenCalled() expect(dbChainMockFns.delete).toHaveBeenCalledOnce() expect(dbChainMockFns.delete).toHaveBeenCalledWith(schemaMock.credentialGroupEnrollment) diff --git a/apps/sim/lib/credential-groups/enrollments.ts b/apps/sim/lib/credential-groups/enrollments.ts index f4579c77026..a22ac3fd42a 100644 --- a/apps/sim/lib/credential-groups/enrollments.ts +++ b/apps/sim/lib/credential-groups/enrollments.ts @@ -4,6 +4,7 @@ import { credential, credentialGroup, credentialGroupEnrollment, + mcpServers, user, workspace, } from '@sim/db/schema' @@ -11,12 +12,14 @@ import { sha256Hex } from '@sim/security/hash' import { getErrorMessage } from '@sim/utils/errors' import { generateId } from '@sim/utils/id' import { normalizeEmail, truncate } from '@sim/utils/string' -import { and, count, desc, eq, inArray, lt, or, sql } from 'drizzle-orm' +import { and, asc, count, desc, eq, inArray, isNull, lt, or, sql } from 'drizzle-orm' import { renderCredentialGroupInvitationEmail } from '@/components/emails/credential-groups/render' import { getCredentialGroupInvitationSubject } from '@/components/emails/subjects' import { getWorkspaceOwnerSubscriptionAccess } from '@/lib/billing/core/workspace-access' import { getBaseUrl } from '@/lib/core/utils/urls' import { isCredentialGroupsAvailable } from '@/lib/credential-groups/availability' +import type { ManagedMcpConnectorId } from '@/lib/credential-groups/managed-mcp-connectors' +import { getManagedMcpConnector } from '@/lib/credential-groups/managed-mcp-connectors' import { getCredentialGroupProviderAdapter } from '@/lib/credential-groups/provider-registry' import type { CredentialGroupProvider } from '@/lib/credential-groups/providers' import { @@ -27,6 +30,7 @@ import { import type { CredentialGroupEnrollmentConnection, CredentialGroupEnrollmentDetail, + CredentialGroupEnrollmentMcpConnection, CredentialGroupEnrollmentRecord, InviteCredentialGroupEnrollmentsInput, } from '@/lib/credential-groups/types' @@ -88,6 +92,17 @@ export interface PublicCredentialGroupEnrollment { }> } > + mcpServers: Array<{ + id: string + name: string + description: string | null + managedConnectorId: ManagedMcpConnectorId + connection: { + id: string + status: 'connected' | 'needs_reauth' | 'revoked' + grantedAt: string + } | null + }> status: CredentialGroupEnrollmentRecord['status'] } @@ -104,6 +119,19 @@ export interface CredentialGroupOAuthContext { options: CredentialGroupOptionConfig[] } +export interface CredentialGroupMcpOAuthContext { + enrollmentId: string + credentialGroupId: string + workspaceId: string + email: string + enrollmentStatus: EnrollmentRow['status'] + server: { + id: string + name: string + url: string + } +} + export interface PublicCredentialGroupEnrollmentIdentity { enrollmentId: string credentialGroupId: string @@ -330,7 +358,25 @@ async function getInvitationContext( throw new CredentialGroupEnrollmentError('Credential group is disabled', 409) } if (!row.options.some((option) => option.status === 'active')) { - throw new CredentialGroupEnrollmentError('Add an account type before inviting people', 409) + const [linkedMcpServer] = await db + .select({ id: mcpServers.id }) + .from(mcpServers) + .where( + and( + eq(mcpServers.workspaceId, workspaceId), + eq(mcpServers.credentialGroupId, groupId), + eq(mcpServers.authType, 'oauth'), + eq(mcpServers.enabled, true), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + if (!linkedMcpServer) { + throw new CredentialGroupEnrollmentError( + 'Add an account type or OAuth MCP server before inviting people', + 409 + ) + } } return row } @@ -526,6 +572,19 @@ export async function listCredentialGroupEnrollments( const activeOptionIds = group.options .filter((option) => option.status === 'active') .map((option) => option.id) + const activeMcpServers = await db + .select({ id: mcpServers.id, name: mcpServers.name }) + .from(mcpServers) + .where( + and( + eq(mcpServers.workspaceId, workspaceId), + eq(mcpServers.credentialGroupId, groupId), + eq(mcpServers.authType, 'oauth'), + eq(mcpServers.enabled, true), + isNull(mcpServers.deletedAt) + ) + ) + const activeMcpServerById = new Map(activeMcpServers.map((server) => [server.id, server])) const cursorPosition = cursor ? decodeCredentialGroupEnrollmentCursor(cursor) : undefined @@ -585,6 +644,31 @@ export async function listCredentialGroupEnrollments( if (connectionRows.length > connectionSummaryLimit) { throw new Error('Managed credential connection summaries exceed the supported provider states') } + const mcpConnectionSummaryLimit = enrollmentIds.length * activeMcpServers.length + const mcpConnectionRows = + enrollmentIds.length === 0 || activeMcpServers.length === 0 + ? [] + : await db + .select({ + enrollmentId: credential.credentialGroupEnrollmentId, + mcpServerId: credential.mcpServerId, + status: credential.managedOauthStatus, + }) + .from(credential) + .where( + and( + eq(credential.type, 'managed_mcp'), + inArray(credential.credentialGroupEnrollmentId, enrollmentIds), + inArray( + credential.mcpServerId, + activeMcpServers.map((server) => server.id) + ) + ) + ) + .limit(mcpConnectionSummaryLimit + 1) + if (mcpConnectionRows.length > mcpConnectionSummaryLimit) { + throw new Error('Managed MCP connection summaries exceed the linked server limit') + } const connectionsByEnrollment = new Map() for (const connection of connectionRows) { if (!connection.enrollmentId) { @@ -599,6 +683,22 @@ export async function listCredentialGroupEnrollments( if (current) current.push(summary) else connectionsByEnrollment.set(connection.enrollmentId, [summary]) } + const mcpConnectionsByEnrollment = new Map() + for (const connection of mcpConnectionRows) { + if (!connection.enrollmentId || !connection.mcpServerId) { + throw new Error('Managed MCP credential source is missing') + } + const server = activeMcpServerById.get(connection.mcpServerId) + if (!server) throw new Error('Managed MCP credential references an unlinked server') + const summary: CredentialGroupEnrollmentMcpConnection = { + mcpServerId: server.id, + name: server.name, + status: toCredentialGroupConnectionStatus(connection.status), + } + const current = mcpConnectionsByEnrollment.get(connection.enrollmentId) + if (current) current.push(summary) + else mcpConnectionsByEnrollment.set(connection.enrollmentId, [summary]) + } const nextCursorEnrollment = hasNextPage ? pageRows.at(-1)?.enrollment : undefined if (hasNextPage && !nextCursorEnrollment) { throw new Error('Credential group enrollment page is missing its cursor boundary') @@ -607,6 +707,7 @@ export async function listCredentialGroupEnrollments( enrollments: pageRows.map(({ enrollment }) => ({ ...toCredentialGroupEnrollment(enrollment), connections: connectionsByEnrollment.get(enrollment.id) ?? [], + mcpConnections: mcpConnectionsByEnrollment.get(enrollment.id) ?? [], })), nextCursor: nextCursorEnrollment ? encodeCredentialGroupEnrollmentCursor(nextCursorEnrollment) @@ -727,7 +828,10 @@ export async function deleteCredentialGroupEnrollment( workspaceId: string, groupId: string, enrollmentId: string -): Promise { +): Promise<{ + credentialGroupEnrollment: CredentialGroupEnrollmentRecord + retiredMcpConnectionIds: string[] +}> { const [existing] = await db .select({ email: credentialGroupEnrollment.email }) .from(credentialGroupEnrollment) @@ -745,6 +849,15 @@ export async function deleteCredentialGroupEnrollment( return db.transaction(async (tx) => { await lockCredentialGroupInvitationTarget(tx, groupId, existing.email) await lockCredentialGroupEnrollmentLifecycle(tx, enrollmentId) + const managedMcpConnections = await tx + .select({ id: credential.id }) + .from(credential) + .where( + and( + eq(credential.type, 'managed_mcp'), + eq(credential.credentialGroupEnrollmentId, enrollmentId) + ) + ) const [deleted] = await tx .delete(credentialGroupEnrollment) .where( @@ -755,7 +868,10 @@ export async function deleteCredentialGroupEnrollment( ) .returning() if (!deleted) throw new CredentialGroupEnrollmentError('Enrollment not found', 404) - return toCredentialGroupEnrollment(deleted) + return { + credentialGroupEnrollment: toCredentialGroupEnrollment(deleted), + retiredMcpConnectionIds: managedMcpConnections.map((row) => row.id), + } }) } @@ -780,24 +896,64 @@ export async function getAuthorizedPublicCredentialGroupEnrollment( async function buildPublicCredentialGroupEnrollment( row: NonNullable>> ): Promise { - const connectionRows = await db - .select({ - optionId: credential.credentialGroupOptionId, - status: credential.managedOauthStatus, - scopeVersion: credential.managedOauthScopeVersion, - authorizationAppId: credential.authorizationAppId, - grantedScopes: credential.grantedScopes, - displayName: credential.displayName, - metadata: credential.providerMetadata, - grantedAt: credential.grantedAt, - }) - .from(credential) - .where( - and( - eq(credential.type, 'managed_oauth'), - eq(credential.credentialGroupEnrollmentId, row.enrollment.id) + const [connectionRows, linkedMcpServers, mcpConnectionRows] = await Promise.all([ + db + .select({ + optionId: credential.credentialGroupOptionId, + status: credential.managedOauthStatus, + scopeVersion: credential.managedOauthScopeVersion, + authorizationAppId: credential.authorizationAppId, + grantedScopes: credential.grantedScopes, + displayName: credential.displayName, + metadata: credential.providerMetadata, + grantedAt: credential.grantedAt, + }) + .from(credential) + .where( + and( + eq(credential.type, 'managed_oauth'), + eq(credential.credentialGroupEnrollmentId, row.enrollment.id) + ) + ), + db + .select({ + id: mcpServers.id, + name: mcpServers.name, + description: mcpServers.description, + managedConnectorId: mcpServers.managedConnectorId, + }) + .from(mcpServers) + .where( + and( + eq(mcpServers.workspaceId, row.workspaceId), + eq(mcpServers.credentialGroupId, row.groupId), + eq(mcpServers.authType, 'oauth'), + eq(mcpServers.enabled, true), + isNull(mcpServers.deletedAt) + ) ) - ) + .orderBy(asc(mcpServers.name), asc(mcpServers.id)), + db + .select({ + id: credential.id, + mcpServerId: credential.mcpServerId, + status: credential.managedOauthStatus, + grantedAt: credential.grantedAt, + }) + .from(credential) + .where( + and( + eq(credential.type, 'managed_mcp'), + eq(credential.credentialGroupEnrollmentId, row.enrollment.id) + ) + ), + ]) + const mcpConnectionByServerId = new Map( + mcpConnectionRows.map((connection) => { + if (!connection.mcpServerId) throw new Error('Managed MCP credential has no server') + return [connection.mcpServerId, connection] as const + }) + ) return { inviterName: row.inviterName, @@ -850,6 +1006,28 @@ async function buildPublicCredentialGroupEnrollment( } }) ), + mcpServers: linkedMcpServers.map((server) => { + if (!server.managedConnectorId) { + throw new Error(`Credential Group MCP server ${server.id} has no managed connector ID`) + } + const managedConnectorId = getManagedMcpConnector(server.managedConnectorId).id + const connection = mcpConnectionByServerId.get(server.id) + if (!connection?.grantedAt) return { ...server, managedConnectorId, connection: null } + return { + ...server, + managedConnectorId, + connection: { + id: connection.id, + status: + connection.status === 'active' + ? ('connected' as const) + : connection.status === 'revoked' + ? ('revoked' as const) + : ('needs_reauth' as const), + grantedAt: connection.grantedAt.toISOString(), + }, + } + }), status: row.enrollment.status, } } @@ -962,6 +1140,46 @@ export async function getAuthorizedCredentialGroupOAuthContext( return credentialGroupOAuthContextFromRow(row, option) } +export async function getAuthorizedCredentialGroupMcpOAuthContext( + identity: PublicCredentialGroupEnrollmentIdentity, + mcpServerId: string +): Promise { + const row = await resolveAuthorizedPublicEnrollmentRow(identity) + if (!row) return null + const [server] = await db + .select({ + id: mcpServers.id, + name: mcpServers.name, + url: mcpServers.url, + managedConnectorId: mcpServers.managedConnectorId, + }) + .from(mcpServers) + .where( + and( + eq(mcpServers.id, mcpServerId), + eq(mcpServers.workspaceId, row.workspaceId), + eq(mcpServers.credentialGroupId, row.groupId), + eq(mcpServers.authType, 'oauth'), + eq(mcpServers.enabled, true), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + if (!server?.url) return null + if (!server.managedConnectorId) { + throw new Error(`Credential Group MCP server ${server.id} has no managed connector ID`) + } + getManagedMcpConnector(server.managedConnectorId) + return { + enrollmentId: row.enrollment.id, + credentialGroupId: row.groupId, + workspaceId: row.workspaceId, + email: row.enrollment.email, + enrollmentStatus: row.enrollment.status, + server: { id: server.id, name: server.name, url: server.url }, + } +} + function credentialGroupOAuthContextFromRow( row: NonNullable>>, option: CredentialGroupOptionConfig diff --git a/apps/sim/lib/credential-groups/workflow-access-limits.ts b/apps/sim/lib/credential-groups/limits.ts similarity index 77% rename from apps/sim/lib/credential-groups/workflow-access-limits.ts rename to apps/sim/lib/credential-groups/limits.ts index 50c7c24949e..93e3a889f59 100644 --- a/apps/sim/lib/credential-groups/workflow-access-limits.ts +++ b/apps/sim/lib/credential-groups/limits.ts @@ -1,3 +1,4 @@ +export const CREDENTIAL_GROUP_MCP_SERVER_LIMIT = 50 export const CREDENTIAL_GROUP_WORKFLOW_ACCESS_LIMIT = 50 export const CREDENTIAL_GROUP_WORKFLOW_CATALOG_LIMIT = 500 export const CREDENTIAL_GROUP_WORKFLOW_NAME_MAX_LENGTH = 255 diff --git a/apps/sim/lib/credential-groups/managed-mcp-connector-icons.ts b/apps/sim/lib/credential-groups/managed-mcp-connector-icons.ts new file mode 100644 index 00000000000..f42806a8769 --- /dev/null +++ b/apps/sim/lib/credential-groups/managed-mcp-connector-icons.ts @@ -0,0 +1,12 @@ +import { DatabricksIcon, FirefliesIcon, GranolaIcon } from '@/components/icons' +import type { ManagedMcpConnectorId } from '@/lib/credential-groups/managed-mcp-connectors' + +export const MANAGED_MCP_CONNECTOR_ICONS = { + fireflies: FirefliesIcon, + granola: GranolaIcon, + databricks: DatabricksIcon, +} as const satisfies Record + +export function getManagedMcpConnectorIcon(connectorId: ManagedMcpConnectorId) { + return MANAGED_MCP_CONNECTOR_ICONS[connectorId] +} diff --git a/apps/sim/lib/credential-groups/managed-mcp-connectors.test.ts b/apps/sim/lib/credential-groups/managed-mcp-connectors.test.ts new file mode 100644 index 00000000000..13a4e0ba42b --- /dev/null +++ b/apps/sim/lib/credential-groups/managed-mcp-connectors.test.ts @@ -0,0 +1,42 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { + getManagedMcpConnector, + requireManagedMcpConnectorUrl, +} from '@/lib/credential-groups/managed-mcp-connectors' + +describe('managed MCP connectors', () => { + it('uses immutable URLs for fixed connectors', () => { + expect(requireManagedMcpConnectorUrl('fireflies')).toBe('https://api.fireflies.ai/mcp') + expect(requireManagedMcpConnectorUrl('granola')).toBe('https://mcp.granola.ai/mcp') + expect(() => requireManagedMcpConnectorUrl('fireflies', 'https://example.com/mcp')).toThrow( + 'Fireflies uses the fixed MCP URL' + ) + }) + + it.each([ + 'https://workspace.cloud.databricks.com/api/2.0/mcp/functions/catalog/schema', + 'https://workspace.azuredatabricks.net/api/2.0/mcp/vector-search/catalog/schema/index', + 'https://workspace.cloud.databricks.us/api/2.0/mcp/functions/catalog/schema', + 'https://example.databricksapps.com/mcp', + ])('accepts an official Databricks MCP URL: %s', (url) => { + expect(requireManagedMcpConnectorUrl('databricks', url)).toBe(url) + }) + + it.each([ + 'http://workspace.cloud.databricks.com/api/2.0/mcp/functions/catalog/schema', + 'https://workspace.cloud.databricks.com/not-mcp', + 'https://databricks.example.com/api/2.0/mcp/functions/catalog/schema', + 'https://workspace.cloud.databricks.com/api/2.0/mcp/functions/catalog/schema?token=secret', + ])('rejects a noncanonical Databricks MCP URL: %s', (url) => { + expect(() => requireManagedMcpConnectorUrl('databricks', url)).toThrow() + }) + + it('fails on connector IDs that are not in the registry', () => { + expect(() => getManagedMcpConnector('custom')).toThrow( + 'Unsupported managed MCP connector: custom' + ) + }) +}) diff --git a/apps/sim/lib/credential-groups/managed-mcp-connectors.ts b/apps/sim/lib/credential-groups/managed-mcp-connectors.ts new file mode 100644 index 00000000000..de4f379f169 --- /dev/null +++ b/apps/sim/lib/credential-groups/managed-mcp-connectors.ts @@ -0,0 +1,108 @@ +export const MANAGED_MCP_CONNECTOR_IDS = ['fireflies', 'granola', 'databricks'] as const + +export type ManagedMcpConnectorId = (typeof MANAGED_MCP_CONNECTOR_IDS)[number] + +interface FixedManagedMcpConnector { + id: Exclude + name: string + description: string + url: string + oauthClientRegistration: 'dynamic' +} + +interface DatabricksManagedMcpConnector { + id: 'databricks' + name: string + description: string + oauthClientRegistration: 'preregistered' +} + +export type ManagedMcpConnector = FixedManagedMcpConnector | DatabricksManagedMcpConnector + +export const MANAGED_MCP_CONNECTORS = { + fireflies: { + id: 'fireflies', + name: 'Fireflies', + description: 'Let each person connect their own Fireflies account', + url: 'https://api.fireflies.ai/mcp', + oauthClientRegistration: 'dynamic', + }, + granola: { + id: 'granola', + name: 'Granola', + description: 'Let each person connect their own Granola account', + url: 'https://mcp.granola.ai/mcp', + oauthClientRegistration: 'dynamic', + }, + databricks: { + id: 'databricks', + name: 'Databricks', + description: 'Let each person connect their own Databricks account', + oauthClientRegistration: 'preregistered', + }, +} as const satisfies Record + +const DATABRICKS_WORKSPACE_HOST_SUFFIXES = [ + '.cloud.databricks.com', + '.cloud.databricks.us', + '.cloud.databricks.mil', + '.azuredatabricks.net', + '.gcp.databricks.com', + '.databricks.com', +] as const + +const DATABRICKS_APP_HOST_SUFFIXES = [ + '.databricksapps.com', + '.databricksapps.us', + '.databricksapps.mil', +] as const + +export function isManagedMcpConnectorId(value: string): value is ManagedMcpConnectorId { + return MANAGED_MCP_CONNECTOR_IDS.some((connectorId) => connectorId === value) +} + +export function getManagedMcpConnector(connectorId: string): ManagedMcpConnector { + if (!isManagedMcpConnectorId(connectorId)) { + throw new Error(`Unsupported managed MCP connector: ${connectorId}`) + } + return MANAGED_MCP_CONNECTORS[connectorId] +} + +function hostnameHasSuffix(hostname: string, suffixes: readonly string[]): boolean { + return suffixes.some((suffix) => hostname.endsWith(suffix)) +} + +export function requireManagedMcpConnectorUrl( + connectorId: ManagedMcpConnectorId, + rawUrl?: string +): string { + const connector = getManagedMcpConnector(connectorId) + if ('url' in connector) { + if (rawUrl !== undefined && rawUrl !== connector.url) { + throw new Error(`${connector.name} uses the fixed MCP URL ${connector.url}`) + } + return connector.url + } + + if (!rawUrl?.trim()) throw new Error('Databricks MCP URL is required') + let url: URL + try { + url = new URL(rawUrl.trim()) + } catch { + throw new Error('Databricks MCP URL is invalid') + } + if (url.protocol !== 'https:' || url.username || url.password || url.search || url.hash) { + throw new Error('Databricks MCP URL must be a credential-free HTTPS URL') + } + + const hostname = url.hostname.toLowerCase() + const isWorkspaceHost = hostnameHasSuffix(hostname, DATABRICKS_WORKSPACE_HOST_SUFFIXES) + const isAppHost = hostnameHasSuffix(hostname, DATABRICKS_APP_HOST_SUFFIXES) + const isManagedServicePath = + url.pathname.startsWith('/api/2.0/mcp/') || url.pathname.startsWith('/ai-gateway/mcp-services/') + const isAppPath = url.pathname === '/mcp' || url.pathname === '/mcp/' + if ((!isWorkspaceHost || !isManagedServicePath) && (!isAppHost || !isAppPath)) { + throw new Error('Databricks MCP URL must point to an official Databricks MCP endpoint') + } + return url.toString().replace(/\/$/, '') +} diff --git a/apps/sim/lib/credential-groups/managed-mcp-service.ts b/apps/sim/lib/credential-groups/managed-mcp-service.ts new file mode 100644 index 00000000000..7d31e594d72 --- /dev/null +++ b/apps/sim/lib/credential-groups/managed-mcp-service.ts @@ -0,0 +1,577 @@ +import { db } from '@sim/db' +import { + credential, + credentialGroup, + credentialGroupEnrollment, + mcpServerOauth, + mcpServers, +} from '@sim/db/schema' +import { getPostgresErrorCode } from '@sim/utils/errors' +import { and, eq, inArray, isNull, ne } from 'drizzle-orm' +import { encryptSecret } from '@/lib/core/security/encryption' +import { + getManagedMcpConnector, + type ManagedMcpConnectorId, + requireManagedMcpConnectorUrl, +} from '@/lib/credential-groups/managed-mcp-connectors' +import type { DbOrTx } from '@/lib/db/types' +import { + McpDnsResolutionError, + McpDomainNotAllowedError, + McpSsrfError, + validateMcpDomain, + validateMcpServerSsrf, +} from '@/lib/mcp/domain-check' +import { generateMcpServerId } from '@/lib/mcp/utils' + +export class ManagedMcpConnectorError extends Error { + constructor( + message: string, + readonly code: 'validation' | 'not_found' | 'conflict' | 'forbidden' | 'bad_gateway' + ) { + super(message) + this.name = 'ManagedMcpConnectorError' + } +} + +export interface ManagedMcpConnectorSummary { + id: string + name: string + description: string | null + authType: string + enabled: boolean + managedConnectorId: ManagedMcpConnectorId +} + +export type CreateManagedMcpConnectorInput = + | { connectorId: 'fireflies' | 'granola' } + | { + connectorId: 'databricks' + name: string + url: string + oauthClientId: string + oauthClientSecret?: string + } + +export interface UpdateManagedMcpConnectorInput { + name?: string + url?: string + oauthClientId?: string + oauthClientSecret?: string | null +} + +export interface ManagedMcpConnectorMutationResult { + mcpServer: ManagedMcpConnectorSummary + retiredMcpConnectionIds: string[] + resetMcpServerIds: string[] +} + +function toSummary(row: typeof mcpServers.$inferSelect): ManagedMcpConnectorSummary { + if (!row.managedConnectorId) { + throw new Error(`Credential Group MCP server ${row.id} has no managed connector ID`) + } + const connector = getManagedMcpConnector(row.managedConnectorId) + return { + id: row.id, + name: row.name, + description: row.description, + authType: row.authType, + enabled: row.enabled, + managedConnectorId: connector.id, + } +} + +async function validateServerUrl(url: string): Promise { + try { + validateMcpDomain(url) + await validateMcpServerSsrf(url) + } catch (error) { + if (error instanceof McpDomainNotAllowedError || error instanceof McpSsrfError) { + throw new ManagedMcpConnectorError(error.message, 'forbidden') + } + if (error instanceof McpDnsResolutionError) { + throw new ManagedMcpConnectorError(error.message, 'bad_gateway') + } + throw error + } +} + +function resolveManagedMcpConnectorUrl( + connectorId: ManagedMcpConnectorId, + rawUrl?: string +): string { + try { + return requireManagedMcpConnectorUrl(connectorId, rawUrl) + } catch (error) { + if (error instanceof Error) { + throw new ManagedMcpConnectorError(error.message, 'validation') + } + throw error + } +} + +async function retireManagedMcpCredentials( + credentialGroupId: string, + mcpServerIds: string[], + executor: DbOrTx +): Promise { + if (mcpServerIds.length === 0) return [] + const enrollmentIds = executor + .select({ id: credentialGroupEnrollment.id }) + .from(credentialGroupEnrollment) + .where(eq(credentialGroupEnrollment.credentialGroupId, credentialGroupId)) + const retired = await executor + .update(credential) + .set({ + managedOauthStatus: 'revoked', + encryptedOauthTokenSet: null, + accessTokenExpiresAt: null, + mcpTools: null, + mcpToolsRefreshedAt: null, + revokedAt: new Date(), + updatedAt: new Date(), + }) + .where( + and( + eq(credential.type, 'managed_mcp'), + inArray(credential.credentialGroupEnrollmentId, enrollmentIds), + inArray(credential.mcpServerId, mcpServerIds) + ) + ) + .returning({ id: credential.id }) + return retired.map((row) => row.id) +} + +export async function retireManagedMcpServersForGroup( + workspaceId: string, + credentialGroupId: string, + executor: DbOrTx +): Promise<{ serverIds: string[]; connectionIds: string[] }> { + const servers = await executor + .select({ id: mcpServers.id }) + .from(mcpServers) + .where( + and( + eq(mcpServers.workspaceId, workspaceId), + eq(mcpServers.credentialGroupId, credentialGroupId), + isNull(mcpServers.deletedAt) + ) + ) + .for('update') + const serverIds = servers.map((server) => server.id) + if (serverIds.length === 0) return { serverIds: [], connectionIds: [] } + const connectionIds = await retireManagedMcpCredentials(credentialGroupId, serverIds, executor) + const now = new Date() + await executor + .update(mcpServers) + .set({ enabled: false, deletedAt: now, updatedAt: now }) + .where(inArray(mcpServers.id, serverIds)) + await executor.delete(mcpServerOauth).where(inArray(mcpServerOauth.mcpServerId, serverIds)) + return { serverIds, connectionIds } +} + +export async function createManagedMcpConnector(params: { + workspaceId: string + credentialGroupId: string + userId: string + input: CreateManagedMcpConnectorInput +}): Promise { + const connector = getManagedMcpConnector(params.input.connectorId) + const url = resolveManagedMcpConnectorUrl( + connector.id, + params.input.connectorId === 'databricks' ? params.input.url : undefined + ) + await validateServerUrl(url) + const serverId = generateMcpServerId(params.workspaceId, url) + const oauthClientId = + params.input.connectorId === 'databricks' ? params.input.oauthClientId.trim() : null + const oauthClientSecret = + params.input.connectorId === 'databricks' && params.input.oauthClientSecret + ? (await encryptSecret(params.input.oauthClientSecret)).encrypted + : null + const name = params.input.connectorId === 'databricks' ? params.input.name.trim() : connector.name + if (!name) + throw new ManagedMcpConnectorError('Managed MCP connector name is required', 'validation') + if (params.input.connectorId === 'databricks' && !oauthClientId) { + throw new ManagedMcpConnectorError('Databricks OAuth Client ID is required', 'validation') + } + + try { + const mcpServer = await db.transaction(async (tx) => { + const [group] = await tx + .select({ id: credentialGroup.id }) + .from(credentialGroup) + .where( + and( + eq(credentialGroup.id, params.credentialGroupId), + eq(credentialGroup.workspaceId, params.workspaceId) + ) + ) + .limit(1) + .for('update') + if (!group) throw new ManagedMcpConnectorError('Credential group not found', 'not_found') + + const [existingProvider] = await tx + .select({ id: mcpServers.id }) + .from(mcpServers) + .where( + and( + eq(mcpServers.workspaceId, params.workspaceId), + eq(mcpServers.credentialGroupId, params.credentialGroupId), + eq(mcpServers.managedConnectorId, connector.id), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + if (existingProvider) { + throw new ManagedMcpConnectorError( + `${connector.name} is already configured for this Credential Group`, + 'conflict' + ) + } + + const [liveServerWithUrl] = await tx + .select({ id: mcpServers.id }) + .from(mcpServers) + .where( + and( + eq(mcpServers.workspaceId, params.workspaceId), + eq(mcpServers.url, url), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + .for('update') + if (liveServerWithUrl) { + throw new ManagedMcpConnectorError( + 'An MCP server with this URL already exists. Remove it from MCP settings first.', + 'conflict' + ) + } + + const [existingUrl] = await tx + .select() + .from(mcpServers) + .where(and(eq(mcpServers.id, serverId), eq(mcpServers.workspaceId, params.workspaceId))) + .limit(1) + .for('update') + const now = new Date() + if (existingUrl) { + const [revived] = await tx + .update(mcpServers) + .set({ + credentialGroupId: params.credentialGroupId, + managedConnectorId: connector.id, + createdBy: params.userId, + name, + description: connector.description, + transport: 'streamable-http', + url, + authType: 'oauth', + oauthClientId, + oauthClientSecret, + headers: {}, + enabled: true, + connectionStatus: 'disconnected', + lastConnected: null, + lastError: null, + deletedAt: null, + updatedAt: now, + }) + .where(eq(mcpServers.id, serverId)) + .returning() + if (!revived) throw new Error('Managed MCP server revival returned no row') + return revived + } + + const [created] = await tx + .insert(mcpServers) + .values({ + id: serverId, + workspaceId: params.workspaceId, + credentialGroupId: params.credentialGroupId, + managedConnectorId: connector.id, + createdBy: params.userId, + name, + description: connector.description, + transport: 'streamable-http', + url, + authType: 'oauth', + oauthClientId, + oauthClientSecret, + headers: {}, + enabled: true, + connectionStatus: 'disconnected', + lastConnected: null, + createdAt: now, + updatedAt: now, + }) + .returning() + if (!created) throw new Error('Managed MCP server insert returned no row') + return created + }) + return { + mcpServer: toSummary(mcpServer), + retiredMcpConnectionIds: [], + resetMcpServerIds: [], + } + } catch (error) { + if (getPostgresErrorCode(error) === '23505') { + throw new ManagedMcpConnectorError( + `${connector.name} is already configured for this Credential Group`, + 'conflict' + ) + } + throw error + } +} + +export async function updateManagedMcpConnector(params: { + workspaceId: string + credentialGroupId: string + connectorId: ManagedMcpConnectorId + input: UpdateManagedMcpConnectorInput +}): Promise { + if (params.connectorId !== 'databricks') { + throw new ManagedMcpConnectorError( + 'Only Databricks connector settings can be changed', + 'validation' + ) + } + const current = await db + .select() + .from(mcpServers) + .where( + and( + eq(mcpServers.workspaceId, params.workspaceId), + eq(mcpServers.credentialGroupId, params.credentialGroupId), + eq(mcpServers.managedConnectorId, params.connectorId), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + .then((rows) => rows[0]) + if (!current) throw new ManagedMcpConnectorError('Managed MCP connector not found', 'not_found') + const url = resolveManagedMcpConnectorUrl( + 'databricks', + params.input.url ?? current.url ?? undefined + ) + if (url !== current.url) await validateServerUrl(url) + const encryptedSecret = + params.input.oauthClientSecret === undefined + ? undefined + : params.input.oauthClientSecret === null + ? null + : (await encryptSecret(params.input.oauthClientSecret)).encrypted + + const result = await db.transaction(async (tx) => { + const [group] = await tx + .select({ id: credentialGroup.id }) + .from(credentialGroup) + .where( + and( + eq(credentialGroup.id, params.credentialGroupId), + eq(credentialGroup.workspaceId, params.workspaceId) + ) + ) + .limit(1) + .for('update') + if (!group) throw new ManagedMcpConnectorError('Credential group not found', 'not_found') + + const [locked] = await tx + .select() + .from(mcpServers) + .where( + and( + eq(mcpServers.id, current.id), + eq(mcpServers.workspaceId, params.workspaceId), + eq(mcpServers.credentialGroupId, params.credentialGroupId), + eq(mcpServers.managedConnectorId, 'databricks'), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + .for('update') + if (!locked) throw new ManagedMcpConnectorError('Managed MCP connector not found', 'not_found') + const urlChanged = url !== locked.url + const targetServerId = generateMcpServerId(params.workspaceId, url) + if (urlChanged && targetServerId === locked.id) { + throw new Error(`MCP server ID collision for ${locked.id}`) + } + if (urlChanged) { + const [liveServerWithUrl] = await tx + .select({ id: mcpServers.id }) + .from(mcpServers) + .where( + and( + eq(mcpServers.workspaceId, params.workspaceId), + eq(mcpServers.url, url), + ne(mcpServers.id, locked.id), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + .for('update') + if (liveServerWithUrl) { + throw new ManagedMcpConnectorError( + 'An MCP server with this URL already exists. Remove it from MCP settings first.', + 'conflict' + ) + } + } + const nextName = params.input.name?.trim() ?? locked.name + const nextOauthClientId = params.input.oauthClientId?.trim() ?? locked.oauthClientId + if (!nextName) { + throw new ManagedMcpConnectorError('Databricks name is required', 'validation') + } + if (!nextOauthClientId) { + throw new ManagedMcpConnectorError('Databricks OAuth Client ID is required', 'validation') + } + const nextOauthClientSecret = + encryptedSecret === undefined ? locked.oauthClientSecret : encryptedSecret + const changedCredentials = + urlChanged || nextOauthClientId !== locked.oauthClientId || encryptedSecret !== undefined + const retiredMcpConnectionIds = changedCredentials + ? await retireManagedMcpCredentials(params.credentialGroupId, [locked.id], tx) + : [] + if (changedCredentials) { + await tx.delete(mcpServerOauth).where(eq(mcpServerOauth.mcpServerId, locked.id)) + } + const now = new Date() + if (!urlChanged) { + const [updated] = await tx + .update(mcpServers) + .set({ + name: nextName, + oauthClientId: nextOauthClientId, + ...(encryptedSecret !== undefined ? { oauthClientSecret: encryptedSecret } : {}), + ...(changedCredentials + ? { connectionStatus: 'disconnected', lastConnected: null, lastError: null } + : {}), + updatedAt: now, + }) + .where(eq(mcpServers.id, locked.id)) + .returning() + if (!updated) throw new Error('Managed MCP server update returned no row') + return { + mcpServer: toSummary(updated), + retiredMcpConnectionIds, + resetMcpServerIds: changedCredentials ? [locked.id] : [], + } + } + + const [target] = await tx + .select() + .from(mcpServers) + .where(and(eq(mcpServers.id, targetServerId), eq(mcpServers.workspaceId, params.workspaceId))) + .limit(1) + .for('update') + if (target?.deletedAt === null) { + throw new ManagedMcpConnectorError( + 'An MCP server with this URL already exists. Remove it from MCP settings first.', + 'conflict' + ) + } + + await tx + .update(mcpServers) + .set({ enabled: false, deletedAt: now, updatedAt: now }) + .where(eq(mcpServers.id, locked.id)) + if (target) { + await tx.delete(mcpServerOauth).where(eq(mcpServerOauth.mcpServerId, target.id)) + } + const rowValues = { + credentialGroupId: params.credentialGroupId, + managedConnectorId: 'databricks' as const, + createdBy: locked.createdBy, + name: nextName, + description: getManagedMcpConnector('databricks').description, + transport: 'streamable-http', + url, + authType: 'oauth', + oauthClientId: nextOauthClientId, + oauthClientSecret: nextOauthClientSecret, + headers: {}, + enabled: true, + connectionStatus: 'disconnected', + lastConnected: null, + lastError: null, + deletedAt: null, + updatedAt: now, + } + const [replacement] = target + ? await tx.update(mcpServers).set(rowValues).where(eq(mcpServers.id, target.id)).returning() + : await tx + .insert(mcpServers) + .values({ + id: targetServerId, + workspaceId: params.workspaceId, + ...rowValues, + createdAt: now, + }) + .returning() + if (!replacement) throw new Error('Managed MCP server replacement returned no row') + return { + mcpServer: toSummary(replacement), + retiredMcpConnectionIds, + resetMcpServerIds: [locked.id, replacement.id], + } + }) + return result +} + +export async function deleteManagedMcpConnector(params: { + workspaceId: string + credentialGroupId: string + connectorId: ManagedMcpConnectorId +}): Promise<{ + mcpServer: ManagedMcpConnectorSummary + serverIds: string[] + retiredMcpConnectionIds: string[] +}> { + return db.transaction(async (tx) => { + const [group] = await tx + .select({ id: credentialGroup.id }) + .from(credentialGroup) + .where( + and( + eq(credentialGroup.id, params.credentialGroupId), + eq(credentialGroup.workspaceId, params.workspaceId) + ) + ) + .limit(1) + .for('update') + if (!group) throw new ManagedMcpConnectorError('Credential group not found', 'not_found') + + const [server] = await tx + .select() + .from(mcpServers) + .where( + and( + eq(mcpServers.workspaceId, params.workspaceId), + eq(mcpServers.credentialGroupId, params.credentialGroupId), + eq(mcpServers.managedConnectorId, params.connectorId), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + .for('update') + if (!server) throw new ManagedMcpConnectorError('Managed MCP connector not found', 'not_found') + const retiredMcpConnectionIds = await retireManagedMcpCredentials( + params.credentialGroupId, + [server.id], + tx + ) + const now = new Date() + await tx + .update(mcpServers) + .set({ enabled: false, deletedAt: now, updatedAt: now }) + .where(eq(mcpServers.id, server.id)) + await tx.delete(mcpServerOauth).where(eq(mcpServerOauth.mcpServerId, server.id)) + return { + mcpServer: toSummary(server), + serverIds: [server.id], + retiredMcpConnectionIds, + } + }) +} diff --git a/apps/sim/lib/credential-groups/mcp-connections.test.ts b/apps/sim/lib/credential-groups/mcp-connections.test.ts new file mode 100644 index 00000000000..87869655ef4 --- /dev/null +++ b/apps/sim/lib/credential-groups/mcp-connections.test.ts @@ -0,0 +1,99 @@ +/** + * @vitest-environment node + */ +import { dbChainMockFns, hasMockCondition, resetDbChainMock } from '@sim/testing' +import { beforeEach, describe, expect, it, vi } from 'vitest' +import { listCredentialGroupMcpConnectionReferences } from '@/lib/credential-groups/mcp-connections' + +describe('listCredentialGroupMcpConnectionReferences', () => { + beforeEach(() => { + vi.clearAllMocks() + resetDbChainMock() + }) + + it('returns MCP credential IDs and tool names without secret material', async () => { + dbChainMockFns.limit.mockResolvedValueOnce([ + { + id: 'mcp-cg-connection-1', + email: 'person@example.com', + displayName: 'Fireflies', + mcpServerId: 'mcp-server-1', + mcpServerName: 'Fireflies', + managedConnectorId: 'fireflies', + hasToolSnapshot: true, + toolNames: ['list_transcripts', 'get_transcript'], + createdAt: new Date('2026-09-01T12:00:00.000Z'), + }, + ]) + + const result = await listCredentialGroupMcpConnectionReferences({ + workspaceId: 'workspace-1', + credentialGroupId: 'group-1', + limit: 50, + }) + + expect(result).toEqual({ + mcpConnections: [ + { + credentialId: 'mcp-cg-connection-1', + email: 'person@example.com', + displayName: 'Fireflies', + mcpServerId: 'mcp-server-1', + mcpServerName: 'Fireflies', + toolNames: ['list_transcripts', 'get_transcript'], + }, + ], + nextCursor: null, + }) + }) + + it('applies email and root MCP server filters inside the credential group scope', async () => { + dbChainMockFns.limit.mockResolvedValueOnce([]) + + await listCredentialGroupMcpConnectionReferences({ + workspaceId: 'workspace-1', + credentialGroupId: 'group-1', + email: 'person@example.com', + mcpServerId: 'mcp-server-1', + limit: 50, + }) + + const where = dbChainMockFns.where.mock.calls.at(-1)?.[0] + expect( + hasMockCondition( + where, + (condition) => condition.type === 'eq' && condition.right === 'person@example.com' + ) + ).toBe(true) + expect( + hasMockCondition( + where, + (condition) => condition.type === 'eq' && condition.right === 'mcp-server-1' + ) + ).toBe(true) + }) + + it('fails fast when an active connection has no tool snapshot', async () => { + dbChainMockFns.limit.mockResolvedValueOnce([ + { + id: 'mcp-cg-connection-1', + email: 'person@example.com', + displayName: 'Fireflies', + mcpServerId: 'mcp-server-1', + mcpServerName: 'Fireflies', + managedConnectorId: 'fireflies', + hasToolSnapshot: false, + toolNames: [], + createdAt: new Date('2026-09-01T12:00:00.000Z'), + }, + ]) + + await expect( + listCredentialGroupMcpConnectionReferences({ + workspaceId: 'workspace-1', + credentialGroupId: 'group-1', + limit: 50, + }) + ).rejects.toThrow('Managed MCP connection mcp-cg-connection-1 has no tool snapshot') + }) +}) diff --git a/apps/sim/lib/credential-groups/mcp-connections.ts b/apps/sim/lib/credential-groups/mcp-connections.ts new file mode 100644 index 00000000000..b3aeb1c3044 --- /dev/null +++ b/apps/sim/lib/credential-groups/mcp-connections.ts @@ -0,0 +1,158 @@ +import { db } from '@sim/db' +import { credential, credentialGroup, credentialGroupEnrollment, mcpServers } from '@sim/db/schema' +import { and, asc, eq, gt, inArray, isNull, or, sql } from 'drizzle-orm' +import { getManagedMcpConnector } from '@/lib/credential-groups/managed-mcp-connectors' + +export const MAX_CREDENTIAL_GROUP_MCP_CONNECTION_PAGE_SIZE = 100 + +export interface CredentialGroupMcpConnectionReference { + credentialId: string + email: string + displayName: string + mcpServerId: string + mcpServerName: string + toolNames: string[] +} + +export class CredentialGroupMcpConnectionCursorNotFoundError extends Error { + constructor() { + super('Credential group MCP connection cursor not found') + this.name = 'CredentialGroupMcpConnectionCursorNotFoundError' + } +} + +interface ListCredentialGroupMcpConnectionReferencesInput { + workspaceId: string + credentialGroupId: string + limit: number + cursor?: string + email?: string + mcpServerId?: string +} + +function decodeToolNames(value: unknown): string[] { + const decoded = credential.mcpTools.mapFromDriverValue(value) + if (!Array.isArray(decoded) || !decoded.every((name) => typeof name === 'string')) { + throw new Error('Managed MCP tool name projection is invalid') + } + return decoded +} + +/** Lists one bounded page of active managed MCP connections without selecting token material. */ +export async function listCredentialGroupMcpConnectionReferences({ + workspaceId, + credentialGroupId, + limit, + cursor, + email, + mcpServerId, +}: ListCredentialGroupMcpConnectionReferencesInput): Promise<{ + mcpConnections: CredentialGroupMcpConnectionReference[] + nextCursor: string | null +}> { + const scope = () => + and( + eq(credential.workspaceId, workspaceId), + eq(credential.type, 'managed_mcp'), + eq(credential.managedOauthStatus, 'active'), + eq(credentialGroup.id, credentialGroupId), + eq(credentialGroup.workspaceId, workspaceId), + eq(credentialGroup.status, 'active'), + inArray(credentialGroupEnrollment.status, ['in_progress', 'completed']), + eq(mcpServers.workspaceId, workspaceId), + eq(mcpServers.authType, 'oauth'), + eq(mcpServers.enabled, true), + isNull(mcpServers.deletedAt), + sql`${mcpServers.credentialGroupId} = ${credentialGroup.id}`, + email ? eq(credentialGroupEnrollment.email, email) : undefined, + mcpServerId ? eq(mcpServers.id, mcpServerId) : undefined + ) + + let cursorPosition: { id: string; createdAt: Date } | undefined + if (cursor) { + const [cursorRow] = await db + .select({ id: credential.id, createdAt: credential.createdAt }) + .from(credential) + .innerJoin( + credentialGroupEnrollment, + eq(credentialGroupEnrollment.id, credential.credentialGroupEnrollmentId) + ) + .innerJoin( + credentialGroup, + eq(credentialGroup.id, credentialGroupEnrollment.credentialGroupId) + ) + .innerJoin(mcpServers, eq(mcpServers.id, credential.mcpServerId)) + .where(and(eq(credential.id, cursor), scope())) + .limit(1) + if (!cursorRow) throw new CredentialGroupMcpConnectionCursorNotFoundError() + cursorPosition = cursorRow + } + + const rows = await db + .select({ + id: credential.id, + email: credentialGroupEnrollment.email, + displayName: credential.displayName, + mcpServerId: mcpServers.id, + mcpServerName: mcpServers.name, + managedConnectorId: mcpServers.managedConnectorId, + hasToolSnapshot: sql`${credential.mcpTools} IS NOT NULL`, + toolNames: + sql`COALESCE(jsonb_path_query_array(${credential.mcpTools}, '$[*].name'), '[]'::jsonb)`.mapWith( + decodeToolNames + ), + createdAt: credential.createdAt, + }) + .from(credential) + .innerJoin( + credentialGroupEnrollment, + eq(credentialGroupEnrollment.id, credential.credentialGroupEnrollmentId) + ) + .innerJoin(credentialGroup, eq(credentialGroup.id, credentialGroupEnrollment.credentialGroupId)) + .innerJoin(mcpServers, eq(mcpServers.id, credential.mcpServerId)) + .where( + and( + scope(), + cursorPosition + ? or( + gt(credential.createdAt, cursorPosition.createdAt), + and( + eq(credential.createdAt, cursorPosition.createdAt), + gt(credential.id, cursorPosition.id) + ) + ) + : undefined + ) + ) + .orderBy(asc(credential.createdAt), asc(credential.id)) + .limit(limit + 1) + + const hasMore = rows.length > limit + const pageRows = hasMore ? rows.slice(0, limit) : rows + const nextCursor = hasMore ? pageRows.at(-1)?.id : null + if (hasMore && !nextCursor) throw new Error('MCP connection page cursor could not be derived') + + return { + mcpConnections: pageRows.map((row) => { + if (!row.hasToolSnapshot) { + throw new Error(`Managed MCP connection ${row.id} has no tool snapshot`) + } + if (!row.managedConnectorId) { + throw new Error(`Managed MCP server ${row.mcpServerId} has no connector ID`) + } + getManagedMcpConnector(row.managedConnectorId) + if (row.toolNames.some((name) => typeof name !== 'string' || !name.trim())) { + throw new Error(`Managed MCP connection ${row.id} has invalid tool metadata`) + } + return { + credentialId: row.id, + email: row.email, + displayName: row.displayName, + mcpServerId: row.mcpServerId, + mcpServerName: row.mcpServerName, + toolNames: row.toolNames, + } + }), + nextCursor: nextCursor ?? null, + } +} diff --git a/apps/sim/lib/credential-groups/mcp-oauth-state.test.ts b/apps/sim/lib/credential-groups/mcp-oauth-state.test.ts new file mode 100644 index 00000000000..e7e88b6e871 --- /dev/null +++ b/apps/sim/lib/credential-groups/mcp-oauth-state.test.ts @@ -0,0 +1,109 @@ +/** + * @vitest-environment node + */ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const { mockRedis, values } = vi.hoisted(() => { + const values = new Map() + return { + values, + mockRedis: { + set: vi.fn(async (key: string, value: string) => { + if (values.has(key)) return null + values.set(key, value) + return 'OK' + }), + eval: vi.fn(async (_script: string, _keyCount: number, key: string) => { + const value = values.get(key) ?? null + values.delete(key) + return value + }), + sadd: vi.fn(async () => 1), + srem: vi.fn(async () => 1), + pexpire: vi.fn(async () => 1), + }, + } +}) + +vi.mock('@/lib/core/config/redis', () => ({ + getRedisClient: vi.fn(() => mockRedis), +})) + +vi.mock('@/lib/core/security/encryption', () => ({ + encryptSecret: vi.fn(async (value: string) => ({ + encrypted: `encrypted:${Buffer.from(value).toString('base64')}`, + })), + decryptSecret: vi.fn(async (value: string) => ({ + decrypted: Buffer.from(value.replace(/^encrypted:/, ''), 'base64').toString(), + })), +})) + +import { getRedisClient } from '@/lib/core/config/redis' +import { + consumeCredentialGroupMcpOAuthAttempt, + createCredentialGroupMcpOAuthAttempt, + isCredentialGroupMcpOAuthState, +} from '@/lib/credential-groups/mcp-oauth-state' + +describe('Credential Group MCP OAuth state', () => { + beforeEach(() => { + vi.clearAllMocks() + values.clear() + vi.mocked(getRedisClient).mockReturnValue(mockRedis as never) + }) + + it('encrypts bearer material and consumes an attempt exactly once', async () => { + const state = 'mcp_cg_state-1' + await createCredentialGroupMcpOAuthAttempt({ + state, + enrollmentId: 'enrollment-1', + credentialGroupId: 'group-1', + mcpServerId: 'mcp-server-1', + codeVerifier: 'code-verifier', + invitationToken: 'invitation-token', + }) + + const stored = [...values.values()][0] + expect(isCredentialGroupMcpOAuthState(state)).toBe(true) + expect(stored).not.toContain('code-verifier') + expect(stored).not.toContain('invitation-token') + await expect(consumeCredentialGroupMcpOAuthAttempt(state)).resolves.toMatchObject({ + state, + enrollmentId: 'enrollment-1', + credentialGroupId: 'group-1', + mcpServerId: 'mcp-server-1', + codeVerifier: 'code-verifier', + invitationToken: 'invitation-token', + }) + await expect(consumeCredentialGroupMcpOAuthAttempt(state)).resolves.toBeNull() + }) + + it('fails closed when Redis is unavailable', async () => { + vi.mocked(getRedisClient).mockReturnValue(null) + + await expect( + createCredentialGroupMcpOAuthAttempt({ + state: 'mcp_cg_state-1', + enrollmentId: 'enrollment-1', + credentialGroupId: 'group-1', + mcpServerId: 'mcp-server-1', + codeVerifier: 'code-verifier', + invitationToken: 'invitation-token', + }) + ).rejects.toThrow('Credential Group MCP OAuth requires Redis') + }) + + it('rejects state outside the managed MCP namespace', async () => { + await expect( + createCredentialGroupMcpOAuthAttempt({ + state: 'ordinary-state', + enrollmentId: 'enrollment-1', + credentialGroupId: 'group-1', + mcpServerId: 'mcp-server-1', + codeVerifier: 'code-verifier', + invitationToken: 'invitation-token', + }) + ).rejects.toThrow('invalid prefix') + expect(mockRedis.set).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/lib/credential-groups/mcp-oauth-state.ts b/apps/sim/lib/credential-groups/mcp-oauth-state.ts new file mode 100644 index 00000000000..3db80dc64a0 --- /dev/null +++ b/apps/sim/lib/credential-groups/mcp-oauth-state.ts @@ -0,0 +1,150 @@ +import { sha256Hex } from '@sim/security/hash' +import { getRedisClient } from '@/lib/core/config/redis' +import { decryptSecret, encryptSecret } from '@/lib/core/security/encryption' + +const MCP_OAUTH_ATTEMPT_TTL_MS = 10 * 60 * 1000 +const MCP_OAUTH_ATTEMPT_VERSION = 1 as const +const MCP_OAUTH_STATE_PREFIX = 'mcp_cg_' + +const CONSUME_SCRIPT = ` +local value = redis.call('GET', KEYS[1]) +if not value then + return nil +end +redis.call('DEL', KEYS[1]) +return value +` + +const CLEAR_SERVER_ATTEMPTS_SCRIPT = ` +local keys = redis.call('SMEMBERS', KEYS[1]) +for _, key in ipairs(keys) do + redis.call('DEL', key) +end +redis.call('DEL', KEYS[1]) +return #keys +` + +interface StoredCredentialGroupMcpOAuthAttempt { + version: typeof MCP_OAUTH_ATTEMPT_VERSION + enrollmentId: string + credentialGroupId: string + mcpServerId: string + encryptedCodeVerifier: string + encryptedInvitationToken: string + createdAt: number +} + +export interface CredentialGroupMcpOAuthAttempt { + state: string + enrollmentId: string + credentialGroupId: string + mcpServerId: string + codeVerifier: string + invitationToken: string + createdAt: number +} + +function requireRedis() { + const redis = getRedisClient() + if (!redis) throw new Error('Credential Group MCP OAuth requires Redis') + return redis +} + +function attemptKey(state: string): string { + return `credential-group:mcp-oauth-attempt:${sha256Hex(state)}` +} + +function serverAttemptsKey(mcpServerId: string): string { + return `credential-group:mcp-oauth-attempts:${mcpServerId}` +} + +function isStoredAttempt(value: unknown): value is StoredCredentialGroupMcpOAuthAttempt { + if (!value || typeof value !== 'object') return false + const candidate = value as Record + return ( + candidate.version === MCP_OAUTH_ATTEMPT_VERSION && + typeof candidate.enrollmentId === 'string' && + typeof candidate.credentialGroupId === 'string' && + typeof candidate.mcpServerId === 'string' && + typeof candidate.encryptedCodeVerifier === 'string' && + typeof candidate.encryptedInvitationToken === 'string' && + typeof candidate.createdAt === 'number' + ) +} + +export function isCredentialGroupMcpOAuthState(state: string): boolean { + return state.startsWith(MCP_OAUTH_STATE_PREFIX) +} + +export async function createCredentialGroupMcpOAuthAttempt(params: { + state: string + enrollmentId: string + credentialGroupId: string + mcpServerId: string + codeVerifier: string + invitationToken: string +}): Promise { + if (!isCredentialGroupMcpOAuthState(params.state)) { + throw new Error('Managed MCP OAuth state has an invalid prefix') + } + const redis = requireRedis() + const [codeVerifier, invitationToken] = await Promise.all([ + encryptSecret(params.codeVerifier), + encryptSecret(params.invitationToken), + ]) + const attempt: StoredCredentialGroupMcpOAuthAttempt = { + version: MCP_OAUTH_ATTEMPT_VERSION, + enrollmentId: params.enrollmentId, + credentialGroupId: params.credentialGroupId, + mcpServerId: params.mcpServerId, + encryptedCodeVerifier: codeVerifier.encrypted, + encryptedInvitationToken: invitationToken.encrypted, + createdAt: Date.now(), + } + const stored = await redis.set( + attemptKey(params.state), + JSON.stringify(attempt), + 'PX', + MCP_OAUTH_ATTEMPT_TTL_MS, + 'NX' + ) + if (stored !== 'OK') throw new Error('Credential Group MCP OAuth state collision') + await redis.sadd(serverAttemptsKey(params.mcpServerId), attemptKey(params.state)) + await redis.pexpire(serverAttemptsKey(params.mcpServerId), MCP_OAUTH_ATTEMPT_TTL_MS) +} + +export async function consumeCredentialGroupMcpOAuthAttempt( + state: string +): Promise { + if (!isCredentialGroupMcpOAuthState(state)) return null + const raw = await requireRedis().eval(CONSUME_SCRIPT, 1, attemptKey(state)) + if (raw === null) return null + if (typeof raw !== 'string') throw new Error('Credential Group MCP OAuth state is malformed') + const parsed: unknown = JSON.parse(raw) + if (!isStoredAttempt(parsed)) throw new Error('Credential Group MCP OAuth state is malformed') + await requireRedis().srem(serverAttemptsKey(parsed.mcpServerId), attemptKey(state)) + if (Date.now() - parsed.createdAt > MCP_OAUTH_ATTEMPT_TTL_MS) return null + const [codeVerifier, invitationToken] = await Promise.all([ + decryptSecret(parsed.encryptedCodeVerifier), + decryptSecret(parsed.encryptedInvitationToken), + ]) + return { + state, + enrollmentId: parsed.enrollmentId, + credentialGroupId: parsed.credentialGroupId, + mcpServerId: parsed.mcpServerId, + codeVerifier: codeVerifier.decrypted, + invitationToken: invitationToken.decrypted, + createdAt: parsed.createdAt, + } +} + +export async function clearCredentialGroupMcpOAuthAttempts(mcpServerIds: string[]): Promise { + if (mcpServerIds.length === 0) return + const redis = requireRedis() + await Promise.all( + mcpServerIds.map((mcpServerId) => + redis.eval(CLEAR_SERVER_ATTEMPTS_SCRIPT, 1, serverAttemptsKey(mcpServerId)) + ) + ) +} diff --git a/apps/sim/lib/credential-groups/mcp-oauth.ts b/apps/sim/lib/credential-groups/mcp-oauth.ts new file mode 100644 index 00000000000..0e9df666c25 --- /dev/null +++ b/apps/sim/lib/credential-groups/mcp-oauth.ts @@ -0,0 +1,108 @@ +import type { OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js' +import type { CredentialGroupMcpOAuthContext } from '@/lib/credential-groups/enrollments' +import { createCredentialGroupMcpOAuthAttempt } from '@/lib/credential-groups/mcp-oauth-state' +import { encryptManagedMcpTokens, persistManagedMcpCredential } from '@/lib/credentials/managed-mcp' +import { + assertSafeOauthServerUrl, + getOrCreateOauthRow, + loadPreregisteredClient, + McpOauthRedirectRequired, + mcpAuthGuarded, + withMcpOauthRefreshLock, +} from '@/lib/mcp/oauth' +import { ManagedMcpOauthProvider } from '@/lib/mcp/oauth/managed-provider' +import { mcpService } from '@/lib/mcp/service' + +export async function startCredentialGroupMcpOAuth( + context: CredentialGroupMcpOAuthContext, + invitationToken: string +): Promise { + assertSafeOauthServerUrl(context.server.url) + return withMcpOauthRefreshLock(context.server.id, async () => { + const clientRow = await getOrCreateOauthRow({ + mcpServerId: context.server.id, + workspaceId: context.workspaceId, + }) + const preregistered = await loadPreregisteredClient(context.server.id) + const provider = new ManagedMcpOauthProvider({ + clientRow, + preregistered, + async onSaveTokens() { + throw new Error('Managed MCP OAuth start cannot persist grant tokens') + }, + }) + + try { + const result = await mcpAuthGuarded(provider, { serverUrl: context.server.url }) + if (result === 'AUTHORIZED') { + throw new Error('Managed MCP OAuth unexpectedly authorized without an enrollment grant') + } + throw new Error('Managed MCP OAuth did not produce an authorization redirect') + } catch (error) { + if (!(error instanceof McpOauthRedirectRequired)) throw error + const attempt = provider.requireAuthorizationAttempt() + await createCredentialGroupMcpOAuthAttempt({ + ...attempt, + enrollmentId: context.enrollmentId, + credentialGroupId: context.credentialGroupId, + mcpServerId: context.server.id, + invitationToken, + }) + return error.authorizationUrl + } + }) +} + +export async function completeCredentialGroupMcpOAuth( + context: CredentialGroupMcpOAuthContext, + codeVerifier: string, + authorizationCode: string +): Promise<{ connectionId: string; mcpServerId: string }> { + assertSafeOauthServerUrl(context.server.url) + const clientRow = await getOrCreateOauthRow({ + mcpServerId: context.server.id, + workspaceId: context.workspaceId, + }) + const preregistered = await loadPreregisteredClient(context.server.id) + let grantedTokens: OAuthTokens | undefined + const provider = new ManagedMcpOauthProvider({ + clientRow, + preregistered, + codeVerifier, + async onSaveTokens(tokens) { + if (!tokens) { + grantedTokens = undefined + return + } + await encryptManagedMcpTokens(tokens) + grantedTokens = tokens + }, + }) + const result = await mcpAuthGuarded(provider, { + serverUrl: context.server.url, + authorizationCode, + }) + if (result !== 'AUTHORIZED' || !grantedTokens) { + throw new Error('Managed MCP OAuth token exchange did not return usable tokens') + } + const tools = await mcpService.discoverManagedMcpTools( + context.server.id, + context.workspaceId, + provider, + undefined, + { requireComplete: true } + ) + const connectionId = await persistManagedMcpCredential({ + enrollmentId: context.enrollmentId, + workspaceId: context.workspaceId, + mcpServerId: context.server.id, + mcpServerName: context.server.name, + tokens: grantedTokens, + tools: tools.map((tool) => ({ + name: tool.name, + ...(tool.description ? { description: tool.description } : {}), + inputSchema: tool.inputSchema, + })), + }) + return { connectionId, mcpServerId: context.server.id } +} diff --git a/apps/sim/lib/credential-groups/service.test.ts b/apps/sim/lib/credential-groups/service.test.ts index 32badce9ee4..18a69bf89f1 100644 --- a/apps/sim/lib/credential-groups/service.test.ts +++ b/apps/sim/lib/credential-groups/service.test.ts @@ -79,7 +79,7 @@ describe('Credential Group service', () => { }, ], }) - ).resolves.toMatchObject({ id: 'group-1' }) + ).resolves.toMatchObject({ credentialGroup: { id: 'group-1' } }) expect(mockGetPolicy).toHaveBeenCalledWith( expect.objectContaining({ slackBotCredentialId: 'bot-1' }), @@ -175,7 +175,11 @@ describe('Credential Group service', () => { .mockResolvedValueOnce([{ id: 'policy-1' }]) .mockResolvedValueOnce([{ id: 'group-1' }]) - await expect(deleteCredentialGroup('workspace-1', 'group-1')).resolves.toBe(true) + await expect(deleteCredentialGroup('workspace-1', 'group-1')).resolves.toEqual({ + deleted: true, + retiredMcpConnectionIds: [], + retiredMcpServerIds: [], + }) expect(dbChainMockFns.for).toHaveBeenCalledWith('update') expect(dbChainMockFns.delete).toHaveBeenCalledTimes(2) diff --git a/apps/sim/lib/credential-groups/service.ts b/apps/sim/lib/credential-groups/service.ts index 6bff6ee700d..c754b11a6d4 100644 --- a/apps/sim/lib/credential-groups/service.ts +++ b/apps/sim/lib/credential-groups/service.ts @@ -4,13 +4,16 @@ import { credential, credentialGroup, credentialGroupEnrollment, + mcpServers, } from '@sim/db/schema' import { generateId } from '@sim/utils/id' -import { and, desc, eq, inArray } from 'drizzle-orm' +import { and, asc, desc, eq, inArray, isNull } from 'drizzle-orm' import { credentialGroupWorkflowAccessPolicyCodec, requireDefaultCredentialGroupWorkflowAccessPolicy, } from '@/lib/credential-groups/application/workflow-access-policy' +import { getManagedMcpConnector } from '@/lib/credential-groups/managed-mcp-connectors' +import { retireManagedMcpServersForGroup } from '@/lib/credential-groups/managed-mcp-service' import { credentialGroupScopePolicyVersion } from '@/lib/credential-groups/provider-adapter' import { decryptCredentialGroupProviderConfiguration } from '@/lib/credential-groups/provider-configuration' import { getCredentialGroupProviderAdapter } from '@/lib/credential-groups/provider-registry' @@ -18,6 +21,7 @@ import { isCredentialGroupProvider } from '@/lib/credential-groups/providers' import { SLACK_MANAGED_USER_SCOPES } from '@/lib/credential-groups/slack-managed-user-scopes' import type { CreateCredentialGroupInput, + CredentialGroupMcpServer, CredentialGroupOptionInput, CredentialGroupRecord, UpdateCredentialGroupInput, @@ -28,6 +32,44 @@ import { requireResourcePolicy, } from '@/lib/resource-policies/repository' +interface CredentialGroupMutationResult { + credentialGroup: CredentialGroupRecord + retiredMcpConnectionIds: string[] +} + +interface DeleteCredentialGroupResult { + deleted: boolean + retiredMcpConnectionIds: string[] + retiredMcpServerIds: string[] +} + +async function listLinkedMcpServers( + credentialGroupId: string, + executor: DbOrTx = db +): Promise { + const rows = await executor + .select({ + id: mcpServers.id, + name: mcpServers.name, + description: mcpServers.description, + authType: mcpServers.authType, + enabled: mcpServers.enabled, + managedConnectorId: mcpServers.managedConnectorId, + }) + .from(mcpServers) + .where(and(eq(mcpServers.credentialGroupId, credentialGroupId), isNull(mcpServers.deletedAt))) + .orderBy(asc(mcpServers.name), asc(mcpServers.id)) + return rows.map((row) => { + if (!row.managedConnectorId) { + throw new Error(`Credential Group MCP server ${row.id} has no managed connector ID`) + } + return { + ...row, + managedConnectorId: getManagedMcpConnector(row.managedConnectorId).id, + } + }) +} + function scopesEqual(left: string[], right: string[]): boolean { const normalizedLeft = [...new Set(left)].sort() const normalizedRight = [...new Set(right)].sort() @@ -97,7 +139,8 @@ async function updateOptions( } async function toCredentialGroup( - row: typeof credentialGroup.$inferSelect + row: typeof credentialGroup.$inferSelect, + linkedMcpServers: CredentialGroupMcpServer[] ): Promise { const providerConfiguration = await decryptCredentialGroupProviderConfiguration( row.encryptedProviderConfiguration @@ -140,6 +183,7 @@ async function toCredentialGroup( : ('ready' as const), } }), + mcpServers: linkedMcpServers, status: row.status, createdAt: row.createdAt.toISOString(), updatedAt: row.updatedAt.toISOString(), @@ -147,12 +191,42 @@ async function toCredentialGroup( } export async function listCredentialGroups(workspaceId: string): Promise { - const rows = await db - .select() - .from(credentialGroup) - .where(eq(credentialGroup.workspaceId, workspaceId)) - .orderBy(desc(credentialGroup.createdAt)) - return Promise.all(rows.map(toCredentialGroup)) + const [rows, serverRows] = await Promise.all([ + db + .select() + .from(credentialGroup) + .where(eq(credentialGroup.workspaceId, workspaceId)) + .orderBy(desc(credentialGroup.createdAt)), + db + .select({ + id: mcpServers.id, + name: mcpServers.name, + description: mcpServers.description, + authType: mcpServers.authType, + enabled: mcpServers.enabled, + credentialGroupId: mcpServers.credentialGroupId, + managedConnectorId: mcpServers.managedConnectorId, + }) + .from(mcpServers) + .where(and(eq(mcpServers.workspaceId, workspaceId), isNull(mcpServers.deletedAt))) + .orderBy(asc(mcpServers.name), asc(mcpServers.id)), + ]) + const serversByGroupId = new Map() + for (const server of serverRows) { + if (!server.credentialGroupId) continue + const summary = { + id: server.id, + name: server.name, + description: server.description, + authType: server.authType, + enabled: server.enabled, + managedConnectorId: getManagedMcpConnector(server.managedConnectorId ?? '').id, + } + const current = serversByGroupId.get(server.credentialGroupId) + if (current) current.push(summary) + else serversByGroupId.set(server.credentialGroupId, [summary]) + } + return Promise.all(rows.map((row) => toCredentialGroup(row, serversByGroupId.get(row.id) ?? []))) } export async function getCredentialGroup( @@ -164,7 +238,7 @@ export async function getCredentialGroup( .from(credentialGroup) .where(and(eq(credentialGroup.id, groupId), eq(credentialGroup.workspaceId, workspaceId))) .limit(1) - return row ? toCredentialGroup(row) : null + return row ? toCredentialGroup(row, await listLinkedMcpServers(row.id)) : null } export async function createCredentialGroup( @@ -206,14 +280,14 @@ export async function createCredentialGroup( document: policy.document, credentialGroupId: created.id, }) - return toCredentialGroup(created) + return toCredentialGroup(created, await listLinkedMcpServers(created.id, tx)) }) } export async function deleteCredentialGroup( workspaceId: string, groupId: string -): Promise { +): Promise { return db.transaction(async (tx) => { const [existing] = await tx .select({ id: credentialGroup.id }) @@ -221,7 +295,11 @@ export async function deleteCredentialGroup( .where(and(eq(credentialGroup.id, groupId), eq(credentialGroup.workspaceId, workspaceId))) .limit(1) .for('update') - if (!existing) return false + if (!existing) { + return { deleted: false, retiredMcpConnectionIds: [], retiredMcpServerIds: [] } + } + + const retiredMcp = await retireManagedMcpServersForGroup(workspaceId, groupId, tx) await deleteResourcePolicyForResource( { workspaceId, resourceType: 'credential_group', resourceId: groupId }, @@ -232,7 +310,11 @@ export async function deleteCredentialGroup( .where(and(eq(credentialGroup.id, groupId), eq(credentialGroup.workspaceId, workspaceId))) .returning({ id: credentialGroup.id }) if (deleted.length !== 1) throw new Error('Locked Credential Group delete returned no row') - return true + return { + deleted: true, + retiredMcpConnectionIds: retiredMcp.connectionIds, + retiredMcpServerIds: retiredMcp.serverIds, + } }) } @@ -240,7 +322,7 @@ export async function updateCredentialGroup( workspaceId: string, groupId: string, body: UpdateCredentialGroupInput -): Promise { +): Promise { return db.transaction(async (tx) => { const [existing] = await tx .select() @@ -302,6 +384,9 @@ export async function updateCredentialGroup( ) ) } - return toCredentialGroup(updated) + return { + credentialGroup: await toCredentialGroup(updated, await listLinkedMcpServers(updated.id, tx)), + retiredMcpConnectionIds: [], + } }) } diff --git a/apps/sim/lib/credential-groups/types.ts b/apps/sim/lib/credential-groups/types.ts index a9c39dc5ebe..8842f88c077 100644 --- a/apps/sim/lib/credential-groups/types.ts +++ b/apps/sim/lib/credential-groups/types.ts @@ -1,3 +1,4 @@ +import type { ManagedMcpConnectorId } from '@/lib/credential-groups/managed-mcp-connectors' import type { CredentialGroupProvider } from '@/lib/credential-groups/providers' interface CredentialGroupOptionInputBase { @@ -29,6 +30,15 @@ export interface UpdateCredentialGroupInput { status?: 'active' | 'disabled' } +export interface CredentialGroupMcpServer { + id: string + name: string + description: string | null + authType: string + enabled: boolean + managedConnectorId: ManagedMcpConnectorId +} + interface CredentialGroupOptionBase { id: string label: string @@ -53,6 +63,7 @@ export interface CredentialGroupRecord { name: string description: string | null options: CredentialGroupOption[] + mcpServers: CredentialGroupMcpServer[] status: 'active' | 'disabled' createdAt: string updatedAt: string @@ -86,8 +97,15 @@ export interface CredentialGroupEnrollmentConnection { count: number } +export interface CredentialGroupEnrollmentMcpConnection { + mcpServerId: string + name: string + status: 'active' | 'needs_reauth' | 'revoked' +} + export interface CredentialGroupEnrollmentDetail extends CredentialGroupEnrollmentRecord { connections: CredentialGroupEnrollmentConnection[] + mcpConnections: CredentialGroupEnrollmentMcpConnection[] } export interface InviteCredentialGroupEnrollmentsInput { diff --git a/apps/sim/lib/credentials/access.ts b/apps/sim/lib/credentials/access.ts index 6f7bc25515e..9f1da73fa52 100644 --- a/apps/sim/lib/credentials/access.ts +++ b/apps/sim/lib/credentials/access.ts @@ -12,12 +12,23 @@ type ActiveCredentialMember = typeof credentialMember.$inferSelect type CredentialRecord = typeof credential.$inferSelect export type CredentialType = (typeof credentialTypeEnum.enumValues)[number] -export type OrdinaryCredentialType = Exclude +export type ManagedCredentialType = Extract + +export const MANAGED_CREDENTIAL_TYPES: readonly ManagedCredentialType[] = [ + 'managed_oauth', + 'managed_mcp', +] + +export function isManagedCredentialType(type: CredentialType): type is ManagedCredentialType { + return MANAGED_CREDENTIAL_TYPES.some((managed) => managed === type) +} + +export type OrdinaryCredentialType = Exclude /** Narrows credentials exposed through ordinary user-managed credential surfaces. */ export function requireOrdinaryCredentialType(type: CredentialType): OrdinaryCredentialType { - if (type === 'managed_oauth') { - throw new Error('Managed OAuth credential reached an ordinary credential surface') + if (isManagedCredentialType(type)) { + throw new Error('Managed credential reached an ordinary credential surface') } return type } diff --git a/apps/sim/lib/credentials/application/authorization.ts b/apps/sim/lib/credentials/application/authorization.ts index ef384c6b346..acee7eea975 100644 --- a/apps/sim/lib/credentials/application/authorization.ts +++ b/apps/sim/lib/credentials/application/authorization.ts @@ -1,10 +1,12 @@ import { type Principal, resolvePrincipalExecutionActorUserId } from '@sim/auth/principal' import type { WorkspaceDelegationPolicy } from '@/lib/core/application' import { OrchestrationError } from '@/lib/core/orchestration/types' +import type { ManagedMcpCredentialApplicationContext } from '@/lib/credentials/managed-mcp' import type { ManagedOAuthCredentialApplicationContext } from '@/lib/credentials/managed-oauth' export const CREDENTIAL_DELEGATION_AUDIENCE = 'sim:credentials' export const MANAGED_OAUTH_DELEGATION_AUDIENCE = 'sim:managed-oauth-credentials' +export const MANAGED_MCP_DELEGATION_AUDIENCE = 'sim:managed-mcp-credentials' export const credentialDelegationPolicy = { audience: CREDENTIAL_DELEGATION_AUDIENCE, @@ -23,6 +25,14 @@ export const managedOAuthCredentialDelegationPolicy = { ) => principal.resourceScope?.credentialId === context.credentialId, } satisfies WorkspaceDelegationPolicy +export const managedMcpCredentialDelegationPolicy = { + audience: MANAGED_MCP_DELEGATION_AUDIENCE, + isWithinScope: ( + principal: Extract, + context: ManagedMcpCredentialApplicationContext + ) => principal.resourceScope?.credentialId === context.credentialId, +} satisfies WorkspaceDelegationPolicy + /** * Resolves the user whose credential grants an operation evaluates. * diff --git a/apps/sim/lib/credentials/application/credential-crud.test.ts b/apps/sim/lib/credentials/application/credential-crud.test.ts index c90980159b9..0ba3a46a136 100644 --- a/apps/sim/lib/credentials/application/credential-crud.test.ts +++ b/apps/sim/lib/credentials/application/credential-crud.test.ts @@ -37,6 +37,7 @@ vi.mock('@/lib/credentials/queries', () => ({ vi.mock('@/lib/credentials/access', () => ({ getCredentialActorContext: mocks.getActor, canUseCredential: () => true, + requireOrdinaryCredentialType: (type: string) => type, })) vi.mock('@/lib/credentials/orchestration', () => ({ updateCredentialRecord: mocks.updateRecord, diff --git a/apps/sim/lib/credentials/application/credential-crud.ts b/apps/sim/lib/credentials/application/credential-crud.ts index e0ba3090979..13938cb9abd 100644 --- a/apps/sim/lib/credentials/application/credential-crud.ts +++ b/apps/sim/lib/credentials/application/credential-crud.ts @@ -3,7 +3,11 @@ import { requirePrincipalSubjectUserId } from '@sim/auth/principal' import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application' import { getBlockVisibility } from '@/lib/core/config/block-visibility' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { canUseCredential, getCredentialActorContext } from '@/lib/credentials/access' +import { + canUseCredential, + getCredentialActorContext, + requireOrdinaryCredentialType, +} from '@/lib/credentials/access' import { defineAuthorizedCredentialUseCase, requireCredentialAccess, @@ -241,7 +245,7 @@ export const createWorkspaceCredential = defineAuthorizedWorkspaceUseCase({ requirePrincipalSubjectUserId(principal), 'credential_connected', { - credential_type: result.credential.type, + credential_type: requireOrdinaryCredentialType(result.credential.type), provider_id: result.credential.providerId ?? result.credential.type, workspace_id: context.workspaceId, }, diff --git a/apps/sim/lib/credentials/application/credential-members.ts b/apps/sim/lib/credentials/application/credential-members.ts index 58a2262ce60..48736ffceae 100644 --- a/apps/sim/lib/credentials/application/credential-members.ts +++ b/apps/sim/lib/credentials/application/credential-members.ts @@ -1,6 +1,7 @@ import { AuditAction, AuditResourceType } from '@sim/audit' import { requirePrincipalSubjectUserId, type SessionPrincipal } from '@sim/auth/principal' import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application' +import { requireOrdinaryCredentialType } from '@/lib/credentials/access' import { defineAuthorizedCredentialUseCase } from '@/lib/credentials/application/authorized-credential-use-case' import { defineAuthorizedCredentialUserUseCase } from '@/lib/credentials/application/authorized-user-use-case' import { resolveCredentialApplicationContext } from '@/lib/credentials/application/credential-context' @@ -86,7 +87,7 @@ export const upsertCredentialMemberUseCase = defineAuthorizedCredentialUseCase({ afterSuccess: ({ principal, context, result }) => { if (!result.created) return captureServerEvent(requirePrincipalSubjectUserId(principal), 'credential_shared', { - credential_type: context.credential.type, + credential_type: requireOrdinaryCredentialType(context.credential.type), role: result.role, workspace_id: context.workspaceId, }) @@ -119,7 +120,7 @@ export const removeCredentialMemberUseCase = defineAuthorizedCredentialUseCase({ }), afterSuccess: ({ principal, context }) => { captureServerEvent(requirePrincipalSubjectUserId(principal), 'credential_unshared', { - credential_type: context.credential.type, + credential_type: requireOrdinaryCredentialType(context.credential.type), workspace_id: context.workspaceId, }) }, diff --git a/apps/sim/lib/credentials/application/discover-managed-mcp-tools.test.ts b/apps/sim/lib/credentials/application/discover-managed-mcp-tools.test.ts new file mode 100644 index 00000000000..0e6f6f77a7a --- /dev/null +++ b/apps/sim/lib/credentials/application/discover-managed-mcp-tools.test.ts @@ -0,0 +1,143 @@ +/** + * @vitest-environment node + */ +import type { WorkflowExecutionDelegatedPrincipal } from '@sim/auth/principal' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + discoverTools: vi.fn(), + loadAuthProvider: vi.fn(), + loadContext: vi.fn(), + loadRuntime: vi.fn(), + requireCredentialAccess: vi.fn(), + resolvePermission: vi.fn(), + saveToolSnapshot: vi.fn(), +})) + +vi.mock('@/lib/credentials/managed-mcp', () => ({ + loadManagedMcpCredentialApplicationContext: mocks.loadContext, + loadManagedMcpRuntimeCredential: mocks.loadRuntime, + saveManagedMcpToolSnapshot: mocks.saveToolSnapshot, +})) + +vi.mock('@/lib/credential-groups/application/authorization', () => ({ + requireCredentialGroupCredentialAccess: mocks.requireCredentialAccess, +})) + +vi.mock('@/lib/mcp/application/managed-auth-provider', () => ({ + loadManagedMcpAuthProvider: mocks.loadAuthProvider, +})) + +vi.mock('@/lib/mcp/oauth', () => ({ + withMcpOauthRefreshLock: vi.fn((_credentialId: string, operation: () => Promise) => + operation() + ), +})) + +vi.mock('@/lib/mcp/service', () => ({ + mcpService: { discoverManagedMcpTools: mocks.discoverTools }, +})) + +vi.mock('@sim/platform-authz/workspace', () => ({ + permissionSatisfies: (permission: string | null, required: string) => + permission === 'admin' || permission === 'write' || permission === required, + resolveEffectiveWorkspacePermission: mocks.resolvePermission, +})) + +import { discoverManagedMcpToolsUseCase } from '@/lib/credentials/application/discover-managed-mcp-tools' + +const context = { + credentialId: 'mcp-cg-123456789012345678901', + credentialGroupId: 'group-1', + credentialGroupEnrollmentId: 'selected-enrollment', + mcpServerId: 'mcp-fireflies', + mcpServerName: 'Fireflies', + workspaceId: 'workspace-1', + workspaceOrganizationId: null, + allowPersonalApiKeys: true, +} + +const principal: WorkflowExecutionDelegatedPrincipal = { + kind: 'delegated', + serviceId: 'executor', + subjectUserId: 'execution-user', + workspaceId: context.workspaceId, + delegationId: 'delegation-1', + audience: 'sim:managed-mcp-credentials', + issuedAt: new Date(Date.now() - 1_000), + expiresAt: new Date(Date.now() + 60_000), + resourceScope: { credentialId: context.credentialId }, + delegationContext: { + kind: 'workflow_execution', + workflowId: 'workflow-1', + principal: { kind: 'session', userId: 'execution-user', sessionId: 'session-1' }, + currentWorkflow: { workflowId: 'workflow-1', mode: 'draft' }, + }, +} + +describe('discoverManagedMcpToolsUseCase', () => { + beforeEach(() => { + vi.clearAllMocks() + mocks.loadContext.mockResolvedValue(context) + mocks.loadRuntime.mockResolvedValue({ + credentialId: context.credentialId, + mcpServerId: context.mcpServerId, + mcpServerName: context.mcpServerName, + workspaceId: context.workspaceId, + tokenVersion: 'encrypted-token-version-1', + tokens: { access_token: 'access-token' }, + tools: [], + }) + mocks.loadAuthProvider.mockResolvedValue({}) + mocks.requireCredentialAccess.mockResolvedValue(undefined) + mocks.resolvePermission.mockResolvedValue('read') + mocks.discoverTools.mockResolvedValue([ + { + name: 'search_transcripts', + description: 'Search transcripts', + inputSchema: { type: 'object', properties: {} }, + serverId: context.mcpServerId, + serverName: context.mcpServerName, + }, + ]) + }) + + it('discovers through the explicit credential and projects that ID as the tool server', async () => { + const signal = new AbortController().signal + const result = await discoverManagedMcpToolsUseCase.execute({ + principal, + input: { + workspaceId: context.workspaceId, + credentialId: context.credentialId, + signal, + }, + }) + + expect(mocks.requireCredentialAccess).toHaveBeenCalledWith(principal, context, { + resourceType: 'credential_group', + action: 'credential_groups.credentials.use', + }) + expect(mocks.loadRuntime).toHaveBeenCalledWith(context.credentialId, context.workspaceId) + expect(mocks.discoverTools).toHaveBeenCalledWith( + context.mcpServerId, + context.workspaceId, + {}, + signal, + { requireComplete: true } + ) + expect(result.tools).toEqual([ + expect.objectContaining({ + name: 'search_transcripts', + serverId: context.credentialId, + serverName: context.mcpServerName, + }), + ]) + expect(mocks.saveToolSnapshot).toHaveBeenCalledWith(context.credentialId, [ + { + name: 'search_transcripts', + description: 'Search transcripts', + inputSchema: { type: 'object', properties: {} }, + }, + ]) + }) +}) diff --git a/apps/sim/lib/credentials/application/discover-managed-mcp-tools.ts b/apps/sim/lib/credentials/application/discover-managed-mcp-tools.ts new file mode 100644 index 00000000000..0e8ba546f31 --- /dev/null +++ b/apps/sim/lib/credentials/application/discover-managed-mcp-tools.ts @@ -0,0 +1,73 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { requireCredentialGroupCredentialAccess } from '@/lib/credential-groups/application/authorization' +import { managedMcpCredentialDelegationPolicy } from '@/lib/credentials/application/authorization' +import { credentialOperations } from '@/lib/credentials/application/operations' +import { + loadManagedMcpCredentialApplicationContext, + loadManagedMcpRuntimeCredential, + saveManagedMcpToolSnapshot, +} from '@/lib/credentials/managed-mcp' +import { loadManagedMcpAuthProvider } from '@/lib/mcp/application/managed-auth-provider' +import { withMcpOauthRefreshLock } from '@/lib/mcp/oauth' +import { mcpService } from '@/lib/mcp/service' + +export interface DiscoverManagedMcpToolsInput { + workspaceId: string + credentialId: string + signal?: AbortSignal +} + +export const discoverManagedMcpToolsUseCase = defineAuthorizedWorkspaceUseCase({ + operation: credentialOperations.useManagedMcp, + resolveContext: async ({ input }: { input: DiscoverManagedMcpToolsInput }) => { + const context = await loadManagedMcpCredentialApplicationContext(input.credentialId) + if (!context || context.workspaceId !== input.workspaceId) { + throw new OrchestrationError('not_found', 'Managed MCP connection not found') + } + return context + }, + authorizationOptions: { delegation: managedMcpCredentialDelegationPolicy }, + async authorizeResource({ principal, context, resourcePolicy }) { + await requireCredentialGroupCredentialAccess(principal, context, resourcePolicy) + }, + async execute({ input, context }) { + input.signal?.throwIfAborted() + const runtime = await loadManagedMcpRuntimeCredential(context.credentialId, context.workspaceId) + const tools = await withMcpOauthRefreshLock(runtime.credentialId, async () => + mcpService.discoverManagedMcpTools( + runtime.mcpServerId, + runtime.workspaceId, + await loadManagedMcpAuthProvider(runtime.credentialId, runtime.workspaceId), + input.signal, + { requireComplete: true } + ) + ) + await saveManagedMcpToolSnapshot( + runtime.credentialId, + tools.map((tool) => ({ + name: tool.name, + ...(tool.description ? { description: tool.description } : {}), + inputSchema: tool.inputSchema, + })) + ) + return { + tools: tools.map((tool) => ({ + ...tool, + serverId: runtime.credentialId, + serverName: runtime.mcpServerName, + })), + } + }, + projectAudit: ({ context }) => ({ + action: AuditAction.CREDENTIAL_ACCESSED, + resourceType: AuditResourceType.CREDENTIAL, + resourceId: context.credentialId, + description: `Discovered tools from managed MCP credential ${context.credentialId}`, + metadata: { + credentialType: 'managed_mcp', + mcpServerId: context.mcpServerId, + }, + }), +}) diff --git a/apps/sim/lib/credentials/application/operations.ts b/apps/sim/lib/credentials/application/operations.ts index 4bda143e590..c851eaac563 100644 --- a/apps/sim/lib/credentials/application/operations.ts +++ b/apps/sim/lib/credentials/application/operations.ts @@ -183,6 +183,18 @@ export const credentialOperations = { action: CREDENTIAL_GROUP_CREDENTIAL_USE_ACTION, }, }), + useManagedMcp: defineWorkspaceOperation({ + id: 'credentials.managed_mcp.use', + minimumRole: 'read', + workspaceApiKey: 'deny', + capability: 'integrations.manage', + principalKinds: ['delegated'], + delegatedServices: ['executor'], + resourcePolicy: { + resourceType: 'credential_group', + action: CREDENTIAL_GROUP_CREDENTIAL_USE_ACTION, + }, + }), } as const /** diff --git a/apps/sim/lib/credentials/application/presentation.ts b/apps/sim/lib/credentials/application/presentation.ts index 3770f2ab7f7..a7a9305580d 100644 --- a/apps/sim/lib/credentials/application/presentation.ts +++ b/apps/sim/lib/credentials/application/presentation.ts @@ -36,6 +36,7 @@ export function toWorkspaceCredential( access?: CredentialActorContext ): WorkspaceCredential { const type = requireOrdinaryCredentialType(row.type) + if (!row.createdBy) throw new Error(`Credential ${row.id} has no creator`) const role = access?.isAdmin ? 'admin' : (access?.member?.role ?? ('role' in row ? row.role : undefined)) diff --git a/apps/sim/lib/credentials/application/service-account.test.ts b/apps/sim/lib/credentials/application/service-account.test.ts index dbdf310231e..20828646e5a 100644 --- a/apps/sim/lib/credentials/application/service-account.test.ts +++ b/apps/sim/lib/credentials/application/service-account.test.ts @@ -39,6 +39,12 @@ vi.mock('@/lib/credentials/queries', () => ({ })) vi.mock('@/lib/credentials/access', () => ({ getCredentialActorContext: mocks.getActor, + requireOrdinaryCredentialType: (type: string) => { + if (type === 'managed_oauth' || type === 'managed_mcp') { + throw new Error('Managed credential reached an ordinary credential surface') + } + return type + }, })) vi.mock('@/lib/posthog/server', () => ({ captureServerEvent: mocks.capture })) diff --git a/apps/sim/lib/credentials/application/service-account.ts b/apps/sim/lib/credentials/application/service-account.ts index 6112b39a99d..6061034e068 100644 --- a/apps/sim/lib/credentials/application/service-account.ts +++ b/apps/sim/lib/credentials/application/service-account.ts @@ -4,7 +4,7 @@ import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application' import { ForbiddenOperationError } from '@/lib/core/application/forbidden' import { OrchestrationError } from '@/lib/core/orchestration/types' import { HttpError } from '@/lib/core/utils/http-error' -import { getCredentialActorContext } from '@/lib/credentials/access' +import { getCredentialActorContext, requireOrdinaryCredentialType } from '@/lib/credentials/access' import { defineAuthorizedCredentialUseCase, requireManageableCredentialType, @@ -183,7 +183,7 @@ export const deleteCredentialUseCase = defineAuthorizedCredentialUseCase({ requirePrincipalSubjectUserId(principal), 'credential_deleted', { - credential_type: result.credential.type, + credential_type: requireOrdinaryCredentialType(result.credential.type), provider_id: result.credential.providerId ?? result.credential.envKey ?? result.credential.id, workspace_id: context.workspaceId, diff --git a/apps/sim/lib/credentials/managed-mcp.ts b/apps/sim/lib/credentials/managed-mcp.ts new file mode 100644 index 00000000000..df57d76d215 --- /dev/null +++ b/apps/sim/lib/credentials/managed-mcp.ts @@ -0,0 +1,402 @@ +import type { OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js' +import { db } from '@sim/db' +import { + credential, + credentialGroup, + credentialGroupEnrollment, + type ManagedMcpToolSnapshot, + mcpServers, +} from '@sim/db/schema' +import { getErrorMessage } from '@sim/utils/errors' +import { and, eq, isNull, ne } from 'drizzle-orm' +import { getWorkspaceOwnerSubscriptionAccess } from '@/lib/billing/core/workspace-access' +import type { WorkspaceAuthorizationContext } from '@/lib/core/application' +import { decryptSecret, encryptSecret } from '@/lib/core/security/encryption' +import { isCredentialGroupsAvailable } from '@/lib/credential-groups/availability' +import { lockCredentialGroupEnrollmentLifecycle } from '@/lib/credential-groups/enrollments' +import { getManagedMcpConnector } from '@/lib/credential-groups/managed-mcp-connectors' +import { generateManagedMcpConnectionId } from '@/lib/mcp/utils' +import { loadActiveWorkspaceApplicationContext } from '@/lib/workspaces/application/workspace-context' + +const MANAGED_MCP_TOKEN_SET_TYPE = 'managed-mcp-oauth-token-set' as const +const MANAGED_MCP_TOKEN_SET_VERSION = 1 as const + +interface ManagedMcpTokenEnvelope { + type: typeof MANAGED_MCP_TOKEN_SET_TYPE + version: typeof MANAGED_MCP_TOKEN_SET_VERSION + tokens: OAuthTokens +} + +export interface ManagedMcpCredentialApplicationContext extends WorkspaceAuthorizationContext { + credentialId: string + credentialGroupId: string + credentialGroupEnrollmentId: string + mcpServerId: string + mcpServerName: string +} + +export interface ManagedMcpRuntimeCredential { + credentialId: string + mcpServerId: string + mcpServerName: string + workspaceId: string + tokenVersion: string + tokens: OAuthTokens + tools: ManagedMcpToolSnapshot[] +} + +export class ManagedMcpCredentialError extends Error { + constructor( + message: string, + readonly statusCode: 401 | 403 | 404 | 500 + ) { + super(message) + this.name = 'ManagedMcpCredentialError' + } +} + +function isOAuthTokens(value: unknown): value is OAuthTokens { + if (!value || typeof value !== 'object') return false + const candidate = value as Record + return ( + typeof candidate.access_token === 'string' && + candidate.access_token.length > 0 && + (candidate.refresh_token === undefined || typeof candidate.refresh_token === 'string') && + (candidate.token_type === undefined || typeof candidate.token_type === 'string') && + (candidate.expires_in === undefined || typeof candidate.expires_in === 'number') + ) +} + +export async function encryptManagedMcpTokens(tokens: OAuthTokens): Promise { + if (!isOAuthTokens(tokens)) throw new ManagedMcpCredentialError('Invalid MCP OAuth tokens', 500) + const envelope: ManagedMcpTokenEnvelope = { + type: MANAGED_MCP_TOKEN_SET_TYPE, + version: MANAGED_MCP_TOKEN_SET_VERSION, + tokens, + } + return (await encryptSecret(JSON.stringify(envelope))).encrypted +} + +export async function decryptManagedMcpTokens(encrypted: string): Promise { + try { + const { decrypted } = await decryptSecret(encrypted) + const parsed: unknown = JSON.parse(decrypted) + if (!parsed || typeof parsed !== 'object') throw new Error('Invalid token envelope') + const envelope = parsed as Record + if ( + envelope.type !== MANAGED_MCP_TOKEN_SET_TYPE || + envelope.version !== MANAGED_MCP_TOKEN_SET_VERSION || + !isOAuthTokens(envelope.tokens) + ) { + throw new Error('Invalid token envelope') + } + return envelope.tokens + } catch (error) { + throw new ManagedMcpCredentialError( + `Managed MCP credential token data is invalid: ${getErrorMessage(error)}`, + 500 + ) + } +} + +export async function loadManagedMcpCredentialApplicationContext( + credentialId: string +): Promise { + const [row] = await db + .select({ + credentialId: credential.id, + workspaceId: credential.workspaceId, + credentialGroupId: credentialGroup.id, + credentialGroupEnrollmentId: credentialGroupEnrollment.id, + mcpServerId: mcpServers.id, + mcpServerName: mcpServers.name, + managedConnectorId: mcpServers.managedConnectorId, + }) + .from(credential) + .innerJoin( + credentialGroupEnrollment, + eq(credentialGroupEnrollment.id, credential.credentialGroupEnrollmentId) + ) + .innerJoin(credentialGroup, eq(credentialGroup.id, credentialGroupEnrollment.credentialGroupId)) + .innerJoin(mcpServers, eq(mcpServers.id, credential.mcpServerId)) + .where(and(eq(credential.id, credentialId), eq(credential.type, 'managed_mcp'))) + .limit(1) + if (!row) return null + if (!row.managedConnectorId) { + throw new Error(`Managed MCP server ${row.mcpServerId} has no connector ID`) + } + getManagedMcpConnector(row.managedConnectorId) + const workspaceContext = await loadActiveWorkspaceApplicationContext(row.workspaceId) + return workspaceContext ? { ...workspaceContext, ...row } : null +} + +export async function loadManagedMcpRuntimeCredential( + credentialId: string, + workspaceId: string +): Promise { + const ownerBilling = await getWorkspaceOwnerSubscriptionAccess(workspaceId) + if (!(await isCredentialGroupsAvailable({ workspaceId, ownerBilling }))) { + throw new ManagedMcpCredentialError( + 'Managed MCP credentials are not available for this workspace', + 403 + ) + } + + const [row] = await db + .select({ + credentialId: credential.id, + workspaceId: credential.workspaceId, + status: credential.managedOauthStatus, + encryptedTokens: credential.encryptedOauthTokenSet, + tools: credential.mcpTools, + enrollmentStatus: credentialGroupEnrollment.status, + groupStatus: credentialGroup.status, + credentialGroupId: credentialGroup.id, + linkedCredentialGroupId: mcpServers.credentialGroupId, + mcpServerId: mcpServers.id, + mcpServerName: mcpServers.name, + managedConnectorId: mcpServers.managedConnectorId, + }) + .from(credential) + .innerJoin( + credentialGroupEnrollment, + eq(credentialGroupEnrollment.id, credential.credentialGroupEnrollmentId) + ) + .innerJoin(credentialGroup, eq(credentialGroup.id, credentialGroupEnrollment.credentialGroupId)) + .innerJoin(mcpServers, eq(mcpServers.id, credential.mcpServerId)) + .where( + and( + eq(credential.id, credentialId), + eq(credential.workspaceId, workspaceId), + eq(credential.type, 'managed_mcp'), + eq(mcpServers.workspaceId, workspaceId), + eq(mcpServers.authType, 'oauth'), + eq(mcpServers.enabled, true), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + if (!row) throw new ManagedMcpCredentialError('Managed MCP credential not found', 404) + if (!row.managedConnectorId) { + throw new ManagedMcpCredentialError('Managed MCP connector metadata is missing', 500) + } + getManagedMcpConnector(row.managedConnectorId) + if ( + row.status !== 'active' || + row.groupStatus !== 'active' || + !['in_progress', 'completed'].includes(row.enrollmentStatus) || + row.linkedCredentialGroupId !== row.credentialGroupId + ) { + throw new ManagedMcpCredentialError('Managed MCP credential needs authorization', 401) + } + if (!row.encryptedTokens) { + throw new ManagedMcpCredentialError('Managed MCP credential token data is missing', 500) + } + if (!row.tools) throw new ManagedMcpCredentialError('Managed MCP tool metadata is missing', 500) + return { + credentialId: row.credentialId, + workspaceId: row.workspaceId, + mcpServerId: row.mcpServerId, + mcpServerName: row.mcpServerName, + tokenVersion: row.encryptedTokens, + tokens: await decryptManagedMcpTokens(row.encryptedTokens), + tools: row.tools, + } +} + +export async function persistManagedMcpCredential(params: { + enrollmentId: string + workspaceId: string + mcpServerId: string + mcpServerName: string + tokens: OAuthTokens + tools: Array<{ name: string; description?: string; inputSchema: Record }> +}): Promise { + const encryptedOauthTokenSet = await encryptManagedMcpTokens(params.tokens) + const now = new Date() + const accessTokenExpiresAt = + typeof params.tokens.expires_in === 'number' + ? new Date(now.getTime() + params.tokens.expires_in * 1000) + : null + return db.transaction(async (tx) => { + await lockCredentialGroupEnrollmentLifecycle(tx, params.enrollmentId) + const [source] = await tx + .select({ + enrollmentStatus: credentialGroupEnrollment.status, + credentialGroupId: credentialGroupEnrollment.credentialGroupId, + groupStatus: credentialGroup.status, + linkedCredentialGroupId: mcpServers.credentialGroupId, + managedConnectorId: mcpServers.managedConnectorId, + }) + .from(credentialGroupEnrollment) + .innerJoin( + credentialGroup, + eq(credentialGroup.id, credentialGroupEnrollment.credentialGroupId) + ) + .innerJoin(mcpServers, eq(mcpServers.id, params.mcpServerId)) + .where( + and( + eq(credentialGroupEnrollment.id, params.enrollmentId), + eq(credentialGroup.workspaceId, params.workspaceId), + eq(mcpServers.workspaceId, params.workspaceId), + eq(mcpServers.authType, 'oauth'), + eq(mcpServers.enabled, true), + isNull(mcpServers.deletedAt) + ) + ) + .limit(1) + .for('update') + if ( + !source || + !source.managedConnectorId || + source.groupStatus !== 'active' || + !['invited', 'in_progress', 'completed'].includes(source.enrollmentStatus) || + source.linkedCredentialGroupId !== source.credentialGroupId + ) { + throw new ManagedMcpCredentialError('Managed MCP connection is no longer available', 404) + } + getManagedMcpConnector(source.managedConnectorId) + + const [existing] = await tx + .select({ id: credential.id }) + .from(credential) + .where( + and( + eq(credential.type, 'managed_mcp'), + eq(credential.credentialGroupEnrollmentId, params.enrollmentId), + eq(credential.mcpServerId, params.mcpServerId) + ) + ) + .limit(1) + .for('update') + const values = { + displayName: params.mcpServerName, + managedOauthStatus: 'active' as const, + encryptedOauthTokenSet, + accessTokenExpiresAt, + mcpTools: params.tools, + mcpToolsRefreshedAt: now, + grantedAt: now, + revokedAt: null, + updatedAt: now, + } + let connectionId: string + if (existing) { + const [updated] = await tx + .update(credential) + .set(values) + .where(and(eq(credential.id, existing.id), eq(credential.type, 'managed_mcp'))) + .returning({ id: credential.id }) + if (!updated) throw new Error('Managed MCP credential update returned no row') + connectionId = updated.id + } else { + const id = generateManagedMcpConnectionId() + const insert: typeof credential.$inferInsert = { + id, + workspaceId: params.workspaceId, + type: 'managed_mcp', + createdBy: null, + credentialGroupEnrollmentId: params.enrollmentId, + mcpServerId: params.mcpServerId, + ...values, + createdAt: now, + } + const [created] = await tx.insert(credential).values(insert).returning({ id: credential.id }) + if (!created) throw new Error('Managed MCP credential insert returned no row') + connectionId = created.id + } + + const [updatedEnrollment] = await tx + .update(credentialGroupEnrollment) + .set({ + status: source.enrollmentStatus === 'completed' ? 'completed' : 'in_progress', + ...(source.enrollmentStatus === 'completed' ? {} : { completedAt: null }), + updatedAt: now, + }) + .where( + and( + eq(credentialGroupEnrollment.id, params.enrollmentId), + ne(credentialGroupEnrollment.status, 'revoked') + ) + ) + .returning({ id: credentialGroupEnrollment.id }) + if (!updatedEnrollment) { + throw new ManagedMcpCredentialError('Managed MCP enrollment is no longer available', 404) + } + return connectionId + }) +} + +export async function saveManagedMcpRuntimeTokens( + credentialId: string, + tokens: OAuthTokens | null, + expectedTokenVersion: string +): Promise { + const now = new Date() + const encryptedOauthTokenSet = tokens ? await encryptManagedMcpTokens(tokens) : null + return db.transaction(async (tx) => { + const [source] = await tx + .select({ enrollmentId: credential.credentialGroupEnrollmentId }) + .from(credential) + .where(and(eq(credential.id, credentialId), eq(credential.type, 'managed_mcp'))) + .limit(1) + if (!source?.enrollmentId) { + throw new ManagedMcpCredentialError('Managed MCP credential is no longer active', 401) + } + await lockCredentialGroupEnrollmentLifecycle(tx, source.enrollmentId) + const updated = await tx + .update(credential) + .set( + tokens + ? { + encryptedOauthTokenSet, + managedOauthStatus: 'active', + accessTokenExpiresAt: + typeof tokens.expires_in === 'number' + ? new Date(now.getTime() + tokens.expires_in * 1000) + : null, + updatedAt: now, + } + : { + encryptedOauthTokenSet: null, + managedOauthStatus: 'needs_reauth', + accessTokenExpiresAt: null, + updatedAt: now, + } + ) + .where( + and( + eq(credential.id, credentialId), + eq(credential.type, 'managed_mcp'), + eq(credential.managedOauthStatus, 'active'), + eq(credential.encryptedOauthTokenSet, expectedTokenVersion) + ) + ) + .returning({ id: credential.id }) + if (updated.length !== 1) { + throw new ManagedMcpCredentialError('Managed MCP credential grant changed', 401) + } + return encryptedOauthTokenSet + }) +} + +/** Replaces the editor snapshot only after a complete live tools/list succeeds. */ +export async function saveManagedMcpToolSnapshot( + credentialId: string, + tools: ManagedMcpToolSnapshot[] +): Promise { + const updated = await db + .update(credential) + .set({ mcpTools: tools, mcpToolsRefreshedAt: new Date(), updatedAt: new Date() }) + .where( + and( + eq(credential.id, credentialId), + eq(credential.type, 'managed_mcp'), + eq(credential.managedOauthStatus, 'active') + ) + ) + .returning({ id: credential.id }) + if (updated.length !== 1) { + throw new ManagedMcpCredentialError('Managed MCP credential grant changed', 401) + } +} diff --git a/apps/sim/lib/credentials/managed-oauth.test.ts b/apps/sim/lib/credentials/managed-oauth.test.ts index 1df5b3543e7..cc62461af31 100644 --- a/apps/sim/lib/credentials/managed-oauth.test.ts +++ b/apps/sim/lib/credentials/managed-oauth.test.ts @@ -2,13 +2,14 @@ * @vitest-environment node */ import { dbChainMockFns, resetDbChainMock } from '@sim/testing' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' const mocks = vi.hoisted(() => ({ getBilling: vi.fn(), isAvailable: vi.fn(), getAdapter: vi.fn(), decryptSecret: vi.fn(), + encryptSecret: vi.fn(), })) vi.mock('@/lib/billing/core/workspace-access', () => ({ @@ -25,15 +26,44 @@ vi.mock('@/lib/credential-groups/provider-registry', () => ({ vi.mock('@/lib/core/security/encryption', () => ({ decryptSecret: mocks.decryptSecret, - encryptSecret: vi.fn(), + encryptSecret: mocks.encryptSecret, })) import { resolveManagedOAuthToken } from '@/lib/credentials/managed-oauth' +function mondayCredentialRow() { + return { + id: 'credential-1', + workspaceId: 'workspace-1', + type: 'managed_oauth', + providerId: 'monday', + authorizationAppId: 'monday:monday-client-1', + managedOauthScopeVersion: 1, + managedOauthStatus: 'active', + grantedScopes: ['boards:read', 'me:read'], + encryptedOauthTokenSet: 'encrypted-token-set', + accessTokenExpiresAt: new Date('2026-09-01T11:00:00.000Z'), + refreshTokenExpiresAt: null, + credentialGroupId: 'group-1', + credentialGroupEnrollmentId: 'enrollment-1', + } +} + +function mondayTokenResolutionParams() { + return { + credentialId: 'credential-1', + workspaceId: 'workspace-1', + expectedProviderId: 'monday', + requiredScopes: ['boards:read', 'me:read'], + } +} + describe('managed OAuth token resolution', () => { beforeEach(() => { vi.clearAllMocks() resetDbChainMock() + vi.useFakeTimers() + vi.setSystemTime(new Date('2026-09-01T12:00:00.000Z')) mocks.getBilling.mockResolvedValue({ plan: 'enterprise' }) mocks.isAvailable.mockResolvedValue(true) mocks.decryptSecret.mockResolvedValue({ @@ -53,6 +83,10 @@ describe('managed OAuth token resolution', () => { }) }) + afterEach(() => { + vi.useRealTimers() + }) + it('uses a non-expiring Slack access token without entering refresh', async () => { dbChainMockFns.limit.mockResolvedValueOnce([ { @@ -80,4 +114,98 @@ describe('managed OAuth token resolution', () => { ).resolves.toEqual({ accessToken: 'xoxp-slack-token', refreshed: false }) expect(dbChainMockFns.transaction).not.toHaveBeenCalled() }) + + it('refreshes an expired Monday credential and persists its rotated token set', async () => { + const row = mondayCredentialRow() + dbChainMockFns.limit.mockResolvedValueOnce([row]).mockResolvedValueOnce([row]) + dbChainMockFns.returning.mockResolvedValueOnce([{ id: row.id }]) + mocks.decryptSecret.mockResolvedValue({ + decrypted: JSON.stringify({ + type: 'managed-oauth-token-set', + version: 1, + tokenType: 'Bearer', + accessToken: 'expired-access-token', + refreshToken: 'old-refresh-token', + }), + }) + mocks.encryptSecret.mockResolvedValue({ encrypted: 'encrypted-rotated-token-set' }) + const refreshToken = vi.fn().mockResolvedValue({ + ok: true, + accessToken: 'new-access-token', + refreshToken: 'rotated-refresh-token', + expiresIn: 3600, + }) + mocks.getAdapter.mockReturnValue({ + getPolicy: vi.fn().mockResolvedValue({ + authorizationAppId: row.authorizationAppId, + scopeVersion: 1, + }), + hasRequiredScopes: vi.fn().mockReturnValue(true), + refreshToken, + isTerminalRefreshError: vi.fn().mockReturnValue(false), + }) + + await expect(resolveManagedOAuthToken(mondayTokenResolutionParams())).resolves.toEqual({ + accessToken: 'new-access-token', + refreshed: true, + }) + + expect(refreshToken).toHaveBeenCalledWith('old-refresh-token') + const [serializedTokenSet] = mocks.encryptSecret.mock.calls[0] as [string] + expect(JSON.parse(serializedTokenSet)).toEqual({ + type: 'managed-oauth-token-set', + version: 1, + tokenType: 'Bearer', + accessToken: 'new-access-token', + refreshToken: 'rotated-refresh-token', + }) + expect(dbChainMockFns.set).toHaveBeenCalledWith( + expect.objectContaining({ + encryptedOauthTokenSet: 'encrypted-rotated-token-set', + accessTokenExpiresAt: new Date('2026-09-01T13:00:00.000Z'), + lastRefreshedAt: new Date('2026-09-01T12:00:00.000Z'), + }) + ) + }) + + it('marks an expired Monday credential for reauthorization after a terminal refresh error', async () => { + const row = mondayCredentialRow() + dbChainMockFns.limit.mockResolvedValueOnce([row]).mockResolvedValueOnce([row]) + mocks.decryptSecret.mockResolvedValue({ + decrypted: JSON.stringify({ + type: 'managed-oauth-token-set', + version: 1, + tokenType: 'Bearer', + accessToken: 'expired-access-token', + refreshToken: 'old-refresh-token', + }), + }) + const refreshToken = vi.fn().mockResolvedValue({ + ok: false, + errorCode: 'invalid_grant', + message: 'Refresh token rejected', + }) + const isTerminalRefreshError = vi.fn().mockReturnValue(true) + mocks.getAdapter.mockReturnValue({ + getPolicy: vi.fn().mockResolvedValue({ + authorizationAppId: row.authorizationAppId, + scopeVersion: 1, + }), + hasRequiredScopes: vi.fn().mockReturnValue(true), + refreshToken, + isTerminalRefreshError, + }) + + await expect(resolveManagedOAuthToken(mondayTokenResolutionParams())).rejects.toMatchObject({ + code: 'MANAGED_CREDENTIAL_NEEDS_REAUTH', + statusCode: 401, + }) + + expect(refreshToken).toHaveBeenCalledWith('old-refresh-token') + expect(isTerminalRefreshError).toHaveBeenCalledWith('invalid_grant') + expect(dbChainMockFns.set).toHaveBeenCalledWith( + expect.objectContaining({ managedOauthStatus: 'needs_reauth' }) + ) + expect(mocks.encryptSecret).not.toHaveBeenCalled() + }) }) diff --git a/apps/sim/lib/credentials/members.test.ts b/apps/sim/lib/credentials/members.test.ts index fae51df0525..074b49de7f2 100644 --- a/apps/sim/lib/credentials/members.test.ts +++ b/apps/sim/lib/credentials/members.test.ts @@ -10,11 +10,14 @@ describe('listCredentialMembershipsForUser', () => { resetDbChainMock() }) - it('excludes managed OAuth credentials from ordinary memberships', async () => { + it('excludes managed credentials from ordinary memberships', async () => { dbChainMockFns.where.mockResolvedValue([]) await listCredentialMembershipsForUser('user-1') - expect(drizzleOrmMock.ne).toHaveBeenCalledWith(schemaMock.credential.type, 'managed_oauth') + expect(drizzleOrmMock.notInArray).toHaveBeenCalledWith(schemaMock.credential.type, [ + 'managed_oauth', + 'managed_mcp', + ]) }) }) diff --git a/apps/sim/lib/credentials/members.ts b/apps/sim/lib/credentials/members.ts index 7c3f68047d8..4c0de62ec25 100644 --- a/apps/sim/lib/credentials/members.ts +++ b/apps/sim/lib/credentials/members.ts @@ -1,7 +1,7 @@ import { db } from '@sim/db' import { credential, credentialMember, user } from '@sim/db/schema' import { generateId } from '@sim/utils/id' -import { and, eq, ne } from 'drizzle-orm' +import { and, eq, notInArray } from 'drizzle-orm' import { OrchestrationError } from '@/lib/core/orchestration/types' import { isSharedCredentialType, requireOrdinaryCredentialType } from '@/lib/credentials/access' import type { CredentialRow } from '@/lib/credentials/queries' @@ -218,7 +218,12 @@ export async function listCredentialMembershipsForUser(userId: string) { }) .from(credentialMember) .innerJoin(credential, eq(credentialMember.credentialId, credential.id)) - .where(and(eq(credentialMember.userId, userId), ne(credential.type, 'managed_oauth'))) + .where( + and( + eq(credentialMember.userId, userId), + notInArray(credential.type, ['managed_oauth', 'managed_mcp']) + ) + ) return rows.map((row) => ({ ...row, type: requireOrdinaryCredentialType(row.type) })) } diff --git a/apps/sim/lib/credentials/orchestration/credential-create.ts b/apps/sim/lib/credentials/orchestration/credential-create.ts index 8c3af20c6bb..3eb5903815c 100644 --- a/apps/sim/lib/credentials/orchestration/credential-create.ts +++ b/apps/sim/lib/credentials/orchestration/credential-create.ts @@ -10,7 +10,7 @@ import { normalizeCredentialEnvKey } from '@/lib/api/contracts/credentials' import { acquireOrganizationUserMutationLocks } from '@/lib/billing/organizations/membership' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' import { decryptSecret } from '@/lib/core/security/encryption' -import { getCredentialActorContext } from '@/lib/credentials/access' +import { getCredentialActorContext, requireOrdinaryCredentialType } from '@/lib/credentials/access' import { AtlassianValidationError } from '@/lib/credentials/atlassian-service-account' import { getCredentialCreationWorkspaceContext } from '@/lib/credentials/environment' import type { CredentialOrchestrationErrorCode } from '@/lib/credentials/orchestration' @@ -608,7 +608,7 @@ export async function performCreateCredential( params.userId, 'credential_connected', { - credential_type: result.credential.type, + credential_type: requireOrdinaryCredentialType(result.credential.type), provider_id: result.credential.providerId ?? result.credential.type, workspace_id: result.credential.workspaceId, }, diff --git a/apps/sim/lib/credentials/queries.test.ts b/apps/sim/lib/credentials/queries.test.ts index efe7459628e..de3cc280dae 100644 --- a/apps/sim/lib/credentials/queries.test.ts +++ b/apps/sim/lib/credentials/queries.test.ts @@ -16,7 +16,7 @@ describe('listVisibleWorkspaceCredentials', () => { resetDbChainMock() }) - it('always excludes managed OAuth credentials from selector-backed listings', async () => { + it('always excludes managed credentials from selector-backed listings', async () => { dbChainMockFns.orderBy.mockResolvedValueOnce([]) await listVisibleWorkspaceCredentials({ @@ -25,7 +25,10 @@ describe('listVisibleWorkspaceCredentials', () => { workspaceAccess: { canAdmin: true }, }) - expect(drizzleOrmMock.ne).toHaveBeenCalledWith(schemaMock.credential.type, 'managed_oauth') + expect(drizzleOrmMock.notInArray).toHaveBeenCalledWith(schemaMock.credential.type, [ + 'managed_oauth', + 'managed_mcp', + ]) }) it('does not expose Credential Group configuration on a custom Slack bot', async () => { @@ -153,11 +156,14 @@ describe('ordinary credential lookups', () => { credentialId: 'credential-1', }), ], - ])('excludes managed OAuth from the %s path', async (_name, lookup) => { + ])('excludes managed credentials from the %s path', async (_name, lookup) => { dbChainMockFns.limit.mockResolvedValue([]) await lookup() - expect(drizzleOrmMock.ne).toHaveBeenCalledWith(schemaMock.credential.type, 'managed_oauth') + expect(drizzleOrmMock.notInArray).toHaveBeenCalledWith(schemaMock.credential.type, [ + 'managed_oauth', + 'managed_mcp', + ]) }) }) diff --git a/apps/sim/lib/credentials/queries.ts b/apps/sim/lib/credentials/queries.ts index 1fe8d5f02e4..c89a3975a38 100644 --- a/apps/sim/lib/credentials/queries.ts +++ b/apps/sim/lib/credentials/queries.ts @@ -1,6 +1,6 @@ import { db } from '@sim/db' import { credential, credentialMember } from '@sim/db/schema' -import { and, eq, inArray, isNotNull, ne, or, sql } from 'drizzle-orm' +import { and, eq, inArray, isNotNull, notInArray, or, sql } from 'drizzle-orm' import type { V2CredentialSortBy } from '@/lib/api/contracts/v2/credentials' import { type CursorKey, @@ -135,7 +135,8 @@ export async function listVisibleWorkspaceCredentials(params: { const whereClauses = [ eq(credential.workspaceId, workspaceId), - ne(credential.type, 'managed_oauth'), + notInArray(credential.type, ['managed_oauth', 'managed_mcp']), + isNotNull(credential.createdBy), ] if (types?.length) whereClauses.push(inArray(credential.type, types)) if (providerId) whereClauses.push(eq(credential.providerId, providerId)) @@ -198,19 +199,23 @@ export async function listVisibleWorkspaceCredentials(params: { const rows = await (limit === undefined ? query : query.limit(limit + 1)) - const mapped = rows.map(({ memberRole, encryptedServiceAccountKey, ...rest }) => ({ - ...rest, - hasServiceAccountKey: Boolean(encryptedServiceAccountKey), - /** - * An `env_personal` credential's own env owner administers it regardless of - * workspace role — otherwise the owner of a personal secret can't manage it. - */ - role: - (rest.type === 'env_personal' && rest.envOwnerUserId === userId) || - (isWorkspaceAdmin && isSharedCredentialType(rest.type)) - ? ('admin' as const) - : (memberRole ?? ('member' as const)), - })) + const mapped = rows.map(({ memberRole, encryptedServiceAccountKey, ...rest }) => { + if (!rest.createdBy) throw new Error(`Credential ${rest.id} has no creator`) + return { + ...rest, + createdBy: rest.createdBy, + hasServiceAccountKey: Boolean(encryptedServiceAccountKey), + /** + * An `env_personal` credential's own env owner administers it regardless of + * workspace role — otherwise the owner of a personal secret can't manage it. + */ + role: + (rest.type === 'env_personal' && rest.envOwnerUserId === userId) || + (isWorkspaceAdmin && isSharedCredentialType(rest.type)) + ? ('admin' as const) + : (memberRole ?? ('member' as const)), + } + }) return keysetPage(keys, mapped, limit) } @@ -271,12 +276,16 @@ export async function listWorkspacePrincipalCredentials(params: { const rows = await query.limit(limit + 1) - const mapped = rows.map((row) => ({ - ...row, - envKey: null, - envOwnerUserId: null, - role: 'member' as const, - })) + const mapped = rows.map((row) => { + if (!row.createdBy) throw new Error(`Credential ${row.id} has no creator`) + return { + ...row, + createdBy: row.createdBy, + envKey: null, + envOwnerUserId: null, + role: 'member' as const, + } + }) return keysetPage(keys, mapped, limit) } @@ -296,7 +305,7 @@ export async function getWorkspaceCredential(params: { and( eq(credential.id, params.credentialId), eq(credential.workspaceId, params.workspaceId), - ne(credential.type, 'managed_oauth') + notInArray(credential.type, ['managed_oauth', 'managed_mcp']) ) ) .limit(1) @@ -321,7 +330,7 @@ export async function findWorkspaceCredentialLookup(params: { and( eq(credential.id, params.credentialId), eq(credential.workspaceId, params.workspaceId), - ne(credential.type, 'managed_oauth') + notInArray(credential.type, ['managed_oauth', 'managed_mcp']) ) ) .limit(1) @@ -334,7 +343,7 @@ export async function findWorkspaceCredentialLookup(params: { and( eq(credential.accountId, params.credentialId), eq(credential.workspaceId, params.workspaceId), - ne(credential.type, 'managed_oauth') + notInArray(credential.type, ['managed_oauth', 'managed_mcp']) ) ) .limit(1) @@ -348,7 +357,12 @@ export async function getCredentialById(credentialId: string): Promise { expect(selectReleaseForChannel(flagged, 'latest')?.tag_name).toBe('v0.5.24') }) - it('skips releases missing the updater manifest asset', () => { - // A release whose build failed (or is mid-upload) must not take the - // channel down; the previous good release keeps serving. + it('keeps releases missing the updater manifest eligible for candidate validation', () => { const withBrokenNewest = [ release('v0.5.25-dev.413', { assets: [{ name: 'Sim-0.5.25-dev.413-universal.dmg' }] }), release('v0.5.25-dev.412'), ] - expect(selectReleaseForChannel(withBrokenNewest, 'dev')?.tag_name).toBe('v0.5.25-dev.412') + expect(selectReleaseForChannel(withBrokenNewest, 'dev')?.tag_name).toBe('v0.5.25-dev.413') }) - it('tolerates release listings without asset data', () => { - const bare = { tag_name: 'v0.5.24', draft: false, prerelease: false } - expect(selectReleaseForChannel([bare], 'latest')?.tag_name).toBe('v0.5.24') + it('keeps release listings without asset data eligible for candidate validation', () => { + const bare = { tag_name: 'v0.5.25', draft: false, prerelease: false } + expect(selectReleaseForChannel([bare, release('v0.5.24')], 'latest')?.tag_name).toBe('v0.5.25') }) it('skips drafts and unparseable tags', () => { @@ -140,27 +138,70 @@ describe('rewriteManifestUrls', () => { const manifest = [ 'version: 0.5.24', 'files:', - ' - url: Sim-0.5.24-universal-mac.zip', + ' - url: Sim-0.5.24-universal.zip', ' sha512: abc', ' size: 123', - 'path: Sim-0.5.24-universal-mac.zip', + 'path: Sim-0.5.24-universal.zip', 'sha512: abc', "releaseDate: '2026-07-23T00:00:00.000Z'", ].join('\n') - const rewritten = rewriteManifestUrls(manifest, 'v0.5.24', repository) + const rewritten = rewriteManifestUrls( + manifest, + 'v0.5.24', + repository, + new Set(['Sim-0.5.24-universal.zip']) + ) expect(rewritten).toContain( - ` - url: https://github.com/${repository}/releases/download/v0.5.24/Sim-0.5.24-universal-mac.zip` + ` - url: https://github.com/${repository}/releases/download/v0.5.24/Sim-0.5.24-universal.zip` ) expect(rewritten).toContain( - `path: https://github.com/${repository}/releases/download/v0.5.24/Sim-0.5.24-universal-mac.zip` + `path: https://github.com/${repository}/releases/download/v0.5.24/Sim-0.5.24-universal.zip` ) expect(rewritten).toContain('sha512: abc') }) - it('leaves already-absolute URLs alone', () => { - const manifest = ' - url: https://cdn.example.com/Sim.zip' - expect(rewriteManifestUrls(manifest, 'v0.5.24', DESKTOP_STABLE_RELEASE_REPOSITORY)).toBe( - manifest + it('canonicalizes an expected absolute asset URL', () => { + const manifest = ' - url: https://cdn.example.com/Sim-0.5.24-universal.zip' + expect( + rewriteManifestUrls( + manifest, + 'v0.5.24', + DESKTOP_STABLE_RELEASE_REPOSITORY, + new Set(['Sim-0.5.24-universal.zip']) + ) + ).toBe( + ` - url: https://github.com/${DESKTOP_STABLE_RELEASE_REPOSITORY}/releases/download/v0.5.24/Sim-0.5.24-universal.zip` ) }) + + it('rejects unexpected manifest asset names', () => { + const manifest = ' - url: https://cdn.example.com/unreviewed.zip' + expect( + rewriteManifestUrls( + manifest, + 'v0.5.24', + DESKTOP_STABLE_RELEASE_REPOSITORY, + new Set(['Sim-0.5.24-universal.zip']) + ) + ).toBeNull() + }) + + it('rejects an expected artifact that is absent from the release', () => { + const manifest = ' - url: Sim-0.5.24-universal.zip' + expect( + rewriteManifestUrls(manifest, 'v0.5.24', DESKTOP_STABLE_RELEASE_REPOSITORY, new Set()) + ).toBeNull() + }) + + it('rejects a manifest without an updater file entry', () => { + const manifest = ['version: 0.5.24', 'files: []', 'path: Sim-0.5.24-universal.zip'].join('\n') + expect( + rewriteManifestUrls( + manifest, + 'v0.5.24', + DESKTOP_STABLE_RELEASE_REPOSITORY, + new Set(['Sim-0.5.24-universal.zip']) + ) + ).toBeNull() + }) }) diff --git a/apps/sim/lib/desktop/update-feed.ts b/apps/sim/lib/desktop/update-feed.ts index ed8d14c16f3..f6ba20a3788 100644 --- a/apps/sim/lib/desktop/update-feed.ts +++ b/apps/sim/lib/desktop/update-feed.ts @@ -25,6 +25,8 @@ * Squirrel.Mac cannot apply (bundle-id mismatch) — each channel only ever * moves forward on its own artifacts. */ + +import { readResponseTextWithLimit } from '@/lib/core/utils/stream-limits' import { compareVersions } from '@/lib/desktop/min-version' export const DESKTOP_STABLE_RELEASE_REPOSITORY = 'simstudioai/sim' @@ -66,6 +68,7 @@ export function channelOfVersion(version: string): DesktopUpdateChannel { * release belongs to is carried entirely by its tag. */ export const MANIFEST_ASSET_NAME = 'latest-mac.yml' +export const MAX_DESKTOP_UPDATE_MANIFEST_BYTES = 256 * 1024 /** The subset of the GitHub releases API the feed needs. */ export interface DesktopReleaseCandidate { @@ -76,18 +79,16 @@ export interface DesktopReleaseCandidate { } /** - * Picks the newest release of the channel's own kind. Channels never see - * another channel's artifacts (see module docs). Releases without their - * updater manifest asset are skipped — a release created before its build - * finished (or whose build failed) must not take the channel down. Returns - * null when nothing qualifies. + * Lists releases of the channel's own kind, newest first. Channels never see + * another channel's artifacts (see module docs). Artifact validation happens + * in the candidate resolver so invalid releases remain distinguishable from + * a channel with no releases. */ -export function selectReleaseForChannel( +function releasesForChannel( releases: DesktopReleaseCandidate[], channel: DesktopUpdateChannel -): DesktopReleaseCandidate | null { - let best: DesktopReleaseCandidate | null = null - let bestVersion = '' +): DesktopReleaseCandidate[] { + const candidates: Array<{ release: DesktopReleaseCandidate; version: string }> = [] for (const release of releases) { if (release.draft) continue const version = release.tag_name.replace(/^v/, '') @@ -95,23 +96,19 @@ export function selectReleaseForChannel( // Defense in depth: a bare vX.Y.Z tag manually marked "pre-release" on // GitHub must not reach stable clients. if (channel === 'latest' && release.prerelease) continue - if (release.assets && !release.assets.some((asset) => asset.name === MANIFEST_ASSET_NAME)) { - continue - } - if (best === null) { - const valid = compareVersions(version, '0.0.0') - if (valid === null) continue - best = release - bestVersion = version - continue - } - const comparison = compareVersions(version, bestVersion) - if (comparison !== null && comparison > 0) { - best = release - bestVersion = version - } + if (compareVersions(version, '0.0.0') === null) continue + candidates.push({ release, version }) } - return best + candidates.sort((left, right) => compareVersions(right.version, left.version) ?? 0) + return candidates.map(({ release }) => release) +} + +/** Picks the newest release that passes the channel and version checks. */ +export function selectReleaseForChannel( + releases: DesktopReleaseCandidate[], + channel: DesktopUpdateChannel +): DesktopReleaseCandidate | null { + return releasesForChannel(releases, channel)[0] ?? null } /** @@ -124,15 +121,36 @@ export function selectReleaseForChannel( export function rewriteManifestUrls( manifest: string, tag: string, - repository: DesktopReleaseRepository -): string { + repository: DesktopReleaseRepository, + availableAssetNames: ReadonlySet +): string | null { const base = `https://github.com/${repository}/releases/download/${tag}/` - return manifest.replace(/^(\s*(?:-\s*)?(?:url|path):\s*)(\S+)\s*$/gm, (line, prefix, value) => { - if (value.startsWith('http://') || value.startsWith('https://')) { - return line + const version = tag.replace(/^v/, '') + const expectedNames = new Set([`Sim-${version}-universal.dmg`, `Sim-${version}-universal.zip`]) + let valid = true + let hasUpdaterFile = false + const rewritten = manifest.replace( + /^(\s*(?:-\s*)?(?:url|path):\s*)(\S+)\s*$/gm, + (_line, prefix: string, value: string) => { + try { + const pathname = + value.startsWith('http://') || value.startsWith('https://') + ? new URL(value).pathname + : value + const name = decodeURIComponent(pathname.split('/').at(-1) ?? '') + if (!expectedNames.has(name) || !availableAssetNames.has(name)) { + valid = false + return '' + } + if (/\burl:\s*$/.test(prefix)) hasUpdaterFile = true + return `${prefix}${base}${encodeURIComponent(name)}` + } catch { + valid = false + return '' + } } - return `${prefix}${base}${encodeURIComponent(value)}` - }) + ) + return valid && hasUpdaterFile ? rewritten : null } /** @@ -150,6 +168,39 @@ export const DESKTOP_RELEASES_PAGE_SIZE = 100 */ export const MAX_DESKTOP_RELEASE_PAGES = 5 +export interface DesktopReleaseAssets { + manifest: string + installer: { name: string; browser_download_url: string } +} + +/** Reads and validates the complete artifact set required to offer a release. */ +export async function resolveReleaseAssets( + release: DesktopReleaseCandidate, + repository: DesktopReleaseRepository, + fetchManifest: (url: string) => Promise +): Promise { + const manifestAsset = release.assets?.find((asset) => asset.name === MANIFEST_ASSET_NAME) + const installer = selectInstallerAsset(release, repository) + if (!manifestAsset || !installer) return null + + try { + const response = await fetchManifest(manifestAsset.browser_download_url) + if (!response.ok) return null + const source = await readResponseTextWithLimit(response, { + maxBytes: MAX_DESKTOP_UPDATE_MANIFEST_BYTES, + label: 'Desktop update manifest', + }) + const version = release.tag_name.replace(/^v/, '') + if (/^version:\s*(\S+)\s*$/m.exec(source)?.[1] !== version) return null + + const availableAssetNames = new Set(release.assets?.map((asset) => asset.name)) + const manifest = rewriteManifestUrls(source, release.tag_name, repository, availableAssetNames) + return manifest ? { manifest, installer } : null + } catch { + return null + } +} + /** One page of the GitHub releases API, newest release first. */ export function releasesApiUrl(repository: DesktopReleaseRepository, page: number): string { return `https://api.github.com/repos/${repository}/releases?per_page=${DESKTOP_RELEASES_PAGE_SIZE}&page=${page}` @@ -164,22 +215,32 @@ export function releasesApiUrl(repository: DesktopReleaseRepository, page: numbe * (other tag families, other channels) cannot push a channel's newest build * out of the window and take the whole channel's updates down. * - * `fetchPage` returns null when the page could not be read; the resolver - * surfaces that as a failure rather than silently serving an older release. + * Every candidate is passed to `resolveCandidate`; a rejected candidate falls + * through to the next version. `fetchPage` returning null remains fatal because + * an unreadable page could hide a newer valid release. */ -export async function resolveLatestRelease( +export async function resolveLatestRelease( channel: DesktopUpdateChannel, - fetchPage: (page: number) => Promise -): Promise<{ release: DesktopReleaseCandidate | null } | { error: 'fetch-failed' }> { + fetchPage: (page: number) => Promise, + resolveCandidate: (release: DesktopReleaseCandidate) => T | null | Promise +): Promise< + | { release: DesktopReleaseCandidate; value: T } + | { release: null; rejectedCandidates: boolean } + | { error: 'fetch-failed' } +> { + let rejectedCandidates = false for (let page = 1; page <= MAX_DESKTOP_RELEASE_PAGES; page++) { const releases = await fetchPage(page) if (releases === null) return { error: 'fetch-failed' } - const release = selectReleaseForChannel(releases, channel) - if (release) return { release } + for (const release of releasesForChannel(releases, channel)) { + const value = await resolveCandidate(release) + if (value !== null) return { release, value } + rejectedCandidates = true + } // A short page is the end of the list; nothing older remains to walk. if (releases.length < DESKTOP_RELEASES_PAGE_SIZE) break } - return { release: null } + return { release: null, rejectedCandidates } } /** @@ -189,12 +250,19 @@ export async function resolveLatestRelease( * web-app and SDK tags that carry no desktop artifact at all. */ export function selectInstallerAsset( - release: DesktopReleaseCandidate + release: DesktopReleaseCandidate, + repository: DesktopReleaseRepository ): { name: string; browser_download_url: string } | null { const assets = release.assets ?? [] - return ( - assets.find((asset) => asset.name.endsWith('.dmg')) ?? - assets.find((asset) => asset.name.endsWith('.zip')) ?? - null - ) + const version = release.tag_name.replace(/^v/, '') + const dmgName = `Sim-${version}-universal.dmg` + const zipName = `Sim-${version}-universal.zip` + const asset = + assets.find((candidate) => candidate.name === dmgName) ?? + assets.find((candidate) => candidate.name === zipName) + if (!asset) return null + return { + name: asset.name, + browser_download_url: `https://github.com/${repository}/releases/download/${release.tag_name}/${asset.name}`, + } } diff --git a/apps/sim/lib/execution/sandbox/bundles/_polyfills.ts b/apps/sim/lib/execution/sandbox/bundles/_polyfills.ts index a7eab1bfd2c..59522dd9d14 100644 --- a/apps/sim/lib/execution/sandbox/bundles/_polyfills.ts +++ b/apps/sim/lib/execution/sandbox/bundles/_polyfills.ts @@ -7,15 +7,37 @@ * `ivm.Reference` per laverdet/isolated-vm#136) BEFORE the bundle runs, so * `process/browser` picks up the real delegated `setTimeout`. * - * The only thing this file still does is alias `global -> globalThis` for - * UMD-style fallbacks inside the bundles. All other runtime surface - * (`console`, `TextEncoder`, `TextDecoder`, timers) is installed by the - * worker via `ivm.Callback` / `ivm.Reference` bridges to Node's native - * implementations — no hand-rolled polyfill logic lives in the isolate. + * Beyond aliasing `global -> globalThis` for UMD-style fallbacks inside the + * bundles, this file only answers the one name the bundler can leave dangling + * (see below). All other runtime surface (`console`, `TextEncoder`, + * `TextDecoder`, timers) is installed by the worker via `ivm.Callback` / + * `ivm.Reference` bridges to Node's native implementations — no hand-rolled + * polyfill logic lives in the isolate. */ -const g: typeof globalThis & { global?: typeof globalThis } = globalThis +const g: typeof globalThis & { + global?: typeof globalThis + __require?: (id: string) => never +} = globalThis if (typeof g.global === 'undefined') g.global = globalThis +/** + * A library that inlines a CommonJS dependency ships esbuild's `__require` + * helper around it (docx >= 9.7.1 does this for JSZip's UMD build). Bun's + * browser/iife build rewrites the bare `require` references inside that helper + * to its own `__require` runtime helper and then never emits it, so the bundle + * throws `ReferenceError: __require is not defined` while it is still being + * evaluated. The isolate has no `require` at all, so the only correct answer + * to a dynamic require is the one esbuild's helper gives when `require` is + * absent: throw. Defining it here keeps every bundle self-contained; `build.ts` + * evaluates each bundle in a bare context so a new variant of the defect fails + * the build instead of shipping. + */ +if (typeof g.__require === 'undefined') { + g.__require = (id: string): never => { + throw new Error(`Dynamic require of "${id}" is not supported in the sandbox`) + } +} + export {} diff --git a/apps/sim/lib/execution/sandbox/bundles/build.ts b/apps/sim/lib/execution/sandbox/bundles/build.ts index 5e6ab81645d..8d380bb4276 100644 --- a/apps/sim/lib/execution/sandbox/bundles/build.ts +++ b/apps/sim/lib/execution/sandbox/bundles/build.ts @@ -7,6 +7,11 @@ * `fs`). The emitted files attach their exports to `globalThis.__bundles[name]` * and are checked in so production images don't need the bundler at runtime. * + * Every bundle is evaluated in a bare context before it is written: the + * bundler can emit a reference to a runtime helper it never defines (Bun does + * this for docx's inlined CommonJS shim), and nothing else loads these files + * before a production document generation does. + * * Run via: `bun run build:sandbox-bundles`. */ @@ -14,6 +19,8 @@ import { mkdirSync, rmSync, writeFileSync } from 'node:fs' import { dirname, join } from 'node:path' import { fileURLToPath } from 'node:url' import { createLogger } from '@sim/logger' +import { evaluateSandboxBundle } from '@/lib/execution/sandbox/bundles/verify' +import type { SandboxBundleName } from '@/lib/execution/sandbox/types' const logger = createLogger('SandboxBundleBuild') @@ -39,7 +46,7 @@ const APP_SIM_ROOT = join(HERE, '..', '..', '..', '..') interface BundleSpec { /** Key on `globalThis.__bundles`. */ - name: string + name: SandboxBundleName /** Short filename written under `bundles/.cjs`. */ outFile: string /** Source of the entry file bun will bundle. */ @@ -121,8 +128,16 @@ async function main(): Promise { const code = await result.outputs[0].text() const banner = `// sandbox bundle: ${spec.name}\n// generated by apps/sim/lib/execution/sandbox/bundles/build.ts\n// do not edit by hand. run \`bun run build:sandbox-bundles\` to regenerate.\n` - writeFileSync(join(BUNDLES_DIR, spec.outFile), banner + code, 'utf-8') - logger.info(`built ${spec.outFile} (${code.length.toLocaleString()} chars)`) + const output = banner + code + try { + evaluateSandboxBundle(output, spec.name) + } catch (error) { + throw new Error( + `Sandbox bundle ${spec.name} does not evaluate in a bare isolate context: ${String(error)}` + ) + } + writeFileSync(join(BUNDLES_DIR, spec.outFile), output, 'utf-8') + logger.info(`built and verified ${spec.outFile} (${code.length.toLocaleString()} chars)`) } rmSync(ENTRIES_DIR, { recursive: true, force: true }) diff --git a/apps/sim/lib/execution/sandbox/bundles/docx.cjs b/apps/sim/lib/execution/sandbox/bundles/docx.cjs index 8147b97e60d..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 L9=Object.create;var{getPrototypeOf:M9,defineProperty:p1,getOwnPropertyNames:X9}=Object;var R9=Object.prototype.hasOwnProperty;var O9=(B,U,G)=>{G=B!=null?L9(M9(B)):{};let Y=U||!B||!B.__esModule?p1(G,"default",{value:B,enumerable:!0}):G;for(let Q of X9(B))if(!R9.call(Y,Q))p1(Y,Q,{get:()=>B[Q],enumerable:!0});return Y};var F9=(B,U)=>()=>(U||B((U={exports:{}}).exports,U),U.exports);var H9=(B,U)=>{for(var G in U)p1(B,G,{get:U[G],enumerable:!0,configurable:!0,set:(Y)=>U[G]=()=>Y})};var h8=F9((J7,_8)=>{var N0=_8.exports={},p0,r0;function Y6(){throw new Error("setTimeout has not been defined")}function Z6(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")p0=setTimeout;else p0=Y6}catch(B){p0=Y6}try{if(typeof clearTimeout==="function")r0=clearTimeout;else r0=Z6}catch(B){r0=Z6}})();function g8(B){if(p0===setTimeout)return setTimeout(B,0);if((p0===Y6||!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 n9(B){if(r0===clearTimeout)return clearTimeout(B);if((r0===Z6||!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,N2,A1=-1;function s9(){if(!b2||!N2)return;if(b2=!1,N2.length)Q2=N2.concat(Q2);else A1=-1;if(Q2.length)f8()}function f8(){if(b2)return;var B=g8(s9);b2=!0;var U=Q2.length;while(U){N2=Q2,Q2=[];while(++A11)for(var G=1;G0)throw new 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 W9(B,U){return(B+U)*3/4-U}function P9(B){var U,G=E9(B),Y=G[0],Q=G[1],J=new Uint8Array(W9(Y,Q)),Z=0,K=Q>0?Y-4:Y,V;for(V=0;V>16&255,J[Z++]=U>>8&255,J[Z++]=U&255;if(Q===2)U=h0[B.charCodeAt(V)]<<2|h0[B.charCodeAt(V+1)]>>4,J[Z++]=U&255;if(Q===1)U=h0[B.charCodeAt(V)]<<10|h0[B.charCodeAt(V+1)]<<4|h0[B.charCodeAt(V+2)]>>2,J[Z++]=U>>8&255,J[Z++]=U&255;return J}function A9(B){return l0[B>>18&63]+l0[B>>12&63]+l0[B>>6&63]+l0[B&63]}function j9(B,U,G){var Y,Q=[];for(var J=U;JK?K:Z+J));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 W1(B,U,G,Y,Q){var J,Z,K=Q*8-Y-1,V=(1<>1,O=-7,X=G?Q-1:0,D=G?-1:1,W=B[U+X];X+=D,J=W&(1<<-O)-1,W>>=-O,O+=K;for(;O>0;J=J*256+B[U+X],X+=D,O-=8);Z=J&(1<<-O)-1,J>>=-O,O+=Y;for(;O>0;Z=Z*256+B[U+X],X+=D,O-=8);if(J===0)J=1-H;else if(J===V)return Z?NaN:(W?-1:1)*(1/0);else Z=Z+Math.pow(2,Y),J=J-H;return(W?-1:1)*Z*Math.pow(2,J-Y)}function A8(B,U,G,Y,Q,J){var Z,K,V,H=J*8-Q-1,O=(1<>1,D=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,W=Y?0:J-1,E=Y?1:-1,P=U<0||U===0&&1/U<0?1:0;if(U=Math.abs(U),isNaN(U)||U===1/0)K=isNaN(U)?1:0,Z=O;else{if(Z=Math.floor(Math.log(U)/Math.LN2),U*(V=Math.pow(2,-Z))<1)Z--,V*=2;if(Z+X>=1)U+=D/V;else U+=D*Math.pow(2,1-X);if(U*V>=2)Z++,V/=2;if(Z+X>=O)K=0,Z=O;else if(Z+X>=1)K=(U*V-1)*Math.pow(2,Q),Z=Z+X;else K=U*Math.pow(2,X-1)*Math.pow(2,Q),Z=0}for(;Q>=8;B[G+W]=K&255,W+=E,K/=256,Q-=8);Z=Z<0;B[G+W]=Z&255,W+=E,Z/=256,H-=8);B[G+W-E]|=P*128}var H8=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;var i1=2147483647;var{btoa:tK,atob:eK,File:B7,Blob:U7}=globalThis;function Z2(B){if(B>i1)throw new RangeError('The value "'+B+'" is invalid for option "size"');let U=new Uint8Array(B);return Object.setPrototypeOf(U,J0.prototype),U}function e1(B,U,G){return class Y 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(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}var N9=e1("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),z9=e1("ERR_INVALID_ARG_TYPE",function(B,U){return`The "${B}" argument must be of type number. Received type ${typeof U}`},TypeError),n1=e1("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=P8(String(G));else if(typeof G==="bigint"){if(Q=String(G),G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))Q=P8(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 new TypeError('The "string" argument must be of type string. Received type number');return B6(B)}return j8(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 j8(B,U,G){if(typeof B==="string")return D9(B,U);if(ArrayBuffer.isView(B))return C9(B);if(B==null)throw new 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 o1(B,U,G);if(typeof SharedArrayBuffer!=="undefined"&&(a0(B,SharedArrayBuffer)||B&&a0(B.buffer,SharedArrayBuffer)))return o1(B,U,G);if(typeof B==="number")throw new 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=k9(B);if(Q)return Q;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]==="function")return J0.from(B[Symbol.toPrimitive]("string"),U,G);throw new 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 j8(B,U,G)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);function N8(B){if(typeof B!=="number")throw new TypeError('"size" argument must be of type number');else if(B<0)throw new RangeError('The value "'+B+'" is invalid for option "size"')}function T9(B,U,G){if(N8(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 T9(B,U,G)};function B6(B){return N8(B),Z2(B<0?0:U6(B)|0)}J0.allocUnsafe=function(B){return B6(B)};J0.allocUnsafeSlow=function(B){return B6(B)};function D9(B,U){if(typeof U!=="string"||U==="")U="utf8";if(!J0.isEncoding(U))throw new TypeError("Unknown encoding: "+U);let G=z8(B,U)|0,Y=Z2(G),Q=Y.write(B,U);if(Q!==G)Y=Y.slice(0,Q);return Y}function s1(B){let U=B.length<0?0:U6(B.length)|0,G=Z2(U);for(let Y=0;Y=i1)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i1.toString(16)+" bytes");return B|0}J0.isBuffer=function B(U){return U!=null&&U._isBuffer===!0&&U!==J0.prototype};J0.compare=function B(U,G){if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(a0(G,Uint8Array))G=J0.from(G,G.offset,G.byteLength);if(!J0.isBuffer(U)||!J0.isBuffer(G))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(U===G)return 0;let Y=U.length,Q=G.length;for(let J=0,Z=Math.min(Y,Q);JQ.length){if(!J0.isBuffer(Z))Z=J0.from(Z);Z.copy(Q,J)}else Uint8Array.prototype.set.call(Q,Z,J);else if(!J0.isBuffer(Z))throw new TypeError('"list" argument must be an Array of Buffers');else Z.copy(Q,J);J+=Z.length}return Q};function z8(B,U){if(J0.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||a0(B,ArrayBuffer))return B.byteLength;if(typeof B!=="string")throw new 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 t1(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return y8(B).length;default:if(Q)return Y?-1:t1(B).length;U=(""+U).toLowerCase(),Q=!0}}J0.byteLength=z8;function $9(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 u9(this,U,G);case"utf8":case"utf-8":return D8(this,U,G);case"ascii":return _9(this,U,G);case"latin1":case"binary":return h9(this,U,G);case"base64":return f9(this,U,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d9(this,U,G);default:if(Y)throw new TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),Y=!0}}J0.prototype._isBuffer=!0;function j2(B,U,G){let Y=B[U];B[U]=B[G],B[G]=Y}J0.prototype.swap16=function B(){let U=this.length;if(U%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let G=0;GG)U+=" ... ";return""};if(H8)J0.prototype[H8]=J0.prototype.inspect;J0.prototype.compare=function B(U,G,Y,Q,J){if(a0(U,Uint8Array))U=J0.from(U,U.offset,U.byteLength);if(!J0.isBuffer(U))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof U);if(G===void 0)G=0;if(Y===void 0)Y=U?U.length:0;if(Q===void 0)Q=0;if(J===void 0)J=this.length;if(G<0||Y>U.length||Q<0||J>this.length)throw new RangeError("out of range index");if(Q>=J&&G>=Y)return 0;if(Q>=J)return-1;if(G>=Y)return 1;if(G>>>=0,Y>>>=0,Q>>>=0,J>>>=0,this===U)return 0;let Z=J-Q,K=Y-G,V=Math.min(Z,K),H=this.slice(Q,J),O=U.slice(G,Y);for(let X=0;X2147483647)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 E8(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 E8(B,[U],G,Y,Q)}throw new TypeError("val must be string, number or Buffer")}function E8(B,U,G,Y,Q){let J=1,Z=B.length,K=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;J=2,Z/=2,K/=2,G/=2}}function V(O,X){if(J===1)return O[X];else return O.readUInt16BE(X*J)}let H;if(Q){let O=-1;for(H=G;HZ)G=Z-K;for(H=G;H>=0;H--){let O=!0;for(let X=0;XQ)Y=Q;let J=U.length;if(Y>J/2)Y=J/2;let Z;for(Z=0;Z>>0,isFinite(Y)){if(Y=Y>>>0,Q===void 0)Q="utf8"}else Q=Y,Y=void 0;else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let J=this.length-G;if(Y===void 0||Y>J)Y=J;if(U.length>0&&(Y<0||G<0)||G>this.length)throw new RangeError("Attempt to write outside buffer bounds");if(!Q)Q="utf8";let Z=!1;for(;;)switch(Q){case"hex":return S9(this,U,G,Y);case"utf8":case"utf-8":return b9(this,U,G,Y);case"ascii":case"latin1":case"binary":return v9(this,U,G,Y);case"base64":return y9(this,U,G,Y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g9(this,U,G,Y);default:if(Z)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),Z=!0}};J0.prototype.toJSON=function B(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f9(B,U,G){if(U===0&&G===B.length)return F8(B);else return F8(B.slice(U,G))}function D8(B,U,G){G=Math.min(B.length,G);let Y=[],Q=U;while(Q239?4:J>223?3:J>191?2:1;if(Q+K<=G){let V,H,O,X;switch(K){case 1:if(J<128)Z=J;break;case 2:if(V=B[Q+1],(V&192)===128){if(X=(J&31)<<6|V&63,X>127)Z=X}break;case 3:if(V=B[Q+1],H=B[Q+2],(V&192)===128&&(H&192)===128){if(X=(J&15)<<12|(V&63)<<6|H&63,X>2047&&(X<55296||X>57343))Z=X}break;case 4:if(V=B[Q+1],H=B[Q+2],O=B[Q+3],(V&192)===128&&(H&192)===128&&(O&192)===128){if(X=(J&15)<<18|(V&63)<<12|(H&63)<<6|O&63,X>65535&&X<1114112)Z=X}}}if(Z===null)Z=65533,K=1;else if(Z>65535)Z-=65536,Y.push(Z>>>10&1023|55296),Z=56320|Z&1023;Y.push(Z),Q+=K}return x9(Y)}var W8=4096;function x9(B){let U=B.length;if(U<=W8)return String.fromCharCode.apply(String,B);let G="",Y=0;while(YY)G=Y;let Q="";for(let J=U;JY)U=Y;if(G<0){if(G+=Y,G<0)G=0}else if(G>Y)G=Y;if(GG)throw new RangeError("Trying to access beyond buffer length")}J0.prototype.readUintLE=J0.prototype.readUIntLE=function B(U,G,Y){if(U=U>>>0,G=G>>>0,!Y)$0(U,G,this.length);let Q=this[U],J=1,Z=0;while(++Z>>0,G=G>>>0,!Y)$0(U,G,this.length);let Q=this[U+--G],J=1;while(G>0&&(J*=256))Q+=this[U+--G]*J;return Q};J0.prototype.readUint8=J0.prototype.readUInt8=function B(U,G){if(U=U>>>0,!G)$0(U,1,this.length);return this[U]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function B(U,G){if(U=U>>>0,!G)$0(U,2,this.length);return this[U]|this[U+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function B(U,G){if(U=U>>>0,!G)$0(U,2,this.length);return this[U]<<8|this[U+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function B(U,G){if(U=U>>>0,!G)$0(U,4,this.length);return(this[U]|this[U+1]<<8|this[U+2]<<16)+this[U+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function B(U,G){if(U=U>>>0,!G)$0(U,4,this.length);return this[U]*16777216+(this[U+1]<<16|this[U+2]<<8|this[U+3])};J0.prototype.readBigUInt64LE=X2(function B(U){U=U>>>0,S2(U,"offset");let G=this[U],Y=this[U+7];if(G===void 0||Y===void 0)n2(U,this.length-8);let Q=G+this[++U]*256+this[++U]*65536+this[++U]*16777216,J=this[++U]+this[++U]*256+this[++U]*65536+Y*16777216;return BigInt(Q)+(BigInt(J)<>>0,S2(U,"offset");let G=this[U],Y=this[U+7];if(G===void 0||Y===void 0)n2(U,this.length-8);let Q=G*16777216+this[++U]*65536+this[++U]*256+this[++U],J=this[++U]*16777216+this[++U]*65536+this[++U]*256+Y;return(BigInt(Q)<>>0,G=G>>>0,!Y)$0(U,G,this.length);let Q=this[U],J=1,Z=0;while(++Z=J)Q-=Math.pow(2,8*G);return Q};J0.prototype.readIntBE=function B(U,G,Y){if(U=U>>>0,G=G>>>0,!Y)$0(U,G,this.length);let Q=G,J=1,Z=this[U+--Q];while(Q>0&&(J*=256))Z+=this[U+--Q]*J;if(J*=128,Z>=J)Z-=Math.pow(2,8*G);return Z};J0.prototype.readInt8=function B(U,G){if(U=U>>>0,!G)$0(U,1,this.length);if(!(this[U]&128))return this[U];return(255-this[U]+1)*-1};J0.prototype.readInt16LE=function B(U,G){if(U=U>>>0,!G)$0(U,2,this.length);let Y=this[U]|this[U+1]<<8;return Y&32768?Y|4294901760:Y};J0.prototype.readInt16BE=function B(U,G){if(U=U>>>0,!G)$0(U,2,this.length);let Y=this[U+1]|this[U]<<8;return Y&32768?Y|4294901760:Y};J0.prototype.readInt32LE=function B(U,G){if(U=U>>>0,!G)$0(U,4,this.length);return this[U]|this[U+1]<<8|this[U+2]<<16|this[U+3]<<24};J0.prototype.readInt32BE=function B(U,G){if(U=U>>>0,!G)$0(U,4,this.length);return this[U]<<24|this[U+1]<<16|this[U+2]<<8|this[U+3]};J0.prototype.readBigInt64LE=X2(function B(U){U=U>>>0,S2(U,"offset");let G=this[U],Y=this[U+7];if(G===void 0||Y===void 0)n2(U,this.length-8);let Q=this[U+4]+this[U+5]*256+this[U+6]*65536+(Y<<24);return(BigInt(Q)<>>0,S2(U,"offset");let G=this[U],Y=this[U+7];if(G===void 0||Y===void 0)n2(U,this.length-8);let Q=(G<<24)+this[++U]*65536+this[++U]*256+this[++U];return(BigInt(Q)<>>0,!G)$0(U,4,this.length);return W1(this,U,!0,23,4)};J0.prototype.readFloatBE=function B(U,G){if(U=U>>>0,!G)$0(U,4,this.length);return W1(this,U,!1,23,4)};J0.prototype.readDoubleLE=function B(U,G){if(U=U>>>0,!G)$0(U,8,this.length);return W1(this,U,!0,52,8)};J0.prototype.readDoubleBE=function B(U,G){if(U=U>>>0,!G)$0(U,8,this.length);return W1(this,U,!1,52,8)};function g0(B,U,G,Y,Q,J){if(!J0.isBuffer(B))throw new TypeError('"buffer" argument must be a Buffer instance');if(U>Q||UB.length)throw new RangeError("Index out of range")}J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function B(U,G,Y,Q){if(U=+U,G=G>>>0,Y=Y>>>0,!Q){let K=Math.pow(2,8*Y)-1;g0(this,U,G,Y,K,0)}let J=1,Z=0;this[G]=U&255;while(++Z>>0,Y=Y>>>0,!Q){let K=Math.pow(2,8*Y)-1;g0(this,U,G,Y,K,0)}let J=Y-1,Z=1;this[G+J]=U&255;while(--J>=0&&(Z*=256))this[G+J]=U/Z&255;return G+Y};J0.prototype.writeUint8=J0.prototype.writeUInt8=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,1,255,0);return this[G]=U&255,G+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,2,65535,0);return this[G]=U&255,this[G+1]=U>>>8,G+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,2,65535,0);return this[G]=U>>>8,this[G+1]=U&255,G+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,4,4294967295,0);return this[G+3]=U>>>24,this[G+2]=U>>>16,this[G+1]=U>>>8,this[G]=U&255,G+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,4,4294967295,0);return this[G]=U>>>24,this[G+1]=U>>>16,this[G+2]=U>>>8,this[G+3]=U&255,G+4};function C8(B,U,G,Y,Q){v8(U,Y,Q,B,G,7);let J=Number(U&BigInt(4294967295));B[G++]=J,J=J>>8,B[G++]=J,J=J>>8,B[G++]=J,J=J>>8,B[G++]=J;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 k8(B,U,G,Y,Q){v8(U,Y,Q,B,G,7);let J=Number(U&BigInt(4294967295));B[G+7]=J,J=J>>8,B[G+6]=J,J=J>>8,B[G+5]=J,J=J>>8,B[G+4]=J;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=X2(function B(U,G=0){return C8(this,U,G,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=X2(function B(U,G=0){return k8(this,U,G,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function B(U,G,Y,Q){if(U=+U,G=G>>>0,!Q){let V=Math.pow(2,8*Y-1);g0(this,U,G,Y,V-1,-V)}let J=0,Z=1,K=0;this[G]=U&255;while(++J>0)-K&255}return G+Y};J0.prototype.writeIntBE=function B(U,G,Y,Q){if(U=+U,G=G>>>0,!Q){let V=Math.pow(2,8*Y-1);g0(this,U,G,Y,V-1,-V)}let J=Y-1,Z=1,K=0;this[G+J]=U&255;while(--J>=0&&(Z*=256)){if(U<0&&K===0&&this[G+J+1]!==0)K=1;this[G+J]=(U/Z>>0)-K&255}return G+Y};J0.prototype.writeInt8=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,1,127,-128);if(U<0)U=255+U+1;return this[G]=U&255,G+1};J0.prototype.writeInt16LE=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,2,32767,-32768);return this[G]=U&255,this[G+1]=U>>>8,G+2};J0.prototype.writeInt16BE=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,2,32767,-32768);return this[G]=U>>>8,this[G+1]=U&255,G+2};J0.prototype.writeInt32LE=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,4,2147483647,-2147483648);return this[G]=U&255,this[G+1]=U>>>8,this[G+2]=U>>>16,this[G+3]=U>>>24,G+4};J0.prototype.writeInt32BE=function B(U,G,Y){if(U=+U,G=G>>>0,!Y)g0(this,U,G,4,2147483647,-2147483648);if(U<0)U=4294967295+U+1;return this[G]=U>>>24,this[G+1]=U>>>16,this[G+2]=U>>>8,this[G+3]=U&255,G+4};J0.prototype.writeBigInt64LE=X2(function B(U,G=0){return C8(this,U,G,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=X2(function B(U,G=0){return k8(this,U,G,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $8(B,U,G,Y,Q,J){if(G+Y>B.length)throw new RangeError("Index out of range");if(G<0)throw new RangeError("Index out of range")}function S8(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$8(B,U,G,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return A8(B,U,G,Y,23,4),G+4}J0.prototype.writeFloatLE=function B(U,G,Y){return S8(this,U,G,!0,Y)};J0.prototype.writeFloatBE=function B(U,G,Y){return S8(this,U,G,!1,Y)};function b8(B,U,G,Y,Q){if(U=+U,G=G>>>0,!Q)$8(B,U,G,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return A8(B,U,G,Y,52,8),G+8}J0.prototype.writeDoubleLE=function B(U,G,Y){return b8(this,U,G,!0,Y)};J0.prototype.writeDoubleBE=function B(U,G,Y){return b8(this,U,G,!1,Y)};J0.prototype.copy=function B(U,G,Y,Q){if(!J0.isBuffer(U))throw new TypeError("argument should be a Buffer");if(!Y)Y=0;if(!Q&&Q!==0)Q=this.length;if(G>=U.length)G=U.length;if(!G)G=0;if(Q>0&&Q=this.length)throw new RangeError("Index out of range");if(Q<0)throw new RangeError("sourceEnd out of bounds");if(Q>this.length)Q=this.length;if(U.length-G>>0,Y=Y===void 0?this.length:Y>>>0,!U)U=0;let J;if(typeof U==="number")for(J=G;J=Y+4;G-=3)U=`_${B.slice(G-3,G)}${U}`;return`${B.slice(0,G)}${U}`}function c9(B,U,G){if(S2(U,"offset"),B[U]===void 0||B[U+G]===void 0)n2(U,B.length-(G+1))}function v8(B,U,G,Y,Q,J){if(B>G||B3)if(U===0||U===BigInt(0))K=`>= 0${Z} and < 2${Z} ** ${(J+1)*8}${Z}`;else K=`>= -(2${Z} ** ${(J+1)*8-1}${Z}) and < 2 ** ${(J+1)*8-1}${Z}`;else K=`>= ${U}${Z} and <= ${G}${Z}`;throw new n1("value",K,B)}c9(Y,Q,J)}function S2(B,U){if(typeof B!=="number")throw new z9(U,"number",B)}function n2(B,U,G){if(Math.floor(B)!==B)throw S2(B,G),new n1(G||"offset","an integer",B);if(U<0)throw new N9;throw new n1(G||"offset",`>= ${G?1:0} and <= ${U}`,B)}var m9=/[^+/0-9A-Za-z-_]/g;function l9(B){if(B=B.split("=")[0],B=B.trim().replace(m9,""),B.length<2)return"";while(B.length%4!==0)B=B+"=";return B}function t1(B,U){U=U||1/0;let G,Y=B.length,Q=null,J=[];for(let Z=0;Z55295&&G<57344){if(!Q){if(G>56319){if((U-=3)>-1)J.push(239,191,189);continue}else if(Z+1===Y){if((U-=3)>-1)J.push(239,191,189);continue}Q=G;continue}if(G<56320){if((U-=3)>-1)J.push(239,191,189);Q=G;continue}G=(Q-55296<<10|G-56320)+65536}else if(Q){if((U-=3)>-1)J.push(239,191,189)}if(Q=null,G<128){if((U-=1)<0)break;J.push(G)}else if(G<2048){if((U-=2)<0)break;J.push(G>>6|192,G&63|128)}else if(G<65536){if((U-=3)<0)break;J.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if((U-=4)<0)break;J.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw new Error("Invalid code point")}return J}function a9(B){let U=[];for(let G=0;G>8,Q=G%256,J.push(Q),J.push(Y)}return J}function y8(B){return P9(l9(B))}function P1(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 r9=function(){let B=new 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 X2(B){return typeof BigInt==="undefined"?i9:B}function i9(){throw new Error("BigInt not supported")}function G6(B){return()=>{throw new Error(B+" is not implemented for node:buffer browser polyfill")}}var G7=G6("resolveObjectURL"),Y7=G6("isUtf8");var Z7=G6("transcode");var sK=O9(h8());var L8={};H9(L8,{unsignedDecimalNumber:()=>q1,universalMeasureValue:()=>V1,uniqueUuid:()=>eB,uniqueNumericIdCreator:()=>X1,uniqueId:()=>R1,uCharHexNumber:()=>F6,twipsMeasureValue:()=>z0,standardizeData:()=>P4,signedTwipsMeasureValue:()=>t0,signedHpsMeasureValue:()=>GG,shortHexNumber:()=>SB,sectionPageSizeDefaults:()=>k1,sectionMarginDefaults:()=>O2,positiveUniversalMeasureValue:()=>u6,pointMeasureValue:()=>gB,percentageValue:()=>vB,patchDocument:()=>pK,patchDetector:()=>iK,measurementOrPercentValue:()=>d6,longHexNumber:()=>UG,hpsMeasureValue:()=>bB,hexColorValue:()=>C2,hashedId:()=>H6,encodeUtf8:()=>U1,eighthPointMeasureValue:()=>yB,docPropertiesUniqueNumericIdGen:()=>oB,decimalNumber:()=>D0,dateTimeValue:()=>fB,createWrapTopAndBottom:()=>O4,createWrapTight:()=>R4,createWrapSquare:()=>X4,createWrapNone:()=>W6,createVerticalPosition:()=>J4,createVerticalAlign:()=>B8,createUnderline:()=>cB,createTransformation:()=>i6,createTableWidthElement:()=>J1,createTableRowHeight:()=>HU,createTableLook:()=>FU,createTableLayout:()=>RU,createTableFloatProperties:()=>XU,createTabStopItem:()=>b4,createTabStop:()=>v4,createStringElement:()=>f2,createSpacing:()=>S4,createSimplePos:()=>G4,createShading:()=>w1,createSectionType:()=>CU,createRunFonts:()=>T1,createParagraphStyle:()=>x2,createPageSize:()=>TU,createPageNumberType:()=>zU,createPageMargin:()=>NU,createOutlineLevel:()=>_4,createMathSuperScriptProperties:()=>p4,createMathSuperScriptElement:()=>a2,createMathSubSuperScriptProperties:()=>i4,createMathSubScriptProperties:()=>r4,createMathSubScriptElement:()=>l2,createMathPreSubSuperScriptProperties:()=>n4,createMathNAryProperties:()=>t6,createMathLimitLocation:()=>a4,createMathBase:()=>y0,createMathAccentCharacter:()=>l4,createLineNumberType:()=>AU,createIndent:()=>hB,createHorizontalPosition:()=>Q4,createHeaderFooterReference:()=>C1,createFrameProperties:()=>u4,createEmphasisMark:()=>p6,createDotEmphasisMark:()=>XG,createDocumentGrid:()=>PU,createColumns:()=>WU,createBorderElement:()=>P0,createBodyProperties:()=>K4,createAlignment:()=>c6,convertToXmlComponent:()=>h1,convertMillimetersToTwip:()=>gG,convertInchesToTwip:()=>u0,concreteNumUniqueNumericIdGen:()=>sB,commentIdToParaId:()=>j4,bookmarkUniqueNumericIdGen:()=>tB,abstractNumUniqueNumericIdGen:()=>nB,YearShort:()=>aY,YearLong:()=>iY,XmlComponent:()=>t,XmlAttributeComponent:()=>O0,WpsShapeRun:()=>zY,WpgGroupRun:()=>TY,WidthType:()=>b1,WORKAROUND4:()=>aZ,WORKAROUND3:()=>BG,WORKAROUND2:()=>OJ,VerticalPositionRelativeFrom:()=>U4,VerticalPositionAlign:()=>QG,VerticalMergeType:()=>U8,VerticalMergeRevisionType:()=>wQ,VerticalMerge:()=>j6,VerticalAnchor:()=>fG,VerticalAlignTable:()=>KU,VerticalAlignSection:()=>IU,VerticalAlign:()=>LQ,UnderlineType:()=>r6,ThematicBreak:()=>_B,Textbox:()=>PK,TextWrappingType:()=>e2,TextWrappingSide:()=>M4,TextRun:()=>Q1,TextEffect:()=>AG,TextDirection:()=>FQ,TableRowPropertiesChange:()=>EU,TableRowProperties:()=>Q8,TableRow:()=>$Q,TableProperties:()=>Z8,TableOfContents:()=>JK,TableLayoutType:()=>zQ,TableCellBorders:()=>VU,TableCell:()=>G8,TableBorders:()=>Y8,TableAnchorType:()=>WQ,Table:()=>CQ,TabStopType:()=>A6,TabStopPosition:()=>wZ,Tab:()=>D4,TDirection:()=>LU,SymbolRun:()=>aB,Styles:()=>$1,StyleLevel:()=>KK,StyleForParagraph:()=>p2,StyleForCharacter:()=>$2,StringValueElement:()=>V2,StringEnumValueElement:()=>YG,StringContainer:()=>R2,SpaceType:()=>x0,SoftHyphen:()=>cY,SimpleMailMergeField:()=>$Y,SimpleField:()=>n6,ShadingType:()=>wG,SequentialIdentifier:()=>CY,Separator:()=>oY,SectionType:()=>sQ,SectionPropertiesChange:()=>kU,SectionProperties:()=>J8,RunPropertiesDefaults:()=>aU,RunPropertiesChange:()=>lB,RunProperties:()=>U2,Run:()=>T0,RelativeVerticalPosition:()=>AQ,RelativeHorizontalPosition:()=>PQ,PrettifyType:()=>G9,PositionalTabRelativeTo:()=>YZ,PositionalTabLeader:()=>ZZ,PositionalTabAlignment:()=>GZ,PositionalTab:()=>JZ,PatchType:()=>D6,ParagraphRunProperties:()=>mB,ParagraphPropertiesDefaults:()=>lU,ParagraphPropertiesChange:()=>d4,ParagraphProperties:()=>w2,Paragraph:()=>d0,PageTextDirectionType:()=>iQ,PageTextDirection:()=>DU,PageReference:()=>AZ,PageOrientation:()=>y1,PageNumberSeparator:()=>rQ,PageNumberElement:()=>eY,PageNumber:()=>F2,PageBreakBefore:()=>$4,PageBreak:()=>KZ,PageBorders:()=>jU,PageBorderZOrder:()=>pQ,PageBorderOffsetFrom:()=>aQ,PageBorderDisplay:()=>lQ,Packer:()=>Y9,OverlapType:()=>jQ,OnOffElement:()=>V0,Numbering:()=>dU,NumberedItemReferenceFormat:()=>HZ,NumberedItemReference:()=>WZ,NumberValueElement:()=>_2,NumberProperties:()=>D1,NumberFormat:()=>JG,NoBreakHyphen:()=>dY,NextAttributeComponent:()=>k6,MonthShort:()=>lY,MonthLong:()=>rY,Media:()=>K8,MathSuperScript:()=>dZ,MathSum:()=>xZ,MathSubSuperScript:()=>mZ,MathSubScript:()=>cZ,MathSquareBrackets:()=>eZ,MathRun:()=>vZ,MathRoundBrackets:()=>tZ,MathRadicalProperties:()=>o4,MathRadical:()=>iZ,MathPreSubSuperScript:()=>lZ,MathNumerator:()=>m4,MathLimitUpper:()=>hZ,MathLimitLower:()=>uZ,MathLimit:()=>e6,MathIntegral:()=>_Z,MathFunctionProperties:()=>e4,MathFunctionName:()=>t4,MathFunction:()=>nZ,MathFraction:()=>yZ,MathDenominator:()=>c4,MathDegree:()=>s4,MathCurlyBrackets:()=>BQ,MathAngledBrackets:()=>UQ,Math:()=>SZ,LineRuleType:()=>k2,LineNumberRestartFormat:()=>mQ,LevelSuffix:()=>PJ,LevelOverride:()=>uU,LevelFormat:()=>i0,LevelForOverride:()=>NJ,LevelBase:()=>I8,Level:()=>hU,LeaderType:()=>VZ,LastRenderedPageBreak:()=>UZ,InternalHyperlink:()=>y4,InsertedTextRun:()=>QQ,InsertedTableRow:()=>UU,InsertedTableCell:()=>YU,InitializableXmlComponent:()=>h6,ImportedXmlComponent:()=>kB,ImportedRootElementAttributes:()=>$B,ImageRun:()=>NY,IgnoreIfEmptyXmlComponent:()=>L2,HyperlinkType:()=>RZ,HpsMeasureElement:()=>z1,HorizontalPositionRelativeFrom:()=>B4,HorizontalPositionAlign:()=>ZG,HighlightColor:()=>jG,HeightRule:()=>kQ,HeadingLevel:()=>qZ,HeaderWrapper:()=>_U,HeaderFooterType:()=>N6,HeaderFooterReferenceType:()=>D2,Header:()=>IK,GridSpan:()=>wU,FrameWrap:()=>$Z,FrameAnchorType:()=>kZ,FootnoteReferenceRun:()=>VK,FootnoteReferenceElement:()=>sY,FootnoteReference:()=>oU,FooterWrapper:()=>fU,Footer:()=>qK,FootNotes:()=>xU,FootNoteReferenceRunAttributes:()=>sU,FileChild:()=>O1,File:()=>GK,ExternalHyperlink:()=>o6,Endnotes:()=>gU,EndnoteReferenceRunAttributes:()=>tU,EndnoteReferenceRun:()=>wK,EndnoteReference:()=>T4,EndnoteIdReference:()=>eU,EmptyElement:()=>S0,EmphasisMarkType:()=>a6,EMPTY_OBJECT:()=>KB,DropCapType:()=>CZ,Drawing:()=>c1,DocumentGridType:()=>cQ,DocumentDefaults:()=>pU,DocumentBackgroundAttributes:()=>SU,DocumentBackground:()=>bU,DocumentAttributes:()=>F1,DocumentAttributeNamespaces:()=>v1,Document:()=>GK,DeletedTextRun:()=>qQ,DeletedTableRow:()=>GU,DeletedTableCell:()=>ZU,DayShort:()=>mY,DayLong:()=>pY,ContinuationSeparator:()=>tY,ConcreteNumbering:()=>T6,ConcreteHyperlink:()=>m2,CommentsExtended:()=>z4,Comments:()=>N4,CommentReference:()=>xY,CommentRangeStart:()=>gY,CommentRangeEnd:()=>fY,Comment:()=>P6,ColumnBreak:()=>IZ,Column:()=>tQ,CheckBoxUtil:()=>B9,CheckBoxSymbolElement:()=>S1,CheckBox:()=>LK,CharacterSet:()=>jZ,CellMergeAttributes:()=>QU,CellMerge:()=>JU,CarriageReturn:()=>BZ,BuilderElement:()=>w0,BorderStyle:()=>d1,Border:()=>xB,BookmarkStart:()=>f4,BookmarkEnd:()=>x4,Bookmark:()=>g4,Body:()=>$U,BaseXmlComponent:()=>Y1,Attributes:()=>C0,AnnotationReference:()=>nY,AlignmentType:()=>c0,AbstractNumbering:()=>z6});var{create:o9,defineProperty:QB,getOwnPropertyDescriptor:t9,getOwnPropertyNames:e9,getPrototypeOf:B5}=Object,U5=Object.prototype.hasOwnProperty,JB=(B,U)=>()=>(B&&(U=B(B=0)),U),L0=(B,U)=>()=>(U||(B((U={exports:{}}).exports,U),B=null),U.exports),G5=(B,U,G,Y)=>{if(U&&typeof U==="object"||typeof U==="function"){for(var Q=e9(U),J=0,Z=Q.length,K;JU[V]).bind(null,K),enumerable:!(Y=t9(U,K))||Y.enumerable})}return B},C6=(B,U,G)=>(G=B!=null?o9(B5(B)):{},G5(U||!B||!B.__esModule?QB(G,"default",{value:B,enumerable:!0}):G,B)),j1=((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 Y5(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 new TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(B)}function Z5(B){var U=Y5(B,"string");return G1(U)=="symbol"?U:U+""}function e(B,U,G){return(U=Z5(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=new Array}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}},L2=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 u8(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 M0(B){for(var U=1;U{if(Y!==void 0){let Q=this.xmlKeys&&this.xmlKeys[G]||G;U[Q]=Y}}),{_attr:U}}},k6=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})=>M0(M0({},U),{},{[G]:Y}),{})}}},C0=class extends O0{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"})}},$6=L0((B,U)=>{var G=typeof Reflect==="object"?Reflect:null,Y=G&&typeof G.apply==="function"?G.apply:function w($,x,j){return Function.prototype.apply.call($,x,j)},Q;if(G&&typeof G.ownKeys==="function")Q=G.ownKeys;else if(Object.getOwnPropertySymbols)Q=function w($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))};else Q=function w($){return Object.getOwnPropertyNames($)};function J(w){if(console&&console.warn)console.warn(w)}var Z=Number.isNaN||function w($){return $!==$};function K(){K.init.call(this)}U.exports=K,U.exports.once=v,K.EventEmitter=K,K.prototype._events=void 0,K.prototype._eventsCount=0,K.prototype._maxListeners=void 0;var V=10;function H(w){if(typeof w!=="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(K,"defaultMaxListeners",{enumerable:!0,get:function(){return V},set:function(w){if(typeof w!=="number"||w<0||Z(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");V=w}}),K.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},K.prototype.setMaxListeners=function w($){if(typeof $!=="number"||$<0||Z($))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function O(w){if(w._maxListeners===void 0)return K.defaultMaxListeners;return w._maxListeners}K.prototype.getMaxListeners=function w(){return O(this)},K.prototype.emit=function w($){var x=[];for(var j=1;j0)b=x[0];if(b instanceof Error)throw b;var c=new Error("Unhandled error."+(b?" ("+b.message+")":""));throw c.context=b,c}var T=U0[$];if(T===void 0)return!1;if(typeof T==="function")Y(T,this,x);else{var m=T.length,B0=z(T,m);for(var j=0;j0&&b.length>a&&!b.warned){b.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+b.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=w,c.type=$,c.count=b.length,J(c)}}return w}K.prototype.addListener=function w($,x){return X(this,$,x,!1)},K.prototype.on=K.prototype.addListener,K.prototype.prependListener=function w($,x){return X(this,$,x,!0)};function D(){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 W(w,$,x){var j={fired:!1,wrapFn:void 0,target:w,type:$,listener:x},a=D.bind(j);return a.listener=x,j.wrapFn=a,a}K.prototype.once=function w($,x){return H(x),this.on($,W(this,$,x)),this},K.prototype.prependOnceListener=function w($,x){return H(x),this.prependListener($,W(this,$,x)),this},K.prototype.removeListener=function w($,x){var j,a,U0,b,c;if(H(x),a=this._events,a===void 0)return this;if(j=a[$],j===void 0)return this;if(j===x||j.listener===x){if(--this._eventsCount===0)this._events=Object.create(null);else if(delete a[$],a.removeListener)this.emit("removeListener",$,j.listener||x)}else if(typeof j!=="function"){U0=-1;for(b=j.length-1;b>=0;b--)if(j[b]===x||j[b].listener===x){c=j[b].listener,U0=b;break}if(U0<0)return this;if(U0===0)j.shift();else C(j,U0);if(j.length===1)a[$]=j[0];if(a.removeListener!==void 0)this.emit("removeListener",$,c||x)}return this},K.prototype.off=K.prototype.removeListener,K.prototype.removeAllListeners=function w($){var x,j=this._events,a;if(j===void 0)return this;if(j.removeListener===void 0){if(arguments.length===0)this._events=Object.create(null),this._eventsCount=0;else if(j[$]!==void 0)if(--this._eventsCount===0)this._events=Object.create(null);else delete j[$];return this}if(arguments.length===0){var U0=Object.keys(j),b;for(a=0;a=0;a--)this.removeListener($,x[a]);return this};function E(w,$,x){var j=w._events;if(j===void 0)return[];var a=j[$];if(a===void 0)return[];if(typeof a==="function")return x?[a.listener||a]:[a];return x?A(a):z(a,a.length)}K.prototype.listeners=function w($){return E(this,$,!0)},K.prototype.rawListeners=function w($){return E(this,$,!1)},K.listenerCount=function(w,$){if(typeof w.listenerCount==="function")return w.listenerCount($);else return P.call(w,$)},K.prototype.listenerCount=P;function P(w){var $=this._events;if($!==void 0){var x=$[w];if(typeof x==="function")return 1;else if(x!==void 0)return x.length}return 0}K.prototype.eventNames=function w(){return this._eventsCount>0?Q(this._events):[]};function z(w,$){var x=new Array($);for(var j=0;j<$;++j)x[j]=w[j];return x}function C(w,$){for(;$+1{if(typeof Object.create==="function")U.exports=function G(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 G(Y,Q){if(Q){Y.super_=Q;var J=function(){};J.prototype=Q.prototype,Y.prototype=new J,Y.prototype.constructor=Y}}}),v0,d2=JB(()=>{v0=globalThis||self});function Q5(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function X6(){throw new Error("setTimeout has not been defined")}function R6(){throw new Error("clearTimeout has not been defined")}function IB(B){if(n0===setTimeout)return setTimeout(B,0);if((n0===X6||!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 J5(B){if(s0===clearTimeout)return clearTimeout(B);if((s0===R6||!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 K5(){if(!T2||!z2)return;if(T2=!1,z2.length)o0=z2.concat(o0);else B1=-1;if(o0.length)qB()}function qB(){if(T2)return;var B=IB(K5);T2=!0;var U=o0.length;while(U){z2=o0,o0=[];while(++B1{Q6={exports:{}},A0=Q6.exports={},function(){try{if(typeof setTimeout==="function")n0=setTimeout;else n0=X6}catch(B){n0=X6}try{if(typeof clearTimeout==="function")s0=clearTimeout;else s0=R6}catch(B){s0=R6}}(),o0=[],T2=!1,B1=-1,A0.nextTick=function(B){var U=new Array(arguments.length-1);if(arguments.length>1)for(var G=1;G{U.exports=$6().EventEmitter}),I5=L0((B)=>{B.byteLength=V,B.toByteArray=O,B.fromByteArray=W;var U=[],G=[],Y=typeof Uint8Array!=="undefined"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var J=0,Z=Q.length;J0)throw new Error("Invalid string. Length must be a multiple of 4");var z=E.indexOf("=");if(z===-1)z=P;var C=z===P?0:4-z%4;return[z,C]}function V(E){var P=K(E),z=P[0],C=P[1];return(z+C)*3/4-C}function H(E,P,z){return(P+z)*3/4-z}function O(E){var P,z=K(E),C=z[0],A=z[1],v=new Y(H(E,C,A)),S=0,F=A>0?C-4:C,w;for(w=0;w>16&255,v[S++]=P>>8&255,v[S++]=P&255;if(A===2)P=G[E.charCodeAt(w)]<<2|G[E.charCodeAt(w+1)]>>4,v[S++]=P&255;if(A===1)P=G[E.charCodeAt(w)]<<10|G[E.charCodeAt(w+1)]<<4|G[E.charCodeAt(w+2)]>>2,v[S++]=P>>8&255,v[S++]=P&255;return v}function X(E){return U[E>>18&63]+U[E>>12&63]+U[E>>6&63]+U[E&63]}function D(E,P,z){var C,A=[];for(var v=P;vF?F:S+v));if(C===1)P=E[z-1],A.push(U[P>>2]+U[P<<4&63]+"==");else if(C===2)P=(E[z-2]<<8)+E[z-1],A.push(U[P>>10]+U[P>>4&63]+U[P<<2&63]+"=");return A.join("")}}),q5=L0((B)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */B.read=function(U,G,Y,Q,J){var Z,K,V=J*8-Q-1,H=(1<>1,X=-7,D=Y?J-1:0,W=Y?-1:1,E=U[G+D];D+=W,Z=E&(1<<-X)-1,E>>=-X,X+=V;for(;X>0;Z=Z*256+U[G+D],D+=W,X-=8);K=Z&(1<<-X)-1,Z>>=-X,X+=Q;for(;X>0;K=K*256+U[G+D],D+=W,X-=8);if(Z===0)Z=1-O;else if(Z===H)return K?NaN:(E?-1:1)*(1/0);else K=K+Math.pow(2,Q),Z=Z-O;return(E?-1:1)*K*Math.pow(2,Z-Q)},B.write=function(U,G,Y,Q,J,Z){var K,V,H,O=Z*8-J-1,X=(1<>1,W=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=Q?0:Z-1,P=Q?1:-1,z=G<0||G===0&&1/G<0?1:0;if(G=Math.abs(G),isNaN(G)||G===1/0)V=isNaN(G)?1:0,K=X;else{if(K=Math.floor(Math.log(G)/Math.LN2),G*(H=Math.pow(2,-K))<1)K--,H*=2;if(K+D>=1)G+=W/H;else G+=W*Math.pow(2,1-D);if(G*H>=2)K++,H/=2;if(K+D>=X)V=0,K=X;else if(K+D>=1)V=(G*H-1)*Math.pow(2,J),K=K+D;else V=G*Math.pow(2,D-1)*Math.pow(2,J),K=0}for(;J>=8;U[Y+E]=V&255,E+=P,V/=256,J-=8);K=K<0;U[Y+E]=K&255,E+=P,K/=256,O-=8);U[Y+E-P]|=z*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 g1=L0((B)=>{var U=I5(),G=q5(),Y=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=K,B.SlowBuffer=A,B.INSPECT_MAX_BYTES=50;var Q=2147483647;if(B.kMaxLength=Q,K.TYPED_ARRAY_SUPPORT=J(),!K.TYPED_ARRAY_SUPPORT&&typeof console!=="undefined"&&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 J(){try{var k=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(k,I),k.foo()===42}catch(q){return!1}}Object.defineProperty(K.prototype,"parent",{enumerable:!0,get:function(){if(!K.isBuffer(this))return;return this.buffer}}),Object.defineProperty(K.prototype,"offset",{enumerable:!0,get:function(){if(!K.isBuffer(this))return;return this.byteOffset}});function Z(k){if(k>Q)throw new RangeError('The value "'+k+'" is invalid for option "size"');var I=new Uint8Array(k);return Object.setPrototypeOf(I,K.prototype),I}function K(k,I,q){if(typeof k==="number"){if(typeof I==="string")throw new TypeError('The "string" argument must be of type string. Received type number');return X(k)}return V(k,I,q)}K.poolSize=8192;function V(k,I,q){if(typeof k==="string")return D(k,I);if(ArrayBuffer.isView(k))return E(k);if(k==null)throw new 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 P(k,I,q);if(typeof SharedArrayBuffer!=="undefined"&&(f(k,SharedArrayBuffer)||k&&f(k.buffer,SharedArrayBuffer)))return P(k,I,q);if(typeof k==="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var R=k.valueOf&&k.valueOf();if(R!=null&&R!==k)return K.from(R,I,q);var _=z(k);if(_)return _;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]==="function")return K.from(k[Symbol.toPrimitive]("string"),I,q);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}K.from=function(k,I,q){return V(k,I,q)},Object.setPrototypeOf(K.prototype,Uint8Array.prototype),Object.setPrototypeOf(K,Uint8Array);function H(k){if(typeof k!=="number")throw new TypeError('"size" argument must be of type number');else if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function O(k,I,q){if(H(k),k<=0)return Z(k);if(I!==void 0)return typeof q==="string"?Z(k).fill(I,q):Z(k).fill(I);return Z(k)}K.alloc=function(k,I,q){return O(k,I,q)};function X(k){return H(k),Z(k<0?0:C(k)|0)}K.allocUnsafe=function(k){return X(k)},K.allocUnsafeSlow=function(k){return X(k)};function D(k,I){if(typeof I!=="string"||I==="")I="utf8";if(!K.isEncoding(I))throw new TypeError("Unknown encoding: "+I);var q=v(k,I)|0,R=Z(q),_=R.write(k,I);if(_!==q)R=R.slice(0,_);return R}function W(k){var I=k.length<0?0:C(k.length)|0,q=Z(I);for(var R=0;R=Q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return k|0}function A(k){if(+k!=k)k=0;return K.alloc(+k)}K.isBuffer=function k(I){return I!=null&&I._isBuffer===!0&&I!==K.prototype},K.compare=function k(I,q){if(f(I,Uint8Array))I=K.from(I,I.offset,I.byteLength);if(f(q,Uint8Array))q=K.from(q,q.offset,q.byteLength);if(!K.isBuffer(I)||!K.isBuffer(q))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===q)return 0;var R=I.length,_=q.length;for(var l=0,d=Math.min(R,_);l_.length)K.from(d).copy(_,l);else Uint8Array.prototype.set.call(_,d,l);else if(!K.isBuffer(d))throw new TypeError('"list" argument must be an Array of Buffers');else d.copy(_,l);l+=d.length}return _};function v(k,I){if(K.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||f(k,ArrayBuffer))return k.byteLength;if(typeof k!=="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var q=k.length,R=arguments.length>2&&arguments[2]===!0;if(!R&&q===0)return 0;var _=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return q;case"utf8":case"utf-8":return M(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q*2;case"hex":return q>>>1;case"base64":return Z0(k).length;default:if(_)return R?-1:M(k).length;I=(""+I).toLowerCase(),_=!0}}K.byteLength=v;function S(k,I,q){var R=!1;if(I===void 0||I<0)I=0;if(I>this.length)return"";if(q===void 0||q>this.length)q=this.length;if(q<=0)return"";if(q>>>=0,I>>>=0,q<=I)return"";if(!k)k="utf8";while(!0)switch(k){case"hex":return s(this,I,q);case"utf8":case"utf-8":return T(this,I,q);case"ascii":return i(this,I,q);case"latin1":case"binary":return I0(this,I,q);case"base64":return c(this,I,q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G0(this,I,q);default:if(R)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),R=!0}}K.prototype._isBuffer=!0;function F(k,I,q){var R=k[I];k[I]=k[q],k[q]=R}if(K.prototype.swap16=function k(){var I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var q=0;qq)I+=" ... ";return""},Y)K.prototype[Y]=K.prototype.inspect;K.prototype.compare=function k(I,q,R,_,l){if(f(I,Uint8Array))I=K.from(I,I.offset,I.byteLength);if(!K.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(q===void 0)q=0;if(R===void 0)R=I?I.length:0;if(_===void 0)_=0;if(l===void 0)l=this.length;if(q<0||R>I.length||_<0||l>this.length)throw new RangeError("out of range index");if(_>=l&&q>=R)return 0;if(_>=l)return-1;if(q>=R)return 1;if(q>>>=0,R>>>=0,_>>>=0,l>>>=0,this===I)return 0;var d=l-_,Q0=R-q,q0=Math.min(d,Q0),K0=this.slice(_,l),X0=I.slice(q,R);for(var F0=0;F02147483647)q=2147483647;else if(q<-2147483648)q=-2147483648;if(q=+q,L(q))q=_?0:k.length-1;if(q<0)q=k.length+q;if(q>=k.length)if(_)return-1;else q=k.length-1;else if(q<0)if(_)q=0;else return-1;if(typeof I==="string")I=K.from(I,R);if(K.isBuffer(I)){if(I.length===0)return-1;return $(k,I,q,R,_)}else if(typeof I==="number"){if(I=I&255,typeof Uint8Array.prototype.indexOf==="function")if(_)return Uint8Array.prototype.indexOf.call(k,I,q);else return Uint8Array.prototype.lastIndexOf.call(k,I,q);return $(k,[I],q,R,_)}throw new TypeError("val must be string, number or Buffer")}function $(k,I,q,R,_){var l=1,d=k.length,Q0=I.length;if(R!==void 0){if(R=String(R).toLowerCase(),R==="ucs2"||R==="ucs-2"||R==="utf16le"||R==="utf-16le"){if(k.length<2||I.length<2)return-1;l=2,d/=2,Q0/=2,q/=2}}function q0(k0,M2){if(l===1)return k0[M2];else return k0.readUInt16BE(M2*l)}var K0;if(_){var X0=-1;for(K0=q;K0d)q=d-Q0;for(K0=q;K0>=0;K0--){var F0=!0;for(var H0=0;H0_)R=_;var l=I.length;if(R>l/2)R=l/2;for(var d=0;d>>0,isFinite(R)){if(R=R>>>0,_===void 0)_="utf8"}else _=R,R=void 0;else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-q;if(R===void 0||R>l)R=l;if(I.length>0&&(R<0||q<0)||q>this.length)throw new RangeError("Attempt to write outside buffer bounds");if(!_)_="utf8";var d=!1;for(;;)switch(_){case"hex":return x(this,I,q,R);case"utf8":case"utf-8":return j(this,I,q,R);case"ascii":case"latin1":case"binary":return a(this,I,q,R);case"base64":return U0(this,I,q,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,I,q,R);default:if(d)throw new TypeError("Unknown encoding: "+_);_=(""+_).toLowerCase(),d=!0}},K.prototype.toJSON=function k(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(k,I,q){if(I===0&&q===k.length)return U.fromByteArray(k);else return U.fromByteArray(k.slice(I,q))}function T(k,I,q){q=Math.min(k.length,q);var R=[],_=I;while(_239?4:l>223?3:l>191?2:1;if(_+Q0<=q){var q0,K0,X0,F0;switch(Q0){case 1:if(l<128)d=l;break;case 2:if(q0=k[_+1],(q0&192)===128){if(F0=(l&31)<<6|q0&63,F0>127)d=F0}break;case 3:if(q0=k[_+1],K0=k[_+2],(q0&192)===128&&(K0&192)===128){if(F0=(l&15)<<12|(q0&63)<<6|K0&63,F0>2047&&(F0<55296||F0>57343))d=F0}break;case 4:if(q0=k[_+1],K0=k[_+2],X0=k[_+3],(q0&192)===128&&(K0&192)===128&&(X0&192)===128){if(F0=(l&15)<<18|(q0&63)<<12|(K0&63)<<6|X0&63,F0>65535&&F0<1114112)d=F0}}}if(d===null)d=65533,Q0=1;else if(d>65535)d-=65536,R.push(d>>>10&1023|55296),d=56320|d&1023;R.push(d),_+=Q0}return B0(R)}var m=4096;function B0(k){var I=k.length;if(I<=m)return String.fromCharCode.apply(String,k);var q="",R=0;while(RR)q=R;var _="";for(var l=I;lR)I=R;if(q<0){if(q+=R,q<0)q=0}else if(q>R)q=R;if(qq)throw new RangeError("Trying to access beyond buffer length")}K.prototype.readUintLE=K.prototype.readUIntLE=function k(I,q,R){if(I=I>>>0,q=q>>>0,!R)r(I,q,this.length);var _=this[I],l=1,d=0;while(++d>>0,q=q>>>0,!R)r(I,q,this.length);var _=this[I+--q],l=1;while(q>0&&(l*=256))_+=this[I+--q]*l;return _},K.prototype.readUint8=K.prototype.readUInt8=function k(I,q){if(I=I>>>0,!q)r(I,1,this.length);return this[I]},K.prototype.readUint16LE=K.prototype.readUInt16LE=function k(I,q){if(I=I>>>0,!q)r(I,2,this.length);return this[I]|this[I+1]<<8},K.prototype.readUint16BE=K.prototype.readUInt16BE=function k(I,q){if(I=I>>>0,!q)r(I,2,this.length);return this[I]<<8|this[I+1]},K.prototype.readUint32LE=K.prototype.readUInt32LE=function k(I,q){if(I=I>>>0,!q)r(I,4,this.length);return(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},K.prototype.readUint32BE=K.prototype.readUInt32BE=function k(I,q){if(I=I>>>0,!q)r(I,4,this.length);return this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},K.prototype.readIntLE=function k(I,q,R){if(I=I>>>0,q=q>>>0,!R)r(I,q,this.length);var _=this[I],l=1,d=0;while(++d=l)_-=Math.pow(2,8*q);return _},K.prototype.readIntBE=function k(I,q,R){if(I=I>>>0,q=q>>>0,!R)r(I,q,this.length);var _=q,l=1,d=this[I+--_];while(_>0&&(l*=256))d+=this[I+--_]*l;if(l*=128,d>=l)d-=Math.pow(2,8*q);return d},K.prototype.readInt8=function k(I,q){if(I=I>>>0,!q)r(I,1,this.length);if(!(this[I]&128))return this[I];return(255-this[I]+1)*-1},K.prototype.readInt16LE=function k(I,q){if(I=I>>>0,!q)r(I,2,this.length);var R=this[I]|this[I+1]<<8;return R&32768?R|4294901760:R},K.prototype.readInt16BE=function k(I,q){if(I=I>>>0,!q)r(I,2,this.length);var R=this[I+1]|this[I]<<8;return R&32768?R|4294901760:R},K.prototype.readInt32LE=function k(I,q){if(I=I>>>0,!q)r(I,4,this.length);return this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},K.prototype.readInt32BE=function k(I,q){if(I=I>>>0,!q)r(I,4,this.length);return this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},K.prototype.readFloatLE=function k(I,q){if(I=I>>>0,!q)r(I,4,this.length);return G.read(this,I,!0,23,4)},K.prototype.readFloatBE=function k(I,q){if(I=I>>>0,!q)r(I,4,this.length);return G.read(this,I,!1,23,4)},K.prototype.readDoubleLE=function k(I,q){if(I=I>>>0,!q)r(I,8,this.length);return G.read(this,I,!0,52,8)},K.prototype.readDoubleBE=function k(I,q){if(I=I>>>0,!q)r(I,8,this.length);return G.read(this,I,!1,52,8)};function y(k,I,q,R,_,l){if(!K.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>_||Ik.length)throw new RangeError("Index out of range")}K.prototype.writeUintLE=K.prototype.writeUIntLE=function k(I,q,R,_){if(I=+I,q=q>>>0,R=R>>>0,!_){var l=Math.pow(2,8*R)-1;y(this,I,q,R,l,0)}var d=1,Q0=0;this[q]=I&255;while(++Q0>>0,R=R>>>0,!_){var l=Math.pow(2,8*R)-1;y(this,I,q,R,l,0)}var d=R-1,Q0=1;this[q+d]=I&255;while(--d>=0&&(Q0*=256))this[q+d]=I/Q0&255;return q+R},K.prototype.writeUint8=K.prototype.writeUInt8=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,1,255,0);return this[q]=I&255,q+1},K.prototype.writeUint16LE=K.prototype.writeUInt16LE=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,2,65535,0);return this[q]=I&255,this[q+1]=I>>>8,q+2},K.prototype.writeUint16BE=K.prototype.writeUInt16BE=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,2,65535,0);return this[q]=I>>>8,this[q+1]=I&255,q+2},K.prototype.writeUint32LE=K.prototype.writeUInt32LE=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,4,4294967295,0);return this[q+3]=I>>>24,this[q+2]=I>>>16,this[q+1]=I>>>8,this[q]=I&255,q+4},K.prototype.writeUint32BE=K.prototype.writeUInt32BE=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,4,4294967295,0);return this[q]=I>>>24,this[q+1]=I>>>16,this[q+2]=I>>>8,this[q+3]=I&255,q+4},K.prototype.writeIntLE=function k(I,q,R,_){if(I=+I,q=q>>>0,!_){var l=Math.pow(2,8*R-1);y(this,I,q,R,l-1,-l)}var d=0,Q0=1,q0=0;this[q]=I&255;while(++d>0)-q0&255}return q+R},K.prototype.writeIntBE=function k(I,q,R,_){if(I=+I,q=q>>>0,!_){var l=Math.pow(2,8*R-1);y(this,I,q,R,l-1,-l)}var d=R-1,Q0=1,q0=0;this[q+d]=I&255;while(--d>=0&&(Q0*=256)){if(I<0&&q0===0&&this[q+d+1]!==0)q0=1;this[q+d]=(I/Q0>>0)-q0&255}return q+R},K.prototype.writeInt8=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,1,127,-128);if(I<0)I=255+I+1;return this[q]=I&255,q+1},K.prototype.writeInt16LE=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,2,32767,-32768);return this[q]=I&255,this[q+1]=I>>>8,q+2},K.prototype.writeInt16BE=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,2,32767,-32768);return this[q]=I>>>8,this[q+1]=I&255,q+2},K.prototype.writeInt32LE=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,4,2147483647,-2147483648);return this[q]=I&255,this[q+1]=I>>>8,this[q+2]=I>>>16,this[q+3]=I>>>24,q+4},K.prototype.writeInt32BE=function k(I,q,R){if(I=+I,q=q>>>0,!R)y(this,I,q,4,2147483647,-2147483648);if(I<0)I=4294967295+I+1;return this[q]=I>>>24,this[q+1]=I>>>16,this[q+2]=I>>>8,this[q+3]=I&255,q+4};function n(k,I,q,R,_,l){if(q+R>k.length)throw new RangeError("Index out of range");if(q<0)throw new RangeError("Index out of range")}function o(k,I,q,R,_){if(I=+I,q=q>>>0,!_)n(k,I,q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return G.write(k,I,q,R,23,4),q+4}K.prototype.writeFloatLE=function k(I,q,R){return o(this,I,q,!0,R)},K.prototype.writeFloatBE=function k(I,q,R){return o(this,I,q,!1,R)};function Y0(k,I,q,R,_){if(I=+I,q=q>>>0,!_)n(k,I,q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return G.write(k,I,q,R,52,8),q+8}K.prototype.writeDoubleLE=function k(I,q,R){return Y0(this,I,q,!0,R)},K.prototype.writeDoubleBE=function k(I,q,R){return Y0(this,I,q,!1,R)},K.prototype.copy=function k(I,q,R,_){if(!K.isBuffer(I))throw new TypeError("argument should be a Buffer");if(!R)R=0;if(!_&&_!==0)_=this.length;if(q>=I.length)q=I.length;if(!q)q=0;if(_>0&&_=this.length)throw new RangeError("Index out of range");if(_<0)throw new RangeError("sourceEnd out of bounds");if(_>this.length)_=this.length;if(I.length-q<_-R)_=I.length-q+R;var l=_-R;if(this===I&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(q,R,_);else Uint8Array.prototype.set.call(I,this.subarray(R,_),q);return l},K.prototype.fill=function k(I,q,R,_){if(typeof I==="string"){if(typeof q==="string")_=q,q=0,R=this.length;else if(typeof R==="string")_=R,R=this.length;if(_!==void 0&&typeof _!=="string")throw new TypeError("encoding must be a string");if(typeof _==="string"&&!K.isEncoding(_))throw new TypeError("Unknown encoding: "+_);if(I.length===1){var l=I.charCodeAt(0);if(_==="utf8"&&l<128||_==="latin1")I=l}}else if(typeof I==="number")I=I&255;else if(typeof I==="boolean")I=Number(I);if(q<0||this.length>>0,R=R===void 0?this.length:R>>>0,!I)I=0;var d;if(typeof I==="number")for(d=q;d55295&&q<57344){if(!_){if(q>56319){if((I-=3)>-1)l.push(239,191,189);continue}else if(d+1===R){if((I-=3)>-1)l.push(239,191,189);continue}_=q;continue}if(q<56320){if((I-=3)>-1)l.push(239,191,189);_=q;continue}q=(_-55296<<10|q-56320)+65536}else if(_){if((I-=3)>-1)l.push(239,191,189)}if(_=null,q<128){if((I-=1)<0)break;l.push(q)}else if(q<2048){if((I-=2)<0)break;l.push(q>>6|192,q&63|128)}else if(q<65536){if((I-=3)<0)break;l.push(q>>12|224,q>>6&63|128,q&63|128)}else if(q<1114112){if((I-=4)<0)break;l.push(q>>18|240,q>>12&63|128,q>>6&63|128,q&63|128)}else throw new Error("Invalid code point")}return l}function u(k){var I=[];for(var q=0;q>8,_=q%256,l.push(_),l.push(R)}return l}function Z0(k){return U.toByteArray(N(k))}function g(k,I,q,R){for(var _=0;_=I.length||_>=k.length)break;I[_+q]=k[_]}return _}function f(k,I){return k instanceof I||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===I.name}function L(k){return k!==k}var p=function(){var k="0123456789abcdef",I=new Array(256);for(var q=0;q<16;++q){var R=q*16;for(var _=0;_<16;++_)I[R+_]=k[q]+k[_]}return I}()}),wB=L0((B,U)=>{U.exports=function G(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var Y={},Q=Symbol("test"),J=Object(Q);if(typeof Q==="string")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(J)!=="[object Symbol]")return!1;var Z=42;Y[Q]=Z;for(var K 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 V=Object.getOwnPropertySymbols(Y);if(V.length!==1||V[0]!==Q)return!1;if(!Object.prototype.propertyIsEnumerable.call(Y,Q))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var H=Object.getOwnPropertyDescriptor(Y,Q);if(H.value!==Z||H.enumerable!==!0)return!1}return!0}}),S6=L0((B,U)=>{var G=wB();U.exports=function Y(){return G()&&!!Symbol.toStringTag}}),LB=L0((B,U)=>{U.exports=Object}),V5=L0((B,U)=>{U.exports=Error}),w5=L0((B,U)=>{U.exports=EvalError}),L5=L0((B,U)=>{U.exports=RangeError}),M5=L0((B,U)=>{U.exports=ReferenceError}),MB=L0((B,U)=>{U.exports=SyntaxError}),f1=L0((B,U)=>{U.exports=TypeError}),X5=L0((B,U)=>{U.exports=URIError}),R5=L0((B,U)=>{U.exports=Math.abs}),O5=L0((B,U)=>{U.exports=Math.floor}),F5=L0((B,U)=>{U.exports=Math.max}),H5=L0((B,U)=>{U.exports=Math.min}),E5=L0((B,U)=>{U.exports=Math.pow}),W5=L0((B,U)=>{U.exports=Math.round}),P5=L0((B,U)=>{U.exports=Number.isNaN||function G(Y){return Y!==Y}}),A5=L0((B,U)=>{var G=P5();U.exports=function Y(Q){if(G(Q)||Q===0)return Q;return Q<0?-1:1}}),j5=L0((B,U)=>{U.exports=Object.getOwnPropertyDescriptor}),K1=L0((B,U)=>{var G=j5();if(G)try{G([],"length")}catch(Y){G=null}U.exports=G}),x1=L0((B,U)=>{var G=Object.defineProperty||!1;if(G)try{G({},"a",{value:1})}catch(Y){G=!1}U.exports=G}),N5=L0((B,U)=>{var G=typeof Symbol!=="undefined"&&Symbol,Y=wB();U.exports=function Q(){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()}}),XB=L0((B,U)=>{U.exports=typeof Reflect!=="undefined"&&Reflect.getPrototypeOf||null}),RB=L0((B,U)=>{U.exports=LB().getPrototypeOf||null}),z5=L0((B,U)=>{var G="Function.prototype.bind called on incompatible ",Y=Object.prototype.toString,Q=Math.max,J="[object Function]",Z=function H(O,X){var D=[];for(var W=0;W{var G=z5();U.exports=Function.prototype.bind||G}),b6=L0((B,U)=>{U.exports=Function.prototype.call}),v6=L0((B,U)=>{U.exports=Function.prototype.apply}),T5=L0((B,U)=>{U.exports=typeof Reflect!=="undefined"&&Reflect&&Reflect.apply}),OB=L0((B,U)=>{var G=I1(),Y=v6(),Q=b6();U.exports=T5()||G.call(Q,Y)}),y6=L0((B,U)=>{var G=I1(),Y=f1(),Q=b6(),J=OB();U.exports=function Z(K){if(K.length<1||typeof K[0]!=="function")throw new Y("a function is required");return J(G,Q,K)}}),D5=L0((B,U)=>{var G=y6(),Y=K1(),Q;try{Q=[].__proto__===Array.prototype}catch(V){if(!V||typeof V!=="object"||!("code"in V)||V.code!=="ERR_PROTO_ACCESS")throw V}var J=!!Q&&Y&&Y(Object.prototype,"__proto__"),Z=Object,K=Z.getPrototypeOf;U.exports=J&&typeof J.get==="function"?G([J.get]):typeof K==="function"?function V(H){return K(H==null?H:Z(H))}:!1}),FB=L0((B,U)=>{var G=XB(),Y=RB(),Q=D5();U.exports=G?function J(Z){return G(Z)}:Y?function J(Z){if(!Z||typeof Z!=="object"&&typeof Z!=="function")throw new TypeError("getProto: not an object");return Y(Z)}:Q?function J(Z){return Q(Z)}:null}),C5=L0((B,U)=>{var G=Function.prototype.call,Y=Object.prototype.hasOwnProperty;U.exports=I1().call(G,Y)}),HB=L0((B,U)=>{var G,Y=LB(),Q=V5(),J=w5(),Z=L5(),K=M5(),V=MB(),H=f1(),O=X5(),X=R5(),D=O5(),W=F5(),E=H5(),P=E5(),z=W5(),C=A5(),A=Function,v=function(h){try{return A('"use strict"; return ('+h+").constructor;")()}catch(Z0){}},S=K1(),F=x1(),w=function(){throw new H},$=S?function(){try{return arguments.callee,w}catch(h){try{return S(arguments,"callee").get}catch(Z0){return w}}}():w,x=N5()(),j=FB(),a=RB(),U0=XB(),b=v6(),c=b6(),T={},m=typeof Uint8Array==="undefined"||!j?G:j(Uint8Array),B0={__proto__:null,"%AggregateError%":typeof AggregateError==="undefined"?G:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer==="undefined"?G:ArrayBuffer,"%ArrayIteratorPrototype%":x&&j?j([][Symbol.iterator]()):G,"%AsyncFromSyncIteratorPrototype%":G,"%AsyncFunction%":T,"%AsyncGenerator%":T,"%AsyncGeneratorFunction%":T,"%AsyncIteratorPrototype%":T,"%Atomics%":typeof Atomics==="undefined"?G:Atomics,"%BigInt%":typeof BigInt==="undefined"?G:BigInt,"%BigInt64Array%":typeof BigInt64Array==="undefined"?G:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array==="undefined"?G:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView==="undefined"?G:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Q,"%eval%":eval,"%EvalError%":J,"%Float16Array%":typeof Float16Array==="undefined"?G:Float16Array,"%Float32Array%":typeof Float32Array==="undefined"?G:Float32Array,"%Float64Array%":typeof Float64Array==="undefined"?G:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry==="undefined"?G:FinalizationRegistry,"%Function%":A,"%GeneratorFunction%":T,"%Int8Array%":typeof Int8Array==="undefined"?G:Int8Array,"%Int16Array%":typeof Int16Array==="undefined"?G:Int16Array,"%Int32Array%":typeof Int32Array==="undefined"?G:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x&&j?j(j([][Symbol.iterator]())):G,"%JSON%":typeof JSON==="object"?JSON:G,"%Map%":typeof Map==="undefined"?G:Map,"%MapIteratorPrototype%":typeof Map==="undefined"||!x||!j?G:j(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Y,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise==="undefined"?G:Promise,"%Proxy%":typeof Proxy==="undefined"?G:Proxy,"%RangeError%":Z,"%ReferenceError%":K,"%Reflect%":typeof Reflect==="undefined"?G:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set==="undefined"?G:Set,"%SetIteratorPrototype%":typeof Set==="undefined"||!x||!j?G:j(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer==="undefined"?G:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x&&j?j(""[Symbol.iterator]()):G,"%Symbol%":x?Symbol:G,"%SyntaxError%":V,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":H,"%Uint8Array%":typeof Uint8Array==="undefined"?G:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray==="undefined"?G:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array==="undefined"?G:Uint16Array,"%Uint32Array%":typeof Uint32Array==="undefined"?G:Uint32Array,"%URIError%":O,"%WeakMap%":typeof WeakMap==="undefined"?G:WeakMap,"%WeakRef%":typeof WeakRef==="undefined"?G:WeakRef,"%WeakSet%":typeof WeakSet==="undefined"?G:WeakSet,"%Function.prototype.call%":c,"%Function.prototype.apply%":b,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":a,"%Math.abs%":X,"%Math.floor%":D,"%Math.max%":W,"%Math.min%":E,"%Math.pow%":P,"%Math.round%":z,"%Math.sign%":C,"%Reflect.getPrototypeOf%":U0};if(j)try{null.error}catch(h){B0["%Error.prototype%"]=j(j(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 L=h("%AsyncGenerator%");if(L&&j)g=j(L.prototype)}return B0[Z0]=g,g},I0={__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=I1(),G0=C5(),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),R0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,N=/\\(\\)?/g,M=function h(Z0){var g=o(Z0,0,1),f=o(Z0,-1);if(g==="%"&&f!=="%")throw new V("invalid intrinsic syntax, expected closing `%`");else if(f==="%"&&g!=="%")throw new V("invalid intrinsic syntax, expected opening `%`");var L=[];return n(Z0,R0,function(p,k,I,q){L[L.length]=I?n(q,N,"$1"):k||p}),L},u=function h(Z0,g){var f=Z0,L;if(G0(I0,f))L=I0[f],f="%"+L[0]+"%";if(G0(B0,f)){var p=B0[f];if(p===T)p=i(f);if(typeof p==="undefined"&&!g)throw new H("intrinsic "+Z0+" exists, but is not available. Please file an issue!");return{alias:L,name:f,value:p}}throw new V("intrinsic "+Z0+" does not exist!")};U.exports=function h(Z0,g){if(typeof Z0!=="string"||Z0.length===0)throw new H("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!=="boolean")throw new H('"allowMissing" argument must be a boolean');if(Y0(/^%?[^%]*%?$/,Z0)===null)throw new V("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var f=M(Z0),L=f.length>0?f[0]:"",p=u("%"+L+"%",g),k=p.name,I=p.value,q=!1,R=p.alias;if(R)L=R[0],y(f,r([0,1],R));for(var _=1,l=!0;_=f.length){var K0=S(I,d);if(l=!!K0,l&&"get"in K0&&!("originalValue"in K0.get))I=K0.get;else I=I[d]}else l=G0(I,d),I=I[d];if(l&&!q)B0[k]=I}}return I}}),EB=L0((B,U)=>{var G=HB(),Y=y6(),Q=Y([G("%String.prototype.indexOf%")]);U.exports=function J(Z,K){var V=G(Z,!!K);if(typeof V==="function"&&Q(Z,".prototype.")>-1)return Y([V]);return V}}),k5=L0((B,U)=>{var G=S6()(),Y=EB()("Object.prototype.toString"),Q=function K(V){if(G&&V&&typeof V==="object"&&Symbol.toStringTag in V)return!1;return Y(V)==="[object Arguments]"},J=function K(V){if(Q(V))return!0;return V!==null&&typeof V==="object"&&"length"in V&&typeof V.length==="number"&&V.length>=0&&Y(V)!=="[object Array]"&&"callee"in V&&Y(V.callee)==="[object Function]"},Z=function(){return Q(arguments)}();Q.isLegacyArguments=J,U.exports=Z?Q:J}),$5=L0((B,U)=>{var G=Object.prototype.toString,Y=Function.prototype.toString,Q=/^\s*(?:function)?\*/,J=S6()(),Z=Object.getPrototypeOf,K=function(){if(!J)return!1;try{return Function("return function*() {}")()}catch(H){}},V;U.exports=function H(O){if(typeof O!=="function")return!1;if(Q.test(Y.call(O)))return!0;if(!J)return G.call(O)==="[object GeneratorFunction]";if(!Z)return!1;if(typeof V==="undefined"){var X=K();V=X?Z(X):!1}return Z(O)===V}}),S5=L0((B,U)=>{var G=Function.prototype.toString,Y=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,Q,J;if(typeof Y==="function"&&typeof Object.defineProperty==="function")try{Q=Object.defineProperty({},"length",{get:function(){throw J}}),J={},Y(function(){throw 42},null,Q)}catch(S){if(S!==J)Y=null}else Y=null;var Z=/^\s*class\b/,K=function S(F){try{var w=G.call(F);return Z.test(w)}catch($){return!1}},V=function S(F){try{if(K(F))return!1;return G.call(F),!0}catch(w){return!1}},H=Object.prototype.toString,O="[object Object]",X="[object Function]",D="[object GeneratorFunction]",W="[object HTMLAllCollection]",E="[object HTML document.all class]",P="[object HTMLCollection]",z=typeof Symbol==="function"&&!!Symbol.toStringTag,C=!(0 in[,]),A=function S(){return!1};if(typeof document==="object"){var v=document.all;if(H.call(v)===H.call(document.all))A=function S(F){if((C||!F)&&(typeof F==="undefined"||typeof F==="object"))try{var w=H.call(F);return(w===W||w===E||w===P||w===O)&&F("")==null}catch($){}return!1}}U.exports=Y?function S(F){if(A(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;try{Y(F,null,Q)}catch(w){if(w!==J)return!1}return!K(F)&&V(F)}:function S(F){if(A(F))return!0;if(!F)return!1;if(typeof F!=="function"&&typeof F!=="object")return!1;if(z)return V(F);if(K(F))return!1;var w=H.call(F);if(w!==X&&w!==D&&!/^\[object HTML/.test(w))return!1;return V(F)}}),b5=L0((B,U)=>{var G=S5(),Y=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,J=function H(O,X,D){for(var W=0,E=O.length;W=3)W=D;if(V(O))J(O,X,W);else if(typeof O==="string")Z(O,X,W);else K(O,X,W)}}),v5=L0((B,U)=>{U.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),y5=L0((B,U)=>{d2();var G=v5(),Y=typeof globalThis==="undefined"?v0:globalThis;U.exports=function Q(){var J=[];for(var Z=0;Z{var G=x1(),Y=MB(),Q=f1(),J=K1();U.exports=function Z(K,V,H){if(!K||typeof K!=="object"&&typeof K!=="function")throw new Q("`obj` must be an object or a function`");if(typeof V!=="string"&&typeof V!=="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 O=arguments.length>3?arguments[3]:null,X=arguments.length>4?arguments[4]:null,D=arguments.length>5?arguments[5]:null,W=arguments.length>6?arguments[6]:!1,E=!!J&&J(K,V);if(G)G(K,V,{configurable:D===null&&E?E.configurable:!D,enumerable:O===null&&E?E.enumerable:!O,value:H,writable:X===null&&E?E.writable:!X});else if(W||!O&&!X&&!D)K[V]=H;else throw new Y("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),f5=L0((B,U)=>{var G=x1(),Y=function Q(){return!!G};Y.hasArrayLengthDefineBug=function Q(){if(!G)return null;try{return G([],"length",{value:1}).length!==1}catch(J){return!0}},U.exports=Y}),x5=L0((B,U)=>{var G=HB(),Y=g5(),Q=f5()(),J=K1(),Z=f1(),K=G("%Math.floor%");U.exports=function V(H,O){if(typeof H!=="function")throw new Z("`fn` is not a function");if(typeof O!=="number"||O<0||O>4294967295||K(O)!==O)throw new Z("`length` must be a positive 32-bit integer");var X=arguments.length>2&&!!arguments[2],D=!0,W=!0;if("length"in H&&J){var E=J(H,"length");if(E&&!E.configurable)D=!1;if(E&&!E.writable)W=!1}if(D||W||!X)if(Q)Y(H,"length",O,!0,!0);else Y(H,"length",O);return H}}),_5=L0((B,U)=>{var G=I1(),Y=v6(),Q=OB();U.exports=function J(){return Q(G,Y,arguments)}}),h5=L0((B,U)=>{var G=x5(),Y=x1(),Q=y6(),J=_5();if(U.exports=function Z(K){var V=Q(arguments),H=K.length-(arguments.length-1);return G(V,1+(H>0?H:0),!0)},Y)Y(U.exports,"apply",{value:J});else U.exports.apply=J}),WB=L0((B,U)=>{d2();var G=b5(),Y=y5(),Q=h5(),J=EB(),Z=K1(),K=FB(),V=J("Object.prototype.toString"),H=S6()(),O=typeof globalThis==="undefined"?v0:globalThis,X=Y(),D=J("String.prototype.slice"),W=J("Array.prototype.indexOf",!0)||function C(A,v){for(var S=0;S-1)return v;if(v!=="Object")return!1;return z(A)}if(!Z)return null;return P(A)}}),u5=L0((B,U)=>{var G=WB();U.exports=function Y(Q){return!!G(Q)}}),d5=L0((B)=>{var U=k5(),G=$5(),Y=WB(),Q=u5();function J(R){return R.call.bind(R)}var Z=typeof BigInt!=="undefined",K=typeof Symbol!=="undefined",V=J(Object.prototype.toString),H=J(Number.prototype.valueOf),O=J(String.prototype.valueOf),X=J(Boolean.prototype.valueOf);if(Z)var D=J(BigInt.prototype.valueOf);if(K)var W=J(Symbol.prototype.valueOf);function E(R,_){if(typeof R!=="object")return!1;try{return _(R),!0}catch(l){return!1}}B.isArgumentsObject=U,B.isGeneratorFunction=G,B.isTypedArray=Q;function P(R){return typeof Promise!=="undefined"&&R instanceof Promise||R!==null&&typeof R==="object"&&typeof R.then==="function"&&typeof R.catch==="function"}B.isPromise=P;function z(R){if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView)return ArrayBuffer.isView(R);return Q(R)||n(R)}B.isArrayBufferView=z;function C(R){return Y(R)==="Uint8Array"}B.isUint8Array=C;function A(R){return Y(R)==="Uint8ClampedArray"}B.isUint8ClampedArray=A;function v(R){return Y(R)==="Uint16Array"}B.isUint16Array=v;function S(R){return Y(R)==="Uint32Array"}B.isUint32Array=S;function F(R){return Y(R)==="Int8Array"}B.isInt8Array=F;function w(R){return Y(R)==="Int16Array"}B.isInt16Array=w;function $(R){return Y(R)==="Int32Array"}B.isInt32Array=$;function x(R){return Y(R)==="Float32Array"}B.isFloat32Array=x;function j(R){return Y(R)==="Float64Array"}B.isFloat64Array=j;function a(R){return Y(R)==="BigInt64Array"}B.isBigInt64Array=a;function U0(R){return Y(R)==="BigUint64Array"}B.isBigUint64Array=U0;function b(R){return V(R)==="[object Map]"}b.working=typeof Map!=="undefined"&&b(new Map);function c(R){if(typeof Map==="undefined")return!1;return b.working?b(R):R instanceof Map}B.isMap=c;function T(R){return V(R)==="[object Set]"}T.working=typeof Set!=="undefined"&&T(new Set);function m(R){if(typeof Set==="undefined")return!1;return T.working?T(R):R instanceof Set}B.isSet=m;function B0(R){return V(R)==="[object WeakMap]"}B0.working=typeof WeakMap!=="undefined"&&B0(new WeakMap);function i(R){if(typeof WeakMap==="undefined")return!1;return B0.working?B0(R):R instanceof WeakMap}B.isWeakMap=i;function I0(R){return V(R)==="[object WeakSet]"}I0.working=typeof WeakSet!=="undefined"&&I0(new WeakSet);function s(R){return I0(R)}B.isWeakSet=s;function G0(R){return V(R)==="[object ArrayBuffer]"}G0.working=typeof ArrayBuffer!=="undefined"&&G0(new ArrayBuffer);function r(R){if(typeof ArrayBuffer==="undefined")return!1;return G0.working?G0(R):R instanceof ArrayBuffer}B.isArrayBuffer=r;function y(R){return V(R)==="[object DataView]"}y.working=typeof ArrayBuffer!=="undefined"&&typeof DataView!=="undefined"&&y(new DataView(new ArrayBuffer(1),0,1));function n(R){if(typeof DataView==="undefined")return!1;return y.working?y(R):R instanceof DataView}B.isDataView=n;var o=typeof SharedArrayBuffer!=="undefined"?SharedArrayBuffer:void 0;function Y0(R){return V(R)==="[object SharedArrayBuffer]"}function R0(R){if(typeof o==="undefined")return!1;if(typeof Y0.working==="undefined")Y0.working=Y0(new o);return Y0.working?Y0(R):R instanceof o}B.isSharedArrayBuffer=R0;function N(R){return V(R)==="[object AsyncFunction]"}B.isAsyncFunction=N;function M(R){return V(R)==="[object Map Iterator]"}B.isMapIterator=M;function u(R){return V(R)==="[object Set Iterator]"}B.isSetIterator=u;function h(R){return V(R)==="[object Generator]"}B.isGeneratorObject=h;function Z0(R){return V(R)==="[object WebAssembly.Module]"}B.isWebAssemblyCompiledModule=Z0;function g(R){return E(R,H)}B.isNumberObject=g;function f(R){return E(R,O)}B.isStringObject=f;function L(R){return E(R,X)}B.isBooleanObject=L;function p(R){return Z&&E(R,D)}B.isBigIntObject=p;function k(R){return K&&E(R,W)}B.isSymbolObject=k;function I(R){return g(R)||f(R)||L(R)||p(R)||k(R)}B.isBoxedPrimitive=I;function q(R){return typeof Uint8Array!=="undefined"&&(r(R)||R0(R))}B.isAnyArrayBuffer=q,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(R){Object.defineProperty(B,R,{enumerable:!1,value:function(){throw new Error(R+" is not supported in userland")}})})}),c5=L0((B,U)=>{U.exports=function G(Y){return Y&&typeof Y==="object"&&typeof Y.copy==="function"&&typeof Y.fill==="function"&&typeof Y.readUInt8==="function"}}),PB=L0((B)=>{E2();var U=Object.getOwnPropertyDescriptors||function y(n){var o=Object.keys(n),Y0={};for(var R0=0;R0=R0)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 M=Y0[o];o=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=K;return O(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 K(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 V(y,n){return y}function H(y){var n={};return y.forEach(function(o,Y0){n[o]=!0}),n}function O(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=O(y,Y0,o);return Y0}var R0=X(y,n);if(R0)return R0;var N=Object.keys(n),M=H(N);if(y.showHidden)N=Object.getOwnPropertyNames(n);if(U0(n)&&(N.indexOf("message")>=0||N.indexOf("description")>=0))return D(n);if(N.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 D(n)}var h="",Z0=!1,g=["{","}"];if(z(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=" "+D(n);if(N.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=W(y,n,o,M,N);else f=N.map(function(L){return E(y,n,o,M,L,Z0)});return y.seen.pop(),P(f,h,g)}function X(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(A(n))return y.stylize("null","null")}function D(y){return"["+Error.prototype.toString.call(y)+"]"}function W(y,n,o,Y0,R0){var N=[];for(var M=0,u=n.length;M-1)if(N)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($(M)){if(N&&R0.match(/^\d+$/))return u;if(M=JSON.stringify(""+R0),M.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))M=M.slice(1,-1),M=y.stylize(M,"name");else M=M.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),M=y.stylize(M,"string")}return M+": "+u}function P(y,n,o){var Y0=0;if(y.reduce(function(R0,N){if(Y0++,N.indexOf(` -`)>=0)Y0++;return R0+N.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=d5();function z(y){return Array.isArray(y)}B.isArray=z;function C(y){return typeof y==="boolean"}B.isBoolean=C;function A(y){return y===null}B.isNull=A;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 w(y){return typeof y==="symbol"}B.isSymbol=w;function $(y){return y===void 0}B.isUndefined=$;function x(y){return j(y)&&T(y)==="[object RegExp]"}B.isRegExp=x,B.types.isRegExp=x;function j(y){return typeof y==="object"&&y!==null}B.isObject=j;function a(y){return j(y)&&T(y)==="[object Date]"}B.isDate=a,B.types.isDate=a;function U0(y){return j(y)&&(T(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==="undefined"}B.isPrimitive=c,B.isBuffer=c5();function T(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=H2(),B._extend=function(y,n){if(!n||!j(n))return y;var o=Object.keys(n),Y0=o.length;while(Y0--)y[o[Y0]]=n[o[Y0]];return y};function I0(y,n){return Object.prototype.hasOwnProperty.call(y,n)}var s=typeof Symbol!=="undefined"?Symbol("util.promisify.custom"):void 0;B.promisify=function y(n){if(typeof n!=="function")throw new TypeError('The "original" argument must be of type Function');if(s&&n[s]){var o=n[s];if(typeof o!=="function")throw new 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,R0,N=new Promise(function(h,Z0){Y0=h,R0=Z0}),M=[];for(var u=0;u{function G(E,P){var z=Object.keys(E);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(E);P&&(C=C.filter(function(A){return Object.getOwnPropertyDescriptor(E,A).enumerable})),z.push.apply(z,C)}return z}function Y(E){for(var P=1;P0)this.tail.next=C;else this.head=C;this.tail=C,++this.length}},{key:"unshift",value:function P(z){var C={data:z,next:this.head};if(this.length===0)this.tail=C;this.head=C,++this.length}},{key:"shift",value:function P(){if(this.length===0)return;var z=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,z}},{key:"clear",value:function P(){this.head=this.tail=null,this.length=0}},{key:"join",value:function P(z){if(this.length===0)return"";var C=this.head,A=""+C.data;while(C=C.next)A+=z+C.data;return A}},{key:"concat",value:function P(z){if(this.length===0)return O.alloc(0);var C=O.allocUnsafe(z>>>0),A=this.head,v=0;while(A)W(A.data,C,v),v+=A.data.length,A=A.next;return C}},{key:"consume",value:function P(z,C){var A;if(zS.length?S.length:z;if(F===S.length)v+=S;else v+=S.slice(0,z);if(z-=F,z===0){if(F===S.length)if(++A,C.next)this.head=C.next;else this.head=this.tail=null;else this.head=C,C.data=S.slice(F);break}++A}return this.length-=A,v}},{key:"_getBuffer",value:function P(z){var C=O.allocUnsafe(z),A=this.head,v=1;A.data.copy(C),z-=A.data.length;while(A=A.next){var S=A.data,F=z>S.length?S.length:z;if(S.copy(C,C.length-z,0,F),z-=F,z===0){if(F===S.length)if(++v,A.next)this.head=A.next;else this.head=this.tail=null;else this.head=A,A.data=S.slice(F);break}++v}return this.length-=v,C}},{key:D,value:function P(z,C){return X(this,Y(Y({},C),{},{depth:0,customInspect:!1}))}}]),E}()}),AB=L0((B,U)=>{E2();function G(V,H){var O=this,X=this._readableState&&this._readableState.destroyed,D=this._writableState&&this._writableState.destroyed;if(X||D){if(H)H(V);else if(V){if(!this._writableState)E0.nextTick(Z,this,V);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,E0.nextTick(Z,this,V)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(V||null,function(W){if(!H&&W)if(!O._writableState)E0.nextTick(Y,O,W);else if(!O._writableState.errorEmitted)O._writableState.errorEmitted=!0,E0.nextTick(Y,O,W);else E0.nextTick(Q,O);else if(H)E0.nextTick(Q,O),H(W);else E0.nextTick(Q,O)}),this}function Y(V,H){Z(V,H),Q(V)}function Q(V){if(V._writableState&&!V._writableState.emitClose)return;if(V._readableState&&!V._readableState.emitClose)return;V.emit("close")}function J(){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(V,H){V.emit("error",H)}function K(V,H){var{_readableState:O,_writableState:X}=V;if(O&&O.autoDestroy||X&&X.autoDestroy)V.destroy(H);else V.emit("error",H)}U.exports={destroy:G,undestroy:J,errorOrDestroy:K}}),c2=L0((B,U)=>{function G(H,O){H.prototype=Object.create(O.prototype),H.prototype.constructor=H,H.__proto__=O}var Y={};function Q(H,O,X){if(!X)X=Error;function D(E,P,z){if(typeof O==="string")return O;else return O(E,P,z)}var W=function(E){G(P,E);function P(z,C,A){return E.call(this,D(z,C,A))||this}return P}(X);W.prototype.name=X.name,W.prototype.code=H,Y[H]=W}function J(H,O){if(Array.isArray(H)){var X=H.length;if(H=H.map(function(D){return String(D)}),X>2)return"one of ".concat(O," ").concat(H.slice(0,X-1).join(", "),", or ")+H[X-1];else if(X===2)return"one of ".concat(O," ").concat(H[0]," or ").concat(H[1]);else return"of ".concat(O," ").concat(H[0])}else return"of ".concat(O," ").concat(String(H))}function Z(H,O,X){return H.substr(!X||X<0?0:+X,O.length)===O}function K(H,O,X){if(X===void 0||X>H.length)X=H.length;return H.substring(X-O.length,X)===O}function V(H,O,X){if(typeof X!=="number")X=0;if(X+O.length>H.length)return!1;else return H.indexOf(O,X)!==-1}Q("ERR_INVALID_OPT_VALUE",function(H,O){return'The value "'+O+'" is invalid for option "'+H+'"'},TypeError),Q("ERR_INVALID_ARG_TYPE",function(H,O,X){var D;if(typeof O==="string"&&Z(O,"not "))D="must not be",O=O.replace(/^not /,"");else D="must be";var W;if(K(H," argument"))W="The ".concat(H," ").concat(D," ").concat(J(O,"type"));else{var E=V(H,".")?"property":"argument";W='The "'.concat(H,'" ').concat(E," ").concat(D," ").concat(J(O,"type"))}return W+=". Received type ".concat(typeof X),W},TypeError),Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Q("ERR_METHOD_NOT_IMPLEMENTED",function(H){return"The "+H+" method is not implemented"}),Q("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Q("ERR_STREAM_DESTROYED",function(H){return"Cannot call "+H+" 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(H){return"Unknown encoding: "+H},TypeError),Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),U.exports.codes=Y}),jB=L0((B,U)=>{var G=c2().codes.ERR_INVALID_OPT_VALUE;function Y(J,Z,K){return J.highWaterMark!=null?J.highWaterMark:Z?J[K]:null}function Q(J,Z,K,V){var H=Y(Z,V,K);if(H!=null){if(!(isFinite(H)&&Math.floor(H)===H)||H<0)throw new G(V?K:"highWaterMark",H);return Math.floor(H)}return J.objectMode?16:16384}U.exports={getHighWaterMark:Q}}),l5=L0((B,U)=>{d2(),U.exports=G;function G(Q,J){if(Y("noDeprecation"))return Q;var Z=!1;function K(){if(!Z){if(Y("throwDeprecation"))throw new Error(J);else if(Y("traceDeprecation"))console.trace(J);else console.warn(J);Z=!0}return Q.apply(this,arguments)}return K}function Y(Q){try{if(!v0.localStorage)return!1}catch(Z){return!1}var J=v0.localStorage[Q];if(J==null)return!1;return String(J).toLowerCase()==="true"}}),NB=L0((B,U)=>{d2(),E2(),U.exports=j;function G(N){var M=this;this.next=null,this.entry=null,this.finish=function(){R0(M,N)}}var Y;j.WritableState=$;var Q={deprecate:l5()},J=VB(),Z=g1().Buffer,K=(typeof v0!=="undefined"?v0:typeof window!=="undefined"?window:typeof self!=="undefined"?self:{}).Uint8Array||function(){};function V(N){return Z.from(N)}function H(N){return Z.isBuffer(N)||N instanceof K}var O=AB(),X=jB().getHighWaterMark,D=c2().codes,W=D.ERR_INVALID_ARG_TYPE,E=D.ERR_METHOD_NOT_IMPLEMENTED,P=D.ERR_MULTIPLE_CALLBACK,z=D.ERR_STREAM_CANNOT_PIPE,C=D.ERR_STREAM_DESTROYED,A=D.ERR_STREAM_NULL_VALUES,v=D.ERR_STREAM_WRITE_AFTER_END,S=D.ERR_UNKNOWN_ENCODING,F=O.errorOrDestroy;H2()(j,J);function w(){}function $(N,M,u){if(Y=Y||u2(),N=N||{},typeof u!=="boolean")u=M instanceof Y;if(this.objectMode=!!N.objectMode,u)this.objectMode=this.objectMode||!!N.writableObjectMode;this.highWaterMark=X(this,N,"writableHighWaterMark",u),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=N.decodeStrings===!1;this.decodeStrings=!h,this.defaultEncoding=N.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Z0){i(M,Z0)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=N.emitClose!==!1,this.autoDestroy=!!N.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new G(this)}$.prototype.getBuffer=function N(){var M=this.bufferedRequest,u=[];while(M)u.push(M),M=M.next;return u},function(){try{Object.defineProperty($.prototype,"buffer",{get:Q.deprecate(function N(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(N){}}();var x;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")x=Function.prototype[Symbol.hasInstance],Object.defineProperty(j,Symbol.hasInstance,{value:function N(M){if(x.call(this,M))return!0;if(this!==j)return!1;return M&&M._writableState instanceof $}});else x=function N(M){return M instanceof this};function j(N){Y=Y||u2();var M=this instanceof Y;if(!M&&!x.call(j,this))return new j(N);if(this._writableState=new $(N,this,M),this.writable=!0,N){if(typeof N.write==="function")this._write=N.write;if(typeof N.writev==="function")this._writev=N.writev;if(typeof N.destroy==="function")this._destroy=N.destroy;if(typeof N.final==="function")this._final=N.final}J.call(this)}j.prototype.pipe=function(){F(this,new z)};function a(N,M){var u=new v;F(N,u),E0.nextTick(M,u)}function U0(N,M,u,h){var Z0;if(u===null)Z0=new A;else if(typeof u!=="string"&&!M.objectMode)Z0=new W("chunk",["string","Buffer"],u);if(Z0)return F(N,Z0),E0.nextTick(h,Z0),!1;return!0}j.prototype.write=function(N,M,u){var h=this._writableState,Z0=!1,g=!h.objectMode&&H(N);if(g&&!Z.isBuffer(N))N=V(N);if(typeof M==="function")u=M,M=null;if(g)M="buffer";else if(!M)M=h.defaultEncoding;if(typeof u!=="function")u=w;if(h.ending)a(this,u);else if(g||U0(this,h,N,u))h.pendingcb++,Z0=c(this,h,g,N,M,u);return Z0},j.prototype.cork=function(){this._writableState.corked++},j.prototype.uncork=function(){var N=this._writableState;if(N.corked){if(N.corked--,!N.writing&&!N.corked&&!N.bufferProcessing&&N.bufferedRequest)G0(this,N)}},j.prototype.setDefaultEncoding=function N(M){if(typeof M==="string")M=M.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((M+"").toLowerCase())>-1))throw new S(M);return this._writableState.defaultEncoding=M,this},Object.defineProperty(j.prototype,"writableBuffer",{enumerable:!1,get:function N(){return this._writableState&&this._writableState.getBuffer()}});function b(N,M,u){if(!N.objectMode&&N.decodeStrings!==!1&&typeof M==="string")M=Z.from(M,u);return M}Object.defineProperty(j.prototype,"writableHighWaterMark",{enumerable:!1,get:function N(){return this._writableState.highWaterMark}});function c(N,M,u,h,Z0,g){if(!u){var f=b(M,h,Z0);if(h!==f)u=!0,Z0="buffer",h=f}var L=M.objectMode?1:h.length;M.length+=L;var p=M.length{E2();var G=Object.keys||function(X){var D=[];for(var W in X)D.push(W);return D};U.exports=V;var Y=zB(),Q=NB();H2()(V,Y);var J=G(Q.prototype);for(var Z=0;Z{var G=g1(),Y=G.Buffer;function Q(Z,K){for(var V in Z)K[V]=Z[V]}if(Y.from&&Y.alloc&&Y.allocUnsafe&&Y.allocUnsafeSlow)U.exports=G;else Q(G,B),B.Buffer=J;function J(Z,K,V){return Y(Z,K,V)}Q(Y,J),J.from=function(Z,K,V){if(typeof Z==="number")throw new TypeError("Argument must not be a number");return Y(Z,K,V)},J.alloc=function(Z,K,V){if(typeof Z!=="number")throw new TypeError("Argument must be a number");var H=Y(Z);if(K!==void 0)if(typeof V==="string")H.fill(K,V);else H.fill(K);else H.fill(0);return H},J.allocUnsafe=function(Z){if(typeof Z!=="number")throw new TypeError("Argument must be a number");return Y(Z)},J.allocUnsafeSlow=function(Z){if(typeof Z!=="number")throw new TypeError("Argument must be a number");return G.SlowBuffer(Z)}}),O6=L0((B)=>{var U=a5().Buffer,G=U.isEncoding||function(A){switch(A=""+A,A&&A.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(A){if(!A)return"utf8";var v;while(!0)switch(A){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 A;default:if(v)return;A=(""+A).toLowerCase(),v=!0}}function Q(A){var v=Y(A);if(typeof v!=="string"&&(U.isEncoding===G||!G(A)))throw new Error("Unknown encoding: "+A);return v||A}B.StringDecoder=J;function J(A){this.encoding=Q(A);var v;switch(this.encoding){case"utf16le":this.text=D,this.end=W,v=4;break;case"utf8":this.fillLast=H,v=4;break;case"base64":this.text=E,this.end=P,v=3;break;default:this.write=z,this.end=C;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=U.allocUnsafe(v)}J.prototype.write=function(A){if(A.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(A),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;if(S>5===6)return 2;else if(A>>4===14)return 3;else if(A>>3===30)return 4;return A>>6===2?-1:-2}function K(A,v,S){var F=v.length-1;if(F=0){if(w>0)A.lastNeed=w-1;return w}if(--F=0){if(w>0)A.lastNeed=w-2;return w}if(--F=0){if(w>0)if(w===2)w=0;else A.lastNeed=w-3;return w}return 0}function V(A,v,S){if((v[0]&192)!==128)return A.lastNeed=0,"�";if(A.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return A.lastNeed=1,"�";if(A.lastNeed>2&&v.length>2){if((v[2]&192)!==128)return A.lastNeed=2,"�"}}}function H(A){var v=this.lastTotal-this.lastNeed,S=V(this,A,v);if(S!==void 0)return S;if(this.lastNeed<=A.length)return A.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);A.copy(this.lastChar,v,0,A.length),this.lastNeed-=A.length}function O(A,v){var S=K(this,A,v);if(!this.lastNeed)return A.toString("utf8",v);this.lastTotal=S;var F=A.length-(S-this.lastNeed);return A.copy(this.lastChar,0,F),A.toString("utf8",v,F)}function X(A){var v=A&&A.length?this.write(A):"";if(this.lastNeed)return v+"�";return v}function D(A,v){if((A.length-v)%2===0){var S=A.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]=A[A.length-2],this.lastChar[1]=A[A.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=A[A.length-1],A.toString("utf16le",v,A.length-1)}function W(A){var v=A&&A.length?this.write(A):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function E(A,v){var S=(A.length-v)%3;if(S===0)return A.toString("base64",v);if(this.lastNeed=3-S,this.lastTotal=3,S===1)this.lastChar[0]=A[A.length-1];else this.lastChar[0]=A[A.length-2],this.lastChar[1]=A[A.length-1];return A.toString("base64",v,A.length-S)}function P(A){var v=A&&A.length?this.write(A):"";if(this.lastNeed)return v+this.lastChar.toString("base64",0,3-this.lastNeed);return v}function z(A){return A.toString(this.encoding)}function C(A){return A&&A.length?this.write(A):""}}),g6=L0((B,U)=>{var G=c2().codes.ERR_STREAM_PREMATURE_CLOSE;function Y(K){var V=!1;return function(){if(V)return;V=!0;for(var H=arguments.length,O=new Array(H),X=0;X{E2();var G;function Y(S,F,w){if(F=Q(F),F in S)Object.defineProperty(S,F,{value:w,enumerable:!0,configurable:!0,writable:!0});else S[F]=w;return S}function Q(S){var F=J(S,"string");return typeof F==="symbol"?F:String(F)}function J(S,F){if(typeof S!=="object"||S===null)return S;var w=S[Symbol.toPrimitive];if(w!==void 0){var $=w.call(S,F||"default");if(typeof $!=="object")return $;throw new TypeError("@@toPrimitive must return a primitive value.")}return(F==="string"?String:Number)(S)}var Z=g6(),K=Symbol("lastResolve"),V=Symbol("lastReject"),H=Symbol("error"),O=Symbol("ended"),X=Symbol("lastPromise"),D=Symbol("handlePromise"),W=Symbol("stream");function E(S,F){return{value:S,done:F}}function P(S){var F=S[K];if(F!==null){var w=S[W].read();if(w!==null)S[X]=null,S[K]=null,S[V]=null,F(E(w,!1))}}function z(S){E0.nextTick(P,S)}function C(S,F){return function(w,$){S.then(function(){if(F[O]){w(E(void 0,!0));return}F[D](w,$)},$)}}var A=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((G={get stream(){return this[W]},next:function S(){var F=this,w=this[H];if(w!==null)return Promise.reject(w);if(this[O])return Promise.resolve(E(void 0,!0));if(this[W].destroyed)return new Promise(function(a,U0){E0.nextTick(function(){if(F[H])U0(F[H]);else a(E(void 0,!0))})});var $=this[X],x;if($)x=new Promise(C($,this));else{var j=this[W].read();if(j!==null)return Promise.resolve(E(j,!1));x=new Promise(this[D])}return this[X]=x,x}},Y(G,Symbol.asyncIterator,function(){return this}),Y(G,"return",function S(){var F=this;return new Promise(function(w,$){F[W].destroy(null,function(x){if(x){$(x);return}w(E(void 0,!0))})})}),G),A);U.exports=function S(F){var w,$=Object.create(v,(w={},Y(w,W,{value:F,writable:!0}),Y(w,K,{value:null,writable:!0}),Y(w,V,{value:null,writable:!0}),Y(w,H,{value:null,writable:!0}),Y(w,O,{value:F._readableState.endEmitted,writable:!0}),Y(w,D,{value:function x(j,a){var U0=$[W].read();if(U0)$[X]=null,$[K]=null,$[V]=null,j(E(U0,!1));else $[K]=j,$[V]=a},writable:!0}),w));return $[X]=null,Z(F,function(x){if(x&&x.code!=="ERR_STREAM_PREMATURE_CLOSE"){var j=$[V];if(j!==null)$[X]=null,$[K]=null,$[V]=null,j(x);$[H]=x;return}var a=$[K];if(a!==null)$[X]=null,$[K]=null,$[V]=null,a(E(void 0,!0));$[O]=!0}),F.on("readable",z.bind(null,$)),$}}),r5=L0((B,U)=>{U.exports=function(){throw new Error("Readable.from is not available in the browser")}}),zB=L0((B,U)=>{d2(),E2(),U.exports=a;var G;a.ReadableState=j,$6().EventEmitter;var Y=function g(f,L){return f.listeners(L).length},Q=VB(),J=g1().Buffer,Z=(typeof v0!=="undefined"?v0:typeof window!=="undefined"?window:typeof self!=="undefined"?self:{}).Uint8Array||function(){};function K(g){return J.from(g)}function V(g){return J.isBuffer(g)||g instanceof Z}var H=PB(),O;if(H&&H.debuglog)O=H.debuglog("stream");else O=function g(){};var X=m5(),D=AB(),W=jB().getHighWaterMark,E=c2().codes,P=E.ERR_INVALID_ARG_TYPE,z=E.ERR_STREAM_PUSH_AFTER_EOF,C=E.ERR_METHOD_NOT_IMPLEMENTED,A=E.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,F;H2()(a,Q);var w=D.errorOrDestroy,$=["error","close","destroy","pause","resume"];function x(g,f,L){if(typeof g.prependListener==="function")return g.prependListener(f,L);if(!g._events||!g._events[f])g.on(f,L);else if(Array.isArray(g._events[f]))g._events[f].unshift(L);else g._events[f]=[L,g._events[f]]}function j(g,f,L){if(G=G||u2(),g=g||{},typeof L!=="boolean")L=f instanceof G;if(this.objectMode=!!g.objectMode,L)this.objectMode=this.objectMode||!!g.readableObjectMode;if(this.highWaterMark=W(this,g,"readableHighWaterMark",L),this.buffer=new X,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=O6().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 j(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 g(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function g(f){if(!this._readableState)return;this._readableState.destroyed=f}}),a.prototype.destroy=D.destroy,a.prototype._undestroy=D.undestroy,a.prototype._destroy=function(g,f){f(g)},a.prototype.push=function(g,f){var L=this._readableState,p;if(!L.objectMode){if(typeof g==="string"){if(f=f||L.defaultEncoding,f!==L.encoding)g=J.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,L,p,k){O("readableAddChunk",f);var I=g._readableState;if(f===null)I.reading=!1,i(g,I);else{var q;if(!k)q=c(I,f);if(q)w(g,q);else if(I.objectMode||f&&f.length>0){if(typeof f!=="string"&&!I.objectMode&&Object.getPrototypeOf(f)!==J.prototype)f=K(f);if(p)if(I.endEmitted)w(g,new A);else b(g,I,f,!0);else if(I.ended)w(g,new z);else if(I.destroyed)return!1;else if(I.reading=!1,I.decoder&&!L)if(f=I.decoder.write(f),I.objectMode||f.length!==0)b(g,I,f,!1);else G0(g,I);else b(g,I,f,!1)}else if(!p)I.reading=!1,G0(g,I)}return!I.ended&&(I.length=T)g=T;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){O("read",g),g=parseInt(g,10);var f=this._readableState,L=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(O("read: emitReadable",f.length,f.ended),f.length===0&&f.ended)u(this);else I0(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(O("need readable",p),f.length===0||f.length-g0)k=M(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(L!==g&&f.ended)u(this)}if(k!==null)this.emit("data",k);return k};function i(g,f){if(O("onEofChunk"),f.ended)return;if(f.decoder){var L=f.decoder.end();if(L&&L.length)f.buffer.push(L),f.length+=f.objectMode?1:L.length}if(f.ended=!0,f.sync)I0(g);else if(f.needReadable=!1,!f.emittedReadable)f.emittedReadable=!0,s(g)}function I0(g){var f=g._readableState;if(O("emitReadable",f.needReadable,f.emittedReadable),f.needReadable=!1,!f.emittedReadable)O("emitReadable",f.flowing),f.emittedReadable=!0,E0.nextTick(s,g)}function s(g){var f=g._readableState;if(O("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,N(g)}function G0(g,f){if(!f.readingMore)f.readingMore=!0,E0.nextTick(r,g,f)}function r(g,f){while(!f.reading&&!f.ended&&(f.length1&&Z0(p.pipes,g)!==-1)&&!_)O("false write response, pause",p.awaitDrain),p.awaitDrain++;L.pause()}}function Q0(F0){if(O("onerror",F0),X0(),g.removeListener("error",Q0),Y(g,"error")===0)w(g,F0)}x(g,"error",Q0);function q0(){g.removeListener("finish",K0),X0()}g.once("close",q0);function K0(){O("onfinish"),g.removeListener("close",q0),X0()}g.once("finish",K0);function X0(){O("unpipe"),L.unpipe(g)}if(g.emit("pipe",L),!p.flowing)O("pipe resume"),L.resume();return g};function y(g){return function f(){var L=g._readableState;if(O("pipeOnDrain",L.awaitDrain),L.awaitDrain)L.awaitDrain--;if(L.awaitDrain===0&&Y(g,"data"))L.flowing=!0,N(g)}}a.prototype.unpipe=function(g){var f=this._readableState,L={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,L);return this}if(!g){var{pipes:p,pipesCount:k}=f;f.pipes=null,f.pipesCount=0,f.flowing=!1;for(var I=0;I0,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,O("on readable",p.length,p.reading),p.length)I0(this);else if(!p.reading)E0.nextTick(o,this)}}return L},a.prototype.addListener=a.prototype.on,a.prototype.removeListener=function(g,f){var L=Q.prototype.removeListener.call(this,g,f);if(g==="readable")E0.nextTick(n,this);return L},a.prototype.removeAllListeners=function(g){var f=Q.prototype.removeAllListeners.apply(this,arguments);if(g==="readable"||g===void 0)E0.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){O("readable nexttick read 0"),g.read(0)}a.prototype.resume=function(){var g=this._readableState;if(!g.flowing)O("resume"),g.flowing=!g.readableListening,Y0(this,g);return g.paused=!1,this};function Y0(g,f){if(!f.resumeScheduled)f.resumeScheduled=!0,E0.nextTick(R0,g,f)}function R0(g,f){if(O("resume",f.reading),!f.reading)g.read(0);if(f.resumeScheduled=!1,g.emit("resume"),N(g),f.flowing&&!f.reading)g.read(0)}a.prototype.pause=function(){if(O("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)O("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState.paused=!0,this};function N(g){var f=g._readableState;O("flow",f.flowing);while(f.flowing&&g.read()!==null);}if(a.prototype.wrap=function(g){var f=this,L=this._readableState,p=!1;g.on("end",function(){if(O("wrapped end"),L.decoder&&!L.ended){var q=L.decoder.end();if(q&&q.length)f.push(q)}f.push(null)}),g.on("data",function(q){if(O("wrapped data"),L.decoder)q=L.decoder.write(q);if(L.objectMode&&(q===null||q===void 0))return;else if(!L.objectMode&&(!q||!q.length))return;if(!f.push(q))p=!0,g.pause()});for(var k in g)if(this[k]===void 0&&typeof g[k]==="function")this[k]=function q(R){return function _(){return g[R].apply(g,arguments)}}(k);for(var I=0;I<$.length;I++)g.on($[I],this.emit.bind(this,$[I]));return this._read=function(q){if(O("wrapped _read",q),p)p=!1,g.resume()},this},typeof Symbol==="function")a.prototype[Symbol.asyncIterator]=function(){if(S===void 0)S=p5();return S(this)};Object.defineProperty(a.prototype,"readableHighWaterMark",{enumerable:!1,get:function g(){return this._readableState.highWaterMark}}),Object.defineProperty(a.prototype,"readableBuffer",{enumerable:!1,get:function g(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(a.prototype,"readableFlowing",{enumerable:!1,get:function g(){return this._readableState.flowing},set:function g(f){if(this._readableState)this._readableState.flowing=f}}),a._fromList=M,Object.defineProperty(a.prototype,"readableLength",{enumerable:!1,get:function g(){return this._readableState.length}});function M(g,f){if(f.length===0)return null;var L;if(f.objectMode)L=f.buffer.shift();else if(!g||g>=f.length){if(f.decoder)L=f.buffer.join("");else if(f.buffer.length===1)L=f.buffer.first();else L=f.buffer.concat(f.length);f.buffer.clear()}else L=f.buffer.consume(g,f.decoder);return L}function u(g){var f=g._readableState;if(O("endReadable",f.endEmitted),!f.endEmitted)f.ended=!0,E0.nextTick(h,f,g)}function h(g,f){if(O("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0){if(g.endEmitted=!0,f.readable=!1,f.emit("end"),g.autoDestroy){var L=f._writableState;if(!L||L.autoDestroy&&L.finished)f.destroy()}}}if(typeof Symbol==="function")a.from=function(g,f){if(F===void 0)F=r5();return F(a,g,f)};function Z0(g,f){for(var L=0,p=g.length;L{U.exports=H;var G=c2().codes,Y=G.ERR_METHOD_NOT_IMPLEMENTED,Q=G.ERR_MULTIPLE_CALLBACK,J=G.ERR_TRANSFORM_ALREADY_TRANSFORMING,Z=G.ERR_TRANSFORM_WITH_LENGTH_0,K=u2();H2()(H,K);function V(D,W){var E=this._transformState;E.transforming=!1;var P=E.writecb;if(P===null)return this.emit("error",new Q);if(E.writechunk=null,E.writecb=null,W!=null)this.push(W);P(D);var z=this._readableState;if(z.reading=!1,z.needReadable||z.length{U.exports=Y;var G=TB();H2()(Y,G);function Y(Q){if(!(this instanceof Y))return new Y(Q);G.call(this,Q)}Y.prototype._transform=function(Q,J,Z){Z(null,Q)}}),n5=L0((B,U)=>{var G;function Y(E){var P=!1;return function(){if(P)return;P=!0,E.apply(void 0,arguments)}}var Q=c2().codes,J=Q.ERR_MISSING_ARGS,Z=Q.ERR_STREAM_DESTROYED;function K(E){if(E)throw E}function V(E){return E.setHeader&&typeof E.abort==="function"}function H(E,P,z,C){C=Y(C);var A=!1;if(E.on("close",function(){A=!0}),G===void 0)G=g6();G(E,{readable:P,writable:z},function(S){if(S)return C(S);A=!0,C()});var v=!1;return function(S){if(A)return;if(v)return;if(v=!0,V(E))return E.abort();if(typeof E.destroy==="function")return E.destroy();C(S||new Z("pipe"))}}function O(E){E()}function X(E,P){return E.pipe(P)}function D(E){if(!E.length)return K;if(typeof E[E.length-1]!=="function")return K;return E.pop()}function W(){for(var E=arguments.length,P=new Array(E),z=0;z0,function($){if(!A)A=$;if($)v.forEach(O);if(w)return;v.forEach(O),C(A)})});return P.reduce(X)}U.exports=W}),f6=L0((B,U)=>{U.exports=Y;var G=$6().EventEmitter;H2()(Y,G),Y.Readable=zB(),Y.Writable=NB(),Y.Duplex=u2(),Y.Transform=TB(),Y.PassThrough=i5(),Y.finished=g6(),Y.pipeline=n5(),Y.Stream=Y;function Y(){G.call(this)}Y.prototype.pipe=function(Q,J){var Z=this;function K(E){if(Q.writable){if(Q.write(E)===!1&&Z.pause)Z.pause()}}Z.on("data",K);function V(){if(Z.readable&&Z.resume)Z.resume()}if(Q.on("drain",V),!Q._isStdio&&(!J||J.end!==!1))Z.on("end",O),Z.on("close",X);var H=!1;function O(){if(H)return;H=!0,Q.end()}function X(){if(H)return;if(H=!0,typeof Q.destroy==="function")Q.destroy()}function D(E){if(W(),G.listenerCount(this,"error")===0)throw E}Z.on("error",D),Q.on("error",D);function W(){Z.removeListener("data",K),Q.removeListener("drain",V),Z.removeListener("end",O),Z.removeListener("close",X),Z.removeListener("error",D),Q.removeListener("error",D),Z.removeListener("end",W),Z.removeListener("close",W),Q.removeListener("close",W)}return Z.on("end",W),Z.on("close",W),Q.on("close",W),Q.emit("pipe",Z),Q}}),s5=L0((B)=>{(function(U){U.parser=function(N,M){return new Y(N,M)},U.SAXParser=Y,U.SAXStream=O,U.createStream=H,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(N,M){if(!(this instanceof Y))return new Y(N,M);var u=this;if(J(u),u.q=u.c="",u.bufferCheckPosition=U.MAX_BUFFER_LENGTH,u.opt=M||{},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=!!N,u.noscript=!!(N||u.opt.noscript),u.state=j.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(P);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(N){function M(){}return M.prototype=N,new M};if(!Object.keys)Object.keys=function(N){var M=[];for(var u in N)if(N.hasOwnProperty(u))M.push(u);return M};function Q(N){var M=Math.max(U.MAX_BUFFER_LENGTH,10),u=0;for(var h=0,Z0=G.length;hM)switch(G[h]){case"textNode":c(N);break;case"cdata":b(N,"oncdata",N.cdata),N.cdata="";break;case"script":b(N,"onscript",N.script),N.script="";break;default:m(N,"Max buffer length exceeded: "+G[h])}u=Math.max(u,g)}N.bufferCheckPosition=U.MAX_BUFFER_LENGTH-u+N.position}function J(N){for(var M=0,u=G.length;M"||S(N)}function $(N,M){return N.test(M)}function x(N,M){return!$(N,M)}var j=0;U.STATE={BEGIN:j++,BEGIN_WHITESPACE:j++,TEXT:j++,TEXT_ENTITY:j++,OPEN_WAKA:j++,SGML_DECL:j++,SGML_DECL_QUOTED:j++,DOCTYPE:j++,DOCTYPE_QUOTED:j++,DOCTYPE_DTD:j++,DOCTYPE_DTD_QUOTED:j++,COMMENT_STARTING:j++,COMMENT:j++,COMMENT_ENDING:j++,COMMENT_ENDED:j++,CDATA:j++,CDATA_ENDING:j++,CDATA_ENDING_2:j++,PROC_INST:j++,PROC_INST_BODY:j++,PROC_INST_ENDING:j++,OPEN_TAG:j++,OPEN_TAG_SLASH:j++,ATTRIB:j++,ATTRIB_NAME:j++,ATTRIB_NAME_SAW_WHITE:j++,ATTRIB_VALUE:j++,ATTRIB_VALUE_QUOTED:j++,ATTRIB_VALUE_CLOSED:j++,ATTRIB_VALUE_UNQUOTED:j++,ATTRIB_VALUE_ENTITY_Q:j++,ATTRIB_VALUE_ENTITY_U:j++,CLOSE_TAG:j++,CLOSE_TAG_SAW_WHITE:j++,SCRIPT:j++,SCRIPT_ENDING:j++},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(N){var M=U.ENTITIES[N],u=typeof M==="number"?String.fromCharCode(M):M;U.ENTITIES[N]=u});for(var a in U.STATE)U.STATE[U.STATE[a]]=a;j=U.STATE;function U0(N,M,u){N[M]&&N[M](u)}function b(N,M,u){if(N.textNode)c(N);U0(N,M,u)}function c(N){if(N.textNode=T(N.opt,N.textNode),N.textNode)U0(N,"ontext",N.textNode);N.textNode=""}function T(N,M){if(N.trim)M=M.trim();if(N.normalize)M=M.replace(/\s+/g," ");return M}function m(N,M){if(c(N),N.trackPosition)M+=` -Line: `+N.line+` -Column: `+N.column+` -Char: `+N.c;return M=new Error(M),N.error=M,U0(N,"onerror",M),N}function B0(N){if(N.sawRoot&&!N.closedRoot)i(N,"Unclosed root tag");if(N.state!==j.BEGIN&&N.state!==j.BEGIN_WHITESPACE&&N.state!==j.TEXT)m(N,"Unexpected end");return c(N),N.c="",N.closed=!0,U0(N,"onend"),Y.call(N,N.strict,N.opt),N}function i(N,M){if(typeof N!=="object"||!(N instanceof Y))throw new Error("bad call to strictFail");if(N.strict)m(N,M)}function I0(N){if(!N.strict)N.tagName=N.tagName[N.looseCase]();var M=N.tags[N.tags.length-1]||N,u=N.tag={name:N.tagName,attributes:{}};if(N.opt.xmlns)u.ns=M.ns;N.attribList.length=0,b(N,"onopentagstart",u)}function s(N,M){var u=N.indexOf(":")<0?["",N]:N.split(":"),h=u[0],Z0=u[1];if(M&&N==="xmlns")h="xmlns",Z0="";return{prefix:h,local:Z0}}function G0(N){if(!N.strict)N.attribName=N.attribName[N.looseCase]();if(N.attribList.indexOf(N.attribName)!==-1||N.tag.attributes.hasOwnProperty(N.attribName)){N.attribName=N.attribValue="";return}if(N.opt.xmlns){var M=s(N.attribName,!0),u=M.prefix,h=M.local;if(u==="xmlns")if(h==="xml"&&N.attribValue!==W)i(N,"xml: prefix must be bound to "+W+` -Actual: `+N.attribValue);else if(h==="xmlns"&&N.attribValue!==E)i(N,"xmlns: prefix must be bound to "+E+` -Actual: `+N.attribValue);else{var Z0=N.tag,g=N.tags[N.tags.length-1]||N;if(Z0.ns===g.ns)Z0.ns=Object.create(g.ns);Z0.ns[h]=N.attribValue}N.attribList.push([N.attribName,N.attribValue])}else N.tag.attributes[N.attribName]=N.attribValue,b(N,"onattribute",{name:N.attribName,value:N.attribValue});N.attribName=N.attribValue=""}function r(N,M){if(N.opt.xmlns){var u=N.tag,h=s(N.tagName);if(u.prefix=h.prefix,u.local=h.local,u.uri=u.ns[h.prefix]||"",u.prefix&&!u.uri)i(N,"Unbound namespace prefix: "+JSON.stringify(N.tagName)),u.uri=h.prefix;var Z0=N.tags[N.tags.length-1]||N;if(u.ns&&Z0.ns!==u.ns)Object.keys(u.ns).forEach(function(d){b(N,"onopennamespace",{prefix:d,uri:u.ns[d]})});for(var g=0,f=N.attribList.length;g",N.tagName="",N.state=j.SCRIPT;return}b(N,"onscript",N.script),N.script=""}var M=N.tags.length,u=N.tagName;if(!N.strict)u=u[N.looseCase]();var h=u;while(M--)if(N.tags[M].name!==h)i(N,"Unexpected close tag");else break;if(M<0){i(N,"Unmatched closing tag: "+N.tagName),N.textNode+="",N.state=j.TEXT;return}N.tagName=u;var Z0=N.tags.length;while(Z0-- >M){var g=N.tag=N.tags.pop();N.tagName=N.tag.name,b(N,"onclosetag",N.tagName);var f={};for(var L in g.ns)f[L]=g.ns[L];var p=N.tags[N.tags.length-1]||N;if(N.opt.xmlns&&g.ns!==p.ns)Object.keys(g.ns).forEach(function(k){var I=g.ns[k];b(N,"onclosenamespace",{prefix:k,uri:I})})}if(M===0)N.closedRoot=!0;N.tagName=N.attribValue=N.attribName="",N.attribList.length=0,N.state=j.TEXT}function n(N){var M=N.entity,u=M.toLowerCase(),h,Z0="";if(N.ENTITIES[M])return N.ENTITIES[M];if(N.ENTITIES[u])return N.ENTITIES[u];if(M=u,M.charAt(0)==="#")if(M.charAt(1)==="x")M=M.slice(2),h=parseInt(M,16),Z0=h.toString(16);else M=M.slice(1),h=parseInt(M,10),Z0=h.toString(10);if(M=M.replace(/^0+/,""),isNaN(h)||Z0.toLowerCase()!==M)return i(N,"Invalid character entity"),"&"+N.entity+";";return String.fromCodePoint(h)}function o(N,M){if(M==="<")N.state=j.OPEN_WAKA,N.startTagPosition=N.position;else if(!S(M))i(N,"Non-whitespace before first tag."),N.textNode=M,N.state=j.TEXT}function Y0(N,M){var u="";if(M")b(M,"onsgmldeclaration",M.sgmlDecl),M.sgmlDecl="",M.state=j.TEXT;else if(F(h))M.state=j.SGML_DECL_QUOTED,M.sgmlDecl+=h;else M.sgmlDecl+=h;continue;case j.SGML_DECL_QUOTED:if(h===M.q)M.state=j.SGML_DECL,M.q="";M.sgmlDecl+=h;continue;case j.DOCTYPE:if(h===">")M.state=j.TEXT,b(M,"ondoctype",M.doctype),M.doctype=!0;else if(M.doctype+=h,h==="[")M.state=j.DOCTYPE_DTD;else if(F(h))M.state=j.DOCTYPE_QUOTED,M.q=h;continue;case j.DOCTYPE_QUOTED:if(M.doctype+=h,h===M.q)M.q="",M.state=j.DOCTYPE;continue;case j.DOCTYPE_DTD:if(M.doctype+=h,h==="]")M.state=j.DOCTYPE;else if(F(h))M.state=j.DOCTYPE_DTD_QUOTED,M.q=h;continue;case j.DOCTYPE_DTD_QUOTED:if(M.doctype+=h,h===M.q)M.state=j.DOCTYPE_DTD,M.q="";continue;case j.COMMENT:if(h==="-")M.state=j.COMMENT_ENDING;else M.comment+=h;continue;case j.COMMENT_ENDING:if(h==="-"){if(M.state=j.COMMENT_ENDED,M.comment=T(M.opt,M.comment),M.comment)b(M,"oncomment",M.comment);M.comment=""}else M.comment+="-"+h,M.state=j.COMMENT;continue;case j.COMMENT_ENDED:if(h!==">")i(M,"Malformed comment"),M.comment+="--"+h,M.state=j.COMMENT;else M.state=j.TEXT;continue;case j.CDATA:if(h==="]")M.state=j.CDATA_ENDING;else M.cdata+=h;continue;case j.CDATA_ENDING:if(h==="]")M.state=j.CDATA_ENDING_2;else M.cdata+="]"+h,M.state=j.CDATA;continue;case j.CDATA_ENDING_2:if(h===">"){if(M.cdata)b(M,"oncdata",M.cdata);b(M,"onclosecdata"),M.cdata="",M.state=j.TEXT}else if(h==="]")M.cdata+="]";else M.cdata+="]]"+h,M.state=j.CDATA;continue;case j.PROC_INST:if(h==="?")M.state=j.PROC_INST_ENDING;else if(S(h))M.state=j.PROC_INST_BODY;else M.procInstName+=h;continue;case j.PROC_INST_BODY:if(!M.procInstBody&&S(h))continue;else if(h==="?")M.state=j.PROC_INST_ENDING;else M.procInstBody+=h;continue;case j.PROC_INST_ENDING:if(h===">")b(M,"onprocessinginstruction",{name:M.procInstName,body:M.procInstBody}),M.procInstName=M.procInstBody="",M.state=j.TEXT;else M.procInstBody+="?"+h,M.state=j.PROC_INST_BODY;continue;case j.OPEN_TAG:if($(C,h))M.tagName+=h;else if(I0(M),h===">")r(M);else if(h==="/")M.state=j.OPEN_TAG_SLASH;else{if(!S(h))i(M,"Invalid character in tag name");M.state=j.ATTRIB}continue;case j.OPEN_TAG_SLASH:if(h===">")r(M,!0),y(M);else i(M,"Forward-slash in opening tag not followed by >"),M.state=j.ATTRIB;continue;case j.ATTRIB:if(S(h))continue;else if(h===">")r(M);else if(h==="/")M.state=j.OPEN_TAG_SLASH;else if($(z,h))M.attribName=h,M.attribValue="",M.state=j.ATTRIB_NAME;else i(M,"Invalid attribute name");continue;case j.ATTRIB_NAME:if(h==="=")M.state=j.ATTRIB_VALUE;else if(h===">")i(M,"Attribute without value"),M.attribValue=M.attribName,G0(M),r(M);else if(S(h))M.state=j.ATTRIB_NAME_SAW_WHITE;else if($(C,h))M.attribName+=h;else i(M,"Invalid attribute name");continue;case j.ATTRIB_NAME_SAW_WHITE:if(h==="=")M.state=j.ATTRIB_VALUE;else if(S(h))continue;else if(i(M,"Attribute without value"),M.tag.attributes[M.attribName]="",M.attribValue="",b(M,"onattribute",{name:M.attribName,value:""}),M.attribName="",h===">")r(M);else if($(z,h))M.attribName=h,M.state=j.ATTRIB_NAME;else i(M,"Invalid attribute name"),M.state=j.ATTRIB;continue;case j.ATTRIB_VALUE:if(S(h))continue;else if(F(h))M.q=h,M.state=j.ATTRIB_VALUE_QUOTED;else i(M,"Unquoted attribute value"),M.state=j.ATTRIB_VALUE_UNQUOTED,M.attribValue=h;continue;case j.ATTRIB_VALUE_QUOTED:if(h!==M.q){if(h==="&")M.state=j.ATTRIB_VALUE_ENTITY_Q;else M.attribValue+=h;continue}G0(M),M.q="",M.state=j.ATTRIB_VALUE_CLOSED;continue;case j.ATTRIB_VALUE_CLOSED:if(S(h))M.state=j.ATTRIB;else if(h===">")r(M);else if(h==="/")M.state=j.OPEN_TAG_SLASH;else if($(z,h))i(M,"No whitespace between attributes"),M.attribName=h,M.attribValue="",M.state=j.ATTRIB_NAME;else i(M,"Invalid attribute name");continue;case j.ATTRIB_VALUE_UNQUOTED:if(!w(h)){if(h==="&")M.state=j.ATTRIB_VALUE_ENTITY_U;else M.attribValue+=h;continue}if(G0(M),h===">")r(M);else M.state=j.ATTRIB;continue;case j.CLOSE_TAG:if(!M.tagName)if(S(h))continue;else if(x(z,h))if(M.script)M.script+="")y(M);else if($(C,h))M.tagName+=h;else if(M.script)M.script+="")y(M);else i(M,"Invalid characters in closing tag");continue;case j.TEXT_ENTITY:case j.ATTRIB_VALUE_ENTITY_Q:case j.ATTRIB_VALUE_ENTITY_U:var f,L;switch(M.state){case j.TEXT_ENTITY:f=j.TEXT,L="textNode";break;case j.ATTRIB_VALUE_ENTITY_Q:f=j.ATTRIB_VALUE_QUOTED,L="attribValue";break;case j.ATTRIB_VALUE_ENTITY_U:f=j.ATTRIB_VALUE_UNQUOTED,L="attribValue";break}if(h===";")M[L]+=n(M),M.entity="",M.state=f;else if($(M.entity.length?v:A,h))M.entity+=h;else i(M,"Invalid character in entity name"),M[L]+="&"+M.entity+h,M.entity="",M.state=f;continue;default:throw new Error(M,"Unknown state: "+M.state)}}if(M.position>=M.bufferCheckPosition)Q(M);return M}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint)(function(){var N=String.fromCharCode,M=Math.floor,u=function(){var h=16384,Z0=[],g,f,L=-1,p=arguments.length;if(!p)return"";var k="";while(++L1114111||M(I)!==I)throw RangeError("Invalid code point: "+I);if(I<=65535)Z0.push(I);else I-=65536,g=(I>>10)+55296,f=I%1024+56320,Z0.push(g,f);if(L+1===p||Z0.length>h)k+=N.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==="undefined"?B.sax={}:B)}),x6=L0((B,U)=>{U.exports={isArray:function(G){if(Array.isArray)return Array.isArray(G);return Object.prototype.toString.call(G)==="[object Array]"}}}),_6=L0((B,U)=>{var G=x6().isArray;U.exports={copyOptions:function(Y){var Q,J={};for(Q in Y)if(Y.hasOwnProperty(Q))J[Q]=Y[Q];return J},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}}}),DB=L0((B,U)=>{var G=s5(),Y={on:function(){},parse:function(){}},Q=_6(),J=x6().isArray,Z,K=!0,V;function H(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 O(F){var w=Number(F);if(!isNaN(w))return w;var $=F.toLowerCase();if($==="true")return!0;else if($==="false")return!1;return F}function X(F,w){var $;if(Z.compact){if(!V[Z[F+"Key"]]&&(J(Z.alwaysArray)?Z.alwaysArray.indexOf(Z[F+"Key"])!==-1:Z.alwaysArray))V[Z[F+"Key"]]=[];if(V[Z[F+"Key"]]&&!J(V[Z[F+"Key"]]))V[Z[F+"Key"]]=[V[Z[F+"Key"]]];if(F+"Fn"in Z&&typeof w==="string")w=Z[F+"Fn"](w,V);if(F==="instruction"&&(("instructionFn"in Z)||("instructionNameFn"in Z))){for($ in w)if(w.hasOwnProperty($))if("instructionFn"in Z)w[$]=Z.instructionFn(w[$],$,V);else{var x=w[$];delete w[$],w[Z.instructionNameFn($,x,V)]=x}}if(J(V[Z[F+"Key"]]))V[Z[F+"Key"]].push(w);else V[Z[F+"Key"]]=w}else{if(!V[Z.elementsKey])V[Z.elementsKey]=[];var j={};if(j[Z.typeKey]=F,F==="instruction"){for($ in w)if(w.hasOwnProperty($))break;if(j[Z.nameKey]="instructionNameFn"in Z?Z.instructionNameFn($,w,V):$,Z.instructionHasAttributes){if(j[Z.attributesKey]=w[$][Z.attributesKey],"instructionFn"in Z)j[Z.attributesKey]=Z.instructionFn(j[Z.attributesKey],$,V)}else{if("instructionFn"in Z)w[$]=Z.instructionFn(w[$],$,V);j[Z.instructionKey]=w[$]}}else{if(F+"Fn"in Z)w=Z[F+"Fn"](w,V);j[Z[F+"Key"]]=w}if(Z.addParent)j[Z.parentKey]=V;V[Z.elementsKey].push(j)}}function D(F){if("attributesFn"in Z&&F)F=Z.attributesFn(F,V);if((Z.trim||("attributeValueFn"in Z)||("attributeNameFn"in Z)||Z.nativeTypeAttributes)&&F){var w;for(w in F)if(F.hasOwnProperty(w)){if(Z.trim)F[w]=F[w].trim();if(Z.nativeTypeAttributes)F[w]=O(F[w]);if("attributeValueFn"in Z)F[w]=Z.attributeValueFn(F[w],w,V);if("attributeNameFn"in Z){var $=F[w];delete F[w],F[Z.attributeNameFn(w,F[w],V)]=$}}}return F}function W(F){var w={};if(F.body&&(F.name.toLowerCase()==="xml"||Z.instructionHasAttributes)){var $=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,x;while((x=$.exec(F.body))!==null)w[x[1]]=x[2]||x[3]||x[4];w=D(w)}if(F.name.toLowerCase()==="xml"){if(Z.ignoreDeclaration)return;if(V[Z.declarationKey]={},Object.keys(w).length)V[Z.declarationKey][Z.attributesKey]=w;if(Z.addParent)V[Z.declarationKey][Z.parentKey]=V}else{if(Z.ignoreInstruction)return;if(Z.trim)F.body=F.body.trim();var j={};if(Z.instructionHasAttributes&&Object.keys(w).length)j[F.name]={},j[F.name][Z.attributesKey]=w;else j[F.name]=F.body;X("instruction",j)}}function E(F,w){var $;if(typeof F==="object")w=F.attributes,F=F.name;if(w=D(w),"elementNameFn"in Z)F=Z.elementNameFn(F,V);if(Z.compact){if($={},!Z.ignoreAttributes&&w&&Object.keys(w).length){$[Z.attributesKey]={};var x;for(x in w)if(w.hasOwnProperty(x))$[Z.attributesKey][x]=w[x]}if(!(F in V)&&(J(Z.alwaysArray)?Z.alwaysArray.indexOf(F)!==-1:Z.alwaysArray))V[F]=[];if(V[F]&&!J(V[F]))V[F]=[V[F]];if(J(V[F]))V[F].push($);else V[F]=$}else{if(!V[Z.elementsKey])V[Z.elementsKey]=[];if($={},$[Z.typeKey]="element",$[Z.nameKey]=F,!Z.ignoreAttributes&&w&&Object.keys(w).length)$[Z.attributesKey]=w;if(Z.alwaysChildren)$[Z.elementsKey]=[];V[Z.elementsKey].push($)}$[Z.parentKey]=V,V=$}function P(F){if(Z.ignoreText)return;if(!F.trim()&&!Z.captureSpacesBetweenElements)return;if(Z.trim)F=F.trim();if(Z.nativeType)F=O(F);if(Z.sanitize)F=F.replace(/&/g,"&").replace(//g,">");X("text",F)}function z(F){if(Z.ignoreComment)return;if(Z.trim)F=F.trim();X("comment",F)}function C(F){var w=V[Z.parentKey];if(!Z.addParent)delete V[Z.parentKey];V=w}function A(F){if(Z.ignoreCdata)return;if(Z.trim)F=F.trim();X("cdata",F)}function v(F){if(Z.ignoreDoctype)return;if(F=F.replace(/^ /,""),Z.trim)F=F.trim();X("doctype",F)}function S(F){F.note=F}U.exports=function(F,w){var $=K?G.parser(!0,{}):$=new Y.Parser("UTF-8"),x={};if(V=x,Z=H(w),K)$.opt={strictEntities:!0},$.onopentag=E,$.ontext=P,$.oncomment=z,$.onclosetag=C,$.onerror=S,$.oncdata=A,$.ondoctype=v,$.onprocessinginstruction=W;else $.on("startElement",E),$.on("text",P),$.on("comment",z),$.on("endElement",C),$.on("error",S);if(K)$.write(F).close();else if(!$.parse(F))throw new Error("XML parsing error: "+$.getError());if(x[Z.elementsKey]){var j=x[Z.elementsKey];delete x[Z.elementsKey],x[Z.elementsKey]=j,delete x.text}return x}}),o5=L0((B,U)=>{var G=_6(),Y=DB();function Q(J){var Z=G.copyOptions(J);return G.ensureSpacesExists(Z),Z}U.exports=function(J,Z){var K=Q(Z),V=Y(J,K),H,O="compact"in K&&K.compact?"_parent":"parent";if("addParent"in K&&K.addParent)H=JSON.stringify(V,function(X,D){return X===O?"_":D},K.spaces);else H=JSON.stringify(V,null,K.spaces);return H.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}}),CB=L0((B,U)=>{var G=_6(),Y=x6().isArray,Q,J;function Z(F){var w=G.copyOptions(F);if(G.ensureFlagExists("ignoreDeclaration",w),G.ensureFlagExists("ignoreInstruction",w),G.ensureFlagExists("ignoreAttributes",w),G.ensureFlagExists("ignoreText",w),G.ensureFlagExists("ignoreComment",w),G.ensureFlagExists("ignoreCdata",w),G.ensureFlagExists("ignoreDoctype",w),G.ensureFlagExists("compact",w),G.ensureFlagExists("indentText",w),G.ensureFlagExists("indentCdata",w),G.ensureFlagExists("indentAttributes",w),G.ensureFlagExists("indentInstruction",w),G.ensureFlagExists("fullTagEmptyElement",w),G.ensureFlagExists("noQuotesForNativeAttributes",w),G.ensureSpacesExists(w),typeof w.spaces==="number")w.spaces=Array(w.spaces+1).join(" ");return G.ensureKeyExists("declaration",w),G.ensureKeyExists("instruction",w),G.ensureKeyExists("attributes",w),G.ensureKeyExists("text",w),G.ensureKeyExists("comment",w),G.ensureKeyExists("cdata",w),G.ensureKeyExists("doctype",w),G.ensureKeyExists("type",w),G.ensureKeyExists("name",w),G.ensureKeyExists("elements",w),G.checkFnExists("doctype",w),G.checkFnExists("instruction",w),G.checkFnExists("cdata",w),G.checkFnExists("comment",w),G.checkFnExists("text",w),G.checkFnExists("instructionName",w),G.checkFnExists("elementName",w),G.checkFnExists("attributeName",w),G.checkFnExists("attributeValue",w),G.checkFnExists("attributes",w),G.checkFnExists("fullTagEmptyElement",w),w}function K(F,w,$){return(!$&&F.spaces?` -`:"")+Array(w+1).join(F.spaces)}function V(F,w,$){if(w.ignoreAttributes)return"";if("attributesFn"in w)F=w.attributesFn(F,J,Q);var x,j,a,U0,b=[];for(x in F)if(F.hasOwnProperty(x)&&F[x]!==null&&F[x]!==void 0)U0=w.noQuotesForNativeAttributes&&typeof F[x]!=="string"?"":'"',j=""+F[x],j=j.replace(/"/g,"""),a="attributeNameFn"in w?w.attributeNameFn(x,j,J,Q):x,b.push(w.spaces&&w.indentAttributes?K(w,$+1,!1):" "),b.push(a+"="+U0+("attributeValueFn"in w?w.attributeValueFn(j,x,J,Q):j)+U0);if(F&&Object.keys(F).length&&w.spaces&&w.indentAttributes)b.push(K(w,$,!1));return b.join("")}function H(F,w,$){return Q=F,J="xml",w.ignoreDeclaration?"":""}function O(F,w,$){if(w.ignoreInstruction)return"";var x;for(x in F)if(F.hasOwnProperty(x))break;var j="instructionNameFn"in w?w.instructionNameFn(x,F[x],J,Q):x;if(typeof F[x]==="object")return Q=F,J=j,"";else{var a=F[x]?F[x]:"";if("instructionFn"in w)a=w.instructionFn(a,x,J,Q);return""}}function X(F,w){return w.ignoreComment?"":""}function D(F,w){return w.ignoreCdata?"":"","]]]]>"))+"]]>"}function W(F,w){return w.ignoreDoctype?"":""}function E(F,w){if(w.ignoreText)return"";return F=""+F,F=F.replace(/&/g,"&"),F=F.replace(/&/g,"&").replace(//g,">"),"textFn"in w?w.textFn(F,J,Q):F}function P(F,w){var $;if(F.elements&&F.elements.length)for($=0;$"),F[w.elementsKey]&&F[w.elementsKey].length)x.push(C(F[w.elementsKey],w,$+1)),Q=F,J=F.name;x.push(w.spaces&&P(F,w)?` -`+Array($+1).join(w.spaces):""),x.push("")}else x.push("/>");return x.join("")}function C(F,w,$,x){return F.reduce(function(j,a){var U0=K(w,$,x&&!j);switch(a.type){case"element":return j+U0+z(a,w,$);case"comment":return j+U0+X(a[w.commentKey],w);case"doctype":return j+U0+W(a[w.doctypeKey],w);case"cdata":return j+(w.indentCdata?U0:"")+D(a[w.cdataKey],w);case"text":return j+(w.indentText?U0:"")+E(a[w.textKey],w);case"instruction":var b={};return b[a[w.nameKey]]=a[w.attributesKey]?a:a[w.instructionKey],j+(w.indentInstruction?U0:"")+O(b,w,$)}},"")}function A(F,w,$){var x;for(x in F)if(F.hasOwnProperty(x))switch(x){case w.parentKey:case w.attributesKey:break;case w.textKey:if(w.indentText||$)return!0;break;case w.cdataKey:if(w.indentCdata||$)return!0;break;case w.instructionKey:if(w.indentInstruction||$)return!0;break;case w.doctypeKey:case w.commentKey:return!0;default:return!0}return!1}function v(F,w,$,x,j){Q=F,J=w;var a="elementNameFn"in $?$.elementNameFn(w,F):w;if(typeof F==="undefined"||F===null||F==="")return"fullTagEmptyElementFn"in $&&$.fullTagEmptyElementFn(w,F)||$.fullTagEmptyElement?"<"+a+">":"<"+a+"/>";var U0=[];if(w){if(U0.push("<"+a),typeof F!=="object")return U0.push(">"+E(F,$)+""),U0.join("");if(F[$.attributesKey])U0.push(V(F[$.attributesKey],$,x));var b=A(F,$,!0)||F[$.attributesKey]&&F[$.attributesKey]["xml:space"]==="preserve";if(!b)if("fullTagEmptyElementFn"in $)b=$.fullTagEmptyElementFn(w,F);else b=$.fullTagEmptyElement;if(b)U0.push(">");else return U0.push("/>"),U0.join("")}if(U0.push(S(F,$,x+1,!1)),Q=F,J=w,w)U0.push((j?K($,x,!1):"")+"");return U0.join("")}function S(F,w,$,x){var j,a,U0,b=[];for(a in F)if(F.hasOwnProperty(a)){U0=Y(F[a])?F[a]:[F[a]];for(j=0;j{var G=CB();U.exports=function(Y,Q){if(Y instanceof Buffer)Y=Y.toString();var J=null;if(typeof Y==="string")try{J=JSON.parse(Y)}catch(Z){throw new Error("The JSON structure is invalid")}else J=Y;return G(J,Q)}}),_1=L0((B,U)=>{U.exports={xml2js:DB(),xml2json:o5(),js2xml:CB(),json2xml:t5()}})(),h1=(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=h1(Y);if(Q!==void 0)U.push(Q)}return U;case"text":return B.text;default:return}},e5=class extends O0{},kB=class extends t{static fromXmlString(B){return h1(_1.xml2js(B,{compact:!1}))}constructor(B,U){super(B);if(U)this.root.push(new e5(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}}},BG="",h6=class extends t{constructor(B,U){super(B);if(U)this.root=U.root}},D0=(B)=>{if(isNaN(B))throw new Error(`Invalid value '${B}' specified. Must be an integer.`);return Math.floor(B)},q1=(B)=>{let U=D0(B);if(U<0)throw new Error(`Invalid value '${B}' specified. Must be a positive integer.`);return U},u1=(B,U)=>{let G=U*2;if(B.length!==G||isNaN(Number(`0x${B}`)))throw new Error(`Invalid hex value '${B}'. Expected ${G} digit hex value`);return B},UG=(B)=>u1(B,4),SB=(B)=>u1(B,2),F6=(B)=>u1(B,1),V1=(B)=>{let U=B.slice(-2),G=B.substring(0,B.length-2);return`${Number(G)}${U}`},u6=(B)=>{let U=V1(B);if(parseFloat(U)<0)throw new Error(`Invalid value '${U}' specified. Expected a positive number.`);return U},C2=(B)=>{if(B==="auto")return B;return u1(B.charAt(0)==="#"?B.substring(1):B,3)},t0=(B)=>typeof B==="string"?V1(B):D0(B),bB=(B)=>typeof B==="string"?u6(B):q1(B),GG=(B)=>typeof B==="string"?V1(B):D0(B),z0=(B)=>typeof B==="string"?u6(B):q1(B),vB=(B)=>{let U=B.substring(0,B.length-1);return`${Number(U)}%`},d6=(B)=>{if(typeof B==="number")return D0(B);if(B.slice(-1)==="%")return vB(B);return V1(B)},yB=q1,gB=q1,fB=(B)=>B.toISOString(),V0=class extends t{constructor(B,U=!0){super(B);if(U!==!0)this.root.push(new C0({val:U}))}},z1=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:bB(U)}))}},S0=class extends t{},V2=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},f2=(B,U)=>new w0({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}))}},YG=class extends t{constructor(B,U){super(B);this.root.push(new C0({val:U}))}},R2=class extends t{constructor(B,U){super(B);this.root.push(U)}},w0=class extends t{constructor({name:B,attributes:U,children:G}){super(B);if(U)this.root.push(new k6(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"},c6=(B)=>new w0({name:"w:jc",attributes:{val:{key:"w:val",value:B}}}),P0=(B,{color:U,size:G,space:Y,style:Q})=>new w0({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)}}}),d1={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 L2{constructor(B){super("w:pBdr");if(B.top)this.root.push(P0("w:top",B.top));if(B.bottom)this.root.push(P0("w:bottom",B.bottom));if(B.left)this.root.push(P0("w:left",B.left));if(B.right)this.root.push(P0("w:right",B.right));if(B.between)this.root.push(P0("w:between",B.between))}},_B=class extends t{constructor(){super("w:pBdr");let B=P0("w:bottom",{color:"auto",space:1,style:d1.SINGLE,size:6});this.root.push(B)}},hB=({start:B,end:U,left:G,right:Y,hanging:Q,firstLine:J,firstLineChars:Z})=>new w0({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:z0(Q)},firstLine:{key:"w:firstLine",value:J===void 0?void 0:z0(J)},firstLineChars:{key:"w:firstLineChars",value:Z===void 0?void 0:D0(Z)}}}),uB=()=>new w0({name:"w:br"}),m6={BEGIN:"begin",END:"end",SEPARATE:"separate"},l6=(B,U)=>new w0({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:B},dirty:{key:"w:dirty",value:U}}}),e0=(B)=>l6(m6.BEGIN,B),q2=(B)=>l6(m6.SEPARATE,B),B2=(B)=>l6(m6.END,B),ZG={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},QG={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},JG={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 O0{constructor(...B){super(...B);e(this,"xmlKeys",{space:"xml:space"})}},KG=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")}},qG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTIONPAGES")}},VG=class extends t{constructor(){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("SECTION")}},w1=({fill:B,color:U,type:G})=>new w0({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}}}),wG={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 O0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},LG=class extends t{constructor(B){super("w:del");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},MG=class extends t{constructor(B){super("w:ins");this.root.push(new b0({id:B.id,author:B.author,date:B.date}))}},a6={DOT:"dot"},p6=(B=a6.DOT)=>new w0({name:"w:em",attributes:{val:{key:"w:val",value:B}}}),XG=()=>p6(a6.DOT),RG=class extends t{constructor(B){super("w:spacing");this.root.push(new C0({val:t0(B)}))}},OG=class extends t{constructor(B){super("w:color");this.root.push(new C0({val:C2(B)}))}},FG=class extends t{constructor(B){super("w:highlight");this.root.push(new C0({val:B}))}},HG=class extends t{constructor(B){super("w:highlightCs");this.root.push(new C0({val:B}))}},EG=(B)=>new w0({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 w0({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 w0({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 w0({name:"w:vertAlign",attributes:{val:{key:"w:val",value:B}}}),WG=()=>dB("superscript"),PG=()=>dB("subscript"),r6={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=r6.SINGLE,U)=>new w0({name:"w:u",attributes:{val:{key:"w:val",value:B},color:{key:"w:color",value:U===void 0?void 0:C2(U)}}}),AG={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},jG={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 L2{constructor(B){super("w:rPr");if(!B)return;if(B.style)this.push(new V2("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 V0("w:b",B.bold));if(B.boldComplexScript===void 0&&B.bold!==void 0||B.boldComplexScript){var U;this.push(new V0("w:bCs",(U=B.boldComplexScript)!==null&&U!==void 0?U:B.bold))}if(B.italics!==void 0)this.push(new V0("w:i",B.italics));if(B.italicsComplexScript===void 0&&B.italics!==void 0||B.italicsComplexScript){var G;this.push(new V0("w:iCs",(G=B.italicsComplexScript)!==null&&G!==void 0?G:B.italics))}if(B.smallCaps!==void 0)this.push(new V0("w:smallCaps",B.smallCaps));else if(B.allCaps!==void 0)this.push(new V0("w:caps",B.allCaps));if(B.strike!==void 0)this.push(new V0("w:strike",B.strike));if(B.doubleStrike!==void 0)this.push(new V0("w:dstrike",B.doubleStrike));if(B.emboss!==void 0)this.push(new V0("w:emboss",B.emboss));if(B.imprint!==void 0)this.push(new V0("w:imprint",B.imprint));if(B.noProof!==void 0)this.push(new V0("w:noProof",B.noProof));if(B.snapToGrid!==void 0)this.push(new V0("w:snapToGrid",B.snapToGrid));if(B.vanish)this.push(new V0("w:vanish",B.vanish));if(B.color)this.push(new OG(B.color));if(B.characterSpacing)this.push(new RG(B.characterSpacing));if(B.scale!==void 0)this.push(new _2("w:w",B.scale));if(B.kern)this.push(new z1("w:kern",B.kern));if(B.position)this.push(new V2("w:position",B.position));if(B.size!==void 0)this.push(new z1("w:sz",B.size));let Y=B.sizeComplexScript===void 0||B.sizeComplexScript===!0?B.size:B.sizeComplexScript;if(Y)this.push(new z1("w:szCs",Y));if(B.highlight)this.push(new FG(B.highlight));let Q=B.highlightComplexScript===void 0||B.highlightComplexScript===!0?B.highlight:B.highlightComplexScript;if(Q)this.push(new HG(Q));if(B.underline)this.push(cB(B.underline.type,B.underline.color));if(B.effect)this.push(new V2("w:effect",B.effect));if(B.border)this.push(P0("w:bdr",B.border));if(B.shading)this.push(w1(B.shading));if(B.subScript)this.push(PG());if(B.superScript)this.push(WG());if(B.rightToLeft!==void 0)this.push(new V0("w:rtl",B.rightToLeft));if(B.emphasisMark)this.push(p6(B.emphasisMark.type));if(B.language)this.push(EG(B.language));if(B.specVanish)this.push(new V0("w:specVanish",B.vanish));if(B.math)this.push(new V0("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 MG(B.insertion));if(B===null||B===void 0?void 0:B.deletion)this.push(new LG(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"},T0=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 new Error(Q||"Assertion failed")}G.equal=function Y(Q,J,Z){if(Q!=J)throw new Error(Z||"Assertion failed: "+Q+" != "+J)}}),G2=L0((B)=>{var U=L1();B.inherits=H2();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 T=[];if(typeof b==="string"){if(!c){var m=0;for(var B0=0;B0>6|192,T[m++]=i&63|128;else if(G(b,B0))i=65536+((i&1023)<<10)+(b.charCodeAt(++B0)&1023),T[m++]=i>>18|240,T[m++]=i>>12&63|128,T[m++]=i>>6&63|128,T[m++]=i&63|128;else T[m++]=i>>12|224,T[m++]=i>>6&63|128,T[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=J;function Z(b,c){var T="";for(var m=0;m>>0}return i}B.join32=H;function O(b,c){var T=new Array(b.length*4);for(var m=0,B0=0;m>>24,T[B0+1]=i>>>16&255,T[B0+2]=i>>>8&255,T[B0+3]=i&255;else T[B0+3]=i>>>24,T[B0+2]=i>>>16&255,T[B0+1]=i>>>8&255,T[B0]=i&255}return T}B.split32=O;function X(b,c){return b>>>c|b<<32-c}B.rotr32=X;function D(b,c){return b<>>32-c}B.rotl32=D;function W(b,c){return b+c>>>0}B.sum32=W;function E(b,c,T){return b+c+T>>>0}B.sum32_3=E;function P(b,c,T,m){return b+c+T+m>>>0}B.sum32_4=P;function z(b,c,T,m,B0){return b+c+T+m+B0>>>0}B.sum32_5=z;function C(b,c,T,m){var B0=b[c],i=m+b[c+1]>>>0;b[c]=(i>>0,b[c+1]=i}B.sum64=C;function A(b,c,T,m){return(c+m>>>0>>0}B.sum64_hi=A;function v(b,c,T,m){return c+m>>>0}B.sum64_lo=v;function S(b,c,T,m,B0,i,I0,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,T,m,B0,i,I0,s){return c+m+i+s>>>0}B.sum64_4_lo=F;function w(b,c,T,m,B0,i,I0,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=w;function $(b,c,T,m,B0,i,I0,s,G0,r){return c+m+i+s+r>>>0}B.sum64_5_lo=$;function x(b,c,T){return(c<<32-T|b>>>T)>>>0}B.rotr64_hi=x;function j(b,c,T){return(b<<32-T|c>>>T)>>>0}B.rotr64_lo=j;function a(b,c,T){return b>>>T}B.shr64_hi=a;function U0(b,c,T){return(b<<32-T|c>>>T)>>>0}B.shr64_lo=U0}),M1=L0((B)=>{var U=G2(),G=L1();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 Q(J,Z){if(J=U.toArray(J,Z),!this.pending)this.pending=J;else this.pending=this.pending.concat(J);if(this.pendingTotal+=J.length,this.pending.length>=this._delta8){J=this.pending;var K=J.length%this._delta8;if(this.pending=J.slice(J.length-K,J.length),this.pending.length===0)this.pending=null;J=U.join32(J,0,J.length-K,this.endian);for(var V=0;V>>24&255,V[H++]=J>>>16&255,V[H++]=J>>>8&255,V[H++]=J&255}else{V[H++]=J&255,V[H++]=J>>>8&255,V[H++]=J>>>16&255,V[H++]=J>>>24&255,V[H++]=0,V[H++]=0,V[H++]=0,V[H++]=0;for(O=8;O{var U=G2().rotr32;function G(O,X,D,W){if(O===0)return Y(X,D,W);if(O===1||O===3)return J(X,D,W);if(O===2)return Q(X,D,W)}B.ft_1=G;function Y(O,X,D){return O&X^~O&D}B.ch32=Y;function Q(O,X,D){return O&X^O&D^X&D}B.maj32=Q;function J(O,X,D){return O^X^D}B.p32=J;function Z(O){return U(O,2)^U(O,13)^U(O,22)}B.s0_256=Z;function K(O){return U(O,6)^U(O,11)^U(O,25)}B.s1_256=K;function V(O){return U(O,7)^U(O,18)^O>>>3}B.g0_256=V;function H(O){return U(O,17)^U(O,19)^O>>>10}B.g1_256=H}),zG=L0((B,U)=>{var G=G2(),Y=M1(),Q=pB(),J=G.rotl32,Z=G.sum32,K=G.sum32_5,V=Q.ft_1,H=Y.BlockHash,O=[1518500249,1859775393,2400959708,3395469782];function X(){if(!(this instanceof X))return new X;H.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}G.inherits(X,H),U.exports=X,X.blockSize=512,X.outSize=160,X.hmacStrength=80,X.padLength=64,X.prototype._update=function D(W,E){var P=this.W;for(var z=0;z<16;z++)P[z]=W[E+z];for(;z{var G=G2(),Y=M1(),Q=pB(),J=L1(),Z=G.sum32,K=G.sum32_4,V=G.sum32_5,H=Q.ch32,O=Q.maj32,X=Q.s0_256,D=Q.s1_256,W=Q.g0_256,E=Q.g1_256,P=Y.BlockHash,z=[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;P.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=z,this.W=new Array(64)}G.inherits(C,P),U.exports=C,C.blockSize=512,C.outSize=256,C.hmacStrength=192,C.padLength=64,C.prototype._update=function A(v,S){var F=this.W;for(var w=0;w<16;w++)F[w]=v[S+w];for(;w{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 J(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,7),"big");else return G.split32(this.h.slice(0,7),"big")}}),iB=L0((B,U)=>{var G=G2(),Y=M1(),Q=L1(),J=G.rotr64_hi,Z=G.rotr64_lo,K=G.shr64_hi,V=G.shr64_lo,H=G.sum64,O=G.sum64_hi,X=G.sum64_lo,D=G.sum64_4_hi,W=G.sum64_4_lo,E=G.sum64_5_hi,P=G.sum64_5_lo,z=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 A(){if(!(this instanceof A))return new A;z.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=new Array(160)}G.inherits(A,z),U.exports=A,A.blockSize=1024,A.outSize=512,A.hmacStrength=192,A.padLength=128,A.prototype._prepareBlock=function m(B0,i){var I0=this.W;for(var s=0;s<32;s++)I0[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 J(Z){if(Z==="hex")return G.toHex32(this.h.slice(0,12),"big");else return G.split32(this.h.slice(0,12),"big")}}),CG=L0((B)=>{B.sha1=zG(),B.sha224=TG(),B.sha256=rB(),B.sha384=DG(),B.sha512=iB()}),kG=L0((B)=>{var U=G2(),G=M1(),Y=U.rotl32,Q=U.sum32,J=U.sum32_3,Z=U.sum32_4,K=G.BlockHash;function V(){if(!(this instanceof V))return new V;K.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}U.inherits(V,K),B.ripemd160=V,V.blockSize=512,V.outSize=160,V.hmacStrength=192,V.padLength=64,V.prototype._update=function z(C,A){var v=this.h[0],S=this.h[1],F=this.h[2],w=this.h[3],$=this.h[4],x=v,j=S,a=F,U0=w,b=$;for(var c=0;c<80;c++){var T=Q(Y(Z(v,H(c,S,F,w),C[D[c]+A],O(c)),E[c]),$);v=$,$=w,w=Y(F,10),F=S,S=T,T=Q(Y(Z(x,H(79-c,j,a,U0),C[W[c]+A],X(c)),P[c]),b),x=b,b=U0,U0=Y(a,10),a=j,j=T}T=J(this.h[1],F,U0),this.h[1]=J(this.h[2],w,b),this.h[2]=J(this.h[3],$,x),this.h[3]=J(this.h[4],v,j),this.h[4]=J(this.h[0],S,a),this.h[0]=T},V.prototype._digest=function z(C){if(C==="hex")return U.toHex32(this.h,"little");else return U.split32(this.h,"little")};function H(z,C,A,v){if(z<=15)return C^A^v;else if(z<=31)return C&A|~C&v;else if(z<=47)return(C|~A)^v;else if(z<=63)return C&v|A&~v;else return C^(A|~v)}function O(z){if(z<=15)return 0;else if(z<=31)return 1518500249;else if(z<=47)return 1859775393;else if(z<=63)return 2400959708;else return 2840853838}function X(z){if(z<=15)return 1352829926;else if(z<=31)return 1548603684;else if(z<=47)return 1836072691;else if(z<=63)return 2053994217;else return 0}var D=[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],W=[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],E=[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],P=[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]}),$G=L0((B,U)=>{var G=G2(),Y=L1();function Q(J,Z,K){if(!(this instanceof Q))return new Q(J,Z,K);this.Hash=J,this.blockSize=J.blockSize/8,this.outSize=J.outSize/8,this.inner=null,this.outer=null,this._init(G.toArray(Z,K))}U.exports=Q,Q.prototype._init=function J(Z){if(Z.length>this.blockSize)Z=new this.Hash().update(Z).digest();Y(Z.length<=this.blockSize);for(var K=Z.length;K{var U=B;U.utils=G2(),U.common=M1(),U.sha=CG(),U.ripemd=kG(),U.hmac=$G(),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),bG="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",vG=(B,U=21)=>{return(G=U)=>{let Y="",Q=G|0;while(Q--)Y+=B[Math.random()*B.length|0];return Y}},yG=(B=21)=>{let U="",G=B|0;while(G--)U+=bG[Math.random()*64|0];return U},gG=(B)=>Math.floor(B/25.4*72*20),u0=(B)=>Math.floor(B*72*20),X1=(B=0)=>{let U=B;return()=>++U},nB=()=>X1(),sB=()=>X1(1),oB=()=>X1(),tB=()=>X1(),R1=()=>yG().toLowerCase(),H6=(B)=>SG.default.sha1().update(B instanceof ArrayBuffer?new Uint8Array(B):B).digest("hex"),s2=(B)=>vG("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 w0({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),Y4=(B)=>new w0({name:"wp:align",children:[B]}),Z4=(B)=>new w0({name:"wp:posOffset",children:[B.toString()]}),Q4=({relative:B,align:U,offset:G})=>new w0({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 new Error("There is no configuration provided for floating position (Align or offset)")})()]}),J4=({relative:B,align:U,offset:G})=>new w0({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 new Error("There is no configuration provided for floating position (Align or offset)")})()]}),fG=function(B){return B.CENTER="ctr",B.TOP="t",B.BOTTOM="b",B}({}),K4=(B={})=>{var U,G,Y,Q;return new w0({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 V0("a:noAutofit",B.noAutoFit)]:[]]})},xG=(B={txBox:"1"})=>new w0({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:B.txBox}}}),_G=(B)=>new w0({name:"w:txbxContent",children:[...B]}),hG=(B)=>new w0({name:"wps:txbx",children:[_G(B)]}),uG=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{cx:"cx",cy:"cy"})}},dG=class extends t{constructor(B,U){super("a:ext");e(this,"attributes",void 0),this.attributes=new uG({cx:B,cy:U}),this.root.push(this.attributes)}},cG=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{x:"x",y:"y"})}},mG=class extends t{constructor(B,U){super("a:off");this.root.push(new cG({x:B!==null&&B!==void 0?B:0,y:U!==null&&U!==void 0?U:0}))}},lG=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},I4=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 lG({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 mG((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 dG(B.emus.x,B.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},q4=()=>new w0({name:"a:noFill"}),aG=(B)=>new w0({name:"a:srgbClr",attributes:{value:{key:"val",value:B.value}}}),pG=(B)=>new w0({name:"a:schemeClr",attributes:{value:{key:"val",value:B.value}}}),E6=(B)=>new w0({name:"a:solidFill",children:[B.type==="rgb"?aG(B):pG(B)]}),rG=(B)=>new w0({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"?q4():B.solidFillType==="rgb"?E6({type:"rgb",value:B.value}):E6({type:"scheme",value:B.value})]}),iG=class extends t{constructor(){super("a:avLst")}},nG=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{prst:"prst"})}},sG=class extends t{constructor(){super("a:prstGeom");this.root.push(new nG({prst:"rect"})),this.root.push(new iG)}},oG=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{bwMode:"bwMode"})}},V4=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 oG({bwMode:"auto"})),this.form=new I4(Y),this.root.push(this.form),this.root.push(new sG),U)this.root.push(q4()),this.root.push(rG(U));if(G)this.root.push(E6(G))}},l8=(B)=>new w0({name:"wps:wsp",children:[xG(B.nonVisualProperties),new V4({element:"wps",transform:B.transformation,outline:B.outline,solidFill:B.solidFill}),hG(B.children),K4(B.bodyProperties)]}),J6=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{uri:"uri"})}},tG=(B)=>new w0({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}}`}}}),eG=(B)=>new w0({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[tG(B)]}),BY=(B)=>new w0({name:"a:extLst",children:[eG(B)]}),UY=(B)=>new w0({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"?[BY(B)]:[]}),GY=class extends t{constructor(){super("a:srcRect")}},YY=class extends t{constructor(){super("a:fillRect")}},ZY=class extends t{constructor(){super("a:stretch");this.root.push(new YY)}},QY=class extends t{constructor(B){super("pic:blipFill");this.root.push(UY(B)),this.root.push(new GY),this.root.push(new ZY)}},JY=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},KY=class extends t{constructor(){super("a:picLocks");this.root.push(new JY({noChangeAspect:1,noChangeArrowheads:1}))}},IY=class extends t{constructor(){super("pic:cNvPicPr");this.root.push(new KY)}},w4=(B,U)=>new w0({name:"a:hlinkClick",attributes:M0(M0({},U?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${B}`}})}),qY=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},VY=class extends t{constructor(){super("pic:cNvPr");this.root.push(new qY({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(w4(G.linkId,!1));break}return super.prepForXml(B)}},wY=class extends t{constructor(){super("pic:nvPicPr");this.root.push(new VY),this.root.push(new IY)}},LY=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:pic"})}},a8=class extends t{constructor({mediaData:B,transform:U,outline:G}){super("pic:pic");this.root.push(new LY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new wY),this.root.push(new QY(B)),this.root.push(new V4({element:"pic",transform:U,outline:G}))}},MY=(B)=>new w0({name:"wpg:grpSpPr",children:[new I4(B)]}),XY=()=>new w0({name:"wpg:cNvGrpSpPr"}),RY=(B)=>new w0({name:"wpg:wgp",children:[XY(),MY(B.transformation),...B.children]}),OY=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphicData");if(B.type==="wps"){this.root.push(new J6({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let Q=l8(M0(M0({},B.data),{},{transformation:U,outline:G,solidFill:Y}));this.root.push(Q)}else if(B.type==="wpg"){this.root.push(new J6({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let Q=RY({children:B.children.map((J)=>{if(J.type==="wps")return l8(M0(M0({},J.data),{},{transformation:J.transformation,outline:J.outline,solidFill:J.solidFill}));else return new a8({mediaData:J,transform:J.transformation,outline:J.outline})}),transformation:U});this.root.push(Q)}else{this.root.push(new J6({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let Q=new a8({mediaData:B,transform:U,outline:G});this.root.push(Q)}}},FY=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{a:"xmlns:a"})}},L4=class extends t{constructor({mediaData:B,transform:U,outline:G,solidFill:Y}){super("a:graphic");e(this,"data",void 0),this.root.push(new FY({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new OY({mediaData:B,transform:U,outline:G,solidFill:Y}),this.root.push(this.data)}},e2={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},M4={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},W6=()=>new w0({name:"wp:wrapNone"}),X4=(B,U={top:0,bottom:0,left:0,right:0})=>new w0({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:B.side||M4.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}}}),R4=(B={top:0,bottom:0})=>new w0({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:B.top},distB:{key:"distB",value:B.bottom}}}),O4=(B={top:0,bottom:0})=>new w0({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 k6(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(w4(G.linkId,!0));break}return super.prepForXml(B)}},H4=({top:B,right:U,bottom:G,left:Y})=>new w0({name:"wp:effectExtent",attributes:{top:{key:"t",value:B},right:{key:"r",value:U},bottom:{key:"b",value:G},left:{key:"l",value:Y}}}),E4=({x:B,y:U})=>new w0({name:"wp:extent",attributes:{x:{key:"cx",value:B},y:{key:"cy",value:U}}}),HY=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},EY=class extends t{constructor(){super("a:graphicFrameLocks");this.root.push(new HY({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},W4=()=>new w0({name:"wp:cNvGraphicFramePr",children:[new EY]}),WY=class extends O0{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"})}},PY=class extends t{constructor({mediaData:B,transform:U,drawingOptions:G}){super("wp:anchor");let Y=M0({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},G.floating);if(this.root.push(new WY({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(E4({x:U.emus.x,y:U.emus.y})),this.root.push(H4({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(X4(G.floating.wrap,G.floating.margins));break;case e2.TIGHT:this.root.push(R4(G.floating.margins));break;case e2.TOP_AND_BOTTOM:this.root.push(O4(G.floating.margins));break;case e2.NONE:default:this.root.push(W6())}else this.root.push(W6());this.root.push(new F4(G.docProperties)),this.root.push(W4()),this.root.push(new L4({mediaData:B,transform:U,outline:G.outline,solidFill:G.solidFill}))}},AY=({mediaData:B,transform:U,docProperties:G,outline:Y,solidFill:Q})=>{var J,Z,K,V;return new w0({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:[E4({x:U.emus.x,y:U.emus.y}),H4(Y?{top:((J=Y.width)!==null&&J!==void 0?J:9525)*2,right:((Z=Y.width)!==null&&Z!==void 0?Z:9525)*2,bottom:((K=Y.width)!==null&&K!==void 0?K:9525)*2,left:((V=Y.width)!==null&&V!==void 0?V:9525)*2}:{top:0,right:0,bottom:0,left:0}),new F4(G),W4(),new L4({mediaData:B,transform:U,outline:Y,solidFill:Q})]})},c1=class extends t{constructor(B,U={}){super("w:drawing");if(!U.floating)this.root.push(AY({mediaData:B,transform:B.transformation,docProperties:U.docProperties,outline:U.outline,solidFill:U.solidFill}));else this.root.push(new PY({mediaData:B,transform:B.transformation,drawingOptions:U}))}},jY=(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)))},P4=(B)=>typeof B==="string"?jY(B):B,K6=(B,U)=>({data:P4(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}}),NY=class extends t{constructor(B){var U=(...Z)=>(super(...Z),e(this,"imageData",void 0),this);let G=`${H6(B.data)}.${B.type}`,Y=B.type==="svg"?M0(M0({type:B.type},K6(B,G)),{},{fallback:M0({type:B.fallback.type},K6(M0(M0({},B.fallback),{},{transformation:B.transformation}),`${H6(B.fallback.data)}.${B.fallback.type}`))}):M0({type:B.type},K6(B,G)),Q=new c1(Y,{floating:B.floating,docProperties:B.altText,outline:B.outline}),J=new T0({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(J);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(J);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)}},i6=(B)=>{var U,G,Y,Q,J,Z,K,V;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(((J=(Z=B.offset)===null||Z===void 0?void 0:Z.left)!==null&&J!==void 0?J:0)*9525),y:Math.round(((K=(V=B.offset)===null||V===void 0?void 0:V.top)!==null&&K!==void 0?K: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}},zY=class extends T0{constructor(B){super({});e(this,"wpsShapeData",void 0),this.wpsShapeData={type:B.type,transformation:i6(B.transformation),data:M0({},B)};let U=new c1(this.wpsShapeData,{floating:B.floating,docProperties:B.altText,outline:B.outline,solidFill:B.solidFill});this.root.push(U)}},TY=class extends T0{constructor(B){super({});e(this,"wpgGroupData",void 0),e(this,"mediaDatas",void 0),this.wpgGroupData={type:B.type,transformation:i6(B.transformation),children:B.children};let U=new c1(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)}},DY=class extends t{constructor(B){super("w:instrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(`SEQ ${B}`)}},CY=class extends T0{constructor(B){super({});this.root.push(e0(!0)),this.root.push(new DY(B)),this.root.push(q2()),this.root.push(B2())}},kY=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{instr:"w:instr"})}},n6=class extends t{constructor(B,U){super("w:fldSimple");if(this.root.push(new kY({instr:B})),U!==void 0)this.root.push(new Q1(U))}},$Y=class extends n6{constructor(B){super(` MERGEFIELD ${B} `,`«${B}»`)}},SY=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},A4={EXTERNAL:"External"},bY=(B,U,G,Y)=>new w0({name:"Relationship",attributes:{id:{key:"Id",value:B},type:{key:"Type",value:U},target:{key:"Target",value:G},targetMode:{key:"TargetMode",value:Y}}}),W2=class extends t{constructor(){super("Relationships");this.root.push(new SY({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(B,U,G,Y){this.root.push(bY(`rId${B}`,U,G,Y))}get RelationshipCount(){return this.root.length-1}},vY=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},s6=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},yY=class extends O0{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"})}},gY=class extends t{constructor(B){super("w:commentRangeStart");this.root.push(new s6({id:B}))}},fY=class extends t{constructor(B){super("w:commentRangeEnd");this.root.push(new s6({id:B}))}},xY=class extends t{constructor(B){super("w:commentReference");this.root.push(new s6({id:B}))}},P6=class extends t{constructor({id:B,initials:U,author:G,date:Y=new Date,children:Q},J){super("w:comment");e(this,"paraId",void 0),this.paraId=J,this.root.push(new vY({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 J=Q["w:p"];if(Array.isArray(J))J.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return U}},j4=(B)=>(B+1).toString(16).toUpperCase().padStart(8,"0"),N4=class extends t{constructor({children:B}){super("w:comments");if(e(this,"relationships",void 0),e(this,"threadData",void 0),this.root.push(new yY({"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,j4(G.id)]));for(let G of B)this.root.push(new P6(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 P6(U));this.relationships=new W2}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},_Y=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},hY=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},uY=class extends t{constructor(B){super("w15:commentEx");this.root.push(new hY({paraId:B.paraId,paraIdParent:B.parentParaId,done:B.done!==void 0?B.done?"1":"0":void 0}))}},z4=class extends t{constructor(B){super("w15:commentsEx");this.root.push(new _Y({"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 uY(U))}},dY=class extends S0{constructor(){super("w:noBreakHyphen")}},cY=class extends S0{constructor(){super("w:softHyphen")}},mY=class extends S0{constructor(){super("w:dayShort")}},lY=class extends S0{constructor(){super("w:monthShort")}},aY=class extends S0{constructor(){super("w:yearShort")}},pY=class extends S0{constructor(){super("w:dayLong")}},rY=class extends S0{constructor(){super("w:monthLong")}},iY=class extends S0{constructor(){super("w:yearLong")}},nY=class extends S0{constructor(){super("w:annotationRef")}},sY=class extends S0{constructor(){super("w:footnoteRef")}},T4=class extends S0{constructor(){super("w:endnoteRef")}},oY=class extends S0{constructor(){super("w:separator")}},tY=class extends S0{constructor(){super("w:continuationSeparator")}},eY=class extends S0{constructor(){super("w:pgNum")}},BZ=class extends S0{constructor(){super("w:cr")}},D4=class extends S0{constructor(){super("w:tab")}},UZ=class extends S0{constructor(){super("w:lastRenderedPageBreak")}},GZ={LEFT:"left",CENTER:"center",RIGHT:"right"},YZ={MARGIN:"margin",INDENT:"indent"},ZZ={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},QZ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},JZ=class extends t{constructor(B){super("w:ptab");this.root.push(new QZ({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}))}},KZ=class extends T0{constructor(){super({});this.root.push(new k4(C4.PAGE))}},IZ=class extends T0{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:J})=>new w0({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:J}}}),qZ={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},x2=(B)=>new w0({name:"w:pStyle",attributes:{val:{key:"w:val",value:B}}}),A6={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},VZ={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},wZ={MAX:9026},b4=({type:B,position:U,leader:G})=>new w0({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 w0({name:"w:tabs",children:B.map((U)=>b4(U))}),D1=class extends t{constructor(B,U){super("w:numPr");this.root.push(new LZ(U)),this.root.push(new MZ(B))}},LZ=class extends t{constructor(B){super("w:ilvl");if(B>9)throw new 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}))}},MZ=class extends t{constructor(B){super("w:numId");this.root.push(new C0({val:typeof B==="string"?`{${B}}`:B}))}},O1=class extends t{constructor(...B){super(...B);e(this,"fileChild",Symbol())}},XZ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},RZ={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 XZ({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,R1(),B.anchor)}},o6=class extends t{constructor(B){super("w:externalHyperlink");e(this,"options",void 0),this.options=B}},OZ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id",name:"w:name"})}},FZ=class extends O0{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 OZ({name:B,id:U});this.root.push(G)}},x4=class extends t{constructor(B){super("w:bookmarkEnd");let U=new FZ({id:B});this.root.push(U)}},HZ=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},WZ=class extends n6{constructor(B,U,G={}){let{hyperlink:Y=!0,referenceFormat:Q="full_context"}=G,J=`${`REF ${B}`} ${[...Y?["\\h"]:[],...[EZ[Q]].filter((Z)=>!!Z)].join(" ")}`;super(J,U)}},_4=(B)=>new w0({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:B}}}),PZ=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)}},AZ=class extends T0{constructor(B,U={}){super({children:[e0(!0),new PZ(B,U),B2()]})}},jZ={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"},N1=({id:B,fontKey:U,subsetted:G},Y)=>new w0({name:Y,attributes:M0({id:{key:"r:id",value:B}},U?{fontKey:{key:"w:fontKey",value:`{${U}}`}}:{}),children:[...G?[new V0("w:subsetted",G)]:[]]}),NZ=({name:B,altName:U,panose1:G,charset:Y,family:Q,notTrueType:J,pitch:Z,sig:K,embedRegular:V,embedBold:H,embedItalic:O,embedBoldItalic:X})=>new w0({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)]:[],...J?[new V0("w:notTrueType",J)]:[],...Z?[f2("w:pitch",Z)]:[],...K?[new w0({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:K.usb0},usb1:{key:"w:usb1",value:K.usb1},usb2:{key:"w:usb2",value:K.usb2},usb3:{key:"w:usb3",value:K.usb3},csb0:{key:"w:csb0",value:K.csb0},csb1:{key:"w:csb1",value:K.csb1}}})]:[],...V?[N1(V,"w:embedRegular")]:[],...H?[N1(H,"w:embedBold")]:[],...O?[N1(O,"w:embedItalic")]:[],...X?[N1(X,"w:embedBoldItalic")]:[]]}),zZ=({name:B,index:U,fontKey:G,characterSet:Y})=>NZ({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}`}}),TZ=(B)=>new w0({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)=>zZ({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)=>M0(M0({},U),{},{fontKey:eB()})),this.fontTable=TZ(this.fontOptionsWithKey),this.relationships=new W2;for(let U=0;Unew w0({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),CZ={NONE:"none",DROP:"drop",MARGIN:"margin"},kZ={MARGIN:"margin",PAGE:"page",TEXT:"text"},$Z={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},u4=(B)=>{var U,G;return new w0({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}}})},w2=class extends L2{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 V0("w:keepNext",B.keepNext));if(B.keepLines!==void 0)this.push(new V0("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 V0("w:widowControl",B.widowControl));if(B.bullet)this.push(new D1(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 D1(`${B.numbering.reference}-${(G=B.numbering.instance)!==null&&G!==void 0?G:0}`,B.numbering.level))}else if(B.numbering===!1)this.push(new D1(0,0));if(B.border)this.push(new xB(B.border));if(B.thematicBreak)this.push(new _B);if(B.shading)this.push(w1(B.shading));if(B.wordWrap)this.push(DZ());if(B.overflowPunctuation)this.push(new V0("w:overflowPunct",B.overflowPunctuation));let Y=[...B.rightTabStop!==void 0?[{type:A6.RIGHT,position:B.rightTabStop}]:[],...B.tabStops?B.tabStops:[],...B.leftTabStop!==void 0?[{type:A6.LEFT,position:B.leftTabStop}]:[]];if(Y.length>0)this.push(v4(Y));if(B.bidirectional!==void 0)this.push(new V0("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 V0("w:contextualSpacing",B.contextualSpacing));if(B.alignment)this.push(c6(B.alignment));if(B.outlineLevel!==void 0)this.push(_4(B.outlineLevel));if(B.suppressLineNumbers!==void 0)this.push(new V0("w:suppressLineNumbers",B.suppressLineNumbers));if(B.autoSpaceEastAsianText!==void 0)this.push(new V0("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 w2(M0(M0({},B),{},{includeIfEmpty:!0})))}},d0=class extends O1{constructor(B){super("w:p");if(e(this,"properties",void 0),typeof B==="string")return this.properties=new w2({}),this.root.push(this.properties),this.root.push(new Q1(B)),this;if(this.properties=new w2(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 o6){let G=this.root.indexOf(U),Y=new m2(U.options.children,R1());B.viewWrapper.Relationships.addRelationship(Y.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",U.options.link,A4.EXTERNAL),this.root[G]=Y}return super.prepForXml(B)}addRunToFront(B){return this.root.splice(1,0,B),this}},SZ=class extends t{constructor(B){super("m:oMath");for(let U of B.children)this.root.push(U)}},bZ=class extends t{constructor(B){super("m:t");this.root.push(B)}},vZ=class extends t{constructor(B){super("m:r");this.root.push(new bZ(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)}},yZ=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 w0({name:"m:chr",attributes:{accent:{key:"m:val",value:B}}}),y0=({children:B})=>new w0({name:"m:e",children:B}),a4=({value:B})=>new w0({name:"m:limLoc",attributes:{value:{key:"m:val",value:B||"undOvr"}}}),gZ=()=>new w0({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),fZ=()=>new w0({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),t6=({accent:B,hasSuperScript:U,hasSubScript:G,limitLocationVal:Y})=>new w0({name:"m:naryPr",children:[...B?[l4({accent:B})]:[],a4({value:Y}),...!U?[fZ()]:[],...!G?[gZ()]:[]]}),l2=({children:B})=>new w0({name:"m:sub",children:B}),a2=({children:B})=>new w0({name:"m:sup",children:B}),xZ=class extends t{constructor(B){super("m:nary");if(this.root.push(t6({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}))}},_Z=class extends t{constructor(B){super("m:nary");if(this.root.push(t6({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}))}},e6=class extends t{constructor(B){super("m:lim");for(let U of B)this.root.push(U)}},hZ=class extends t{constructor(B){super("m:limUpp");this.root.push(y0({children:B.children})),this.root.push(new e6(B.limit))}},uZ=class extends t{constructor(B){super("m:limLow");this.root.push(y0({children:B.children})),this.root.push(new e6(B.limit))}},p4=()=>new w0({name:"m:sSupPr"}),dZ=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 w0({name:"m:sSubPr"}),cZ=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 w0({name:"m:sSubSupPr"}),mZ=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 w0({name:"m:sPrePr"}),lZ=class extends w0{constructor({children:B,subScript:U,superScript:G}){super({name:"m:sPre",children:[n4(),y0({children:B}),l2({children:U}),a2({children:G})]})}},aZ="",s4=class extends t{constructor(B){super("m:deg");if(B)for(let U of B)this.root.push(U)}},pZ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{hide:"m:val"})}},rZ=class extends t{constructor(){super("m:degHide");this.root.push(new pZ({hide:1}))}},o4=class extends t{constructor(B){super("m:radPr");if(!B)this.root.push(new rZ)}},iZ=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")}},nZ=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}))}},sZ=({character:B})=>new w0({name:"m:begChr",attributes:{character:{key:"m:val",value:B}}}),oZ=({character:B})=>new w0({name:"m:endChr",attributes:{character:{key:"m:val",value:B}}}),m1=({characters:B})=>new w0({name:"m:dPr",children:B?[sZ({character:B.beginningCharacter}),oZ({character:B.endingCharacter})]:[]}),tZ=class extends t{constructor(B){super("m:d");this.root.push(m1({})),this.root.push(y0({children:B.children}))}},eZ=class extends t{constructor(B){super("m:d");this.root.push(m1({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(y0({children:B.children}))}},BQ=class extends t{constructor(B){super("m:d");this.root.push(m1({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(y0({children:B.children}))}},UQ=class extends t{constructor(B){super("m:d");this.root.push(m1({characters:{beginningCharacter:"〈",endingCharacter:"〉"}})),this.root.push(y0({children:B.children}))}},GQ=(B)=>new w0({name:"w:gridCol",attributes:B!==void 0?{width:{key:"w:w",value:z0(B)}}:void 0}),BU=class extends t{constructor(B,U){super("w:tblGrid");for(let G of B)this.root.push(GQ(G));if(U)this.root.push(new ZQ(U))}},YQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},ZQ=class extends t{constructor(B){super("w:tblGridChange");this.root.push(new YQ({id:B.id})),this.root.push(new BU(B.columnWidths))}},QQ=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))}},JQ=class extends t{constructor(){super("w:delInstrText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push("PAGE")}},KQ=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")}},p8=class extends t{constructor(B){super("w:delText");this.root.push(new _0({space:x0.PRESERVE})),this.root.push(B)}},qQ=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 VQ(B),this.addChildElement(this.deletedTextRunWrapper)}},VQ=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 JQ),this.root.push(q2()),this.root.push(B2());break;case F2.TOTAL_PAGES:this.root.push(e0()),this.root.push(new KQ),this.root.push(q2()),this.root.push(B2());break;case F2.TOTAL_PAGES_IN_SECTION:this.root.push(e0()),this.root.push(new IQ),this.root.push(q2()),this.root.push(B2());break;default:this.root.push(new p8(U));break}continue}this.root.push(U)}else if(B.text)this.root.push(new p8(B.text));if(B.break)for(let U=0;Unew w0({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:B}}}),qU=({marginUnitType:B=b1.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((J)=>J.size!==void 0).map(({name:J,size:Z})=>J1(J,{type:B,size:Z})),MQ=(B)=>{let U=qU(B);if(U.length===0)return;return new w0({name:"w:tblCellMar",children:U})},XQ=(B)=>{let U=qU(B);if(U.length===0)return;return new w0({name:"w:tcMar",children:U})},b1={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},J1=(B,{type:U=b1.AUTO,size:G})=>{let Y=G;if(U===b1.PERCENTAGE&&typeof G==="number")Y=`${G}%`;return new w0({name:B,attributes:{type:{key:"w:type",value:U},size:{key:"w:w",value:d6(Y)}}})},VU=class extends L2{constructor(B){super("w:tcBorders");if(B.top)this.root.push(P0("w:top",B.top));if(B.start)this.root.push(P0("w:start",B.start));if(B.left)this.root.push(P0("w:left",B.left));if(B.bottom)this.root.push(P0("w:bottom",B.bottom));if(B.end)this.root.push(P0("w:end",B.end));if(B.right)this.root.push(P0("w:right",B.right))}},RQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},wU=class extends t{constructor(B){super("w:gridSpan");this.root.push(new RQ({val:D0(B)}))}},U8={CONTINUE:"continue",RESTART:"restart"},OQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},j6=class extends t{constructor(B){super("w:vMerge");this.root.push(new OQ({val:B}))}},FQ={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},HQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},LU=class extends t{constructor(B){super("w:textDirection");this.root.push(new HQ({val:B}))}},MU=class extends L2{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 wU(B.columnSpan));if(B.verticalMerge)this.root.push(new j6(B.verticalMerge));else if(B.rowSpan&&B.rowSpan>1)this.root.push(new j6(U8.RESTART));if(B.borders)this.root.push(new VU(B.borders));if(B.shading)this.root.push(w1(B.shading));if(B.margins){let U=XQ(B.margins);if(U)this.root.push(U)}if(B.textDirection)this.root.push(new LU(B.textDirection));if(B.verticalAlign)this.root.push(B8(B.verticalAlign));if(B.insertion)this.root.push(new YU(B.insertion));if(B.deletion)this.root.push(new ZU(B.deletion));if(B.revision)this.root.push(new EQ(B.revision));if(B.cellMerge)this.root.push(new JU(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 MU(M0(M0({},B),{},{includeIfEmpty:!0})))}},G8=class extends t{constructor(B){super("w:tc");e(this,"options",void 0),this.options=B,this.root.push(new MU(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:d1.NONE,size:0,color:"auto"},y2={style:d1.SINGLE,size:4,color:"auto"},Y8=class extends t{constructor(B){var U,G,Y,Q,J,Z;super("w:tblBorders");this.root.push(P0("w:top",(U=B.top)!==null&&U!==void 0?U:y2)),this.root.push(P0("w:left",(G=B.left)!==null&&G!==void 0?G:y2)),this.root.push(P0("w:bottom",(Y=B.bottom)!==null&&Y!==void 0?Y:y2)),this.root.push(P0("w:right",(Q=B.right)!==null&&Q!==void 0?Q:y2)),this.root.push(P0("w:insideH",(J=B.insideHorizontal)!==null&&J!==void 0?J:y2)),this.root.push(P0("w:insideV",(Z=B.insideVertical)!==null&&Z!==void 0?Z:y2))}};e(Y8,"NONE",{top:v2,bottom:v2,left:v2,right:v2,insideHorizontal:v2,insideVertical:v2});var WQ={MARGIN:"margin",PAGE:"page",TEXT:"text"},PQ={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},AQ={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},jQ={NEVER:"never",OVERLAP:"overlap"},NQ=(B)=>new w0({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:B}}}),XU=({horizontalAnchor:B,verticalAnchor:U,absoluteHorizontalPosition:G,relativeHorizontalPosition:Y,absoluteVerticalPosition:Q,relativeVerticalPosition:J,bottomFromText:Z,topFromText:K,leftFromText:V,rightFromText:H,overlap:O})=>new w0({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:V===void 0?void 0:z0(V)},rightFromText:{key:"w:rightFromText",value:H===void 0?void 0:z0(H)},topFromText:{key:"w:topFromText",value:K===void 0?void 0:z0(K)},bottomFromText:{key:"w:bottomFromText",value:Z===void 0?void 0:z0(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:J},verticalAnchor:{key:"w:vertAnchor",value:U}},children:O?[NQ(O)]:void 0}),zQ={AUTOFIT:"autofit",FIXED:"fixed"},RU=(B)=>new w0({name:"w:tblLayout",attributes:{type:{key:"w:type",value:B}}}),TQ={DXA:"dxa",NIL:"nil"},OU=({type:B=TQ.DXA,value:U})=>new w0({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:B},value:{key:"w:w",value:d6(U)}}}),FU=({firstRow:B,lastRow:U,firstColumn:G,lastColumn:Y,noHBand:Q,noVBand:J})=>new w0({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:J}}}),Z8=class extends L2{constructor(B){super("w:tblPr",B.includeIfEmpty);if(B.style)this.root.push(new V2("w:tblStyle",B.style));if(B.float)this.root.push(XU(B.float));if(B.visuallyRightToLeft!==void 0)this.root.push(new V0("w:bidiVisual",B.visuallyRightToLeft));if(B.width)this.root.push(J1("w:tblW",B.width));if(B.alignment)this.root.push(c6(B.alignment));if(B.indent)this.root.push(J1("w:tblInd",B.indent));if(B.borders)this.root.push(new Y8(B.borders));if(B.shading)this.root.push(w1(B.shading));if(B.layout)this.root.push(RU(B.layout));if(B.cellMargin){let U=MQ(B.cellMargin);if(U)this.root.push(U)}if(B.tableLook)this.root.push(FU(B.tableLook));if(B.cellSpacing)this.root.push(OU(B.cellSpacing));if(B.revision)this.root.push(new DQ(B.revision))}},DQ=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 Z8(M0(M0({},B),{},{includeIfEmpty:!0})))}},CQ=class extends O1{constructor({rows:B,width:U,columnWidths:G=Array(Math.max(...B.map((P)=>P.CellCount))).fill(100),columnWidthsRevision:Y,margins:Q,indent:J,float:Z,layout:K,style:V,borders:H,alignment:O,visuallyRightToLeft:X,tableLook:D,cellSpacing:W,revision:E}){super("w:tbl");this.root.push(new Z8({borders:H!==null&&H!==void 0?H:{},width:U!==null&&U!==void 0?U:{size:100},indent:J,float:Z,layout:K,style:V,alignment:O,cellMargin:Q,visuallyRightToLeft:X,tableLook:D,cellSpacing:W,revision:E})),this.root.push(new BU(G,Y));for(let P of B)this.root.push(P);B.forEach((P,z)=>{if(z===B.length-1)return;let C=0;P.cells.forEach((A)=>{if(A.options.rowSpan&&A.options.rowSpan>1){let v=new G8({rowSpan:A.options.rowSpan-1,columnSpan:A.options.columnSpan,borders:A.options.borders,children:[],verticalMerge:U8.CONTINUE});B[z+1].addCellToColumnIndex(v,C)}C+=A.options.columnSpan||1})})}},kQ={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},HU=(B,U)=>new w0({name:"w:trHeight",attributes:{value:{key:"w:val",value:z0(B)},rule:{key:"w:hRule",value:U}}}),Q8=class extends L2{constructor(B){super("w:trPr",B.includeIfEmpty);if(B.cantSplit!==void 0)this.root.push(new V0("w:cantSplit",B.cantSplit));if(B.tableHeader!==void 0)this.root.push(new V0("w:tblHeader",B.tableHeader));if(B.height)this.root.push(HU(B.height.value,B.height.rule));if(B.cellSpacing)this.root.push(OU(B.cellSpacing));if(B.insertion)this.root.push(new UU(B.insertion));if(B.deletion)this.root.push(new GU(B.deletion));if(B.revision)this.root.push(new EU(B.revision))}},EU=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 Q8(M0(M0({},B),{},{includeIfEmpty:!0})))}},$Q=class extends t{constructor(B){super("w:tr");e(this,"options",void 0),this.options=B,this.root.push(new Q8(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 G8)}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 new 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 new 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}},SQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},bQ=class extends t{constructor(){super("Properties");this.root.push(new SQ({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},vQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns"})}},I2=(B,U)=>new w0({name:"Default",attributes:{contentType:{key:"ContentType",value:B},extension:{key:"Extension",value:U}}}),f0=(B,U)=>new w0({name:"Override",attributes:{contentType:{key:"ContentType",value:B},partName:{key:"PartName",value:U}}}),yQ=class extends t{constructor(){super("Types");this.root.push(new vQ({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(I2("image/png","png")),this.root.push(I2("image/jpeg","jpeg")),this.root.push(I2("image/jpeg","jpg")),this.root.push(I2("image/bmp","bmp")),this.root.push(I2("image/gif","gif")),this.root.push(I2("image/svg+xml","svg")),this.root.push(I2("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(I2("application/xml","xml")),this.root.push(I2("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`))}},v1={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 O0{constructor(B,U){super(M0({Ignorable:U},Object.fromEntries(B.map((G)=>[G,v1[G]]))));e(this,"xmlKeys",M0({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(v1).map((G)=>[G,`xmlns:${G}`]))))}},gQ=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 R2("dc:title",B.title));if(B.subject)this.root.push(new R2("dc:subject",B.subject));if(B.creator)this.root.push(new R2("dc:creator",B.creator));if(B.keywords)this.root.push(new R2("cp:keywords",B.keywords));if(B.description)this.root.push(new R2("dc:description",B.description));if(B.lastModifiedBy)this.root.push(new R2("cp:lastModifiedBy",B.lastModifiedBy));if(B.revision)this.root.push(new R2("cp:revision",String(B.revision)));this.root.push(new r8("dcterms:created")),this.root.push(new r8("dcterms:modified"))}},fQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"xsi:type"})}},r8=class extends t{constructor(B){super(B);this.root.push(new fQ({type:"dcterms:W3CDTF"})),this.root.push(fB(new Date))}},xQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},_Q=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},hQ=class extends t{constructor(B,U){super("property");this.root.push(new _Q({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:B.toString(),name:U.name})),this.root.push(new uQ(U.value))}},uQ=class extends t{constructor(B){super("vt:lpwstr");this.root.push(B)}},dQ=class extends t{constructor(B){super("Properties");e(this,"nextId",void 0),e(this,"properties",[]),this.root.push(new xQ({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 hQ(this.nextId++,B))}},WU=({space:B,count:U,separate:G,equalWidth:Y,children:Q})=>new w0({name:"w:cols",attributes:{space:{key:"w:space",value:B===void 0?void 0:z0(B)},count:{key:"w:num",value:U===void 0?void 0:D0(U)},separate:{key:"w:sep",value:G},equalWidth:{key:"w:equalWidth",value:Y}},children:!Y&&Q?Q:void 0}),cQ={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},PU=({type:B,linePitch:U,charSpace:G})=>new w0({name:"w:docGrid",attributes:{type:{key:"w:type",value:B},linePitch:{key:"w:linePitch",value:D0(U)},charSpace:{key:"w:charSpace",value:G?D0(G):void 0}}}),D2={DEFAULT:"default",FIRST:"first",EVEN:"even"},N6={HEADER:"w:headerReference",FOOTER:"w:footerReference"},C1=(B,U)=>new w0({name:B,attributes:{type:{key:"w:type",value:U.type||D2.DEFAULT},id:{key:"r:id",value:`rId${U.id}`}}}),mQ={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},AU=({countBy:B,start:U,restart:G,distance:Y})=>new w0({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:B===void 0?void 0:D0(B)},start:{key:"w:start",value:U===void 0?void 0:D0(U)},restart:{key:"w:restart",value:G},distance:{key:"w:distance",value:Y===void 0?void 0:z0(Y)}}}),lQ={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},aQ={PAGE:"page",TEXT:"text"},pQ={BACK:"back",FRONT:"front"},i8=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},jU=class extends L2{constructor(B){super("w:pgBorders");if(!B)return this;if(B.pageBorders)this.root.push(new i8({display:B.pageBorders.display,offsetFrom:B.pageBorders.offsetFrom,zOrder:B.pageBorders.zOrder}));else this.root.push(new i8({}));if(B.pageBorderTop)this.root.push(P0("w:top",B.pageBorderTop));if(B.pageBorderLeft)this.root.push(P0("w:left",B.pageBorderLeft));if(B.pageBorderBottom)this.root.push(P0("w:bottom",B.pageBorderBottom));if(B.pageBorderRight)this.root.push(P0("w:right",B.pageBorderRight))}},NU=(B,U,G,Y,Q,J,Z)=>new w0({name:"w:pgMar",attributes:{top:{key:"w:top",value:t0(B)},right:{key:"w:right",value:z0(U)},bottom:{key:"w:bottom",value:t0(G)},left:{key:"w:left",value:z0(Y)},header:{key:"w:header",value:z0(Q)},footer:{key:"w:footer",value:z0(J)},gutter:{key:"w:gutter",value:z0(Z)}}}),rQ={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},zU=({start:B,formatType:U,separator:G})=>new w0({name:"w:pgNumType",attributes:{start:{key:"w:start",value:B===void 0?void 0:D0(B)},formatType:{key:"w:fmt",value:U},separator:{key:"w:chapSep",value:G}}}),y1={PORTRAIT:"portrait",LANDSCAPE:"landscape"},TU=({width:B,height:U,orientation:G,code:Y})=>{let Q=z0(B),J=z0(U);return new w0({name:"w:pgSz",attributes:{width:{key:"w:w",value:G===y1.LANDSCAPE?J:Q},height:{key:"w:h",value:G===y1.LANDSCAPE?Q:J},orientation:{key:"w:orient",value:G},code:{key:"w:code",value:Y}}})},iQ={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},nQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},DU=class extends t{constructor(B){super("w:textDirection");this.root.push(new nQ({val:B}))}},sQ={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},CU=(B)=>new w0({name:"w:type",attributes:{val:{key:"w:val",value:B}}}),O2={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},k1={WIDTH:11906,HEIGHT:16838,ORIENTATION:y1.PORTRAIT},J8=class extends t{constructor({page:{size:{width:B=k1.WIDTH,height:U=k1.HEIGHT,orientation:G=k1.ORIENTATION,code:Y}={},margin:{top:Q=O2.TOP,right:J=O2.RIGHT,bottom:Z=O2.BOTTOM,left:K=O2.LEFT,header:V=O2.HEADER,footer:H=O2.FOOTER,gutter:O=O2.GUTTER}={},pageNumbers:X={},borders:D,textDirection:W}={},grid:{linePitch:E=360,charSpace:P,type:z}={},headerWrapperGroup:C={},footerWrapperGroup:A={},lineNumbers:v,titlePage:S,verticalAlign:F,column:w,type:$,revision:x}={}){super("w:sectPr");if(this.addHeaderFooterGroup(N6.HEADER,C),this.addHeaderFooterGroup(N6.FOOTER,A),$)this.root.push(CU($));if(this.root.push(TU({width:B,height:U,orientation:G,code:Y})),this.root.push(NU(Q,J,Z,K,V,H,O)),D)this.root.push(new jU(D));if(v)this.root.push(AU(v));if(this.root.push(zU(X)),w)this.root.push(WU(w));if(F)this.root.push(B8(F));if(S!==void 0)this.root.push(new V0("w:titlePg",S));if(W)this.root.push(new DU(W));if(x)this.root.push(new kU(x));this.root.push(PU({linePitch:E,charSpace:P,type:z}))}addHeaderFooterGroup(B,U){if(U.default)this.root.push(C1(B,{type:D2.DEFAULT,id:U.default.View.ReferenceId}));if(U.first)this.root.push(C1(B,{type:D2.FIRST,id:U.first.View.ReferenceId}));if(U.even)this.root.push(C1(B,{type:D2.EVEN,id:U.even.View.ReferenceId}))}},kU=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 J8(B))}},oQ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{width:"w:w",space:"w:space"})}},tQ=class extends t{constructor(B){super("w:col");this.root.push(new oQ({width:z0(B.width),space:B.space===void 0?void 0:z0(B.space)}))}},$U=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 J8(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 w2({});return G.push(B),U.addChildElement(G),U}},SU=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},bU=class extends t{constructor(B){super("w:background");this.root.push(new SU({color:B.color===void 0?void 0:C2(B.color),themeColor:B.themeColor,themeShade:B.themeShade===void 0?void 0:F6(B.themeShade),themeTint:B.themeTint===void 0?void 0:F6(B.themeTint)}))}},eQ=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 $U,B.background)this.root.push(new bU(B.background));this.root.push(this.body)}add(B){return this.body.push(B),this}get Body(){return this.body}},BJ=class{constructor(B){e(this,"document",void 0),e(this,"relationships",void 0),this.document=new eQ(B),this.relationships=new W2}get View(){return this.document}get Relationships(){return this.relationships}},UJ=class extends O0{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"})}},GJ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",id:"w:id"})}},YJ=class extends T0{constructor(){super({style:"EndnoteReference"});this.root.push(new T4)}},n8={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},I6=class extends t{constructor(B){super("w:endnote");this.root.push(new GJ({type:B.type,id:B.id}));for(let U=0;U9)throw new 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 FJ({ilvl:D0(B),tentative:1}))}},hU=class extends I8{},NJ=class extends I8{},zJ=class extends t{constructor(B){super("w:multiLevelType");this.root.push(new C0({val:B}))}},TJ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},z6=class extends t{constructor(B,U){super("w:abstractNum");e(this,"id",void 0),this.root.push(new TJ({abstractNumId:D0(B),restartNumberingAfterBreak:0})),this.root.push(new zJ("hybridMultilevel")),this.id=B;for(let G of U)this.root.push(new hU(G))}},DJ=class extends t{constructor(B){super("w:abstractNumId");this.root.push(new C0({val:B}))}},CJ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{numId:"w:numId"})}},T6=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 CJ({numId:D0(B.numId)})),this.root.push(new DJ(D0(B.abstractNumId))),B.overrideLevels&&B.overrideLevels.length)for(let U of B.overrideLevels)this.root.push(new uU(U.num,U.start))}},kJ=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{ilvl:"w:ilvl"})}},uU=class extends t{constructor(B,U){super("w:lvlOverride");if(this.root.push(new kJ({ilvl:B})),U!==void 0)this.root.push(new SJ(U))}},$J=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},SJ=class extends t{constructor(B){super("w:startOverride");this.root.push(new $J({val:B}))}},dU=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 z6(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 T6({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 z6(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),J=Q&&Q[0].start,Z={numId:this.concreteNumUniqueNumericId(),abstractNumId:G.id,reference:B,instance:U,overrideLevels:[typeof J==="number"&&Number.isInteger(J)?{num:0,start:J}:{num:0,start:1}]};this.concreteNumberingMap.set(Y,new T6(Z))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},bJ=(B)=>new w0({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"}}}),vJ=class extends t{constructor(B){super("w:compat");if(B.version)this.root.push(bJ(B.version));if(B.useSingleBorderforContiguousCells)this.root.push(new V0("w:useSingleBorderforContiguousCells",B.useSingleBorderforContiguousCells));if(B.wordPerfectJustification)this.root.push(new V0("w:wpJustification",B.wordPerfectJustification));if(B.noTabStopForHangingIndent)this.root.push(new V0("w:noTabHangInd",B.noTabStopForHangingIndent));if(B.noLeading)this.root.push(new V0("w:noLeading",B.noLeading));if(B.spaceForUnderline)this.root.push(new V0("w:spaceForUL",B.spaceForUnderline));if(B.noColumnBalance)this.root.push(new V0("w:noColumnBalance",B.noColumnBalance));if(B.balanceSingleByteDoubleByteWidth)this.root.push(new V0("w:balanceSingleByteDoubleByteWidth",B.balanceSingleByteDoubleByteWidth));if(B.noExtraLineSpacing)this.root.push(new V0("w:noExtraLineSpacing",B.noExtraLineSpacing));if(B.doNotLeaveBackslashAlone)this.root.push(new V0("w:doNotLeaveBackslashAlone",B.doNotLeaveBackslashAlone));if(B.underlineTrailingSpaces)this.root.push(new V0("w:ulTrailSpace",B.underlineTrailingSpaces));if(B.doNotExpandShiftReturn)this.root.push(new V0("w:doNotExpandShiftReturn",B.doNotExpandShiftReturn));if(B.spacingInWholePoints)this.root.push(new V0("w:spacingInWholePoints",B.spacingInWholePoints));if(B.lineWrapLikeWord6)this.root.push(new V0("w:lineWrapLikeWord6",B.lineWrapLikeWord6));if(B.printBodyTextBeforeHeader)this.root.push(new V0("w:printBodyTextBeforeHeader",B.printBodyTextBeforeHeader));if(B.printColorsBlack)this.root.push(new V0("w:printColBlack",B.printColorsBlack));if(B.spaceWidth)this.root.push(new V0("w:wpSpaceWidth",B.spaceWidth));if(B.showBreaksInFrames)this.root.push(new V0("w:showBreaksInFrames",B.showBreaksInFrames));if(B.subFontBySize)this.root.push(new V0("w:subFontBySize",B.subFontBySize));if(B.suppressBottomSpacing)this.root.push(new V0("w:suppressBottomSpacing",B.suppressBottomSpacing));if(B.suppressTopSpacing)this.root.push(new V0("w:suppressTopSpacing",B.suppressTopSpacing));if(B.suppressSpacingAtTopOfPage)this.root.push(new V0("w:suppressSpacingAtTopOfPage",B.suppressSpacingAtTopOfPage));if(B.suppressTopSpacingWP)this.root.push(new V0("w:suppressTopSpacingWP",B.suppressTopSpacingWP));if(B.suppressSpBfAfterPgBrk)this.root.push(new V0("w:suppressSpBfAfterPgBrk",B.suppressSpBfAfterPgBrk));if(B.swapBordersFacingPages)this.root.push(new V0("w:swapBordersFacingPages",B.swapBordersFacingPages));if(B.convertMailMergeEsc)this.root.push(new V0("w:convMailMergeEsc",B.convertMailMergeEsc));if(B.truncateFontHeightsLikeWP6)this.root.push(new V0("w:truncateFontHeightsLikeWP6",B.truncateFontHeightsLikeWP6));if(B.macWordSmallCaps)this.root.push(new V0("w:mwSmallCaps",B.macWordSmallCaps));if(B.usePrinterMetrics)this.root.push(new V0("w:usePrinterMetrics",B.usePrinterMetrics));if(B.doNotSuppressParagraphBorders)this.root.push(new V0("w:doNotSuppressParagraphBorders",B.doNotSuppressParagraphBorders));if(B.wrapTrailSpaces)this.root.push(new V0("w:wrapTrailSpaces",B.wrapTrailSpaces));if(B.footnoteLayoutLikeWW8)this.root.push(new V0("w:footnoteLayoutLikeWW8",B.footnoteLayoutLikeWW8));if(B.shapeLayoutLikeWW8)this.root.push(new V0("w:shapeLayoutLikeWW8",B.shapeLayoutLikeWW8));if(B.alignTablesRowByRow)this.root.push(new V0("w:alignTablesRowByRow",B.alignTablesRowByRow));if(B.forgetLastTabAlignment)this.root.push(new V0("w:forgetLastTabAlignment",B.forgetLastTabAlignment));if(B.adjustLineHeightInTable)this.root.push(new V0("w:adjustLineHeightInTable",B.adjustLineHeightInTable));if(B.autoSpaceLikeWord95)this.root.push(new V0("w:autoSpaceLikeWord95",B.autoSpaceLikeWord95));if(B.noSpaceRaiseLower)this.root.push(new V0("w:noSpaceRaiseLower",B.noSpaceRaiseLower));if(B.doNotUseHTMLParagraphAutoSpacing)this.root.push(new V0("w:doNotUseHTMLParagraphAutoSpacing",B.doNotUseHTMLParagraphAutoSpacing));if(B.layoutRawTableWidth)this.root.push(new V0("w:layoutRawTableWidth",B.layoutRawTableWidth));if(B.layoutTableRowsApart)this.root.push(new V0("w:layoutTableRowsApart",B.layoutTableRowsApart));if(B.useWord97LineBreakRules)this.root.push(new V0("w:useWord97LineBreakRules",B.useWord97LineBreakRules));if(B.doNotBreakWrappedTables)this.root.push(new V0("w:doNotBreakWrappedTables",B.doNotBreakWrappedTables));if(B.doNotSnapToGridInCell)this.root.push(new V0("w:doNotSnapToGridInCell",B.doNotSnapToGridInCell));if(B.selectFieldWithFirstOrLastCharacter)this.root.push(new V0("w:selectFldWithFirstOrLastChar",B.selectFieldWithFirstOrLastCharacter));if(B.applyBreakingRules)this.root.push(new V0("w:applyBreakingRules",B.applyBreakingRules));if(B.doNotWrapTextWithPunctuation)this.root.push(new V0("w:doNotWrapTextWithPunct",B.doNotWrapTextWithPunctuation));if(B.doNotUseEastAsianBreakRules)this.root.push(new V0("w:doNotUseEastAsianBreakRules",B.doNotUseEastAsianBreakRules));if(B.useWord2002TableStyleRules)this.root.push(new V0("w:useWord2002TableStyleRules",B.useWord2002TableStyleRules));if(B.growAutofit)this.root.push(new V0("w:growAutofit",B.growAutofit));if(B.useFELayout)this.root.push(new V0("w:useFELayout",B.useFELayout));if(B.useNormalStyleForList)this.root.push(new V0("w:useNormalStyleForList",B.useNormalStyleForList));if(B.doNotUseIndentAsNumberingTabStop)this.root.push(new V0("w:doNotUseIndentAsNumberingTabStop",B.doNotUseIndentAsNumberingTabStop));if(B.useAlternateEastAsianLineBreakRules)this.root.push(new V0("w:useAltKinsokuLineBreakRules",B.useAlternateEastAsianLineBreakRules));if(B.allowSpaceOfSameStyleInTable)this.root.push(new V0("w:allowSpaceOfSameStyleInTable",B.allowSpaceOfSameStyleInTable));if(B.doNotSuppressIndentation)this.root.push(new V0("w:doNotSuppressIndentation",B.doNotSuppressIndentation));if(B.doNotAutofitConstrainedTables)this.root.push(new V0("w:doNotAutofitConstrainedTables",B.doNotAutofitConstrainedTables));if(B.autofitToFirstFixedWidthCell)this.root.push(new V0("w:autofitToFirstFixedWidthCell",B.autofitToFirstFixedWidthCell));if(B.underlineTabInNumberingList)this.root.push(new V0("w:underlineTabInNumList",B.underlineTabInNumberingList));if(B.displayHangulFixedWidth)this.root.push(new V0("w:displayHangulFixedWidth",B.displayHangulFixedWidth));if(B.splitPgBreakAndParaMark)this.root.push(new V0("w:splitPgBreakAndParaMark",B.splitPgBreakAndParaMark));if(B.doNotVerticallyAlignCellWithSp)this.root.push(new V0("w:doNotVertAlignCellWithSp",B.doNotVerticallyAlignCellWithSp));if(B.doNotBreakConstrainedForcedTable)this.root.push(new V0("w:doNotBreakConstrainedForcedTable",B.doNotBreakConstrainedForcedTable));if(B.ignoreVerticalAlignmentInTextboxes)this.root.push(new V0("w:doNotVertAlignInTxbx",B.ignoreVerticalAlignmentInTextboxes));if(B.useAnsiKerningPairs)this.root.push(new V0("w:useAnsiKerningPairs",B.useAnsiKerningPairs));if(B.cachedColumnBalance)this.root.push(new V0("w:cachedColBalance",B.cachedColumnBalance))}},yJ=class extends O0{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"})}},gJ=class extends t{constructor(B){var U,G,Y,Q,J,Z,K,V;super("w:settings");if(this.root.push(new yJ({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 V0("w:displayBackgroundShape",!0)),B.trackRevisions!==void 0)this.root.push(new V0("w:trackRevisions",B.trackRevisions));if(B.evenAndOddHeaders!==void 0)this.root.push(new V0("w:evenAndOddHeaders",B.evenAndOddHeaders));if(B.updateFields!==void 0)this.root.push(new V0("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 V0("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 V0("w:doNotHyphenateCaps",B.hyphenation.doNotHyphenateCaps));this.root.push(new vJ(M0(M0({},(J=B.compatibility)!==null&&J!==void 0?J:{}),{},{version:(Z=(K=(V=B.compatibility)===null||V===void 0?void 0:V.version)!==null&&K!==void 0?K:B.compatibilityModeVersion)!==null&&Z!==void 0?Z:15})))}},cU=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w:val"})}},fJ=class extends t{constructor(B){super("w:name");this.root.push(new cU({val:B}))}},xJ=class extends t{constructor(B){super("w:uiPriority");this.root.push(new cU({val:D0(B)}))}},_J=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},mU=class extends t{constructor(B,U){super("w:style");if(this.root.push(new _J(B)),U.name)this.root.push(new fJ(U.name));if(U.basedOn)this.root.push(new V2("w:basedOn",U.basedOn));if(U.next)this.root.push(new V2("w:next",U.next));if(U.link)this.root.push(new V2("w:link",U.link));if(U.uiPriority!==void 0)this.root.push(new xJ(U.uiPriority));if(U.semiHidden!==void 0)this.root.push(new V0("w:semiHidden",U.semiHidden));if(U.unhideWhenUsed!==void 0)this.root.push(new V0("w:unhideWhenUsed",U.unhideWhenUsed));if(U.quickFormat!==void 0)this.root.push(new V0("w:qFormat",U.quickFormat))}},p2=class extends mU{constructor(B){super({type:"paragraph",styleId:B.id},B);e(this,"paragraphProperties",void 0),e(this,"runProperties",void 0),this.paragraphProperties=new w2(B.paragraph),this.runProperties=new U2(B.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},$2=class extends mU{constructor(B){super({type:"character",styleId:B.id},M0({uiPriority:99,unhideWhenUsed:!0},B));e(this,"runProperties",void 0),this.runProperties=new U2(B.run),this.root.push(this.runProperties)}},P2=class extends p2{constructor(B){super(M0({basedOn:"Normal",next:"Normal",quickFormat:!0},B))}},hJ=class extends P2{constructor(B){super(M0({id:"Title",name:"Title"},B))}},uJ=class extends P2{constructor(B){super(M0({id:"Heading1",name:"Heading 1"},B))}},dJ=class extends P2{constructor(B){super(M0({id:"Heading2",name:"Heading 2"},B))}},cJ=class extends P2{constructor(B){super(M0({id:"Heading3",name:"Heading 3"},B))}},mJ=class extends P2{constructor(B){super(M0({id:"Heading4",name:"Heading 4"},B))}},lJ=class extends P2{constructor(B){super(M0({id:"Heading5",name:"Heading 5"},B))}},aJ=class extends P2{constructor(B){super(M0({id:"Heading6",name:"Heading 6"},B))}},pJ=class extends P2{constructor(B){super(M0({id:"Strong",name:"Strong"},B))}},rJ=class extends p2{constructor(B){super(M0({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},B))}},iJ=class extends p2{constructor(B){super(M0({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))}},nJ=class extends $2{constructor(B){super(M0({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},sJ=class extends $2{constructor(B){super(M0({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},B))}},oJ=class extends p2{constructor(B){super(M0({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))}},tJ=class extends $2{constructor(B){super(M0({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},B))}},eJ=class extends $2{constructor(B){super(M0({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},B))}},BK=class extends $2{constructor(B){super(M0({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:r6.SINGLE}}},B))}},$1=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))}},lU=class extends t{constructor(B){super("w:pPrDefault");this.root.push(new w2(B))}},aU=class extends t{constructor(B){super("w:rPrDefault");this.root.push(new U2(B))}},pU=class extends t{constructor(B){super("w:docDefaults");e(this,"runPropertiesDefaults",void 0),e(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new aU(B.run),this.paragraphPropertiesDefaults=new lU(B.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},UK=class{newInstance(B){let U=_1.xml2js(B,{compact:!1}),G;for(let Q of U.elements||[])if(Q.name==="w:styles")G=Q;if(G===void 0)throw new Error("can not find styles element");let Y=G.elements||[];return{initialStyles:new $B(G.attributes),importedStyles:Y.map((Q)=>h1(Q))}}},V6=class{newInstance(B={}){var U;return{initialStyles:new F1(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new pU((U=B.document)!==null&&U!==void 0?U:{}),new hJ(M0({run:{size:56}},B.title)),new uJ(M0({run:{color:"2E74B5",size:32}},B.heading1)),new dJ(M0({run:{color:"2E74B5",size:26}},B.heading2)),new cJ(M0({run:{color:"1F4D78",size:24}},B.heading3)),new mJ(M0({run:{color:"2E74B5",italics:!0}},B.heading4)),new lJ(M0({run:{color:"2E74B5"}},B.heading5)),new aJ(M0({run:{color:"1F4D78"}},B.heading6)),new pJ(M0({run:{bold:!0}},B.strong)),new rJ(B.listParagraph||{}),new BK(B.hyperlink||{}),new nJ(B.footnoteReference||{}),new iJ(B.footnoteText||{}),new sJ(B.footnoteTextChar||{}),new tJ(B.endnoteReference||{}),new oJ(B.endnoteText||{}),new eJ(B.endnoteTextChar||{})]}}},GK=class{constructor(B){var U,G,Y,Q,J,Z,K,V,H,O,X,D;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 gQ(M0(M0({},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 dU(B.numbering?B.numbering:{config:[]}),this.comments=new N4((Q=B.comments)!==null&&Q!==void 0?Q:{children:[]}),this.comments.ThreadData)this.commentsExtended=new z4(this.comments.ThreadData);if(this.fileRelationships=new W2,this.customProperties=new dQ((J=B.customProperties)!==null&&J!==void 0?J:[]),this.appProperties=new bQ,this.footnotesWrapper=new MJ,this.endnotesWrapper=new JJ,this.contentTypes=new yQ,this.documentWrapper=new BJ({background:B.background}),this.settings=new gJ({compatibilityModeVersion:B.compatabilityModeVersion,compatibility:B.compatibility,evenAndOddHeaders:B.evenAndOddHeaderAndFooters?!0:!1,trackRevisions:(Z=B.features)===null||Z===void 0?void 0:Z.trackRevisions,updateFields:(K=B.features)===null||K===void 0?void 0:K.updateFields,defaultTabStop:B.defaultTabStop,hyphenation:{autoHyphenation:(V=B.hyphenation)===null||V===void 0?void 0:V.autoHyphenation,hyphenationZone:(H=B.hyphenation)===null||H===void 0?void 0:H.hyphenationZone,consecutiveHyphenLimit:(O=B.hyphenation)===null||O===void 0?void 0:O.consecutiveHyphenLimit,doNotHyphenateCaps:(X=B.hyphenation)===null||X===void 0?void 0:X.doNotHyphenateCaps}}),this.media=new K8,B.externalStyles!==void 0){var W;let E=new V6().newInstance((W=B.styles)===null||W===void 0?void 0:W.default),P=new UK().newInstance(B.externalStyles);this.styles=new $1(M0(M0({},P),{},{importedStyles:[...E.importedStyles,...P.importedStyles]}))}else if(B.styles){let E=new V6().newInstance(B.styles.default);this.styles=new $1(M0(M0({},E),B.styles))}else{let E=new V6;this.styles=new $1(E.newInstance())}this.addDefaultRelationships();for(let E of B.sections)this.addSection(E);if(B.footnotes)for(let E in B.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(E),B.footnotes[E].children);if(B.endnotes)for(let E in B.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(E),B.endnotes[E].children);this.fontWrapper=new h4((D=B.fonts)!==null&&D!==void 0?D:[])}addSection({headers:B={},footers:U={},children:G,properties:Y}){this.documentWrapper.View.Body.addSection(M0(M0({},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 _U(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addHeaderToDocument(U),U}createFooter(B){let U=new fU(this.media,this.currentRelationshipId++);for(let G of B.options.children)U.add(G);return this.addFooterToDocument(U),U}addHeaderToDocument(B,U=D2.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=D2.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}},YK=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)}},rU=class extends t{constructor(){super("w:sdtContent")}},iU=class extends t{constructor(B){super("w:sdtPr");if(B)this.root.push(new V2("w:alias",B))}};function ZK(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 nU(B,U){if(B==null)return{};var G,Y,Q=ZK(B,U);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(B);for(Y=0;Y0){let{stylesWithLevels:H}=J,O=Y.map((D,W)=>{var E,P;let z=this.buildCachedContentParagraphChild(D,J),C=(E=H===null||H===void 0||(P=H.find((v)=>v.level===D.level))===null||P===void 0?void 0:P.styleName)!==null&&E!==void 0?E:`TOC${D.level}`,A=W===0?[...K,z]:W===Y.length-1?[z,...V]:[z];return new d0({style:C,tabStops:this.getTabStopsForLevel(D.level),children:A})}),X=O;if(Y.length<=1)X=[...O,new d0({children:V})];for(let D of X)Z.addChildElement(D)}else{let H=new d0({children:K});Z.addChildElement(H);for(let X of G)Z.addChildElement(X);let O=new d0({children:V});Z.addChildElement(O)}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 T0({style:(U===null||U===void 0?void 0:U.hyperlink)&&B.href!==void 0?"IndexLink":void 0,children:[new Z1({text:B.title}),new D4,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}},KK=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}},qK=class{constructor(B={children:[]}){e(this,"options",void 0),this.options=B}},sU=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},oU=class extends t{constructor(B){super("w:footnoteReference");this.root.push(new sU({id:B}))}},VK=class extends T0{constructor(B){super({style:"FootnoteReference"});this.root.push(new oU(B))}},tU=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{id:"w:id"})}},eU=class extends t{constructor(B){super("w:endnoteReference");this.root.push(new tU({id:B}))}},wK=class extends T0{constructor(B){super({style:"EndnoteReference"});this.root.push(new eU(B))}},o8=class extends O0{constructor(...B){super(...B);e(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},S1=class extends t{constructor(B,U,G){super(B);if(G)this.root.push(new o8({val:SB(U),symbolfont:G}));else this.root.push(new o8({val:U}))}},B9=class extends t{constructor(B){var U,G,Y,Q,J,Z,K,V;super("w14:checkbox");e(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),e(this,"DEFAULT_CHECKED_SYMBOL","2612"),e(this,"DEFAULT_FONT","MS Gothic");let H=(B===null||B===void 0?void 0:B.checked)?"1":"0",O,X;this.root.push(new S1("w14:checked",H)),O=(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,X=(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 S1("w14:checkedState",O,X)),O=(B===null||B===void 0||(J=B.uncheckedState)===null||J===void 0?void 0:J.value)?B===null||B===void 0||(Z=B.uncheckedState)===null||Z===void 0?void 0:Z.value:this.DEFAULT_UNCHECKED_SYMBOL,X=(B===null||B===void 0||(K=B.uncheckedState)===null||K===void 0?void 0:K.font)?B===null||B===void 0||(V=B.uncheckedState)===null||V===void 0?void 0:V.font:this.DEFAULT_FONT,this.root.push(new S1("w14:uncheckedState",O,X))}},LK=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 J=new iU(B===null||B===void 0?void 0:B.alias);J.addChildElement(new B9(B)),this.root.push(J);let Z=new rU,K=B===null||B===void 0||(U=B.checkedState)===null||U===void 0?void 0:U.font,V=B===null||B===void 0||(G=B.checkedState)===null||G===void 0?void 0:G.value,H=B===null||B===void 0||(Y=B.uncheckedState)===null||Y===void 0?void 0:Y.font,O=B===null||B===void 0||(Q=B.uncheckedState)===null||Q===void 0?void 0:Q.value,X,D;if(B===null||B===void 0?void 0:B.checked)X=K?K:this.DEFAULT_FONT,D=V?V:this.DEFAULT_CHECKED_SYMBOL;else X=H?H:this.DEFAULT_FONT,D=O?O:this.DEFAULT_UNCHECKED_SYMBOL;let W=new aB({char:D,symbolfont:X});Z.addChildElement(W),this.root.push(Z)}},MK=({shape:B})=>new w0({name:"w:pict",children:[B]}),XK=({children:B=[]})=>new w0({name:"w:txbxContent",children:B}),RK=({style:B,children:U,inset:G})=>new w0({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:[XK({children:U})]}),OK="#_x0000_t202",FK={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"},HK=(B)=>B?Object.entries(B).map(([U,G])=>`${FK[U]}:${G}`).join(";"):void 0,EK=({id:B,children:U,type:G=OK,style:Y})=>new w0({name:"v:shape",attributes:{id:{key:"id",value:B},type:{key:"type",value:G},style:{key:"style",value:HK(Y)}},children:[RK({style:"mso-fit-shape-to-text:t;",children:U})]}),WK=["style","children"],PK=class extends O1{constructor(B){let{style:U,children:G}=B,Y=nU(B,WK);super("w:p");this.root.push(new w2(Y)),this.root.push(MK({shape:EK({children:G,id:R1(),style:U})}))}},AK=L0((B,U)=>{d2(),E2();/*! + `)+" "+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: `+N.attribValue);else{var Z0=N.tag,g=N.tags[N.tags.length-1]||N;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!="undefined")U.exports=G();else if(typeof define=="function"&&define.amd)define([],G);else(typeof window!="undefined"?window:typeof v0!="undefined"?v0:typeof self!="undefined"?self:this).JSZip=G()})(function(){return function G(Y,Q,J){function Z(H,O){if(!Q[H]){if(!Y[H]){var X=typeof j1=="function"&&j1;if(!O&&X)return X(H,!0);if(K)return K(H,!0);var D=new Error("Cannot find module '"+H+"'");throw D.code="MODULE_NOT_FOUND",D}var W=Q[H]={exports:{}};Y[H][0].call(W.exports,function(E){var P=Y[H][1][E];return Z(P||E)},W,W.exports,G,Y,Q,J)}return Q[H].exports}for(var K=typeof j1=="function"&&j1,V=0;V>2,W=(3&H)<<4|O>>4,E=1>6:64,P=2>4,O=(15&D)<<4|(W=K.indexOf(V.charAt(P++)))>>2,X=(3&W)<<6|(E=K.indexOf(V.charAt(P++))),A[z++]=H,W!==64&&(A[z++]=O),E!==64&&(A[z++]=X);return A}},{"./support":30,"./utils":32}],2:[function(G,Y,Q){var J=G("./external"),Z=G("./stream/DataWorker"),K=G("./stream/Crc32Probe"),V=G("./stream/DataLengthProbe");function H(O,X,D,W,E){this.compressedSize=O,this.uncompressedSize=X,this.crc32=D,this.compression=W,this.compressedContent=E}H.prototype={getContentWorker:function(){var O=new Z(J.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new V("data_length")),X=this;return O.on("end",function(){if(this.streamInfo.data_length!==X.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),O},getCompressedWorker:function(){return new Z(J.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},H.createWorkerFrom=function(O,X,D){return O.pipe(new K).pipe(new V("uncompressedSize")).pipe(X.compressWorker(D)).pipe(new V("compressedSize")).withStreamInfo("compression",X)},Y.exports=H},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(G,Y,Q){var J=G("./stream/GenericWorker");Q.STORE={magic:"\x00\x00",compressWorker:function(){return new J("STORE compression")},uncompressWorker:function(){return new J("STORE decompression")}},Q.DEFLATE=G("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(G,Y,Q){var J=G("./utils"),Z=function(){for(var K,V=[],H=0;H<256;H++){K=H;for(var O=0;O<8;O++)K=1&K?3988292384^K>>>1:K>>>1;V[H]=K}return V}();Y.exports=function(K,V){return K!==void 0&&K.length?J.getTypeOf(K)!=="string"?function(H,O,X,D){var W=Z,E=D+X;H^=-1;for(var P=D;P>>8^W[255&(H^O[P])];return-1^H}(0|V,K,K.length,0):function(H,O,X,D){var W=Z,E=D+X;H^=-1;for(var P=D;P>>8^W[255&(H^O.charCodeAt(P))];return-1^H}(0|V,K,K.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 J=null;J=typeof Promise!="undefined"?Promise:G("lie"),Y.exports={Promise:J}},{lie:37}],7:[function(G,Y,Q){var J=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",Z=G("pako"),K=G("./utils"),V=G("./stream/GenericWorker"),H=J?"uint8array":"array";function O(X,D){V.call(this,"FlateWorker/"+X),this._pako=null,this._pakoAction=X,this._pakoOptions=D,this.meta={}}Q.magic="\b\x00",K.inherits(O,V),O.prototype.processChunk=function(X){this.meta=X.meta,this._pako===null&&this._createPako(),this._pako.push(K.transformTo(H,X.data),!1)},O.prototype.flush=function(){V.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},O.prototype.cleanUp=function(){V.prototype.cleanUp.call(this),this._pako=null},O.prototype._createPako=function(){this._pako=new Z[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var X=this;this._pako.onData=function(D){X.push({data:D,meta:X.meta})}},Q.compressWorker=function(X){return new O("Deflate",X)},Q.uncompressWorker=function(){return new O("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(G,Y,Q){function J(W,E){var P,z="";for(P=0;P>>=8;return z}function Z(W,E,P,z,C,A){var v,S,F=W.file,w=W.compression,$=A!==H.utf8encode,x=K.transformTo("string",A(F.name)),j=K.transformTo("string",H.utf8encode(F.name)),a=F.comment,U0=K.transformTo("string",A(a)),b=K.transformTo("string",H.utf8encode(a)),c=j.length!==F.name.length,T=b.length!==a.length,m="",B0="",i="",I0=F.dir,s=F.date,G0={crc32:0,compressedSize:0,uncompressedSize:0};E&&!P||(G0.crc32=W.crc32,G0.compressedSize=W.compressedSize,G0.uncompressedSize=W.uncompressedSize);var r=0;E&&(r|=8),$||!c&&!T||(r|=2048);var y=0,n=0;I0&&(y|=16),C==="UNIX"?(n=798,y|=function(Y0,R0){var N=Y0;return Y0||(N=R0?16893:33204),(65535&N)<<16}(F.unixPermissions,I0)):(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=J(1,1)+J(O(x),4)+j,m+="up"+J(B0.length,2)+B0),T&&(i=J(1,1)+J(O(U0),4)+b,m+="uc"+J(i.length,2)+i);var o="";return o+=` -\x00`,o+=J(r,2),o+=w.magic,o+=J(v,2),o+=J(S,2),o+=J(G0.crc32,4),o+=J(G0.compressedSize,4),o+=J(G0.uncompressedSize,4),o+=J(x.length,2),o+=J(m.length,2),{fileRecord:X.LOCAL_FILE_HEADER+o+x+m,dirRecord:X.CENTRAL_FILE_HEADER+J(n,2)+o+J(U0.length,2)+"\x00\x00\x00\x00"+J(y,4)+J(z,4)+x+m+U0}}var K=G("../utils"),V=G("../stream/GenericWorker"),H=G("../utf8"),O=G("../crc32"),X=G("../signature");function D(W,E,P,z){V.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=E,this.zipPlatform=P,this.encodeFileName=z,this.streamFiles=W,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}K.inherits(D,V),D.prototype.push=function(W){var E=W.meta.percent||0,P=this.entriesCount,z=this._sources.length;this.accumulate?this.contentBuffer.push(W):(this.bytesWritten+=W.data.length,V.prototype.push.call(this,{data:W.data,meta:{currentFile:this.currentFile,percent:P?(E+100*(P-z-1))/P:100}}))},D.prototype.openedSource=function(W){this.currentSourceOffset=this.bytesWritten,this.currentFile=W.file.name;var E=this.streamFiles&&!W.file.dir;if(E){var P=Z(W,E,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:P.fileRecord,meta:{percent:0}})}else this.accumulate=!0},D.prototype.closedSource=function(W){this.accumulate=!1;var E=this.streamFiles&&!W.file.dir,P=Z(W,E,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(P.dirRecord),E)this.push({data:function(z){return X.DATA_DESCRIPTOR+J(z.crc32,4)+J(z.compressedSize,4)+J(z.uncompressedSize,4)}(W),meta:{percent:100}});else for(this.push({data:P.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},D.prototype.flush=function(){for(var W=this.bytesWritten,E=0;E=this.index;V--)H=(H<<8)+this.byteAt(V);return this.index+=K,H},readString:function(K){return J.transformTo("string",this.readData(K))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var K=this.readInt(4);return new Date(Date.UTC(1980+(K>>25&127),(K>>21&15)-1,K>>16&31,K>>11&31,K>>5&63,(31&K)<<1))}},Y.exports=Z},{"../utils":32}],19:[function(G,Y,Q){var J=G("./Uint8ArrayReader");function Z(K){J.call(this,K)}G("../utils").inherits(Z,J),Z.prototype.readData=function(K){this.checkOffset(K);var V=this.data.slice(this.zero+this.index,this.zero+this.index+K);return this.index+=K,V},Y.exports=Z},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(G,Y,Q){var J=G("./DataReader");function Z(K){J.call(this,K)}G("../utils").inherits(Z,J),Z.prototype.byteAt=function(K){return this.data.charCodeAt(this.zero+K)},Z.prototype.lastIndexOfSignature=function(K){return this.data.lastIndexOf(K)-this.zero},Z.prototype.readAndCheckSignature=function(K){return K===this.readData(4)},Z.prototype.readData=function(K){this.checkOffset(K);var V=this.data.slice(this.zero+this.index,this.zero+this.index+K);return this.index+=K,V},Y.exports=Z},{"../utils":32,"./DataReader":18}],21:[function(G,Y,Q){var J=G("./ArrayReader");function Z(K){J.call(this,K)}G("../utils").inherits(Z,J),Z.prototype.readData=function(K){if(this.checkOffset(K),K===0)return new Uint8Array(0);var V=this.data.subarray(this.zero+this.index,this.zero+this.index+K);return this.index+=K,V},Y.exports=Z},{"../utils":32,"./ArrayReader":17}],22:[function(G,Y,Q){var J=G("../utils"),Z=G("../support"),K=G("./ArrayReader"),V=G("./StringReader"),H=G("./NodeBufferReader"),O=G("./Uint8ArrayReader");Y.exports=function(X){var D=J.getTypeOf(X);return J.checkSupport(D),D!=="string"||Z.uint8array?D==="nodebuffer"?new H(X):Z.uint8array?new O(J.transformTo("uint8array",X)):new K(J.transformTo("array",X)):new V(X)}},{"../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 J=G("./GenericWorker"),Z=G("../utils");function K(V){J.call(this,"ConvertWorker to "+V),this.destType=V}Z.inherits(K,J),K.prototype.processChunk=function(V){this.push({data:Z.transformTo(this.destType,V.data),meta:V.meta})},Y.exports=K},{"../utils":32,"./GenericWorker":28}],25:[function(G,Y,Q){var J=G("./GenericWorker"),Z=G("../crc32");function K(){J.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}G("../utils").inherits(K,J),K.prototype.processChunk=function(V){this.streamInfo.crc32=Z(V.data,this.streamInfo.crc32||0),this.push(V)},Y.exports=K},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(G,Y,Q){var J=G("../utils"),Z=G("./GenericWorker");function K(V){Z.call(this,"DataLengthProbe for "+V),this.propName=V,this.withStreamInfo(V,0)}J.inherits(K,Z),K.prototype.processChunk=function(V){if(V){var H=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=H+V.data.length}Z.prototype.processChunk.call(this,V)},Y.exports=K},{"../utils":32,"./GenericWorker":28}],27:[function(G,Y,Q){var J=G("../utils"),Z=G("./GenericWorker");function K(V){Z.call(this,"DataWorker");var H=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,V.then(function(O){H.dataIsReady=!0,H.data=O,H.max=O&&O.length||0,H.type=J.getTypeOf(O),H.isPaused||H._tickAndRepeat()},function(O){H.error(O)})}J.inherits(K,Z),K.prototype.cleanUp=function(){Z.prototype.cleanUp.call(this),this.data=null},K.prototype.resume=function(){return!!Z.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,J.delay(this._tickAndRepeat,[],this)),!0)},K.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(J.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},K.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var V=null,H=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":V=this.data.substring(this.index,H);break;case"uint8array":V=this.data.subarray(this.index,H);break;case"array":case"nodebuffer":V=this.data.slice(this.index,H)}return this.index=H,this.push({data:V,meta:{percent:this.max?this.index/this.max*100:0}})},Y.exports=K},{"../utils":32,"./GenericWorker":28}],28:[function(G,Y,Q){function J(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}J.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,K){return this._listeners[Z].push(K),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Z,K){if(this._listeners[Z])for(var V=0;V "+Z:Z}},Y.exports=J},{}],29:[function(G,Y,Q){var J=G("../utils"),Z=G("./ConvertWorker"),K=G("./GenericWorker"),V=G("../base64"),H=G("../support"),O=G("../external"),X=null;if(H.nodestream)try{X=G("../nodejs/NodejsStreamOutputAdapter")}catch(E){}function D(E,P){return new O.Promise(function(z,C){var A=[],v=E._internalType,S=E._outputType,F=E._mimeType;E.on("data",function(w,$){A.push(w),P&&P($)}).on("error",function(w){A=[],C(w)}).on("end",function(){try{z(function(w,$,x){switch(w){case"blob":return J.newBlob(J.transformTo("arraybuffer",$),x);case"base64":return V.encode($);default:return J.transformTo(w,$)}}(S,function(w,$){var x,j=0,a=null,U0=0;for(x=0;x<$.length;x++)U0+=$[x].length;switch(w){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],j),j+=$[x].length;return a;case"nodebuffer":return Buffer.concat($);default:throw new Error("concat : unsupported type '"+w+"'")}}(v,A),F))}catch(w){C(w)}A=[]}).resume()})}function W(E,P,z){var C=P;switch(P){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=P,this._mimeType=z,J.checkSupport(C),this._worker=E.pipe(new Z(C)),E.lock()}catch(A){this._worker=new K("error"),this._worker.error(A)}}W.prototype={accumulate:function(E){return D(this,E)},on:function(E,P){var z=this;return E==="data"?this._worker.on(E,function(C){P.call(z,C.data,C.meta)}):this._worker.on(E,function(){J.delay(P,arguments,z)}),this},resume:function(){return J.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(E){if(J.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new X(this,{objectMode:this._outputType!=="nodebuffer"},E)}},Y.exports=W},{"../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!="undefined"&&typeof Uint8Array!="undefined",Q.nodebuffer=typeof Buffer!="undefined",Q.uint8array=typeof Uint8Array!="undefined",typeof ArrayBuffer=="undefined")Q.blob=!1;else{var J=new ArrayBuffer(0);try{Q.blob=new Blob([J],{type:"application/zip"}).size===0}catch(K){try{var Z=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);Z.append(J),Q.blob=Z.getBlob("application/zip").size===0}catch(V){Q.blob=!1}}}try{Q.nodestream=!!G("readable-stream").Readable}catch(K){Q.nodestream=!1}},{"readable-stream":16}],31:[function(G,Y,Q){for(var J=G("./utils"),Z=G("./support"),K=G("./nodejsUtils"),V=G("./stream/GenericWorker"),H=new Array(256),O=0;O<256;O++)H[O]=252<=O?6:248<=O?5:240<=O?4:224<=O?3:192<=O?2:1;H[254]=H[254]=1;function X(){V.call(this,"utf-8 decode"),this.leftOver=null}function D(){V.call(this,"utf-8 encode")}Q.utf8encode=function(W){return Z.nodebuffer?K.newBufferFrom(W,"utf-8"):function(E){var P,z,C,A,v,S=E.length,F=0;for(A=0;A>>6:(z<65536?P[v++]=224|z>>>12:(P[v++]=240|z>>>18,P[v++]=128|z>>>12&63),P[v++]=128|z>>>6&63),P[v++]=128|63&z);return P}(W)},Q.utf8decode=function(W){return Z.nodebuffer?J.transformTo("nodebuffer",W).toString("utf-8"):function(E){var P,z,C,A,v=E.length,S=new Array(2*v);for(P=z=0;P>10&1023,S[z++]=56320|1023&C)}return S.length!==z&&(S.subarray?S=S.subarray(0,z):S.length=z),J.applyFromCharCode(S)}(W=J.transformTo(Z.uint8array?"uint8array":"array",W))},J.inherits(X,V),X.prototype.processChunk=function(W){var E=J.transformTo(Z.uint8array?"uint8array":"array",W.data);if(this.leftOver&&this.leftOver.length){if(Z.uint8array){var P=E;(E=new Uint8Array(P.length+this.leftOver.length)).set(this.leftOver,0),E.set(P,this.leftOver.length)}else E=this.leftOver.concat(E);this.leftOver=null}var z=function(A,v){var S;for((v=v||A.length)>A.length&&(v=A.length),S=v-1;0<=S&&(192&A[S])==128;)S--;return S<0?v:S===0?v:S+H[A[S]]>v?S:v}(E),C=E;z!==E.length&&(Z.uint8array?(C=E.subarray(0,z),this.leftOver=E.subarray(z,E.length)):(C=E.slice(0,z),this.leftOver=E.slice(z,E.length))),this.push({data:Q.utf8decode(C),meta:W.meta})},X.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:Q.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},Q.Utf8DecodeWorker=X,J.inherits(D,V),D.prototype.processChunk=function(W){this.push({data:Q.utf8encode(W.data),meta:W.meta})},Q.Utf8EncodeWorker=D},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(G,Y,Q){var J=G("./support"),Z=G("./base64"),K=G("./nodejsUtils"),V=G("./external");function H(P){return P}function O(P,z){for(var C=0;C>8;this.dir=!!(16&this.externalFileAttributes),W==0&&(this.dosPermissions=63&this.externalFileAttributes),W==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var W=J(this.extraFields[1].value);this.uncompressedSize===Z.MAX_VALUE_32BITS&&(this.uncompressedSize=W.readInt(8)),this.compressedSize===Z.MAX_VALUE_32BITS&&(this.compressedSize=W.readInt(8)),this.localHeaderOffset===Z.MAX_VALUE_32BITS&&(this.localHeaderOffset=W.readInt(8)),this.diskNumberStart===Z.MAX_VALUE_32BITS&&(this.diskNumberStart=W.readInt(4))}},readExtraFields:function(W){var E,P,z,C=W.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});W.index+4>>6:(W<65536?D[z++]=224|W>>>12:(D[z++]=240|W>>>18,D[z++]=128|W>>>12&63),D[z++]=128|W>>>6&63),D[z++]=128|63&W);return D},Q.buf2binstring=function(X){return O(X,X.length)},Q.binstring2buf=function(X){for(var D=new J.Buf8(X.length),W=0,E=D.length;W>10&1023,A[E++]=56320|1023&P)}return O(A,E)},Q.utf8border=function(X,D){var W;for((D=D||X.length)>X.length&&(D=X.length),W=D-1;0<=W&&(192&X[W])==128;)W--;return W<0?D:W===0?D:W+V[X[W]]>D?W:D}},{"./common":41}],43:[function(G,Y,Q){Y.exports=function(J,Z,K,V){for(var H=65535&J|0,O=J>>>16&65535|0,X=0;K!==0;){for(K-=X=2000>>1:Z>>>1;K[V]=Z}return K}();Y.exports=function(Z,K,V,H){var O=J,X=H+V;Z^=-1;for(var D=H;D>>8^O[255&(Z^K[D])];return-1^Z}},{}],46:[function(G,Y,Q){var J,Z=G("../utils/common"),K=G("./trees"),V=G("./adler32"),H=G("./crc32"),O=G("./messages"),X=0,D=4,W=0,E=-2,P=-1,z=4,C=2,A=8,v=9,S=286,F=30,w=19,$=2*S+1,x=15,j=3,a=258,U0=a+j+1,b=42,c=113,T=1,m=2,B0=3,i=4;function I0(L,p){return L.msg=O[p],p}function s(L){return(L<<1)-(4L.avail_out&&(k=L.avail_out),k!==0&&(Z.arraySet(L.output,p.pending_buf,p.pending_out,k,L.next_out),L.next_out+=k,p.pending_out+=k,L.total_out+=k,L.avail_out-=k,p.pending-=k,p.pending===0&&(p.pending_out=0))}function y(L,p){K._tr_flush_block(L,0<=L.block_start?L.block_start:-1,L.strstart-L.block_start,p),L.block_start=L.strstart,r(L.strm)}function n(L,p){L.pending_buf[L.pending++]=p}function o(L,p){L.pending_buf[L.pending++]=p>>>8&255,L.pending_buf[L.pending++]=255&p}function Y0(L,p){var k,I,q=L.max_chain_length,R=L.strstart,_=L.prev_length,l=L.nice_match,d=L.strstart>L.w_size-U0?L.strstart-(L.w_size-U0):0,Q0=L.window,q0=L.w_mask,K0=L.prev,X0=L.strstart+a,F0=Q0[R+_-1],H0=Q0[R+_];L.prev_length>=L.good_match&&(q>>=2),l>L.lookahead&&(l=L.lookahead);do if(Q0[(k=p)+_]===H0&&Q0[k+_-1]===F0&&Q0[k]===Q0[R]&&Q0[++k]===Q0[R+1]){R+=2,k++;do;while(Q0[++R]===Q0[++k]&&Q0[++R]===Q0[++k]&&Q0[++R]===Q0[++k]&&Q0[++R]===Q0[++k]&&Q0[++R]===Q0[++k]&&Q0[++R]===Q0[++k]&&Q0[++R]===Q0[++k]&&Q0[++R]===Q0[++k]&&Rd&&--q!=0);return _<=L.lookahead?_:L.lookahead}function R0(L){var p,k,I,q,R,_,l,d,Q0,q0,K0=L.w_size;do{if(q=L.window_size-L.lookahead-L.strstart,L.strstart>=K0+(K0-U0)){for(Z.arraySet(L.window,L.window,K0,K0,0),L.match_start-=K0,L.strstart-=K0,L.block_start-=K0,p=k=L.hash_size;I=L.head[--p],L.head[p]=K0<=I?I-K0:0,--k;);for(p=k=K0;I=L.prev[--p],L.prev[p]=K0<=I?I-K0:0,--k;);q+=K0}if(L.strm.avail_in===0)break;if(_=L.strm,l=L.window,d=L.strstart+L.lookahead,Q0=q,q0=void 0,q0=_.avail_in,Q0=j)for(R=L.strstart-L.insert,L.ins_h=L.window[R],L.ins_h=(L.ins_h<=j&&(L.ins_h=(L.ins_h<=j)if(I=K._tr_tally(L,L.strstart-L.match_start,L.match_length-j),L.lookahead-=L.match_length,L.match_length<=L.max_lazy_match&&L.lookahead>=j){for(L.match_length--;L.strstart++,L.ins_h=(L.ins_h<=j&&(L.ins_h=(L.ins_h<=j&&L.match_length<=L.prev_length){for(q=L.strstart+L.lookahead-j,I=K._tr_tally(L,L.strstart-1-L.prev_match,L.prev_length-j),L.lookahead-=L.prev_length-1,L.prev_length-=2;++L.strstart<=q&&(L.ins_h=(L.ins_h<L.pending_buf_size-5&&(k=L.pending_buf_size-5);;){if(L.lookahead<=1){if(R0(L),L.lookahead===0&&p===X)return T;if(L.lookahead===0)break}L.strstart+=L.lookahead,L.lookahead=0;var I=L.block_start+k;if((L.strstart===0||L.strstart>=I)&&(L.lookahead=L.strstart-I,L.strstart=I,y(L,!1),L.strm.avail_out===0))return T;if(L.strstart-L.block_start>=L.w_size-U0&&(y(L,!1),L.strm.avail_out===0))return T}return L.insert=0,p===D?(y(L,!0),L.strm.avail_out===0?B0:i):(L.strstart>L.block_start&&(y(L,!1),L.strm.avail_out),T)}),new u(4,4,8,4,N),new u(4,5,16,8,N),new u(4,6,32,32,N),new u(4,4,16,16,M),new u(8,16,32,32,M),new u(8,16,128,128,M),new u(8,32,128,256,M),new u(32,128,258,1024,M),new u(32,258,258,4096,M)],Q.deflateInit=function(L,p){return f(L,p,A,15,8,0)},Q.deflateInit2=f,Q.deflateReset=g,Q.deflateResetKeep=Z0,Q.deflateSetHeader=function(L,p){return L&&L.state?L.state.wrap!==2?E:(L.state.gzhead=p,W):E},Q.deflate=function(L,p){var k,I,q,R;if(!L||!L.state||5>8&255),n(I,I.gzhead.time>>16&255),n(I,I.gzhead.time>>24&255),n(I,I.level===9?2:2<=I.strategy||I.level<2?4:0),n(I,255&I.gzhead.os),I.gzhead.extra&&I.gzhead.extra.length&&(n(I,255&I.gzhead.extra.length),n(I,I.gzhead.extra.length>>8&255)),I.gzhead.hcrc&&(L.adler=H(L.adler,I.pending_buf,I.pending,0)),I.gzindex=0,I.status=69):(n(I,0),n(I,0),n(I,0),n(I,0),n(I,0),n(I,I.level===9?2:2<=I.strategy||I.level<2?4:0),n(I,3),I.status=c);else{var _=A+(I.w_bits-8<<4)<<8;_|=(2<=I.strategy||I.level<2?0:I.level<6?1:I.level===6?2:3)<<6,I.strstart!==0&&(_|=32),_+=31-_%31,I.status=c,o(I,_),I.strstart!==0&&(o(I,L.adler>>>16),o(I,65535&L.adler)),L.adler=1}if(I.status===69)if(I.gzhead.extra){for(q=I.pending;I.gzindex<(65535&I.gzhead.extra.length)&&(I.pending!==I.pending_buf_size||(I.gzhead.hcrc&&I.pending>q&&(L.adler=H(L.adler,I.pending_buf,I.pending-q,q)),r(L),q=I.pending,I.pending!==I.pending_buf_size));)n(I,255&I.gzhead.extra[I.gzindex]),I.gzindex++;I.gzhead.hcrc&&I.pending>q&&(L.adler=H(L.adler,I.pending_buf,I.pending-q,q)),I.gzindex===I.gzhead.extra.length&&(I.gzindex=0,I.status=73)}else I.status=73;if(I.status===73)if(I.gzhead.name){q=I.pending;do{if(I.pending===I.pending_buf_size&&(I.gzhead.hcrc&&I.pending>q&&(L.adler=H(L.adler,I.pending_buf,I.pending-q,q)),r(L),q=I.pending,I.pending===I.pending_buf_size)){R=1;break}R=I.gzindexq&&(L.adler=H(L.adler,I.pending_buf,I.pending-q,q)),R===0&&(I.gzindex=0,I.status=91)}else I.status=91;if(I.status===91)if(I.gzhead.comment){q=I.pending;do{if(I.pending===I.pending_buf_size&&(I.gzhead.hcrc&&I.pending>q&&(L.adler=H(L.adler,I.pending_buf,I.pending-q,q)),r(L),q=I.pending,I.pending===I.pending_buf_size)){R=1;break}R=I.gzindexq&&(L.adler=H(L.adler,I.pending_buf,I.pending-q,q)),R===0&&(I.status=103)}else I.status=103;if(I.status===103&&(I.gzhead.hcrc?(I.pending+2>I.pending_buf_size&&r(L),I.pending+2<=I.pending_buf_size&&(n(I,255&L.adler),n(I,L.adler>>8&255),L.adler=0,I.status=c)):I.status=c),I.pending!==0){if(r(L),L.avail_out===0)return I.last_flush=-1,W}else if(L.avail_in===0&&s(p)<=s(k)&&p!==D)return I0(L,-5);if(I.status===666&&L.avail_in!==0)return I0(L,-5);if(L.avail_in!==0||I.lookahead!==0||p!==X&&I.status!==666){var l=I.strategy===2?function(d,Q0){for(var q0;;){if(d.lookahead===0&&(R0(d),d.lookahead===0)){if(Q0===X)return T;break}if(d.match_length=0,q0=K._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++,q0&&(y(d,!1),d.strm.avail_out===0))return T}return d.insert=0,Q0===D?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?T:m}(I,p):I.strategy===3?function(d,Q0){for(var q0,K0,X0,F0,H0=d.window;;){if(d.lookahead<=a){if(R0(d),d.lookahead<=a&&Q0===X)return T;if(d.lookahead===0)break}if(d.match_length=0,d.lookahead>=j&&0d.lookahead&&(d.match_length=d.lookahead)}if(d.match_length>=j?(q0=K._tr_tally(d,1,d.match_length-j),d.lookahead-=d.match_length,d.strstart+=d.match_length,d.match_length=0):(q0=K._tr_tally(d,0,d.window[d.strstart]),d.lookahead--,d.strstart++),q0&&(y(d,!1),d.strm.avail_out===0))return T}return d.insert=0,Q0===D?(y(d,!0),d.strm.avail_out===0?B0:i):d.last_lit&&(y(d,!1),d.strm.avail_out===0)?T:m}(I,p):J[I.level].func(I,p);if(l!==B0&&l!==i||(I.status=666),l===T||l===B0)return L.avail_out===0&&(I.last_flush=-1),W;if(l===m&&(p===1?K._tr_align(I):p!==5&&(K._tr_stored_block(I,0,0,!1),p===3&&(G0(I.head),I.lookahead===0&&(I.strstart=0,I.block_start=0,I.insert=0))),r(L),L.avail_out===0))return I.last_flush=-1,W}return p!==D?W:I.wrap<=0?1:(I.wrap===2?(n(I,255&L.adler),n(I,L.adler>>8&255),n(I,L.adler>>16&255),n(I,L.adler>>24&255),n(I,255&L.total_in),n(I,L.total_in>>8&255),n(I,L.total_in>>16&255),n(I,L.total_in>>24&255)):(o(I,L.adler>>>16),o(I,65535&L.adler)),r(L),0=k.w_size&&(R===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,q0-k.w_size,k.w_size,0),p=Q0,q0=k.w_size),_=L.avail_in,l=L.next_in,d=L.input,L.avail_in=q0,L.next_in=0,L.input=p,R0(k);k.lookahead>=j;){for(I=k.strstart,q=k.lookahead-(j-1);k.ins_h=(k.ins_h<>>=j=x>>>24,v-=j,(j=x>>>16&255)===0)m[O++]=65535&x;else{if(!(16&j)){if((64&j)==0){x=S[(65535&x)+(A&(1<>>=j,v-=j),v<15&&(A+=T[V++]<>>=j=x>>>24,v-=j,!(16&(j=x>>>16&255))){if((64&j)==0){x=F[(65535&x)+(A&(1<>>=j,v-=j,(j=O-X)>3,A&=(1<<(v-=a<<3))-1,J.next_in=V,J.next_out=O,J.avail_in=V>>24&255)+(b>>>8&65280)+((65280&b)<<8)+((255&b)<<24)}function A(){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 J.Buf16(320),this.work=new J.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=E,c.last=0,c.havedict=0,c.dmax=32768,c.head=null,c.hold=0,c.bits=0,c.lencode=c.lendyn=new J.Buf32(P),c.distcode=c.distdyn=new J.Buf32(z),c.sane=1,c.back=-1,D):W}function S(b){var c;return b&&b.state?((c=b.state).wsize=0,c.whave=0,c.wnext=0,v(b)):W}function F(b,c){var T,m;return b&&b.state?(m=b.state,c<0?(T=0,c=-c):(T=1+(c>>4),c<48&&(c&=15)),c&&(c<8||15=i.wsize?(J.arraySet(i.window,c,T-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(m<(B0=i.wsize-i.wnext)&&(B0=m),J.arraySet(i.window,c,T-m,B0,i.wnext),(m-=B0)?(J.arraySet(i.window,c,T-m,m,0),i.wnext=m,i.whave=i.wsize):(i.wnext+=B0,i.wnext===i.wsize&&(i.wnext=0),i.whave>>8&255,T.check=K(T.check,R,2,0),y=r=0,T.mode=2;break}if(T.flags=0,T.head&&(T.head.done=!1),!(1&T.wrap)||(((255&r)<<8)+(r>>8))%31){b.msg="incorrect header check",T.mode=30;break}if((15&r)!=8){b.msg="unknown compression method",T.mode=30;break}if(y-=4,L=8+(15&(r>>>=4)),T.wbits===0)T.wbits=L;else if(L>T.wbits){b.msg="invalid window size",T.mode=30;break}T.dmax=1<>8&1),512&T.flags&&(R[0]=255&r,R[1]=r>>>8&255,T.check=K(T.check,R,2,0)),y=r=0,T.mode=3;case 3:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>8&255,R[2]=r>>>16&255,R[3]=r>>>24&255,T.check=K(T.check,R,4,0)),y=r=0,T.mode=4;case 4:for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>8),512&T.flags&&(R[0]=255&r,R[1]=r>>>8&255,T.check=K(T.check,R,2,0)),y=r=0,T.mode=5;case 5:if(1024&T.flags){for(;y<16;){if(s===0)break B;s--,r+=m[i++]<>>8&255,T.check=K(T.check,R,2,0)),y=r=0}else T.head&&(T.head.extra=null);T.mode=6;case 6:if(1024&T.flags&&(s<(Y0=T.length)&&(Y0=s),Y0&&(T.head&&(L=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),J.arraySet(T.head.extra,m,i,Y0,L)),512&T.flags&&(T.check=K(T.check,m,Y0,i)),s-=Y0,i+=Y0,T.length-=Y0),T.length))break B;T.length=0,T.mode=7;case 7:if(2048&T.flags){if(s===0)break B;for(Y0=0;L=m[i+Y0++],T.head&&L&&T.length<65536&&(T.head.name+=String.fromCharCode(L)),L&&Y0>9&1,T.head.done=!0),b.adler=T.check=0,T.mode=12;break;case 10:for(;y<32;){if(s===0)break B;s--,r+=m[i++]<>>=7&y,y-=7&y,T.mode=27;break}for(;y<3;){if(s===0)break B;s--,r+=m[i++]<>>=1)){case 0:T.mode=14;break;case 1:if(a(T),T.mode=20,c!==6)break;r>>>=2,y-=2;break B;case 2:T.mode=17;break;case 3:b.msg="invalid block type",T.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",T.mode=30;break}if(T.length=65535&r,y=r=0,T.mode=15,c===6)break B;case 15:T.mode=16;case 16:if(Y0=T.length){if(s>>=5,y-=5,T.ndist=1+(31&r),r>>>=5,y-=5,T.ncode=4+(15&r),r>>>=4,y-=4,286>>=3,y-=3}for(;T.have<19;)T.lens[_[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,k={bits:T.lenbits},p=H(0,T.lens,0,19,T.lencode,0,T.work,k),T.lenbits=k.bits,p){b.msg="invalid code lengths set",T.mode=30;break}T.have=0,T.mode=19;case 19:for(;T.have>>16&255,h=65535&q,!((M=q>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=M,y-=M,T.lens[T.have++]=h;else{if(h===16){for(I=M+2;y>>=M,y-=M,T.have===0){b.msg="invalid bit length repeat",T.mode=30;break}L=T.lens[T.have-1],Y0=3+(3&r),r>>>=2,y-=2}else if(h===17){for(I=M+3;y>>=M)),r>>>=3,y-=3}else{for(I=M+7;y>>=M)),r>>>=7,y-=7}if(T.have+Y0>T.nlen+T.ndist){b.msg="invalid bit length repeat",T.mode=30;break}for(;Y0--;)T.lens[T.have++]=L}}if(T.mode===30)break;if(T.lens[256]===0){b.msg="invalid code -- missing end-of-block",T.mode=30;break}if(T.lenbits=9,k={bits:T.lenbits},p=H(O,T.lens,0,T.nlen,T.lencode,0,T.work,k),T.lenbits=k.bits,p){b.msg="invalid literal/lengths set",T.mode=30;break}if(T.distbits=6,T.distcode=T.distdyn,k={bits:T.distbits},p=H(X,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,k),T.distbits=k.bits,p){b.msg="invalid distances set",T.mode=30;break}if(T.mode=20,c===6)break B;case 20:T.mode=21;case 21:if(6<=s&&258<=G0){b.next_out=I0,b.avail_out=G0,b.next_in=i,b.avail_in=s,T.hold=r,T.bits=y,V(b,o),I0=b.next_out,B0=b.output,G0=b.avail_out,i=b.next_in,m=b.input,s=b.avail_in,r=T.hold,y=T.bits,T.mode===12&&(T.back=-1);break}for(T.back=0;u=(q=T.lencode[r&(1<>>16&255,h=65535&q,!((M=q>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&q,!(Z0+(M=q>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,T.back+=Z0}if(r>>>=M,y-=M,T.back+=M,T.length=h,u===0){T.mode=26;break}if(32&u){T.back=-1,T.mode=12;break}if(64&u){b.msg="invalid literal/length code",T.mode=30;break}T.extra=15&u,T.mode=22;case 22:if(T.extra){for(I=T.extra;y>>=T.extra,y-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=23;case 23:for(;u=(q=T.distcode[r&(1<>>16&255,h=65535&q,!((M=q>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>Z0)])>>>16&255,h=65535&q,!(Z0+(M=q>>>24)<=y);){if(s===0)break B;s--,r+=m[i++]<>>=Z0,y-=Z0,T.back+=Z0}if(r>>>=M,y-=M,T.back+=M,64&u){b.msg="invalid distance code",T.mode=30;break}T.offset=h,T.extra=15&u,T.mode=24;case 24:if(T.extra){for(I=T.extra;y>>=T.extra,y-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){b.msg="invalid distance too far back",T.mode=30;break}T.mode=25;case 25:if(G0===0)break B;if(Y0=o-G0,T.offset>Y0){if((Y0=T.offset-Y0)>T.whave&&T.sane){b.msg="invalid distance too far back",T.mode=30;break}R0=Y0>T.wnext?(Y0-=T.wnext,T.wsize-Y0):T.wnext-Y0,Y0>T.length&&(Y0=T.length),N=T.window}else N=B0,R0=I0-T.offset,Y0=T.length;for(G0$?(j=R0[N+z[c]],y[n+z[c]]):(j=96,0),A=1<>I0)+(v-=A)]=x<<24|j<<16|a|0,v!==0;);for(A=1<>=1;if(A!==0?(r&=A-1,r+=A):r=0,c++,--o[b]==0){if(b===m)break;b=X[D+z[c]]}if(B0>>7)]}function n(q,R){q.pending_buf[q.pending++]=255&R,q.pending_buf[q.pending++]=R>>>8&255}function o(q,R,_){q.bi_valid>C-_?(q.bi_buf|=R<>C-q.bi_valid,q.bi_valid+=_-C):(q.bi_buf|=R<>>=1,_<<=1,0<--R;);return _>>>1}function N(q,R,_){var l,d,Q0=new Array(z+1),q0=0;for(l=1;l<=z;l++)Q0[l]=q0=q0+_[l-1]<<1;for(d=0;d<=R;d++){var K0=q[2*d+1];K0!==0&&(q[2*d]=R0(Q0[K0]++,K0))}}function M(q){var R;for(R=0;R>1;1<=_;_--)Z0(q,Q0,_);for(d=X0;_=q.heap[1],q.heap[1]=q.heap[q.heap_len--],Z0(q,Q0,1),l=q.heap[1],q.heap[--q.heap_max]=_,q.heap[--q.heap_max]=l,Q0[2*d]=Q0[2*_]+Q0[2*l],q.depth[d]=(q.depth[_]>=q.depth[l]?q.depth[_]:q.depth[l])+1,Q0[2*_+1]=Q0[2*l+1]=d,q.heap[1]=d++,Z0(q,Q0,1),2<=q.heap_len;);q.heap[--q.heap_max]=q.heap[1],function(H0,k0){var M2,m0,r2,j0,H1,a1,Y2=k0.dyn_tree,M8=k0.max_code,q9=k0.stat_desc.static_tree,V9=k0.stat_desc.has_stree,w9=k0.stat_desc.extra_bits,X8=k0.stat_desc.extra_base,i2=k0.stat_desc.max_length,E1=0;for(j0=0;j0<=z;j0++)H0.bl_count[j0]=0;for(Y2[2*H0.heap[H0.heap_max]+1]=0,M2=H0.heap_max+1;M2>=7;d>>=1)if(1&F0&&K0.dyn_ltree[2*X0]!==0)return Z;if(K0.dyn_ltree[18]!==0||K0.dyn_ltree[20]!==0||K0.dyn_ltree[26]!==0)return K;for(X0=32;X0>>3,(Q0=q.static_len+3+7>>>3)<=d&&(d=Q0)):d=Q0=_+5,_+4<=d&&R!==-1?I(q,R,_,l):q.strategy===4||Q0===d?(o(q,2+(l?1:0),3),g(q,U0,b)):(o(q,4+(l?1:0),3),function(K0,X0,F0,H0){var k0;for(o(K0,X0-257,5),o(K0,F0-1,5),o(K0,H0-4,4),k0=0;k0>>8&255,q.pending_buf[q.d_buf+2*q.last_lit+1]=255&R,q.pending_buf[q.l_buf+q.last_lit]=255&_,q.last_lit++,R===0?q.dyn_ltree[2*_]++:(q.matches++,R--,q.dyn_ltree[2*(T[_]+X+1)]++,q.dyn_dtree[2*y(R)]++),q.last_lit===q.lit_bufsize-1},Q._tr_align=function(q){o(q,2,3),Y0(q,v,U0),function(R){R.bi_valid===16?(n(R,R.bi_buf),R.bi_buf=0,R.bi_valid=0):8<=R.bi_valid&&(R.pending_buf[R.pending++]=255&R.bi_buf,R.bi_buf>>=8,R.bi_valid-=8)}(q)}},{"../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(J){(function(Z,K){if(!Z.setImmediate){var V,H,O,X,D=1,W={},E=!1,P=Z.document,z=Object.getPrototypeOf&&Object.getPrototypeOf(Z);z=z&&z.setTimeout?z:Z,V={}.toString.call(Z.process)==="[object process]"?function(S){E0.nextTick(function(){A(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}}()?(X="setImmediate$"+Math.random()+"$",Z.addEventListener?Z.addEventListener("message",v,!1):Z.attachEvent("onmessage",v),function(S){Z.postMessage(X+S,"*")}):Z.MessageChannel?((O=new MessageChannel).port1.onmessage=function(S){A(S.data)},function(S){O.port2.postMessage(S)}):P&&("onreadystatechange"in P.createElement("script"))?(H=P.documentElement,function(S){var F=P.createElement("script");F.onreadystatechange=function(){A(S),F.onreadystatechange=null,H.removeChild(F),F=null},H.appendChild(F)}):function(S){setTimeout(A,0,S)},z.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var F=new Array(arguments.length-1),w=0;w{var G={"&":"&",'"':""","'":"'","<":"<",">":">"};function Y(Q){return Q&&Q.replace?Q.replace(/([&"<>'])/g,function(J,Z){return G[Z]}):Q}U.exports=Y}),NK=L0((B,U)=>{E2();var G=jK(),Y=f6().Stream,Q=" ";function J(X,D){if(typeof D!=="object")D={indent:D};var W=D.stream?new Y:null,E="",P=!1,z=!D.indent?"":D.indent===!0?Q:D.indent,C=!0;function A($){if(!C)$();else E0.nextTick($)}function v($,x){if(x!==void 0)E+=x;if($&&!P)W=W||new Y,P=!0;if($&&P){var j=E;A(function(){W.emit("data",j)}),E=""}}function S($,x){H(v,V($,z,z?1:0),x)}function F(){if(W){var $=E;A(function(){W.emit("data",$),W.emit("end"),W.readable=!1,W.emit("close")})}}function w($){var x={version:"1.0",encoding:$.encoding||"UTF-8"};if($.standalone)x.standalone=$.standalone;S({"?xml":{_attr:x}}),E=E.replace("/>","?>")}if(A(function(){C=!1}),D.declaration)w(D.declaration);if(X&&X.forEach)X.forEach(function($,x){var j;if(x+1===X.length)j=F;S($,j)});else S(X,F);if(W)return W.readable=!0,W;return E}function Z(){var X={_elem:V(Array.prototype.slice.call(arguments))};return X.push=function(D){if(!this.append)throw new Error("not assigned to a parent!");var W=this,E=this._elem.indent;H(this.append,V(D,E,this._elem.icount+(E?1:0)),function(){W.append(!0)})},X.close=function(D){if(D!==void 0)this.push(D);if(this.end)this.end()},X}function K(X,D){return new Array(D||0).join(X||"")}function V(X,D,W){W=W||0;var E=K(D,W),P,z=X,C=!1;if(typeof X==="object"){if(P=Object.keys(X)[0],z=X[P],z&&z._elem)return z._elem.name=P,z._elem.icount=W,z._elem.indent=D,z._elem.indents=E,z._elem.interrupt=z,z._elem}var A=[],v=[],S;function F(w){Object.keys(w).forEach(function($){A.push(O($,w[$]))})}switch(typeof z){case"object":if(z===null)break;if(z._attr)F(z._attr);if(z._cdata)v.push(("/g,"]]]]>")+"]]>");if(z.forEach){if(S=!1,v.push(""),z.forEach(function(w){if(typeof w=="object")if(Object.keys(w)[0]=="_attr")F(w._attr);else v.push(V(w,D,W+1));else v.pop(),S=!0,v.push(G(w))}),!S)v.push("")}break;default:v.push(G(z))}return{name:P,interrupt:C,attributes:A,content:v,icount:W,indents:E,indent:D}}function H(X,D,W){if(typeof D!="object")return X(!1,D);var E=D.interrupt?1:D.content.length;function P(){while(D.content.length){var C=D.content.shift();if(C===void 0)continue;if(z(C))return;H(X,C)}if(X(!1,(E>1?D.indents:"")+(D.name?"":"")+(D.indent&&!W?` -`:"")),W)W()}function z(C){if(C.interrupt)return C.interrupt.append=X,C.interrupt.end=P,C.interrupt=!1,X(!0),!0;return!1}if(X(!1,D.indents+(D.name?"<"+D.name:"")+(D.attributes.length?" "+D.attributes.join(" "):"")+(E?D.name?">":"":D.name?"/>":"")+(D.indent&&E>1?` -`:"")),!E)return X(!1,D.indent?` -`:"");if(!z(D))P()}function O(X,D){return X+'="'+G(D)+'"'}U.exports=J,U.exports.element=U.exports.Element=Z}),zK=f6(),h2=C6(AK(),1),W0=C6(NK(),1),o2=0,w6=32,TK=32,DK=(B,U)=>{let G=U.replace(/-/g,"");if(G.length!==TK)throw new 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,w6).map((Z,K)=>Z^Y[K%Y.length]),J=new Uint8Array(o2+Q.length+Math.max(0,B.length-w6));return J.set(B.slice(0,o2)),J.set(Q,o2),J.set(B.slice(w6),o2+Q.length),J},q8=class{format(B,U={stack:[]}){let G=B.prepForXml(U);if(G)return G;else throw Error("XMLComponent did not format correctly")}},U9=class{replace(B,U,G){let Y=B;return U.forEach((Q,J)=>{Y=Y.replace(new RegExp(`{${Q.fileName}}`,"g"),(G+J).toString())}),Y}getMediaData(B,U){return U.Array.filter((G)=>B.search(`{${G.fileName}}`)>0)}},CK=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}},kK=class{constructor(){e(this,"formatter",void 0),e(this,"imageReplacer",void 0),e(this,"numberingReplacer",void 0),this.formatter=new q8,this.imageReplacer=new U9,this.numberingReplacer=new CK}compile(B,U,G=[]){let Y=new h2.default,Q=this.xmlifyFile(B,U),J=new Map(Object.entries(Q));for(let[,Z]of J)if(Array.isArray(Z))for(let K of Z)Y.file(K.path,U1(K.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:K,fontKey:V}]of B.FontTable.fontOptionsWithKey.entries())Y.file(`word/fonts/font${Z+1}.odttf`,DK(K,V));return Y}xmlifyFile(B,U){let G=B.Document.Relationships.RelationshipCount+1,Y=W0.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,J=W0.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,K=W0.default(this.formatter.format(B.FootNotes.View,{viewWrapper:B.FootNotes,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}}),V=this.imageReplacer.getMediaData(Y,B.Media),H=this.imageReplacer.getMediaData(J,B.Media),O=this.imageReplacer.getMediaData(K,B.Media);return M0(M0({Relationships:{data:(()=>{return V.forEach((X,D)=>{B.Document.Relationships.addRelationship(G+D,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${X.fileName}`)}),B.Document.Relationships.addRelationship(B.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),W0.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 X=this.imageReplacer.replace(Y,V,G);return this.numberingReplacer.replace(X,B.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let X=W0.default(this.formatter.format(B.Styles,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(X,B.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:W0.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:W0.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:W0.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((X,D)=>{let W=W0.default(this.formatter.format(X.View,{viewWrapper:X,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(W,B.Media).forEach((E,P)=>{X.Relationships.addRelationship(P,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${E.fileName}`)}),{data:W0.default(this.formatter.format(X.Relationships,{viewWrapper:X,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${D+1}.xml.rels`}}),FooterRelationships:B.Footers.map((X,D)=>{let W=W0.default(this.formatter.format(X.View,{viewWrapper:X,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(W,B.Media).forEach((E,P)=>{X.Relationships.addRelationship(P,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${E.fileName}`)}),{data:W0.default(this.formatter.format(X.Relationships,{viewWrapper:X,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${D+1}.xml.rels`}}),Headers:B.Headers.map((X,D)=>{let W=W0.default(this.formatter.format(X.View,{viewWrapper:X,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),E=this.imageReplacer.getMediaData(W,B.Media),P=this.imageReplacer.replace(W,E,0);return{data:this.numberingReplacer.replace(P,B.Numbering.ConcreteNumbering),path:`word/header${D+1}.xml`}}),Footers:B.Footers.map((X,D)=>{let W=W0.default(this.formatter.format(X.View,{viewWrapper:X,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),E=this.imageReplacer.getMediaData(W,B.Media),P=this.imageReplacer.replace(W,E,0);return{data:this.numberingReplacer.replace(P,B.Numbering.ConcreteNumbering),path:`word/footer${D+1}.xml`}}),ContentTypes:{data:W0.default(this.formatter.format(B.ContentTypes,{viewWrapper:B.Document,file:B,stack:[]}),{indent:U,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:W0.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:W0.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 X=this.imageReplacer.replace(K,O,Z);return this.numberingReplacer.replace(X,B.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{return O.forEach((X,D)=>{B.FootNotes.Relationships.addRelationship(Z+D,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${X.fileName}`)}),W0.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:W0.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:W0.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:W0.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 X=this.imageReplacer.replace(J,H,Q);return this.numberingReplacer.replace(X,B.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{return H.forEach((X,D)=>{B.Comments.Relationships.addRelationship(Q+D,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${X.fileName}`)}),W0.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:W0.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:W0.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:W0.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 t8(B,U,G,Y,Q,J,Z){try{var K=B[J](Z),V=K.value}catch(H){G(H);return}K.done?U(V):Promise.resolve(V).then(Y,Q)}function V8(B){return function(){var U=this,G=arguments;return new Promise(function(Y,Q){var J=B.apply(U,G);function Z(V){t8(J,Y,Q,Z,K,"next",V)}function K(V){t8(J,Y,Q,Z,K,"throw",V)}Z(void 0)})}}var G9={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:"\t"},e8=(B)=>B===!0?G9.WITH_2_BLANKS:B===!1?void 0:B,Y9=class B{static pack(U,G,Y){var Q=this;return V8(function*(J,Z,K,V=[]){return Q.compiler.compile(J,e8(K),V).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 zK.Stream;return this.compiler.compile(U,e8(G),Y).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then((J)=>{Q.emit("data",J),Q.emit("end")}),Q}};e(Y9,"compiler",new kK);var $K=new q8,l1=(B)=>{return _1.xml2js(B,{compact:!1,captureSpacesBetweenElements:!0})},Z9=(B)=>{var U;return(U=l1(W0.default($K.format(new Z1({text:B})))).elements[0].elements)!==null&&U!==void 0?U:[]},Q9=(B)=>M0(M0({},B),{},{attributes:{"xml:space":"preserve"}}),w8=(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=w8(B,"Types");if(Y.some((Q)=>{var J,Z;return Q.type==="element"&&Q.name==="Default"&&(Q===null||Q===void 0||(J=Q.attributes)===null||J===void 0?void 0:J.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"})},SK=(B)=>{let U=parseInt(B.substring(3),10);return isNaN(U)?0:U},bK=(B)=>{return w8(B,"Relationships").map((U)=>{var G,Y;return SK((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 J=w8(B,"Relationships");return J.push({attributes:{Id:`rId${U}`,Type:G,Target:Y,TargetMode:Q},name:"Relationship",type:"element"}),J},vK=class extends Error{constructor(B){super(`Token ${B} not found`);this.name="TokenNotFoundError"}},yK=(B,U)=>{var G;for(let Z=0;Z<((G=B.elements)!==null&&G!==void 0?G:[]).length;Z++){let K=B.elements[Z];if(K.type==="element"&&K.name==="w:r"){var Y;let V=((Y=K.elements)!==null&&Y!==void 0?Y:[]).filter((H)=>H.type==="element"&&H.name==="w:t");for(let H of V){var Q,J;if(!((Q=H.elements)===null||Q===void 0?void 0:Q[0]))continue;if((J=H.elements[0].text)===null||J===void 0?void 0:J.includes(U))return Z}}}throw new vK(U)},gK=(B,U)=>{var G,Y;let Q=-1,J=(G=(Y=B.elements)===null||Y===void 0?void 0:Y.map((Z,K)=>{if(Q!==-1)return Z;if(Z.type==="element"&&Z.name==="w:t"){var V,H;let O=((V=(H=Z.elements)===null||H===void 0||(H=H[0])===null||H===void 0?void 0:H.text)!==null&&V!==void 0?V:"").split(U),X=O.map((D)=>M0(M0(M0({},Z),Q9(Z)),{},{elements:Z9(D)}));if(O.length>1)Q=K;return X}else return Z}).flat())!==null&&G!==void 0?G:[];return{left:M0(M0({},JSON.parse(JSON.stringify(B))),{},{elements:J.slice(0,Q+1)}),right:M0(M0({},JSON.parse(JSON.stringify(B))),{},{elements:J.slice(Q+1)})}},t2={START:0,MIDDLE:1,END:2},fK=({paragraphElement:B,renderedParagraph:U,originalText:G,replacementText:Y})=>{let Q=U.text.indexOf(G),J=Q+G.length-1,Z=t2.START;for(let K of U.runs)for(let{text:V,index:H,start:O,end:X}of K.parts)switch(Z){case t2.START:if(Q>=O&&Q<=X){let D=Q-O,W=Math.min(J,X)-O,E=K.text.substring(D,W+1);if(E==="")continue;let P=V.replace(E,Y);L6(B.elements[K.index].elements[H],P),Z=t2.MIDDLE;continue}break;case t2.MIDDLE:if(J<=X){let D=V.substring(J-O+1);L6(B.elements[K.index].elements[H],D);let W=B.elements[K.index].elements[H];B.elements[K.index].elements[H]=Q9(W),Z=t2.END}else L6(B.elements[K.index].elements[H],"");break;default:}return B},L6=(B,U)=>{return B.elements=Z9(U),B},xK=(B)=>{if(B.element.name!=="w:p")throw new 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 J=_K(Y,Q,U);return U+=J.text.length,J}).filter((Y)=>!!Y);return{text:G.reduce((Y,Q)=>Y+Q.text,""),runs:G,index:B.index,pathToParagraph:J9(B)}},_K=(B,U,G)=>{if(!B.elements)return{text:"",parts:[],index:-1,start:G,end:G};let Y=G,Q=B.elements.map((J,Z)=>{var K,V;return J.name==="w:t"&&J.elements&&J.elements.length>0?{text:(K=(V=J.elements[0].text)===null||V===void 0?void 0:V.toString())!==null&&K!==void 0?K:"",index:Z,start:Y,end:(()=>{var H,O;return Y+=((H=(O=J.elements[0].text)===null||O===void 0?void 0:O.toString())!==null&&H!==void 0?H:"").length-1,Y})()}:void 0}).filter((J)=>!!J).map((J)=>J);return{text:Q.reduce((J,Z)=>J+Z.text,""),parts:Q,index:U,start:G,end:Y}},J9=(B)=>B.parent?[...J9(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:[]},K9=(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,xK(Y)];G.push(...UB(Y))}return U},hK=(B,U)=>K9(B).filter((G)=>G.text.includes(U)),uK=new q8,M6="ɵ",dK=({json:B,patch:U,patchText:G,context:Y,keepOriginalStyles:Q=!0})=>{let J=hK(B,G);if(J.length===0)return{element:B,didFindOccurrence:!1};for(let Z of J){let K=U.children.map((V)=>l1(W0.default(uK.format(V,Y)))).map((V)=>V.elements[0]);switch(U.type){case D6.DOCUMENT:{let V=cK(B,Z.pathToParagraph),H=mK(Z.pathToParagraph);V.elements.splice(H,1,...K);break}case D6.PARAGRAPH:default:{let V=I9(B,Z.pathToParagraph);fK({paragraphElement:V,renderedParagraph:Z,originalText:G,replacementText:M6});let H=yK(V,M6),O=V.elements[H],{left:X,right:D}=gK(O,M6),W=K,E=D;if(Q){let P=O.elements.filter((z)=>z.type==="element"&&z.name==="w:rPr");W=K.map((z)=>{var C;return M0(M0({},z),{},{elements:[...P,...(C=z.elements)!==null&&C!==void 0?C:[]]})}),E=M0(M0({},D),{},{elements:[...P,...D.elements]})}V.elements.splice(H,1,X,...W,E);break}}}return{element:B,didFindOccurrence:!0}},I9=(B,U)=>{let G=B;for(let Y=1;YI9(B,U.slice(0,U.length-1)),mK=(B)=>B[B.length-1],D6={DOCUMENT:"file",PARAGRAPH:"paragraph"},GB=new U9,lK=new Uint8Array([255,254]),aK=new Uint8Array([254,255]),YB=(B,U)=>{if(B.length!==U.length)return!1;for(let G=0;Gj.name==="w:document");if(x&&x.attributes){for(let j of["mc","wp","r","w15","m"])x.attributes[`xmlns:${j}`]=v1[j];x.attributes["mc:Ignorable"]=`${x.attributes["mc:Ignorable"]||""} w15`.trim()}}if(v.startsWith("word/")&&!v.endsWith(".xml.rels")){let x={file:H,viewWrapper:{Relationships:{addRelationship:(b,c,T,m)=>{D.push({key:v,hyperlink:{id:b,link:T}})}}},stack:[]};if(V.set(v,x),!(J===null||J===void 0?void 0:J.start.trim())||!(J===null||J===void 0?void 0:J.end.trim()))throw new Error("Both start and end delimiters must be non-empty strings.");let{start:j,end:a}=J;for(let[b,c]of Object.entries(Y)){let T=`${j}${b}${a}`;while(!0){let{didFindOccurrence:m}=dK({json:$,patch:M0(M0({},c),{},{children:c.children.map((B0)=>{if(B0 instanceof o6){let i=new m2(B0.options.children,R1());return D.push({key:v,hyperlink:{id:i.linkId,link:B0.options.link}}),i}else return B0})}),patchText:T,context:x,keepOriginalStyles:Q});if(!Z||!m)break}}let U0=GB.getMediaData(JSON.stringify($),x.file.Media);if(U0.length>0)W=!0,X.push({key:v,mediaDatas:U0})}O.set(v,$)}for(let{key:v,mediaDatas:S}of X){var z;let F=`word/_rels/${v.split("/").pop()}.rels`,w=(z=O.get(F))!==null&&z!==void 0?z:ZB();O.set(F,w);let $=bK(w),x=GB.replace(JSON.stringify(O.get(v)),S,$);O.set(v,JSON.parse(x));for(let j=0;j{return _1.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:[]}]}),iK=function(){var B=V8(function*({data:U}){let G=U instanceof h2.default?U:yield h2.default.loadAsync(U),Y=new Set;for(let[Q,J]of Object.entries(G.files)){if(!Q.endsWith(".xml")&&!Q.endsWith(".rels"))continue;if(Q.startsWith("word/")&&!Q.endsWith(".xml.rels"))K9(l1(yield J.async("text"))).forEach((Z)=>nK(Z.text).forEach((K)=>Y.add(K)))}return Array.from(Y)});return function U(G){return B.apply(this,arguments)}}(),nK=(B)=>{var U;let G=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(U=B.match(G))!==null&&U!==void 0?U:[]};if(typeof globalThis.Buffer==="undefined")globalThis.Buffer=J0;if(typeof globalThis.process==="undefined")globalThis.process=sK;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.docx=L8;})(); + */(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;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/pdf-lib.cjs b/apps/sim/lib/execution/sandbox/bundles/pdf-lib.cjs index 830ff9cf783..3ee9405140b 100644 --- a/apps/sim/lib/execution/sandbox/bundles/pdf-lib.cjs +++ b/apps/sim/lib/execution/sandbox/bundles/pdf-lib.cjs @@ -1,7 +1,7 @@ // sandbox bundle: pdf-lib // generated by apps/sim/lib/execution/sandbox/bundles/build.ts // do not edit by hand. run `bun run build:sandbox-bundles` to regenerate. -(()=>{var d3=Object.create;var{getPrototypeOf:n3,defineProperty:fq,getOwnPropertyNames:r3}=Object;var i3=Object.prototype.hasOwnProperty;var $2=(V,q,X)=>{X=V!=null?d3(n3(V)):{};let K=q||!V||!V.__esModule?fq(X,"default",{value:V,enumerable:!0}):X;for(let Q of r3(V))if(!i3.call(K,Q))fq(K,Q,{get:()=>V[Q],enumerable:!0});return K};var g0=(V,q)=>()=>(q||V((q={exports:{}}).exports,q),q.exports);var a3=(V,q)=>{for(var X in q)fq(V,X,{get:q[X],enumerable:!0,configurable:!0,set:(K)=>q[X]=()=>K})};var gX=g0((hZ,uX)=>{var A0=uX.exports={},F6,P6;function sq(){throw new Error("setTimeout has not been defined")}function tq(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")F6=setTimeout;else F6=sq}catch(V){F6=sq}try{if(typeof clearTimeout==="function")P6=clearTimeout;else P6=tq}catch(V){P6=tq}})();function FX(V){if(F6===setTimeout)return setTimeout(V,0);if((F6===sq||!F6)&&setTimeout)return F6=setTimeout,setTimeout(V,0);try{return F6(V,0)}catch(q){try{return F6.call(null,V,0)}catch(X){return F6.call(this,V,0)}}}function NK(V){if(P6===clearTimeout)return clearTimeout(V);if((P6===tq||!P6)&&clearTimeout)return P6=clearTimeout,clearTimeout(V);try{return P6(V)}catch(q){try{return P6.call(null,V)}catch(X){return P6.call(this,V)}}}var o6=[],$8=!1,d5,h1=-1;function SK(){if(!$8||!d5)return;if($8=!1,d5.length)o6=d5.concat(o6);else h1=-1;if(o6.length)PX()}function PX(){if($8)return;var V=FX(SK);$8=!0;var q=o6.length;while(q){d5=o6,o6=[];while(++h11)for(var X=1;X{var gK=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Int32Array!=="undefined";function xK(V,q){return Object.prototype.hasOwnProperty.call(V,q)}r0.assign=function(V){var q=Array.prototype.slice.call(arguments,1);while(q.length){var X=q.shift();if(!X)continue;if(typeof X!=="object")throw new TypeError(X+"must be non-object");for(var K in X)if(xK(X,K))V[K]=X[K]}return V};r0.shrinkBuf=function(V,q){if(V.length===q)return V;if(V.subarray)return V.subarray(0,q);return V.length=q,V};var bK={arraySet:function(V,q,X,K,Q){if(q.subarray&&V.subarray){V.set(q.subarray(X,X+K),Q);return}for(var Y=0;Y{var fK=t6(),lK=4,pX=0,dX=1,_K=2;function u8(V){var q=V.length;while(--q>=0)V[q]=0}var cK=0,sX=1,pK=2,dK=3,nK=258,N4=29,p2=256,f2=p2+1+N4,D8=30,S4=19,tX=2*f2+1,i5=15,T4=16,rK=7,y4=256,eX=16,qV=17,XV=18,w4=[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],g1=[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],iK=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],VV=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],aK=512,e6=new Array((f2+2)*2);u8(e6);var m2=new Array(D8*2);u8(m2);var l2=new Array(aK);u8(l2);var _2=new Array(nK-dK+1);u8(_2);var $4=new Array(N4);u8($4);var x1=new Array(D8);u8(x1);function v4(V,q,X,K,Q){this.static_tree=V,this.extra_bits=q,this.extra_base=X,this.elems=K,this.max_length=Q,this.has_stree=V&&V.length}var KV,QV,YV;function R4(V,q){this.dyn_tree=V,this.max_code=0,this.stat_desc=q}function JV(V){return V<256?l2[V]:l2[256+(V>>>7)]}function c2(V,q){V.pending_buf[V.pending++]=q&255,V.pending_buf[V.pending++]=q>>>8&255}function q6(V,q,X){if(V.bi_valid>T4-X)V.bi_buf|=q<>T4-V.bi_valid,V.bi_valid+=X-T4;else V.bi_buf|=q<>>=1,X<<=1;while(--q>0);return X>>>1}function oK(V){if(V.bi_valid===16)c2(V,V.bi_buf),V.bi_buf=0,V.bi_valid=0;else if(V.bi_valid>=8)V.pending_buf[V.pending++]=V.bi_buf&255,V.bi_buf>>=8,V.bi_valid-=8}function sK(V,q){var{dyn_tree:X,max_code:K}=q,Q=q.stat_desc.static_tree,Y=q.stat_desc.has_stree,J=q.stat_desc.extra_bits,G=q.stat_desc.extra_base,W=q.stat_desc.max_length,Z,U,H,z,I,M,L=0;for(z=0;z<=i5;z++)V.bl_count[z]=0;X[V.heap[V.heap_max]*2+1]=0;for(Z=V.heap_max+1;ZW)z=W,L++;if(X[U*2+1]=z,U>K)continue;if(V.bl_count[z]++,I=0,U>=G)I=J[U-G];if(M=X[U*2],V.opt_len+=M*(z+I),Y)V.static_len+=M*(Q[U*2+1]+I)}if(L===0)return;do{z=W-1;while(V.bl_count[z]===0)z--;V.bl_count[z]--,V.bl_count[z+1]+=2,V.bl_count[W]--,L-=2}while(L>0);for(z=W;z!==0;z--){U=V.bl_count[z];while(U!==0){if(H=V.heap[--Z],H>K)continue;if(X[H*2+1]!==z)V.opt_len+=(z-X[H*2+1])*X[H*2],X[H*2+1]=z;U--}}}function ZV(V,q,X){var K=new Array(i5+1),Q=0,Y,J;for(Y=1;Y<=i5;Y++)K[Y]=Q=Q+X[Y-1]<<1;for(J=0;J<=q;J++){var G=V[J*2+1];if(G===0)continue;V[J*2]=GV(K[G]++,G)}}function tK(){var V,q,X,K,Q,Y=new Array(i5+1);X=0;for(K=0;K>=7;for(;K8)c2(V,V.bi_buf);else if(V.bi_valid>0)V.pending_buf[V.pending++]=V.bi_buf;V.bi_buf=0,V.bi_valid=0}function eK(V,q,X,K){if(UV(V),K)c2(V,X),c2(V,~X);fK.arraySet(V.pending_buf,V.window,q,X,V.pending),V.pending+=X}function nX(V,q,X,K){var Q=q*2,Y=X*2;return V[Q]>1;J>=1;J--)O4(V,X,J);Z=Y;do J=V.heap[1],V.heap[1]=V.heap[V.heap_len--],O4(V,X,1),G=V.heap[1],V.heap[--V.heap_max]=J,V.heap[--V.heap_max]=G,X[Z*2]=X[J*2]+X[G*2],V.depth[Z]=(V.depth[J]>=V.depth[G]?V.depth[J]:V.depth[G])+1,X[J*2+1]=X[G*2+1]=Z,V.heap[1]=Z++,O4(V,X,1);while(V.heap_len>=2);V.heap[--V.heap_max]=V.heap[1],sK(V,q),ZV(X,W,V.bl_count)}function iX(V,q,X){var K,Q=-1,Y,J=q[1],G=0,W=7,Z=4;if(J===0)W=138,Z=3;q[(X+1)*2+1]=65535;for(K=0;K<=X;K++){if(Y=J,J=q[(K+1)*2+1],++G=3;q--)if(V.bl_tree[VV[q]*2+1]!==0)break;return V.opt_len+=3*(q+1)+5+5+4,q}function XQ(V,q,X,K){var Q;q6(V,q-257,5),q6(V,X-1,5),q6(V,K-4,4);for(Q=0;Q>>=1)if(q&1&&V.dyn_ltree[X*2]!==0)return pX;if(V.dyn_ltree[18]!==0||V.dyn_ltree[20]!==0||V.dyn_ltree[26]!==0)return dX;for(X=32;X0){if(V.strm.data_type===_K)V.strm.data_type=VQ(V);if(A4(V,V.l_desc),A4(V,V.d_desc),J=qQ(V),Q=V.opt_len+3+7>>>3,Y=V.static_len+3+7>>>3,Y<=Q)Q=Y}else Q=Y=X+5;if(X+4<=Q&&q!==-1)HV(V,q,X,K);else if(V.strategy===lK||Y===Q)q6(V,(sX<<1)+(K?1:0),3),rX(V,e6,m2);else q6(V,(pK<<1)+(K?1:0),3),XQ(V,V.l_desc.max_code+1,V.d_desc.max_code+1,J+1),rX(V,V.dyn_ltree,V.dyn_dtree);if(WV(V),K)UV(V)}function JQ(V,q,X){if(V.pending_buf[V.d_buf+V.last_lit*2]=q>>>8&255,V.pending_buf[V.d_buf+V.last_lit*2+1]=q&255,V.pending_buf[V.l_buf+V.last_lit]=X&255,V.last_lit++,q===0)V.dyn_ltree[X*2]++;else V.matches++,q--,V.dyn_ltree[(_2[X]+p2+1)*2]++,V.dyn_dtree[JV(q)*2]++;return V.last_lit===V.lit_bufsize-1}g8._tr_init=KQ;g8._tr_stored_block=HV;g8._tr_flush_block=YQ;g8._tr_tally=JQ;g8._tr_align=QQ});var C4=g0((dZ,MV)=>{function GQ(V,q,X,K){var Q=V&65535|0,Y=V>>>16&65535|0,J=0;while(X!==0){J=X>2000?2000:X,X-=J;do Q=Q+q[K++]|0,Y=Y+Q|0;while(--J);Q%=65521,Y%=65521}return Q|Y<<16|0}MV.exports=GQ});var h4=g0((nZ,IV)=>{function ZQ(){var V,q=[];for(var X=0;X<256;X++){V=X;for(var K=0;K<8;K++)V=V&1?3988292384^V>>>1:V>>>1;q[X]=V}return q}var WQ=ZQ();function UQ(V,q,X,K){var Q=WQ,Y=K+X;V^=-1;for(var J=K;J>>8^Q[(V^q[J])&255];return V^-1}IV.exports=UQ});var b1=g0((rZ,kV)=>{kV.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 wV=g0((m6)=>{var i0=t6(),U6=zV(),BV=C4(),B5=h4(),HQ=b1(),t5=0,zQ=1,MQ=3,w5=4,EV=5,b6=0,LV=1,H6=-2,IQ=-3,F4=-5,kQ=-1,EQ=1,m1=2,LQ=3,jQ=4,BQ=0,TQ=2,c1=8,vQ=9,RQ=15,OQ=8,wQ=29,AQ=256,D4=AQ+1+wQ,NQ=30,SQ=19,yQ=2*D4+1,$Q=15,U0=3,R5=258,O6=R5+U0+1,CQ=32,p1=42,u4=69,f1=73,l1=91,_1=103,a5=113,n2=666,h0=1,r2=2,o5=3,m8=4,hQ=3;function O5(V,q){return V.msg=HQ[q],q}function jV(V){return(V<<1)-(V>4?9:0)}function v5(V){var q=V.length;while(--q>=0)V[q]=0}function T5(V){var q=V.state,X=q.pending;if(X>V.avail_out)X=V.avail_out;if(X===0)return;if(i0.arraySet(V.output,q.pending_buf,q.pending_out,X,V.next_out),V.next_out+=X,q.pending_out+=X,V.total_out+=X,V.avail_out-=X,q.pending-=X,q.pending===0)q.pending_out=0}function x0(V,q){U6._tr_flush_block(V,V.block_start>=0?V.block_start:-1,V.strstart-V.block_start,q),V.block_start=V.strstart,T5(V.strm)}function H0(V,q){V.pending_buf[V.pending++]=q}function d2(V,q){V.pending_buf[V.pending++]=q>>>8&255,V.pending_buf[V.pending++]=q&255}function FQ(V,q,X,K){var Q=V.avail_in;if(Q>K)Q=K;if(Q===0)return 0;if(V.avail_in-=Q,i0.arraySet(q,V.input,V.next_in,Q,X),V.state.wrap===1)V.adler=BV(V.adler,q,Q,X);else if(V.state.wrap===2)V.adler=B5(V.adler,q,Q,X);return V.next_in+=Q,V.total_in+=Q,Q}function TV(V,q){var{max_chain_length:X,strstart:K}=V,Q,Y,J=V.prev_length,G=V.nice_match,W=V.strstart>V.w_size-O6?V.strstart-(V.w_size-O6):0,Z=V.window,U=V.w_mask,H=V.prev,z=V.strstart+R5,I=Z[K+J-1],M=Z[K+J];if(V.prev_length>=V.good_match)X>>=2;if(G>V.lookahead)G=V.lookahead;do{if(Q=q,Z[Q+J]!==M||Z[Q+J-1]!==I||Z[Q]!==Z[K]||Z[++Q]!==Z[K+1])continue;K+=2,Q++;do;while(Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&KJ){if(V.match_start=q,J=Y,Y>=G)break;I=Z[K+J-1],M=Z[K+J]}}while((q=H[q&U])>W&&--X!==0);if(J<=V.lookahead)return J;return V.lookahead}function s5(V){var q=V.w_size,X,K,Q,Y,J;do{if(Y=V.window_size-V.lookahead-V.strstart,V.strstart>=q+(q-O6)){i0.arraySet(V.window,V.window,q,q,0),V.match_start-=q,V.strstart-=q,V.block_start-=q,K=V.hash_size,X=K;do Q=V.head[--X],V.head[X]=Q>=q?Q-q:0;while(--K);K=q,X=K;do Q=V.prev[--X],V.prev[X]=Q>=q?Q-q:0;while(--K);Y+=q}if(V.strm.avail_in===0)break;if(K=FQ(V.strm,V.window,V.strstart+V.lookahead,Y),V.lookahead+=K,V.lookahead+V.insert>=U0){J=V.strstart-V.insert,V.ins_h=V.window[J],V.ins_h=(V.ins_h<V.pending_buf_size-5)X=V.pending_buf_size-5;for(;;){if(V.lookahead<=1){if(s5(V),V.lookahead===0&&q===t5)return h0;if(V.lookahead===0)break}V.strstart+=V.lookahead,V.lookahead=0;var K=V.block_start+X;if(V.strstart===0||V.strstart>=K){if(V.lookahead=V.strstart-K,V.strstart=K,x0(V,!1),V.strm.avail_out===0)return h0}if(V.strstart-V.block_start>=V.w_size-O6){if(x0(V,!1),V.strm.avail_out===0)return h0}}if(V.insert=0,q===w5){if(x0(V,!0),V.strm.avail_out===0)return o5;return m8}if(V.strstart>V.block_start){if(x0(V,!1),V.strm.avail_out===0)return h0}return h0}function P4(V,q){var X,K;for(;;){if(V.lookahead=U0)V.ins_h=(V.ins_h<=U0)if(K=U6._tr_tally(V,V.strstart-V.match_start,V.match_length-U0),V.lookahead-=V.match_length,V.match_length<=V.max_lazy_match&&V.lookahead>=U0){V.match_length--;do V.strstart++,V.ins_h=(V.ins_h<=U0)V.ins_h=(V.ins_h<4096))V.match_length=U0-1}if(V.prev_length>=U0&&V.match_length<=V.prev_length){Q=V.strstart+V.lookahead-U0,K=U6._tr_tally(V,V.strstart-1-V.prev_match,V.prev_length-U0),V.lookahead-=V.prev_length-1,V.prev_length-=2;do if(++V.strstart<=Q)V.ins_h=(V.ins_h<=U0&&V.strstart>0){if(Q=V.strstart-1,K=J[Q],K===J[++Q]&&K===J[++Q]&&K===J[++Q]){Y=V.strstart+R5;do;while(K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&QV.lookahead)V.match_length=V.lookahead}}if(V.match_length>=U0)X=U6._tr_tally(V,1,V.match_length-U0),V.lookahead-=V.match_length,V.strstart+=V.match_length,V.match_length=0;else X=U6._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++;if(X){if(x0(V,!1),V.strm.avail_out===0)return h0}}if(V.insert=0,q===w5){if(x0(V,!0),V.strm.avail_out===0)return o5;return m8}if(V.last_lit){if(x0(V,!1),V.strm.avail_out===0)return h0}return r2}function uQ(V,q){var X;for(;;){if(V.lookahead===0){if(s5(V),V.lookahead===0){if(q===t5)return h0;break}}if(V.match_length=0,X=U6._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++,X){if(x0(V,!1),V.strm.avail_out===0)return h0}}if(V.insert=0,q===w5){if(x0(V,!0),V.strm.avail_out===0)return o5;return m8}if(V.last_lit){if(x0(V,!1),V.strm.avail_out===0)return h0}return r2}function x6(V,q,X,K,Q){this.good_length=V,this.max_lazy=q,this.nice_length=X,this.max_chain=K,this.func=Q}var b8;b8=[new x6(0,0,0,0,PQ),new x6(4,4,8,4,P4),new x6(4,5,16,8,P4),new x6(4,6,32,32,P4),new x6(4,4,16,16,x8),new x6(8,16,32,32,x8),new x6(8,16,128,128,x8),new x6(8,32,128,256,x8),new x6(32,128,258,1024,x8),new x6(32,258,258,4096,x8)];function gQ(V){V.window_size=2*V.w_size,v5(V.head),V.max_lazy_match=b8[V.level].max_lazy,V.good_match=b8[V.level].good_length,V.nice_match=b8[V.level].nice_length,V.max_chain_length=b8[V.level].max_chain,V.strstart=0,V.block_start=0,V.lookahead=0,V.insert=0,V.match_length=V.prev_length=U0-1,V.match_available=0,V.ins_h=0}function xQ(){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=c1,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 i0.Buf16(yQ*2),this.dyn_dtree=new i0.Buf16((2*NQ+1)*2),this.bl_tree=new i0.Buf16((2*SQ+1)*2),v5(this.dyn_ltree),v5(this.dyn_dtree),v5(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i0.Buf16($Q+1),this.heap=new i0.Buf16(2*D4+1),v5(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i0.Buf16(2*D4+1),v5(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 vV(V){var q;if(!V||!V.state)return O5(V,H6);if(V.total_in=V.total_out=0,V.data_type=TQ,q=V.state,q.pending=0,q.pending_out=0,q.wrap<0)q.wrap=-q.wrap;return q.status=q.wrap?p1:a5,V.adler=q.wrap===2?0:1,q.last_flush=t5,U6._tr_init(q),b6}function RV(V){var q=vV(V);if(q===b6)gQ(V.state);return q}function bQ(V,q){if(!V||!V.state)return H6;if(V.state.wrap!==2)return H6;return V.state.gzhead=q,b6}function OV(V,q,X,K,Q,Y){if(!V)return H6;var J=1;if(q===kQ)q=6;if(K<0)J=0,K=-K;else if(K>15)J=2,K-=16;if(Q<1||Q>vQ||X!==c1||K<8||K>15||q<0||q>9||Y<0||Y>jQ)return O5(V,H6);if(K===8)K=9;var G=new xQ;return V.state=G,G.strm=V,G.wrap=J,G.gzhead=null,G.w_bits=K,G.w_size=1<EV||q<0)return V?O5(V,H6):H6;if(K=V.state,!V.output||!V.input&&V.avail_in!==0||K.status===n2&&q!==w5)return O5(V,V.avail_out===0?F4:H6);if(K.strm=V,X=K.last_flush,K.last_flush=q,K.status===p1)if(K.wrap===2)if(V.adler=0,H0(K,31),H0(K,139),H0(K,8),!K.gzhead)H0(K,0),H0(K,0),H0(K,0),H0(K,0),H0(K,0),H0(K,K.level===9?2:K.strategy>=m1||K.level<2?4:0),H0(K,hQ),K.status=a5;else{if(H0(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)),H0(K,K.gzhead.time&255),H0(K,K.gzhead.time>>8&255),H0(K,K.gzhead.time>>16&255),H0(K,K.gzhead.time>>24&255),H0(K,K.level===9?2:K.strategy>=m1||K.level<2?4:0),H0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)H0(K,K.gzhead.extra.length&255),H0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)V.adler=B5(V.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=u4}else{var J=c1+(K.w_bits-8<<4)<<8,G=-1;if(K.strategy>=m1||K.level<2)G=0;else if(K.level<6)G=1;else if(K.level===6)G=2;else G=3;if(J|=G<<6,K.strstart!==0)J|=CQ;if(J+=31-J%31,K.status=a5,d2(K,J),K.strstart!==0)d2(K,V.adler>>>16),d2(K,V.adler&65535);V.adler=1}if(K.status===u4)if(K.gzhead.extra){Q=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>Q)V.adler=B5(V.adler,K.pending_buf,K.pending-Q,Q);if(T5(V),Q=K.pending,K.pending===K.pending_buf_size)break}H0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>Q)V.adler=B5(V.adler,K.pending_buf,K.pending-Q,Q);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=f1}else K.status=f1;if(K.status===f1)if(K.gzhead.name){Q=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>Q)V.adler=B5(V.adler,K.pending_buf,K.pending-Q,Q);if(T5(V),Q=K.pending,K.pending===K.pending_buf_size){Y=1;break}}if(K.gzindexQ)V.adler=B5(V.adler,K.pending_buf,K.pending-Q,Q);if(Y===0)K.gzindex=0,K.status=l1}else K.status=l1;if(K.status===l1)if(K.gzhead.comment){Q=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>Q)V.adler=B5(V.adler,K.pending_buf,K.pending-Q,Q);if(T5(V),Q=K.pending,K.pending===K.pending_buf_size){Y=1;break}}if(K.gzindexQ)V.adler=B5(V.adler,K.pending_buf,K.pending-Q,Q);if(Y===0)K.status=_1}else K.status=_1;if(K.status===_1)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)T5(V);if(K.pending+2<=K.pending_buf_size)H0(K,V.adler&255),H0(K,V.adler>>8&255),V.adler=0,K.status=a5}else K.status=a5;if(K.pending!==0){if(T5(V),V.avail_out===0)return K.last_flush=-1,b6}else if(V.avail_in===0&&jV(q)<=jV(X)&&q!==w5)return O5(V,F4);if(K.status===n2&&V.avail_in!==0)return O5(V,F4);if(V.avail_in!==0||K.lookahead!==0||q!==t5&&K.status!==n2){var W=K.strategy===m1?uQ(K,q):K.strategy===LQ?DQ(K,q):b8[K.level].func(K,q);if(W===o5||W===m8)K.status=n2;if(W===h0||W===o5){if(V.avail_out===0)K.last_flush=-1;return b6}if(W===r2){if(q===zQ)U6._tr_align(K);else if(q!==EV){if(U6._tr_stored_block(K,0,0,!1),q===MQ){if(v5(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(T5(V),V.avail_out===0)return K.last_flush=-1,b6}}if(q!==w5)return b6;if(K.wrap<=0)return LV;if(K.wrap===2)H0(K,V.adler&255),H0(K,V.adler>>8&255),H0(K,V.adler>>16&255),H0(K,V.adler>>24&255),H0(K,V.total_in&255),H0(K,V.total_in>>8&255),H0(K,V.total_in>>16&255),H0(K,V.total_in>>24&255);else d2(K,V.adler>>>16),d2(K,V.adler&65535);if(T5(V),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?b6:LV}function lQ(V){var q;if(!V||!V.state)return H6;if(q=V.state.status,q!==p1&&q!==u4&&q!==f1&&q!==l1&&q!==_1&&q!==a5&&q!==n2)return O5(V,H6);return V.state=null,q===a5?O5(V,IQ):b6}function _Q(V,q){var X=q.length,K,Q,Y,J,G,W,Z,U;if(!V||!V.state)return H6;if(K=V.state,J=K.wrap,J===2||J===1&&K.status!==p1||K.lookahead)return H6;if(J===1)V.adler=BV(V.adler,q,X,0);if(K.wrap=0,X>=K.w_size){if(J===0)v5(K.head),K.strstart=0,K.block_start=0,K.insert=0;U=new i0.Buf8(K.w_size),i0.arraySet(U,q,X-K.w_size,K.w_size,0),q=U,X=K.w_size}G=V.avail_in,W=V.next_in,Z=V.input,V.avail_in=X,V.next_in=0,V.input=q,s5(K);while(K.lookahead>=U0){Q=K.strstart,Y=K.lookahead-(U0-1);do K.ins_h=(K.ins_h<{var d1=t6(),AV=!0,NV=!0;try{String.fromCharCode.apply(null,[0])}catch(V){AV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(V){NV=!1}var i2=new d1.Buf8(256);for(f6=0;f6<256;f6++)i2[f6]=f6>=252?6:f6>=248?5:f6>=240?4:f6>=224?3:f6>=192?2:1;var f6;i2[254]=i2[254]=1;f8.string2buf=function(V){var q,X,K,Q,Y,J=V.length,G=0;for(Q=0;Q>>6,q[Y++]=128|X&63;else if(X<65536)q[Y++]=224|X>>>12,q[Y++]=128|X>>>6&63,q[Y++]=128|X&63;else q[Y++]=240|X>>>18,q[Y++]=128|X>>>12&63,q[Y++]=128|X>>>6&63,q[Y++]=128|X&63}return q};function SV(V,q){if(q<65534){if(V.subarray&&NV||!V.subarray&&AV)return String.fromCharCode.apply(null,d1.shrinkBuf(V,q))}var X="";for(var K=0;K4){G[K++]=65533,X+=Y-1;continue}Q&=Y===2?31:Y===3?15:7;while(Y>1&&X1){G[K++]=65533;continue}if(Q<65536)G[K++]=Q;else Q-=65536,G[K++]=55296|Q>>10&1023,G[K++]=56320|Q&1023}return SV(G,K)};f8.utf8border=function(V,q){var X;if(q=q||V.length,q>V.length)q=V.length;X=q-1;while(X>=0&&(V[X]&192)===128)X--;if(X<0)return q;if(X===0)return q;return X+i2[V[X]]>q?X:q}});var x4=g0((oZ,yV)=>{function cQ(){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}yV.exports=cQ});var FV=g0((s2)=>{var a2=wV(),o2=t6(),m4=g4(),f4=b1(),pQ=x4(),hV=Object.prototype.toString,dQ=0,b4=4,l8=0,$V=1,CV=2,nQ=-1,rQ=0,iQ=8;function e5(V){if(!(this instanceof e5))return new e5(V);this.options=o2.assign({level:nQ,method:iQ,chunkSize:16384,windowBits:15,memLevel:8,strategy:rQ,to:""},V||{});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 pQ,this.strm.avail_out=0;var X=a2.deflateInit2(this.strm,q.level,q.method,q.windowBits,q.memLevel,q.strategy);if(X!==l8)throw new Error(f4[X]);if(q.header)a2.deflateSetHeader(this.strm,q.header);if(q.dictionary){var K;if(typeof q.dictionary==="string")K=m4.string2buf(q.dictionary);else if(hV.call(q.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(q.dictionary);else K=q.dictionary;if(X=a2.deflateSetDictionary(this.strm,K),X!==l8)throw new Error(f4[X]);this._dict_set=!0}}e5.prototype.push=function(V,q){var X=this.strm,K=this.options.chunkSize,Q,Y;if(this.ended)return!1;if(Y=q===~~q?q:q===!0?b4:dQ,typeof V==="string")X.input=m4.string2buf(V);else if(hV.call(V)==="[object ArrayBuffer]")X.input=new Uint8Array(V);else X.input=V;X.next_in=0,X.avail_in=X.input.length;do{if(X.avail_out===0)X.output=new o2.Buf8(K),X.next_out=0,X.avail_out=K;if(Q=a2.deflate(X,Y),Q!==$V&&Q!==l8)return this.onEnd(Q),this.ended=!0,!1;if(X.avail_out===0||X.avail_in===0&&(Y===b4||Y===CV))if(this.options.to==="string")this.onData(m4.buf2binstring(o2.shrinkBuf(X.output,X.next_out)));else this.onData(o2.shrinkBuf(X.output,X.next_out))}while((X.avail_in>0||X.avail_out===0)&&Q!==$V);if(Y===b4)return Q=a2.deflateEnd(this.strm),this.onEnd(Q),this.ended=!0,Q===l8;if(Y===CV)return this.onEnd(l8),X.avail_out=0,!0;return!0};e5.prototype.onData=function(V){this.chunks.push(V)};e5.prototype.onEnd=function(V){if(V===l8)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=o2.flattenChunks(this.chunks);this.chunks=[],this.err=V,this.msg=this.strm.msg};function l4(V,q){var X=new e5(q);if(X.push(V,!0),X.err)throw X.msg||f4[X.err];return X.result}function aQ(V,q){return q=q||{},q.raw=!0,l4(V,q)}function oQ(V,q){return q=q||{},q.gzip=!0,l4(V,q)}s2.Deflate=e5;s2.deflate=l4;s2.deflateRaw=aQ;s2.gzip=oQ});var DV=g0((tZ,PV)=>{var n1=30,sQ=12;PV.exports=function V(q,X){var K,Q,Y,J,G,W,Z,U,H,z,I,M,L,B,j,O,N,R,v,w,$,S,h,b,C;K=q.state,Q=q.next_in,b=q.input,Y=Q+(q.avail_in-5),J=q.next_out,C=q.output,G=J-(X-q.avail_out),W=J+(q.avail_out-257),Z=K.dmax,U=K.wsize,H=K.whave,z=K.wnext,I=K.window,M=K.hold,L=K.bits,B=K.lencode,j=K.distcode,O=(1<>>24,M>>>=v,L-=v,v=R>>>16&255,v===0)C[J++]=R&65535;else if(v&16){if(w=R&65535,v&=15,v){if(L>>=v,L-=v}if(L<15)M+=b[Q++]<>>24,M>>>=v,L-=v,v=R>>>16&255,v&16){if($=R&65535,v&=15,LZ){q.msg="invalid distance too far back",K.mode=n1;break q}if(M>>>=v,L-=v,v=J-G,$>v){if(v=$-v,v>H){if(K.sane){q.msg="invalid distance too far back",K.mode=n1;break q}}if(S=0,h=I,z===0){if(S+=U-v,v2)C[J++]=h[S++],C[J++]=h[S++],C[J++]=h[S++],w-=3;if(w){if(C[J++]=h[S++],w>1)C[J++]=h[S++]}}else{S=J-$;do C[J++]=C[S++],C[J++]=C[S++],C[J++]=C[S++],w-=3;while(w>2);if(w){if(C[J++]=C[S++],w>1)C[J++]=C[S++]}}}else if((v&64)===0){R=j[(R&65535)+(M&(1<>3,Q-=w,L-=w<<3,M&=(1<{var uV=t6(),_8=15,gV=852,xV=592,bV=0,_4=1,mV=2,tQ=[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],eQ=[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],qY=[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],XY=[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];fV.exports=function V(q,X,K,Q,Y,J,G,W){var Z=W.bits,U=0,H=0,z=0,I=0,M=0,L=0,B=0,j=0,O=0,N=0,R,v,w,$,S,h=null,b=0,C,D=new uV.Buf16(_8+1),l=new uV.Buf16(_8+1),u=null,q0=0,J0,r,k0;for(U=0;U<=_8;U++)D[U]=0;for(H=0;H=1;I--)if(D[I]!==0)break;if(M>I)M=I;if(I===0)return Y[J++]=20971520,Y[J++]=20971520,W.bits=1,0;for(z=1;z0&&(q===bV||I!==1))return-1;l[1]=0;for(U=1;U<_8;U++)l[U+1]=l[U]+D[U];for(H=0;HgV||q===mV&&O>xV)return 1;for(;;){if(J0=U-B,G[H]C)r=u[q0+G[H]],k0=h[b+G[H]];else r=96,k0=0;R=1<>B)+v]=J0<<24|r<<16|k0|0;while(v!==0);R=1<>=1;if(R!==0)N&=R-1,N+=R;else N=0;if(H++,--D[U]===0){if(U===I)break;U=X[K+G[H]]}if(U>M&&(N&$)!==w){if(B===0)B=M;S+=z,L=U-B,j=1<gV||q===mV&&O>xV)return 1;w=N&$,Y[w]=M<<24|L<<16|S-J|0}}if(N!==0)Y[S+N]=U-B<<24|4194304|0;return W.bits=M,0}});var R9=g0((w6)=>{var Q6=t6(),i4=C4(),l6=h4(),VY=DV(),t2=lV(),KY=0,M9=1,I9=2,_V=4,QY=5,r1=6,q8=0,YY=1,JY=2,z6=-2,k9=-3,a4=-4,GY=-5,cV=8,E9=1,pV=2,dV=3,nV=4,rV=5,iV=6,aV=7,oV=8,sV=9,tV=10,o1=11,q5=12,c4=13,eV=14,p4=15,q9=16,X9=17,V9=18,K9=19,i1=20,a1=21,Q9=22,Y9=23,J9=24,G9=25,Z9=26,d4=27,W9=28,U9=29,j0=30,o4=31,ZY=32,WY=852,UY=592,HY=15,zY=HY;function H9(V){return(V>>>24&255)+(V>>>8&65280)+((V&65280)<<8)+((V&255)<<24)}function MY(){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 Q6.Buf16(320),this.work=new Q6.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function L9(V){var q;if(!V||!V.state)return z6;if(q=V.state,V.total_in=V.total_out=q.total=0,V.msg="",q.wrap)V.adler=q.wrap&1;return q.mode=E9,q.last=0,q.havedict=0,q.dmax=32768,q.head=null,q.hold=0,q.bits=0,q.lencode=q.lendyn=new Q6.Buf32(WY),q.distcode=q.distdyn=new Q6.Buf32(UY),q.sane=1,q.back=-1,q8}function j9(V){var q;if(!V||!V.state)return z6;return q=V.state,q.wsize=0,q.whave=0,q.wnext=0,L9(V)}function B9(V,q){var X,K;if(!V||!V.state)return z6;if(K=V.state,q<0)X=0,q=-q;else if(X=(q>>4)+1,q<48)q&=15;if(q&&(q<8||q>15))return z6;if(K.window!==null&&K.wbits!==q)K.window=null;return K.wrap=X,K.wbits=q,j9(V)}function T9(V,q){var X,K;if(!V)return z6;if(K=new MY,V.state=K,K.window=null,X=B9(V,q),X!==q8)V.state=null;return X}function IY(V){return T9(V,zY)}var z9=!0,n4,r4;function kY(V){if(z9){var q;n4=new Q6.Buf32(512),r4=new Q6.Buf32(32),q=0;while(q<144)V.lens[q++]=8;while(q<256)V.lens[q++]=9;while(q<280)V.lens[q++]=7;while(q<288)V.lens[q++]=8;t2(M9,V.lens,0,288,n4,0,V.work,{bits:9}),q=0;while(q<32)V.lens[q++]=5;t2(I9,V.lens,0,32,r4,0,V.work,{bits:5}),z9=!1}V.lencode=n4,V.lenbits=9,V.distcode=r4,V.distbits=5}function v9(V,q,X,K){var Q,Y=V.state;if(Y.window===null)Y.wsize=1<=Y.wsize)Q6.arraySet(Y.window,q,X-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize;else{if(Q=Y.wsize-Y.wnext,Q>K)Q=K;if(Q6.arraySet(Y.window,q,X-K,Q,Y.wnext),K-=Q,K)Q6.arraySet(Y.window,q,X-K,K,0),Y.wnext=K,Y.whave=Y.wsize;else{if(Y.wnext+=Q,Y.wnext===Y.wsize)Y.wnext=0;if(Y.whave>>8&255,X.check=l6(X.check,h,2,0),Z=0,U=0,X.mode=pV;break}if(X.flags=0,X.head)X.head.done=!1;if(!(X.wrap&1)||(((Z&255)<<8)+(Z>>8))%31){V.msg="incorrect header check",X.mode=j0;break}if((Z&15)!==cV){V.msg="unknown compression method",X.mode=j0;break}if(Z>>>=4,U-=4,$=(Z&15)+8,X.wbits===0)X.wbits=$;else if($>X.wbits){V.msg="invalid window size",X.mode=j0;break}X.dmax=1<<$,V.adler=X.check=1,X.mode=Z&512?tV:q5,Z=0,U=0;break;case pV:while(U<16){if(G===0)break q;G--,Z+=K[Y++]<>8&1;if(X.flags&512)h[0]=Z&255,h[1]=Z>>>8&255,X.check=l6(X.check,h,2,0);Z=0,U=0,X.mode=dV;case dV:while(U<32){if(G===0)break q;G--,Z+=K[Y++]<>>8&255,h[2]=Z>>>16&255,h[3]=Z>>>24&255,X.check=l6(X.check,h,4,0);Z=0,U=0,X.mode=nV;case nV:while(U<16){if(G===0)break q;G--,Z+=K[Y++]<>8;if(X.flags&512)h[0]=Z&255,h[1]=Z>>>8&255,X.check=l6(X.check,h,2,0);Z=0,U=0,X.mode=rV;case rV:if(X.flags&1024){while(U<16){if(G===0)break q;G--,Z+=K[Y++]<>>8&255,X.check=l6(X.check,h,2,0);Z=0,U=0}else if(X.head)X.head.extra=null;X.mode=iV;case iV:if(X.flags&1024){if(I=X.length,I>G)I=G;if(I){if(X.head){if($=X.head.extra_len-X.length,!X.head.extra)X.head.extra=new Array(X.head.extra_len);Q6.arraySet(X.head.extra,K,Y,I,$)}if(X.flags&512)X.check=l6(X.check,K,I,Y);G-=I,Y+=I,X.length-=I}if(X.length)break q}X.length=0,X.mode=aV;case aV:if(X.flags&2048){if(G===0)break q;I=0;do if($=K[Y+I++],X.head&&$&&X.length<65536)X.head.name+=String.fromCharCode($);while($&&I>9&1,X.head.done=!0;V.adler=X.check=0,X.mode=q5;break;case tV:while(U<32){if(G===0)break q;G--,Z+=K[Y++]<>>=U&7,U-=U&7,X.mode=d4;break}while(U<3){if(G===0)break q;G--,Z+=K[Y++]<>>=1,U-=1,Z&3){case 0:X.mode=eV;break;case 1:if(kY(X),X.mode=i1,q===r1){Z>>>=2,U-=2;break q}break;case 2:X.mode=X9;break;case 3:V.msg="invalid block type",X.mode=j0}Z>>>=2,U-=2;break;case eV:Z>>>=U&7,U-=U&7;while(U<32){if(G===0)break q;G--,Z+=K[Y++]<>>16^65535)){V.msg="invalid stored block lengths",X.mode=j0;break}if(X.length=Z&65535,Z=0,U=0,X.mode=p4,q===r1)break q;case p4:X.mode=q9;case q9:if(I=X.length,I){if(I>G)I=G;if(I>W)I=W;if(I===0)break q;Q6.arraySet(Q,K,Y,I,J),G-=I,Y+=I,W-=I,J+=I,X.length-=I;break}X.mode=q5;break;case X9:while(U<14){if(G===0)break q;G--,Z+=K[Y++]<>>=5,U-=5,X.ndist=(Z&31)+1,Z>>>=5,U-=5,X.ncode=(Z&15)+4,Z>>>=4,U-=4,X.nlen>286||X.ndist>30){V.msg="too many length or distance symbols",X.mode=j0;break}X.have=0,X.mode=V9;case V9:while(X.have>>=3,U-=3}while(X.have<19)X.lens[D[X.have++]]=0;if(X.lencode=X.lendyn,X.lenbits=7,b={bits:X.lenbits},S=t2(KY,X.lens,0,19,X.lencode,0,X.work,b),X.lenbits=b.bits,S){V.msg="invalid code lengths set",X.mode=j0;break}X.have=0,X.mode=K9;case K9:while(X.have>>24,O=B>>>16&255,N=B&65535,j<=U)break;if(G===0)break q;G--,Z+=K[Y++]<>>=j,U-=j,X.lens[X.have++]=N;else{if(N===16){C=j+2;while(U>>=j,U-=j,X.have===0){V.msg="invalid bit length repeat",X.mode=j0;break}$=X.lens[X.have-1],I=3+(Z&3),Z>>>=2,U-=2}else if(N===17){C=j+3;while(U>>=j,U-=j,$=0,I=3+(Z&7),Z>>>=3,U-=3}else{C=j+7;while(U>>=j,U-=j,$=0,I=11+(Z&127),Z>>>=7,U-=7}if(X.have+I>X.nlen+X.ndist){V.msg="invalid bit length repeat",X.mode=j0;break}while(I--)X.lens[X.have++]=$}}if(X.mode===j0)break;if(X.lens[256]===0){V.msg="invalid code -- missing end-of-block",X.mode=j0;break}if(X.lenbits=9,b={bits:X.lenbits},S=t2(M9,X.lens,0,X.nlen,X.lencode,0,X.work,b),X.lenbits=b.bits,S){V.msg="invalid literal/lengths set",X.mode=j0;break}if(X.distbits=6,X.distcode=X.distdyn,b={bits:X.distbits},S=t2(I9,X.lens,X.nlen,X.ndist,X.distcode,0,X.work,b),X.distbits=b.bits,S){V.msg="invalid distances set",X.mode=j0;break}if(X.mode=i1,q===r1)break q;case i1:X.mode=a1;case a1:if(G>=6&&W>=258){if(V.next_out=J,V.avail_out=W,V.next_in=Y,V.avail_in=G,X.hold=Z,X.bits=U,VY(V,z),J=V.next_out,Q=V.output,W=V.avail_out,Y=V.next_in,K=V.input,G=V.avail_in,Z=X.hold,U=X.bits,X.mode===q5)X.back=-1;break}X.back=0;for(;;){if(B=X.lencode[Z&(1<>>24,O=B>>>16&255,N=B&65535,j<=U)break;if(G===0)break q;G--,Z+=K[Y++]<>R)],j=B>>>24,O=B>>>16&255,N=B&65535,R+j<=U)break;if(G===0)break q;G--,Z+=K[Y++]<>>=R,U-=R,X.back+=R}if(Z>>>=j,U-=j,X.back+=j,X.length=N,O===0){X.mode=Z9;break}if(O&32){X.back=-1,X.mode=q5;break}if(O&64){V.msg="invalid literal/length code",X.mode=j0;break}X.extra=O&15,X.mode=Q9;case Q9:if(X.extra){C=X.extra;while(U>>=X.extra,U-=X.extra,X.back+=X.extra}X.was=X.length,X.mode=Y9;case Y9:for(;;){if(B=X.distcode[Z&(1<>>24,O=B>>>16&255,N=B&65535,j<=U)break;if(G===0)break q;G--,Z+=K[Y++]<>R)],j=B>>>24,O=B>>>16&255,N=B&65535,R+j<=U)break;if(G===0)break q;G--,Z+=K[Y++]<>>=R,U-=R,X.back+=R}if(Z>>>=j,U-=j,X.back+=j,O&64){V.msg="invalid distance code",X.mode=j0;break}X.offset=N,X.extra=O&15,X.mode=J9;case J9:if(X.extra){C=X.extra;while(U>>=X.extra,U-=X.extra,X.back+=X.extra}if(X.offset>X.dmax){V.msg="invalid distance too far back",X.mode=j0;break}X.mode=G9;case G9:if(W===0)break q;if(I=z-W,X.offset>I){if(I=X.offset-I,I>X.whave){if(X.sane){V.msg="invalid distance too far back",X.mode=j0;break}}if(I>X.wnext)I-=X.wnext,M=X.wsize-I;else M=X.wnext-I;if(I>X.length)I=X.length;L=X.window}else L=Q,M=J-X.offset,I=X.length;if(I>W)I=W;W-=I,X.length-=I;do Q[J++]=L[M++];while(--I);if(X.length===0)X.mode=a1;break;case Z9:if(W===0)break q;Q[J++]=X.length,W--,X.mode=a1;break;case d4:if(X.wrap){while(U<32){if(G===0)break q;G--,Z|=K[Y++]<{O9.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 A9=g0((VW,w9)=>{function TY(){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}w9.exports=TY});var S9=g0((q1)=>{var c8=R9(),e2=t6(),s1=g4(),N0=s4(),t4=b1(),vY=x4(),RY=A9(),N9=Object.prototype.toString;function X8(V){if(!(this instanceof X8))return new X8(V);this.options=e2.assign({chunkSize:16384,windowBits:0,to:""},V||{});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&&!(V&&V.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 vY,this.strm.avail_out=0;var X=c8.inflateInit2(this.strm,q.windowBits);if(X!==N0.Z_OK)throw new Error(t4[X]);if(this.header=new RY,c8.inflateGetHeader(this.strm,this.header),q.dictionary){if(typeof q.dictionary==="string")q.dictionary=s1.string2buf(q.dictionary);else if(N9.call(q.dictionary)==="[object ArrayBuffer]")q.dictionary=new Uint8Array(q.dictionary);if(q.raw){if(X=c8.inflateSetDictionary(this.strm,q.dictionary),X!==N0.Z_OK)throw new Error(t4[X])}}}X8.prototype.push=function(V,q){var X=this.strm,K=this.options.chunkSize,Q=this.options.dictionary,Y,J,G,W,Z,U=!1;if(this.ended)return!1;if(J=q===~~q?q:q===!0?N0.Z_FINISH:N0.Z_NO_FLUSH,typeof V==="string")X.input=s1.binstring2buf(V);else if(N9.call(V)==="[object ArrayBuffer]")X.input=new Uint8Array(V);else X.input=V;X.next_in=0,X.avail_in=X.input.length;do{if(X.avail_out===0)X.output=new e2.Buf8(K),X.next_out=0,X.avail_out=K;if(Y=c8.inflate(X,N0.Z_NO_FLUSH),Y===N0.Z_NEED_DICT&&Q)Y=c8.inflateSetDictionary(this.strm,Q);if(Y===N0.Z_BUF_ERROR&&U===!0)Y=N0.Z_OK,U=!1;if(Y!==N0.Z_STREAM_END&&Y!==N0.Z_OK)return this.onEnd(Y),this.ended=!0,!1;if(X.next_out){if(X.avail_out===0||Y===N0.Z_STREAM_END||X.avail_in===0&&(J===N0.Z_FINISH||J===N0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(G=s1.utf8border(X.output,X.next_out),W=X.next_out-G,Z=s1.buf2string(X.output,G),X.next_out=W,X.avail_out=K-W,W)e2.arraySet(X.output,X.output,G,W,0);this.onData(Z)}else this.onData(e2.shrinkBuf(X.output,X.next_out))}if(X.avail_in===0&&X.avail_out===0)U=!0}while((X.avail_in>0||X.avail_out===0)&&Y!==N0.Z_STREAM_END);if(Y===N0.Z_STREAM_END)J=N0.Z_FINISH;if(J===N0.Z_FINISH)return Y=c8.inflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===N0.Z_OK;if(J===N0.Z_SYNC_FLUSH)return this.onEnd(N0.Z_OK),X.avail_out=0,!0;return!0};X8.prototype.onData=function(V){this.chunks.push(V)};X8.prototype.onEnd=function(V){if(V===N0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=e2.flattenChunks(this.chunks);this.chunks=[],this.err=V,this.msg=this.strm.msg};function e4(V,q){var X=new X8(q);if(X.push(V,!0),X.err)throw X.msg||t4[X.err];return X.result}function OY(V,q){return q=q||{},q.raw=!0,e4(V,q)}q1.Inflate=X8;q1.inflate=e4;q1.inflateRaw=OY;q1.ungzip=e4});var X1=g0((QW,$9)=>{var wY=t6().assign,AY=FV(),NY=S9(),SY=s4(),y9={};wY(y9,AY,NY,SY);$9.exports=y9});var zX=globalThis;if(typeof zX.global==="undefined")zX.global=globalThis;var C6=[],W6=[],lq="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(c5=0,MX=lq.length;c50)throw new Error("Invalid string. Length must be a multiple of 4");var X=V.indexOf("=");if(X===-1)X=q;var K=X===q?0:4-X%4;return[X,K]}function s3(V,q){return(V+q)*3/4-q}function t3(V){var q,X=o3(V),K=X[0],Q=X[1],Y=new Uint8Array(s3(K,Q)),J=0,G=Q>0?K-4:K,W;for(W=0;W>16&255,Y[J++]=q>>8&255,Y[J++]=q&255;if(Q===2)q=W6[V.charCodeAt(W)]<<2|W6[V.charCodeAt(W+1)]>>4,Y[J++]=q&255;if(Q===1)q=W6[V.charCodeAt(W)]<<10|W6[V.charCodeAt(W+1)]<<4|W6[V.charCodeAt(W+2)]>>2,Y[J++]=q>>8&255,Y[J++]=q&255;return Y}function e3(V){return C6[V>>18&63]+C6[V>>12&63]+C6[V>>6&63]+C6[V&63]}function qK(V,q,X){var K,Q=[];for(var Y=q;YG?G:J+Y));if(K===1)q=V[X-1],Q.push(C6[q>>2]+C6[q<<4&63]+"==");else if(K===2)q=(V[X-2]<<8)+V[X-1],Q.push(C6[q>>10]+C6[q>>4&63]+C6[q<<2&63]+"=");return Q.join("")}function $1(V,q,X,K,Q){var Y,J,G=Q*8-K-1,W=(1<>1,U=-7,H=X?Q-1:0,z=X?-1:1,I=V[q+H];H+=z,Y=I&(1<<-U)-1,I>>=-U,U+=G;for(;U>0;Y=Y*256+V[q+H],H+=z,U-=8);J=Y&(1<<-U)-1,Y>>=-U,U+=K;for(;U>0;J=J*256+V[q+H],H+=z,U-=8);if(Y===0)Y=1-Z;else if(Y===W)return J?NaN:(I?-1:1)*(1/0);else J=J+Math.pow(2,K),Y=Y-Z;return(I?-1:1)*J*Math.pow(2,Y-K)}function BX(V,q,X,K,Q,Y){var J,G,W,Z=Y*8-Q-1,U=(1<>1,z=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=K?0:Y-1,M=K?1:-1,L=q<0||q===0&&1/q<0?1:0;if(q=Math.abs(q),isNaN(q)||q===1/0)G=isNaN(q)?1:0,J=U;else{if(J=Math.floor(Math.log(q)/Math.LN2),q*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+H>=1)q+=z/W;else q+=z*Math.pow(2,1-H);if(q*W>=2)J++,W/=2;if(J+H>=U)G=0,J=U;else if(J+H>=1)G=(q*W-1)*Math.pow(2,Q),J=J+H;else G=q*Math.pow(2,H-1)*Math.pow(2,Q),J=0}for(;Q>=8;V[X+I]=G&255,I+=M,G/=256,Q-=8);J=J<0;V[X+I]=J&255,I+=M,J/=256,Z-=8);V[X+I-M]|=L*128}var kX=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null;var _q=2147483647;var{btoa:OZ,atob:wZ,File:AZ,Blob:NZ}=globalThis;function a6(V){if(V>_q)throw new RangeError('The value "'+V+'" is invalid for option "size"');let q=new Uint8Array(V);return Object.setPrototypeOf(q,y.prototype),q}function rq(V,q,X){return class K extends X{constructor(){super();Object.defineProperty(this,"message",{value:q.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${V}]`,this.stack,delete this.name}get code(){return V}set code(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${V}]: ${this.message}`}}}var XK=rq("ERR_BUFFER_OUT_OF_BOUNDS",function(V){if(V)return`${V} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),VK=rq("ERR_INVALID_ARG_TYPE",function(V,q){return`The "${V}" argument must be of type number. Received type ${typeof q}`},TypeError),cq=rq("ERR_OUT_OF_RANGE",function(V,q,X){let K=`The value of "${V}" is out of range.`,Q=X;if(Number.isInteger(X)&&Math.abs(X)>4294967296)Q=jX(String(X));else if(typeof X==="bigint"){if(Q=String(X),X>BigInt(2)**BigInt(32)||X<-(BigInt(2)**BigInt(32)))Q=jX(Q);Q+="n"}return K+=` It must be ${q}. Received ${Q}`,K},RangeError);function y(V,q,X){if(typeof V==="number"){if(typeof q==="string")throw new TypeError('The "string" argument must be of type string. Received type number');return iq(V)}return TX(V,q,X)}Object.defineProperty(y.prototype,"parent",{enumerable:!0,get:function(){if(!y.isBuffer(this))return;return this.buffer}});Object.defineProperty(y.prototype,"offset",{enumerable:!0,get:function(){if(!y.isBuffer(this))return;return this.byteOffset}});y.poolSize=8192;function TX(V,q,X){if(typeof V==="string")return QK(V,q);if(ArrayBuffer.isView(V))return YK(V);if(V==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V);if(h6(V,ArrayBuffer)||V&&h6(V.buffer,ArrayBuffer))return dq(V,q,X);if(typeof SharedArrayBuffer!=="undefined"&&(h6(V,SharedArrayBuffer)||V&&h6(V.buffer,SharedArrayBuffer)))return dq(V,q,X);if(typeof V==="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let K=V.valueOf&&V.valueOf();if(K!=null&&K!==V)return y.from(K,q,X);let Q=JK(V);if(Q)return Q;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof V[Symbol.toPrimitive]==="function")return y.from(V[Symbol.toPrimitive]("string"),q,X);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V)}y.from=function(V,q,X){return TX(V,q,X)};Object.setPrototypeOf(y.prototype,Uint8Array.prototype);Object.setPrototypeOf(y,Uint8Array);function vX(V){if(typeof V!=="number")throw new TypeError('"size" argument must be of type number');else if(V<0)throw new RangeError('The value "'+V+'" is invalid for option "size"')}function KK(V,q,X){if(vX(V),V<=0)return a6(V);if(q!==void 0)return typeof X==="string"?a6(V).fill(q,X):a6(V).fill(q);return a6(V)}y.alloc=function(V,q,X){return KK(V,q,X)};function iq(V){return vX(V),a6(V<0?0:aq(V)|0)}y.allocUnsafe=function(V){return iq(V)};y.allocUnsafeSlow=function(V){return iq(V)};function QK(V,q){if(typeof q!=="string"||q==="")q="utf8";if(!y.isEncoding(q))throw new TypeError("Unknown encoding: "+q);let X=RX(V,q)|0,K=a6(X),Q=K.write(V,q);if(Q!==X)K=K.slice(0,Q);return K}function pq(V){let q=V.length<0?0:aq(V.length)|0,X=a6(q);for(let K=0;K=_q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_q.toString(16)+" bytes");return V|0}y.isBuffer=function V(q){return q!=null&&q._isBuffer===!0&&q!==y.prototype};y.compare=function V(q,X){if(h6(q,Uint8Array))q=y.from(q,q.offset,q.byteLength);if(h6(X,Uint8Array))X=y.from(X,X.offset,X.byteLength);if(!y.isBuffer(q)||!y.isBuffer(X))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(q===X)return 0;let K=q.length,Q=X.length;for(let Y=0,J=Math.min(K,Q);YQ.length){if(!y.isBuffer(J))J=y.from(J);J.copy(Q,Y)}else Uint8Array.prototype.set.call(Q,J,Y);else if(!y.isBuffer(J))throw new TypeError('"list" argument must be an Array of Buffers');else J.copy(Q,Y);Y+=J.length}return Q};function RX(V,q){if(y.isBuffer(V))return V.length;if(ArrayBuffer.isView(V)||h6(V,ArrayBuffer))return V.byteLength;if(typeof V!=="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof V);let X=V.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&X===0)return 0;let Q=!1;for(;;)switch(q){case"ascii":case"latin1":case"binary":return X;case"utf8":case"utf-8":return nq(V).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X*2;case"hex":return X>>>1;case"base64":return hX(V).length;default:if(Q)return K?-1:nq(V).length;q=(""+q).toLowerCase(),Q=!0}}y.byteLength=RX;function GK(V,q,X){let K=!1;if(q===void 0||q<0)q=0;if(q>this.length)return"";if(X===void 0||X>this.length)X=this.length;if(X<=0)return"";if(X>>>=0,q>>>=0,X<=q)return"";if(!V)V="utf8";while(!0)switch(V){case"hex":return LK(this,q,X);case"utf8":case"utf-8":return wX(this,q,X);case"ascii":return kK(this,q,X);case"latin1":case"binary":return EK(this,q,X);case"base64":return MK(this,q,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jK(this,q,X);default:if(K)throw new TypeError("Unknown encoding: "+V);V=(V+"").toLowerCase(),K=!0}}y.prototype._isBuffer=!0;function p5(V,q,X){let K=V[q];V[q]=V[X],V[X]=K}y.prototype.swap16=function V(){let q=this.length;if(q%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let X=0;XX)q+=" ... ";return""};if(kX)y.prototype[kX]=y.prototype.inspect;y.prototype.compare=function V(q,X,K,Q,Y){if(h6(q,Uint8Array))q=y.from(q,q.offset,q.byteLength);if(!y.isBuffer(q))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof q);if(X===void 0)X=0;if(K===void 0)K=q?q.length:0;if(Q===void 0)Q=0;if(Y===void 0)Y=this.length;if(X<0||K>q.length||Q<0||Y>this.length)throw new RangeError("out of range index");if(Q>=Y&&X>=K)return 0;if(Q>=Y)return-1;if(X>=K)return 1;if(X>>>=0,K>>>=0,Q>>>=0,Y>>>=0,this===q)return 0;let J=Y-Q,G=K-X,W=Math.min(J,G),Z=this.slice(Q,Y),U=q.slice(X,K);for(let H=0;H2147483647)X=2147483647;else if(X<-2147483648)X=-2147483648;if(X=+X,Number.isNaN(X))X=Q?0:V.length-1;if(X<0)X=V.length+X;if(X>=V.length)if(Q)return-1;else X=V.length-1;else if(X<0)if(Q)X=0;else return-1;if(typeof q==="string")q=y.from(q,K);if(y.isBuffer(q)){if(q.length===0)return-1;return EX(V,q,X,K,Q)}else if(typeof q==="number"){if(q=q&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(V,q,X);else return Uint8Array.prototype.lastIndexOf.call(V,q,X);return EX(V,[q],X,K,Q)}throw new TypeError("val must be string, number or Buffer")}function EX(V,q,X,K,Q){let Y=1,J=V.length,G=q.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if(V.length<2||q.length<2)return-1;Y=2,J/=2,G/=2,X/=2}}function W(U,H){if(Y===1)return U[H];else return U.readUInt16BE(H*Y)}let Z;if(Q){let U=-1;for(Z=X;ZJ)X=J-G;for(Z=X;Z>=0;Z--){let U=!0;for(let H=0;HQ)K=Q;let Y=q.length;if(K>Y/2)K=Y/2;let J;for(J=0;J>>0,isFinite(K)){if(K=K>>>0,Q===void 0)Q="utf8"}else Q=K,K=void 0;else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Y=this.length-X;if(K===void 0||K>Y)K=Y;if(q.length>0&&(K<0||X<0)||X>this.length)throw new RangeError("Attempt to write outside buffer bounds");if(!Q)Q="utf8";let J=!1;for(;;)switch(Q){case"hex":return ZK(this,q,X,K);case"utf8":case"utf-8":return WK(this,q,X,K);case"ascii":case"latin1":case"binary":return UK(this,q,X,K);case"base64":return HK(this,q,X,K);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zK(this,q,X,K);default:if(J)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),J=!0}};y.prototype.toJSON=function V(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function MK(V,q,X){if(q===0&&X===V.length)return IX(V);else return IX(V.slice(q,X))}function wX(V,q,X){X=Math.min(V.length,X);let K=[],Q=q;while(Q239?4:Y>223?3:Y>191?2:1;if(Q+G<=X){let W,Z,U,H;switch(G){case 1:if(Y<128)J=Y;break;case 2:if(W=V[Q+1],(W&192)===128){if(H=(Y&31)<<6|W&63,H>127)J=H}break;case 3:if(W=V[Q+1],Z=V[Q+2],(W&192)===128&&(Z&192)===128){if(H=(Y&15)<<12|(W&63)<<6|Z&63,H>2047&&(H<55296||H>57343))J=H}break;case 4:if(W=V[Q+1],Z=V[Q+2],U=V[Q+3],(W&192)===128&&(Z&192)===128&&(U&192)===128){if(H=(Y&15)<<18|(W&63)<<12|(Z&63)<<6|U&63,H>65535&&H<1114112)J=H}}}if(J===null)J=65533,G=1;else if(J>65535)J-=65536,K.push(J>>>10&1023|55296),J=56320|J&1023;K.push(J),Q+=G}return IK(K)}var LX=4096;function IK(V){let q=V.length;if(q<=LX)return String.fromCharCode.apply(String,V);let X="",K=0;while(KK)X=K;let Q="";for(let Y=q;YK)q=K;if(X<0){if(X+=K,X<0)X=0}else if(X>K)X=K;if(XX)throw new RangeError("Trying to access beyond buffer length")}y.prototype.readUintLE=y.prototype.readUIntLE=function V(q,X,K){if(q=q>>>0,X=X>>>0,!K)D0(q,X,this.length);let Q=this[q],Y=1,J=0;while(++J>>0,X=X>>>0,!K)D0(q,X,this.length);let Q=this[q+--X],Y=1;while(X>0&&(Y*=256))Q+=this[q+--X]*Y;return Q};y.prototype.readUint8=y.prototype.readUInt8=function V(q,X){if(q=q>>>0,!X)D0(q,1,this.length);return this[q]};y.prototype.readUint16LE=y.prototype.readUInt16LE=function V(q,X){if(q=q>>>0,!X)D0(q,2,this.length);return this[q]|this[q+1]<<8};y.prototype.readUint16BE=y.prototype.readUInt16BE=function V(q,X){if(q=q>>>0,!X)D0(q,2,this.length);return this[q]<<8|this[q+1]};y.prototype.readUint32LE=y.prototype.readUInt32LE=function V(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return(this[q]|this[q+1]<<8|this[q+2]<<16)+this[q+3]*16777216};y.prototype.readUint32BE=y.prototype.readUInt32BE=function V(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return this[q]*16777216+(this[q+1]<<16|this[q+2]<<8|this[q+3])};y.prototype.readBigUInt64LE=M5(function V(q){q=q>>>0,y8(q,"offset");let X=this[q],K=this[q+7];if(X===void 0||K===void 0)C2(q,this.length-8);let Q=X+this[++q]*256+this[++q]*65536+this[++q]*16777216,Y=this[++q]+this[++q]*256+this[++q]*65536+K*16777216;return BigInt(Q)+(BigInt(Y)<>>0,y8(q,"offset");let X=this[q],K=this[q+7];if(X===void 0||K===void 0)C2(q,this.length-8);let Q=X*16777216+this[++q]*65536+this[++q]*256+this[++q],Y=this[++q]*16777216+this[++q]*65536+this[++q]*256+K;return(BigInt(Q)<>>0,X=X>>>0,!K)D0(q,X,this.length);let Q=this[q],Y=1,J=0;while(++J=Y)Q-=Math.pow(2,8*X);return Q};y.prototype.readIntBE=function V(q,X,K){if(q=q>>>0,X=X>>>0,!K)D0(q,X,this.length);let Q=X,Y=1,J=this[q+--Q];while(Q>0&&(Y*=256))J+=this[q+--Q]*Y;if(Y*=128,J>=Y)J-=Math.pow(2,8*X);return J};y.prototype.readInt8=function V(q,X){if(q=q>>>0,!X)D0(q,1,this.length);if(!(this[q]&128))return this[q];return(255-this[q]+1)*-1};y.prototype.readInt16LE=function V(q,X){if(q=q>>>0,!X)D0(q,2,this.length);let K=this[q]|this[q+1]<<8;return K&32768?K|4294901760:K};y.prototype.readInt16BE=function V(q,X){if(q=q>>>0,!X)D0(q,2,this.length);let K=this[q+1]|this[q]<<8;return K&32768?K|4294901760:K};y.prototype.readInt32LE=function V(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return this[q]|this[q+1]<<8|this[q+2]<<16|this[q+3]<<24};y.prototype.readInt32BE=function V(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return this[q]<<24|this[q+1]<<16|this[q+2]<<8|this[q+3]};y.prototype.readBigInt64LE=M5(function V(q){q=q>>>0,y8(q,"offset");let X=this[q],K=this[q+7];if(X===void 0||K===void 0)C2(q,this.length-8);let Q=this[q+4]+this[q+5]*256+this[q+6]*65536+(K<<24);return(BigInt(Q)<>>0,y8(q,"offset");let X=this[q],K=this[q+7];if(X===void 0||K===void 0)C2(q,this.length-8);let Q=(X<<24)+this[++q]*65536+this[++q]*256+this[++q];return(BigInt(Q)<>>0,!X)D0(q,4,this.length);return $1(this,q,!0,23,4)};y.prototype.readFloatBE=function V(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return $1(this,q,!1,23,4)};y.prototype.readDoubleLE=function V(q,X){if(q=q>>>0,!X)D0(q,8,this.length);return $1(this,q,!0,52,8)};y.prototype.readDoubleBE=function V(q,X){if(q=q>>>0,!X)D0(q,8,this.length);return $1(this,q,!1,52,8)};function s0(V,q,X,K,Q,Y){if(!y.isBuffer(V))throw new TypeError('"buffer" argument must be a Buffer instance');if(q>Q||qV.length)throw new RangeError("Index out of range")}y.prototype.writeUintLE=y.prototype.writeUIntLE=function V(q,X,K,Q){if(q=+q,X=X>>>0,K=K>>>0,!Q){let G=Math.pow(2,8*K)-1;s0(this,q,X,K,G,0)}let Y=1,J=0;this[X]=q&255;while(++J>>0,K=K>>>0,!Q){let G=Math.pow(2,8*K)-1;s0(this,q,X,K,G,0)}let Y=K-1,J=1;this[X+Y]=q&255;while(--Y>=0&&(J*=256))this[X+Y]=q/J&255;return X+K};y.prototype.writeUint8=y.prototype.writeUInt8=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,1,255,0);return this[X]=q&255,X+1};y.prototype.writeUint16LE=y.prototype.writeUInt16LE=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,2,65535,0);return this[X]=q&255,this[X+1]=q>>>8,X+2};y.prototype.writeUint16BE=y.prototype.writeUInt16BE=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,2,65535,0);return this[X]=q>>>8,this[X+1]=q&255,X+2};y.prototype.writeUint32LE=y.prototype.writeUInt32LE=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,4,4294967295,0);return this[X+3]=q>>>24,this[X+2]=q>>>16,this[X+1]=q>>>8,this[X]=q&255,X+4};y.prototype.writeUint32BE=y.prototype.writeUInt32BE=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,4,4294967295,0);return this[X]=q>>>24,this[X+1]=q>>>16,this[X+2]=q>>>8,this[X+3]=q&255,X+4};function AX(V,q,X,K,Q){CX(q,K,Q,V,X,7);let Y=Number(q&BigInt(4294967295));V[X++]=Y,Y=Y>>8,V[X++]=Y,Y=Y>>8,V[X++]=Y,Y=Y>>8,V[X++]=Y;let J=Number(q>>BigInt(32)&BigInt(4294967295));return V[X++]=J,J=J>>8,V[X++]=J,J=J>>8,V[X++]=J,J=J>>8,V[X++]=J,X}function NX(V,q,X,K,Q){CX(q,K,Q,V,X,7);let Y=Number(q&BigInt(4294967295));V[X+7]=Y,Y=Y>>8,V[X+6]=Y,Y=Y>>8,V[X+5]=Y,Y=Y>>8,V[X+4]=Y;let J=Number(q>>BigInt(32)&BigInt(4294967295));return V[X+3]=J,J=J>>8,V[X+2]=J,J=J>>8,V[X+1]=J,J=J>>8,V[X]=J,X+8}y.prototype.writeBigUInt64LE=M5(function V(q,X=0){return AX(this,q,X,BigInt(0),BigInt("0xffffffffffffffff"))});y.prototype.writeBigUInt64BE=M5(function V(q,X=0){return NX(this,q,X,BigInt(0),BigInt("0xffffffffffffffff"))});y.prototype.writeIntLE=function V(q,X,K,Q){if(q=+q,X=X>>>0,!Q){let W=Math.pow(2,8*K-1);s0(this,q,X,K,W-1,-W)}let Y=0,J=1,G=0;this[X]=q&255;while(++Y>0)-G&255}return X+K};y.prototype.writeIntBE=function V(q,X,K,Q){if(q=+q,X=X>>>0,!Q){let W=Math.pow(2,8*K-1);s0(this,q,X,K,W-1,-W)}let Y=K-1,J=1,G=0;this[X+Y]=q&255;while(--Y>=0&&(J*=256)){if(q<0&&G===0&&this[X+Y+1]!==0)G=1;this[X+Y]=(q/J>>0)-G&255}return X+K};y.prototype.writeInt8=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,1,127,-128);if(q<0)q=255+q+1;return this[X]=q&255,X+1};y.prototype.writeInt16LE=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,2,32767,-32768);return this[X]=q&255,this[X+1]=q>>>8,X+2};y.prototype.writeInt16BE=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,2,32767,-32768);return this[X]=q>>>8,this[X+1]=q&255,X+2};y.prototype.writeInt32LE=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,4,2147483647,-2147483648);return this[X]=q&255,this[X+1]=q>>>8,this[X+2]=q>>>16,this[X+3]=q>>>24,X+4};y.prototype.writeInt32BE=function V(q,X,K){if(q=+q,X=X>>>0,!K)s0(this,q,X,4,2147483647,-2147483648);if(q<0)q=4294967295+q+1;return this[X]=q>>>24,this[X+1]=q>>>16,this[X+2]=q>>>8,this[X+3]=q&255,X+4};y.prototype.writeBigInt64LE=M5(function V(q,X=0){return AX(this,q,X,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});y.prototype.writeBigInt64BE=M5(function V(q,X=0){return NX(this,q,X,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function SX(V,q,X,K,Q,Y){if(X+K>V.length)throw new RangeError("Index out of range");if(X<0)throw new RangeError("Index out of range")}function yX(V,q,X,K,Q){if(q=+q,X=X>>>0,!Q)SX(V,q,X,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return BX(V,q,X,K,23,4),X+4}y.prototype.writeFloatLE=function V(q,X,K){return yX(this,q,X,!0,K)};y.prototype.writeFloatBE=function V(q,X,K){return yX(this,q,X,!1,K)};function $X(V,q,X,K,Q){if(q=+q,X=X>>>0,!Q)SX(V,q,X,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return BX(V,q,X,K,52,8),X+8}y.prototype.writeDoubleLE=function V(q,X,K){return $X(this,q,X,!0,K)};y.prototype.writeDoubleBE=function V(q,X,K){return $X(this,q,X,!1,K)};y.prototype.copy=function V(q,X,K,Q){if(!y.isBuffer(q))throw new TypeError("argument should be a Buffer");if(!K)K=0;if(!Q&&Q!==0)Q=this.length;if(X>=q.length)X=q.length;if(!X)X=0;if(Q>0&&Q=this.length)throw new RangeError("Index out of range");if(Q<0)throw new RangeError("sourceEnd out of bounds");if(Q>this.length)Q=this.length;if(q.length-X>>0,K=K===void 0?this.length:K>>>0,!q)q=0;let Y;if(typeof q==="number")for(Y=X;Y=K+4;X-=3)q=`_${V.slice(X-3,X)}${q}`;return`${V.slice(0,X)}${q}`}function BK(V,q,X){if(y8(q,"offset"),V[q]===void 0||V[q+X]===void 0)C2(q,V.length-(X+1))}function CX(V,q,X,K,Q,Y){if(V>X||V3)if(q===0||q===BigInt(0))G=`>= 0${J} and < 2${J} ** ${(Y+1)*8}${J}`;else G=`>= -(2${J} ** ${(Y+1)*8-1}${J}) and < 2 ** ${(Y+1)*8-1}${J}`;else G=`>= ${q}${J} and <= ${X}${J}`;throw new cq("value",G,V)}BK(K,Q,Y)}function y8(V,q){if(typeof V!=="number")throw new VK(q,"number",V)}function C2(V,q,X){if(Math.floor(V)!==V)throw y8(V,X),new cq(X||"offset","an integer",V);if(q<0)throw new XK;throw new cq(X||"offset",`>= ${X?1:0} and <= ${q}`,V)}var TK=/[^+/0-9A-Za-z-_]/g;function vK(V){if(V=V.split("=")[0],V=V.trim().replace(TK,""),V.length<2)return"";while(V.length%4!==0)V=V+"=";return V}function nq(V,q){q=q||1/0;let X,K=V.length,Q=null,Y=[];for(let J=0;J55295&&X<57344){if(!Q){if(X>56319){if((q-=3)>-1)Y.push(239,191,189);continue}else if(J+1===K){if((q-=3)>-1)Y.push(239,191,189);continue}Q=X;continue}if(X<56320){if((q-=3)>-1)Y.push(239,191,189);Q=X;continue}X=(Q-55296<<10|X-56320)+65536}else if(Q){if((q-=3)>-1)Y.push(239,191,189)}if(Q=null,X<128){if((q-=1)<0)break;Y.push(X)}else if(X<2048){if((q-=2)<0)break;Y.push(X>>6|192,X&63|128)}else if(X<65536){if((q-=3)<0)break;Y.push(X>>12|224,X>>6&63|128,X&63|128)}else if(X<1114112){if((q-=4)<0)break;Y.push(X>>18|240,X>>12&63|128,X>>6&63|128,X&63|128)}else throw new Error("Invalid code point")}return Y}function RK(V){let q=[];for(let X=0;X>8,Q=X%256,Y.push(Q),Y.push(K)}return Y}function hX(V){return t3(vK(V))}function C1(V,q,X,K){let Q;for(Q=0;Q=q.length||Q>=V.length)break;q[Q+X]=V[Q]}return Q}function h6(V,q){return V instanceof q||V!=null&&V.constructor!=null&&V.constructor.name!=null&&V.constructor.name===q.name}var wK=function(){let V=new Array(256);for(let q=0;q<16;++q){let X=q*16;for(let K=0;K<16;++K)V[X+K]="0123456789abcdef"[q]+"0123456789abcdef"[K]}return V}();function M5(V){return typeof BigInt==="undefined"?AK:V}function AK(){throw new Error("BigInt not supported")}function oq(V){return()=>{throw new Error(V+" is not implemented for node:buffer browser polyfill")}}var SZ=oq("resolveObjectURL"),yZ=oq("isUtf8");var $Z=oq("transcode");var TZ=$2(gX());var HX={};a3(HX,{waitForTick:()=>R6,values:()=>d8,utf8Encode:()=>PK,utf16Encode:()=>E4,utf16Decode:()=>x2,typedArrayFor:()=>D2,translate:()=>c0,toUint8Array:()=>r5,toRadians:()=>O0,toHexStringOfMinLength:()=>D6,toHexString:()=>u6,toDegrees:()=>I1,toCodePoint:()=>K4,toCharCode:()=>s,sum:()=>z4,stroke:()=>B8,square:()=>uG,sortedUniq:()=>H4,skewRadians:()=>I2,skewDegrees:()=>FG,sizeInBytes:()=>P8,singleQuote:()=>t9,showText:()=>j1,setWordSpacing:()=>bG,setTextRise:()=>fG,setTextRenderingMode:()=>lG,setTextMatrix:()=>F3,setStrokingRgbColor:()=>g7,setStrokingGrayscaleColor:()=>D7,setStrokingColor:()=>v8,setStrokingCmykColor:()=>b7,setLineWidth:()=>j8,setLineJoin:()=>DG,setLineHeight:()=>F7,setLineCap:()=>k2,setGraphicsState:()=>i6,setFontAndSize:()=>T8,setFillingRgbColor:()=>u7,setFillingGrayscaleColor:()=>P7,setFillingColor:()=>E6,setFillingCmykColor:()=>x7,setDashPattern:()=>L8,setCharacterSqueeze:()=>mG,setCharacterSpacing:()=>xG,scale:()=>g5,rotateRectangle:()=>y7,rotateRadians:()=>x5,rotateInPlace:()=>L6,rotateDegrees:()=>M2,rotateAndSkewTextRadiansAndTranslate:()=>L2,rotateAndSkewTextDegreesAndTranslate:()=>_G,rgb:()=>Y0,reverseArray:()=>k5,restoreDashPattern:()=>PG,reduceRotation:()=>k6,rectanglesAreEqual:()=>n8,rectangle:()=>h3,range:()=>M4,radiansToDegrees:()=>C3,radians:()=>CG,pushGraphicsState:()=>B0,popGraphicsState:()=>T0,pluckIndices:()=>I4,pdfDocEncodingDecode:()=>J1,parseDate:()=>P2,padStart:()=>e0,numberToString:()=>B4,normalizeAppearance:()=>G6,nextLine:()=>h7,newlineChars:()=>CK,moveTo:()=>J6,moveText:()=>gG,mergeUint8Arrays:()=>W4,mergeLines:()=>F1,mergeIntoTypedArray:()=>Z4,lowSurrogate:()=>u1,lineTo:()=>S0,lineSplit:()=>F2,layoutSinglelineText:()=>v2,layoutMultilineText:()=>uq,layoutCombedText:()=>KX,last:()=>n5,isWithinBMP:()=>L4,isType:()=>X3,isStandardFont:()=>e1,isNewlineChar:()=>Y4,highSurrogate:()=>D1,hasUtf16BOM:()=>b2,hasSurrogates:()=>j4,grayscale:()=>Sq,getType:()=>q3,findLastMatch:()=>F8,fillAndStroke:()=>L1,fill:()=>E1,escapedNewlineChars:()=>mX,escapeRegExp:()=>bX,error:()=>j5,endText:()=>T1,endPath:()=>wq,endMarkedContent:()=>Nq,encodeToBase64:()=>X4,drawTextLines:()=>Fq,drawTextField:()=>Pq,drawText:()=>rG,drawSvgPath:()=>d7,drawRectangle:()=>b5,drawRadioButton:()=>T2,drawPage:()=>c7,drawOptionList:()=>n7,drawObject:()=>j2,drawLinesOfText:()=>_7,drawLine:()=>p7,drawImage:()=>w1,drawEllipsePath:()=>x3,drawEllipse:()=>O1,drawCheckMark:()=>b3,drawCheckBox:()=>B2,drawButton:()=>hq,degreesToRadians:()=>U5,degrees:()=>p,defaultTextFieldAppearanceProvider:()=>GX,defaultRadioGroupAppearanceProvider:()=>YX,defaultOptionListAppearanceProvider:()=>WX,defaultDropdownAppearanceProvider:()=>ZX,defaultCheckBoxAppearanceProvider:()=>QX,defaultButtonAppearanceProvider:()=>JX,decodePDFRawStream:()=>V2,decodeFromBase64DataUri:()=>V4,decodeFromBase64:()=>q4,createValueErrorMsg:()=>e9,createTypeErrorMsg:()=>V3,createPDFAcroFields:()=>Z2,createPDFAcroField:()=>Iq,copyStringIntoBuffer:()=>I0,concatTransformationMatrix:()=>k1,componentsToColor:()=>l0,colorToComponents:()=>$q,cmyk:()=>yq,closePath:()=>N6,clipEvenOdd:()=>hG,clip:()=>Oq,cleanText:()=>I5,charSplit:()=>J4,charFromHexCode:()=>Q4,charFromCode:()=>t0,charAtIndex:()=>P1,canBeConvertedToUint8Array:()=>k4,bytesFor:()=>L5,byAscendingId:()=>U4,breakTextIntoLines:()=>G4,beginText:()=>B1,beginMarkedContent:()=>Aq,backtick:()=>$0,assertRangeOrUndefined:()=>X6,assertRange:()=>b0,assertPositive:()=>X5,assertOrUndefined:()=>F,assertMultiple:()=>Y1,assertIsSubset:()=>V7,assertIsOneOfOrUndefined:()=>a0,assertIsOneOf:()=>M6,assertIs:()=>T,assertInteger:()=>K7,assertEachIs:()=>Q1,asPDFNumber:()=>f,asPDFName:()=>z2,asNumber:()=>t,arrayAsString:()=>u2,appendQuadraticCurve:()=>E2,appendBezierCurve:()=>p0,adjustDimsForRotation:()=>r6,addRandomSuffix:()=>$K,ViewerPreferences:()=>W1,UnsupportedEncodingError:()=>Q7,UnrecognizedStreamTypeError:()=>J7,UnexpectedObjectTypeError:()=>A5,UnexpectedFieldTypeError:()=>z5,UnbalancedParenthesisError:()=>E7,TextRenderingMode:()=>C7,TextAlignment:()=>v0,StandardFonts:()=>N8,StandardFontValues:()=>o9,StandardFontEmbedder:()=>$5,StalledParserError:()=>L7,RotationTypes:()=>E8,RichTextFieldReadError:()=>e7,ReparseError:()=>Q8,RemovePageFromEmptyDocumentError:()=>o7,ReadingDirection:()=>H8,PrivateConstructorError:()=>K8,PrintScaling:()=>z8,PngEmbedder:()=>X2,ParseSpeeds:()=>A1,PageSizes:()=>UX,PageEmbeddingMismatchedContextError:()=>G7,PDFXRefStreamParser:()=>jq,PDFWriter:()=>o8,PDFWidgetAnnotation:()=>M8,PDFTrailerDict:()=>Qq,PDFTrailer:()=>S5,PDFTextField:()=>A8,PDFString:()=>K0,PDFStreamWriter:()=>Jq,PDFStreamParsingError:()=>k7,PDFStream:()=>E0,PDFSignature:()=>O2,PDFRef:()=>a,PDFRawStream:()=>A6,PDFRadioGroup:()=>l5,PDFParsingError:()=>V5,PDFParser:()=>Bq,PDFPageTree:()=>U2,PDFPageLeaf:()=>_0,PDFPageEmbedder:()=>K2,PDFPage:()=>y0,PDFOptionList:()=>w8,PDFOperatorNames:()=>X0,PDFOperator:()=>e,PDFObjectStreamParser:()=>Lq,PDFObjectStream:()=>a8,PDFObjectParsingError:()=>M7,PDFObjectParser:()=>H2,PDFObjectCopier:()=>Z1,PDFObject:()=>z0,PDFNumber:()=>x,PDFNull:()=>F0,PDFName:()=>k,PDFJavaScript:()=>xq,PDFInvalidObjectParsingError:()=>I7,PDFInvalidObject:()=>s8,PDFImage:()=>R8,PDFHexString:()=>g,PDFHeader:()=>_6,PDFForm:()=>gq,PDFFont:()=>w0,PDFFlateStream:()=>N5,PDFField:()=>d0,PDFEmbeddedPage:()=>R2,PDFDropdown:()=>O8,PDFDocument:()=>o0,PDFDict:()=>m,PDFCrossRefStream:()=>Yq,PDFCrossRefSection:()=>i8,PDFContext:()=>Z8,PDFContentStream:()=>p6,PDFCheckBox:()=>f5,PDFCatalog:()=>W2,PDFButton:()=>S8,PDFBool:()=>c6,PDFArrayIsNotRectangleError:()=>Z7,PDFArray:()=>i,PDFAnnotation:()=>Mq,PDFAcroText:()=>J5,PDFAcroTerminal:()=>K6,PDFAcroSignature:()=>F5,PDFAcroRadioButton:()=>Z5,PDFAcroPushButton:()=>G5,PDFAcroNonTerminal:()=>Y5,PDFAcroListBox:()=>W5,PDFAcroForm:()=>P5,PDFAcroField:()=>Y2,PDFAcroComboBox:()=>Q5,PDFAcroChoice:()=>G2,PDFAcroCheckBox:()=>K5,PDFAcroButton:()=>h5,NumberParsingError:()=>Vq,NonFullScreenPageMode:()=>U8,NoSuchFieldError:()=>s7,NextByteAssertionError:()=>z7,MultiSelectValueError:()=>W7,MissingTfOperatorError:()=>H7,MissingPageContentsEmbeddingError:()=>Y7,MissingPDFHeaderError:()=>j7,MissingOnValueCheckError:()=>aG,MissingKeywordError:()=>B7,MissingDAEntryError:()=>U7,MissingCatalogError:()=>iY,MethodNotImplementedError:()=>u0,LineJoinStyle:()=>$7,LineCapStyle:()=>u5,JpegEmbedder:()=>q2,InvalidTargetIndexError:()=>qq,InvalidPDFDateStringError:()=>G1,InvalidMaxLengthError:()=>VX,InvalidFieldNamePartError:()=>t7,InvalidAcroFieldValueError:()=>J8,IndexOutOfBoundsError:()=>Y8,ImageAlignment:()=>T6,ForeignPageError:()=>a7,FontkitNotRegisteredError:()=>i7,FileEmbedder:()=>Wq,FieldExistsAsNonTerminalError:()=>oG,FieldAlreadyExistsError:()=>Dq,ExceededMaxLengthError:()=>XX,EncryptedPDFError:()=>r7,Duplex:()=>Q2,CustomFontSubsetEmbedder:()=>Zq,CustomFontEmbedder:()=>C5,CorruptPageTreeError:()=>Xq,CombedTextLayoutError:()=>qX,ColorTypes:()=>H5,CharCodes:()=>E,Cache:()=>m0,BlendMode:()=>S6,AppearanceCharacteristics:()=>J2,AnnotationFlags:()=>k8,AcroTextFlags:()=>L0,AcroFieldFlags:()=>Y6,AcroChoiceFlags:()=>G0,AcroButtonFlags:()=>f0,AFRelationship:()=>t8});/*! ***************************************************************************** +(()=>{var dK=Object.create;var{getPrototypeOf:nK,defineProperty:lq,getOwnPropertyNames:rK}=Object;var iK=Object.prototype.hasOwnProperty;function aK(q){return this[q]}var oK,sK,$8=(q,X,V)=>{var K=q!=null&&typeof q==="object";if(K){var Q=X?oK??=new WeakMap:sK??=new WeakMap,Y=Q.get(q);if(Y)return Y}V=q!=null?dK(nK(q)):{};let J=X||!q||!q.__esModule?lq(V,"default",{value:q,enumerable:!0}):V;for(let G of rK(q))if(!iK.call(J,G))lq(J,G,{get:aK.bind(q,G),enumerable:!0});if(K)Q.set(q,J);return J};var g0=(q,X)=>()=>(X||q((X={exports:{}}).exports,X),X.exports);var tK=(q)=>q;function eK(q,X){this[q]=tK.bind(null,X)}var qQ=(q,X)=>{for(var V in X)lq(q,V,{get:X[V],enumerable:!0,configurable:!0,set:eK.bind(X,V)})};var gX=g0((b3,uX)=>{var w0=uX.exports={},F2,P2;function tq(){throw Error("setTimeout has not been defined")}function eq(){throw Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")F2=setTimeout;else F2=tq}catch(q){F2=tq}try{if(typeof clearTimeout==="function")P2=clearTimeout;else P2=eq}catch(q){P2=eq}})();function FX(q){if(F2===setTimeout)return setTimeout(q,0);if((F2===tq||!F2)&&setTimeout)return F2=setTimeout,setTimeout(q,0);try{return F2(q,0)}catch(X){try{return F2.call(null,q,0)}catch(V){return F2.call(this,q,0)}}}function FQ(q){if(P2===clearTimeout)return clearTimeout(q);if((P2===eq||!P2)&&clearTimeout)return P2=clearTimeout,clearTimeout(q);try{return P2(q)}catch(X){try{return P2.call(null,q)}catch(V){return P2.call(this,q)}}}var o2=[],$5=!1,d6,F1=-1;function PQ(){if(!$5||!d6)return;if($5=!1,d6.length)o2=d6.concat(o2);else F1=-1;if(o2.length)PX()}function PX(){if($5)return;var q=FX(PQ);$5=!0;var X=o2.length;while(X){d6=o2,o2=[];while(++F11)for(var V=1;V{var _Q=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function cQ(q,X){return Object.prototype.hasOwnProperty.call(q,X)}r0.assign=function(q){var X=Array.prototype.slice.call(arguments,1);while(X.length){var V=X.shift();if(!V)continue;if(typeof V!=="object")throw TypeError(V+"must be non-object");for(var K in V)if(cQ(V,K))q[K]=V[K]}return q};r0.shrinkBuf=function(q,X){if(q.length===X)return q;if(q.subarray)return q.subarray(0,X);return q.length=X,q};var pQ={arraySet:function(q,X,V,K,Q){if(X.subarray&&q.subarray){q.set(X.subarray(V,V+K),Q);return}for(var Y=0;Y{var nQ=t2(),rQ=4,pX=0,dX=1,iQ=2;function u5(q){var X=q.length;while(--X>=0)q[X]=0}var aQ=0,sX=1,oQ=2,sQ=3,tQ=258,S4=29,p8=256,f8=p8+1+S4,D5=30,y4=19,tX=2*f8+1,i6=15,R4=16,eQ=7,$4=256,eX=16,qV=17,XV=18,w4=[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],x1=[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],qY=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],VV=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],XY=512,e2=Array((f8+2)*2);u5(e2);var m8=Array(D5*2);u5(m8);var l8=Array(XY);u5(l8);var _8=Array(tQ-sQ+1);u5(_8);var C4=Array(S4);u5(C4);var b1=Array(D5);u5(b1);function v4(q,X,V,K,Q){this.static_tree=q,this.extra_bits=X,this.extra_base=V,this.elems=K,this.max_length=Q,this.has_stree=q&&q.length}var KV,QV,YV;function O4(q,X){this.dyn_tree=q,this.max_code=0,this.stat_desc=X}function JV(q){return q<256?l8[q]:l8[256+(q>>>7)]}function c8(q,X){q.pending_buf[q.pending++]=X&255,q.pending_buf[q.pending++]=X>>>8&255}function q2(q,X,V){if(q.bi_valid>R4-V)q.bi_buf|=X<>R4-q.bi_valid,q.bi_valid+=V-R4;else q.bi_buf|=X<>>=1,V<<=1;while(--X>0);return V>>>1}function VY(q){if(q.bi_valid===16)c8(q,q.bi_buf),q.bi_buf=0,q.bi_valid=0;else if(q.bi_valid>=8)q.pending_buf[q.pending++]=q.bi_buf&255,q.bi_buf>>=8,q.bi_valid-=8}function KY(q,X){var{dyn_tree:V,max_code:K}=X,Q=X.stat_desc.static_tree,Y=X.stat_desc.has_stree,J=X.stat_desc.extra_bits,G=X.stat_desc.extra_base,W=X.stat_desc.max_length,Z,H,U,z,k,M,j=0;for(z=0;z<=i6;z++)q.bl_count[z]=0;V[q.heap[q.heap_max]*2+1]=0;for(Z=q.heap_max+1;ZW)z=W,j++;if(V[H*2+1]=z,H>K)continue;if(q.bl_count[z]++,k=0,H>=G)k=J[H-G];if(M=V[H*2],q.opt_len+=M*(z+k),Y)q.static_len+=M*(Q[H*2+1]+k)}if(j===0)return;do{z=W-1;while(q.bl_count[z]===0)z--;q.bl_count[z]--,q.bl_count[z+1]+=2,q.bl_count[W]--,j-=2}while(j>0);for(z=W;z!==0;z--){H=q.bl_count[z];while(H!==0){if(U=q.heap[--Z],U>K)continue;if(V[U*2+1]!==z)q.opt_len+=(z-V[U*2+1])*V[U*2],V[U*2+1]=z;H--}}}function ZV(q,X,V){var K=Array(i6+1),Q=0,Y,J;for(Y=1;Y<=i6;Y++)K[Y]=Q=Q+V[Y-1]<<1;for(J=0;J<=X;J++){var G=q[J*2+1];if(G===0)continue;q[J*2]=GV(K[G]++,G)}}function QY(){var q,X,V,K,Q,Y=Array(i6+1);V=0;for(K=0;K>=7;for(;K8)c8(q,q.bi_buf);else if(q.bi_valid>0)q.pending_buf[q.pending++]=q.bi_buf;q.bi_buf=0,q.bi_valid=0}function YY(q,X,V,K){if(HV(q),K)c8(q,V),c8(q,~V);nQ.arraySet(q.pending_buf,q.window,X,V,q.pending),q.pending+=V}function nX(q,X,V,K){var Q=X*2,Y=V*2;return q[Q]>1;J>=1;J--)A4(q,V,J);Z=Y;do J=q.heap[1],q.heap[1]=q.heap[q.heap_len--],A4(q,V,1),G=q.heap[1],q.heap[--q.heap_max]=J,q.heap[--q.heap_max]=G,V[Z*2]=V[J*2]+V[G*2],q.depth[Z]=(q.depth[J]>=q.depth[G]?q.depth[J]:q.depth[G])+1,V[J*2+1]=V[G*2+1]=Z,q.heap[1]=Z++,A4(q,V,1);while(q.heap_len>=2);q.heap[--q.heap_max]=q.heap[1],KY(q,X),ZV(V,W,q.bl_count)}function iX(q,X,V){var K,Q=-1,Y,J=X[1],G=0,W=7,Z=4;if(J===0)W=138,Z=3;X[(V+1)*2+1]=65535;for(K=0;K<=V;K++){if(Y=J,J=X[(K+1)*2+1],++G=3;X--)if(q.bl_tree[VV[X]*2+1]!==0)break;return q.opt_len+=3*(X+1)+5+5+4,X}function GY(q,X,V,K){var Q;q2(q,X-257,5),q2(q,V-1,5),q2(q,K-4,4);for(Q=0;Q>>=1)if(X&1&&q.dyn_ltree[V*2]!==0)return pX;if(q.dyn_ltree[18]!==0||q.dyn_ltree[20]!==0||q.dyn_ltree[26]!==0)return dX;for(V=32;V0){if(q.strm.data_type===iQ)q.strm.data_type=ZY(q);if(N4(q,q.l_desc),N4(q,q.d_desc),J=JY(q),Q=q.opt_len+3+7>>>3,Y=q.static_len+3+7>>>3,Y<=Q)Q=Y}else Q=Y=V+5;if(V+4<=Q&&X!==-1)UV(q,X,V,K);else if(q.strategy===rQ||Y===Q)q2(q,(sX<<1)+(K?1:0),3),rX(q,e2,m8);else q2(q,(oQ<<1)+(K?1:0),3),GY(q,q.l_desc.max_code+1,q.d_desc.max_code+1,J+1),rX(q,q.dyn_ltree,q.dyn_dtree);if(WV(q),K)HV(q)}function zY(q,X,V){if(q.pending_buf[q.d_buf+q.last_lit*2]=X>>>8&255,q.pending_buf[q.d_buf+q.last_lit*2+1]=X&255,q.pending_buf[q.l_buf+q.last_lit]=V&255,q.last_lit++,X===0)q.dyn_ltree[V*2]++;else q.matches++,X--,q.dyn_ltree[(_8[V]+p8+1)*2]++,q.dyn_dtree[JV(X)*2]++;return q.last_lit===q.lit_bufsize-1}g5._tr_init=WY;g5._tr_stored_block=UV;g5._tr_flush_block=UY;g5._tr_tally=zY;g5._tr_align=HY});var h4=g0((t3,MV)=>{function MY(q,X,V,K){var Q=q&65535|0,Y=q>>>16&65535|0,J=0;while(V!==0){J=V>2000?2000:V,V-=J;do Q=Q+X[K++]|0,Y=Y+Q|0;while(--J);Q%=65521,Y%=65521}return Q|Y<<16|0}MV.exports=MY});var F4=g0((e3,kV)=>{function kY(){var q,X=[];for(var V=0;V<256;V++){q=V;for(var K=0;K<8;K++)q=q&1?3988292384^q>>>1:q>>>1;X[V]=q}return X}var IY=kY();function EY(q,X,V,K){var Q=IY,Y=K+V;q^=-1;for(var J=K;J>>8^Q[(q^X[J])&255];return q^-1}kV.exports=EY});var m1=g0((qW,IV)=>{IV.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 AV=g0((m2)=>{var i0=t2(),H2=zV(),BV=h4(),B6=F4(),jY=m1(),t6=0,LY=1,BY=3,A6=4,EV=5,b2=0,jV=1,U2=-2,TY=-3,P4=-5,RY=-1,vY=1,f1=2,OY=3,AY=4,wY=0,NY=2,p1=8,SY=9,yY=15,$Y=8,CY=29,hY=256,u4=hY+1+CY,FY=30,PY=19,DY=2*u4+1,uY=15,H0=3,v6=258,O2=v6+H0+1,gY=32,d1=42,g4=69,l1=73,_1=91,c1=103,a6=113,n8=666,h0=1,r8=2,o6=3,m5=4,xY=3;function O6(q,X){return q.msg=jY[X],X}function LV(q){return(q<<1)-(q>4?9:0)}function R6(q){var X=q.length;while(--X>=0)q[X]=0}function T6(q){var X=q.state,V=X.pending;if(V>q.avail_out)V=q.avail_out;if(V===0)return;if(i0.arraySet(q.output,X.pending_buf,X.pending_out,V,q.next_out),q.next_out+=V,X.pending_out+=V,q.total_out+=V,q.avail_out-=V,X.pending-=V,X.pending===0)X.pending_out=0}function x0(q,X){H2._tr_flush_block(q,q.block_start>=0?q.block_start:-1,q.strstart-q.block_start,X),q.block_start=q.strstart,T6(q.strm)}function U0(q,X){q.pending_buf[q.pending++]=X}function d8(q,X){q.pending_buf[q.pending++]=X>>>8&255,q.pending_buf[q.pending++]=X&255}function bY(q,X,V,K){var Q=q.avail_in;if(Q>K)Q=K;if(Q===0)return 0;if(q.avail_in-=Q,i0.arraySet(X,q.input,q.next_in,Q,V),q.state.wrap===1)q.adler=BV(q.adler,X,Q,V);else if(q.state.wrap===2)q.adler=B6(q.adler,X,Q,V);return q.next_in+=Q,q.total_in+=Q,Q}function TV(q,X){var{max_chain_length:V,strstart:K}=q,Q,Y,J=q.prev_length,G=q.nice_match,W=q.strstart>q.w_size-O2?q.strstart-(q.w_size-O2):0,Z=q.window,H=q.w_mask,U=q.prev,z=q.strstart+v6,k=Z[K+J-1],M=Z[K+J];if(q.prev_length>=q.good_match)V>>=2;if(G>q.lookahead)G=q.lookahead;do{if(Q=X,Z[Q+J]!==M||Z[Q+J-1]!==k||Z[Q]!==Z[K]||Z[++Q]!==Z[K+1])continue;K+=2,Q++;do;while(Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&Z[++K]===Z[++Q]&&KJ){if(q.match_start=X,J=Y,Y>=G)break;k=Z[K+J-1],M=Z[K+J]}}while((X=U[X&H])>W&&--V!==0);if(J<=q.lookahead)return J;return q.lookahead}function s6(q){var X=q.w_size,V,K,Q,Y,J;do{if(Y=q.window_size-q.lookahead-q.strstart,q.strstart>=X+(X-O2)){i0.arraySet(q.window,q.window,X,X,0),q.match_start-=X,q.strstart-=X,q.block_start-=X,K=q.hash_size,V=K;do Q=q.head[--V],q.head[V]=Q>=X?Q-X:0;while(--K);K=X,V=K;do Q=q.prev[--V],q.prev[V]=Q>=X?Q-X:0;while(--K);Y+=X}if(q.strm.avail_in===0)break;if(K=bY(q.strm,q.window,q.strstart+q.lookahead,Y),q.lookahead+=K,q.lookahead+q.insert>=H0){J=q.strstart-q.insert,q.ins_h=q.window[J],q.ins_h=(q.ins_h<q.pending_buf_size-5)V=q.pending_buf_size-5;for(;;){if(q.lookahead<=1){if(s6(q),q.lookahead===0&&X===t6)return h0;if(q.lookahead===0)break}q.strstart+=q.lookahead,q.lookahead=0;var K=q.block_start+V;if(q.strstart===0||q.strstart>=K){if(q.lookahead=q.strstart-K,q.strstart=K,x0(q,!1),q.strm.avail_out===0)return h0}if(q.strstart-q.block_start>=q.w_size-O2){if(x0(q,!1),q.strm.avail_out===0)return h0}}if(q.insert=0,X===A6){if(x0(q,!0),q.strm.avail_out===0)return o6;return m5}if(q.strstart>q.block_start){if(x0(q,!1),q.strm.avail_out===0)return h0}return h0}function D4(q,X){var V,K;for(;;){if(q.lookahead=H0)q.ins_h=(q.ins_h<=H0)if(K=H2._tr_tally(q,q.strstart-q.match_start,q.match_length-H0),q.lookahead-=q.match_length,q.match_length<=q.max_lazy_match&&q.lookahead>=H0){q.match_length--;do q.strstart++,q.ins_h=(q.ins_h<=H0)q.ins_h=(q.ins_h<4096))q.match_length=H0-1}if(q.prev_length>=H0&&q.match_length<=q.prev_length){Q=q.strstart+q.lookahead-H0,K=H2._tr_tally(q,q.strstart-1-q.prev_match,q.prev_length-H0),q.lookahead-=q.prev_length-1,q.prev_length-=2;do if(++q.strstart<=Q)q.ins_h=(q.ins_h<=H0&&q.strstart>0){if(Q=q.strstart-1,K=J[Q],K===J[++Q]&&K===J[++Q]&&K===J[++Q]){Y=q.strstart+v6;do;while(K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&K===J[++Q]&&Qq.lookahead)q.match_length=q.lookahead}}if(q.match_length>=H0)V=H2._tr_tally(q,1,q.match_length-H0),q.lookahead-=q.match_length,q.strstart+=q.match_length,q.match_length=0;else V=H2._tr_tally(q,0,q.window[q.strstart]),q.lookahead--,q.strstart++;if(V){if(x0(q,!1),q.strm.avail_out===0)return h0}}if(q.insert=0,X===A6){if(x0(q,!0),q.strm.avail_out===0)return o6;return m5}if(q.last_lit){if(x0(q,!1),q.strm.avail_out===0)return h0}return r8}function lY(q,X){var V;for(;;){if(q.lookahead===0){if(s6(q),q.lookahead===0){if(X===t6)return h0;break}}if(q.match_length=0,V=H2._tr_tally(q,0,q.window[q.strstart]),q.lookahead--,q.strstart++,V){if(x0(q,!1),q.strm.avail_out===0)return h0}}if(q.insert=0,X===A6){if(x0(q,!0),q.strm.avail_out===0)return o6;return m5}if(q.last_lit){if(x0(q,!1),q.strm.avail_out===0)return h0}return r8}function x2(q,X,V,K,Q){this.good_length=q,this.max_lazy=X,this.nice_length=V,this.max_chain=K,this.func=Q}var b5;b5=[new x2(0,0,0,0,mY),new x2(4,4,8,4,D4),new x2(4,5,16,8,D4),new x2(4,6,32,32,D4),new x2(4,4,16,16,x5),new x2(8,16,32,32,x5),new x2(8,16,128,128,x5),new x2(8,32,128,256,x5),new x2(32,128,258,1024,x5),new x2(32,258,258,4096,x5)];function _Y(q){q.window_size=2*q.w_size,R6(q.head),q.max_lazy_match=b5[q.level].max_lazy,q.good_match=b5[q.level].good_length,q.nice_match=b5[q.level].nice_length,q.max_chain_length=b5[q.level].max_chain,q.strstart=0,q.block_start=0,q.lookahead=0,q.insert=0,q.match_length=q.prev_length=H0-1,q.match_available=0,q.ins_h=0}function cY(){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=p1,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 i0.Buf16(DY*2),this.dyn_dtree=new i0.Buf16((2*FY+1)*2),this.bl_tree=new i0.Buf16((2*PY+1)*2),R6(this.dyn_ltree),R6(this.dyn_dtree),R6(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i0.Buf16(uY+1),this.heap=new i0.Buf16(2*u4+1),R6(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i0.Buf16(2*u4+1),R6(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 RV(q){var X;if(!q||!q.state)return O6(q,U2);if(q.total_in=q.total_out=0,q.data_type=NY,X=q.state,X.pending=0,X.pending_out=0,X.wrap<0)X.wrap=-X.wrap;return X.status=X.wrap?d1:a6,q.adler=X.wrap===2?0:1,X.last_flush=t6,H2._tr_init(X),b2}function vV(q){var X=RV(q);if(X===b2)_Y(q.state);return X}function pY(q,X){if(!q||!q.state)return U2;if(q.state.wrap!==2)return U2;return q.state.gzhead=X,b2}function OV(q,X,V,K,Q,Y){if(!q)return U2;var J=1;if(X===RY)X=6;if(K<0)J=0,K=-K;else if(K>15)J=2,K-=16;if(Q<1||Q>SY||V!==p1||K<8||K>15||X<0||X>9||Y<0||Y>AY)return O6(q,U2);if(K===8)K=9;var G=new cY;return q.state=G,G.strm=q,G.wrap=J,G.gzhead=null,G.w_bits=K,G.w_size=1<EV||X<0)return q?O6(q,U2):U2;if(K=q.state,!q.output||!q.input&&q.avail_in!==0||K.status===n8&&X!==A6)return O6(q,q.avail_out===0?P4:U2);if(K.strm=q,V=K.last_flush,K.last_flush=X,K.status===d1)if(K.wrap===2)if(q.adler=0,U0(K,31),U0(K,139),U0(K,8),!K.gzhead)U0(K,0),U0(K,0),U0(K,0),U0(K,0),U0(K,0),U0(K,K.level===9?2:K.strategy>=f1||K.level<2?4:0),U0(K,xY),K.status=a6;else{if(U0(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)),U0(K,K.gzhead.time&255),U0(K,K.gzhead.time>>8&255),U0(K,K.gzhead.time>>16&255),U0(K,K.gzhead.time>>24&255),U0(K,K.level===9?2:K.strategy>=f1||K.level<2?4:0),U0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)U0(K,K.gzhead.extra.length&255),U0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)q.adler=B6(q.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=g4}else{var J=p1+(K.w_bits-8<<4)<<8,G=-1;if(K.strategy>=f1||K.level<2)G=0;else if(K.level<6)G=1;else if(K.level===6)G=2;else G=3;if(J|=G<<6,K.strstart!==0)J|=gY;if(J+=31-J%31,K.status=a6,d8(K,J),K.strstart!==0)d8(K,q.adler>>>16),d8(K,q.adler&65535);q.adler=1}if(K.status===g4)if(K.gzhead.extra){Q=K.pending;while(K.gzindex<(K.gzhead.extra.length&65535)){if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>Q)q.adler=B6(q.adler,K.pending_buf,K.pending-Q,Q);if(T6(q),Q=K.pending,K.pending===K.pending_buf_size)break}U0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>Q)q.adler=B6(q.adler,K.pending_buf,K.pending-Q,Q);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=l1}else K.status=l1;if(K.status===l1)if(K.gzhead.name){Q=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>Q)q.adler=B6(q.adler,K.pending_buf,K.pending-Q,Q);if(T6(q),Q=K.pending,K.pending===K.pending_buf_size){Y=1;break}}if(K.gzindexQ)q.adler=B6(q.adler,K.pending_buf,K.pending-Q,Q);if(Y===0)K.gzindex=0,K.status=_1}else K.status=_1;if(K.status===_1)if(K.gzhead.comment){Q=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>Q)q.adler=B6(q.adler,K.pending_buf,K.pending-Q,Q);if(T6(q),Q=K.pending,K.pending===K.pending_buf_size){Y=1;break}}if(K.gzindexQ)q.adler=B6(q.adler,K.pending_buf,K.pending-Q,Q);if(Y===0)K.status=c1}else K.status=c1;if(K.status===c1)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)T6(q);if(K.pending+2<=K.pending_buf_size)U0(K,q.adler&255),U0(K,q.adler>>8&255),q.adler=0,K.status=a6}else K.status=a6;if(K.pending!==0){if(T6(q),q.avail_out===0)return K.last_flush=-1,b2}else if(q.avail_in===0&&LV(X)<=LV(V)&&X!==A6)return O6(q,P4);if(K.status===n8&&q.avail_in!==0)return O6(q,P4);if(q.avail_in!==0||K.lookahead!==0||X!==t6&&K.status!==n8){var W=K.strategy===f1?lY(K,X):K.strategy===OY?fY(K,X):b5[K.level].func(K,X);if(W===o6||W===m5)K.status=n8;if(W===h0||W===o6){if(q.avail_out===0)K.last_flush=-1;return b2}if(W===r8){if(X===LY)H2._tr_align(K);else if(X!==EV){if(H2._tr_stored_block(K,0,0,!1),X===BY){if(R6(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(T6(q),q.avail_out===0)return K.last_flush=-1,b2}}if(X!==A6)return b2;if(K.wrap<=0)return jV;if(K.wrap===2)U0(K,q.adler&255),U0(K,q.adler>>8&255),U0(K,q.adler>>16&255),U0(K,q.adler>>24&255),U0(K,q.total_in&255),U0(K,q.total_in>>8&255),U0(K,q.total_in>>16&255),U0(K,q.total_in>>24&255);else d8(K,q.adler>>>16),d8(K,q.adler&65535);if(T6(q),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?b2:jV}function rY(q){var X;if(!q||!q.state)return U2;if(X=q.state.status,X!==d1&&X!==g4&&X!==l1&&X!==_1&&X!==c1&&X!==a6&&X!==n8)return O6(q,U2);return q.state=null,X===a6?O6(q,TY):b2}function iY(q,X){var V=X.length,K,Q,Y,J,G,W,Z,H;if(!q||!q.state)return U2;if(K=q.state,J=K.wrap,J===2||J===1&&K.status!==d1||K.lookahead)return U2;if(J===1)q.adler=BV(q.adler,X,V,0);if(K.wrap=0,V>=K.w_size){if(J===0)R6(K.head),K.strstart=0,K.block_start=0,K.insert=0;H=new i0.Buf8(K.w_size),i0.arraySet(H,X,V-K.w_size,K.w_size,0),X=H,V=K.w_size}G=q.avail_in,W=q.next_in,Z=q.input,q.avail_in=V,q.next_in=0,q.input=X,s6(K);while(K.lookahead>=H0){Q=K.strstart,Y=K.lookahead-(H0-1);do K.ins_h=(K.ins_h<{var n1=t2(),wV=!0,NV=!0;try{String.fromCharCode.apply(null,[0])}catch(q){wV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(q){NV=!1}var i8=new n1.Buf8(256);for(f2=0;f2<256;f2++)i8[f2]=f2>=252?6:f2>=248?5:f2>=240?4:f2>=224?3:f2>=192?2:1;var f2;i8[254]=i8[254]=1;f5.string2buf=function(q){var X,V,K,Q,Y,J=q.length,G=0;for(Q=0;Q>>6,X[Y++]=128|V&63;else if(V<65536)X[Y++]=224|V>>>12,X[Y++]=128|V>>>6&63,X[Y++]=128|V&63;else X[Y++]=240|V>>>18,X[Y++]=128|V>>>12&63,X[Y++]=128|V>>>6&63,X[Y++]=128|V&63}return X};function SV(q,X){if(X<65534){if(q.subarray&&NV||!q.subarray&&wV)return String.fromCharCode.apply(null,n1.shrinkBuf(q,X))}var V="";for(var K=0;K4){G[K++]=65533,V+=Y-1;continue}Q&=Y===2?31:Y===3?15:7;while(Y>1&&V1){G[K++]=65533;continue}if(Q<65536)G[K++]=Q;else Q-=65536,G[K++]=55296|Q>>10&1023,G[K++]=56320|Q&1023}return SV(G,K)};f5.utf8border=function(q,X){var V;if(X=X||q.length,X>q.length)X=q.length;V=X-1;while(V>=0&&(q[V]&192)===128)V--;if(V<0)return X;if(V===0)return X;return V+i8[q[V]]>X?V:X}});var b4=g0((KW,yV)=>{function aY(){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}yV.exports=aY});var FV=g0((s8)=>{var a8=AV(),o8=t2(),f4=x4(),l4=m1(),oY=b4(),hV=Object.prototype.toString,sY=0,m4=4,l5=0,$V=1,CV=2,tY=-1,eY=0,qJ=8;function e6(q){if(!(this instanceof e6))return new e6(q);this.options=o8.assign({level:tY,method:qJ,chunkSize:16384,windowBits:15,memLevel:8,strategy:eY,to:""},q||{});var X=this.options;if(X.raw&&X.windowBits>0)X.windowBits=-X.windowBits;else if(X.gzip&&X.windowBits>0&&X.windowBits<16)X.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new oY,this.strm.avail_out=0;var V=a8.deflateInit2(this.strm,X.level,X.method,X.windowBits,X.memLevel,X.strategy);if(V!==l5)throw Error(l4[V]);if(X.header)a8.deflateSetHeader(this.strm,X.header);if(X.dictionary){var K;if(typeof X.dictionary==="string")K=f4.string2buf(X.dictionary);else if(hV.call(X.dictionary)==="[object ArrayBuffer]")K=new Uint8Array(X.dictionary);else K=X.dictionary;if(V=a8.deflateSetDictionary(this.strm,K),V!==l5)throw Error(l4[V]);this._dict_set=!0}}e6.prototype.push=function(q,X){var V=this.strm,K=this.options.chunkSize,Q,Y;if(this.ended)return!1;if(Y=X===~~X?X:X===!0?m4:sY,typeof q==="string")V.input=f4.string2buf(q);else if(hV.call(q)==="[object ArrayBuffer]")V.input=new Uint8Array(q);else V.input=q;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new o8.Buf8(K),V.next_out=0,V.avail_out=K;if(Q=a8.deflate(V,Y),Q!==$V&&Q!==l5)return this.onEnd(Q),this.ended=!0,!1;if(V.avail_out===0||V.avail_in===0&&(Y===m4||Y===CV))if(this.options.to==="string")this.onData(f4.buf2binstring(o8.shrinkBuf(V.output,V.next_out)));else this.onData(o8.shrinkBuf(V.output,V.next_out))}while((V.avail_in>0||V.avail_out===0)&&Q!==$V);if(Y===m4)return Q=a8.deflateEnd(this.strm),this.onEnd(Q),this.ended=!0,Q===l5;if(Y===CV)return this.onEnd(l5),V.avail_out=0,!0;return!0};e6.prototype.onData=function(q){this.chunks.push(q)};e6.prototype.onEnd=function(q){if(q===l5)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=o8.flattenChunks(this.chunks);this.chunks=[],this.err=q,this.msg=this.strm.msg};function _4(q,X){var V=new e6(X);if(V.push(q,!0),V.err)throw V.msg||l4[V.err];return V.result}function XJ(q,X){return X=X||{},X.raw=!0,_4(q,X)}function VJ(q,X){return X=X||{},X.gzip=!0,_4(q,X)}s8.Deflate=e6;s8.deflate=_4;s8.deflateRaw=XJ;s8.gzip=VJ});var DV=g0((YW,PV)=>{var r1=30,KJ=12;PV.exports=function(X,V){var K,Q,Y,J,G,W,Z,H,U,z,k,M,j,B,L,O,N,v,R,A,$,S,h,b,C;K=X.state,Q=X.next_in,b=X.input,Y=Q+(X.avail_in-5),J=X.next_out,C=X.output,G=J-(V-X.avail_out),W=J+(X.avail_out-257),Z=K.dmax,H=K.wsize,U=K.whave,z=K.wnext,k=K.window,M=K.hold,j=K.bits,B=K.lencode,L=K.distcode,O=(1<>>24,M>>>=R,j-=R,R=v>>>16&255,R===0)C[J++]=v&65535;else if(R&16){if(A=v&65535,R&=15,R){if(j>>=R,j-=R}if(j<15)M+=b[Q++]<>>24,M>>>=R,j-=R,R=v>>>16&255,R&16){if($=v&65535,R&=15,jZ){X.msg="invalid distance too far back",K.mode=r1;break q}if(M>>>=R,j-=R,R=J-G,$>R){if(R=$-R,R>U){if(K.sane){X.msg="invalid distance too far back",K.mode=r1;break q}}if(S=0,h=k,z===0){if(S+=H-R,R2)C[J++]=h[S++],C[J++]=h[S++],C[J++]=h[S++],A-=3;if(A){if(C[J++]=h[S++],A>1)C[J++]=h[S++]}}else{S=J-$;do C[J++]=C[S++],C[J++]=C[S++],C[J++]=C[S++],A-=3;while(A>2);if(A){if(C[J++]=C[S++],A>1)C[J++]=C[S++]}}}else if((R&64)===0){v=L[(v&65535)+(M&(1<>3,Q-=A,j-=A<<3,M&=(1<{var uV=t2(),_5=15,gV=852,xV=592,bV=0,c4=1,mV=2,QJ=[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],YJ=[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],JJ=[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],GJ=[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];fV.exports=function(X,V,K,Q,Y,J,G,W){var Z=W.bits,H=0,U=0,z=0,k=0,M=0,j=0,B=0,L=0,O=0,N=0,v,R,A,$,S,h=null,b=0,C,D=new uV.Buf16(_5+1),l=new uV.Buf16(_5+1),u=null,q0=0,J0,r,I0;for(H=0;H<=_5;H++)D[H]=0;for(U=0;U=1;k--)if(D[k]!==0)break;if(M>k)M=k;if(k===0)return Y[J++]=20971520,Y[J++]=20971520,W.bits=1,0;for(z=1;z0&&(X===bV||k!==1))return-1;l[1]=0;for(H=1;H<_5;H++)l[H+1]=l[H]+D[H];for(U=0;UgV||X===mV&&O>xV)return 1;for(;;){if(J0=H-B,G[U]C)r=u[q0+G[U]],I0=h[b+G[U]];else r=96,I0=0;v=1<>B)+R]=J0<<24|r<<16|I0|0;while(R!==0);v=1<>=1;if(v!==0)N&=v-1,N+=v;else N=0;if(U++,--D[H]===0){if(H===k)break;H=V[K+G[U]]}if(H>M&&(N&$)!==A){if(B===0)B=M;S+=z,j=H-B,L=1<gV||X===mV&&O>xV)return 1;A=N&$,Y[A]=M<<24|j<<16|S-J|0}}if(N!==0)Y[S+N]=H-B<<24|4194304|0;return W.bits=M,0}});var v9=g0((A2)=>{var Q2=t2(),a4=h4(),l2=F4(),ZJ=DV(),t8=lV(),WJ=0,M9=1,k9=2,_V=4,HJ=5,i1=6,q5=0,UJ=1,zJ=2,z2=-2,I9=-3,o4=-4,MJ=-5,cV=8,E9=1,pV=2,dV=3,nV=4,rV=5,iV=6,aV=7,oV=8,sV=9,tV=10,s1=11,q6=12,p4=13,eV=14,d4=15,q9=16,X9=17,V9=18,K9=19,a1=20,o1=21,Q9=22,Y9=23,J9=24,G9=25,Z9=26,n4=27,W9=28,H9=29,L0=30,s4=31,kJ=32,IJ=852,EJ=592,jJ=15,LJ=jJ;function U9(q){return(q>>>24&255)+(q>>>8&65280)+((q&65280)<<8)+((q&255)<<24)}function BJ(){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 Q2.Buf16(320),this.work=new Q2.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function j9(q){var X;if(!q||!q.state)return z2;if(X=q.state,q.total_in=q.total_out=X.total=0,q.msg="",X.wrap)q.adler=X.wrap&1;return X.mode=E9,X.last=0,X.havedict=0,X.dmax=32768,X.head=null,X.hold=0,X.bits=0,X.lencode=X.lendyn=new Q2.Buf32(IJ),X.distcode=X.distdyn=new Q2.Buf32(EJ),X.sane=1,X.back=-1,q5}function L9(q){var X;if(!q||!q.state)return z2;return X=q.state,X.wsize=0,X.whave=0,X.wnext=0,j9(q)}function B9(q,X){var V,K;if(!q||!q.state)return z2;if(K=q.state,X<0)V=0,X=-X;else if(V=(X>>4)+1,X<48)X&=15;if(X&&(X<8||X>15))return z2;if(K.window!==null&&K.wbits!==X)K.window=null;return K.wrap=V,K.wbits=X,L9(q)}function T9(q,X){var V,K;if(!q)return z2;if(K=new BJ,q.state=K,K.window=null,V=B9(q,X),V!==q5)q.state=null;return V}function TJ(q){return T9(q,LJ)}var z9=!0,r4,i4;function RJ(q){if(z9){var X;r4=new Q2.Buf32(512),i4=new Q2.Buf32(32),X=0;while(X<144)q.lens[X++]=8;while(X<256)q.lens[X++]=9;while(X<280)q.lens[X++]=7;while(X<288)q.lens[X++]=8;t8(M9,q.lens,0,288,r4,0,q.work,{bits:9}),X=0;while(X<32)q.lens[X++]=5;t8(k9,q.lens,0,32,i4,0,q.work,{bits:5}),z9=!1}q.lencode=r4,q.lenbits=9,q.distcode=i4,q.distbits=5}function R9(q,X,V,K){var Q,Y=q.state;if(Y.window===null)Y.wsize=1<=Y.wsize)Q2.arraySet(Y.window,X,V-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize;else{if(Q=Y.wsize-Y.wnext,Q>K)Q=K;if(Q2.arraySet(Y.window,X,V-K,Q,Y.wnext),K-=Q,K)Q2.arraySet(Y.window,X,V-K,K,0),Y.wnext=K,Y.whave=Y.wsize;else{if(Y.wnext+=Q,Y.wnext===Y.wsize)Y.wnext=0;if(Y.whave>>8&255,V.check=l2(V.check,h,2,0),Z=0,H=0,V.mode=pV;break}if(V.flags=0,V.head)V.head.done=!1;if(!(V.wrap&1)||(((Z&255)<<8)+(Z>>8))%31){q.msg="incorrect header check",V.mode=L0;break}if((Z&15)!==cV){q.msg="unknown compression method",V.mode=L0;break}if(Z>>>=4,H-=4,$=(Z&15)+8,V.wbits===0)V.wbits=$;else if($>V.wbits){q.msg="invalid window size",V.mode=L0;break}V.dmax=1<<$,q.adler=V.check=1,V.mode=Z&512?tV:q6,Z=0,H=0;break;case pV:while(H<16){if(G===0)break q;G--,Z+=K[Y++]<>8&1;if(V.flags&512)h[0]=Z&255,h[1]=Z>>>8&255,V.check=l2(V.check,h,2,0);Z=0,H=0,V.mode=dV;case dV:while(H<32){if(G===0)break q;G--,Z+=K[Y++]<>>8&255,h[2]=Z>>>16&255,h[3]=Z>>>24&255,V.check=l2(V.check,h,4,0);Z=0,H=0,V.mode=nV;case nV:while(H<16){if(G===0)break q;G--,Z+=K[Y++]<>8;if(V.flags&512)h[0]=Z&255,h[1]=Z>>>8&255,V.check=l2(V.check,h,2,0);Z=0,H=0,V.mode=rV;case rV:if(V.flags&1024){while(H<16){if(G===0)break q;G--,Z+=K[Y++]<>>8&255,V.check=l2(V.check,h,2,0);Z=0,H=0}else if(V.head)V.head.extra=null;V.mode=iV;case iV:if(V.flags&1024){if(k=V.length,k>G)k=G;if(k){if(V.head){if($=V.head.extra_len-V.length,!V.head.extra)V.head.extra=Array(V.head.extra_len);Q2.arraySet(V.head.extra,K,Y,k,$)}if(V.flags&512)V.check=l2(V.check,K,k,Y);G-=k,Y+=k,V.length-=k}if(V.length)break q}V.length=0,V.mode=aV;case aV:if(V.flags&2048){if(G===0)break q;k=0;do if($=K[Y+k++],V.head&&$&&V.length<65536)V.head.name+=String.fromCharCode($);while($&&k>9&1,V.head.done=!0;q.adler=V.check=0,V.mode=q6;break;case tV:while(H<32){if(G===0)break q;G--,Z+=K[Y++]<>>=H&7,H-=H&7,V.mode=n4;break}while(H<3){if(G===0)break q;G--,Z+=K[Y++]<>>=1,H-=1,Z&3){case 0:V.mode=eV;break;case 1:if(RJ(V),V.mode=a1,X===i1){Z>>>=2,H-=2;break q}break;case 2:V.mode=X9;break;case 3:q.msg="invalid block type",V.mode=L0}Z>>>=2,H-=2;break;case eV:Z>>>=H&7,H-=H&7;while(H<32){if(G===0)break q;G--,Z+=K[Y++]<>>16^65535)){q.msg="invalid stored block lengths",V.mode=L0;break}if(V.length=Z&65535,Z=0,H=0,V.mode=d4,X===i1)break q;case d4:V.mode=q9;case q9:if(k=V.length,k){if(k>G)k=G;if(k>W)k=W;if(k===0)break q;Q2.arraySet(Q,K,Y,k,J),G-=k,Y+=k,W-=k,J+=k,V.length-=k;break}V.mode=q6;break;case X9:while(H<14){if(G===0)break q;G--,Z+=K[Y++]<>>=5,H-=5,V.ndist=(Z&31)+1,Z>>>=5,H-=5,V.ncode=(Z&15)+4,Z>>>=4,H-=4,V.nlen>286||V.ndist>30){q.msg="too many length or distance symbols",V.mode=L0;break}V.have=0,V.mode=V9;case V9:while(V.have>>=3,H-=3}while(V.have<19)V.lens[D[V.have++]]=0;if(V.lencode=V.lendyn,V.lenbits=7,b={bits:V.lenbits},S=t8(WJ,V.lens,0,19,V.lencode,0,V.work,b),V.lenbits=b.bits,S){q.msg="invalid code lengths set",V.mode=L0;break}V.have=0,V.mode=K9;case K9:while(V.have>>24,O=B>>>16&255,N=B&65535,L<=H)break;if(G===0)break q;G--,Z+=K[Y++]<>>=L,H-=L,V.lens[V.have++]=N;else{if(N===16){C=L+2;while(H>>=L,H-=L,V.have===0){q.msg="invalid bit length repeat",V.mode=L0;break}$=V.lens[V.have-1],k=3+(Z&3),Z>>>=2,H-=2}else if(N===17){C=L+3;while(H>>=L,H-=L,$=0,k=3+(Z&7),Z>>>=3,H-=3}else{C=L+7;while(H>>=L,H-=L,$=0,k=11+(Z&127),Z>>>=7,H-=7}if(V.have+k>V.nlen+V.ndist){q.msg="invalid bit length repeat",V.mode=L0;break}while(k--)V.lens[V.have++]=$}}if(V.mode===L0)break;if(V.lens[256]===0){q.msg="invalid code -- missing end-of-block",V.mode=L0;break}if(V.lenbits=9,b={bits:V.lenbits},S=t8(M9,V.lens,0,V.nlen,V.lencode,0,V.work,b),V.lenbits=b.bits,S){q.msg="invalid literal/lengths set",V.mode=L0;break}if(V.distbits=6,V.distcode=V.distdyn,b={bits:V.distbits},S=t8(k9,V.lens,V.nlen,V.ndist,V.distcode,0,V.work,b),V.distbits=b.bits,S){q.msg="invalid distances set",V.mode=L0;break}if(V.mode=a1,X===i1)break q;case a1:V.mode=o1;case o1:if(G>=6&&W>=258){if(q.next_out=J,q.avail_out=W,q.next_in=Y,q.avail_in=G,V.hold=Z,V.bits=H,ZJ(q,z),J=q.next_out,Q=q.output,W=q.avail_out,Y=q.next_in,K=q.input,G=q.avail_in,Z=V.hold,H=V.bits,V.mode===q6)V.back=-1;break}V.back=0;for(;;){if(B=V.lencode[Z&(1<>>24,O=B>>>16&255,N=B&65535,L<=H)break;if(G===0)break q;G--,Z+=K[Y++]<>v)],L=B>>>24,O=B>>>16&255,N=B&65535,v+L<=H)break;if(G===0)break q;G--,Z+=K[Y++]<>>=v,H-=v,V.back+=v}if(Z>>>=L,H-=L,V.back+=L,V.length=N,O===0){V.mode=Z9;break}if(O&32){V.back=-1,V.mode=q6;break}if(O&64){q.msg="invalid literal/length code",V.mode=L0;break}V.extra=O&15,V.mode=Q9;case Q9:if(V.extra){C=V.extra;while(H>>=V.extra,H-=V.extra,V.back+=V.extra}V.was=V.length,V.mode=Y9;case Y9:for(;;){if(B=V.distcode[Z&(1<>>24,O=B>>>16&255,N=B&65535,L<=H)break;if(G===0)break q;G--,Z+=K[Y++]<>v)],L=B>>>24,O=B>>>16&255,N=B&65535,v+L<=H)break;if(G===0)break q;G--,Z+=K[Y++]<>>=v,H-=v,V.back+=v}if(Z>>>=L,H-=L,V.back+=L,O&64){q.msg="invalid distance code",V.mode=L0;break}V.offset=N,V.extra=O&15,V.mode=J9;case J9:if(V.extra){C=V.extra;while(H>>=V.extra,H-=V.extra,V.back+=V.extra}if(V.offset>V.dmax){q.msg="invalid distance too far back",V.mode=L0;break}V.mode=G9;case G9:if(W===0)break q;if(k=z-W,V.offset>k){if(k=V.offset-k,k>V.whave){if(V.sane){q.msg="invalid distance too far back",V.mode=L0;break}}if(k>V.wnext)k-=V.wnext,M=V.wsize-k;else M=V.wnext-k;if(k>V.length)k=V.length;j=V.window}else j=Q,M=J-V.offset,k=V.length;if(k>W)k=W;W-=k,V.length-=k;do Q[J++]=j[M++];while(--k);if(V.length===0)V.mode=o1;break;case Z9:if(W===0)break q;Q[J++]=V.length,W--,V.mode=o1;break;case n4:if(V.wrap){while(H<32){if(G===0)break q;G--,Z|=K[Y++]<{O9.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 w9=g0((WW,A9)=>{function NJ(){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}A9.exports=NJ});var S9=g0((q1)=>{var c5=v9(),e8=t2(),t1=x4(),N0=t4(),e4=m1(),SJ=b4(),yJ=w9(),N9=Object.prototype.toString;function X5(q){if(!(this instanceof X5))return new X5(q);this.options=e8.assign({chunkSize:16384,windowBits:0,to:""},q||{});var X=this.options;if(X.raw&&X.windowBits>=0&&X.windowBits<16){if(X.windowBits=-X.windowBits,X.windowBits===0)X.windowBits=-15}if(X.windowBits>=0&&X.windowBits<16&&!(q&&q.windowBits))X.windowBits+=32;if(X.windowBits>15&&X.windowBits<48){if((X.windowBits&15)===0)X.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new SJ,this.strm.avail_out=0;var V=c5.inflateInit2(this.strm,X.windowBits);if(V!==N0.Z_OK)throw Error(e4[V]);if(this.header=new yJ,c5.inflateGetHeader(this.strm,this.header),X.dictionary){if(typeof X.dictionary==="string")X.dictionary=t1.string2buf(X.dictionary);else if(N9.call(X.dictionary)==="[object ArrayBuffer]")X.dictionary=new Uint8Array(X.dictionary);if(X.raw){if(V=c5.inflateSetDictionary(this.strm,X.dictionary),V!==N0.Z_OK)throw Error(e4[V])}}}X5.prototype.push=function(q,X){var V=this.strm,K=this.options.chunkSize,Q=this.options.dictionary,Y,J,G,W,Z,H=!1;if(this.ended)return!1;if(J=X===~~X?X:X===!0?N0.Z_FINISH:N0.Z_NO_FLUSH,typeof q==="string")V.input=t1.binstring2buf(q);else if(N9.call(q)==="[object ArrayBuffer]")V.input=new Uint8Array(q);else V.input=q;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new e8.Buf8(K),V.next_out=0,V.avail_out=K;if(Y=c5.inflate(V,N0.Z_NO_FLUSH),Y===N0.Z_NEED_DICT&&Q)Y=c5.inflateSetDictionary(this.strm,Q);if(Y===N0.Z_BUF_ERROR&&H===!0)Y=N0.Z_OK,H=!1;if(Y!==N0.Z_STREAM_END&&Y!==N0.Z_OK)return this.onEnd(Y),this.ended=!0,!1;if(V.next_out){if(V.avail_out===0||Y===N0.Z_STREAM_END||V.avail_in===0&&(J===N0.Z_FINISH||J===N0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(G=t1.utf8border(V.output,V.next_out),W=V.next_out-G,Z=t1.buf2string(V.output,G),V.next_out=W,V.avail_out=K-W,W)e8.arraySet(V.output,V.output,G,W,0);this.onData(Z)}else this.onData(e8.shrinkBuf(V.output,V.next_out))}if(V.avail_in===0&&V.avail_out===0)H=!0}while((V.avail_in>0||V.avail_out===0)&&Y!==N0.Z_STREAM_END);if(Y===N0.Z_STREAM_END)J=N0.Z_FINISH;if(J===N0.Z_FINISH)return Y=c5.inflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===N0.Z_OK;if(J===N0.Z_SYNC_FLUSH)return this.onEnd(N0.Z_OK),V.avail_out=0,!0;return!0};X5.prototype.onData=function(q){this.chunks.push(q)};X5.prototype.onEnd=function(q){if(q===N0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=e8.flattenChunks(this.chunks);this.chunks=[],this.err=q,this.msg=this.strm.msg};function q7(q,X){var V=new X5(X);if(V.push(q,!0),V.err)throw V.msg||e4[V.err];return V.result}function $J(q,X){return X=X||{},X.raw=!0,q7(q,X)}q1.Inflate=X5;q1.inflate=q7;q1.inflateRaw=$J;q1.ungzip=q7});var X1=g0((UW,$9)=>{var CJ=t2().assign,hJ=FV(),FJ=S9(),PJ=t4(),y9={};CJ(y9,hJ,FJ,PJ);$9.exports=y9});var $1=globalThis;if(typeof $1.global>"u")$1.global=globalThis;if(typeof $1.__require>"u")$1.__require=(q)=>{throw Error(`Dynamic require of "${q}" is not supported in the sandbox`)};var C2=[],W2=[],_q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(c6=0,MX=_q.length;c60)throw Error("Invalid string. Length must be a multiple of 4");var V=q.indexOf("=");if(V===-1)V=X;var K=V===X?0:4-V%4;return[V,K]}function VQ(q,X){return(q+X)*3/4-X}function KQ(q){var X,V=XQ(q),K=V[0],Q=V[1],Y=new Uint8Array(VQ(K,Q)),J=0,G=Q>0?K-4:K,W;for(W=0;W>16&255,Y[J++]=X>>8&255,Y[J++]=X&255;if(Q===2)X=W2[q.charCodeAt(W)]<<2|W2[q.charCodeAt(W+1)]>>4,Y[J++]=X&255;if(Q===1)X=W2[q.charCodeAt(W)]<<10|W2[q.charCodeAt(W+1)]<<4|W2[q.charCodeAt(W+2)]>>2,Y[J++]=X>>8&255,Y[J++]=X&255;return Y}function QQ(q){return C2[q>>18&63]+C2[q>>12&63]+C2[q>>6&63]+C2[q&63]}function YQ(q,X,V){var K,Q=[];for(var Y=X;YG?G:J+Y));if(K===1)X=q[V-1],Q.push(C2[X>>2]+C2[X<<4&63]+"==");else if(K===2)X=(q[V-2]<<8)+q[V-1],Q.push(C2[X>>10]+C2[X>>4&63]+C2[X<<2&63]+"=");return Q.join("")}function C1(q,X,V,K,Q){var Y,J,G=Q*8-K-1,W=(1<>1,H=-7,U=V?Q-1:0,z=V?-1:1,k=q[X+U];U+=z,Y=k&(1<<-H)-1,k>>=-H,H+=G;for(;H>0;Y=Y*256+q[X+U],U+=z,H-=8);J=Y&(1<<-H)-1,Y>>=-H,H+=K;for(;H>0;J=J*256+q[X+U],U+=z,H-=8);if(Y===0)Y=1-Z;else if(Y===W)return J?NaN:(k?-1:1)*(1/0);else J=J+Math.pow(2,K),Y=Y-Z;return(k?-1:1)*J*Math.pow(2,Y-K)}function BX(q,X,V,K,Q,Y){var J,G,W,Z=Y*8-Q-1,H=(1<>1,z=Q===23?Math.pow(2,-24)-Math.pow(2,-77):0,k=K?0:Y-1,M=K?1:-1,j=X<0||X===0&&1/X<0?1:0;if(X=Math.abs(X),isNaN(X)||X===1/0)G=isNaN(X)?1:0,J=H;else{if(J=Math.floor(Math.log(X)/Math.LN2),X*(W=Math.pow(2,-J))<1)J--,W*=2;if(J+U>=1)X+=z/W;else X+=z*Math.pow(2,1-U);if(X*W>=2)J++,W/=2;if(J+U>=H)G=0,J=H;else if(J+U>=1)G=(X*W-1)*Math.pow(2,Q),J=J+U;else G=X*Math.pow(2,U-1)*Math.pow(2,Q),J=0}for(;Q>=8;q[V+k]=G&255,k+=M,G/=256,Q-=8);J=J<0;q[V+k]=J&255,k+=M,J/=256,Z-=8);q[V+k-M]|=j*128}var IX=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,JQ=50,cq=2147483647;var{btoa:$3,atob:C3,File:h3,Blob:F3}=globalThis;function a2(q){if(q>cq)throw RangeError('The value "'+q+'" is invalid for option "size"');let X=new Uint8Array(q);return Object.setPrototypeOf(X,y.prototype),X}function iq(q,X,V){return class extends V{constructor(){super();Object.defineProperty(this,"message",{value:X.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${q}]`,this.stack,delete this.name}get code(){return q}set code(K){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:K,writable:!0})}toString(){return`${this.name} [${q}]: ${this.message}`}}}var GQ=iq("ERR_BUFFER_OUT_OF_BOUNDS",function(q){if(q)return`${q} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),ZQ=iq("ERR_INVALID_ARG_TYPE",function(q,X){return`The "${q}" argument must be of type number. Received type ${typeof X}`},TypeError),pq=iq("ERR_OUT_OF_RANGE",function(q,X,V){let K=`The value of "${q}" is out of range.`,Q=V;if(Number.isInteger(V)&&Math.abs(V)>4294967296)Q=LX(String(V));else if(typeof V==="bigint"){if(Q=String(V),V>BigInt(2)**BigInt(32)||V<-(BigInt(2)**BigInt(32)))Q=LX(Q);Q+="n"}return K+=` It must be ${X}. Received ${Q}`,K},RangeError);function y(q,X,V){if(typeof q==="number"){if(typeof X==="string")throw TypeError('The "string" argument must be of type string. Received type number');return aq(q)}return TX(q,X,V)}Object.defineProperty(y.prototype,"parent",{enumerable:!0,get:function(){if(!y.isBuffer(this))return;return this.buffer}});Object.defineProperty(y.prototype,"offset",{enumerable:!0,get:function(){if(!y.isBuffer(this))return;return this.byteOffset}});y.poolSize=8192;function TX(q,X,V){if(typeof q==="string")return HQ(q,X);if(ArrayBuffer.isView(q))return UQ(q);if(q==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof q);if(h2(q,ArrayBuffer)||q&&h2(q.buffer,ArrayBuffer))return nq(q,X,V);if(typeof SharedArrayBuffer<"u"&&(h2(q,SharedArrayBuffer)||q&&h2(q.buffer,SharedArrayBuffer)))return nq(q,X,V);if(typeof q==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let K=q.valueOf&&q.valueOf();if(K!=null&&K!==q)return y.from(K,X,V);let Q=zQ(q);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof q[Symbol.toPrimitive]==="function")return y.from(q[Symbol.toPrimitive]("string"),X,V);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof q)}y.from=function(q,X,V){return TX(q,X,V)};Object.setPrototypeOf(y.prototype,Uint8Array.prototype);Object.setPrototypeOf(y,Uint8Array);function RX(q){if(typeof q!=="number")throw TypeError('"size" argument must be of type number');else if(q<0)throw RangeError('The value "'+q+'" is invalid for option "size"')}function WQ(q,X,V){if(RX(q),q<=0)return a2(q);if(X!==void 0)return typeof V==="string"?a2(q).fill(X,V):a2(q).fill(X);return a2(q)}y.alloc=function(q,X,V){return WQ(q,X,V)};function aq(q){return RX(q),a2(q<0?0:oq(q)|0)}y.allocUnsafe=function(q){return aq(q)};y.allocUnsafeSlow=function(q){return aq(q)};function HQ(q,X){if(typeof X!=="string"||X==="")X="utf8";if(!y.isEncoding(X))throw TypeError("Unknown encoding: "+X);let V=vX(q,X)|0,K=a2(V),Q=K.write(q,X);if(Q!==V)K=K.slice(0,Q);return K}function dq(q){let X=q.length<0?0:oq(q.length)|0,V=a2(X);for(let K=0;K=cq)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+cq.toString(16)+" bytes");return q|0}y.isBuffer=function(q){return q!=null&&q._isBuffer===!0&&q!==y.prototype};y.compare=function(q,X){if(h2(q,Uint8Array))q=y.from(q,q.offset,q.byteLength);if(h2(X,Uint8Array))X=y.from(X,X.offset,X.byteLength);if(!y.isBuffer(q)||!y.isBuffer(X))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(q===X)return 0;let V=q.length,K=X.length;for(let Q=0,Y=Math.min(V,K);QK.length){if(!y.isBuffer(Y))Y=y.from(Y);Y.copy(K,Q)}else Uint8Array.prototype.set.call(K,Y,Q);else if(!y.isBuffer(Y))throw TypeError('"list" argument must be an Array of Buffers');else Y.copy(K,Q);Q+=Y.length}return K};function vX(q,X){if(y.isBuffer(q))return q.length;if(ArrayBuffer.isView(q)||h2(q,ArrayBuffer))return q.byteLength;if(typeof q!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof q);let V=q.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&V===0)return 0;let Q=!1;for(;;)switch(X){case"ascii":case"latin1":case"binary":return V;case"utf8":case"utf-8":return rq(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V*2;case"hex":return V>>>1;case"base64":return hX(q).length;default:if(Q)return K?-1:rq(q).length;X=(""+X).toLowerCase(),Q=!0}}y.byteLength=vX;function MQ(q,X,V){let K=!1;if(X===void 0||X<0)X=0;if(X>this.length)return"";if(V===void 0||V>this.length)V=this.length;if(V<=0)return"";if(V>>>=0,X>>>=0,V<=X)return"";if(!q)q="utf8";while(!0)switch(q){case"hex":return OQ(this,X,V);case"utf8":case"utf-8":return AX(this,X,V);case"ascii":return RQ(this,X,V);case"latin1":case"binary":return vQ(this,X,V);case"base64":return BQ(this,X,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return AQ(this,X,V);default:if(K)throw TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),K=!0}}y.prototype._isBuffer=!0;function p6(q,X,V){let K=q[X];q[X]=q[V],q[V]=K}y.prototype.swap16=function(){let q=this.length;if(q%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let X=0;XX)q+=" ... ";return""};if(IX)y.prototype[IX]=y.prototype.inspect;y.prototype.compare=function(q,X,V,K,Q){if(h2(q,Uint8Array))q=y.from(q,q.offset,q.byteLength);if(!y.isBuffer(q))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof q);if(X===void 0)X=0;if(V===void 0)V=q?q.length:0;if(K===void 0)K=0;if(Q===void 0)Q=this.length;if(X<0||V>q.length||K<0||Q>this.length)throw RangeError("out of range index");if(K>=Q&&X>=V)return 0;if(K>=Q)return-1;if(X>=V)return 1;if(X>>>=0,V>>>=0,K>>>=0,Q>>>=0,this===q)return 0;let Y=Q-K,J=V-X,G=Math.min(Y,J),W=this.slice(K,Q),Z=q.slice(X,V);for(let H=0;H2147483647)V=2147483647;else if(V<-2147483648)V=-2147483648;if(V=+V,Number.isNaN(V))V=Q?0:q.length-1;if(V<0)V=q.length+V;if(V>=q.length)if(Q)return-1;else V=q.length-1;else if(V<0)if(Q)V=0;else return-1;if(typeof X==="string")X=y.from(X,K);if(y.isBuffer(X)){if(X.length===0)return-1;return EX(q,X,V,K,Q)}else if(typeof X==="number"){if(X=X&255,typeof Uint8Array.prototype.indexOf==="function")if(Q)return Uint8Array.prototype.indexOf.call(q,X,V);else return Uint8Array.prototype.lastIndexOf.call(q,X,V);return EX(q,[X],V,K,Q)}throw TypeError("val must be string, number or Buffer")}function EX(q,X,V,K,Q){let Y=1,J=q.length,G=X.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if(q.length<2||X.length<2)return-1;Y=2,J/=2,G/=2,V/=2}}function W(H,U){if(Y===1)return H[U];else return H.readUInt16BE(U*Y)}let Z;if(Q){let H=-1;for(Z=V;ZJ)V=J-G;for(Z=V;Z>=0;Z--){let H=!0;for(let U=0;UQ)K=Q;let Y=X.length;if(K>Y/2)K=Y/2;let J;for(J=0;J>>0,isFinite(V)){if(V=V>>>0,K===void 0)K="utf8"}else K=V,V=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Q=this.length-X;if(V===void 0||V>Q)V=Q;if(q.length>0&&(V<0||X<0)||X>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!K)K="utf8";let Y=!1;for(;;)switch(K){case"hex":return kQ(this,q,X,V);case"utf8":case"utf-8":return IQ(this,q,X,V);case"ascii":case"latin1":case"binary":return EQ(this,q,X,V);case"base64":return jQ(this,q,X,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return LQ(this,q,X,V);default:if(Y)throw TypeError("Unknown encoding: "+K);K=(""+K).toLowerCase(),Y=!0}};y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function BQ(q,X,V){if(X===0&&V===q.length)return kX(q);else return kX(q.slice(X,V))}function AX(q,X,V){V=Math.min(q.length,V);let K=[],Q=X;while(Q239?4:Y>223?3:Y>191?2:1;if(Q+G<=V){let W,Z,H,U;switch(G){case 1:if(Y<128)J=Y;break;case 2:if(W=q[Q+1],(W&192)===128){if(U=(Y&31)<<6|W&63,U>127)J=U}break;case 3:if(W=q[Q+1],Z=q[Q+2],(W&192)===128&&(Z&192)===128){if(U=(Y&15)<<12|(W&63)<<6|Z&63,U>2047&&(U<55296||U>57343))J=U}break;case 4:if(W=q[Q+1],Z=q[Q+2],H=q[Q+3],(W&192)===128&&(Z&192)===128&&(H&192)===128){if(U=(Y&15)<<18|(W&63)<<12|(Z&63)<<6|H&63,U>65535&&U<1114112)J=U}}}if(J===null)J=65533,G=1;else if(J>65535)J-=65536,K.push(J>>>10&1023|55296),J=56320|J&1023;K.push(J),Q+=G}return TQ(K)}var jX=4096;function TQ(q){let X=q.length;if(X<=jX)return String.fromCharCode.apply(String,q);let V="",K=0;while(KK)V=K;let Q="";for(let Y=X;YV)q=V;if(X<0){if(X+=V,X<0)X=0}else if(X>V)X=V;if(XV)throw RangeError("Trying to access beyond buffer length")}y.prototype.readUintLE=y.prototype.readUIntLE=function(q,X,V){if(q=q>>>0,X=X>>>0,!V)D0(q,X,this.length);let K=this[q],Q=1,Y=0;while(++Y>>0,X=X>>>0,!V)D0(q,X,this.length);let K=this[q+--X],Q=1;while(X>0&&(Q*=256))K+=this[q+--X]*Q;return K};y.prototype.readUint8=y.prototype.readUInt8=function(q,X){if(q=q>>>0,!X)D0(q,1,this.length);return this[q]};y.prototype.readUint16LE=y.prototype.readUInt16LE=function(q,X){if(q=q>>>0,!X)D0(q,2,this.length);return this[q]|this[q+1]<<8};y.prototype.readUint16BE=y.prototype.readUInt16BE=function(q,X){if(q=q>>>0,!X)D0(q,2,this.length);return this[q]<<8|this[q+1]};y.prototype.readUint32LE=y.prototype.readUInt32LE=function(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return(this[q]|this[q+1]<<8|this[q+2]<<16)+this[q+3]*16777216};y.prototype.readUint32BE=y.prototype.readUInt32BE=function(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return this[q]*16777216+(this[q+1]<<16|this[q+2]<<8|this[q+3])};y.prototype.readBigUInt64LE=M6(function(q){q=q>>>0,y5(q,"offset");let X=this[q],V=this[q+7];if(X===void 0||V===void 0)C8(q,this.length-8);let K=X+this[++q]*256+this[++q]*65536+this[++q]*16777216,Q=this[++q]+this[++q]*256+this[++q]*65536+V*16777216;return BigInt(K)+(BigInt(Q)<>>0,y5(q,"offset");let X=this[q],V=this[q+7];if(X===void 0||V===void 0)C8(q,this.length-8);let K=X*16777216+this[++q]*65536+this[++q]*256+this[++q],Q=this[++q]*16777216+this[++q]*65536+this[++q]*256+V;return(BigInt(K)<>>0,X=X>>>0,!V)D0(q,X,this.length);let K=this[q],Q=1,Y=0;while(++Y=Q)K-=Math.pow(2,8*X);return K};y.prototype.readIntBE=function(q,X,V){if(q=q>>>0,X=X>>>0,!V)D0(q,X,this.length);let K=X,Q=1,Y=this[q+--K];while(K>0&&(Q*=256))Y+=this[q+--K]*Q;if(Q*=128,Y>=Q)Y-=Math.pow(2,8*X);return Y};y.prototype.readInt8=function(q,X){if(q=q>>>0,!X)D0(q,1,this.length);if(!(this[q]&128))return this[q];return(255-this[q]+1)*-1};y.prototype.readInt16LE=function(q,X){if(q=q>>>0,!X)D0(q,2,this.length);let V=this[q]|this[q+1]<<8;return V&32768?V|4294901760:V};y.prototype.readInt16BE=function(q,X){if(q=q>>>0,!X)D0(q,2,this.length);let V=this[q+1]|this[q]<<8;return V&32768?V|4294901760:V};y.prototype.readInt32LE=function(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return this[q]|this[q+1]<<8|this[q+2]<<16|this[q+3]<<24};y.prototype.readInt32BE=function(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return this[q]<<24|this[q+1]<<16|this[q+2]<<8|this[q+3]};y.prototype.readBigInt64LE=M6(function(q){q=q>>>0,y5(q,"offset");let X=this[q],V=this[q+7];if(X===void 0||V===void 0)C8(q,this.length-8);let K=this[q+4]+this[q+5]*256+this[q+6]*65536+(V<<24);return(BigInt(K)<>>0,y5(q,"offset");let X=this[q],V=this[q+7];if(X===void 0||V===void 0)C8(q,this.length-8);let K=(X<<24)+this[++q]*65536+this[++q]*256+this[++q];return(BigInt(K)<>>0,!X)D0(q,4,this.length);return C1(this,q,!0,23,4)};y.prototype.readFloatBE=function(q,X){if(q=q>>>0,!X)D0(q,4,this.length);return C1(this,q,!1,23,4)};y.prototype.readDoubleLE=function(q,X){if(q=q>>>0,!X)D0(q,8,this.length);return C1(this,q,!0,52,8)};y.prototype.readDoubleBE=function(q,X){if(q=q>>>0,!X)D0(q,8,this.length);return C1(this,q,!1,52,8)};function s0(q,X,V,K,Q,Y){if(!y.isBuffer(q))throw TypeError('"buffer" argument must be a Buffer instance');if(X>Q||Xq.length)throw RangeError("Index out of range")}y.prototype.writeUintLE=y.prototype.writeUIntLE=function(q,X,V,K){if(q=+q,X=X>>>0,V=V>>>0,!K){let J=Math.pow(2,8*V)-1;s0(this,q,X,V,J,0)}let Q=1,Y=0;this[X]=q&255;while(++Y>>0,V=V>>>0,!K){let J=Math.pow(2,8*V)-1;s0(this,q,X,V,J,0)}let Q=V-1,Y=1;this[X+Q]=q&255;while(--Q>=0&&(Y*=256))this[X+Q]=q/Y&255;return X+V};y.prototype.writeUint8=y.prototype.writeUInt8=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,1,255,0);return this[X]=q&255,X+1};y.prototype.writeUint16LE=y.prototype.writeUInt16LE=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,2,65535,0);return this[X]=q&255,this[X+1]=q>>>8,X+2};y.prototype.writeUint16BE=y.prototype.writeUInt16BE=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,2,65535,0);return this[X]=q>>>8,this[X+1]=q&255,X+2};y.prototype.writeUint32LE=y.prototype.writeUInt32LE=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,4,4294967295,0);return this[X+3]=q>>>24,this[X+2]=q>>>16,this[X+1]=q>>>8,this[X]=q&255,X+4};y.prototype.writeUint32BE=y.prototype.writeUInt32BE=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,4,4294967295,0);return this[X]=q>>>24,this[X+1]=q>>>16,this[X+2]=q>>>8,this[X+3]=q&255,X+4};function wX(q,X,V,K,Q){CX(X,K,Q,q,V,7);let Y=Number(X&BigInt(4294967295));q[V++]=Y,Y=Y>>8,q[V++]=Y,Y=Y>>8,q[V++]=Y,Y=Y>>8,q[V++]=Y;let J=Number(X>>BigInt(32)&BigInt(4294967295));return q[V++]=J,J=J>>8,q[V++]=J,J=J>>8,q[V++]=J,J=J>>8,q[V++]=J,V}function NX(q,X,V,K,Q){CX(X,K,Q,q,V,7);let Y=Number(X&BigInt(4294967295));q[V+7]=Y,Y=Y>>8,q[V+6]=Y,Y=Y>>8,q[V+5]=Y,Y=Y>>8,q[V+4]=Y;let J=Number(X>>BigInt(32)&BigInt(4294967295));return q[V+3]=J,J=J>>8,q[V+2]=J,J=J>>8,q[V+1]=J,J=J>>8,q[V]=J,V+8}y.prototype.writeBigUInt64LE=M6(function(q,X=0){return wX(this,q,X,BigInt(0),BigInt("0xffffffffffffffff"))});y.prototype.writeBigUInt64BE=M6(function(q,X=0){return NX(this,q,X,BigInt(0),BigInt("0xffffffffffffffff"))});y.prototype.writeIntLE=function(q,X,V,K){if(q=+q,X=X>>>0,!K){let G=Math.pow(2,8*V-1);s0(this,q,X,V,G-1,-G)}let Q=0,Y=1,J=0;this[X]=q&255;while(++Q>0)-J&255}return X+V};y.prototype.writeIntBE=function(q,X,V,K){if(q=+q,X=X>>>0,!K){let G=Math.pow(2,8*V-1);s0(this,q,X,V,G-1,-G)}let Q=V-1,Y=1,J=0;this[X+Q]=q&255;while(--Q>=0&&(Y*=256)){if(q<0&&J===0&&this[X+Q+1]!==0)J=1;this[X+Q]=(q/Y>>0)-J&255}return X+V};y.prototype.writeInt8=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,1,127,-128);if(q<0)q=255+q+1;return this[X]=q&255,X+1};y.prototype.writeInt16LE=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,2,32767,-32768);return this[X]=q&255,this[X+1]=q>>>8,X+2};y.prototype.writeInt16BE=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,2,32767,-32768);return this[X]=q>>>8,this[X+1]=q&255,X+2};y.prototype.writeInt32LE=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,4,2147483647,-2147483648);return this[X]=q&255,this[X+1]=q>>>8,this[X+2]=q>>>16,this[X+3]=q>>>24,X+4};y.prototype.writeInt32BE=function(q,X,V){if(q=+q,X=X>>>0,!V)s0(this,q,X,4,2147483647,-2147483648);if(q<0)q=4294967295+q+1;return this[X]=q>>>24,this[X+1]=q>>>16,this[X+2]=q>>>8,this[X+3]=q&255,X+4};y.prototype.writeBigInt64LE=M6(function(q,X=0){return wX(this,q,X,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});y.prototype.writeBigInt64BE=M6(function(q,X=0){return NX(this,q,X,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function SX(q,X,V,K,Q,Y){if(V+K>q.length)throw RangeError("Index out of range");if(V<0)throw RangeError("Index out of range")}function yX(q,X,V,K,Q){if(X=+X,V=V>>>0,!Q)SX(q,X,V,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return BX(q,X,V,K,23,4),V+4}y.prototype.writeFloatLE=function(q,X,V){return yX(this,q,X,!0,V)};y.prototype.writeFloatBE=function(q,X,V){return yX(this,q,X,!1,V)};function $X(q,X,V,K,Q){if(X=+X,V=V>>>0,!Q)SX(q,X,V,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return BX(q,X,V,K,52,8),V+8}y.prototype.writeDoubleLE=function(q,X,V){return $X(this,q,X,!0,V)};y.prototype.writeDoubleBE=function(q,X,V){return $X(this,q,X,!1,V)};y.prototype.copy=function(q,X,V,K){if(!y.isBuffer(q))throw TypeError("argument should be a Buffer");if(!V)V=0;if(!K&&K!==0)K=this.length;if(X>=q.length)X=q.length;if(!X)X=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(q.length-X>>0,V=V===void 0?this.length:V>>>0,!q)q=0;let Q;if(typeof q==="number")for(Q=X;Q=K+4;V-=3)X=`_${q.slice(V-3,V)}${X}`;return`${q.slice(0,V)}${X}`}function wQ(q,X,V){if(y5(X,"offset"),q[X]===void 0||q[X+V]===void 0)C8(X,q.length-(V+1))}function CX(q,X,V,K,Q,Y){if(q>V||q3)if(X===0||X===BigInt(0))G=`>= 0${J} and < 2${J} ** ${(Y+1)*8}${J}`;else G=`>= -(2${J} ** ${(Y+1)*8-1}${J}) and < 2 ** ${(Y+1)*8-1}${J}`;else G=`>= ${X}${J} and <= ${V}${J}`;throw new pq("value",G,q)}wQ(K,Q,Y)}function y5(q,X){if(typeof q!=="number")throw new ZQ(X,"number",q)}function C8(q,X,V){if(Math.floor(q)!==q)throw y5(q,V),new pq(V||"offset","an integer",q);if(X<0)throw new GQ;throw new pq(V||"offset",`>= ${V?1:0} and <= ${X}`,q)}var NQ=/[^+/0-9A-Za-z-_]/g;function SQ(q){if(q=q.split("=")[0],q=q.trim().replace(NQ,""),q.length<2)return"";while(q.length%4!==0)q=q+"=";return q}function rq(q,X){X=X||1/0;let V,K=q.length,Q=null,Y=[];for(let J=0;J55295&&V<57344){if(!Q){if(V>56319){if((X-=3)>-1)Y.push(239,191,189);continue}else if(J+1===K){if((X-=3)>-1)Y.push(239,191,189);continue}Q=V;continue}if(V<56320){if((X-=3)>-1)Y.push(239,191,189);Q=V;continue}V=(Q-55296<<10|V-56320)+65536}else if(Q){if((X-=3)>-1)Y.push(239,191,189)}if(Q=null,V<128){if((X-=1)<0)break;Y.push(V)}else if(V<2048){if((X-=2)<0)break;Y.push(V>>6|192,V&63|128)}else if(V<65536){if((X-=3)<0)break;Y.push(V>>12|224,V>>6&63|128,V&63|128)}else if(V<1114112){if((X-=4)<0)break;Y.push(V>>18|240,V>>12&63|128,V>>6&63|128,V&63|128)}else throw Error("Invalid code point")}return Y}function yQ(q){let X=[];for(let V=0;V>8,Q=V%256,Y.push(Q),Y.push(K)}return Y}function hX(q){return KQ(SQ(q))}function h1(q,X,V,K){let Q;for(Q=0;Q=X.length||Q>=q.length)break;X[Q+V]=q[Q]}return Q}function h2(q,X){return q instanceof X||q!=null&&q.constructor!=null&&q.constructor.name!=null&&q.constructor.name===X.name}var CQ=function(){let q=Array(256);for(let X=0;X<16;++X){let V=X*16;for(let K=0;K<16;++K)q[V+K]="0123456789abcdef"[X]+"0123456789abcdef"[K]}return q}();function M6(q){return typeof BigInt>"u"?hQ:q}function hQ(){throw Error("BigInt not supported")}function sq(q){return()=>{throw Error(q+" is not implemented for node:buffer browser polyfill")}}var P3=sq("resolveObjectURL"),D3=sq("isUtf8");var u3=sq("transcode");var N3=$8(gX(),1);var zX={};qQ(zX,{waitForTick:()=>v2,values:()=>d5,utf8Encode:()=>mQ,utf16Encode:()=>j4,utf16Decode:()=>x8,typedArrayFor:()=>D8,translate:()=>c0,toUint8Array:()=>r6,toRadians:()=>O0,toHexStringOfMinLength:()=>D2,toHexString:()=>u2,toDegrees:()=>k1,toCodePoint:()=>Q4,toCharCode:()=>s,sum:()=>M4,stroke:()=>B5,square:()=>lZ,sortedUniq:()=>z4,skewRadians:()=>k8,skewDegrees:()=>bZ,sizeInBytes:()=>P5,singleQuote:()=>t9,showText:()=>L1,setWordSpacing:()=>pZ,setTextRise:()=>nZ,setTextRenderingMode:()=>rZ,setTextMatrix:()=>FK,setStrokingRgbColor:()=>x7,setStrokingGrayscaleColor:()=>u7,setStrokingColor:()=>R5,setStrokingCmykColor:()=>m7,setLineWidth:()=>L5,setLineJoin:()=>fZ,setLineHeight:()=>P7,setLineCap:()=>I8,setGraphicsState:()=>i2,setFontAndSize:()=>T5,setFillingRgbColor:()=>g7,setFillingGrayscaleColor:()=>D7,setFillingColor:()=>E2,setFillingCmykColor:()=>b7,setDashPattern:()=>j5,setCharacterSqueeze:()=>dZ,setCharacterSpacing:()=>cZ,scale:()=>g6,rotateRectangle:()=>$7,rotateRadians:()=>x6,rotateInPlace:()=>j2,rotateDegrees:()=>M8,rotateAndSkewTextRadiansAndTranslate:()=>j8,rotateAndSkewTextDegreesAndTranslate:()=>iZ,rgb:()=>Y0,reverseArray:()=>I6,restoreDashPattern:()=>mZ,reduceRotation:()=>I2,rectanglesAreEqual:()=>n5,rectangle:()=>hK,range:()=>k4,radiansToDegrees:()=>CK,radians:()=>gZ,pushGraphicsState:()=>B0,popGraphicsState:()=>T0,pluckIndices:()=>I4,pdfDocEncodingDecode:()=>J1,parseDate:()=>P8,padStart:()=>e0,numberToString:()=>T4,normalizeAppearance:()=>G2,nextLine:()=>F7,newlineChars:()=>gQ,moveTo:()=>J2,moveText:()=>_Z,mergeUint8Arrays:()=>H4,mergeLines:()=>P1,mergeIntoTypedArray:()=>W4,lowSurrogate:()=>g1,lineTo:()=>S0,lineSplit:()=>F8,layoutSinglelineText:()=>R8,layoutMultilineText:()=>gq,layoutCombedText:()=>QX,last:()=>n6,isWithinBMP:()=>L4,isType:()=>XK,isStandardFont:()=>qq,isNewlineChar:()=>J4,highSurrogate:()=>u1,hasUtf16BOM:()=>b8,hasSurrogates:()=>B4,grayscale:()=>yq,getType:()=>qK,findLastMatch:()=>F5,fillAndStroke:()=>j1,fill:()=>E1,escapedNewlineChars:()=>mX,escapeRegExp:()=>bX,error:()=>L6,endText:()=>T1,endPath:()=>wq,endMarkedContent:()=>Sq,encodeToBase64:()=>V4,drawTextLines:()=>Pq,drawTextField:()=>Dq,drawText:()=>eZ,drawSvgPath:()=>n7,drawRectangle:()=>b6,drawRadioButton:()=>T8,drawPage:()=>p7,drawOptionList:()=>r7,drawObject:()=>L8,drawLinesOfText:()=>c7,drawLine:()=>d7,drawImage:()=>A1,drawEllipsePath:()=>xK,drawEllipse:()=>O1,drawCheckMark:()=>bK,drawCheckBox:()=>B8,drawButton:()=>Fq,degreesToRadians:()=>H6,degrees:()=>p,defaultTextFieldAppearanceProvider:()=>ZX,defaultRadioGroupAppearanceProvider:()=>JX,defaultOptionListAppearanceProvider:()=>HX,defaultDropdownAppearanceProvider:()=>WX,defaultCheckBoxAppearanceProvider:()=>YX,defaultButtonAppearanceProvider:()=>GX,decodePDFRawStream:()=>V8,decodeFromBase64DataUri:()=>K4,decodeFromBase64:()=>X4,createValueErrorMsg:()=>e9,createTypeErrorMsg:()=>VK,createPDFAcroFields:()=>Z8,createPDFAcroField:()=>Iq,copyStringIntoBuffer:()=>k0,concatTransformationMatrix:()=>I1,componentsToColor:()=>l0,colorToComponents:()=>Cq,cmyk:()=>$q,closePath:()=>N2,clipEvenOdd:()=>xZ,clip:()=>Aq,cleanText:()=>k6,charSplit:()=>G4,charFromHexCode:()=>Y4,charFromCode:()=>t0,charAtIndex:()=>D1,canBeConvertedToUint8Array:()=>E4,bytesFor:()=>j6,byAscendingId:()=>U4,breakTextIntoLines:()=>Z4,beginText:()=>B1,beginMarkedContent:()=>Nq,backtick:()=>$0,assertRangeOrUndefined:()=>X2,assertRange:()=>b0,assertPositive:()=>X6,assertOrUndefined:()=>F,assertMultiple:()=>Y1,assertIsSubset:()=>K7,assertIsOneOfOrUndefined:()=>a0,assertIsOneOf:()=>M2,assertIs:()=>T,assertInteger:()=>Q7,assertEachIs:()=>Q1,asPDFNumber:()=>f,asPDFName:()=>z8,asNumber:()=>t,arrayAsString:()=>u8,appendQuadraticCurve:()=>E8,appendBezierCurve:()=>p0,adjustDimsForRotation:()=>r2,addRandomSuffix:()=>uQ,ViewerPreferences:()=>W1,UnsupportedEncodingError:()=>Y7,UnrecognizedStreamTypeError:()=>G7,UnexpectedObjectTypeError:()=>w6,UnexpectedFieldTypeError:()=>z6,UnbalancedParenthesisError:()=>j7,TextRenderingMode:()=>h7,TextAlignment:()=>R0,StandardFonts:()=>N5,StandardFontValues:()=>o9,StandardFontEmbedder:()=>$6,StalledParserError:()=>L7,RotationTypes:()=>E5,RichTextFieldReadError:()=>qX,ReparseError:()=>Q5,RemovePageFromEmptyDocumentError:()=>s7,ReadingDirection:()=>U5,PrivateConstructorError:()=>K5,PrintScaling:()=>z5,PngEmbedder:()=>X8,ParseSpeeds:()=>w1,PageSizes:()=>UX,PageEmbeddingMismatchedContextError:()=>Z7,PDFXRefStreamParser:()=>Bq,PDFWriter:()=>o5,PDFWidgetAnnotation:()=>M5,PDFTrailerDict:()=>Yq,PDFTrailer:()=>S6,PDFTextField:()=>w5,PDFString:()=>K0,PDFStreamWriter:()=>Gq,PDFStreamParsingError:()=>E7,PDFStream:()=>E0,PDFSignature:()=>O8,PDFRef:()=>a,PDFRawStream:()=>w2,PDFRadioGroup:()=>l6,PDFParsingError:()=>V6,PDFParser:()=>Tq,PDFPageTree:()=>H8,PDFPageLeaf:()=>_0,PDFPageEmbedder:()=>K8,PDFPage:()=>y0,PDFOptionList:()=>A5,PDFOperatorNames:()=>X0,PDFOperator:()=>e,PDFObjectStreamParser:()=>Lq,PDFObjectStream:()=>a5,PDFObjectParsingError:()=>k7,PDFObjectParser:()=>U8,PDFObjectCopier:()=>Z1,PDFObject:()=>z0,PDFNumber:()=>x,PDFNull:()=>F0,PDFName:()=>I,PDFJavaScript:()=>bq,PDFInvalidObjectParsingError:()=>I7,PDFInvalidObject:()=>s5,PDFImage:()=>v5,PDFHexString:()=>g,PDFHeader:()=>_2,PDFForm:()=>xq,PDFFont:()=>A0,PDFFlateStream:()=>N6,PDFField:()=>d0,PDFEmbeddedPage:()=>v8,PDFDropdown:()=>O5,PDFDocument:()=>o0,PDFDict:()=>m,PDFCrossRefStream:()=>Jq,PDFCrossRefSection:()=>i5,PDFContext:()=>Z5,PDFContentStream:()=>p2,PDFCheckBox:()=>f6,PDFCatalog:()=>W8,PDFButton:()=>S5,PDFBool:()=>c2,PDFArrayIsNotRectangleError:()=>W7,PDFArray:()=>i,PDFAnnotation:()=>kq,PDFAcroText:()=>J6,PDFAcroTerminal:()=>K2,PDFAcroSignature:()=>F6,PDFAcroRadioButton:()=>Z6,PDFAcroPushButton:()=>G6,PDFAcroNonTerminal:()=>Y6,PDFAcroListBox:()=>W6,PDFAcroForm:()=>P6,PDFAcroField:()=>Y8,PDFAcroComboBox:()=>Q6,PDFAcroChoice:()=>G8,PDFAcroCheckBox:()=>K6,PDFAcroButton:()=>h6,NumberParsingError:()=>Kq,NonFullScreenPageMode:()=>H5,NoSuchFieldError:()=>t7,NextByteAssertionError:()=>M7,MultiSelectValueError:()=>H7,MissingTfOperatorError:()=>z7,MissingPageContentsEmbeddingError:()=>J7,MissingPDFHeaderError:()=>B7,MissingOnValueCheckError:()=>X3,MissingKeywordError:()=>T7,MissingDAEntryError:()=>U7,MissingCatalogError:()=>qG,MethodNotImplementedError:()=>u0,LineJoinStyle:()=>C7,LineCapStyle:()=>u6,JpegEmbedder:()=>q8,InvalidTargetIndexError:()=>Xq,InvalidPDFDateStringError:()=>G1,InvalidMaxLengthError:()=>KX,InvalidFieldNamePartError:()=>e7,InvalidAcroFieldValueError:()=>J5,IndexOutOfBoundsError:()=>Y5,ImageAlignment:()=>T2,ForeignPageError:()=>o7,FontkitNotRegisteredError:()=>a7,FileEmbedder:()=>Hq,FieldExistsAsNonTerminalError:()=>V3,FieldAlreadyExistsError:()=>uq,ExceededMaxLengthError:()=>VX,EncryptedPDFError:()=>i7,Duplex:()=>Q8,CustomFontSubsetEmbedder:()=>Wq,CustomFontEmbedder:()=>C6,CorruptPageTreeError:()=>Vq,CombedTextLayoutError:()=>XX,ColorTypes:()=>U6,CharCodes:()=>E,Cache:()=>m0,BlendMode:()=>S2,AppearanceCharacteristics:()=>J8,AnnotationFlags:()=>I5,AcroTextFlags:()=>j0,AcroFieldFlags:()=>Y2,AcroChoiceFlags:()=>G0,AcroButtonFlags:()=>f0,AFRelationship:()=>t5});/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -14,22 +14,22 @@ 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. -***************************************************************************** */var eq=function(V,q){return eq=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,K){X.__proto__=K}||function(X,K){for(var Q in K)if(K.hasOwnProperty(Q))X[Q]=K[Q]},eq(V,q)};function A(V,q){eq(V,q);function X(){this.constructor=V}V.prototype=q===null?Object.create(q):(X.prototype=q.prototype,new X)}var o=function(){return o=Object.assign||function V(q){for(var X,K=1,Q=arguments.length;K0&&Y[Y.length-1]))&&(Z[0]===6||Z[0]===2)){X=0;continue}if(Z[0]===3&&(!Y||Z[1]>Y[0]&&Z[1]>2],q+=h8[(V[K]&3)<<4|V[K+1]>>4],q+=h8[(V[K+1]&15)<<2|V[K+2]>>6],q+=h8[V[K+2]&63];if(X%3===2)q=q.substring(0,q.length-1)+"=";else if(X%3===1)q=q.substring(0,q.length-2)+"==";return q},q4=function(V){var q=V.length*0.75,X=V.length,K,Q=0,Y,J,G,W;if(V[V.length-1]==="="){if(q--,V[V.length-2]==="=")q--}var Z=new Uint8Array(q);for(K=0;K>4,Z[Q++]=(J&15)<<4|G>>2,Z[Q++]=(G&3)<<6|W&63;return Z},yK=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,V4=function(V){var q=V.trim(),X=q.substring(0,100),K=X.match(yK);if(!K)return q4(q);var Q=K[0],Y=q.substring(Q.length);return q4(Y)};var s=function(V){return V.charCodeAt(0)},K4=function(V){return V.codePointAt(0)},D6=function(V,q){return e0(V.toString(16),q,"0").toUpperCase()},u6=function(V){return D6(V,2)},t0=function(V){return String.fromCharCode(V)},Q4=function(V){return t0(parseInt(V,16))},e0=function(V,q,X){var K="";for(var Q=0,Y=q-V.length;Q=55296&&X<=56319&&V.length>Q){if(K=V.charCodeAt(Q),K>=56320&&K<=57343)Y=2}return[V.slice(q,q+Y),Y]},J4=function(V){var q=[];for(var X=0,K=V.length;XX)Z();J+=z,G+=I}}return Z(),W},FK=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,P2=function(V){var q=V.match(FK);if(!q)return;var X=q[1],K=q[2],Q=K===void 0?"01":K,Y=q[3],J=Y===void 0?"01":Y,G=q[4],W=G===void 0?"00":G,Z=q[5],U=Z===void 0?"00":Z,H=q[6],z=H===void 0?"00":H,I=q[7],M=I===void 0?"Z":I,L=q[8],B=L===void 0?"00":L,j=q[9],O=j===void 0?"00":j,N=M==="Z"?"Z":""+M+B+":"+O,R=new Date(X+"-"+Q+"-"+J+"T"+W+":"+U+":"+z+N);return R},F8=function(V,q){var X,K=0,Q;while(K>6&31|192,G=Y&63|128;X.push(J,G),K+=1}else if(Y<65536){var J=Y>>12&15|224,G=Y>>6&63|128,W=Y&63|128;X.push(J,G,W),K+=1}else if(Y<1114112){var J=Y>>18&7|240,G=Y>>12&63|128,W=Y>>6&63|128,Z=Y>>0&63|128;X.push(J,G,W,Z),K+=2}else throw new Error("Invalid code point: 0x"+u6(Y))}return new Uint8Array(X)},E4=function(V,q){if(q===void 0)q=!0;var X=[];if(q)X.push(65279);for(var K=0,Q=V.length;K=0&&V<=65535},j4=function(V){return V>=65536&&V<=1114111},D1=function(V){return Math.floor((V-65536)/1024)+55296},u1=function(V){return(V-65536)%1024+56320},E5;(function(V){V.BigEndian="BigEndian",V.LittleEndian="LittleEndian"})(E5||(E5={}));var g2="�".codePointAt(0),x2=function(V,q){if(q===void 0)q=!0;if(V.length<=1)return String.fromCodePoint(g2);var X=q?uK(V):E5.BigEndian,K=q?2:0,Q=[];while(V.length-K>=2){var Y=lX(V[K++],V[K++],X);if(DK(Y))if(V.length-K<2)Q.push(g2);else{var J=lX(V[K++],V[K++],X);if(fX(J))Q.push(Y,J);else Q.push(g2)}else if(fX(Y))K+=2,Q.push(g2);else Q.push(Y)}if(K=55296&&V<=56319},fX=function(V){return V>=56320&&V<=57343},lX=function(V,q,X){if(X===E5.LittleEndian)return q<<8|V;if(X===E5.BigEndian)return V<<8|q;throw new Error("Invalid byteOrder: "+X)},uK=function(V){return _X(V)?E5.BigEndian:cX(V)?E5.LittleEndian:E5.BigEndian},_X=function(V){return V[0]===254&&V[1]===255},cX=function(V){return V[0]===255&&V[1]===254},b2=function(V){return _X(V)||cX(V)};var B4=function(V){var q=String(V);if(Math.abs(V)<1){var X=parseInt(V.toString().split("e-")[1]);if(X){var K=V<0;if(K)V*=-1;if(V*=Math.pow(10,X-1),q="0."+new Array(X).join("0")+V.toString().substring(2),K)q="-"+q}}else{var X=parseInt(V.toString().split("+")[1]);if(X>20)X-=20,V/=Math.pow(10,X),q=V.toString()+new Array(X+1).join("0")}return q},P8=function(V){return Math.ceil(V.toString(2).length/8)},L5=function(V){var q=new Uint8Array(P8(V));for(var X=1;X<=q.length;X++)q[X-1]=V>>(q.length-X)*8;return q};var j5=function(V){throw new Error(V)};var h9=$2(X1()),C9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",V1=new Uint8Array(256);for(p8=0;p8>4,Z[Q++]=(J&15)<<4|G>>2,Z[Q++]=(G&3)<<6|W&63;return Z},$Y=function(V){var q="";for(var X=0;XK)throw new Error($0(q)+" must be at least "+X+" and at most "+K+", but was actually "+V)},X6=function(V,q,X,K){if(T(V,q,["number","undefined"]),typeof V==="number")b0(V,q,X,K)},Y1=function(V,q,X){if(T(V,q,["number"]),V%X!==0)throw new Error($0(q)+" must be a multiple of "+X+", but was actually "+V)},K7=function(V,q){if(!Number.isInteger(V))throw new Error($0(q)+" must be an integer, but was actually "+V)},X5=function(V,q){if(![1,0].includes(Math.sign(V)))throw new Error($0(q)+" must be a positive number or 0, but was actually "+V)};var V0=new Uint16Array(256);for(r8=0;r8<256;r8++)V0[r8]=r8;var r8;V0[22]=s("\x17");V0[24]=s("˘");V0[25]=s("ˇ");V0[26]=s("ˆ");V0[27]=s("˙");V0[28]=s("˝");V0[29]=s("˛");V0[30]=s("˚");V0[31]=s("˜");V0[127]=s("�");V0[128]=s("•");V0[129]=s("†");V0[130]=s("‡");V0[131]=s("…");V0[132]=s("—");V0[133]=s("–");V0[134]=s("ƒ");V0[135]=s("⁄");V0[136]=s("‹");V0[137]=s("›");V0[138]=s("−");V0[139]=s("‰");V0[140]=s("„");V0[141]=s("“");V0[142]=s("”");V0[143]=s("‘");V0[144]=s("’");V0[145]=s("‚");V0[146]=s("™");V0[147]=s("fi");V0[148]=s("fl");V0[149]=s("Ł");V0[150]=s("Œ");V0[151]=s("Š");V0[152]=s("Ÿ");V0[153]=s("Ž");V0[154]=s("ı");V0[155]=s("ł");V0[156]=s("œ");V0[157]=s("š");V0[158]=s("ž");V0[159]=s("�");V0[160]=s("€");V0[173]=s("�");var J1=function(V){var q=new Array(V.length);for(var X=0,K=V.length;X=E.ExclamationPoint&&V<=E.Tilde&&!Kq[V]},K3={},Q3=new Map,VJ=function(V){A(q,V);function q(X,K){var Q=this;if(X!==K3)throw new K8("PDFName");Q=V.call(this)||this;var Y="/";for(var J=0,G=K.length;J=E.Zero&&Z<=E.Nine||Z>=E.a&&Z<=E.f||Z>=E.A&&Z<=E.F){if(K+=W,K.length===2||!(U>="0"&&U<="9"||U>="a"&&U<="f"||U>="A"&&U<="F"))Y(parseInt(K,16)),K=""}else Y(Z)}return new Uint8Array(X)},q.prototype.decodeText=function(){var X=this.asBytes();return String.fromCharCode.apply(String,Array.from(X))},q.prototype.asString=function(){return this.encodedName},q.prototype.value=function(){return this.encodedName},q.prototype.clone=function(){return this},q.prototype.toString=function(){return this.encodedName},q.prototype.sizeInBytes=function(){return this.encodedName.length},q.prototype.copyBytesInto=function(X,K){return K+=I0(this.encodedName,X,K),this.encodedName.length},q.of=function(X){var K=qJ(X),Q=Q3.get(K);if(!Q)Q=new q(K3,K),Q3.set(K,Q);return Q},q.Length=q.of("Length"),q.FlateDecode=q.of("FlateDecode"),q.Resources=q.of("Resources"),q.Font=q.of("Font"),q.XObject=q.of("XObject"),q.ExtGState=q.of("ExtGState"),q.Contents=q.of("Contents"),q.Type=q.of("Type"),q.Parent=q.of("Parent"),q.MediaBox=q.of("MediaBox"),q.Page=q.of("Page"),q.Annots=q.of("Annots"),q.TrimBox=q.of("TrimBox"),q.ArtBox=q.of("ArtBox"),q.BleedBox=q.of("BleedBox"),q.CropBox=q.of("CropBox"),q.Rotate=q.of("Rotate"),q.Title=q.of("Title"),q.Author=q.of("Author"),q.Subject=q.of("Subject"),q.Creator=q.of("Creator"),q.Keywords=q.of("Keywords"),q.Producer=q.of("Producer"),q.CreationDate=q.of("CreationDate"),q.ModDate=q.of("ModDate"),q}(z0),k=VJ;var KJ=function(V){A(q,V);function q(){return V!==null&&V.apply(this,arguments)||this}return q.prototype.asNull=function(){return null},q.prototype.clone=function(){return this},q.prototype.toString=function(){return"null"},q.prototype.sizeInBytes=function(){return 4},q.prototype.copyBytesInto=function(X,K){return X[K++]=E.n,X[K++]=E.u,X[K++]=E.l,X[K++]=E.l,4},q}(z0),F0=new KJ;var QJ=function(V){A(q,V);function q(X,K){var Q=V.call(this)||this;return Q.dict=X,Q.context=K,Q}return q.prototype.keys=function(){return Array.from(this.dict.keys())},q.prototype.values=function(){return Array.from(this.dict.values())},q.prototype.entries=function(){return Array.from(this.dict.entries())},q.prototype.set=function(X,K){this.dict.set(X,K)},q.prototype.get=function(X,K){if(K===void 0)K=!1;var Q=this.dict.get(X);if(Q===F0&&!K)return;return Q},q.prototype.has=function(X){var K=this.dict.get(X);return K!==void 0&&K!==F0},q.prototype.lookupMaybe=function(X){var K,Q=[];for(var Y=1;Y0&&Y[Y.length-1]))&&(Z[0]===6||Z[0]===2)){V=0;continue}if(Z[0]===3&&(!Y||Z[1]>Y[0]&&Z[1]>2],X+=h5[(q[K]&3)<<4|q[K+1]>>4],X+=h5[(q[K+1]&15)<<2|q[K+2]>>6],X+=h5[q[K+2]&63];if(V%3===2)X=X.substring(0,X.length-1)+"=";else if(V%3===1)X=X.substring(0,X.length-2)+"==";return X},X4=function(q){var X=q.length*0.75,V=q.length,K,Q=0,Y,J,G,W;if(q[q.length-1]==="="){if(X--,q[q.length-2]==="=")X--}var Z=new Uint8Array(X);for(K=0;K>4,Z[Q++]=(J&15)<<4|G>>2,Z[Q++]=(G&3)<<6|W&63;return Z},DQ=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,K4=function(q){var X=q.trim(),V=X.substring(0,100),K=V.match(DQ);if(!K)return X4(X);var Q=K[0],Y=X.substring(Q.length);return X4(Y)};var s=function(q){return q.charCodeAt(0)},Q4=function(q){return q.codePointAt(0)},D2=function(q,X){return e0(q.toString(16),X,"0").toUpperCase()},u2=function(q){return D2(q,2)},t0=function(q){return String.fromCharCode(q)},Y4=function(q){return t0(parseInt(q,16))},e0=function(q,X,V){var K="";for(var Q=0,Y=X-q.length;Q=55296&&V<=56319&&q.length>Q){if(K=q.charCodeAt(Q),K>=56320&&K<=57343)Y=2}return[q.slice(X,X+Y),Y]},G4=function(q){var X=[];for(var V=0,K=q.length;VV)Z();J+=z,G+=k}}return Z(),W},bQ=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,P8=function(q){var X=q.match(bQ);if(!X)return;var V=X[1],K=X[2],Q=K===void 0?"01":K,Y=X[3],J=Y===void 0?"01":Y,G=X[4],W=G===void 0?"00":G,Z=X[5],H=Z===void 0?"00":Z,U=X[6],z=U===void 0?"00":U,k=X[7],M=k===void 0?"Z":k,j=X[8],B=j===void 0?"00":j,L=X[9],O=L===void 0?"00":L,N=M==="Z"?"Z":""+M+B+":"+O,v=new Date(V+"-"+Q+"-"+J+"T"+W+":"+H+":"+z+N);return v},F5=function(q,X){var V,K=0,Q;while(K>6&31|192,G=Y&63|128;V.push(J,G),K+=1}else if(Y<65536){var J=Y>>12&15|224,G=Y>>6&63|128,W=Y&63|128;V.push(J,G,W),K+=1}else if(Y<1114112){var J=Y>>18&7|240,G=Y>>12&63|128,W=Y>>6&63|128,Z=Y>>0&63|128;V.push(J,G,W,Z),K+=2}else throw Error("Invalid code point: 0x"+u2(Y))}return new Uint8Array(V)},j4=function(q,X){if(X===void 0)X=!0;var V=[];if(X)V.push(65279);for(var K=0,Q=q.length;K=0&&q<=65535},B4=function(q){return q>=65536&&q<=1114111},u1=function(q){return Math.floor((q-65536)/1024)+55296},g1=function(q){return(q-65536)%1024+56320},E6;(function(q){q.BigEndian="BigEndian",q.LittleEndian="LittleEndian"})(E6||(E6={}));var g8="�".codePointAt(0),x8=function(q,X){if(X===void 0)X=!0;if(q.length<=1)return String.fromCodePoint(g8);var V=X?lQ(q):E6.BigEndian,K=X?2:0,Q=[];while(q.length-K>=2){var Y=lX(q[K++],q[K++],V);if(fQ(Y))if(q.length-K<2)Q.push(g8);else{var J=lX(q[K++],q[K++],V);if(fX(J))Q.push(Y,J);else Q.push(g8)}else if(fX(Y))K+=2,Q.push(g8);else Q.push(Y)}if(K=55296&&q<=56319},fX=function(q){return q>=56320&&q<=57343},lX=function(q,X,V){if(V===E6.LittleEndian)return X<<8|q;if(V===E6.BigEndian)return q<<8|X;throw Error("Invalid byteOrder: "+V)},lQ=function(q){return _X(q)?E6.BigEndian:cX(q)?E6.LittleEndian:E6.BigEndian},_X=function(q){return q[0]===254&&q[1]===255},cX=function(q){return q[0]===255&&q[1]===254},b8=function(q){return _X(q)||cX(q)};var T4=function(q){var X=String(q);if(Math.abs(q)<1){var V=parseInt(q.toString().split("e-")[1]);if(V){var K=q<0;if(K)q*=-1;if(q*=Math.pow(10,V-1),X="0."+Array(V).join("0")+q.toString().substring(2),K)X="-"+X}}else{var V=parseInt(q.toString().split("+")[1]);if(V>20)V-=20,q/=Math.pow(10,V),X=q.toString()+Array(V+1).join("0")}return X},P5=function(q){return Math.ceil(q.toString(2).length/8)},j6=function(q){var X=new Uint8Array(P5(q));for(var V=1;V<=X.length;V++)X[V-1]=q>>(X.length-V)*8;return X};var L6=function(q){throw Error(q)};var h9=$8(X1(),1),C9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",V1=new Uint8Array(256);for(p5=0;p5>4,Z[Q++]=(J&15)<<4|G>>2,Z[Q++]=(G&3)<<6|W&63;return Z},uJ=function(q){var X="";for(var V=0;VK)throw Error($0(X)+" must be at least "+V+" and at most "+K+", but was actually "+q)},X2=function(q,X,V,K){if(T(q,X,["number","undefined"]),typeof q==="number")b0(q,X,V,K)},Y1=function(q,X,V){if(T(q,X,["number"]),q%V!==0)throw Error($0(X)+" must be a multiple of "+V+", but was actually "+q)},Q7=function(q,X){if(!Number.isInteger(q))throw Error($0(X)+" must be an integer, but was actually "+q)},X6=function(q,X){if(![1,0].includes(Math.sign(q)))throw Error($0(X)+" must be a positive number or 0, but was actually "+q)};var V0=new Uint16Array(256);for(r5=0;r5<256;r5++)V0[r5]=r5;var r5;V0[22]=s("\x17");V0[24]=s("˘");V0[25]=s("ˇ");V0[26]=s("ˆ");V0[27]=s("˙");V0[28]=s("˝");V0[29]=s("˛");V0[30]=s("˚");V0[31]=s("˜");V0[127]=s("�");V0[128]=s("•");V0[129]=s("†");V0[130]=s("‡");V0[131]=s("…");V0[132]=s("—");V0[133]=s("–");V0[134]=s("ƒ");V0[135]=s("⁄");V0[136]=s("‹");V0[137]=s("›");V0[138]=s("−");V0[139]=s("‰");V0[140]=s("„");V0[141]=s("“");V0[142]=s("”");V0[143]=s("‘");V0[144]=s("’");V0[145]=s("‚");V0[146]=s("™");V0[147]=s("fi");V0[148]=s("fl");V0[149]=s("Ł");V0[150]=s("Œ");V0[151]=s("Š");V0[152]=s("Ÿ");V0[153]=s("Ž");V0[154]=s("ı");V0[155]=s("ł");V0[156]=s("œ");V0[157]=s("š");V0[158]=s("ž");V0[159]=s("�");V0[160]=s("€");V0[173]=s("�");var J1=function(q){var X=Array(q.length);for(var V=0,K=q.length;V=E.ExclamationPoint&&q<=E.Tilde&&!Qq[q]},KK={},QK=new Map,ZG=function(q){w(X,q);function X(V,K){var Q=this;if(V!==KK)throw new K5("PDFName");Q=q.call(this)||this;var Y="/";for(var J=0,G=K.length;J=E.Zero&&Z<=E.Nine||Z>=E.a&&Z<=E.f||Z>=E.A&&Z<=E.F){if(K+=W,K.length===2||!(H>="0"&&H<="9"||H>="a"&&H<="f"||H>="A"&&H<="F"))Y(parseInt(K,16)),K=""}else Y(Z)}return new Uint8Array(V)},X.prototype.decodeText=function(){var V=this.asBytes();return String.fromCharCode.apply(String,Array.from(V))},X.prototype.asString=function(){return this.encodedName},X.prototype.value=function(){return this.encodedName},X.prototype.clone=function(){return this},X.prototype.toString=function(){return this.encodedName},X.prototype.sizeInBytes=function(){return this.encodedName.length},X.prototype.copyBytesInto=function(V,K){return K+=k0(this.encodedName,V,K),this.encodedName.length},X.of=function(V){var K=JG(V),Q=QK.get(K);if(!Q)Q=new X(KK,K),QK.set(K,Q);return Q},X.Length=X.of("Length"),X.FlateDecode=X.of("FlateDecode"),X.Resources=X.of("Resources"),X.Font=X.of("Font"),X.XObject=X.of("XObject"),X.ExtGState=X.of("ExtGState"),X.Contents=X.of("Contents"),X.Type=X.of("Type"),X.Parent=X.of("Parent"),X.MediaBox=X.of("MediaBox"),X.Page=X.of("Page"),X.Annots=X.of("Annots"),X.TrimBox=X.of("TrimBox"),X.ArtBox=X.of("ArtBox"),X.BleedBox=X.of("BleedBox"),X.CropBox=X.of("CropBox"),X.Rotate=X.of("Rotate"),X.Title=X.of("Title"),X.Author=X.of("Author"),X.Subject=X.of("Subject"),X.Creator=X.of("Creator"),X.Keywords=X.of("Keywords"),X.Producer=X.of("Producer"),X.CreationDate=X.of("CreationDate"),X.ModDate=X.of("ModDate"),X}(z0),I=ZG;var WG=function(q){w(X,q);function X(){return q!==null&&q.apply(this,arguments)||this}return X.prototype.asNull=function(){return null},X.prototype.clone=function(){return this},X.prototype.toString=function(){return"null"},X.prototype.sizeInBytes=function(){return 4},X.prototype.copyBytesInto=function(V,K){return V[K++]=E.n,V[K++]=E.u,V[K++]=E.l,V[K++]=E.l,4},X}(z0),F0=new WG;var HG=function(q){w(X,q);function X(V,K){var Q=q.call(this)||this;return Q.dict=V,Q.context=K,Q}return X.prototype.keys=function(){return Array.from(this.dict.keys())},X.prototype.values=function(){return Array.from(this.dict.values())},X.prototype.entries=function(){return Array.from(this.dict.entries())},X.prototype.set=function(V,K){this.dict.set(V,K)},X.prototype.get=function(V,K){if(K===void 0)K=!1;var Q=this.dict.get(V);if(Q===F0&&!K)return;return Q},X.prototype.has=function(V){var K=this.dict.get(V);return K!==void 0&&K!==F0},X.prototype.lookupMaybe=function(V){var K,Q=[];for(var Y=1;Ythis.largestObjectNumber)this.largestObjectNumber=q.objectNumber},V.prototype.nextRef=function(){return this.largestObjectNumber+=1,a.of(this.largestObjectNumber)},V.prototype.register=function(q){var X=this.nextRef();return this.assign(X,q),X},V.prototype.delete=function(q){return this.indirectObjects.delete(q)},V.prototype.lookupMaybe=function(q){var X=[];for(var K=1;K1)this.subsections.push([q]),this.chunkIdx+=1,this.chunkLength=1;else X.push(q),this.chunkLength+=1},V.create=function(){return new V({ref:a.of(0,65535),offset:0,deleted:!0})},V.createEmpty=function(){return new V},V}(),i8=kJ;var EJ=function(){function V(q){this.lastXRefOffset=String(q)}return V.prototype.toString=function(){return`startxref +`,V+=this.getContentsString(),V+=` +endstream`,V},X.prototype.copyBytesInto=function(V,K){this.updateDict();var Q=K;K+=this.dict.copyBytesInto(V,K),V[K++]=E.Newline,V[K++]=E.s,V[K++]=E.t,V[K++]=E.r,V[K++]=E.e,V[K++]=E.a,V[K++]=E.m,V[K++]=E.Newline;var Y=this.getContents();for(var J=0,G=Y.length;Jthis.largestObjectNumber)this.largestObjectNumber=X.objectNumber},q.prototype.nextRef=function(){return this.largestObjectNumber+=1,a.of(this.largestObjectNumber)},q.prototype.register=function(X){var V=this.nextRef();return this.assign(V,X),V},q.prototype.delete=function(X){return this.indirectObjects.delete(X)},q.prototype.lookupMaybe=function(X){var V=[];for(var K=1;K1)this.subsections.push([X]),this.chunkIdx+=1,this.chunkLength=1;else V.push(X),this.chunkLength+=1},q.create=function(){return new q({ref:a.of(0,65535),offset:0,deleted:!0})},q.createEmpty=function(){return new q},q}(),i5=RG;var vG=function(){function q(X){this.lastXRefOffset=String(X)}return q.prototype.toString=function(){return`startxref `+this.lastXRefOffset+` -%%EOF`},V.prototype.sizeInBytes=function(){return 16+this.lastXRefOffset.length},V.prototype.copyBytesInto=function(q,X){var K=X;return q[X++]=E.s,q[X++]=E.t,q[X++]=E.a,q[X++]=E.r,q[X++]=E.t,q[X++]=E.x,q[X++]=E.r,q[X++]=E.e,q[X++]=E.f,q[X++]=E.Newline,X+=I0(this.lastXRefOffset,q,X),q[X++]=E.Newline,q[X++]=E.Percent,q[X++]=E.Percent,q[X++]=E.E,q[X++]=E.O,q[X++]=E.F,X-K},V.forLastCrossRefSectionOffset=function(q){return new V(q)},V}(),S5=EJ;var LJ=function(){function V(q){this.dict=q}return V.prototype.toString=function(){return`trailer -`+this.dict.toString()},V.prototype.sizeInBytes=function(){return 8+this.dict.sizeInBytes()},V.prototype.copyBytesInto=function(q,X){var K=X;return q[X++]=E.t,q[X++]=E.r,q[X++]=E.a,q[X++]=E.i,q[X++]=E.l,q[X++]=E.e,q[X++]=E.r,q[X++]=E.Newline,X+=this.dict.copyBytesInto(q,X),X-K},V.of=function(q){return new V(q)},V}(),Qq=LJ;var jJ=function(V){A(q,V);function q(X,K,Q){if(Q===void 0)Q=!0;var Y=V.call(this,X.obj({}),Q)||this;return Y.objects=K,Y.offsets=Y.computeObjectOffsets(),Y.offsetsString=Y.computeOffsetsString(),Y.dict.set(k.of("Type"),k.of("ObjStm")),Y.dict.set(k.of("N"),x.of(Y.objects.length)),Y.dict.set(k.of("First"),x.of(Y.offsetsString.length)),Y}return q.prototype.getObjectsCount=function(){return this.objects.length},q.prototype.clone=function(X){return q.withContextAndObjects(X||this.dict.context,this.objects.slice(),this.encode)},q.prototype.getContentsString=function(){var X=this.offsetsString;for(var K=0,Q=this.objects.length;K1)J.push(G),J.push(U.ref.objectNumber),G=0;G+=1}return J.push(G),J},Y.computeEntryTuples=function(){var J=new Array(Y.entries.length);for(var G=0,W=Y.entries.length;GG[0])G[0]=M;if(L>G[1])G[1]=L;if(B>G[2])G[2]=B}return G},Y.entries=K||[],Y.entryTuplesCache=m0.populatedBy(Y.computeEntryTuples),Y.maxByteWidthsCache=m0.populatedBy(Y.computeMaxEntryByteWidths),Y.indexCache=m0.populatedBy(Y.computeIndex),X.set(k.of("Type"),k.of("XRef")),Y}return q.prototype.addDeletedEntry=function(X,K){var Q=y5.Deleted;this.entries.push({type:Q,ref:X,nextFreeObjectNumber:K}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},q.prototype.addUncompressedEntry=function(X,K){var Q=y5.Uncompressed;this.entries.push({type:Q,ref:X,offset:K}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},q.prototype.addCompressedEntry=function(X,K,Q){var Y=y5.Compressed;this.entries.push({type:Y,ref:X,objectStreamRef:K,index:Q}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},q.prototype.clone=function(X){var K=this,Q=K.dict,Y=K.entries,J=K.encode;return q.of(Q.clone(X),Y.slice(),J)},q.prototype.getContentsString=function(){var X=this.entryTuplesCache.access(),K=this.maxByteWidthsCache.access(),Q="";for(var Y=0,J=X.length;Y=0;M--)Q+=(H[M]||0).toString(2);for(var M=K[1]-1;M>=0;M--)Q+=(z[M]||0).toString(2);for(var M=K[2]-1;M>=0;M--)Q+=(I[M]||0).toString(2)}return Q},q.prototype.getUnencodedContents=function(){var X=this.entryTuplesCache.access(),K=this.maxByteWidthsCache.access(),Q=new Uint8Array(this.getUnencodedContentsSize()),Y=0;for(var J=0,G=X.length;J=0;L--)Q[Y++]=z[L]||0;for(var L=K[1]-1;L>=0;L--)Q[Y++]=I[L]||0;for(var L=K[2]-1;L>=0;L--)Q[Y++]=M[L]||0}return Q},q.prototype.getUnencodedContentsSize=function(){var X=this.maxByteWidthsCache.access(),K=z4(X);return K*this.entries.length},q.prototype.updateDict=function(){V.prototype.updateDict.call(this);var X=this.maxByteWidthsCache.access(),K=this.indexCache.access(),Q=this.dict.context;this.dict.set(k.of("W"),Q.obj(X)),this.dict.set(k.of("Index"),Q.obj(K))},q.create=function(X,K){if(K===void 0)K=!0;var Q=new q(X,[],K);return Q.addDeletedEntry(a.of(0,65535),0),Q},q.of=function(X,K,Q){if(Q===void 0)Q=!0;return new q(X,K,Q)},q}(N5),Yq=vJ;var RJ=function(V){A(q,V);function q(X,K,Q,Y){var J=V.call(this,X,K)||this;return J.encodeStreams=Q,J.objectsPerStream=Y,J}return q.prototype.computeBufferSize=function(){return _(this,void 0,void 0,function(){var X,K,Q,Y,J,G,W,Z,M,L,U,j,H,z,B,I,M,L,B,j,O,N,R,v;return c(this,function(w){switch(w.label){case 0:X=this.context.largestObjectNumber+1,K=_6.forVersion(1,7),Q=K.sizeInBytes()+2,Y=Yq.create(this.createTrailerDict(),this.encodeStreams),J=[],G=[],W=[],Z=this.context.enumerateIndirectObjects(),M=0,L=Z.length,w.label=1;case 1:if(!(M"},q.prototype.sizeInBytes=function(){return this.value.length+2},q.prototype.copyBytesInto=function(X,K){return X[K++]=E.LessThan,K+=I0(this.value,X,K),X[K++]=E.GreaterThan,this.value.length+2},q.of=function(X){return new q(X)},q.fromText=function(X){var K=E4(X),Q="";for(var Y=0,J=K.length;Y1)J.push(G),J.push(H.ref.objectNumber),G=0;G+=1}return J.push(G),J},Y.computeEntryTuples=function(){var J=Array(Y.entries.length);for(var G=0,W=Y.entries.length;GG[0])G[0]=M;if(j>G[1])G[1]=j;if(B>G[2])G[2]=B}return G},Y.entries=K||[],Y.entryTuplesCache=m0.populatedBy(Y.computeEntryTuples),Y.maxByteWidthsCache=m0.populatedBy(Y.computeMaxEntryByteWidths),Y.indexCache=m0.populatedBy(Y.computeIndex),V.set(I.of("Type"),I.of("XRef")),Y}return X.prototype.addDeletedEntry=function(V,K){var Q=y6.Deleted;this.entries.push({type:Q,ref:V,nextFreeObjectNumber:K}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},X.prototype.addUncompressedEntry=function(V,K){var Q=y6.Uncompressed;this.entries.push({type:Q,ref:V,offset:K}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},X.prototype.addCompressedEntry=function(V,K,Q){var Y=y6.Compressed;this.entries.push({type:Y,ref:V,objectStreamRef:K,index:Q}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},X.prototype.clone=function(V){var K=this,Q=K.dict,Y=K.entries,J=K.encode;return X.of(Q.clone(V),Y.slice(),J)},X.prototype.getContentsString=function(){var V=this.entryTuplesCache.access(),K=this.maxByteWidthsCache.access(),Q="";for(var Y=0,J=V.length;Y=0;M--)Q+=(U[M]||0).toString(2);for(var M=K[1]-1;M>=0;M--)Q+=(z[M]||0).toString(2);for(var M=K[2]-1;M>=0;M--)Q+=(k[M]||0).toString(2)}return Q},X.prototype.getUnencodedContents=function(){var V=this.entryTuplesCache.access(),K=this.maxByteWidthsCache.access(),Q=new Uint8Array(this.getUnencodedContentsSize()),Y=0;for(var J=0,G=V.length;J=0;j--)Q[Y++]=z[j]||0;for(var j=K[1]-1;j>=0;j--)Q[Y++]=k[j]||0;for(var j=K[2]-1;j>=0;j--)Q[Y++]=M[j]||0}return Q},X.prototype.getUnencodedContentsSize=function(){var V=this.maxByteWidthsCache.access(),K=M4(V);return K*this.entries.length},X.prototype.updateDict=function(){q.prototype.updateDict.call(this);var V=this.maxByteWidthsCache.access(),K=this.indexCache.access(),Q=this.dict.context;this.dict.set(I.of("W"),Q.obj(V)),this.dict.set(I.of("Index"),Q.obj(K))},X.create=function(V,K){if(K===void 0)K=!0;var Q=new X(V,[],K);return Q.addDeletedEntry(a.of(0,65535),0),Q},X.of=function(V,K,Q){if(Q===void 0)Q=!0;return new X(V,K,Q)},X}(N6),Jq=SG;var yG=function(q){w(X,q);function X(V,K,Q,Y){var J=q.call(this,V,K)||this;return J.encodeStreams=Q,J.objectsPerStream=Y,J}return X.prototype.computeBufferSize=function(){return _(this,void 0,void 0,function(){var V,K,Q,Y,J,G,W,Z,M,j,H,L,U,z,B,k,M,j,B,L,O,N,v,R;return c(this,function(A){switch(A.label){case 0:V=this.context.largestObjectNumber+1,K=_2.forVersion(1,7),Q=K.sizeInBytes()+2,Y=Jq.create(this.createTrailerDict(),this.encodeStreams),J=[],G=[],W=[],Z=this.context.enumerateIndirectObjects(),M=0,j=Z.length,A.label=1;case 1:if(!(M"},X.prototype.sizeInBytes=function(){return this.value.length+2},X.prototype.copyBytesInto=function(V,K){return V[K++]=E.LessThan,K+=k0(this.value,V,K),V[K++]=E.GreaterThan,this.value.length+2},X.of=function(V){return new X(V)},X.fromText=function(V){var K=j4(V),Q="";for(var Y=0,J=K.length;Y endcodespacerange -`+V.length+` beginbfchar -`+V.map(function(q){var X=q[0],K=q[1];return X+" "+K}).join(` +`+q.length+` beginbfchar +`+q.map(function(X){var V=X[0],K=X[1];return V+" "+K}).join(` `)+` endbfchar endcmap CMapName currentdict /CMap defineresource pop end -end`},U3=function(){var V=[];for(var q=0;q"},Gq=function(V){return D6(V,4)},NJ=function(V){if(L4(V))return Gq(V);if(j4(V)){var q=D1(V),X=u1(V);return""+Gq(q)+Gq(X)}var K=u6(V),Q="0x"+K+" is not a valid UTF-8 or UTF-16 codepoint.";throw new Error(Q)};var SJ=function(V){var q=0,X=function(K){q|=1<=E.Zero&&Z<=E.Seven){if(K+=W,K.length===3||!(U>="0"&&U<="7"))Y(parseInt(K,8)),K=""}else Y(Z)}return new Uint8Array(X)},q.prototype.decodeText=function(){var X=this.asBytes();if(b2(X))return x2(X);return J1(X)},q.prototype.decodeDate=function(){var X=this.decodeText(),K=P2(X);if(!K)throw new G1(X);return K},q.prototype.asString=function(){return this.value},q.prototype.clone=function(){return q.of(this.value)},q.prototype.toString=function(){return"("+this.value+")"},q.prototype.sizeInBytes=function(){return this.value.length+2},q.prototype.copyBytesInto=function(X,K){return X[K++]=E.LeftParen,K+=I0(this.value,X,K),X[K++]=E.RightParen,this.value.length+2},q.of=function(X){return new q(X)},q.fromDate=function(X){var K=e0(String(X.getUTCFullYear()),4,"0"),Q=e0(String(X.getUTCMonth()+1),2,"0"),Y=e0(String(X.getUTCDate()),2,"0"),J=e0(String(X.getUTCHours()),2,"0"),G=e0(String(X.getUTCMinutes()),2,"0"),W=e0(String(X.getUTCSeconds()),2,"0");return new q("D:"+K+Q+Y+J+G+W+"Z")},q}(z0),K0=yJ;var $J=function(){function V(q,X,K,Q){var Y=this;this.allGlyphsInFontSortedById=function(){var J=new Array(Y.font.characterSet.length);for(var G=0,W=J.length;G>3)]>>7-((M&7)<<0)&1,D=3*C;G[R]=v[D],G[R+1]=v[D+1],G[R+2]=v[D+2],G[R+3]=C<$?w[C]:255}}if(U==2)for(var S=0;S>2)]>>6-((M&3)<<1)&3,D=3*C;G[R]=v[D],G[R+1]=v[D+1],G[R+2]=v[D+2],G[R+3]=C<$?w[C]:255}}if(U==4)for(var S=0;S>1)]>>4-((M&1)<<2)&15,D=3*C;G[R]=v[D],G[R+1]=v[D+1],G[R+2]=v[D+2],G[R+3]=C<$?w[C]:255}}if(U==8)for(var M=0;M>>3)]>>>7-(r&7)&1),k0=u==j*255?0:255;W[J0+r]=k0<<24|u<<16|u<<8|u}else if(U==2)for(var r=0;r>>2)]>>>6-((r&3)<<1)&3),k0=u==j*85?0:255;W[J0+r]=k0<<24|u<<16|u<<8|u}else if(U==4)for(var r=0;r>>1)]>>>4-((r&1)<<2)&15),k0=u==j*17?0:255;W[J0+r]=k0<<24|u<<16|u<<8|u}else if(U==8)for(var r=0;r>>2<<3);while(Q==0){if(Q=B(q,z,1),Y=B(q,z+1,2),z+=3,Y==0){if((z&7)!=0)z+=8-(z&7);var S=(z>>>3)+4,h=q[S-4]|q[S-3]<<8;if($)X=V.H.W(X,H+h);X.set(new K(q.buffer,q.byteOffset+S,h),H),z=S+h<<3,H+=h;continue}if($)X=V.H.W(X,H+131072);if(Y==1)I=w.J,M=w.h,Z=511,U=31;if(Y==2){J=j(q,z,5)+257,G=j(q,z+5,5)+1,W=j(q,z+10,4)+4,z+=14;var b=z,C=1;for(var D=0;D<38;D+=2)w.Q[D]=0,w.Q[D+1]=0;for(var D=0;DC)C=l}z+=3*W,N(w.Q,C),R(w.Q,C,w.u),I=w.w,M=w.d,z=O(w.u,(1<>>4;if(r>>>8==0)X[H++]=r;else if(r==256)break;else{var k0=H+r-254;if(r>264){var n0=w.q[r-257];k0=H+(n0>>>3)+j(q,z,n0&7),z+=n0&7}var N2=M[v(q,z)&U];z+=N2&15;var S2=N2>>>4,y6=w.c[S2],Z6=(y6>>>4)+B(q,z,y6&15);z+=y6&15;while(H>>4;if(H<=15)J[Z]=H,Z++;else{var z=0,I=0;if(H==16)I=3+G(Q,Y,2),Y+=2,z=J[Z-1];else if(H==17)I=3+G(Q,Y,3),Y+=3;else if(H==18)I=11+G(Q,Y,7),Y+=7;var M=Z+I;while(Z>>1;while(JY)Y=W;J++}while(J>1,Z=q[G+1],U=W<<4|Z,H=X-Z,z=q[G]<>>15-X;K[M]=U,z++}}},V.H.l=function(q,X){var K=V.H.m.r,Q=15-X;for(var Y=0;Y>>Q}},V.H.M=function(q,X,K){K=K<<(X&7);var Q=X>>>3;q[Q]|=K,q[Q+1]|=K>>>8},V.H.I=function(q,X,K){K=K<<(X&7);var Q=X>>>3;q[Q]|=K,q[Q+1]|=K>>>8,q[Q+2]|=K>>>16},V.H.e=function(q,X,K){return(q[X>>>3]|q[(X>>>3)+1]<<8)>>>(X&7)&(1<>>3]|q[(X>>>3)+1]<<8|q[(X>>>3)+2]<<16)>>>(X&7)&(1<>>3]|q[(X>>>3)+1]<<8|q[(X>>>3)+2]<<16)>>>(X&7)},V.H.i=function(q,X){return(q[X>>>3]|q[(X>>>3)+1]<<8|q[(X>>>3)+2]<<16|q[(X>>>3)+3]<<24)>>>(X&7)},V.H.m=function(){var q=Uint16Array,X=Uint32Array;return{K:new q(16),j:new q(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[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,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new q(32),p:[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,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new X(32),J:new q(512),_:[],h:new q(32),$:[],w:new q(32768),C:[],v:[],d:new q(32768),D:[],u:new q(512),Q:[],r:new q(32768),s:new X(286),Y:new X(30),a:new X(19),t:new X(15000),k:new q(65536),g:new q(32768)}}(),function(){var q=V.H.m,X=32768;for(var K=0;K>>1|(Q&1431655765)<<1,Q=(Q&3435973836)>>>2|(Q&858993459)<<2,Q=(Q&4042322160)>>>4|(Q&252645135)<<4,Q=(Q&4278255360)>>>8|(Q&16711935)<<8,q.r[K]=(Q>>>16|Q<<16)>>>17}function Y(J,G,W){while(G--!=0)J.push(0,W)}for(var K=0;K<32;K++)q.q[K]=q.S[K]<<3|q.T[K],q.c[K]=q.p[K]<<4|q.z[K];Y(q._,144,8),Y(q._,112,9),Y(q._,24,7),Y(q._,8,8),V.H.n(q._,9),V.H.A(q._,9,q.J),V.H.l(q._,9),Y(q.$,32,5),V.H.n(q.$,5),V.H.A(q.$,5,q.h),V.H.l(q.$,5),Y(q.Q,19,0),Y(q.C,286,0),Y(q.D,30,0),Y(q.v,320,0)}(),V.H.N}();P.decode._readInterlace=function(V,q){var{width:X,height:K}=q,Q=P.decode._getBPP(q),Y=Q>>3,J=Math.ceil(X*Q/8),G=new Uint8Array(K*J),W=0,Z=[0,0,4,0,2,0,1],U=[0,4,0,2,0,1,0],H=[8,8,8,4,4,2,2],z=[8,8,4,4,2,2,1],I=0;while(I<7){var M=H[I],L=z[I],B=0,j=0,O=Z[I];while(O>3];h=h>>7-(S&7)&1,G[w*J+($>>3)]|=h<<7-(($&7)<<0)}if(Q==2){var h=V[S>>3];h=h>>6-(S&7)&3,G[w*J+($>>2)]|=h<<6-(($&3)<<1)}if(Q==4){var h=V[S>>3];h=h>>4-(S&7)&15,G[w*J+($>>1)]|=h<<4-(($&1)<<2)}if(Q>=8){var b=w*J+$*Y;for(var C=0;C>3)+C]}S+=Q,$+=L}v++,w+=M}if(B*j!=0)W+=j*(1+R);I=I+1}return G};P.decode._getBPP=function(V){var q=[1,null,3,1,2,null,4][V.ctype];return q*V.depth};P.decode._filterZero=function(V,q,X,K,Q){var Y=P.decode._getBPP(q),J=Math.ceil(K*Y/8),G=P.decode._paeth;Y=Math.ceil(Y/8);var W=0,Z=1,U=V[X],H=0;if(U>1)V[X]=[0,0,1][U-2];if(U==3)for(H=Y;H>>1)&255;for(var z=0;z>>1);for(;H>>1)}else{for(;H>8&255,V[q+1]=X&255},readUint:function(V,q){return V[q]*16777216+(V[q+1]<<16|V[q+2]<<8|V[q+3])},writeUint:function(V,q,X){V[q]=X>>24&255,V[q+1]=X>>16&255,V[q+2]=X>>8&255,V[q+3]=X&255},readASCII:function(V,q,X){var K="";for(var Q=0;Q=0&&G>=0)H=I*q+M<<2,z=(G+I)*Q+J+M<<2;else H=(-G+I)*q-J+M<<2,z=I*Q+M<<2;if(W==0)K[z]=V[H],K[z+1]=V[H+1],K[z+2]=V[H+2],K[z+3]=V[H+3];else if(W==1){var L=V[H+3]*0.00392156862745098,B=V[H]*L,j=V[H+1]*L,O=V[H+2]*L,N=K[z+3]*0.00392156862745098,R=K[z]*N,v=K[z+1]*N,w=K[z+2]*N,$=1-L,S=L+N*$,h=S==0?0:1/S;K[z+3]=255*S,K[z+0]=(B+R*$)*h,K[z+1]=(j+v*$)*h,K[z+2]=(O+w*$)*h}else if(W==2){var L=V[H+3],B=V[H],j=V[H+1],O=V[H+2],N=K[z+3],R=K[z],v=K[z+1],w=K[z+2];if(L==N&&B==R&&j==v&&O==w)K[z]=0,K[z+1]=0,K[z+2]=0,K[z+3]=0;else K[z]=B,K[z+1]=j,K[z+2]=O,K[z+3]=L}else if(W==3){var L=V[H+3],B=V[H],j=V[H+1],O=V[H+2],N=K[z+3],R=K[z],v=K[z+1],w=K[z+2];if(L==N&&B==R&&j==v&&O==w)continue;if(L<220&&N>20)return!1}}return!0};P.encode=function(V,q,X,K,Q,Y,J){if(K==null)K=0;if(J==null)J=!1;var G=P.encode.compress(V,q,X,K,[!1,!1,!1,0,J]);return P.encode.compressPNG(G,-1),P.encode._main(G,q,X,Q,Y)};P.encodeLL=function(V,q,X,K,Q,Y,J,G){var W={ctype:0+(K==1?0:2)+(Q==0?0:4),depth:Y,frames:[]},Z=Date.now(),U=(K+Q)*Y,H=U*q;for(var z=0;z1,H=!1,z=33+(U?20:0);if(Q.sRGB!=null)z+=13;if(Q.pHYs!=null)z+=21;if(V.ctype==3){var I=V.plte.length;for(var M=0;M>>24!=255)H=!0;z+=8+I*3+4+(H?8+I*1+4:0)}for(var L=0;L>>8&255,$=R>>>16&255;j[Z+N+0]=v,j[Z+N+1]=w,j[Z+N+2]=$}if(Z+=I*3,J(j,Z,Y(j,Z-I*3-4,I*3+4)),Z+=4,H){J(j,Z,I),Z+=4,W(j,Z,"tRNS"),Z+=4;for(var M=0;M>>24&255;Z+=I,J(j,Z,Y(j,Z-I-4,I+4)),Z+=4}}var S=0;for(var L=0;L>2,D>>2));for(var I=0;Iq0&&r==u[B-q0])J0[B]=J0[B-q0];else{var k0=N[r];if(k0==null){if(N[r]=k0=R.length,R.push(r),R.length>=300)break}J0[B]=k0}}}var n0=R.length;if(n0<=256&&Z==!1){if(n0<=2)H=1;else if(n0<=4)H=2;else if(n0<=16)H=4;else H=8;H=Math.max(H,W)}for(var I=0;I>1)]|=N1[y1+R0]<<4-(R0&1)*4;else if(H==2)for(var R0=0;R0>2)]|=N1[y1+R0]<<6-(R0&3)*2;else if(H==1)for(var R0=0;R0>3)]|=N1[y1+R0]<<7-(R0&7)*1}Z6=$6,U=3,bq=1}else if(j==!1&&O.length==1){var $6=new Uint8Array(q0*y6*3),p3=q0*y6;for(var B=0;B$)$=b;if(hS)S=h}}if($==-1)v=w=$=S=0;if(Q){if((v&1)==1)v--;if((w&1)==1)w--}var D=($-v+1)*(S-w+1);if(DB)B=R;if(vj)j=v}}if(B==-1)M=L=B=j=0;if(J){if((M&1)==1)M--;if((L&1)==1)L--}Y={x:M,y:L,width:B-M+1,height:j-L+1};var S=K[Q];if(S.rect=Y,S.blend=1,S.img=new Uint8Array(Y.width*Y.height*4),K[Q-1].dispose==0)P._copyTile(Z,q,X,S.img,Y.width,Y.height,-Y.x,-Y.y,0),P.encode._prepareDiff(z,q,X,S.img,Y);else P._copyTile(z,q,X,S.img,Y.width,Y.height,-Y.x,-Y.y,0)};P.encode._prepareDiff=function(V,q,X,K,Q){P._copyTile(V,q,X,K,Q.width,Q.height,-Q.x,-Q.y,2)};P.encode._filterZero=function(V,q,X,K,Q,Y,J){var G=[],W=[0,1,2,3,4];if(Y!=-1)W=[Y];else if(q*K>500000||X==1)W=[0];var Z;if(J)Z={level:0};var U=J&&UZIP!=null?UZIP:I3.default;for(var H=0;H>1)+256&255;if(Y==4)for(var Z=Q;Z>1)&255;for(var Z=Q;Z>1)&255}if(Y==4){for(var Z=0;Z>>1;else X=X>>>1;V[q]=X}return V}(),update:function(V,q,X,K){for(var Q=0;Q>>8;return V},crc:function(V,q,X){return P.crc.update(4294967295,V,q,X)^4294967295}};P.quantize=function(V,q){var X=new Uint8Array(V),K=X.slice(0),Q=new Uint32Array(K.buffer),Y=P.quantize.getKDtree(K,q),J=Y[0],G=Y[1],W=P.quantize.planeDst,Z=X,U=Q,H=Z.length,z=new Uint8Array(X.length>>2);for(var I=0;I>2]=O.ind,U[I>>2]=O.est.rgba}return{abuf:K.buffer,inds:z,plte:G}};P.quantize.getKDtree=function(V,q,X){if(X==null)X=0.0001;var K=new Uint32Array(V.buffer),Q={i0:0,i1:V.length,bst:null,est:null,tdst:0,left:null,right:null};Q.bst=P.quantize.stats(V,Q.i0,Q.i1),Q.est=P.quantize.estats(Q.bst);var Y=[Q];while(Y.lengthJ)J=Y[W].est.L,G=W;if(J=U||Z.i1<=U;if(H){Z.est.L=0;continue}var z={i0:Z.i0,i1:U,bst:null,est:null,tdst:0,left:null,right:null};z.bst=P.quantize.stats(V,z.i0,z.i1),z.est=P.quantize.estats(z.bst);var I={i0:U,i1:Z.i1,bst:null,est:null,tdst:0,left:null,right:null};I.bst={R:[],m:[],N:Z.bst.N-z.bst.N};for(var W=0;W<16;W++)I.bst.R[W]=Z.bst.R[W]-z.bst.R[W];for(var W=0;W<4;W++)I.bst.m[W]=Z.bst.m[W]-z.bst.m[W];I.est=P.quantize.estats(I.bst),Z.left=z,Z.right=I,Y[G]=z,Y.push(I)}Y.sort(function(M,L){return L.bst.N-M.bst.N});for(var W=0;W0)J=V.right,G=V.left;var W=P.quantize.getNearest(J,q,X,K,Q);if(W.tdst<=Y*Y)return W;var Z=P.quantize.getNearest(G,q,X,K,Q);return Z.tdstY)K-=4;if(X>=K)break;var W=q[X>>2];q[X>>2]=q[K>>2],q[K>>2]=W,X+=4,K-=4}while(J(V,X,Q)>Y)X-=4;return X+4};P.quantize.vecDot=function(V,q,X){return V[q]*X[0]+V[q+1]*X[1]+V[q+2]*X[2]+V[q+3]*X[3]};P.quantize.stats=function(V,q,X){var K=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Q=[0,0,0,0],Y=X-q>>2;for(var J=q;J>>0}};P.M4={multVec:function(V,q){return[V[0]*q[0]+V[1]*q[1]+V[2]*q[2]+V[3]*q[3],V[4]*q[0]+V[5]*q[1]+V[6]*q[2]+V[7]*q[3],V[8]*q[0]+V[9]*q[1]+V[10]*q[2]+V[11]*q[3],V[12]*q[0]+V[13]*q[1]+V[14]*q[2]+V[15]*q[3]]},dot:function(V,q){return V[0]*q[0]+V[1]*q[1]+V[2]*q[2]+V[3]*q[3]},sml:function(V,q){return[V*q[0],V*q[1],V*q[2],V*q[3]]}};P.encode.concatRGBA=function(V){var q=0;for(var X=0;X1)throw new Error("Animated PNGs are not supported");var Q=new Uint8Array(K[0]),Y=uJ(Q),J=Y.rgbChannel,G=Y.alphaChannel;this.rgbChannel=J;var W=G.some(function(Z){return Z<255});if(W)this.alphaChannel=G;this.type=DJ(X.ctype),this.width=X.width,this.height=X.height,this.bitsPerComponent=8}return V.load=function(q){return new V(q)},V}();var gJ=function(){function V(q){this.image=q,this.bitsPerComponent=q.bitsPerComponent,this.width=q.width,this.height=q.height,this.colorSpace="DeviceRGB"}return V.for=function(q){return _(this,void 0,void 0,function(){var X;return c(this,function(K){return X=k3.load(q),[2,new V(X)]})})},V.prototype.embedIntoContext=function(q,X){return _(this,void 0,void 0,function(){var K,Q;return c(this,function(Y){if(K=this.embedAlphaChannel(q),Q=q.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:K}),X)return q.assign(X,Q),[2,X];else return[2,q.register(Q)];return[2]})})},V.prototype.embedAlphaChannel=function(q){if(!this.image.alphaChannel)return;var X=q.flateStream(this.image.alphaChannel,{Type:"XObject",Subtype:"Image",Height:this.image.height,Width:this.image.width,BitsPerComponent:this.image.bitsPerComponent,ColorSpace:"DeviceGray",Decode:[0,1]});return q.register(X)},V}(),X2=gJ;var xJ=function(){function V(q,X,K){this.bytes=q,this.start=X||0,this.pos=this.start,this.end=!!X&&!!K?X+K:this.bytes.length}return Object.defineProperty(V.prototype,"length",{get:function(){return this.end-this.start},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isEmpty",{get:function(){return this.length===0},enumerable:!1,configurable:!0}),V.prototype.getByte=function(){if(this.pos>=this.end)return-1;return this.bytes[this.pos++]},V.prototype.getUint16=function(){var q=this.getByte(),X=this.getByte();if(q===-1||X===-1)return-1;return(q<<8)+X},V.prototype.getInt32=function(){var q=this.getByte(),X=this.getByte(),K=this.getByte(),Q=this.getByte();return(q<<24)+(X<<16)+(K<<8)+Q},V.prototype.getBytes=function(q,X){if(X===void 0)X=!1;var K=this.bytes,Q=this.pos,Y=this.end;if(!q){var J=K.subarray(Q,Y);return X?new Uint8ClampedArray(J):J}else{var G=Q+q;if(G>Y)G=Y;this.pos=G;var J=K.subarray(Q,G);return X?new Uint8ClampedArray(J):J}},V.prototype.peekByte=function(){var q=this.getByte();return this.pos--,q},V.prototype.peekBytes=function(q,X){if(X===void 0)X=!1;var K=this.getBytes(q,X);return this.pos-=K.length,K},V.prototype.skip=function(q){if(!q)q=1;this.pos+=q},V.prototype.reset=function(){this.pos=this.start},V.prototype.moveStart=function(){this.start=this.pos},V.prototype.makeSubStream=function(q,X){return new V(this.bytes,q,X)},V.prototype.decode=function(){return this.bytes},V}(),Uq=xJ;var bJ=new Uint8Array(0),mJ=function(){function V(q){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=bJ,this.minBufferLength=512,q)while(this.minBufferLengthY)K=Y}else{while(!this.eof)this.readBlock();K=this.bufferLength}this.pos=K;var J=this.buffer.subarray(Q,K);return X&&!(J instanceof Uint8ClampedArray)?new Uint8ClampedArray(J):J},V.prototype.peekByte=function(){var q=this.getByte();return this.pos--,q},V.prototype.peekBytes=function(q,X){if(X===void 0)X=!1;var K=this.getBytes(q,X);return this.pos-=K.length,K},V.prototype.skip=function(q){if(!q)q=1;this.pos+=q},V.prototype.reset=function(){this.pos=0},V.prototype.makeSubStream=function(q,X){var K=q+X;while(this.bufferLength<=K&&!this.eof)this.readBlock();return new Uq(this.buffer,q,X)},V.prototype.decode=function(){while(!this.eof)this.readBlock();return this.buffer.subarray(0,this.bufferLength)},V.prototype.readBlock=function(){throw new u0(this.constructor.name,"readBlock")},V.prototype.ensureBuffer=function(q){var X=this.buffer;if(q<=X.byteLength)return X;var K=this.minBufferLength;while(K=0;--Z)W[G+Z]=H&255,H>>=8}},q}(d6),L3=fJ;var lJ=function(V){A(q,V);function q(X,K){var Q=V.call(this,K)||this;if(Q.stream=X,Q.firstDigit=-1,K)K=0.5*K;return Q}return q.prototype.readBlock=function(){var X=8000,K=this.stream.getBytes(X);if(!K.length){this.eof=!0;return}var Q=K.length+1>>1,Y=this.ensureBuffer(this.bufferLength+Q),J=this.bufferLength,G=this.firstDigit;for(var W=0,Z=K.length;W=48&&U<=57)H=U&15;else if(U>=65&&U<=70||U>=97&&U<=102)H=(U&15)+9;else if(U===62){this.eof=!0;break}else continue;if(G<0)G=H;else Y[J++]=G<<4|H,G=-1}if(G>=0&&this.eof)Y[J++]=G<<4,G=-1;this.firstDigit=G,this.bufferLength=J},q}(d6),j3=lJ;var B3=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_J=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),cJ=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),pJ=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,590000,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],dJ=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],nJ=function(V){A(q,V);function q(X,K){var Q=V.call(this,K)||this;Q.stream=X;var Y=X.getByte(),J=X.getByte();if(Y===-1||J===-1)throw new Error("Invalid header in flate stream: "+Y+", "+J);if((Y&15)!==8)throw new Error("Unknown compression method in flate stream: "+Y+", "+J);if(((Y<<8)+J)%31!==0)throw new Error("Bad FCHECK in flate stream: "+Y+", "+J);if(J&32)throw new Error("FDICT bit set in flate stream: "+Y+", "+J);return Q.codeSize=0,Q.codeBuf=0,Q}return q.prototype.readBlock=function(){var X,K,Q=this.stream,Y=this.getBits(3);if(Y&1)this.eof=!0;if(Y>>=1,Y===0){var J=void 0;if((J=Q.getByte())===-1)throw new Error("Bad block header in flate stream");var G=J;if((J=Q.getByte())===-1)throw new Error("Bad block header in flate stream");if(G|=J<<8,(J=Q.getByte())===-1)throw new Error("Bad block header in flate stream");var W=J;if((J=Q.getByte())===-1)throw new Error("Bad block header in flate stream");if(W|=J<<8,W!==(~G&65535)&&(G!==0||W!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;var Z=this.bufferLength;X=this.ensureBuffer(Z+G);var U=Z+G;if(this.bufferLength=U,G===0){if(Q.peekByte()===-1)this.eof=!0}else for(var H=Z;H0)v[O++]=S}z=this.generateHuffmanTable(v.subarray(0,M)),I=this.generateHuffmanTable(v.subarray(M,R))}else throw new Error("Unknown block type in flate stream");X=this.buffer;var C=X?X.length:0,D=this.bufferLength;while(!0){var l=this.getCode(z);if(l<256){if(D+1>=C)X=this.ensureBuffer(D+1),C=X.length;X[D++]=l;continue}if(l===256){this.bufferLength=D;return}l-=257,l=_J[l];var u=l>>16;if(u>0)u=this.getBits(u);if(K=(l&65535)+u,l=this.getCode(I),l=cJ[l],u=l>>16,u>0)u=this.getBits(u);var q0=(l&65535)+u;if(D+K>=C)X=this.ensureBuffer(D+K),C=X.length;for(var J0=0;J0>X,this.codeSize=Q-=X,J},q.prototype.getCode=function(X){var K=this.stream,Q=X[0],Y=X[1],J=this.codeSize,G=this.codeBuf,W;while(J>16,H=Z&65535;if(U<1||J>U,this.codeSize=J-U,H},q.prototype.generateHuffmanTable=function(X){var K=X.length,Q=0,Y;for(Y=0;YQ)Q=X[Y];var J=1<>=1;for(Y=z;Y0;if(!v||v<256)B[0]=v,j=1;else if(v>=258)if(v=0;J--)B[J]=H[G],G=I[G]}else B[j++]=B[0];else if(v===256){M=9,U=258,j=0;continue}else{this.eof=!0,delete this.lzwState;break}if(w)I[U]=L,z[U]=z[L]+1,H[U]=B[0],U++,M=U+Z&U+Z-1?M:Math.min(Math.log(U+Z)/0.6931471805599453+1,12)|0;if(L=v,O+=j,K>>K&(1<0){var J=this.stream.getBytes(Y);K.set(J,Q),Q+=Y}}else{Y=257-Y;var G=X[1];K=this.ensureBuffer(Q+Y+1);for(var W=0;WK.size())throw new Y8(X,0,K.size());K.remove(X)}},q.prototype.normalizedEntries=function(){var X=this.Kids();if(!X)X=this.dict.context.obj([this.ref]),this.dict.set(k.of("Kids"),X);return{Kids:X}},q.fromDict=function(X,K){return new q(X,K)},q}(Y2),K6=YG;var JG=function(V){A(q,V);function q(){return V!==null&&V.apply(this,arguments)||this}return q.prototype.Opt=function(){return this.dict.lookupMaybe(k.of("Opt"),K0,g,i)},q.prototype.setOpt=function(X){this.dict.set(k.of("Opt"),this.dict.context.obj(X))},q.prototype.getExportValues=function(){var X=this.Opt();if(!X)return;if(X instanceof K0||X instanceof g)return[X];var K=[];for(var Q=0,Y=X.size();QK.size())throw new Y8(X,0,K.size());K.remove(X)}},q.prototype.normalizeExportValues=function(){var X,K,Q,Y,J=(X=this.getExportValues())!==null&&X!==void 0?X:[],G=[],W=this.getWidgets();for(var Z=0,U=W.length;Z1){if(!this.hasFlag(G0.MultiSelect))throw new W7;this.dict.set(k.of("V"),this.dict.context.obj(X))}this.updateSelectedIndices(X)},q.prototype.valuesAreValid=function(X){var K=this.getOptions(),Q=function(W,Z){var U=X[W].decodeText();if(!K.find(function(H){return U===(H.display||H.value).decodeText()}))return{value:!1}};for(var Y=0,J=X.length;Y1){var K=new Array(X.length),Q=this.getOptions(),Y=function(W,Z){var U=X[W].decodeText();K[W]=Q.findIndex(function(H){return U===(H.display||H.value).decodeText()})};for(var J=0,G=X.length;J0){var G=J.lookup(0,K0,g),W=J.lookupMaybe(1,K0,g);K.push({value:G,display:W||G})}}}return K}return[]},q}(K6),G2=ZG;var WG=function(V){A(q,V);function q(){return V!==null&&V.apply(this,arguments)||this}return q.fromDict=function(X,K){return new q(X,K)},q.create=function(X){var K=X.obj({FT:"Ch",Ff:G0.Combo,Kids:[]}),Q=X.register(K);return new q(K,Q)},q}(G2),Q5=WG;var UG=function(V){A(q,V);function q(){return V!==null&&V.apply(this,arguments)||this}return q.prototype.addField=function(X){var K=this.normalizedEntries().Kids;K===null||K===void 0||K.push(X)},q.prototype.normalizedEntries=function(){var X=this.Kids();if(!X)X=this.dict.context.obj([]),this.dict.set(k.of("Kids"),X);return{Kids:X}},q.fromDict=function(X,K){return new q(X,K)},q.create=function(X){var K=X.obj({}),Q=X.register(K);return new q(K,Q)},q}(Y2),Y5=UG;var HG=function(V){A(q,V);function q(){return V!==null&&V.apply(this,arguments)||this}return q.fromDict=function(X,K){return new q(X,K)},q}(K6),F5=HG;var zG=function(V){A(q,V);function q(){return V!==null&&V.apply(this,arguments)||this}return q.prototype.MaxLen=function(){var X=this.dict.lookup(k.of("MaxLen"));if(X instanceof x)return X;return},q.prototype.Q=function(){var X=this.dict.lookup(k.of("Q"));if(X instanceof x)return X;return},q.prototype.setMaxLength=function(X){this.dict.set(k.of("MaxLen"),x.of(X))},q.prototype.removeMaxLength=function(){this.dict.delete(k.of("MaxLen"))},q.prototype.getMaxLength=function(){var X;return(X=this.MaxLen())===null||X===void 0?void 0:X.asNumber()},q.prototype.setQuadding=function(X){this.dict.set(k.of("Q"),x.of(X))},q.prototype.getQuadding=function(){var X;return(X=this.Q())===null||X===void 0?void 0:X.asNumber()},q.prototype.setValue=function(X){this.dict.set(k.of("V"),X)},q.prototype.removeValue=function(){this.dict.delete(k.of("V"))},q.prototype.getValue=function(){var X=this.V();if(X instanceof K0||X instanceof g)return X;return},q.fromDict=function(X,K){return new q(X,K)},q.create=function(X){var K=X.obj({FT:"Tx",Kids:[]}),Q=X.register(K);return new q(K,Q)},q}(K6),J5=zG;var MG=function(V){A(q,V);function q(){return V!==null&&V.apply(this,arguments)||this}return q.fromDict=function(X,K){return new q(X,K)},q.create=function(X){var K=X.obj({FT:"Btn",Ff:f0.PushButton,Kids:[]}),Q=X.register(K);return new q(K,Q)},q}(h5),G5=MG;var IG=function(V){A(q,V);function q(){return V!==null&&V.apply(this,arguments)||this}return q.prototype.setValue=function(X){var K=this.getOnValues();if(!K.includes(X)&&X!==k.of("Off"))throw new J8;this.dict.set(k.of("V"),X);var Q=this.getWidgets();for(var Y=0,J=Q.length;YY)throw new qq(K,Y);var J=K;for(var G=0,W=Q.size();GJ)return U.insertLeafNode(X,J)||Z;else J-=U.Count().asNumber();if(U instanceof _0)J-=1}if(J===0){this.insertLeafKid(Q.size(),X);return}throw new Xq(K,"insertLeafNode")},q.prototype.removeLeafNode=function(X,K){if(K===void 0)K=!0;var Q=this.Kids(),Y=this.Count().asNumber();if(X>=Y)throw new qq(X,Y);var J=X;for(var G=0,W=Q.size();GJ){if(U.removeLeafNode(J,K),K&&U.Kids().size()===0)Q.remove(G);return}else J-=U.Count().asNumber();if(U instanceof _0)if(J===0){this.removeKid(G);return}else J-=1}throw new Xq(X,"removeLeafNode")},q.prototype.ascend=function(X){X(this);var K=this.Parent();if(K)K.ascend(X)},q.prototype.traverse=function(X){var K=this.Kids();for(var Q=0,Y=K.size();QNumber.MAX_SAFE_INTEGER)if(this.capNumbers){var Q="Parsed number that is too large for some PDF readers: "+q+", using Number.MAX_SAFE_INTEGER instead.";return console.warn(Q),Number.MAX_SAFE_INTEGER}else{var Q="Parsed number that is too large for some PDF readers: "+q+", not capping.";console.warn(Q)}return K},V.prototype.skipWhitespace=function(){while(!this.bytes.done()&&I6[this.bytes.peek()])this.bytes.next()},V.prototype.skipLine=function(){while(!this.bytes.done()){var q=this.bytes.peek();if(q===A3||q===N3)return;this.bytes.next()}},V.prototype.skipComment=function(){if(this.bytes.peek()!==E.Percent)return!1;while(!this.bytes.done()){var q=this.bytes.peek();if(q===A3||q===N3)return!0;this.bytes.next()}return!0},V.prototype.skipWhitespaceAndComments=function(){this.skipWhitespace();while(this.skipComment())this.skipWhitespace()},V.prototype.matchKeyword=function(q){var X=this.bytes.offset();for(var K=0,Q=q.length;K=this.length},V.prototype.offset=function(){return this.idx},V.prototype.slice=function(q,X){return this.bytes.slice(q,X)},V.prototype.position=function(){return{line:this.line,column:this.column,offset:this.idx}},V.of=function(q){return new V(q)},V.fromPDFRawStream=function(q){return V.of(V2(q).decode())},V}(),D5=wG;var AG=E.Space,H1=E.CarriageReturn,z1=E.Newline,M1=[E.s,E.t,E.r,E.e,E.a,E.m],Eq=[E.e,E.n,E.d,E.s,E.t,E.r,E.e,E.a,E.m],M0={header:[E.Percent,E.P,E.D,E.F,E.Dash],eof:[E.Percent,E.Percent,E.E,E.O,E.F],obj:[E.o,E.b,E.j],endobj:[E.e,E.n,E.d,E.o,E.b,E.j],xref:[E.x,E.r,E.e,E.f],trailer:[E.t,E.r,E.a,E.i,E.l,E.e,E.r],startxref:[E.s,E.t,E.a,E.r,E.t,E.x,E.r,E.e,E.f],true:[E.t,E.r,E.u,E.e],false:[E.f,E.a,E.l,E.s,E.e],null:[E.n,E.u,E.l,E.l],stream:M1,streamEOF1:Q0(M1,[AG,H1,z1]),streamEOF2:Q0(M1,[H1,z1]),streamEOF3:Q0(M1,[H1]),streamEOF4:Q0(M1,[z1]),endstream:Eq,EOF1endstream:Q0([H1,z1],Eq),EOF2endstream:Q0([H1],Eq),EOF3endstream:Q0([z1],Eq)};var NG=function(V){A(q,V);function q(X,K,Q){if(Q===void 0)Q=!1;var Y=V.call(this,X,Q)||this;return Y.context=K,Y}return q.prototype.parseObject=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(M0.true))return c6.True;if(this.matchKeyword(M0.false))return c6.False;if(this.matchKeyword(M0.null))return F0;var X=this.bytes.peek();if(X===E.LessThan&&this.bytes.peekAhead(1)===E.LessThan)return this.parseDictOrStream();if(X===E.LessThan)return this.parseHexString();if(X===E.LeftParen)return this.parseString();if(X===E.ForwardSlash)return this.parseName();if(X===E.LeftSquareBracket)return this.parseArray();if(U1[X])return this.parseNumberOrRef();throw new M7(this.bytes.position(),X)},q.prototype.parseNumberOrRef=function(){var X=this.parseRawNumber();this.skipWhitespaceAndComments();var K=this.bytes.offset();if(P0[this.bytes.peek()]){var Q=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===E.R)return this.bytes.assertNext(E.R),a.of(X,Q)}return this.bytes.moveTo(K),x.of(X)},q.prototype.parseHexString=function(){var X="";this.bytes.assertNext(E.LessThan);while(!this.bytes.done()&&this.bytes.peek()!==E.GreaterThan)X+=t0(this.bytes.next());return this.bytes.assertNext(E.GreaterThan),g.of(X)},q.prototype.parseString=function(){var X=0,K=!1,Q="";while(!this.bytes.done()){var Y=this.bytes.next();if(Q+=t0(Y),!K){if(Y===E.LeftParen)X+=1;if(Y===E.RightParen)X-=1}if(Y===E.BackSlash)K=!K;else if(K)K=!1;if(X===0)return K0.of(Q.substring(1,Q.length-1))}throw new E7(this.bytes.position())},q.prototype.parseName=function(){this.bytes.assertNext(E.ForwardSlash);var X="";while(!this.bytes.done()){var K=this.bytes.peek();if(I6[K]||V6[K])break;X+=t0(K),this.bytes.next()}return k.of(X)},q.prototype.parseArray=function(){this.bytes.assertNext(E.LeftSquareBracket),this.skipWhitespaceAndComments();var X=i.withContext(this.context);while(this.bytes.peek()!==E.RightSquareBracket){var K=this.parseObject();X.push(K),this.skipWhitespaceAndComments()}return this.bytes.assertNext(E.RightSquareBracket),X},q.prototype.parseDict=function(){this.bytes.assertNext(E.LessThan),this.bytes.assertNext(E.LessThan),this.skipWhitespaceAndComments();var X=new Map;while(!this.bytes.done()&&this.bytes.peek()!==E.GreaterThan&&this.bytes.peekAhead(1)!==E.GreaterThan){var K=this.parseName(),Q=this.parseObject();X.set(K,Q),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(E.GreaterThan),this.bytes.assertNext(E.GreaterThan);var Y=X.get(k.of("Type"));if(Y===k.of("Catalog"))return W2.fromMapWithContext(X,this.context);else if(Y===k.of("Pages"))return U2.fromMapWithContext(X,this.context);else if(Y===k.of("Page"))return _0.fromMapWithContext(X,this.context);else return m.fromMapWithContext(X,this.context)},q.prototype.parseDictOrStream=function(){var X=this.bytes.position(),K=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(M0.streamEOF1)&&!this.matchKeyword(M0.streamEOF2)&&!this.matchKeyword(M0.streamEOF3)&&!this.matchKeyword(M0.streamEOF4)&&!this.matchKeyword(M0.stream))return K;var Q=this.bytes.offset(),Y,J=K.get(k.of("Length"));if(J instanceof x){if(Y=Q+J.asNumber(),this.bytes.moveTo(Y),this.skipWhitespaceAndComments(),!this.matchKeyword(M0.endstream))this.bytes.moveTo(Q),Y=this.findEndOfStreamFallback(X)}else Y=this.findEndOfStreamFallback(X);var G=this.bytes.slice(Q,Y);return A6.of(K,G)},q.prototype.findEndOfStreamFallback=function(X){var K=1,Q=this.bytes.offset();while(!this.bytes.done()){if(Q=this.bytes.offset(),this.matchKeyword(M0.stream))K+=1;else if(this.matchKeyword(M0.EOF1endstream)||this.matchKeyword(M0.EOF2endstream)||this.matchKeyword(M0.EOF3endstream)||this.matchKeyword(M0.endstream))K-=1;else this.bytes.next();if(K===0)break}if(K!==0)throw new k7(X);return Q},q.forBytes=function(X,K,Q){return new q(D5.of(X),K,Q)},q.forByteStream=function(X,K,Q){if(Q===void 0)Q=!1;return new q(X,K,Q)},q}(S3),H2=NG;var SG=function(V){A(q,V);function q(X,K){var Q=V.call(this,D5.fromPDFRawStream(X),X.dict.context)||this,Y=X.dict;return Q.alreadyParsed=!1,Q.shouldWaitForTick=K||function(){return!1},Q.firstOffset=Y.lookup(k.of("First"),x).asNumber(),Q.objectCount=Y.lookup(k.of("N"),x).asNumber(),Q}return q.prototype.parseIntoContext=function(){return _(this,void 0,void 0,function(){var X,K,Q,Y,J,G,W,Z;return c(this,function(U){switch(U.label){case 0:if(this.alreadyParsed)throw new Q8("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0,X=this.parseOffsetsAndObjectNumbers(),K=0,Q=X.length,U.label=1;case 1:if(!(K=E.Space&&K<=E.Tilde;if(Q){if(this.matchKeyword(M0.xref)||this.matchKeyword(M0.trailer)||this.matchKeyword(M0.startxref)||this.matchIndirectObjectHeader()){this.bytes.moveTo(X);break}}this.bytes.next()}},q.prototype.skipBinaryHeaderComment=function(){this.skipWhitespaceAndComments();try{var X=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(X)}catch(K){this.bytes.next(),this.skipWhitespaceAndComments()}},q.forBytesWithOptions=function(X,K,Q,Y){return new q(X,K,Q,Y)},q}(H2),Bq=$G;var n6=function(V){return 1<0)K[K.length]=+Q;X[X.length]={cmd:q,args:K},K=[],Q="",Y=!1}q=Z}else if([" ",","].includes(Z)||Z==="-"&&Q.length>0&&Q[Q.length-1]!=="e"||Z==="."&&Y){if(Q.length===0)continue;if(K.length===J){if(X[X.length]={cmd:q,args:K},K=[+Q],q==="M")q="L";if(q==="m")q="l"}else K[K.length]=+Q;Y=Z===".",Q=["-","."].includes(Z)?Z:""}else if(Q+=Z,Z===".")Y=!0}if(Q.length>0)if(K.length===J){if(X[X.length]={cmd:q,args:K},K=[+Q],q==="M")q="L";if(q==="m")q="l"}else K[K.length]=+Q;return X[X.length]={cmd:q,args:K},X},pG=function(V){d=n=Z0=W0=v1=R1=0;var q=[];for(var X=0;X1)z=Math.sqrt(z),X*=z,K*=z;var I=H/X,M=U/X,L=-U/K,B=H/K,j=I*G+M*W,O=L*G+B*W,N=I*V+M*q,R=L*V+B*q,v=(N-j)*(N-j)+(R-O)*(R-O),w=1/v-0.25;if(w<0)w=0;var $=Math.sqrt(w);if(Y===Q)$=-$;var S=0.5*(j+N)-$*(R-O),h=0.5*(O+R)+$*(N-j),b=Math.atan2(O-h,j-S),C=Math.atan2(R-h,N-S),D=C-b;if(D<0&&Y===1)D+=2*Math.PI;else if(D>0&&Y===0)D-=2*Math.PI;var l=Math.ceil(Math.abs(D/(Math.PI*0.5+0.001))),u=[];for(var q0=0;q0V.length)return Q-1;var B=q.heightAtSize(Q),j=B+B*0.2,O=j*Y;if(O>Math.abs(X.height))return Q-1;Q+=1}return Q},sG=function(V,q,X,K){var Q=X.width/K,Y=X.height,J=m3,G=J4(V);while(JQ*0.75;if(H)return J-1}var z=q.heightAtSize(J,{descender:!1});if(z>Y)return J-1;J+=1}return J},tG=function(V){for(var q=V.length;q>0;q--)if(/\s/.test(V[q]))return q;return},eG=function(V,q,X,K){var Q,Y=V.length;while(Y>0){var J=V.substring(0,Y),G=X.encodeText(J),W=X.widthOfTextAtSize(J,K);if(Wz)z=$+v;if(M+G>I)I=M+G;Z.push({text:N,encoded:R,width:v,height:G,x:$,y:M}),j=w===null||w===void 0?void 0:w.trim()}}return{fontSize:K,lineHeight:W,lines:Z,bounds:{x:U,y:H,width:z-U,height:I-H}}},KX=function(V,q){var{fontSize:X,font:K,bounds:Q,cellCount:Y}=q,J=F1(I5(V));if(J.length>Y)throw new qX(J.length,Y);if(X===void 0||X===0)X=sG(J,K,Q,Y);var G=Q.width/Y,W=K.heightAtSize(X,{descender:!1}),Z=Q.y+(Q.height/2-W/2),U=[],H=Q.x,z=Q.y,I=Q.x+Q.width,M=Q.y+Q.height,L=0,B=0;while(LI)I=$+v;if(Z+W>M)M=Z+W;U.push({text:J,encoded:R,width:v,height:W,x:$,y:Z}),L+=1,B+=N}return{fontSize:X,cells:U,bounds:{x:H,y:z,width:I-H,height:M-z}}},v2=function(V,q){var{alignment:X,fontSize:K,font:Q,bounds:Y}=q,J=F1(I5(V));if(K===void 0||K===0)K=l3([J],Q,Y);var G=Q.encodeText(J),W=Q.widthOfTextAtSize(J,K),Z=Q.heightAtSize(K,{descender:!1}),U=X===v0.Left?Y.x:X===v0.Center?Y.x+Y.width/2-W/2:X===v0.Right?Y.x+Y.width-W:Y.x,H=Y.y+(Y.height/2-Z/2);return{fontSize:K,line:{text:J,encoded:G,width:W,height:Z,x:U,y:H},bounds:{x:U,y:H,width:W,height:Z}}};var G6=function(V){if("normal"in V)return V;return{normal:V}},qZ=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/,m5=function(V){var q,X,K=(q=V.getDefaultAppearance())!==null&&q!==void 0?q:"",Q=(X=F8(K,qZ).match)!==null&&X!==void 0?X:[],Y=Number(Q[2]);return isFinite(Y)?Y:void 0},XZ=/(\d*\.\d+|\d+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+(g|rg|k)/,j6=function(V){var q,X=(q=V.getDefaultAppearance())!==null&&q!==void 0?q:"",K=F8(X,XZ).match,Q=K!==null&&K!==void 0?K:[],Y=Q[1],J=Q[2],G=Q[3],W=Q[4],Z=Q[5];if(Z==="g"&&Y)return Sq(Number(Y));if(Z==="rg"&&Y&&J&&G)return Y0(Number(Y),Number(J),Number(G));if(Z==="k"&&Y&&J&&G&&W)return yq(Number(Y),Number(J),Number(G),Number(W));return},B6=function(V,q,X,K){var Q;if(K===void 0)K=0;var Y=[E6(q).toString(),T8((Q=X===null||X===void 0?void 0:X.name)!==null&&Q!==void 0?Q:"dummy__noop",K).toString()].join(` -`);V.setDefaultAppearance(Y)},QX=function(V,q){var X,K,Q,Y=j6(q),J=j6(V.acroField),G=q.getRectangle(),W=q.getAppearanceCharacteristics(),Z=q.getBorderStyle(),U=(X=Z===null||Z===void 0?void 0:Z.getWidth())!==null&&X!==void 0?X:0,H=k6(W===null||W===void 0?void 0:W.getRotation()),z=r6(G,H),I=z.width,M=z.height,L=L6(o(o({},G),{rotation:H})),B=Y0(0,0,0),j=(K=l0(W===null||W===void 0?void 0:W.getBorderColor()))!==null&&K!==void 0?K:B,O=l0(W===null||W===void 0?void 0:W.getBackgroundColor()),N=l0(W===null||W===void 0?void 0:W.getBackgroundColor(),0.8),R=(Q=Y!==null&&Y!==void 0?Y:J)!==null&&Q!==void 0?Q:B;if(Y)B6(q,R);else B6(V.acroField,R);var v={x:0+U/2,y:0+U/2,width:I-U,height:M-U,thickness:1.5,borderWidth:U,borderColor:j,markColor:R};return{normal:{on:Q0(L,B2(o(o({},v),{color:O,filled:!0}))),off:Q0(L,B2(o(o({},v),{color:O,filled:!1})))},down:{on:Q0(L,B2(o(o({},v),{color:N,filled:!0}))),off:Q0(L,B2(o(o({},v),{color:N,filled:!1})))}}},YX=function(V,q){var X,K,Q,Y=j6(q),J=j6(V.acroField),G=q.getRectangle(),W=q.getAppearanceCharacteristics(),Z=q.getBorderStyle(),U=(X=Z===null||Z===void 0?void 0:Z.getWidth())!==null&&X!==void 0?X:0,H=k6(W===null||W===void 0?void 0:W.getRotation()),z=r6(G,H),I=z.width,M=z.height,L=L6(o(o({},G),{rotation:H})),B=Y0(0,0,0),j=(K=l0(W===null||W===void 0?void 0:W.getBorderColor()))!==null&&K!==void 0?K:B,O=l0(W===null||W===void 0?void 0:W.getBackgroundColor()),N=l0(W===null||W===void 0?void 0:W.getBackgroundColor(),0.8),R=(Q=Y!==null&&Y!==void 0?Y:J)!==null&&Q!==void 0?Q:B;if(Y)B6(q,R);else B6(V.acroField,R);var v={x:I/2,y:M/2,width:I-U,height:M-U,borderWidth:U,borderColor:j,dotColor:R};return{normal:{on:Q0(L,T2(o(o({},v),{color:O,filled:!0}))),off:Q0(L,T2(o(o({},v),{color:O,filled:!1})))},down:{on:Q0(L,T2(o(o({},v),{color:N,filled:!0}))),off:Q0(L,T2(o(o({},v),{color:N,filled:!1})))}}},JX=function(V,q,X){var K,Q,Y,J,G,W=j6(q),Z=j6(V.acroField),U=m5(q),H=m5(V.acroField),z=q.getRectangle(),I=q.getAppearanceCharacteristics(),M=q.getBorderStyle(),L=I===null||I===void 0?void 0:I.getCaptions(),B=(K=L===null||L===void 0?void 0:L.normal)!==null&&K!==void 0?K:"",j=(Y=(Q=L===null||L===void 0?void 0:L.down)!==null&&Q!==void 0?Q:B)!==null&&Y!==void 0?Y:"",O=(J=M===null||M===void 0?void 0:M.getWidth())!==null&&J!==void 0?J:0,N=k6(I===null||I===void 0?void 0:I.getRotation()),R=r6(z,N),v=R.width,w=R.height,$=L6(o(o({},z),{rotation:N})),S=Y0(0,0,0),h=l0(I===null||I===void 0?void 0:I.getBorderColor()),b=l0(I===null||I===void 0?void 0:I.getBackgroundColor()),C=l0(I===null||I===void 0?void 0:I.getBackgroundColor(),0.8),D={x:O,y:O,width:v-O*2,height:w-O*2},l=v2(B,{alignment:v0.Center,fontSize:U!==null&&U!==void 0?U:H,font:X,bounds:D}),u=v2(j,{alignment:v0.Center,fontSize:U!==null&&U!==void 0?U:H,font:X,bounds:D}),q0=Math.min(l.fontSize,u.fontSize),J0=(G=W!==null&&W!==void 0?W:Z)!==null&&G!==void 0?G:S;if(W||U!==void 0)B6(q,J0,X,q0);else B6(V.acroField,J0,X,q0);var r={x:0+O/2,y:0+O/2,width:v-O,height:w-O,borderWidth:O,borderColor:h,textColor:J0,font:X.name,fontSize:q0};return{normal:Q0($,hq(o(o({},r),{color:b,textLines:[l.line]}))),down:Q0($,hq(o(o({},r),{color:C,textLines:[u.line]})))}},GX=function(V,q,X){var K,Q,Y,J,G=j6(q),W=j6(V.acroField),Z=m5(q),U=m5(V.acroField),H=q.getRectangle(),z=q.getAppearanceCharacteristics(),I=q.getBorderStyle(),M=(K=V.getText())!==null&&K!==void 0?K:"",L=(Q=I===null||I===void 0?void 0:I.getWidth())!==null&&Q!==void 0?Q:0,B=k6(z===null||z===void 0?void 0:z.getRotation()),j=r6(H,B),O=j.width,N=j.height,R=L6(o(o({},H),{rotation:B})),v=Y0(0,0,0),w=l0(z===null||z===void 0?void 0:z.getBorderColor()),$=l0(z===null||z===void 0?void 0:z.getBackgroundColor()),S,h,b=V.isCombed()?0:1,C={x:L+b,y:L+b,width:O-(L+b)*2,height:N-(L+b)*2};if(V.isMultiline()){var D=uq(M,{alignment:V.getAlignment(),fontSize:Z!==null&&Z!==void 0?Z:U,font:X,bounds:C});S=D.lines,h=D.fontSize}else if(V.isCombed()){var D=KX(M,{fontSize:Z!==null&&Z!==void 0?Z:U,font:X,bounds:C,cellCount:(Y=V.getMaxLength())!==null&&Y!==void 0?Y:0});S=D.cells,h=D.fontSize}else{var D=v2(M,{alignment:V.getAlignment(),fontSize:Z!==null&&Z!==void 0?Z:U,font:X,bounds:C});S=[D.line],h=D.fontSize}var l=(J=G!==null&&G!==void 0?G:W)!==null&&J!==void 0?J:v;if(G||Z!==void 0)B6(q,l,X,h);else B6(V.acroField,l,X,h);var u={x:0+L/2,y:0+L/2,width:O-L,height:N-L,borderWidth:L!==null&&L!==void 0?L:0,borderColor:w,textColor:l,font:X.name,fontSize:h,color:$,textLines:S,padding:b};return Q0(R,Pq(u))},ZX=function(V,q,X){var K,Q,Y,J=j6(q),G=j6(V.acroField),W=m5(q),Z=m5(V.acroField),U=q.getRectangle(),H=q.getAppearanceCharacteristics(),z=q.getBorderStyle(),I=(K=V.getSelected()[0])!==null&&K!==void 0?K:"",M=(Q=z===null||z===void 0?void 0:z.getWidth())!==null&&Q!==void 0?Q:0,L=k6(H===null||H===void 0?void 0:H.getRotation()),B=r6(U,L),j=B.width,O=B.height,N=L6(o(o({},U),{rotation:L})),R=Y0(0,0,0),v=l0(H===null||H===void 0?void 0:H.getBorderColor()),w=l0(H===null||H===void 0?void 0:H.getBackgroundColor()),$=1,S={x:M+$,y:M+$,width:j-(M+$)*2,height:O-(M+$)*2},h=v2(I,{alignment:v0.Left,fontSize:W!==null&&W!==void 0?W:Z,font:X,bounds:S}),b=h.line,C=h.fontSize,D=(Y=J!==null&&J!==void 0?J:G)!==null&&Y!==void 0?Y:R;if(J||W!==void 0)B6(q,D,X,C);else B6(V.acroField,D,X,C);var l={x:0+M/2,y:0+M/2,width:j-M,height:O-M,borderWidth:M!==null&&M!==void 0?M:0,borderColor:v,textColor:D,font:X.name,fontSize:C,color:w,textLines:[b],padding:$};return Q0(N,Pq(l))},WX=function(V,q,X){var K,Q,Y=j6(q),J=j6(V.acroField),G=m5(q),W=m5(V.acroField),Z=q.getRectangle(),U=q.getAppearanceCharacteristics(),H=q.getBorderStyle(),z=(K=H===null||H===void 0?void 0:H.getWidth())!==null&&K!==void 0?K:0,I=k6(U===null||U===void 0?void 0:U.getRotation()),M=r6(Z,I),L=M.width,B=M.height,j=L6(o(o({},Z),{rotation:I})),O=Y0(0,0,0),N=l0(U===null||U===void 0?void 0:U.getBorderColor()),R=l0(U===null||U===void 0?void 0:U.getBackgroundColor()),v=V.getOptions(),w=V.getSelected();if(V.isSorted())v.sort();var $="";for(var S=0,h=v.length;S1||Q.length===1&&K)this.enableMultiselect();var G=new Array(Q.length);for(var W=0,Z=Q.length;W1||Q.length===1&&K)this.enableMultiselect();var J=new Array(Q.length);for(var G=0,W=Q.length;GK)throw new XX(X.length,K,this.getName());if(this.markAsDirty(),this.disableRichFormatting(),X)this.acroField.setValue(g.fromText(X));else this.acroField.removeValue()},q.prototype.getAlignment=function(){var X=this.acroField.getQuadding();return X===0?v0.Left:X===1?v0.Center:X===2?v0.Right:v0.Left},q.prototype.setAlignment=function(X){M6(X,"alignment",v0),this.markAsDirty(),this.acroField.setQuadding(X)},q.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},q.prototype.setMaxLength=function(X){if(X6(X,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),X===void 0)this.acroField.removeMaxLength();else{var K=this.getText();if(K&&K.length>X)throw new VX(K.length,X,this.getName());this.acroField.setMaxLength(X)}},q.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},q.prototype.setImage=function(X){var K=this.getAlignment(),Q=K===v0.Center?T6.Center:K===v0.Right?T6.Right:T6.Left,Y=this.acroField.getWidgets();for(var J=0,G=Y.length;J"},Zq=function(q){return D2(q,4)},FG=function(q){if(L4(q))return Zq(q);if(B4(q)){var X=u1(q),V=g1(q);return""+Zq(X)+Zq(V)}var K=u2(q),Q="0x"+K+" is not a valid UTF-8 or UTF-16 codepoint.";throw Error(Q)};var PG=function(q){var X=0,V=function(K){X|=1<=E.Zero&&Z<=E.Seven){if(K+=W,K.length===3||!(H>="0"&&H<="7"))Y(parseInt(K,8)),K=""}else Y(Z)}return new Uint8Array(V)},X.prototype.decodeText=function(){var V=this.asBytes();if(b8(V))return x8(V);return J1(V)},X.prototype.decodeDate=function(){var V=this.decodeText(),K=P8(V);if(!K)throw new G1(V);return K},X.prototype.asString=function(){return this.value},X.prototype.clone=function(){return X.of(this.value)},X.prototype.toString=function(){return"("+this.value+")"},X.prototype.sizeInBytes=function(){return this.value.length+2},X.prototype.copyBytesInto=function(V,K){return V[K++]=E.LeftParen,K+=k0(this.value,V,K),V[K++]=E.RightParen,this.value.length+2},X.of=function(V){return new X(V)},X.fromDate=function(V){var K=e0(String(V.getUTCFullYear()),4,"0"),Q=e0(String(V.getUTCMonth()+1),2,"0"),Y=e0(String(V.getUTCDate()),2,"0"),J=e0(String(V.getUTCHours()),2,"0"),G=e0(String(V.getUTCMinutes()),2,"0"),W=e0(String(V.getUTCSeconds()),2,"0");return new X("D:"+K+Q+Y+J+G+W+"Z")},X}(z0),K0=DG;var uG=function(){function q(X,V,K,Q){var Y=this;this.allGlyphsInFontSortedById=function(){var J=Array(Y.font.characterSet.length);for(var G=0,W=J.length;G>3)]>>7-((M&7)<<0)&1,D=3*C;G[v]=R[D],G[v+1]=R[D+1],G[v+2]=R[D+2],G[v+3]=C<$?A[C]:255}}if(H==2)for(var S=0;S>2)]>>6-((M&3)<<1)&3,D=3*C;G[v]=R[D],G[v+1]=R[D+1],G[v+2]=R[D+2],G[v+3]=C<$?A[C]:255}}if(H==4)for(var S=0;S>1)]>>4-((M&1)<<2)&15,D=3*C;G[v]=R[D],G[v+1]=R[D+1],G[v+2]=R[D+2],G[v+3]=C<$?A[C]:255}}if(H==8)for(var M=0;M>>3)]>>>7-(r&7)&1),I0=u==L*255?0:255;W[J0+r]=I0<<24|u<<16|u<<8|u}else if(H==2)for(var r=0;r>>2)]>>>6-((r&3)<<1)&3),I0=u==L*85?0:255;W[J0+r]=I0<<24|u<<16|u<<8|u}else if(H==4)for(var r=0;r>>1)]>>>4-((r&1)<<2)&15),I0=u==L*17?0:255;W[J0+r]=I0<<24|u<<16|u<<8|u}else if(H==8)for(var r=0;r>>2<<3);while(Q==0){if(Q=B(X,z,1),Y=B(X,z+1,2),z+=3,Y==0){if((z&7)!=0)z+=8-(z&7);var S=(z>>>3)+4,h=X[S-4]|X[S-3]<<8;if($)V=q.H.W(V,U+h);V.set(new K(X.buffer,X.byteOffset+S,h),U),z=S+h<<3,U+=h;continue}if($)V=q.H.W(V,U+131072);if(Y==1)k=A.J,M=A.h,Z=511,H=31;if(Y==2){J=L(X,z,5)+257,G=L(X,z+5,5)+1,W=L(X,z+10,4)+4,z+=14;var b=z,C=1;for(var D=0;D<38;D+=2)A.Q[D]=0,A.Q[D+1]=0;for(var D=0;DC)C=l}z+=3*W,N(A.Q,C),v(A.Q,C,A.u),k=A.w,M=A.d,z=O(A.u,(1<>>4;if(r>>>8==0)V[U++]=r;else if(r==256)break;else{var I0=U+r-254;if(r>264){var n0=A.q[r-257];I0=U+(n0>>>3)+L(X,z,n0&7),z+=n0&7}var N8=M[R(X,z)&H];z+=N8&15;var S8=N8>>>4,y2=A.c[S8],Z2=(y2>>>4)+B(X,z,y2&15);z+=y2&15;while(U>>4;if(U<=15)J[Z]=U,Z++;else{var z=0,k=0;if(U==16)k=3+G(Q,Y,2),Y+=2,z=J[Z-1];else if(U==17)k=3+G(Q,Y,3),Y+=3;else if(U==18)k=11+G(Q,Y,7),Y+=7;var M=Z+k;while(Z>>1;while(JY)Y=W;J++}while(J>1,Z=X[G+1],H=W<<4|Z,U=V-Z,z=X[G]<>>15-V;K[M]=H,z++}}},q.H.l=function(X,V){var K=q.H.m.r,Q=15-V;for(var Y=0;Y>>Q}},q.H.M=function(X,V,K){K=K<<(V&7);var Q=V>>>3;X[Q]|=K,X[Q+1]|=K>>>8},q.H.I=function(X,V,K){K=K<<(V&7);var Q=V>>>3;X[Q]|=K,X[Q+1]|=K>>>8,X[Q+2]|=K>>>16},q.H.e=function(X,V,K){return(X[V>>>3]|X[(V>>>3)+1]<<8)>>>(V&7)&(1<>>3]|X[(V>>>3)+1]<<8|X[(V>>>3)+2]<<16)>>>(V&7)&(1<>>3]|X[(V>>>3)+1]<<8|X[(V>>>3)+2]<<16)>>>(V&7)},q.H.i=function(X,V){return(X[V>>>3]|X[(V>>>3)+1]<<8|X[(V>>>3)+2]<<16|X[(V>>>3)+3]<<24)>>>(V&7)},q.H.m=function(){var X=Uint16Array,V=Uint32Array;return{K:new X(16),j:new X(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[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,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new X(32),p:[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,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new V(32),J:new X(512),_:[],h:new X(32),$:[],w:new X(32768),C:[],v:[],d:new X(32768),D:[],u:new X(512),Q:[],r:new X(32768),s:new V(286),Y:new V(30),a:new V(19),t:new V(15000),k:new X(65536),g:new X(32768)}}(),function(){var X=q.H.m,V=32768;for(var K=0;K>>1|(Q&1431655765)<<1,Q=(Q&3435973836)>>>2|(Q&858993459)<<2,Q=(Q&4042322160)>>>4|(Q&252645135)<<4,Q=(Q&4278255360)>>>8|(Q&16711935)<<8,X.r[K]=(Q>>>16|Q<<16)>>>17}function Y(J,G,W){while(G--!=0)J.push(0,W)}for(var K=0;K<32;K++)X.q[K]=X.S[K]<<3|X.T[K],X.c[K]=X.p[K]<<4|X.z[K];Y(X._,144,8),Y(X._,112,9),Y(X._,24,7),Y(X._,8,8),q.H.n(X._,9),q.H.A(X._,9,X.J),q.H.l(X._,9),Y(X.$,32,5),q.H.n(X.$,5),q.H.A(X.$,5,X.h),q.H.l(X.$,5),Y(X.Q,19,0),Y(X.C,286,0),Y(X.D,30,0),Y(X.v,320,0)}(),q.H.N}();P.decode._readInterlace=function(q,X){var{width:V,height:K}=X,Q=P.decode._getBPP(X),Y=Q>>3,J=Math.ceil(V*Q/8),G=new Uint8Array(K*J),W=0,Z=[0,0,4,0,2,0,1],H=[0,4,0,2,0,1,0],U=[8,8,8,4,4,2,2],z=[8,8,4,4,2,2,1],k=0;while(k<7){var M=U[k],j=z[k],B=0,L=0,O=Z[k];while(O>3];h=h>>7-(S&7)&1,G[A*J+($>>3)]|=h<<7-(($&7)<<0)}if(Q==2){var h=q[S>>3];h=h>>6-(S&7)&3,G[A*J+($>>2)]|=h<<6-(($&3)<<1)}if(Q==4){var h=q[S>>3];h=h>>4-(S&7)&15,G[A*J+($>>1)]|=h<<4-(($&1)<<2)}if(Q>=8){var b=A*J+$*Y;for(var C=0;C>3)+C]}S+=Q,$+=j}R++,A+=M}if(B*L!=0)W+=L*(1+v);k=k+1}return G};P.decode._getBPP=function(q){var X=[1,null,3,1,2,null,4][q.ctype];return X*q.depth};P.decode._filterZero=function(q,X,V,K,Q){var Y=P.decode._getBPP(X),J=Math.ceil(K*Y/8),G=P.decode._paeth;Y=Math.ceil(Y/8);var W=0,Z=1,H=q[V],U=0;if(H>1)q[V]=[0,0,1][H-2];if(H==3)for(U=Y;U>>1)&255;for(var z=0;z>>1);for(;U>>1)}else{for(;U>8&255,q[X+1]=V&255},readUint:function(q,X){return q[X]*16777216+(q[X+1]<<16|q[X+2]<<8|q[X+3])},writeUint:function(q,X,V){q[X]=V>>24&255,q[X+1]=V>>16&255,q[X+2]=V>>8&255,q[X+3]=V&255},readASCII:function(q,X,V){var K="";for(var Q=0;Q=0&&G>=0)U=k*X+M<<2,z=(G+k)*Q+J+M<<2;else U=(-G+k)*X-J+M<<2,z=k*Q+M<<2;if(W==0)K[z]=q[U],K[z+1]=q[U+1],K[z+2]=q[U+2],K[z+3]=q[U+3];else if(W==1){var j=q[U+3]*0.00392156862745098,B=q[U]*j,L=q[U+1]*j,O=q[U+2]*j,N=K[z+3]*0.00392156862745098,v=K[z]*N,R=K[z+1]*N,A=K[z+2]*N,$=1-j,S=j+N*$,h=S==0?0:1/S;K[z+3]=255*S,K[z+0]=(B+v*$)*h,K[z+1]=(L+R*$)*h,K[z+2]=(O+A*$)*h}else if(W==2){var j=q[U+3],B=q[U],L=q[U+1],O=q[U+2],N=K[z+3],v=K[z],R=K[z+1],A=K[z+2];if(j==N&&B==v&&L==R&&O==A)K[z]=0,K[z+1]=0,K[z+2]=0,K[z+3]=0;else K[z]=B,K[z+1]=L,K[z+2]=O,K[z+3]=j}else if(W==3){var j=q[U+3],B=q[U],L=q[U+1],O=q[U+2],N=K[z+3],v=K[z],R=K[z+1],A=K[z+2];if(j==N&&B==v&&L==R&&O==A)continue;if(j<220&&N>20)return!1}}return!0};P.encode=function(q,X,V,K,Q,Y,J){if(K==null)K=0;if(J==null)J=!1;var G=P.encode.compress(q,X,V,K,[!1,!1,!1,0,J]);return P.encode.compressPNG(G,-1),P.encode._main(G,X,V,Q,Y)};P.encodeLL=function(q,X,V,K,Q,Y,J,G){var W={ctype:0+(K==1?0:2)+(Q==0?0:4),depth:Y,frames:[]},Z=Date.now(),H=(K+Q)*Y,U=H*X;for(var z=0;z1,U=!1,z=33+(H?20:0);if(Q.sRGB!=null)z+=13;if(Q.pHYs!=null)z+=21;if(q.ctype==3){var k=q.plte.length;for(var M=0;M>>24!=255)U=!0;z+=8+k*3+4+(U?8+k*1+4:0)}for(var j=0;j>>8&255,$=v>>>16&255;L[Z+N+0]=R,L[Z+N+1]=A,L[Z+N+2]=$}if(Z+=k*3,J(L,Z,Y(L,Z-k*3-4,k*3+4)),Z+=4,U){J(L,Z,k),Z+=4,W(L,Z,"tRNS"),Z+=4;for(var M=0;M>>24&255;Z+=k,J(L,Z,Y(L,Z-k-4,k+4)),Z+=4}}var S=0;for(var j=0;j>2,D>>2));for(var k=0;kq0&&r==u[B-q0])J0[B]=J0[B-q0];else{var I0=N[r];if(I0==null){if(N[r]=I0=v.length,v.push(r),v.length>=300)break}J0[B]=I0}}}var n0=v.length;if(n0<=256&&Z==!1){if(n0<=2)U=1;else if(n0<=4)U=2;else if(n0<=16)U=4;else U=8;U=Math.max(U,W)}for(var k=0;k>1)]|=N1[y1+v0]<<4-(v0&1)*4;else if(U==2)for(var v0=0;v0>2)]|=N1[y1+v0]<<6-(v0&3)*2;else if(U==1)for(var v0=0;v0>3)]|=N1[y1+v0]<<7-(v0&7)*1}Z2=$2,H=3,mq=1}else if(L==!1&&O.length==1){var $2=new Uint8Array(q0*y2*3),pK=q0*y2;for(var B=0;B$)$=b;if(hS)S=h}}if($==-1)R=A=$=S=0;if(Q){if((R&1)==1)R--;if((A&1)==1)A--}var D=($-R+1)*(S-A+1);if(DB)B=v;if(RL)L=R}}if(B==-1)M=j=B=L=0;if(J){if((M&1)==1)M--;if((j&1)==1)j--}Y={x:M,y:j,width:B-M+1,height:L-j+1};var S=K[Q];if(S.rect=Y,S.blend=1,S.img=new Uint8Array(Y.width*Y.height*4),K[Q-1].dispose==0)P._copyTile(Z,X,V,S.img,Y.width,Y.height,-Y.x,-Y.y,0),P.encode._prepareDiff(z,X,V,S.img,Y);else P._copyTile(z,X,V,S.img,Y.width,Y.height,-Y.x,-Y.y,0)};P.encode._prepareDiff=function(q,X,V,K,Q){P._copyTile(q,X,V,K,Q.width,Q.height,-Q.x,-Q.y,2)};P.encode._filterZero=function(q,X,V,K,Q,Y,J){var G=[],W=[0,1,2,3,4];if(Y!=-1)W=[Y];else if(X*K>500000||V==1)W=[0];var Z;if(J)Z={level:0};var H=J&&UZIP!=null?UZIP:kK.default;for(var U=0;U>1)+256&255;if(Y==4)for(var Z=Q;Z>1)&255;for(var Z=Q;Z>1)&255}if(Y==4){for(var Z=0;Z>>1;else V=V>>>1;q[X]=V}return q}(),update:function(q,X,V,K){for(var Q=0;Q>>8;return q},crc:function(q,X,V){return P.crc.update(4294967295,q,X,V)^4294967295}};P.quantize=function(q,X){var V=new Uint8Array(q),K=V.slice(0),Q=new Uint32Array(K.buffer),Y=P.quantize.getKDtree(K,X),J=Y[0],G=Y[1],W=P.quantize.planeDst,Z=V,H=Q,U=Z.length,z=new Uint8Array(V.length>>2);for(var k=0;k>2]=O.ind,H[k>>2]=O.est.rgba}return{abuf:K.buffer,inds:z,plte:G}};P.quantize.getKDtree=function(q,X,V){if(V==null)V=0.0001;var K=new Uint32Array(q.buffer),Q={i0:0,i1:q.length,bst:null,est:null,tdst:0,left:null,right:null};Q.bst=P.quantize.stats(q,Q.i0,Q.i1),Q.est=P.quantize.estats(Q.bst);var Y=[Q];while(Y.lengthJ)J=Y[W].est.L,G=W;if(J=H||Z.i1<=H;if(U){Z.est.L=0;continue}var z={i0:Z.i0,i1:H,bst:null,est:null,tdst:0,left:null,right:null};z.bst=P.quantize.stats(q,z.i0,z.i1),z.est=P.quantize.estats(z.bst);var k={i0:H,i1:Z.i1,bst:null,est:null,tdst:0,left:null,right:null};k.bst={R:[],m:[],N:Z.bst.N-z.bst.N};for(var W=0;W<16;W++)k.bst.R[W]=Z.bst.R[W]-z.bst.R[W];for(var W=0;W<4;W++)k.bst.m[W]=Z.bst.m[W]-z.bst.m[W];k.est=P.quantize.estats(k.bst),Z.left=z,Z.right=k,Y[G]=z,Y.push(k)}Y.sort(function(M,j){return j.bst.N-M.bst.N});for(var W=0;W0)J=q.right,G=q.left;var W=P.quantize.getNearest(J,X,V,K,Q);if(W.tdst<=Y*Y)return W;var Z=P.quantize.getNearest(G,X,V,K,Q);return Z.tdstY)K-=4;if(V>=K)break;var W=X[V>>2];X[V>>2]=X[K>>2],X[K>>2]=W,V+=4,K-=4}while(J(q,V,Q)>Y)V-=4;return V+4};P.quantize.vecDot=function(q,X,V){return q[X]*V[0]+q[X+1]*V[1]+q[X+2]*V[2]+q[X+3]*V[3]};P.quantize.stats=function(q,X,V){var K=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Q=[0,0,0,0],Y=V-X>>2;for(var J=X;J>>0}};P.M4={multVec:function(q,X){return[q[0]*X[0]+q[1]*X[1]+q[2]*X[2]+q[3]*X[3],q[4]*X[0]+q[5]*X[1]+q[6]*X[2]+q[7]*X[3],q[8]*X[0]+q[9]*X[1]+q[10]*X[2]+q[11]*X[3],q[12]*X[0]+q[13]*X[1]+q[14]*X[2]+q[15]*X[3]]},dot:function(q,X){return q[0]*X[0]+q[1]*X[1]+q[2]*X[2]+q[3]*X[3]},sml:function(q,X){return[q*X[0],q*X[1],q*X[2],q*X[3]]}};P.encode.concatRGBA=function(q){var X=0;for(var V=0;V1)throw Error("Animated PNGs are not supported");var Q=new Uint8Array(K[0]),Y=lG(Q),J=Y.rgbChannel,G=Y.alphaChannel;this.rgbChannel=J;var W=G.some(function(Z){return Z<255});if(W)this.alphaChannel=G;this.type=fG(V.ctype),this.width=V.width,this.height=V.height,this.bitsPerComponent=8}return q.load=function(X){return new q(X)},q}();var _G=function(){function q(X){this.image=X,this.bitsPerComponent=X.bitsPerComponent,this.width=X.width,this.height=X.height,this.colorSpace="DeviceRGB"}return q.for=function(X){return _(this,void 0,void 0,function(){var V;return c(this,function(K){return V=IK.load(X),[2,new q(V)]})})},q.prototype.embedIntoContext=function(X,V){return _(this,void 0,void 0,function(){var K,Q;return c(this,function(Y){if(K=this.embedAlphaChannel(X),Q=X.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:K}),V)return X.assign(V,Q),[2,V];else return[2,X.register(Q)];return[2]})})},q.prototype.embedAlphaChannel=function(X){if(!this.image.alphaChannel)return;var V=X.flateStream(this.image.alphaChannel,{Type:"XObject",Subtype:"Image",Height:this.image.height,Width:this.image.width,BitsPerComponent:this.image.bitsPerComponent,ColorSpace:"DeviceGray",Decode:[0,1]});return X.register(V)},q}(),X8=_G;var cG=function(){function q(X,V,K){this.bytes=X,this.start=V||0,this.pos=this.start,this.end=!!V&&!!K?V+K:this.bytes.length}return Object.defineProperty(q.prototype,"length",{get:function(){return this.end-this.start},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isEmpty",{get:function(){return this.length===0},enumerable:!1,configurable:!0}),q.prototype.getByte=function(){if(this.pos>=this.end)return-1;return this.bytes[this.pos++]},q.prototype.getUint16=function(){var X=this.getByte(),V=this.getByte();if(X===-1||V===-1)return-1;return(X<<8)+V},q.prototype.getInt32=function(){var X=this.getByte(),V=this.getByte(),K=this.getByte(),Q=this.getByte();return(X<<24)+(V<<16)+(K<<8)+Q},q.prototype.getBytes=function(X,V){if(V===void 0)V=!1;var K=this.bytes,Q=this.pos,Y=this.end;if(!X){var J=K.subarray(Q,Y);return V?new Uint8ClampedArray(J):J}else{var G=Q+X;if(G>Y)G=Y;this.pos=G;var J=K.subarray(Q,G);return V?new Uint8ClampedArray(J):J}},q.prototype.peekByte=function(){var X=this.getByte();return this.pos--,X},q.prototype.peekBytes=function(X,V){if(V===void 0)V=!1;var K=this.getBytes(X,V);return this.pos-=K.length,K},q.prototype.skip=function(X){if(!X)X=1;this.pos+=X},q.prototype.reset=function(){this.pos=this.start},q.prototype.moveStart=function(){this.start=this.pos},q.prototype.makeSubStream=function(X,V){return new q(this.bytes,X,V)},q.prototype.decode=function(){return this.bytes},q}(),Uq=cG;var pG=new Uint8Array(0),dG=function(){function q(X){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=pG,this.minBufferLength=512,X)while(this.minBufferLengthY)K=Y}else{while(!this.eof)this.readBlock();K=this.bufferLength}this.pos=K;var J=this.buffer.subarray(Q,K);return V&&!(J instanceof Uint8ClampedArray)?new Uint8ClampedArray(J):J},q.prototype.peekByte=function(){var X=this.getByte();return this.pos--,X},q.prototype.peekBytes=function(X,V){if(V===void 0)V=!1;var K=this.getBytes(X,V);return this.pos-=K.length,K},q.prototype.skip=function(X){if(!X)X=1;this.pos+=X},q.prototype.reset=function(){this.pos=0},q.prototype.makeSubStream=function(X,V){var K=X+V;while(this.bufferLength<=K&&!this.eof)this.readBlock();return new Uq(this.buffer,X,V)},q.prototype.decode=function(){while(!this.eof)this.readBlock();return this.buffer.subarray(0,this.bufferLength)},q.prototype.readBlock=function(){throw new u0(this.constructor.name,"readBlock")},q.prototype.ensureBuffer=function(X){var V=this.buffer;if(X<=V.byteLength)return V;var K=this.minBufferLength;while(K=0;--Z)W[G+Z]=U&255,U>>=8}},X}(d2),jK=nG;var rG=function(q){w(X,q);function X(V,K){var Q=q.call(this,K)||this;if(Q.stream=V,Q.firstDigit=-1,K)K=0.5*K;return Q}return X.prototype.readBlock=function(){var V=8000,K=this.stream.getBytes(V);if(!K.length){this.eof=!0;return}var Q=K.length+1>>1,Y=this.ensureBuffer(this.bufferLength+Q),J=this.bufferLength,G=this.firstDigit;for(var W=0,Z=K.length;W=48&&H<=57)U=H&15;else if(H>=65&&H<=70||H>=97&&H<=102)U=(H&15)+9;else if(H===62){this.eof=!0;break}else continue;if(G<0)G=U;else Y[J++]=G<<4|U,G=-1}if(G>=0&&this.eof)Y[J++]=G<<4,G=-1;this.firstDigit=G,this.bufferLength=J},X}(d2),LK=rG;var BK=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),iG=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),aG=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),oG=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,590000,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],sG=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],tG=function(q){w(X,q);function X(V,K){var Q=q.call(this,K)||this;Q.stream=V;var Y=V.getByte(),J=V.getByte();if(Y===-1||J===-1)throw Error("Invalid header in flate stream: "+Y+", "+J);if((Y&15)!==8)throw Error("Unknown compression method in flate stream: "+Y+", "+J);if(((Y<<8)+J)%31!==0)throw Error("Bad FCHECK in flate stream: "+Y+", "+J);if(J&32)throw Error("FDICT bit set in flate stream: "+Y+", "+J);return Q.codeSize=0,Q.codeBuf=0,Q}return X.prototype.readBlock=function(){var V,K,Q=this.stream,Y=this.getBits(3);if(Y&1)this.eof=!0;if(Y>>=1,Y===0){var J=void 0;if((J=Q.getByte())===-1)throw Error("Bad block header in flate stream");var G=J;if((J=Q.getByte())===-1)throw Error("Bad block header in flate stream");if(G|=J<<8,(J=Q.getByte())===-1)throw Error("Bad block header in flate stream");var W=J;if((J=Q.getByte())===-1)throw Error("Bad block header in flate stream");if(W|=J<<8,W!==(~G&65535)&&(G!==0||W!==0))throw Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;var Z=this.bufferLength;V=this.ensureBuffer(Z+G);var H=Z+G;if(this.bufferLength=H,G===0){if(Q.peekByte()===-1)this.eof=!0}else for(var U=Z;U0)R[O++]=S}z=this.generateHuffmanTable(R.subarray(0,M)),k=this.generateHuffmanTable(R.subarray(M,v))}else throw Error("Unknown block type in flate stream");V=this.buffer;var C=V?V.length:0,D=this.bufferLength;while(!0){var l=this.getCode(z);if(l<256){if(D+1>=C)V=this.ensureBuffer(D+1),C=V.length;V[D++]=l;continue}if(l===256){this.bufferLength=D;return}l-=257,l=iG[l];var u=l>>16;if(u>0)u=this.getBits(u);if(K=(l&65535)+u,l=this.getCode(k),l=aG[l],u=l>>16,u>0)u=this.getBits(u);var q0=(l&65535)+u;if(D+K>=C)V=this.ensureBuffer(D+K),C=V.length;for(var J0=0;J0>V,this.codeSize=Q-=V,J},X.prototype.getCode=function(V){var K=this.stream,Q=V[0],Y=V[1],J=this.codeSize,G=this.codeBuf,W;while(J>16,U=Z&65535;if(H<1||J>H,this.codeSize=J-H,U},X.prototype.generateHuffmanTable=function(V){var K=V.length,Q=0,Y;for(Y=0;YQ)Q=V[Y];var J=1<>=1;for(Y=z;Y0;if(!R||R<256)B[0]=R,L=1;else if(R>=258)if(R=0;J--)B[J]=U[G],G=k[G]}else B[L++]=B[0];else if(R===256){M=9,H=258,L=0;continue}else{this.eof=!0,delete this.lzwState;break}if(A)k[H]=j,z[H]=z[j]+1,U[H]=B[0],H++,M=H+Z&H+Z-1?M:Math.min(Math.log(H+Z)/0.6931471805599453+1,12)|0;if(j=R,O+=L,K>>K&(1<0){var J=this.stream.getBytes(Y);K.set(J,Q),Q+=Y}}else{Y=257-Y;var G=V[1];K=this.ensureBuffer(Q+Y+1);for(var W=0;WK.size())throw new Y5(V,0,K.size());K.remove(V)}},X.prototype.normalizedEntries=function(){var V=this.Kids();if(!V)V=this.dict.context.obj([this.ref]),this.dict.set(I.of("Kids"),V);return{Kids:V}},X.fromDict=function(V,K){return new X(V,K)},X}(Y8),K2=UZ;var zZ=function(q){w(X,q);function X(){return q!==null&&q.apply(this,arguments)||this}return X.prototype.Opt=function(){return this.dict.lookupMaybe(I.of("Opt"),K0,g,i)},X.prototype.setOpt=function(V){this.dict.set(I.of("Opt"),this.dict.context.obj(V))},X.prototype.getExportValues=function(){var V=this.Opt();if(!V)return;if(V instanceof K0||V instanceof g)return[V];var K=[];for(var Q=0,Y=V.size();QK.size())throw new Y5(V,0,K.size());K.remove(V)}},X.prototype.normalizeExportValues=function(){var V,K,Q,Y,J=(V=this.getExportValues())!==null&&V!==void 0?V:[],G=[],W=this.getWidgets();for(var Z=0,H=W.length;Z1){if(!this.hasFlag(G0.MultiSelect))throw new H7;this.dict.set(I.of("V"),this.dict.context.obj(V))}this.updateSelectedIndices(V)},X.prototype.valuesAreValid=function(V){var K=this.getOptions(),Q=function(W,Z){var H=V[W].decodeText();if(!K.find(function(U){return H===(U.display||U.value).decodeText()}))return{value:!1}};for(var Y=0,J=V.length;Y1){var K=Array(V.length),Q=this.getOptions(),Y=function(W,Z){var H=V[W].decodeText();K[W]=Q.findIndex(function(U){return H===(U.display||U.value).decodeText()})};for(var J=0,G=V.length;J0){var G=J.lookup(0,K0,g),W=J.lookupMaybe(1,K0,g);K.push({value:G,display:W||G})}}}return K}return[]},X}(K2),G8=kZ;var IZ=function(q){w(X,q);function X(){return q!==null&&q.apply(this,arguments)||this}return X.fromDict=function(V,K){return new X(V,K)},X.create=function(V){var K=V.obj({FT:"Ch",Ff:G0.Combo,Kids:[]}),Q=V.register(K);return new X(K,Q)},X}(G8),Q6=IZ;var EZ=function(q){w(X,q);function X(){return q!==null&&q.apply(this,arguments)||this}return X.prototype.addField=function(V){var K=this.normalizedEntries().Kids;K===null||K===void 0||K.push(V)},X.prototype.normalizedEntries=function(){var V=this.Kids();if(!V)V=this.dict.context.obj([]),this.dict.set(I.of("Kids"),V);return{Kids:V}},X.fromDict=function(V,K){return new X(V,K)},X.create=function(V){var K=V.obj({}),Q=V.register(K);return new X(K,Q)},X}(Y8),Y6=EZ;var jZ=function(q){w(X,q);function X(){return q!==null&&q.apply(this,arguments)||this}return X.fromDict=function(V,K){return new X(V,K)},X}(K2),F6=jZ;var LZ=function(q){w(X,q);function X(){return q!==null&&q.apply(this,arguments)||this}return X.prototype.MaxLen=function(){var V=this.dict.lookup(I.of("MaxLen"));if(V instanceof x)return V;return},X.prototype.Q=function(){var V=this.dict.lookup(I.of("Q"));if(V instanceof x)return V;return},X.prototype.setMaxLength=function(V){this.dict.set(I.of("MaxLen"),x.of(V))},X.prototype.removeMaxLength=function(){this.dict.delete(I.of("MaxLen"))},X.prototype.getMaxLength=function(){var V;return(V=this.MaxLen())===null||V===void 0?void 0:V.asNumber()},X.prototype.setQuadding=function(V){this.dict.set(I.of("Q"),x.of(V))},X.prototype.getQuadding=function(){var V;return(V=this.Q())===null||V===void 0?void 0:V.asNumber()},X.prototype.setValue=function(V){this.dict.set(I.of("V"),V)},X.prototype.removeValue=function(){this.dict.delete(I.of("V"))},X.prototype.getValue=function(){var V=this.V();if(V instanceof K0||V instanceof g)return V;return},X.fromDict=function(V,K){return new X(V,K)},X.create=function(V){var K=V.obj({FT:"Tx",Kids:[]}),Q=V.register(K);return new X(K,Q)},X}(K2),J6=LZ;var BZ=function(q){w(X,q);function X(){return q!==null&&q.apply(this,arguments)||this}return X.fromDict=function(V,K){return new X(V,K)},X.create=function(V){var K=V.obj({FT:"Btn",Ff:f0.PushButton,Kids:[]}),Q=V.register(K);return new X(K,Q)},X}(h6),G6=BZ;var TZ=function(q){w(X,q);function X(){return q!==null&&q.apply(this,arguments)||this}return X.prototype.setValue=function(V){var K=this.getOnValues();if(!K.includes(V)&&V!==I.of("Off"))throw new J5;this.dict.set(I.of("V"),V);var Q=this.getWidgets();for(var Y=0,J=Q.length;YY)throw new Xq(K,Y);var J=K;for(var G=0,W=Q.size();GJ)return H.insertLeafNode(V,J)||Z;else J-=H.Count().asNumber();if(H instanceof _0)J-=1}if(J===0){this.insertLeafKid(Q.size(),V);return}throw new Vq(K,"insertLeafNode")},X.prototype.removeLeafNode=function(V,K){if(K===void 0)K=!0;var Q=this.Kids(),Y=this.Count().asNumber();if(V>=Y)throw new Xq(V,Y);var J=V;for(var G=0,W=Q.size();GJ){if(H.removeLeafNode(J,K),K&&H.Kids().size()===0)Q.remove(G);return}else J-=H.Count().asNumber();if(H instanceof _0)if(J===0){this.removeKid(G);return}else J-=1}throw new Vq(V,"removeLeafNode")},X.prototype.ascend=function(V){V(this);var K=this.Parent();if(K)K.ascend(V)},X.prototype.traverse=function(V){var K=this.Kids();for(var Q=0,Y=K.size();QNumber.MAX_SAFE_INTEGER)if(this.capNumbers){var Q="Parsed number that is too large for some PDF readers: "+X+", using Number.MAX_SAFE_INTEGER instead.";return console.warn(Q),Number.MAX_SAFE_INTEGER}else{var Q="Parsed number that is too large for some PDF readers: "+X+", not capping.";console.warn(Q)}return K},q.prototype.skipWhitespace=function(){while(!this.bytes.done()&&k2[this.bytes.peek()])this.bytes.next()},q.prototype.skipLine=function(){while(!this.bytes.done()){var X=this.bytes.peek();if(X===wK||X===NK)return;this.bytes.next()}},q.prototype.skipComment=function(){if(this.bytes.peek()!==E.Percent)return!1;while(!this.bytes.done()){var X=this.bytes.peek();if(X===wK||X===NK)return!0;this.bytes.next()}return!0},q.prototype.skipWhitespaceAndComments=function(){this.skipWhitespace();while(this.skipComment())this.skipWhitespace()},q.prototype.matchKeyword=function(X){var V=this.bytes.offset();for(var K=0,Q=X.length;K=this.length},q.prototype.offset=function(){return this.idx},q.prototype.slice=function(X,V){return this.bytes.slice(X,V)},q.prototype.position=function(){return{line:this.line,column:this.column,offset:this.idx}},q.of=function(X){return new q(X)},q.fromPDFRawStream=function(X){return q.of(V8(X).decode())},q}(),D6=CZ;var hZ=E.Space,U1=E.CarriageReturn,z1=E.Newline,M1=[E.s,E.t,E.r,E.e,E.a,E.m],jq=[E.e,E.n,E.d,E.s,E.t,E.r,E.e,E.a,E.m],M0={header:[E.Percent,E.P,E.D,E.F,E.Dash],eof:[E.Percent,E.Percent,E.E,E.O,E.F],obj:[E.o,E.b,E.j],endobj:[E.e,E.n,E.d,E.o,E.b,E.j],xref:[E.x,E.r,E.e,E.f],trailer:[E.t,E.r,E.a,E.i,E.l,E.e,E.r],startxref:[E.s,E.t,E.a,E.r,E.t,E.x,E.r,E.e,E.f],true:[E.t,E.r,E.u,E.e],false:[E.f,E.a,E.l,E.s,E.e],null:[E.n,E.u,E.l,E.l],stream:M1,streamEOF1:Q0(M1,[hZ,U1,z1]),streamEOF2:Q0(M1,[U1,z1]),streamEOF3:Q0(M1,[U1]),streamEOF4:Q0(M1,[z1]),endstream:jq,EOF1endstream:Q0([U1,z1],jq),EOF2endstream:Q0([U1],jq),EOF3endstream:Q0([z1],jq)};var FZ=function(q){w(X,q);function X(V,K,Q){if(Q===void 0)Q=!1;var Y=q.call(this,V,Q)||this;return Y.context=K,Y}return X.prototype.parseObject=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(M0.true))return c2.True;if(this.matchKeyword(M0.false))return c2.False;if(this.matchKeyword(M0.null))return F0;var V=this.bytes.peek();if(V===E.LessThan&&this.bytes.peekAhead(1)===E.LessThan)return this.parseDictOrStream();if(V===E.LessThan)return this.parseHexString();if(V===E.LeftParen)return this.parseString();if(V===E.ForwardSlash)return this.parseName();if(V===E.LeftSquareBracket)return this.parseArray();if(H1[V])return this.parseNumberOrRef();throw new k7(this.bytes.position(),V)},X.prototype.parseNumberOrRef=function(){var V=this.parseRawNumber();this.skipWhitespaceAndComments();var K=this.bytes.offset();if(P0[this.bytes.peek()]){var Q=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===E.R)return this.bytes.assertNext(E.R),a.of(V,Q)}return this.bytes.moveTo(K),x.of(V)},X.prototype.parseHexString=function(){var V="";this.bytes.assertNext(E.LessThan);while(!this.bytes.done()&&this.bytes.peek()!==E.GreaterThan)V+=t0(this.bytes.next());return this.bytes.assertNext(E.GreaterThan),g.of(V)},X.prototype.parseString=function(){var V=0,K=!1,Q="";while(!this.bytes.done()){var Y=this.bytes.next();if(Q+=t0(Y),!K){if(Y===E.LeftParen)V+=1;if(Y===E.RightParen)V-=1}if(Y===E.BackSlash)K=!K;else if(K)K=!1;if(V===0)return K0.of(Q.substring(1,Q.length-1))}throw new j7(this.bytes.position())},X.prototype.parseName=function(){this.bytes.assertNext(E.ForwardSlash);var V="";while(!this.bytes.done()){var K=this.bytes.peek();if(k2[K]||V2[K])break;V+=t0(K),this.bytes.next()}return I.of(V)},X.prototype.parseArray=function(){this.bytes.assertNext(E.LeftSquareBracket),this.skipWhitespaceAndComments();var V=i.withContext(this.context);while(this.bytes.peek()!==E.RightSquareBracket){var K=this.parseObject();V.push(K),this.skipWhitespaceAndComments()}return this.bytes.assertNext(E.RightSquareBracket),V},X.prototype.parseDict=function(){this.bytes.assertNext(E.LessThan),this.bytes.assertNext(E.LessThan),this.skipWhitespaceAndComments();var V=new Map;while(!this.bytes.done()&&this.bytes.peek()!==E.GreaterThan&&this.bytes.peekAhead(1)!==E.GreaterThan){var K=this.parseName(),Q=this.parseObject();V.set(K,Q),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(E.GreaterThan),this.bytes.assertNext(E.GreaterThan);var Y=V.get(I.of("Type"));if(Y===I.of("Catalog"))return W8.fromMapWithContext(V,this.context);else if(Y===I.of("Pages"))return H8.fromMapWithContext(V,this.context);else if(Y===I.of("Page"))return _0.fromMapWithContext(V,this.context);else return m.fromMapWithContext(V,this.context)},X.prototype.parseDictOrStream=function(){var V=this.bytes.position(),K=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(M0.streamEOF1)&&!this.matchKeyword(M0.streamEOF2)&&!this.matchKeyword(M0.streamEOF3)&&!this.matchKeyword(M0.streamEOF4)&&!this.matchKeyword(M0.stream))return K;var Q=this.bytes.offset(),Y,J=K.get(I.of("Length"));if(J instanceof x){if(Y=Q+J.asNumber(),this.bytes.moveTo(Y),this.skipWhitespaceAndComments(),!this.matchKeyword(M0.endstream))this.bytes.moveTo(Q),Y=this.findEndOfStreamFallback(V)}else Y=this.findEndOfStreamFallback(V);var G=this.bytes.slice(Q,Y);return w2.of(K,G)},X.prototype.findEndOfStreamFallback=function(V){var K=1,Q=this.bytes.offset();while(!this.bytes.done()){if(Q=this.bytes.offset(),this.matchKeyword(M0.stream))K+=1;else if(this.matchKeyword(M0.EOF1endstream)||this.matchKeyword(M0.EOF2endstream)||this.matchKeyword(M0.EOF3endstream)||this.matchKeyword(M0.endstream))K-=1;else this.bytes.next();if(K===0)break}if(K!==0)throw new E7(V);return Q},X.forBytes=function(V,K,Q){return new X(D6.of(V),K,Q)},X.forByteStream=function(V,K,Q){if(Q===void 0)Q=!1;return new X(V,K,Q)},X}(SK),U8=FZ;var PZ=function(q){w(X,q);function X(V,K){var Q=q.call(this,D6.fromPDFRawStream(V),V.dict.context)||this,Y=V.dict;return Q.alreadyParsed=!1,Q.shouldWaitForTick=K||function(){return!1},Q.firstOffset=Y.lookup(I.of("First"),x).asNumber(),Q.objectCount=Y.lookup(I.of("N"),x).asNumber(),Q}return X.prototype.parseIntoContext=function(){return _(this,void 0,void 0,function(){var V,K,Q,Y,J,G,W,Z;return c(this,function(H){switch(H.label){case 0:if(this.alreadyParsed)throw new Q5("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0,V=this.parseOffsetsAndObjectNumbers(),K=0,Q=V.length,H.label=1;case 1:if(!(K=E.Space&&K<=E.Tilde;if(Q){if(this.matchKeyword(M0.xref)||this.matchKeyword(M0.trailer)||this.matchKeyword(M0.startxref)||this.matchIndirectObjectHeader()){this.bytes.moveTo(V);break}}this.bytes.next()}},X.prototype.skipBinaryHeaderComment=function(){this.skipWhitespaceAndComments();try{var V=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(V)}catch(K){this.bytes.next(),this.skipWhitespaceAndComments()}},X.forBytesWithOptions=function(V,K,Q,Y){return new X(V,K,Q,Y)},X}(U8),Tq=uZ;var n2=function(q){return 1<0)K[K.length]=+Q;V[V.length]={cmd:X,args:K},K=[],Q="",Y=!1}X=Z}else if([" ",","].includes(Z)||Z==="-"&&Q.length>0&&Q[Q.length-1]!=="e"||Z==="."&&Y){if(Q.length===0)continue;if(K.length===J){if(V[V.length]={cmd:X,args:K},K=[+Q],X==="M")X="L";if(X==="m")X="l"}else K[K.length]=+Q;Y=Z===".",Q=["-","."].includes(Z)?Z:""}else if(Q+=Z,Z===".")Y=!0}if(Q.length>0)if(K.length===J){if(V[V.length]={cmd:X,args:K},K=[+Q],X==="M")X="L";if(X==="m")X="l"}else K[K.length]=+Q;return V[V.length]={cmd:X,args:K},V},oZ=function(q){d=n=Z0=W0=R1=v1=0;var X=[];for(var V=0;V1)z=Math.sqrt(z),V*=z,K*=z;var k=U/V,M=H/V,j=-H/K,B=U/K,L=k*G+M*W,O=j*G+B*W,N=k*q+M*X,v=j*q+B*X,R=(N-L)*(N-L)+(v-O)*(v-O),A=1/R-0.25;if(A<0)A=0;var $=Math.sqrt(A);if(Y===Q)$=-$;var S=0.5*(L+N)-$*(v-O),h=0.5*(O+v)+$*(N-L),b=Math.atan2(O-h,L-S),C=Math.atan2(v-h,N-S),D=C-b;if(D<0&&Y===1)D+=2*Math.PI;else if(D>0&&Y===0)D-=2*Math.PI;var l=Math.ceil(Math.abs(D/(Math.PI*0.5+0.001))),u=[];for(var q0=0;q0q.length)return Q-1;var B=X.heightAtSize(Q),L=B+B*0.2,O=L*Y;if(O>Math.abs(V.height))return Q-1;Q+=1}return Q},K3=function(q,X,V,K){var Q=V.width/K,Y=V.height,J=mK,G=G4(q);while(JQ*0.75;if(U)return J-1}var z=X.heightAtSize(J,{descender:!1});if(z>Y)return J-1;J+=1}return J},Q3=function(q){for(var X=q.length;X>0;X--)if(/\s/.test(q[X]))return X;return},Y3=function(q,X,V,K){var Q,Y=q.length;while(Y>0){var J=q.substring(0,Y),G=V.encodeText(J),W=V.widthOfTextAtSize(J,K);if(Wz)z=$+R;if(M+G>k)k=M+G;Z.push({text:N,encoded:v,width:R,height:G,x:$,y:M}),L=A===null||A===void 0?void 0:A.trim()}}return{fontSize:K,lineHeight:W,lines:Z,bounds:{x:H,y:U,width:z-H,height:k-U}}},QX=function(q,X){var{fontSize:V,font:K,bounds:Q,cellCount:Y}=X,J=P1(k6(q));if(J.length>Y)throw new XX(J.length,Y);if(V===void 0||V===0)V=K3(J,K,Q,Y);var G=Q.width/Y,W=K.heightAtSize(V,{descender:!1}),Z=Q.y+(Q.height/2-W/2),H=[],U=Q.x,z=Q.y,k=Q.x+Q.width,M=Q.y+Q.height,j=0,B=0;while(jk)k=$+R;if(Z+W>M)M=Z+W;H.push({text:J,encoded:v,width:R,height:W,x:$,y:Z}),j+=1,B+=N}return{fontSize:V,cells:H,bounds:{x:U,y:z,width:k-U,height:M-z}}},R8=function(q,X){var{alignment:V,fontSize:K,font:Q,bounds:Y}=X,J=P1(k6(q));if(K===void 0||K===0)K=lK([J],Q,Y);var G=Q.encodeText(J),W=Q.widthOfTextAtSize(J,K),Z=Q.heightAtSize(K,{descender:!1}),H=V===R0.Left?Y.x:V===R0.Center?Y.x+Y.width/2-W/2:V===R0.Right?Y.x+Y.width-W:Y.x,U=Y.y+(Y.height/2-Z/2);return{fontSize:K,line:{text:J,encoded:G,width:W,height:Z,x:H,y:U},bounds:{x:H,y:U,width:W,height:Z}}};var G2=function(q){if("normal"in q)return q;return{normal:q}},J3=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/,m6=function(q){var X,V,K=(X=q.getDefaultAppearance())!==null&&X!==void 0?X:"",Q=(V=F5(K,J3).match)!==null&&V!==void 0?V:[],Y=Number(Q[2]);return isFinite(Y)?Y:void 0},G3=/(\d*\.\d+|\d+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+(g|rg|k)/,L2=function(q){var X,V=(X=q.getDefaultAppearance())!==null&&X!==void 0?X:"",K=F5(V,G3).match,Q=K!==null&&K!==void 0?K:[],Y=Q[1],J=Q[2],G=Q[3],W=Q[4],Z=Q[5];if(Z==="g"&&Y)return yq(Number(Y));if(Z==="rg"&&Y&&J&&G)return Y0(Number(Y),Number(J),Number(G));if(Z==="k"&&Y&&J&&G&&W)return $q(Number(Y),Number(J),Number(G),Number(W));return},B2=function(q,X,V,K){var Q;if(K===void 0)K=0;var Y=[E2(X).toString(),T5((Q=V===null||V===void 0?void 0:V.name)!==null&&Q!==void 0?Q:"dummy__noop",K).toString()].join(` +`);q.setDefaultAppearance(Y)},YX=function(q,X){var V,K,Q,Y=L2(X),J=L2(q.acroField),G=X.getRectangle(),W=X.getAppearanceCharacteristics(),Z=X.getBorderStyle(),H=(V=Z===null||Z===void 0?void 0:Z.getWidth())!==null&&V!==void 0?V:0,U=I2(W===null||W===void 0?void 0:W.getRotation()),z=r2(G,U),k=z.width,M=z.height,j=j2(o(o({},G),{rotation:U})),B=Y0(0,0,0),L=(K=l0(W===null||W===void 0?void 0:W.getBorderColor()))!==null&&K!==void 0?K:B,O=l0(W===null||W===void 0?void 0:W.getBackgroundColor()),N=l0(W===null||W===void 0?void 0:W.getBackgroundColor(),0.8),v=(Q=Y!==null&&Y!==void 0?Y:J)!==null&&Q!==void 0?Q:B;if(Y)B2(X,v);else B2(q.acroField,v);var R={x:0+H/2,y:0+H/2,width:k-H,height:M-H,thickness:1.5,borderWidth:H,borderColor:L,markColor:v};return{normal:{on:Q0(j,B8(o(o({},R),{color:O,filled:!0}))),off:Q0(j,B8(o(o({},R),{color:O,filled:!1})))},down:{on:Q0(j,B8(o(o({},R),{color:N,filled:!0}))),off:Q0(j,B8(o(o({},R),{color:N,filled:!1})))}}},JX=function(q,X){var V,K,Q,Y=L2(X),J=L2(q.acroField),G=X.getRectangle(),W=X.getAppearanceCharacteristics(),Z=X.getBorderStyle(),H=(V=Z===null||Z===void 0?void 0:Z.getWidth())!==null&&V!==void 0?V:0,U=I2(W===null||W===void 0?void 0:W.getRotation()),z=r2(G,U),k=z.width,M=z.height,j=j2(o(o({},G),{rotation:U})),B=Y0(0,0,0),L=(K=l0(W===null||W===void 0?void 0:W.getBorderColor()))!==null&&K!==void 0?K:B,O=l0(W===null||W===void 0?void 0:W.getBackgroundColor()),N=l0(W===null||W===void 0?void 0:W.getBackgroundColor(),0.8),v=(Q=Y!==null&&Y!==void 0?Y:J)!==null&&Q!==void 0?Q:B;if(Y)B2(X,v);else B2(q.acroField,v);var R={x:k/2,y:M/2,width:k-H,height:M-H,borderWidth:H,borderColor:L,dotColor:v};return{normal:{on:Q0(j,T8(o(o({},R),{color:O,filled:!0}))),off:Q0(j,T8(o(o({},R),{color:O,filled:!1})))},down:{on:Q0(j,T8(o(o({},R),{color:N,filled:!0}))),off:Q0(j,T8(o(o({},R),{color:N,filled:!1})))}}},GX=function(q,X,V){var K,Q,Y,J,G,W=L2(X),Z=L2(q.acroField),H=m6(X),U=m6(q.acroField),z=X.getRectangle(),k=X.getAppearanceCharacteristics(),M=X.getBorderStyle(),j=k===null||k===void 0?void 0:k.getCaptions(),B=(K=j===null||j===void 0?void 0:j.normal)!==null&&K!==void 0?K:"",L=(Y=(Q=j===null||j===void 0?void 0:j.down)!==null&&Q!==void 0?Q:B)!==null&&Y!==void 0?Y:"",O=(J=M===null||M===void 0?void 0:M.getWidth())!==null&&J!==void 0?J:0,N=I2(k===null||k===void 0?void 0:k.getRotation()),v=r2(z,N),R=v.width,A=v.height,$=j2(o(o({},z),{rotation:N})),S=Y0(0,0,0),h=l0(k===null||k===void 0?void 0:k.getBorderColor()),b=l0(k===null||k===void 0?void 0:k.getBackgroundColor()),C=l0(k===null||k===void 0?void 0:k.getBackgroundColor(),0.8),D={x:O,y:O,width:R-O*2,height:A-O*2},l=R8(B,{alignment:R0.Center,fontSize:H!==null&&H!==void 0?H:U,font:V,bounds:D}),u=R8(L,{alignment:R0.Center,fontSize:H!==null&&H!==void 0?H:U,font:V,bounds:D}),q0=Math.min(l.fontSize,u.fontSize),J0=(G=W!==null&&W!==void 0?W:Z)!==null&&G!==void 0?G:S;if(W||H!==void 0)B2(X,J0,V,q0);else B2(q.acroField,J0,V,q0);var r={x:0+O/2,y:0+O/2,width:R-O,height:A-O,borderWidth:O,borderColor:h,textColor:J0,font:V.name,fontSize:q0};return{normal:Q0($,Fq(o(o({},r),{color:b,textLines:[l.line]}))),down:Q0($,Fq(o(o({},r),{color:C,textLines:[u.line]})))}},ZX=function(q,X,V){var K,Q,Y,J,G=L2(X),W=L2(q.acroField),Z=m6(X),H=m6(q.acroField),U=X.getRectangle(),z=X.getAppearanceCharacteristics(),k=X.getBorderStyle(),M=(K=q.getText())!==null&&K!==void 0?K:"",j=(Q=k===null||k===void 0?void 0:k.getWidth())!==null&&Q!==void 0?Q:0,B=I2(z===null||z===void 0?void 0:z.getRotation()),L=r2(U,B),O=L.width,N=L.height,v=j2(o(o({},U),{rotation:B})),R=Y0(0,0,0),A=l0(z===null||z===void 0?void 0:z.getBorderColor()),$=l0(z===null||z===void 0?void 0:z.getBackgroundColor()),S,h,b=q.isCombed()?0:1,C={x:j+b,y:j+b,width:O-(j+b)*2,height:N-(j+b)*2};if(q.isMultiline()){var D=gq(M,{alignment:q.getAlignment(),fontSize:Z!==null&&Z!==void 0?Z:H,font:V,bounds:C});S=D.lines,h=D.fontSize}else if(q.isCombed()){var D=QX(M,{fontSize:Z!==null&&Z!==void 0?Z:H,font:V,bounds:C,cellCount:(Y=q.getMaxLength())!==null&&Y!==void 0?Y:0});S=D.cells,h=D.fontSize}else{var D=R8(M,{alignment:q.getAlignment(),fontSize:Z!==null&&Z!==void 0?Z:H,font:V,bounds:C});S=[D.line],h=D.fontSize}var l=(J=G!==null&&G!==void 0?G:W)!==null&&J!==void 0?J:R;if(G||Z!==void 0)B2(X,l,V,h);else B2(q.acroField,l,V,h);var u={x:0+j/2,y:0+j/2,width:O-j,height:N-j,borderWidth:j!==null&&j!==void 0?j:0,borderColor:A,textColor:l,font:V.name,fontSize:h,color:$,textLines:S,padding:b};return Q0(v,Dq(u))},WX=function(q,X,V){var K,Q,Y,J=L2(X),G=L2(q.acroField),W=m6(X),Z=m6(q.acroField),H=X.getRectangle(),U=X.getAppearanceCharacteristics(),z=X.getBorderStyle(),k=(K=q.getSelected()[0])!==null&&K!==void 0?K:"",M=(Q=z===null||z===void 0?void 0:z.getWidth())!==null&&Q!==void 0?Q:0,j=I2(U===null||U===void 0?void 0:U.getRotation()),B=r2(H,j),L=B.width,O=B.height,N=j2(o(o({},H),{rotation:j})),v=Y0(0,0,0),R=l0(U===null||U===void 0?void 0:U.getBorderColor()),A=l0(U===null||U===void 0?void 0:U.getBackgroundColor()),$=1,S={x:M+$,y:M+$,width:L-(M+$)*2,height:O-(M+$)*2},h=R8(k,{alignment:R0.Left,fontSize:W!==null&&W!==void 0?W:Z,font:V,bounds:S}),b=h.line,C=h.fontSize,D=(Y=J!==null&&J!==void 0?J:G)!==null&&Y!==void 0?Y:v;if(J||W!==void 0)B2(X,D,V,C);else B2(q.acroField,D,V,C);var l={x:0+M/2,y:0+M/2,width:L-M,height:O-M,borderWidth:M!==null&&M!==void 0?M:0,borderColor:R,textColor:D,font:V.name,fontSize:C,color:A,textLines:[b],padding:$};return Q0(N,Dq(l))},HX=function(q,X,V){var K,Q,Y=L2(X),J=L2(q.acroField),G=m6(X),W=m6(q.acroField),Z=X.getRectangle(),H=X.getAppearanceCharacteristics(),U=X.getBorderStyle(),z=(K=U===null||U===void 0?void 0:U.getWidth())!==null&&K!==void 0?K:0,k=I2(H===null||H===void 0?void 0:H.getRotation()),M=r2(Z,k),j=M.width,B=M.height,L=j2(o(o({},Z),{rotation:k})),O=Y0(0,0,0),N=l0(H===null||H===void 0?void 0:H.getBorderColor()),v=l0(H===null||H===void 0?void 0:H.getBackgroundColor()),R=q.getOptions(),A=q.getSelected();if(q.isSorted())R.sort();var $="";for(var S=0,h=R.length;S1||Q.length===1&&K)this.enableMultiselect();var G=Array(Q.length);for(var W=0,Z=Q.length;W1||Q.length===1&&K)this.enableMultiselect();var J=Array(Q.length);for(var G=0,W=Q.length;GK)throw new VX(V.length,K,this.getName());if(this.markAsDirty(),this.disableRichFormatting(),V)this.acroField.setValue(g.fromText(V));else this.acroField.removeValue()},X.prototype.getAlignment=function(){var V=this.acroField.getQuadding();return V===0?R0.Left:V===1?R0.Center:V===2?R0.Right:R0.Left},X.prototype.setAlignment=function(V){M2(V,"alignment",R0),this.markAsDirty(),this.acroField.setQuadding(V)},X.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},X.prototype.setMaxLength=function(V){if(X2(V,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),V===void 0)this.acroField.removeMaxLength();else{var K=this.getText();if(K&&K.length>V)throw new KX(K.length,V,this.getName());this.acroField.setMaxLength(V)}},X.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},X.prototype.setImage=function(V){var K=this.getAlignment(),Q=K===R0.Center?T2.Center:K===R0.Right?T2.Right:T2.Left,Y=this.acroField.getWidgets();for(var J=0,G=Y.length;J"u")globalThis.Buffer=y;if(typeof globalThis.process>"u")globalThis.process=N3;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles["pdf-lib"]=zX;})(); diff --git a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs index 45578fb257e..3368b6a2676 100644 --- a/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs +++ b/apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs @@ -1,36 +1,35 @@ // 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 PJ=Object.create;var{getPrototypeOf:TJ,defineProperty:r6,getOwnPropertyNames:C9,getOwnPropertyDescriptor:EJ}=Object,j9=Object.prototype.hasOwnProperty;var E8=(Q,$,q)=>{q=Q!=null?PJ(TJ(Q)):{};let K=$||!Q||!Q.__esModule?r6(q,"default",{value:Q,enumerable:!0}):q;for(let J of C9(Q))if(!j9.call(K,J))r6(K,J,{get:()=>Q[J],enumerable:!0});return K},R9=new WeakMap,y0=(Q)=>{var $=R9.get(Q),q;if($)return $;if($=r6({},"__esModule",{value:!0}),Q&&typeof Q==="object"||typeof Q==="function")C9(Q).map((K)=>!j9.call($,K)&&r6($,K,{get:()=>Q[K],enumerable:!(q=EJ(Q,K))||q.enumerable}));return R9.set(Q,$),$},N0=(Q,$)=>()=>($||Q(($={exports:{}}).exports,$),$.exports);var h2=(Q,$)=>{for(var q in $)r6(Q,q,{get:$[q],enumerable:!0,configurable:!0,set:(K)=>$[q]=()=>K})};var x2=(Q,$)=>()=>(Q&&($=Q(Q=0)),$);var f9=((Q)=>typeof require!=="undefined"?require:typeof Proxy!=="undefined"?new Proxy(Q,{get:($,q)=>(typeof require!=="undefined"?require:$)[q]}):Q)(function(Q){if(typeof require!=="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+Q+'" is not supported')});var s0={};h2(s0,{transcode:()=>IU,resolveObjectURL:()=>HU,kStringMaxLength:()=>T9,kMaxLength:()=>s6,isUtf8:()=>kU,isAscii:()=>vU,default:()=>RU,constants:()=>lJ,btoa:()=>mJ,atob:()=>nJ,INSPECT_MAX_BYTES:()=>dJ,File:()=>pJ,Buffer:()=>J0,Blob:()=>iJ});function SJ(Q){var $=Q.length;if($%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var q=Q.indexOf("=");if(q===-1)q=$;var K=q===$?0:4-q%4;return[q,K]}function uJ(Q,$){return(Q+$)*3/4-$}function _J(Q){var $,q=SJ(Q),K=q[0],J=q[1],Z=new Uint8Array(uJ(K,J)),G=0,B=J>0?K-4:K,W;for(W=0;W>16&255,Z[G++]=$>>8&255,Z[G++]=$&255;if(J===2)$=v1[Q.charCodeAt(W)]<<2|v1[Q.charCodeAt(W+1)]>>4,Z[G++]=$&255;if(J===1)$=v1[Q.charCodeAt(W)]<<10|v1[Q.charCodeAt(W+1)]<<4|v1[Q.charCodeAt(W+2)]>>2,Z[G++]=$>>8&255,Z[G++]=$&255;return Z}function cJ(Q){return O1[Q>>18&63]+O1[Q>>12&63]+O1[Q>>6&63]+O1[Q&63]}function bJ(Q,$,q){var K,J=[];for(var Z=$;ZB?B:G+Z));if(K===1)$=Q[q-1],J.push(O1[$>>2]+O1[$<<4&63]+"==");else if(K===2)$=(Q[q-2]<<8)+Q[q-1],J.push(O1[$>>10]+O1[$>>4&63]+O1[$<<2&63]+"=");return J.join("")}function S8(Q,$,q,K,J){var Z,G,B=J*8-K-1,W=(1<>1,V=-7,N=q?J-1:0,F=q?-1:1,M=Q[$+N];N+=F,Z=M&(1<<-V)-1,M>>=-V,V+=B;for(;V>0;Z=Z*256+Q[$+N],N+=F,V-=8);G=Z&(1<<-V)-1,Z>>=-V,V+=K;for(;V>0;G=G*256+Q[$+N],N+=F,V-=8);if(Z===0)Z=1-U;else if(Z===W)return G?NaN:(M?-1:1)*(1/0);else G=G+Math.pow(2,K),Z=Z-U;return(M?-1:1)*G*Math.pow(2,Z-K)}function P9(Q,$,q,K,J,Z){var G,B,W,U=Z*8-J-1,V=(1<>1,F=J===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=K?0:Z-1,v=K?1:-1,x=$<0||$===0&&1/$<0?1:0;if($=Math.abs($),isNaN($)||$===1/0)B=isNaN($)?1:0,G=V;else{if(G=Math.floor(Math.log($)/Math.LN2),$*(W=Math.pow(2,-G))<1)G--,W*=2;if(G+N>=1)$+=F/W;else $+=F*Math.pow(2,1-N);if($*W>=2)G++,W/=2;if(G+N>=V)B=0,G=V;else if(G+N>=1)B=($*W-1)*Math.pow(2,J),G=G+N;else B=$*Math.pow(2,N-1)*Math.pow(2,J),G=0}for(;J>=8;Q[q+M]=B&255,M+=v,B/=256,J-=8);G=G<0;Q[q+M]=G&255,M+=v,G/=256,U-=8);Q[q+M-v]|=x*128}function p1(Q){if(Q>s6)throw new RangeError('The value "'+Q+'" is invalid for option "size"');let $=new Uint8Array(Q);return Object.setPrototypeOf($,J0.prototype),$}function Z4(Q,$,q){return class K extends q{constructor(){super();Object.defineProperty(this,"message",{value:$.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Q}]`,this.stack,delete this.name}get code(){return Q}set code(J){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:J,writable:!0})}toString(){return`${this.name} [${Q}]: ${this.message}`}}}function J0(Q,$,q){if(typeof Q==="number"){if(typeof $==="string")throw new TypeError('The "string" argument must be of type string. Received type number');return G4(Q)}return E9(Q,$,q)}function E9(Q,$,q){if(typeof Q==="string")return sJ(Q,$);if(ArrayBuffer.isView(Q))return tJ(Q);if(Q==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Q);if(P1(Q,ArrayBuffer)||Q&&P1(Q.buffer,ArrayBuffer))return U4(Q,$,q);if(typeof SharedArrayBuffer!=="undefined"&&(P1(Q,SharedArrayBuffer)||Q&&P1(Q.buffer,SharedArrayBuffer)))return U4(Q,$,q);if(typeof Q==="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let K=Q.valueOf&&Q.valueOf();if(K!=null&&K!==Q)return J0.from(K,$,q);let J=eJ(Q);if(J)return J;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof Q[Symbol.toPrimitive]==="function")return J0.from(Q[Symbol.toPrimitive]("string"),$,q);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Q)}function S9(Q){if(typeof Q!=="number")throw new TypeError('"size" argument must be of type number');else if(Q<0)throw new RangeError('The value "'+Q+'" is invalid for option "size"')}function rJ(Q,$,q){if(S9(Q),Q<=0)return p1(Q);if($!==void 0)return typeof q==="string"?p1(Q).fill($,q):p1(Q).fill($);return p1(Q)}function G4(Q){return S9(Q),p1(Q<0?0:B4(Q)|0)}function sJ(Q,$){if(typeof $!=="string"||$==="")$="utf8";if(!J0.isEncoding($))throw new TypeError("Unknown encoding: "+$);let q=u9(Q,$)|0,K=p1(q),J=K.write(Q,$);if(J!==q)K=K.slice(0,J);return K}function J4(Q){let $=Q.length<0?0:B4(Q.length)|0,q=p1($);for(let K=0;K<$;K+=1)q[K]=Q[K]&255;return q}function tJ(Q){if(P1(Q,Uint8Array)){let $=new Uint8Array(Q);return U4($.buffer,$.byteOffset,$.byteLength)}return J4(Q)}function U4(Q,$,q){if($<0||Q.byteLength<$)throw new RangeError('"offset" is outside of buffer bounds');if(Q.byteLength<$+(q||0))throw new RangeError('"length" is outside of buffer bounds');let K;if($===void 0&&q===void 0)K=new Uint8Array(Q);else if(q===void 0)K=new Uint8Array(Q,$);else K=new Uint8Array(Q,$,q);return Object.setPrototypeOf(K,J0.prototype),K}function eJ(Q){if(J0.isBuffer(Q)){let $=B4(Q.length)|0,q=p1($);if(q.length===0)return q;return Q.copy(q,0,0,$),q}if(Q.length!==void 0){if(typeof Q.length!=="number"||numberIsNaN(Q.length))return p1(0);return J4(Q)}if(Q.type==="Buffer"&&Array.isArray(Q.data))return J4(Q.data)}function B4(Q){if(Q>=s6)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s6.toString(16)+" bytes");return Q|0}function u9(Q,$){if(J0.isBuffer(Q))return Q.length;if(ArrayBuffer.isView(Q)||P1(Q,ArrayBuffer))return Q.byteLength;if(typeof Q!=="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Q);let q=Q.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&q===0)return 0;let J=!1;for(;;)switch($){case"ascii":case"latin1":case"binary":return q;case"utf8":case"utf-8":return V4(Q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q*2;case"hex":return q>>>1;case"base64":return l9(Q).length;default:if(J)return K?-1:V4(Q).length;$=(""+$).toLowerCase(),J=!0}}function QU(Q,$,q){let K=!1;if($===void 0||$<0)$=0;if($>this.length)return"";if(q===void 0||q>this.length)q=this.length;if(q<=0)return"";if(q>>>=0,$>>>=0,q<=$)return"";if(!Q)Q="utf8";while(!0)switch(Q){case"hex":return WU(this,$,q);case"utf8":case"utf-8":return c9(this,$,q);case"ascii":return GU(this,$,q);case"latin1":case"binary":return BU(this,$,q);case"base64":return VU(this,$,q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zU(this,$,q);default:if(K)throw new TypeError("Unknown encoding: "+Q);Q=(Q+"").toLowerCase(),K=!0}}function P2(Q,$,q){let K=Q[$];Q[$]=Q[q],Q[q]=K}function _9(Q,$,q,K,J){if(Q.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:Q.length-1;if(q<0)q=Q.length+q;if(q>=Q.length)if(J)return-1;else q=Q.length-1;else if(q<0)if(J)q=0;else return-1;if(typeof $==="string")$=J0.from($,K);if(J0.isBuffer($)){if($.length===0)return-1;return h9(Q,$,q,K,J)}else if(typeof $==="number"){if($=$&255,typeof Uint8Array.prototype.indexOf==="function")if(J)return Uint8Array.prototype.indexOf.call(Q,$,q);else return Uint8Array.prototype.lastIndexOf.call(Q,$,q);return h9(Q,[$],q,K,J)}throw new TypeError("val must be string, number or Buffer")}function h9(Q,$,q,K,J){let Z=1,G=Q.length,B=$.length;if(K!==void 0){if(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le"){if(Q.length<2||$.length<2)return-1;Z=2,G/=2,B/=2,q/=2}}function W(V,N){if(Z===1)return V[N];else return V.readUInt16BE(N*Z)}let U;if(J){let V=-1;for(U=q;UG)q=G-B;for(U=q;U>=0;U--){let V=!0;for(let N=0;NJ)K=J;let Z=$.length;if(K>Z/2)K=Z/2;let G;for(G=0;G239?4:Z>223?3:Z>191?2:1;if(J+B<=q){let W,U,V,N;switch(B){case 1:if(Z<128)G=Z;break;case 2:if(W=Q[J+1],(W&192)===128){if(N=(Z&31)<<6|W&63,N>127)G=N}break;case 3:if(W=Q[J+1],U=Q[J+2],(W&192)===128&&(U&192)===128){if(N=(Z&15)<<12|(W&63)<<6|U&63,N>2047&&(N<55296||N>57343))G=N}break;case 4:if(W=Q[J+1],U=Q[J+2],V=Q[J+3],(W&192)===128&&(U&192)===128&&(V&192)===128){if(N=(Z&15)<<18|(W&63)<<12|(U&63)<<6|V&63,N>65535&&N<1114112)G=N}}}if(G===null)G=65533,B=1;else if(G>65535)G-=65536,K.push(G>>>10&1023|55296),G=56320|G&1023;K.push(G),J+=B}return ZU(K)}function ZU(Q){let $=Q.length;if($<=x9)return String.fromCharCode.apply(String,Q);let q="",K=0;while(K<$)q+=String.fromCharCode.apply(String,Q.slice(K,K+=x9));return q}function GU(Q,$,q){let K="";q=Math.min(Q.length,q);for(let J=$;JK)q=K;let J="";for(let Z=$;Zq)throw new RangeError("Trying to access beyond buffer length")}function Z1(Q,$,q,K,J,Z){if(!J0.isBuffer(Q))throw new TypeError('"buffer" argument must be a Buffer instance');if($>J||$Q.length)throw new RangeError("Index out of range")}function b9(Q,$,q,K,J){i9($,K,J,Q,q,7);let Z=Number($&BigInt(4294967295));Q[q++]=Z,Z=Z>>8,Q[q++]=Z,Z=Z>>8,Q[q++]=Z,Z=Z>>8,Q[q++]=Z;let G=Number($>>BigInt(32)&BigInt(4294967295));return Q[q++]=G,G=G>>8,Q[q++]=G,G=G>>8,Q[q++]=G,G=G>>8,Q[q++]=G,q}function d9(Q,$,q,K,J){i9($,K,J,Q,q,7);let Z=Number($&BigInt(4294967295));Q[q+7]=Z,Z=Z>>8,Q[q+6]=Z,Z=Z>>8,Q[q+5]=Z,Z=Z>>8,Q[q+4]=Z;let G=Number($>>BigInt(32)&BigInt(4294967295));return Q[q+3]=G,G=G>>8,Q[q+2]=G,G=G>>8,Q[q+1]=G,G=G>>8,Q[q]=G,q+8}function m9(Q,$,q,K,J,Z){if(q+K>Q.length)throw new RangeError("Index out of range");if(q<0)throw new RangeError("Index out of range")}function n9(Q,$,q,K,J){if($=+$,q=q>>>0,!J)m9(Q,$,q,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return P9(Q,$,q,K,23,4),q+4}function p9(Q,$,q,K,J){if($=+$,q=q>>>0,!J)m9(Q,$,q,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return P9(Q,$,q,K,52,8),q+8}function O9(Q){let $="",q=Q.length,K=Q[0]==="-"?1:0;for(;q>=K+4;q-=3)$=`_${Q.slice(q-3,q)}${$}`;return`${Q.slice(0,q)}${$}`}function FU(Q,$,q){if(J6($,"offset"),Q[$]===void 0||Q[$+q]===void 0)t6($,Q.length-(q+1))}function i9(Q,$,q,K,J,Z){if(Q>q||Q<$){let G=typeof $==="bigint"?"n":"",B;if(Z>3)if($===0||$===BigInt(0))B=`>= 0${G} and < 2${G} ** ${(Z+1)*8}${G}`;else B=`>= -(2${G} ** ${(Z+1)*8-1}${G}) and < 2 ** ${(Z+1)*8-1}${G}`;else B=`>= ${$}${G} and <= ${q}${G}`;throw new K4("value",B,Q)}FU(K,J,Z)}function J6(Q,$){if(typeof Q!=="number")throw new aJ($,"number",Q)}function t6(Q,$,q){if(Math.floor(Q)!==Q)throw J6(Q,q),new K4(q||"offset","an integer",Q);if($<0)throw new oJ;throw new K4(q||"offset",`>= ${q?1:0} and <= ${$}`,Q)}function wU(Q){if(Q=Q.split("=")[0],Q=Q.trim().replace(MU,""),Q.length<2)return"";while(Q.length%4!==0)Q=Q+"=";return Q}function V4(Q,$){$=$||1/0;let q,K=Q.length,J=null,Z=[];for(let G=0;G55295&&q<57344){if(!J){if(q>56319){if(($-=3)>-1)Z.push(239,191,189);continue}else if(G+1===K){if(($-=3)>-1)Z.push(239,191,189);continue}J=q;continue}if(q<56320){if(($-=3)>-1)Z.push(239,191,189);J=q;continue}q=(J-55296<<10|q-56320)+65536}else if(J){if(($-=3)>-1)Z.push(239,191,189)}if(J=null,q<128){if(($-=1)<0)break;Z.push(q)}else if(q<2048){if(($-=2)<0)break;Z.push(q>>6|192,q&63|128)}else if(q<65536){if(($-=3)<0)break;Z.push(q>>12|224,q>>6&63|128,q&63|128)}else if(q<1114112){if(($-=4)<0)break;Z.push(q>>18|240,q>>12&63|128,q>>6&63|128,q&63|128)}else throw new Error("Invalid code point")}return Z}function NU(Q){let $=[];for(let q=0;q>8,J=q%256,Z.push(J),Z.push(K)}return Z}function l9(Q){return _J(wU(Q))}function u8(Q,$,q,K){let J;for(J=0;J=$.length||J>=Q.length)break;$[J+q]=Q[J]}return J}function P1(Q,$){return Q instanceof $||Q!=null&&Q.constructor!=null&&Q.constructor.name!=null&&Q.constructor.name===$.name}function B2(Q){return typeof BigInt==="undefined"?DU:Q}function DU(){throw new Error("BigInt not supported")}function W4(Q){return()=>{throw new Error(Q+" is not implemented for node:buffer browser polyfill")}}var O1,v1,$4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",O2,g9,y9,dJ=50,s6=2147483647,T9=536870888,mJ,nJ,pJ,iJ,lJ,oJ,aJ,K4,x9=4096,MU,LU,HU,kU,vU=(Q)=>{for(let $ of Q)if($.charCodeAt(0)>127)return!1;return!0},IU,RU;var a0=x2(()=>{O1=[],v1=[];for(O2=0,g9=$4.length;O24294967296)J=O9(String(q));else if(typeof q==="bigint"){if(J=String(q),q>BigInt(2)**BigInt(32)||q<-(BigInt(2)**BigInt(32)))J=O9(J);J+="n"}return K+=` It must be ${$}. Received ${J}`,K},RangeError);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;J0.from=function(Q,$,q){return E9(Q,$,q)};Object.setPrototypeOf(J0.prototype,Uint8Array.prototype);Object.setPrototypeOf(J0,Uint8Array);J0.alloc=function(Q,$,q){return rJ(Q,$,q)};J0.allocUnsafe=function(Q){return G4(Q)};J0.allocUnsafeSlow=function(Q){return G4(Q)};J0.isBuffer=function Q($){return $!=null&&$._isBuffer===!0&&$!==J0.prototype};J0.compare=function Q($,q){if(P1($,Uint8Array))$=J0.from($,$.offset,$.byteLength);if(P1(q,Uint8Array))q=J0.from(q,q.offset,q.byteLength);if(!J0.isBuffer($)||!J0.isBuffer(q))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===q)return 0;let K=$.length,J=q.length;for(let Z=0,G=Math.min(K,J);ZJ.length){if(!J0.isBuffer(G))G=J0.from(G);G.copy(J,Z)}else Uint8Array.prototype.set.call(J,G,Z);else if(!J0.isBuffer(G))throw new TypeError('"list" argument must be an Array of Buffers');else G.copy(J,Z);Z+=G.length}return J};J0.byteLength=u9;J0.prototype._isBuffer=!0;J0.prototype.swap16=function Q(){let $=this.length;if($%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let q=0;q<$;q+=2)P2(this,q,q+1);return this};J0.prototype.swap32=function Q(){let $=this.length;if($%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let q=0;q<$;q+=4)P2(this,q,q+3),P2(this,q+1,q+2);return this};J0.prototype.swap64=function Q(){let $=this.length;if($%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let q=0;q<$;q+=8)P2(this,q,q+7),P2(this,q+1,q+6),P2(this,q+2,q+5),P2(this,q+3,q+4);return this};J0.prototype.toString=function Q(){let $=this.length;if($===0)return"";if(arguments.length===0)return c9(this,0,$);return QU.apply(this,arguments)};J0.prototype.toLocaleString=J0.prototype.toString;J0.prototype.equals=function Q($){if(!J0.isBuffer($))throw new TypeError("Argument must be a Buffer");if(this===$)return!0;return J0.compare(this,$)===0};J0.prototype.inspect=function Q(){let $="",q=exports_buffer.INSPECT_MAX_BYTES;if($=this.toString("hex",0,q).replace(/(.{2})/g,"$1 ").trim(),this.length>q)$+=" ... ";return""};if(y9)J0.prototype[y9]=J0.prototype.inspect;J0.prototype.compare=function Q($,q,K,J,Z){if(P1($,Uint8Array))$=J0.from($,$.offset,$.byteLength);if(!J0.isBuffer($))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(q===void 0)q=0;if(K===void 0)K=$?$.length:0;if(J===void 0)J=0;if(Z===void 0)Z=this.length;if(q<0||K>$.length||J<0||Z>this.length)throw new RangeError("out of range index");if(J>=Z&&q>=K)return 0;if(J>=Z)return-1;if(q>=K)return 1;if(q>>>=0,K>>>=0,J>>>=0,Z>>>=0,this===$)return 0;let G=Z-J,B=K-q,W=Math.min(G,B),U=this.slice(J,Z),V=$.slice(q,K);for(let N=0;N>>0,isFinite(K)){if(K=K>>>0,J===void 0)J="utf8"}else J=K,K=void 0;else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Z=this.length-q;if(K===void 0||K>Z)K=Z;if($.length>0&&(K<0||q<0)||q>this.length)throw new RangeError("Attempt to write outside buffer bounds");if(!J)J="utf8";let G=!1;for(;;)switch(J){case"hex":return qU(this,$,q,K);case"utf8":case"utf-8":return $U(this,$,q,K);case"ascii":case"latin1":case"binary":return KU(this,$,q,K);case"base64":return JU(this,$,q,K);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return UU(this,$,q,K);default:if(G)throw new TypeError("Unknown encoding: "+J);J=(""+J).toLowerCase(),G=!0}};J0.prototype.toJSON=function Q(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};J0.prototype.slice=function Q($,q){let K=this.length;if($=~~$,q=q===void 0?K:~~q,$<0){if($+=K,$<0)$=0}else if($>K)$=K;if(q<0){if(q+=K,q<0)q=0}else if(q>K)q=K;if(q<$)q=$;let J=this.subarray($,q);return Object.setPrototypeOf(J,J0.prototype),J};J0.prototype.readUintLE=J0.prototype.readUIntLE=function Q($,q,K){if($=$>>>0,q=q>>>0,!K)o0($,q,this.length);let J=this[$],Z=1,G=0;while(++G>>0,q=q>>>0,!K)o0($,q,this.length);let J=this[$+--q],Z=1;while(q>0&&(Z*=256))J+=this[$+--q]*Z;return J};J0.prototype.readUint8=J0.prototype.readUInt8=function Q($,q){if($=$>>>0,!q)o0($,1,this.length);return this[$]};J0.prototype.readUint16LE=J0.prototype.readUInt16LE=function Q($,q){if($=$>>>0,!q)o0($,2,this.length);return this[$]|this[$+1]<<8};J0.prototype.readUint16BE=J0.prototype.readUInt16BE=function Q($,q){if($=$>>>0,!q)o0($,2,this.length);return this[$]<<8|this[$+1]};J0.prototype.readUint32LE=J0.prototype.readUInt32LE=function Q($,q){if($=$>>>0,!q)o0($,4,this.length);return(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216};J0.prototype.readUint32BE=J0.prototype.readUInt32BE=function Q($,q){if($=$>>>0,!q)o0($,4,this.length);return this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])};J0.prototype.readBigUInt64LE=B2(function Q($){$=$>>>0,J6($,"offset");let q=this[$],K=this[$+7];if(q===void 0||K===void 0)t6($,this.length-8);let J=q+this[++$]*256+this[++$]*65536+this[++$]*16777216,Z=this[++$]+this[++$]*256+this[++$]*65536+K*16777216;return BigInt(J)+(BigInt(Z)<>>0,J6($,"offset");let q=this[$],K=this[$+7];if(q===void 0||K===void 0)t6($,this.length-8);let J=q*16777216+this[++$]*65536+this[++$]*256+this[++$],Z=this[++$]*16777216+this[++$]*65536+this[++$]*256+K;return(BigInt(J)<>>0,q=q>>>0,!K)o0($,q,this.length);let J=this[$],Z=1,G=0;while(++G=Z)J-=Math.pow(2,8*q);return J};J0.prototype.readIntBE=function Q($,q,K){if($=$>>>0,q=q>>>0,!K)o0($,q,this.length);let J=q,Z=1,G=this[$+--J];while(J>0&&(Z*=256))G+=this[$+--J]*Z;if(Z*=128,G>=Z)G-=Math.pow(2,8*q);return G};J0.prototype.readInt8=function Q($,q){if($=$>>>0,!q)o0($,1,this.length);if(!(this[$]&128))return this[$];return(255-this[$]+1)*-1};J0.prototype.readInt16LE=function Q($,q){if($=$>>>0,!q)o0($,2,this.length);let K=this[$]|this[$+1]<<8;return K&32768?K|4294901760:K};J0.prototype.readInt16BE=function Q($,q){if($=$>>>0,!q)o0($,2,this.length);let K=this[$+1]|this[$]<<8;return K&32768?K|4294901760:K};J0.prototype.readInt32LE=function Q($,q){if($=$>>>0,!q)o0($,4,this.length);return this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24};J0.prototype.readInt32BE=function Q($,q){if($=$>>>0,!q)o0($,4,this.length);return this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]};J0.prototype.readBigInt64LE=B2(function Q($){$=$>>>0,J6($,"offset");let q=this[$],K=this[$+7];if(q===void 0||K===void 0)t6($,this.length-8);let J=this[$+4]+this[$+5]*256+this[$+6]*65536+(K<<24);return(BigInt(J)<>>0,J6($,"offset");let q=this[$],K=this[$+7];if(q===void 0||K===void 0)t6($,this.length-8);let J=(q<<24)+this[++$]*65536+this[++$]*256+this[++$];return(BigInt(J)<>>0,!q)o0($,4,this.length);return S8(this,$,!0,23,4)};J0.prototype.readFloatBE=function Q($,q){if($=$>>>0,!q)o0($,4,this.length);return S8(this,$,!1,23,4)};J0.prototype.readDoubleLE=function Q($,q){if($=$>>>0,!q)o0($,8,this.length);return S8(this,$,!0,52,8)};J0.prototype.readDoubleBE=function Q($,q){if($=$>>>0,!q)o0($,8,this.length);return S8(this,$,!1,52,8)};J0.prototype.writeUintLE=J0.prototype.writeUIntLE=function Q($,q,K,J){if($=+$,q=q>>>0,K=K>>>0,!J){let B=Math.pow(2,8*K)-1;Z1(this,$,q,K,B,0)}let Z=1,G=0;this[q]=$&255;while(++G>>0,K=K>>>0,!J){let B=Math.pow(2,8*K)-1;Z1(this,$,q,K,B,0)}let Z=K-1,G=1;this[q+Z]=$&255;while(--Z>=0&&(G*=256))this[q+Z]=$/G&255;return q+K};J0.prototype.writeUint8=J0.prototype.writeUInt8=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(this,$,q,1,255,0);return this[q]=$&255,q+1};J0.prototype.writeUint16LE=J0.prototype.writeUInt16LE=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(this,$,q,2,65535,0);return this[q]=$&255,this[q+1]=$>>>8,q+2};J0.prototype.writeUint16BE=J0.prototype.writeUInt16BE=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(this,$,q,2,65535,0);return this[q]=$>>>8,this[q+1]=$&255,q+2};J0.prototype.writeUint32LE=J0.prototype.writeUInt32LE=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(this,$,q,4,4294967295,0);return this[q+3]=$>>>24,this[q+2]=$>>>16,this[q+1]=$>>>8,this[q]=$&255,q+4};J0.prototype.writeUint32BE=J0.prototype.writeUInt32BE=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(this,$,q,4,4294967295,0);return this[q]=$>>>24,this[q+1]=$>>>16,this[q+2]=$>>>8,this[q+3]=$&255,q+4};J0.prototype.writeBigUInt64LE=B2(function Q($,q=0){return b9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeBigUInt64BE=B2(function Q($,q=0){return d9(this,$,q,BigInt(0),BigInt("0xffffffffffffffff"))});J0.prototype.writeIntLE=function Q($,q,K,J){if($=+$,q=q>>>0,!J){let W=Math.pow(2,8*K-1);Z1(this,$,q,K,W-1,-W)}let Z=0,G=1,B=0;this[q]=$&255;while(++Z>0)-B&255}return q+K};J0.prototype.writeIntBE=function Q($,q,K,J){if($=+$,q=q>>>0,!J){let W=Math.pow(2,8*K-1);Z1(this,$,q,K,W-1,-W)}let Z=K-1,G=1,B=0;this[q+Z]=$&255;while(--Z>=0&&(G*=256)){if($<0&&B===0&&this[q+Z+1]!==0)B=1;this[q+Z]=($/G>>0)-B&255}return q+K};J0.prototype.writeInt8=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(this,$,q,1,127,-128);if($<0)$=255+$+1;return this[q]=$&255,q+1};J0.prototype.writeInt16LE=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(this,$,q,2,32767,-32768);return this[q]=$&255,this[q+1]=$>>>8,q+2};J0.prototype.writeInt16BE=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(this,$,q,2,32767,-32768);return this[q]=$>>>8,this[q+1]=$&255,q+2};J0.prototype.writeInt32LE=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(this,$,q,4,2147483647,-2147483648);return this[q]=$&255,this[q+1]=$>>>8,this[q+2]=$>>>16,this[q+3]=$>>>24,q+4};J0.prototype.writeInt32BE=function Q($,q,K){if($=+$,q=q>>>0,!K)Z1(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};J0.prototype.writeBigInt64LE=B2(function Q($,q=0){return b9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeBigInt64BE=B2(function Q($,q=0){return d9(this,$,q,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});J0.prototype.writeFloatLE=function Q($,q,K){return n9(this,$,q,!0,K)};J0.prototype.writeFloatBE=function Q($,q,K){return n9(this,$,q,!1,K)};J0.prototype.writeDoubleLE=function Q($,q,K){return p9(this,$,q,!0,K)};J0.prototype.writeDoubleBE=function Q($,q,K){return p9(this,$,q,!1,K)};J0.prototype.copy=function Q($,q,K,J){if(!J0.isBuffer($))throw new TypeError("argument should be a Buffer");if(!K)K=0;if(!J&&J!==0)J=this.length;if(q>=$.length)q=$.length;if(!q)q=0;if(J>0&&J=this.length)throw new RangeError("Index out of range");if(J<0)throw new RangeError("sourceEnd out of bounds");if(J>this.length)J=this.length;if($.length-q>>0,K=K===void 0?this.length:K>>>0,!$)$=0;let Z;if(typeof $==="number")for(Z=q;Z{var m0=s9.exports={},T1,E1;function z4(){throw new Error("setTimeout has not been defined")}function F4(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function")T1=setTimeout;else T1=z4}catch(Q){T1=z4}try{if(typeof clearTimeout==="function")E1=clearTimeout;else E1=F4}catch(Q){E1=F4}})();function o9(Q){if(T1===setTimeout)return setTimeout(Q,0);if((T1===z4||!T1)&&setTimeout)return T1=setTimeout,setTimeout(Q,0);try{return T1(Q,0)}catch($){try{return T1.call(null,Q,0)}catch(q){return T1.call(this,Q,0)}}}function CU(Q){if(E1===clearTimeout)return clearTimeout(Q);if((E1===F4||!E1)&&clearTimeout)return E1=clearTimeout,clearTimeout(Q);try{return E1(Q)}catch($){try{return E1.call(null,Q)}catch(q){return E1.call(this,Q)}}}var i1=[],U6=!1,T2,_8=-1;function jU(){if(!U6||!T2)return;if(U6=!1,T2.length)i1=T2.concat(i1);else _8=-1;if(i1.length)a9()}function a9(){if(U6)return;var Q=o9(jU);U6=!0;var $=i1.length;while($){T2=i1,i1=[];while(++_8<$)if(T2)T2[_8].run();_8=-1,$=i1.length}T2=null,U6=!1,CU(Q)}m0.nextTick=function(Q){var $=new Array(arguments.length-1);if(arguments.length>1)for(var q=1;qBQ,once:()=>ZQ,listenerCount:()=>WQ,init:()=>W2,getMaxListeners:()=>FQ,getEventListeners:()=>GQ,default:()=>PU,captureRejectionSymbol:()=>KQ,addAbortListener:()=>MQ,EventEmitter:()=>W2});function JQ(Q,$){var{_events:q}=Q;if($[0]??=new Error("Unhandled error."),!q)throw $[0];var K=q[$Q];if(K)for(var J of QQ.call(K))J.apply(Q,$);var Z=q.error;if(!Z)throw $[0];for(var J of QQ.call(Z))J.apply(Q,$);return!0}function gU(Q,$,q,K){$.then(void 0,function(J){queueMicrotask(()=>XU(Q,J,q,K))})}function XU(Q,$,q,K){if(typeof Q[e9]==="function")Q[e9]($,q,...K);else try{Q[E2]=!1,Q.emit("error",$)}finally{Q[E2]=!0}}function UQ(Q,$,q){q.warned=!0;let K=new Error(`Possible EventEmitter memory leak detected. ${q.length} ${String($)} listeners added to [${Q.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);K.name="MaxListenersExceededWarning",K.emitter=Q,K.type=$,K.count=q.length,console.warn(K)}function VQ(Q,$,...q){this.removeListener(Q,$),$.apply(this,q)}function ZQ(Q,$,q){var K=q?.signal;if(zQ(K,"options.signal"),K?.aborted)throw new M4(void 0,{cause:K?.reason});let{resolve:J,reject:Z,promise:G}=$newPromiseCapability(Promise),B=(V)=>{if(Q.removeListener($,W),K!=null)c8(K,"abort",U);Z(V)},W=(...V)=>{if(typeof Q.removeListener==="function")Q.removeListener("error",B);if(K!=null)c8(K,"abort",U);J(V)};if(qQ(Q,$,W,{once:!0}),$!=="error"&&typeof Q.once==="function")Q.once("error",B);function U(){c8(Q,$,W),c8(Q,"error",B),Z(new M4(void 0,{cause:K?.reason}))}if(K!=null)qQ(K,"abort",U,{once:!0});return G}function GQ(Q,$){return Q.listeners($)}function BQ(Q,...$){N4(Q,"setMaxListeners",0);var q;if($&&(q=$.length))for(let K=0;KK||(q!=null||K!=null)&&Number.isNaN(Q))throw xU($,`${q!=null?`>= ${q}`:""}${q!=null&&K!=null?" && ":""}${K!=null?`<= ${K}`:""}`,Q)}function e6(Q){if(typeof Q!=="function")throw new TypeError("The listener must be a function")}function OU(Q,$){if(typeof Q!=="boolean")throw V6($,"boolean",Q)}function FQ(Q){return Q?._maxListeners??S2}function MQ(Q,$){if(Q===void 0)throw V6("signal","AbortSignal",Q);if(zQ(Q,"signal"),typeof $!=="function")throw V6("listener","function",$);let q;if(Q.aborted)queueMicrotask(()=>$());else Q.addEventListener("abort",$,{__proto__:null,once:!0}),q=()=>{Q.removeEventListener("abort",$)};return{__proto__:null,[Symbol.dispose](){q?.()}}}var w4,E2,$Q,fU,AU,e9,KQ,QQ,S2=10,W2=function Q($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[E2]=$?.captureRejections?Boolean($?.captureRejections):S0[E2])this.emit=hU},S0,yU=function Q($,...q){if($==="error")return JQ(this,q);var{_events:K}=this;if(K===void 0)return!1;var J=K[$];if(J===void 0)return!1;let Z=J.length>1?J.slice():J;for(let G=0,{length:B}=Z;G1?J.slice():J;for(let G=0,{length:B}=Z;G{w4=Symbol.for,E2=Symbol("kCapture"),$Q=w4("events.errorMonitor"),fU=Symbol("events.maxEventTargetListeners"),AU=Symbol("events.maxEventTargetListenersWarned"),e9=w4("nodejs.rejection"),KQ=w4("nodejs.rejection"),QQ=Array.prototype.slice,S0=W2.prototype={};S0._events=void 0;S0._eventsCount=0;S0._maxListeners=void 0;S0.setMaxListeners=function Q($){return N4($,"setMaxListeners",0),this._maxListeners=$,this};S0.constructor=W2;S0.getMaxListeners=function Q(){return this?._maxListeners??S2};S0.emit=yU;S0.addListener=function Q($,q){e6(q);var K=this._events;if(!K)K=this._events={__proto__:null},this._eventsCount=0;else if(K.newListener)this.emit("newListener",$,q.listener??q);var J=K[$];if(!J)K[$]=[q],this._eventsCount++;else{J.push(q);var Z=this._maxListeners??S2;if(Z>0&&J.length>Z&&!J.warned)UQ(this,$,J)}return this};S0.on=S0.addListener;S0.prependListener=function Q($,q){e6(q);var K=this._events;if(!K)K=this._events={__proto__:null},this._eventsCount=0;else if(K.newListener)this.emit("newListener",$,q.listener??q);var J=K[$];if(!J)K[$]=[q],this._eventsCount++;else{J.unshift(q);var Z=this._maxListeners??S2;if(Z>0&&J.length>Z&&!J.warned)UQ(this,$,J)}return this};S0.once=function Q($,q){e6(q);let K=VQ.bind(this,$,q);return K.listener=q,this.addListener($,K),this};S0.prependOnceListener=function Q($,q){e6(q);let K=VQ.bind(this,$,q);return K.listener=q,this.prependListener($,K),this};S0.removeListener=function Q($,q){e6(q);var{_events:K}=this;if(!K)return this;var J=K[$];if(!J)return this;var Z=J.length;let G=-1;for(let B=Z-1;B>=0;B--)if(J[B]===q||J[B].listener===q){G=B;break}if(G<0)return this;if(G===0)J.shift();else J.splice(G,1);if(J.length===0)delete K[$],this._eventsCount--;return this};S0.off=S0.removeListener;S0.removeAllListeners=function Q($){var{_events:q}=this;if($&&q){if(q[$])delete q[$],this._eventsCount--}else this._events={__proto__:null};return this};S0.listeners=function Q($){var{_events:q}=this;if(!q)return[];var K=q[$];if(!K)return[];return K.map((J)=>J.listener??J)};S0.rawListeners=function Q($){var{_events:q}=this;if(!q)return[];var K=q[$];if(!K)return[];return K.slice()};S0.listenerCount=function Q($){var{_events:q}=this;if(!q)return 0;return q[$]?.length??0};S0.eventNames=function Q(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};S0[E2]=!1;M4=class M4 extends Error{constructor(Q="The operation was aborted",$=void 0){if($!==void 0&&typeof $!=="object")throw V6("options","Object",$);super(Q,$);this.code="ABORT_ERR",this.name="AbortError"}};Object.defineProperties(W2,{captureRejections:{get(){return S0[E2]},set(Q){OU(Q,"EventEmitter.captureRejections"),S0[E2]=Q},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return S2},set:(Q)=>{N4(Q,"defaultMaxListeners",0),S2=Q}},kMaxEventTargetListeners:{value:fU,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:AU,enumerable:!1,configurable:!1,writable:!1}});Object.assign(W2,{once:ZQ,getEventListeners:GQ,getMaxListeners:FQ,setMaxListeners:BQ,EventEmitter:W2,usingDomains:!1,captureRejectionSymbol:KQ,errorMonitor:$Q,addAbortListener:MQ,init:W2,listenerCount:WQ});PU=W2});var Y4={};h2(Y4,{versions:()=>dU,version:()=>bU,umask:()=>$V,title:()=>SU,removeListener:()=>lU,removeAllListeners:()=>oU,prependOnceListener:()=>sU,prependListener:()=>rU,once:()=>pU,on:()=>mU,off:()=>iU,nextTick:()=>EU,listeners:()=>tU,env:()=>_U,emit:()=>aU,cwd:()=>QV,chdir:()=>qV,browser:()=>uU,binding:()=>eU,argv:()=>cU,addListener:()=>nU});function TU(){if(!Z6||!u2)return;if(Z6=!1,u2.length)r1=u2.concat(r1);else b8=-1;if(r1.length)wQ()}function wQ(){if(Z6)return;var Q=setTimeout(TU,0);Z6=!0;var $=r1.length;while($){u2=r1,r1=[];while(++b8<$)if(u2){var q=u2[b8];q.fun.apply(null,q.array)}b8=-1,$=r1.length}u2=null,Z6=!1,clearTimeout(Q,0)}function EU(Q){var $=new Array(arguments.length-1);if(arguments.length>1)for(var q=1;q{r1=[];_U={},cU=[],dU={};mU=s1,nU=s1,pU=s1,iU=s1,lU=s1,oU=s1,aU=s1,rU=s1,sU=s1});var p8=N0((nz,IQ)=>{var x0=(Q,$)=>()=>($||Q(($={exports:{}}).exports,$),$.exports),_0=x0((Q,$)=>{class q extends Error{constructor(K){if(!Array.isArray(K))throw new TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{$.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"{}"}}}}),K1=x0((Q,$)=>{var{format:q,inspect:K}=NQ(),{AggregateError:J}=_0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),B=["string","function","number","object","Function","Object","boolean","bigint","symbol"],W=/^([A-Z][a-z0-9]*)+$/,U={};function V(D,z){if(!D)throw new U.ERR_INTERNAL_ASSERTION(z)}function N(D){let z="",Y=D.length,H=D[0]==="-"?1:0;for(;Y>=H+4;Y-=3)z=`_${D.slice(Y-3,Y)}${z}`;return`${D.slice(0,Y)}${z}`}function F(D,z,Y){if(typeof z==="function")return V(z.length<=Y.length,`Code: ${D}; The provided arguments length (${Y.length}) does not match the required ones (${z.length}).`),z(...Y);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(V(H===Y.length,`Code: ${D}; The provided arguments length (${Y.length}) does not match the required ones (${H}).`),Y.length===0)return z;return q(z,...Y)}function M(D,z,Y){if(!Y)Y=Error;class H extends Y{constructor(...R){super(F(D,z,R))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:Y.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,U[D]=H}function v(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function x(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let Y=new Z([z,D],z.message);return Y.code=z.code,Y}return D||z}class y extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new U.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,Y)=>{if(V(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 R=[],c=[],m=[];for(let _ of z)if(V(typeof _==="string","All expected entries have to be of type string"),B.includes(_))R.push(_.toLowerCase());else if(W.test(_))c.push(_);else V(_!=="object",'The value "object" should be written as "Object"'),m.push(_);if(c.length>0){let _=R.indexOf("object");if(_!==-1)R.splice(R,_,1),c.push("Object")}if(R.length>0){switch(R.length){case 1:H+=`of type ${R[0]}`;break;case 2:H+=`one of type ${R[0]} or ${R[1]}`;break;default:{let _=R.pop();H+=`one of type ${R.join(", ")}, or ${_}`}}if(c.length>0||m.length>0)H+=" or "}if(c.length>0){switch(c.length){case 1:H+=`an instance of ${c[0]}`;break;case 2:H+=`an instance of ${c[0]} or ${c[1]}`;break;default:{let _=c.pop();H+=`an instance of ${c.join(", ")}, or ${_}`}}if(m.length>0)H+=" or "}switch(m.length){case 0:break;case 1:if(m[0].toLowerCase()!==m[0])H+="an ";H+=`${m[0]}`;break;case 2:H+=`one of ${m[0]} or ${m[1]}`;break;default:{let _=m.pop();H+=`one of ${m.join(", ")}, or ${_}`}}if(Y==null)H+=`. Received ${Y}`;else if(typeof Y==="function"&&Y.name)H+=`. Received function ${Y.name}`;else if(typeof Y==="object"){var $0;if(($0=Y.constructor)!==null&&$0!==void 0&&$0.name)H+=`. Received an instance of ${Y.constructor.name}`;else{let _=K(Y,{depth:-1});H+=`. Received ${_}`}}else{let _=K(Y,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof Y} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,Y="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${Y}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,Y)=>{var H;let R=Y!==null&&Y!==void 0&&(H=Y.constructor)!==null&&H!==void 0&&H.name?`instance of ${Y.constructor.name}`:`type ${typeof Y}`;return`Expected ${D} to be returned from the "${z}" function but got ${R}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{V(D.length>0,"At least one arg needs to be specified");let z,Y=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),Y){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,Y)=>{V(z,'Missing "range" argument');let H;if(Number.isInteger(Y)&&Math.abs(Y)>4294967296)H=N(String(Y));else if(typeof Y==="bigint"){H=String(Y);let R=BigInt(2)**BigInt(32);if(Y>R||Y<-R)H=N(H);H+="n"}else H=K(Y);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),$.exports={AbortError:y,aggregateTwoErrors:v(x),hideStackFrames:v,codes:U}}),KV=x0((Q,$)=>{Object.defineProperty(Q,"__esModule",{value:!0});var q=new WeakMap,K=new WeakMap;function J(g){let O=q.get(g);return console.assert(O!=null,"'this' is expected an Event object, but got",g),O}function Z(g){if(g.passiveListener!=null){if(typeof console!=="undefined"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",g.passiveListener);return}if(!g.event.cancelable)return;if(g.canceled=!0,typeof g.event.preventDefault==="function")g.event.preventDefault()}function G(g,O){q.set(this,{eventTarget:g,event:O,eventPhase:2,currentTarget:g,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:O.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let h=Object.keys(O);for(let f=0;f0){let g=new Array(arguments.length);for(let O=0;O{Object.defineProperty(Q,"__esModule",{value:!0});var q=KV();class K extends q.EventTarget{constructor(){super();throw new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let V=G.get(this);if(typeof V!=="boolean")throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return V}}q.defineEventAttribute(K.prototype,"abort");function J(){let V=Object.create(K.prototype);return q.EventTarget.call(V),G.set(V,!1),V}function Z(V){if(G.get(V)!==!1)return;G.set(V,!0),V.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 B{constructor(){W.set(this,J())}get signal(){return U(this)}abort(){Z(U(this))}}var W=new WeakMap;function U(V){let N=W.get(V);if(N==null)throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${V===null?"null":typeof V}`);return N}if(Object.defineProperties(B.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(B.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});Q.AbortController=B,Q.AbortSignal=K,Q.default=B,$.exports=B,$.exports.AbortController=$.exports.default=B,$.exports.AbortSignal=K}),G1=x0((Q,$)=>{var q=(a0(),y0(s0)),{format:K,inspect:J}=NQ(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=K1(),{kResistStopPropagation:G,AggregateError:B,SymbolDispose:W}=_0(),U=globalThis.AbortSignal||Q8().AbortSignal,V=globalThis.AbortController||Q8().AbortController,N=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||q.Blob,M=typeof F!=="undefined"?function y(D){return D instanceof F}:function y(D){return!1},v=(y,D)=>{if(y!==void 0&&(y===null||typeof y!=="object"||!("aborted"in y)))throw new Z(D,"AbortSignal",y)},x=(y,D)=>{if(typeof y!=="function")throw new Z(D,"Function",y)};$.exports={AggregateError:B,kEmptyObject:Object.freeze({}),once(y){let D=!1;return function(...z){if(D)return;D=!0,y.apply(this,z)}},createDeferredPromise:function(){let y,D;return{promise:new Promise((z,Y)=>{y=z,D=Y}),resolve:y,reject:D}},promisify(y){return new Promise((D,z)=>{y((Y,...H)=>{if(Y)return z(Y);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(y){return y instanceof N},isArrayBufferView(y){return ArrayBuffer.isView(y)}},isBlob:M,deprecate(y,D){return y},addAbortListener:(a1(),y0(o1)).addAbortListener||function y(D,z){if(D===void 0)throw new Z("signal","AbortSignal",D);v(D,"signal"),x(z,"listener");let Y;if(D.aborted)queueMicrotask(()=>z());else D.addEventListener("abort",z,{__proto__:null,once:!0,[G]:!0}),Y=()=>{D.removeEventListener("abort",z)};return{__proto__:null,[W](){var H;(H=Y)===null||H===void 0||H()}}},AbortSignalAny:U.any||function y(D){if(D.length===1)return D[0];let z=new V,Y=()=>z.abort();return D.forEach((H)=>{v(H,"signals"),H.addEventListener("abort",Y,{once:!0})}),z.signal.addEventListener("abort",()=>{D.forEach((H)=>H.removeEventListener("abort",Y))},{once:!0}),z.signal}},$.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),q8=x0((Q,$)=>{var{ArrayIsArray:q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:B,NumberMAX_SAFE_INTEGER:W,NumberMIN_SAFE_INTEGER:U,NumberParseInt:V,ObjectPrototypeHasOwnProperty:N,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:v,StringPrototypeTrim:x}=_0(),{hideStackFrames:y,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:Y,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:R}}=K1(),{normalizeEncoding:c}=G1(),{isAsyncFunction:m,isArrayBufferView:$0}=G1().types,_={};function g(j){return j===(j|0)}function O(j){return j===j>>>0}var h=/^[0-7]+$/,f="must be a 32-bit unsigned integer or an octal string";function A(j,d,e){if(typeof j==="undefined")j=e;if(typeof j==="string"){if(F(h,j)===null)throw new Y(d,j,f);j=V(j,8)}return i(j,d),j}var I=y((j,d,e=U,p=W)=>{if(typeof j!=="number")throw new z(d,"number",j);if(!G(j))throw new H(d,"an integer",j);if(jp)throw new H(d,`>= ${e} && <= ${p}`,j)}),n=y((j,d,e=-2147483648,p=2147483647)=>{if(typeof j!=="number")throw new z(d,"number",j);if(!G(j))throw new H(d,"an integer",j);if(jp)throw new H(d,`>= ${e} && <= ${p}`,j)}),i=y((j,d,e=!1)=>{if(typeof j!=="number")throw new z(d,"number",j);if(!G(j))throw new H(d,"an integer",j);let p=e?1:0,G0=4294967295;if(jG0)throw new H(d,`>= ${p} && <= ${G0}`,j)});function K0(j,d){if(typeof j!=="string")throw new z(d,"string",j)}function z0(j,d,e=void 0,p){if(typeof j!=="number")throw new z(d,"number",j);if(e!=null&&jp||(e!=null||p!=null)&&B(j))throw new H(d,`${e!=null?`>= ${e}`:""}${e!=null&&p!=null?" && ":""}${p!=null?`<= ${p}`:""}`,j)}var S=y((j,d,e)=>{if(!K(e,j)){let p="must be one of: "+J(Z(e,(G0)=>typeof G0==="string"?`'${G0}'`:M(G0)),", ");throw new Y(d,j,p)}});function U0(j,d){if(typeof j!=="boolean")throw new z(d,"boolean",j)}function k(j,d,e){return j==null||!N(j,d)?e:j[d]}var u=y((j,d,e=null)=>{let p=k(e,"allowArray",!1),G0=k(e,"allowFunction",!1);if(!k(e,"nullable",!1)&&j===null||!p&&q(j)||typeof j!=="object"&&(!G0||typeof j!=="function"))throw new z(d,"Object",j)}),Q0=y((j,d)=>{if(j!=null&&typeof j!=="object"&&typeof j!=="function")throw new z(d,"a dictionary",j)}),E=y((j,d,e=0)=>{if(!q(j))throw new z(d,"Array",j);if(j.length{if(!$0(j))throw new z(d,["Buffer","TypedArray","DataView"],j)});function T(j,d){let e=c(d),p=j.length;if(e==="hex"&&p%2!==0)throw new Y("encoding",d,`is invalid for data of length ${p}`)}function t(j,d="Port",e=!0){if(typeof j!=="number"&&typeof j!=="string"||typeof j==="string"&&x(j).length===0||+j!==+j>>>0||j>65535||j===0&&!e)throw new D(d,j,e);return j|0}var Z0=y((j,d)=>{if(j!==void 0&&(j===null||typeof j!=="object"||!("aborted"in j)))throw new z(d,"AbortSignal",j)}),W0=y((j,d)=>{if(typeof j!=="function")throw new z(d,"Function",j)}),C=y((j,d)=>{if(typeof j!=="function"||m(j))throw new z(d,"Function",j)}),X=y((j,d)=>{if(j!==void 0)throw new z(d,"undefined",j)});function P(j,d,e){if(!K(e,j))throw new z(d,`('${J(e,"|")}')`,j)}var o=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(j,d){if(typeof j==="undefined"||!F(o,j))throw new Y(d,j,'must be an array or string of format "; rel=preload; as=style"')}function l(j){if(typeof j==="string")return r(j,"hints"),j;else if(q(j)){let d=j.length,e="";if(d===0)return e;for(let p=0;p; rel=preload; as=style"')}$.exports={isInt32:g,isUint32:O,parseFileMode:A,validateArray:E,validateStringArray:q0,validateBooleanArray:B0,validateAbortSignalArray:w0,validateBoolean:U0,validateBuffer:b,validateDictionary:Q0,validateEncoding:T,validateFunction:W0,validateInt32:n,validateInteger:I,validateNumber:z0,validateObject:u,validateOneOf:S,validatePlainFunction:C,validatePort:t,validateSignalName:M0,validateString:K0,validateUint32:i,validateUndefined:X,validateUnion:P,validateAbortSignal:Z0,validateLinkHeaderValue:l}}),_2=x0((Q,$)=>{$.exports=(L4(),y0(Y4))}),e1=x0((Q,$)=>{var{SymbolAsyncIterator:q,SymbolIterator:K,SymbolFor:J}=_0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),B=J("nodejs.stream.readable"),W=J("nodejs.stream.writable"),U=J("nodejs.stream.disturbed"),V=J("nodejs.webstream.isClosedPromise"),N=J("nodejs.webstream.controllerErrorFunction");function F(k,u=!1){var Q0;return!!(k&&typeof k.pipe==="function"&&typeof k.on==="function"&&(!u||typeof k.pause==="function"&&typeof k.resume==="function")&&(!k._writableState||((Q0=k._readableState)===null||Q0===void 0?void 0:Q0.readable)!==!1)&&(!k._writableState||k._readableState))}function M(k){var u;return!!(k&&typeof k.write==="function"&&typeof k.on==="function"&&(!k._readableState||((u=k._writableState)===null||u===void 0?void 0:u.writable)!==!1))}function v(k){return!!(k&&typeof k.pipe==="function"&&k._readableState&&typeof k.on==="function"&&typeof k.write==="function")}function x(k){return k&&(k._readableState||k._writableState||typeof k.write==="function"&&typeof k.on==="function"||typeof k.pipe==="function"&&typeof k.on==="function")}function y(k){return!!(k&&!x(k)&&typeof k.pipeThrough==="function"&&typeof k.getReader==="function"&&typeof k.cancel==="function")}function D(k){return!!(k&&!x(k)&&typeof k.getWriter==="function"&&typeof k.abort==="function")}function z(k){return!!(k&&!x(k)&&typeof k.readable==="object"&&typeof k.writable==="object")}function Y(k){return y(k)||D(k)||z(k)}function H(k,u){if(k==null)return!1;if(u===!0)return typeof k[q]==="function";if(u===!1)return typeof k[K]==="function";return typeof k[q]==="function"||typeof k[K]==="function"}function R(k){if(!x(k))return null;let{_writableState:u,_readableState:Q0}=k,E=u||Q0;return!!(k.destroyed||k[Z]||E!==null&&E!==void 0&&E.destroyed)}function c(k){if(!M(k))return null;if(k.writableEnded===!0)return!0;let u=k._writableState;if(u!==null&&u!==void 0&&u.errored)return!1;if(typeof(u===null||u===void 0?void 0:u.ended)!=="boolean")return null;return u.ended}function m(k,u){if(!M(k))return null;if(k.writableFinished===!0)return!0;let Q0=k._writableState;if(Q0!==null&&Q0!==void 0&&Q0.errored)return!1;if(typeof(Q0===null||Q0===void 0?void 0:Q0.finished)!=="boolean")return null;return!!(Q0.finished||u===!1&&Q0.ended===!0&&Q0.length===0)}function $0(k){if(!F(k))return null;if(k.readableEnded===!0)return!0;let u=k._readableState;if(!u||u.errored)return!1;if(typeof(u===null||u===void 0?void 0:u.ended)!=="boolean")return null;return u.ended}function _(k,u){if(!F(k))return null;let Q0=k._readableState;if(Q0!==null&&Q0!==void 0&&Q0.errored)return!1;if(typeof(Q0===null||Q0===void 0?void 0:Q0.endEmitted)!=="boolean")return null;return!!(Q0.endEmitted||u===!1&&Q0.ended===!0&&Q0.length===0)}function g(k){if(k&&k[B]!=null)return k[B];if(typeof(k===null||k===void 0?void 0:k.readable)!=="boolean")return null;if(R(k))return!1;return F(k)&&k.readable&&!_(k)}function O(k){if(k&&k[W]!=null)return k[W];if(typeof(k===null||k===void 0?void 0:k.writable)!=="boolean")return null;if(R(k))return!1;return M(k)&&k.writable&&!c(k)}function h(k,u){if(!x(k))return null;if(R(k))return!0;if((u===null||u===void 0?void 0:u.readable)!==!1&&g(k))return!1;if((u===null||u===void 0?void 0:u.writable)!==!1&&O(k))return!1;return!0}function f(k){var u,Q0;if(!x(k))return null;if(k.writableErrored)return k.writableErrored;return(u=(Q0=k._writableState)===null||Q0===void 0?void 0:Q0.errored)!==null&&u!==void 0?u:null}function A(k){var u,Q0;if(!x(k))return null;if(k.readableErrored)return k.readableErrored;return(u=(Q0=k._readableState)===null||Q0===void 0?void 0:Q0.errored)!==null&&u!==void 0?u:null}function I(k){if(!x(k))return null;if(typeof k.closed==="boolean")return k.closed;let{_writableState:u,_readableState:Q0}=k;if(typeof(u===null||u===void 0?void 0:u.closed)==="boolean"||typeof(Q0===null||Q0===void 0?void 0:Q0.closed)==="boolean")return(u===null||u===void 0?void 0:u.closed)||(Q0===null||Q0===void 0?void 0:Q0.closed);if(typeof k._closed==="boolean"&&n(k))return k._closed;return null}function n(k){return typeof k._closed==="boolean"&&typeof k._defaultKeepAlive==="boolean"&&typeof k._removedConnection==="boolean"&&typeof k._removedContLen==="boolean"}function i(k){return typeof k._sent100==="boolean"&&n(k)}function K0(k){var u;return typeof k._consuming==="boolean"&&typeof k._dumped==="boolean"&&((u=k.req)===null||u===void 0?void 0:u.upgradeOrConnect)===void 0}function z0(k){if(!x(k))return null;let{_writableState:u,_readableState:Q0}=k,E=u||Q0;return!E&&i(k)||!!(E&&E.autoDestroy&&E.emitClose&&E.closed===!1)}function S(k){var u;return!!(k&&((u=k[U])!==null&&u!==void 0?u:k.readableDidRead||k.readableAborted))}function U0(k){var u,Q0,E,q0,B0,w0,M0,b,T,t;return!!(k&&((u=(Q0=(E=(q0=(B0=(w0=k[G])!==null&&w0!==void 0?w0:k.readableErrored)!==null&&B0!==void 0?B0:k.writableErrored)!==null&&q0!==void 0?q0:(M0=k._readableState)===null||M0===void 0?void 0:M0.errorEmitted)!==null&&E!==void 0?E:(b=k._writableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&Q0!==void 0?Q0:(T=k._readableState)===null||T===void 0?void 0:T.errored)!==null&&u!==void 0?u:(t=k._writableState)===null||t===void 0?void 0:t.errored))}$.exports={isDestroyed:R,kIsDestroyed:Z,isDisturbed:S,kIsDisturbed:U,isErrored:U0,kIsErrored:G,isReadable:g,kIsReadable:B,kIsClosedPromise:V,kControllerErrorFunction:N,kIsWritable:W,isClosed:I,isDuplexNodeStream:v,isFinished:h,isIterable:H,isReadableNodeStream:F,isReadableStream:y,isReadableEnded:$0,isReadableFinished:_,isReadableErrored:A,isNodeStream:x,isWebStream:Y,isWritable:O,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:c,isWritableFinished:m,isWritableErrored:f,isServerRequest:K0,isServerResponse:i,willEmitClose:z0,isTransformStream:z}}),z2=x0((Q,$)=>{var q=_2(),{AbortError:K,codes:J}=K1(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:B,once:W}=G1(),{validateAbortSignal:U,validateFunction:V,validateObject:N,validateBoolean:F}=q8(),{Promise:M,PromisePrototypeThen:v,SymbolDispose:x}=_0(),{isClosed:y,isReadable:D,isReadableNodeStream:z,isReadableStream:Y,isReadableFinished:H,isReadableErrored:R,isWritable:c,isWritableNodeStream:m,isWritableStream:$0,isWritableFinished:_,isWritableErrored:g,isNodeStream:O,willEmitClose:h,kIsClosedPromise:f}=e1(),A;function I(S){return S.setHeader&&typeof S.abort==="function"}var n=()=>{};function i(S,U0,k){var u,Q0;if(arguments.length===2)k=U0,U0=B;else if(U0==null)U0=B;else N(U0,"options");if(V(k,"callback"),U(U0.signal,"options.signal"),k=W(k),Y(S)||$0(S))return K0(S,U0,k);if(!O(S))throw new Z("stream",["ReadableStream","WritableStream","Stream"],S);let E=(u=U0.readable)!==null&&u!==void 0?u:z(S),q0=(Q0=U0.writable)!==null&&Q0!==void 0?Q0:m(S),B0=S._writableState,w0=S._readableState,M0=()=>{if(!S.writable)t()},b=h(S)&&z(S)===E&&m(S)===q0,T=_(S,!1),t=()=>{if(T=!0,S.destroyed)b=!1;if(b&&(!S.readable||E))return;if(!E||Z0)k.call(S)},Z0=H(S,!1),W0=()=>{if(Z0=!0,S.destroyed)b=!1;if(b&&(!S.writable||q0))return;if(!q0||T)k.call(S)},C=(j)=>{k.call(S,j)},X=y(S),P=()=>{X=!0;let j=g(S)||R(S);if(j&&typeof j!=="boolean")return k.call(S,j);if(E&&!Z0&&z(S,!0)){if(!H(S,!1))return k.call(S,new G)}if(q0&&!T){if(!_(S,!1))return k.call(S,new G)}k.call(S)},o=()=>{X=!0;let j=g(S)||R(S);if(j&&typeof j!=="boolean")return k.call(S,j);k.call(S)},r=()=>{S.req.on("finish",t)};if(I(S)){if(S.on("complete",t),!b)S.on("abort",P);if(S.req)r();else S.on("request",r)}else if(q0&&!B0)S.on("end",M0),S.on("close",M0);if(!b&&typeof S.aborted==="boolean")S.on("aborted",P);if(S.on("end",W0),S.on("finish",t),U0.error!==!1)S.on("error",C);if(S.on("close",P),X)q.nextTick(P);else if(B0!==null&&B0!==void 0&&B0.errorEmitted||w0!==null&&w0!==void 0&&w0.errorEmitted){if(!b)q.nextTick(o)}else if(!E&&(!b||D(S))&&(T||c(S)===!1))q.nextTick(o);else if(!q0&&(!b||c(S))&&(Z0||D(S)===!1))q.nextTick(o);else if(w0&&S.req&&S.aborted)q.nextTick(o);let l=()=>{if(k=n,S.removeListener("aborted",P),S.removeListener("complete",t),S.removeListener("abort",P),S.removeListener("request",r),S.req)S.req.removeListener("finish",t);S.removeListener("end",M0),S.removeListener("close",M0),S.removeListener("finish",t),S.removeListener("end",W0),S.removeListener("error",C),S.removeListener("close",P)};if(U0.signal&&!X){let j=()=>{let d=k;l(),d.call(S,new K(void 0,{cause:U0.signal.reason}))};if(U0.signal.aborted)q.nextTick(j);else{A=A||G1().addAbortListener;let d=A(U0.signal,j),e=k;k=W((...p)=>{d[x](),e.apply(S,p)})}}return l}function K0(S,U0,k){let u=!1,Q0=n;if(U0.signal)if(Q0=()=>{u=!0,k.call(S,new K(void 0,{cause:U0.signal.reason}))},U0.signal.aborted)q.nextTick(Q0);else{A=A||G1().addAbortListener;let q0=A(U0.signal,Q0),B0=k;k=W((...w0)=>{q0[x](),B0.apply(S,w0)})}let E=(...q0)=>{if(!u)q.nextTick(()=>k.apply(S,q0))};return v(S[f].promise,E,E),n}function z0(S,U0){var k;let u=!1;if(U0===null)U0=B;if((k=U0)!==null&&k!==void 0&&k.cleanup)F(U0.cleanup,"cleanup"),u=U0.cleanup;return new M((Q0,E)=>{let q0=i(S,U0,(B0)=>{if(u)q0();if(B0)E(B0);else Q0()})})}$.exports=i,$.exports.finished=z0}),G6=x0((Q,$)=>{var q=_2(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=K1(),{Symbol:G}=_0(),{kIsDestroyed:B,isDestroyed:W,isFinished:U,isServerRequest:V}=e1(),N=G("kDestroy"),F=G("kConstruct");function M(h,f,A){if(h){if(h.stack,f&&!f.errored)f.errored=h;if(A&&!A.errored)A.errored=h}}function v(h,f){let A=this._readableState,I=this._writableState,n=I||A;if(I!==null&&I!==void 0&&I.destroyed||A!==null&&A!==void 0&&A.destroyed){if(typeof f==="function")f();return this}if(M(h,I,A),I)I.destroyed=!0;if(A)A.destroyed=!0;if(!n.constructed)this.once(N,function(i){x(this,K(i,h),f)});else x(this,h,f);return this}function x(h,f,A){let I=!1;function n(i){if(I)return;I=!0;let{_readableState:K0,_writableState:z0}=h;if(M(i,z0,K0),z0)z0.closed=!0;if(K0)K0.closed=!0;if(typeof A==="function")A(i);if(i)q.nextTick(y,h,i);else q.nextTick(D,h)}try{h._destroy(f||null,n)}catch(i){n(i)}}function y(h,f){z(h,f),D(h)}function D(h){let{_readableState:f,_writableState:A}=h;if(A)A.closeEmitted=!0;if(f)f.closeEmitted=!0;if(A!==null&&A!==void 0&&A.emitClose||f!==null&&f!==void 0&&f.emitClose)h.emit("close")}function z(h,f){let{_readableState:A,_writableState:I}=h;if(I!==null&&I!==void 0&&I.errorEmitted||A!==null&&A!==void 0&&A.errorEmitted)return;if(I)I.errorEmitted=!0;if(A)A.errorEmitted=!0;h.emit("error",f)}function Y(){let h=this._readableState,f=this._writableState;if(h)h.constructed=!0,h.closed=!1,h.closeEmitted=!1,h.destroyed=!1,h.errored=null,h.errorEmitted=!1,h.reading=!1,h.ended=h.readable===!1,h.endEmitted=h.readable===!1;if(f)f.constructed=!0,f.destroyed=!1,f.closed=!1,f.closeEmitted=!1,f.errored=null,f.errorEmitted=!1,f.finalCalled=!1,f.prefinished=!1,f.ended=f.writable===!1,f.ending=f.writable===!1,f.finished=f.writable===!1}function H(h,f,A){let{_readableState:I,_writableState:n}=h;if(n!==null&&n!==void 0&&n.destroyed||I!==null&&I!==void 0&&I.destroyed)return this;if(I!==null&&I!==void 0&&I.autoDestroy||n!==null&&n!==void 0&&n.autoDestroy)h.destroy(f);else if(f){if(f.stack,n&&!n.errored)n.errored=f;if(I&&!I.errored)I.errored=f;if(A)q.nextTick(z,h,f);else z(h,f)}}function R(h,f){if(typeof h._construct!=="function")return;let{_readableState:A,_writableState:I}=h;if(A)A.constructed=!1;if(I)I.constructed=!1;if(h.once(F,f),h.listenerCount(F)>1)return;q.nextTick(c,h)}function c(h){let f=!1;function A(I){if(f){H(h,I!==null&&I!==void 0?I:new J);return}f=!0;let{_readableState:n,_writableState:i}=h,K0=i||n;if(n)n.constructed=!0;if(i)i.constructed=!0;if(K0.destroyed)h.emit(N,I);else if(I)H(h,I,!0);else q.nextTick(m,h)}try{h._construct((I)=>{q.nextTick(A,I)})}catch(I){q.nextTick(A,I)}}function m(h){h.emit(F)}function $0(h){return(h===null||h===void 0?void 0:h.setHeader)&&typeof h.abort==="function"}function _(h){h.emit("close")}function g(h,f){h.emit("error",f),q.nextTick(_,h)}function O(h,f){if(!h||W(h))return;if(!f&&!U(h))f=new Z;if(V(h))h.socket=null,h.destroy(f);else if($0(h))h.abort();else if($0(h.req))h.req.abort();else if(typeof h.destroy==="function")h.destroy(f);else if(typeof h.close==="function")h.close();else if(f)q.nextTick(g,h,f);else q.nextTick(_,h);if(!h.destroyed)h[B]=!0}$.exports={construct:R,destroyer:O,destroy:v,undestroy:Y,errorOrDestroy:H}}),D4=x0((Q,$)=>{var{ArrayIsArray:q,ObjectSetPrototypeOf:K}=_0(),{EventEmitter:J}=(a1(),y0(o1));function Z(B){J.call(this,B)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(B,W){let U=this;function V(D){if(B.writable&&B.write(D)===!1&&U.pause)U.pause()}U.on("data",V);function N(){if(U.readable&&U.resume)U.resume()}if(B.on("drain",N),!B._isStdio&&(!W||W.end!==!1))U.on("end",M),U.on("close",v);let F=!1;function M(){if(F)return;F=!0,B.end()}function v(){if(F)return;if(F=!0,typeof B.destroy==="function")B.destroy()}function x(D){if(y(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(U,"error",x),G(B,"error",x);function y(){U.removeListener("data",V),B.removeListener("drain",N),U.removeListener("end",M),U.removeListener("close",v),U.removeListener("error",x),B.removeListener("error",x),U.removeListener("end",y),U.removeListener("close",y),B.removeListener("close",y)}return U.on("end",y),U.on("close",y),B.on("close",y),B.emit("pipe",U),B};function G(B,W,U){if(typeof B.prependListener==="function")return B.prependListener(W,U);if(!B._events||!B._events[W])B.on(W,U);else if(q(B._events[W]))B._events[W].unshift(U);else B._events[W]=[U,B._events[W]]}$.exports={Stream:Z,prependListener:G}}),d8=x0((Q,$)=>{var{SymbolDispose:q}=_0(),{AbortError:K,codes:J}=K1(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:B}=e1(),W=z2(),{ERR_INVALID_ARG_TYPE:U}=J,V,N=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new U(M,"AbortSignal",F)};$.exports.addAbortSignal=function F(M,v){if(N(M,"signal"),!Z(v)&&!G(v))throw new U("stream",["ReadableStream","WritableStream","Stream"],v);return $.exports.addAbortSignalNoValidate(M,v)},$.exports.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let v=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[B](new K(void 0,{cause:F.reason}))};if(F.aborted)v();else{V=V||G1().addAbortListener;let x=V(F,v);W(M,x[q])}return M}}),JV=x0((Q,$)=>{var{StringPrototypeSlice:q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=_0(),{Buffer:G}=(a0(),y0(s0)),{inspect:B}=G1();$.exports=class W{constructor(){this.head=null,this.tail=null,this.length=0}push(U){let V={data:U,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(U){let V={data:U,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let U=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,U}clear(){this.head=this.tail=null,this.length=0}join(U){if(this.length===0)return"";let V=this.head,N=""+V.data;while((V=V.next)!==null)N+=U+V.data;return N}concat(U){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(U>>>0),N=this.head,F=0;while(N)J(V,N.data,F),F+=N.data.length,N=N.next;return V}consume(U,V){let N=this.head.data;if(UM.length)V+=M,U-=M.length;else{if(U===M.length)if(V+=M,++F,N.next)this.head=N.next;else this.head=this.tail=null;else V+=q(M,0,U),this.head=N,N.data=q(M,U);break}++F}while((N=N.next)!==null);return this.length-=F,V}_getBuffer(U){let V=G.allocUnsafe(U),N=U,F=this.head,M=0;do{let v=F.data;if(U>v.length)J(V,v,N-U),U-=v.length;else{if(U===v.length)if(J(V,v,N-U),++M,F.next)this.head=F.next;else this.head=this.tail=null;else J(V,new Z(v.buffer,v.byteOffset,U),N-U),this.head=F,F.data=v.slice(U);break}++M}while((F=F.next)!==null);return this.length-=M,V}[Symbol.for("nodejs.util.inspect.custom")](U,V){return B(this,{...V,depth:0,customInspect:!1})}}}),m8=x0((Q,$)=>{var{MathFloor:q,NumberIsInteger:K}=_0(),{validateInteger:J}=q8(),{ERR_INVALID_ARG_VALUE:Z}=K1().codes,G=16384,B=16;function W(F,M,v){return F.highWaterMark!=null?F.highWaterMark:M?F[v]:null}function U(F){return F?B:G}function V(F,M){if(J(M,"value",0),F)B=M;else G=M}function N(F,M,v,x){let y=W(M,x,v);if(y!=null){if(!K(y)||y<0){let D=x?`options.${v}`:"options.highWaterMark";throw new Z(D,y)}return q(y)}return U(F.objectMode)}$.exports={getHighWaterMark:N,getDefaultHighWaterMark:U,setDefaultHighWaterMark:V}}),UV=x0((Q,$)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var q=(a0(),y0(s0)),K=q.Buffer;function J(G,B){for(var W in G)B[W]=G[W]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)$.exports=q;else J(q,Q),Q.Buffer=Z;function Z(G,B,W){return K(G,B,W)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,B,W){if(typeof G==="number")throw new TypeError("Argument must not be a number");return K(G,B,W)},Z.alloc=function(G,B,W){if(typeof G!=="number")throw new TypeError("Argument must be a number");var U=K(G);if(B!==void 0)if(typeof W==="string")U.fill(B,W);else U.fill(B);else U.fill(0);return U},Z.allocUnsafe=function(G){if(typeof G!=="number")throw new TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw new TypeError("Argument must be a number");return q.SlowBuffer(G)}}),VV=x0((Q)=>{var $=UV().Buffer,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 Y;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(Y)return;z=(""+z).toLowerCase(),Y=!0}}function J(z){var Y=K(z);if(typeof Y!=="string"&&($.isEncoding===q||!q(z)))throw new Error("Unknown encoding: "+z);return Y||z}Q.StringDecoder=Z;function Z(z){this.encoding=J(z);var Y;switch(this.encoding){case"utf16le":this.text=F,this.end=M,Y=4;break;case"utf8":this.fillLast=U,Y=4;break;case"base64":this.text=v,this.end=x,Y=3;break;default:this.write=y,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=$.allocUnsafe(Y)}Z.prototype.write=function(z){if(z.length===0)return"";var Y,H;if(this.lastNeed){if(Y=this.fillLast(z),Y===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 B(z,Y,H){var R=Y.length-1;if(R=0){if(c>0)z.lastNeed=c-1;return c}if(--R=0){if(c>0)z.lastNeed=c-2;return c}if(--R=0){if(c>0)if(c===2)c=0;else z.lastNeed=c-3;return c}return 0}function W(z,Y,H){if((Y[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&Y.length>1){if((Y[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&Y.length>2){if((Y[2]&192)!==128)return z.lastNeed=2,"�"}}}function U(z){var Y=this.lastTotal-this.lastNeed,H=W(this,z,Y);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,Y,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,Y,0,z.length),this.lastNeed-=z.length}function V(z,Y){var H=B(this,z,Y);if(!this.lastNeed)return z.toString("utf8",Y);this.lastTotal=H;var R=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,R),z.toString("utf8",Y,R)}function N(z){var Y=z&&z.length?this.write(z):"";if(this.lastNeed)return Y+"�";return Y}function F(z,Y){if((z.length-Y)%2===0){var H=z.toString("utf16le",Y);if(H){var R=H.charCodeAt(H.length-1);if(R>=55296&&R<=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",Y,z.length-1)}function M(z){var Y=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return Y+this.lastChar.toString("utf16le",0,H)}return Y}function v(z,Y){var H=(z.length-Y)%3;if(H===0)return z.toString("base64",Y);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",Y,z.length-H)}function x(z){var Y=z&&z.length?this.write(z):"";if(this.lastNeed)return Y+this.lastChar.toString("base64",0,3-this.lastNeed);return Y}function y(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),YQ=x0((Q,$)=>{var q=_2(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=_0(),{Buffer:G}=(a0(),y0(s0)),{ERR_INVALID_ARG_TYPE:B,ERR_STREAM_NULL_VALUES:W}=K1().codes;function U(V,N,F){let M;if(typeof N==="string"||N instanceof G)return new V({objectMode:!0,...F,read(){this.push(N),this.push(null)}});let v;if(N&&N[J])v=!0,M=N[J]();else if(N&&N[Z])v=!1,M=N[Z]();else throw new B("iterable",["Iterable"],N);let x=new V({objectMode:!0,highWaterMark:1,...F}),y=!1;x._read=function(){if(!y)y=!0,z()},x._destroy=function(Y,H){K(D(Y),()=>q.nextTick(H,Y),(R)=>q.nextTick(H,R||Y))};async function D(Y){let H=Y!==void 0&&Y!==null,R=typeof M.throw==="function";if(H&&R){let{value:c,done:m}=await M.throw(Y);if(await c,m)return}if(typeof M.return==="function"){let{value:c}=await M.return();await c}}async function z(){for(;;){try{let{value:Y,done:H}=v?await M.next():M.next();if(H)x.push(null);else{let R=Y&&typeof Y.then==="function"?await Y:Y;if(R===null)throw y=!1,new W;else if(x.push(R))continue;else y=!1}}catch(Y){x.destroy(Y)}break}}return x}$.exports=U}),n8=x0((Q,$)=>{var q=_2(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:B,ObjectKeys:W,ObjectSetPrototypeOf:U,Promise:V,SafeSet:N,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:v}=_0();$.exports=p,p.ReadableState=e;var{EventEmitter:x}=(a1(),y0(o1)),{Stream:y,prependListener:D}=D4(),{Buffer:z}=(a0(),y0(s0)),{addAbortSignal:Y}=d8(),H=z2(),R=G1().debuglog("stream",(w)=>{R=w}),c=JV(),m=G6(),{getHighWaterMark:$0,getDefaultHighWaterMark:_}=m8(),{aggregateTwoErrors:g,codes:{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:h,ERR_OUT_OF_RANGE:f,ERR_STREAM_PUSH_AFTER_EOF:A,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:I},AbortError:n}=K1(),{validateObject:i}=q8(),K0=v("kPaused"),{StringDecoder:z0}=VV(),S=YQ();U(p.prototype,y.prototype),U(p,y);var U0=()=>{},{errorOrDestroy:k}=m,u=1,Q0=2,E=4,q0=8,B0=16,w0=32,M0=64,b=128,T=256,t=512,Z0=1024,W0=2048,C=4096,X=8192,P=16384,o=32768,r=65536,l=131072,j=262144;function d(w){return{enumerable:!1,get(){return(this.state&w)!==0},set(L){if(L)this.state|=w;else this.state&=~w}}}B(e.prototype,{objectMode:d(u),ended:d(Q0),endEmitted:d(E),reading:d(q0),constructed:d(B0),sync:d(w0),needReadable:d(M0),emittedReadable:d(b),readableListening:d(T),resumeScheduled:d(t),errorEmitted:d(Z0),emitClose:d(W0),autoDestroy:d(C),destroyed:d(X),closed:d(P),closeEmitted:d(o),multiAwaitDrain:d(r),readingMore:d(l),dataEmitted:d(j)});function e(w,L,a){if(typeof a!=="boolean")a=L instanceof t1();if(this.state=W0|C|B0|w0,w&&w.objectMode)this.state|=u;if(a&&w&&w.readableObjectMode)this.state|=u;if(this.highWaterMark=w?$0(this,w,"readableHighWaterMark",a):_(!1),this.buffer=new c,this.length=0,this.pipes=[],this.flowing=null,this[K0]=null,w&&w.emitClose===!1)this.state&=~W0;if(w&&w.autoDestroy===!1)this.state&=~C;if(this.errored=null,this.defaultEncoding=w&&w.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,w&&w.encoding)this.decoder=new z0(w.encoding),this.encoding=w.encoding}function p(w){if(!(this instanceof p))return new p(w);let L=this instanceof t1();if(this._readableState=new e(w,this,L),w){if(typeof w.read==="function")this._read=w.read;if(typeof w.destroy==="function")this._destroy=w.destroy;if(typeof w.construct==="function")this._construct=w.construct;if(w.signal&&!L)Y(w.signal,this)}y.call(this,w),m.construct(this,()=>{if(this._readableState.needReadable)M1(this,this._readableState)})}p.prototype.destroy=m.destroy,p.prototype._undestroy=m.undestroy,p.prototype._destroy=function(w,L){L(w)},p.prototype[x.captureRejectionSymbol]=function(w){this.destroy(w)},p.prototype[F]=function(){let w;if(!this.destroyed)w=this.readableEnded?null:new n,this.destroy(w);return new V((L,a)=>H(this,(s)=>s&&s!==w?a(s):L(null)))},p.prototype.push=function(w,L){return G0(this,w,L,!1)},p.prototype.unshift=function(w,L){return G0(this,w,L,!0)};function G0(w,L,a,s){R("readableAddChunk",L);let V0=w._readableState,g0;if((V0.state&u)===0){if(typeof L==="string"){if(a=a||V0.defaultEncoding,V0.encoding!==a)if(s&&V0.encoding)L=z.from(L,a).toString(V0.encoding);else L=z.from(L,a),a=""}else if(L instanceof z)a="";else if(y._isUint8Array(L))L=y._uint8ArrayToBuffer(L),a="";else if(L!=null)g0=new O("chunk",["string","Buffer","Uint8Array"],L)}if(g0)k(w,g0);else if(L===null)V0.state&=~q0,A0(w,V0);else if((V0.state&u)!==0||L&&L.length>0)if(s)if((V0.state&E)!==0)k(w,new I);else if(V0.destroyed||V0.errored)return!1;else P0(w,V0,L,!0);else if(V0.ended)k(w,new A);else if(V0.destroyed||V0.errored)return!1;else if(V0.state&=~q0,V0.decoder&&!a)if(L=V0.decoder.write(L),V0.objectMode||L.length!==0)P0(w,V0,L,!1);else M1(w,V0);else P0(w,V0,L,!1);else if(!s)V0.state&=~q0,M1(w,V0);return!V0.ended&&(V0.length0){if((L.state&r)!==0)L.awaitDrainWriters.clear();else L.awaitDrainWriters=null;L.dataEmitted=!0,w.emit("data",a)}else{if(L.length+=L.objectMode?1:a.length,s)L.buffer.unshift(a);else L.buffer.push(a);if((L.state&M0)!==0)O0(w)}M1(w,L)}p.prototype.isPaused=function(){let w=this._readableState;return w[K0]===!0||w.flowing===!1},p.prototype.setEncoding=function(w){let L=new z0(w);this._readableState.decoder=L,this._readableState.encoding=this._readableState.decoder.encoding;let a=this._readableState.buffer,s="";for(let V0 of a)s+=L.write(V0);if(a.clear(),s!=="")a.push(s);return this._readableState.length=s.length,this};var k0=1073741824;function I0(w){if(w>k0)throw new f("size","<= 1GiB",w);else w--,w|=w>>>1,w|=w>>>2,w|=w>>>4,w|=w>>>8,w|=w>>>16,w++;return w}function Q1(w,L){if(w<=0||L.length===0&&L.ended)return 0;if((L.state&u)!==0)return 1;if(Z(w)){if(L.flowing&&L.length)return L.buffer.first().length;return L.length}if(w<=L.length)return w;return L.ended?L.length:0}p.prototype.read=function(w){if(R("read",w),w===void 0)w=NaN;else if(!J(w))w=G(w,10);let L=this._readableState,a=w;if(w>L.highWaterMark)L.highWaterMark=I0(w);if(w!==0)L.state&=~b;if(w===0&&L.needReadable&&((L.highWaterMark!==0?L.length>=L.highWaterMark:L.length>0)||L.ended)){if(R("read: emitReadable",L.length,L.ended),L.length===0&&L.ended)f2(this);else O0(this);return null}if(w=Q1(w,L),w===0&&L.ended){if(L.length===0)f2(this);return null}let s=(L.state&M0)!==0;if(R("need readable",s),L.length===0||L.length-w0)V0=p6(w,L);else V0=null;if(V0===null)L.needReadable=L.length<=L.highWaterMark,w=0;else if(L.length-=w,L.multiAwaitDrain)L.awaitDrainWriters.clear();else L.awaitDrainWriters=null;if(L.length===0){if(!L.ended)L.needReadable=!0;if(a!==w&&L.ended)f2(this)}if(V0!==null&&!L.errorEmitted&&!L.closeEmitted)L.dataEmitted=!0,this.emit("data",V0);return V0};function A0(w,L){if(R("onEofChunk"),L.ended)return;if(L.decoder){let a=L.decoder.end();if(a&&a.length)L.buffer.push(a),L.length+=L.objectMode?1:a.length}if(L.ended=!0,L.sync)O0(w);else L.needReadable=!1,L.emittedReadable=!0,F1(w)}function O0(w){let L=w._readableState;if(R("emitReadable",L.needReadable,L.emittedReadable),L.needReadable=!1,!L.emittedReadable)R("emitReadable",L.flowing),L.emittedReadable=!0,q.nextTick(F1,w)}function F1(w){let L=w._readableState;if(R("emitReadable_",L.destroyed,L.length,L.ended),!L.destroyed&&!L.errored&&(L.length||L.ended))w.emit("readable"),L.emittedReadable=!1;L.needReadable=!L.flowing&&!L.ended&&L.length<=L.highWaterMark,m6(w)}function M1(w,L){if(!L.readingMore&&L.constructed)L.readingMore=!0,q.nextTick(d0,w,L)}function d0(w,L){while(!L.reading&&!L.ended&&(L.length1&&s.pipes.includes(w))R("false write response, pause",s.awaitDrainWriters.size),s.awaitDrainWriters.add(w);a.pause()}if(!q1)q1=o5(a,w),w.on("drain",q1)}a.on("data",a6);function a6($1){R("ondata");let i0=w.write($1);if(R("dest.write",i0),i0===!1)o6()}function g2($1){if(R("onerror",$1),A1(),w.removeListener("error",g2),w.listenerCount("error")===0){let i0=w._writableState||w._readableState;if(i0&&!i0.errorEmitted)k(w,$1);else w.emit("error",$1)}}D(w,"error",g2);function X2(){w.removeListener("finish",y2),A1()}w.once("close",X2);function y2(){R("onfinish"),w.removeListener("close",X2),A1()}w.once("finish",y2);function A1(){R("unpipe"),a.unpipe(w)}if(w.emit("pipe",a),w.writableNeedDrain===!0)o6();else if(!s.flowing)R("pipe resume"),a.resume();return w};function o5(w,L){return function a(){let s=w._readableState;if(s.awaitDrainWriters===L)R("pipeOnDrain",1),s.awaitDrainWriters=null;else if(s.multiAwaitDrain)R("pipeOnDrain",s.awaitDrainWriters.size),s.awaitDrainWriters.delete(L);if((!s.awaitDrainWriters||s.awaitDrainWriters.size===0)&&w.listenerCount("data"))w.resume()}}p.prototype.unpipe=function(w){let L=this._readableState,a={hasUnpiped:!1};if(L.pipes.length===0)return this;if(!w){let V0=L.pipes;L.pipes=[],this.pause();for(let g0=0;g00,s.flowing!==!1)this.resume()}else if(w==="readable"){if(!s.endEmitted&&!s.readableListening){if(s.readableListening=s.needReadable=!0,s.flowing=!1,s.emittedReadable=!1,R("on readable",s.length,s.reading),s.length)O0(this);else if(!s.reading)q.nextTick(a5,this)}}return a},p.prototype.addListener=p.prototype.on,p.prototype.removeListener=function(w,L){let a=y.prototype.removeListener.call(this,w,L);if(w==="readable")q.nextTick(d6,this);return a},p.prototype.off=p.prototype.removeListener,p.prototype.removeAllListeners=function(w){let L=y.prototype.removeAllListeners.apply(this,arguments);if(w==="readable"||w===void 0)q.nextTick(d6,this);return L};function d6(w){let L=w._readableState;if(L.readableListening=w.listenerCount("readable")>0,L.resumeScheduled&&L[K0]===!1)L.flowing=!0;else if(w.listenerCount("data")>0)w.resume();else if(!L.readableListening)L.flowing=null}function a5(w){R("readable nexttick read 0"),w.read(0)}p.prototype.resume=function(){let w=this._readableState;if(!w.flowing)R("resume"),w.flowing=!w.readableListening,r5(this,w);return w[K0]=!1,this};function r5(w,L){if(!L.resumeScheduled)L.resumeScheduled=!0,q.nextTick(s5,w,L)}function s5(w,L){if(R("resume",L.reading),!L.reading)w.read(0);if(L.resumeScheduled=!1,w.emit("resume"),m6(w),L.flowing&&!L.reading)w.read(0)}p.prototype.pause=function(){if(R("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)R("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[K0]=!0,this};function m6(w){let L=w._readableState;R("flow",L.flowing);while(L.flowing&&w.read()!==null);}p.prototype.wrap=function(w){let L=!1;w.on("data",(s)=>{if(!this.push(s)&&w.pause)L=!0,w.pause()}),w.on("end",()=>{this.push(null)}),w.on("error",(s)=>{k(this,s)}),w.on("close",()=>{this.destroy()}),w.on("destroy",()=>{this.destroy()}),this._read=()=>{if(L&&w.resume)L=!1,w.resume()};let a=W(w);for(let s=1;s{V0=E0?g(V0,E0):null,a(),a=U0});try{while(!0){let E0=w.destroyed?null:w.read();if(E0!==null)yield E0;else if(V0)throw V0;else if(V0===null)return;else await new V(s)}}catch(E0){throw V0=g(V0,E0),V0}finally{if((V0||(L===null||L===void 0?void 0:L.destroyOnReturn)!==!1)&&(V0===void 0||w._readableState.autoDestroy))m.destroyer(w,null);else w.off("readable",s),g0()}}B(p.prototype,{readable:{__proto__:null,get(){let w=this._readableState;return!!w&&w.readable!==!1&&!w.destroyed&&!w.errorEmitted&&!w.endEmitted},set(w){if(this._readableState)this._readableState.readable=!!w}},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(w){if(this._readableState)this._readableState.flowing=w}},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(w){if(!this._readableState)return;this._readableState.destroyed=w}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),B(e.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[K0]!==!1},set(w){this[K0]=!!w}}}),p._fromList=p6;function p6(w,L){if(L.length===0)return null;let a;if(L.objectMode)a=L.buffer.shift();else if(!w||w>=L.length){if(L.decoder)a=L.buffer.join("");else if(L.buffer.length===1)a=L.buffer.first();else a=L.buffer.concat(L.length);L.buffer.clear()}else a=L.buffer.consume(w,L.decoder);return a}function f2(w){let L=w._readableState;if(R("endReadable",L.endEmitted),!L.endEmitted)L.ended=!0,q.nextTick(e5,L,w)}function e5(w,L){if(R("endReadableNT",w.endEmitted,w.length),!w.errored&&!w.closeEmitted&&!w.endEmitted&&w.length===0){if(w.endEmitted=!0,L.emit("end"),L.writable&&L.allowHalfOpen===!1)q.nextTick(Q4,L);else if(w.autoDestroy){let a=L._writableState;if(!a||a.autoDestroy&&(a.finished||a.writable===!1))L.destroy()}}}function Q4(w){if(w.writable&&!w.writableEnded&&!w.destroyed)w.end()}p.from=function(w,L){return S(p,w,L)};var A2;function i6(){if(A2===void 0)A2={};return A2}p.fromWeb=function(w,L){return i6().newStreamReadableFromReadableStream(w,L)},p.toWeb=function(w,L){return i6().newReadableStreamFromStreamReadable(w,L)},p.wrap=function(w,L){var a,s;return new p({objectMode:(a=(s=w.readableObjectMode)!==null&&s!==void 0?s:w.objectMode)!==null&&a!==void 0?a:!0,...L,destroy(V0,g0){m.destroyer(w,V0),g0(V0)}}).wrap(w)}}),H4=x0((Q,$)=>{var q=_2(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:B,ObjectSetPrototypeOf:W,StringPrototypeToLowerCase:U,Symbol:V,SymbolHasInstance:N}=_0();$.exports=i,i.WritableState=I;var{EventEmitter:F}=(a1(),y0(o1)),M=D4().Stream,{Buffer:v}=(a0(),y0(s0)),x=G6(),{addAbortSignal:y}=d8(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=m8(),{ERR_INVALID_ARG_TYPE:Y,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:R,ERR_STREAM_CANNOT_PIPE:c,ERR_STREAM_DESTROYED:m,ERR_STREAM_ALREADY_FINISHED:$0,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:g,ERR_UNKNOWN_ENCODING:O}=K1().codes,{errorOrDestroy:h}=x;W(i.prototype,M.prototype),W(i,M);function f(){}var A=V("kOnFinished");function I(C,X,P){if(typeof P!=="boolean")P=X instanceof t1();if(this.objectMode=!!(C&&C.objectMode),P)this.objectMode=this.objectMode||!!(C&&C.writableObjectMode);this.highWaterMark=C?D(this,C,"writableHighWaterMark",P):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let o=!!(C&&C.decodeStrings===!1);this.decodeStrings=!o,this.defaultEncoding=C&&C.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=k.bind(void 0,X),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,n(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!C||C.emitClose!==!1,this.autoDestroy=!C||C.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[A]=[]}function n(C){C.buffered=[],C.bufferedIndex=0,C.allBuffers=!0,C.allNoop=!0}I.prototype.getBuffer=function C(){return K(this.buffered,this.bufferedIndex)},G(I.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function i(C){let X=this instanceof t1();if(!X&&!Z(i,this))return new i(C);if(this._writableState=new I(C,this,X),C){if(typeof C.write==="function")this._write=C.write;if(typeof C.writev==="function")this._writev=C.writev;if(typeof C.destroy==="function")this._destroy=C.destroy;if(typeof C.final==="function")this._final=C.final;if(typeof C.construct==="function")this._construct=C.construct;if(C.signal)y(C.signal,this)}M.call(this,C),x.construct(this,()=>{let P=this._writableState;if(!P.writing)q0(this,P);b(this,P)})}G(i,N,{__proto__:null,value:function(C){if(Z(this,C))return!0;if(this!==i)return!1;return C&&C._writableState instanceof I}}),i.prototype.pipe=function(){h(this,new c)};function K0(C,X,P,o){let r=C._writableState;if(typeof P==="function")o=P,P=r.defaultEncoding;else{if(!P)P=r.defaultEncoding;else if(P!=="buffer"&&!v.isEncoding(P))throw new O(P);if(typeof o!=="function")o=f}if(X===null)throw new _;else if(!r.objectMode)if(typeof X==="string"){if(r.decodeStrings!==!1)X=v.from(X,P),P="buffer"}else if(X instanceof v)P="buffer";else if(M._isUint8Array(X))X=M._uint8ArrayToBuffer(X),P="buffer";else throw new Y("chunk",["string","Buffer","Uint8Array"],X);let l;if(r.ending)l=new g;else if(r.destroyed)l=new m("write");if(l)return q.nextTick(o,l),h(C,l,!0),l;return r.pendingcb++,z0(C,r,X,P,o)}i.prototype.write=function(C,X,P){return K0(this,C,X,P)===!0},i.prototype.cork=function(){this._writableState.corked++},i.prototype.uncork=function(){let C=this._writableState;if(C.corked){if(C.corked--,!C.writing)q0(this,C)}},i.prototype.setDefaultEncoding=function C(X){if(typeof X==="string")X=U(X);if(!v.isEncoding(X))throw new O(X);return this._writableState.defaultEncoding=X,this};function z0(C,X,P,o,r){let l=X.objectMode?1:P.length;X.length+=l;let j=X.lengthP.bufferedIndex)q0(C,P);if(o)if(P.afterWriteTickInfo!==null&&P.afterWriteTickInfo.cb===r)P.afterWriteTickInfo.count++;else P.afterWriteTickInfo={count:1,cb:r,stream:C,state:P},q.nextTick(u,P.afterWriteTickInfo);else Q0(C,P,1,r)}}function u({stream:C,state:X,count:P,cb:o}){return X.afterWriteTickInfo=null,Q0(C,X,P,o)}function Q0(C,X,P,o){if(!X.ending&&!C.destroyed&&X.length===0&&X.needDrain)X.needDrain=!1,C.emit("drain");while(P-- >0)X.pendingcb--,o();if(X.destroyed)E(X);b(C,X)}function E(C){if(C.writing)return;for(let r=C.bufferedIndex;r1&&C._writev){X.pendingcb-=l-1;let d=X.allNoop?f:(p)=>{for(let G0=j;G0256)P.splice(0,j),X.bufferedIndex=0;else X.bufferedIndex=j}X.bufferProcessing=!1}i.prototype._write=function(C,X,P){if(this._writev)this._writev([{chunk:C,encoding:X}],P);else throw new H("_write()")},i.prototype._writev=null,i.prototype.end=function(C,X,P){let o=this._writableState;if(typeof C==="function")P=C,C=null,X=null;else if(typeof X==="function")P=X,X=null;let r;if(C!==null&&C!==void 0){let l=K0(this,C,X);if(l instanceof J)r=l}if(o.corked)o.corked=1,this.uncork();if(r);else if(!o.errored&&!o.ending)o.ending=!0,b(this,o,!0),o.ended=!0;else if(o.finished)r=new $0("end");else if(o.destroyed)r=new m("end");if(typeof P==="function")if(r||o.finished)q.nextTick(P,r);else o[A].push(P);return this};function B0(C){return C.ending&&!C.destroyed&&C.constructed&&C.length===0&&!C.errored&&C.buffered.length===0&&!C.finished&&!C.writing&&!C.errorEmitted&&!C.closeEmitted}function w0(C,X){let P=!1;function o(r){if(P){h(C,r!==null&&r!==void 0?r:R());return}if(P=!0,X.pendingcb--,r){let l=X[A].splice(0);for(let j=0;j{if(B0(r))T(o,r);else r.pendingcb--},C,X);else if(B0(X))X.pendingcb++,T(C,X)}}}function T(C,X){X.pendingcb--,X.finished=!0;let P=X[A].splice(0);for(let o=0;o{var q=_2(),K=(a0(),y0(s0)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:B,isReadableNodeStream:W,isWritableNodeStream:U,isDuplexNodeStream:V,isReadableStream:N,isWritableStream:F}=e1(),M=z2(),{AbortError:v,codes:{ERR_INVALID_ARG_TYPE:x,ERR_INVALID_RETURN_VALUE:y}}=K1(),{destroyer:D}=G6(),z=t1(),Y=n8(),H=H4(),{createDeferredPromise:R}=G1(),c=YQ(),m=globalThis.Blob||K.Blob,$0=typeof m!=="undefined"?function A(I){return I instanceof m}:function A(I){return!1},_=globalThis.AbortController||Q8().AbortController,{FunctionPrototypeCall:g}=_0();class O extends z{constructor(A){super(A);if((A===null||A===void 0?void 0:A.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((A===null||A===void 0?void 0:A.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}$.exports=function A(I,n){if(V(I))return I;if(W(I))return f({readable:I});if(U(I))return f({writable:I});if(B(I))return f({writable:!1,readable:!1});if(N(I))return f({readable:Y.fromWeb(I)});if(F(I))return f({writable:H.fromWeb(I)});if(typeof I==="function"){let{value:K0,write:z0,final:S,destroy:U0}=h(I);if(G(K0))return c(O,K0,{objectMode:!0,write:z0,final:S,destroy:U0});let k=K0===null||K0===void 0?void 0:K0.then;if(typeof k==="function"){let u,Q0=g(k,K0,(E)=>{if(E!=null)throw new y("nully","body",E)},(E)=>{D(u,E)});return u=new O({objectMode:!0,readable:!1,write:z0,final(E){S(async()=>{try{await Q0,q.nextTick(E,null)}catch(q0){q.nextTick(E,q0)}})},destroy:U0})}throw new y("Iterable, AsyncIterable or AsyncFunction",n,K0)}if($0(I))return A(I.arrayBuffer());if(G(I))return c(O,I,{objectMode:!0,writable:!1});if(N(I===null||I===void 0?void 0:I.readable)&&F(I===null||I===void 0?void 0:I.writable))return O.fromWeb(I);if(typeof(I===null||I===void 0?void 0:I.writable)==="object"||typeof(I===null||I===void 0?void 0:I.readable)==="object"){let K0=I!==null&&I!==void 0&&I.readable?W(I===null||I===void 0?void 0:I.readable)?I===null||I===void 0?void 0:I.readable:A(I.readable):void 0,z0=I!==null&&I!==void 0&&I.writable?U(I===null||I===void 0?void 0:I.writable)?I===null||I===void 0?void 0:I.writable:A(I.writable):void 0;return f({readable:K0,writable:z0})}let i=I===null||I===void 0?void 0:I.then;if(typeof i==="function"){let K0;return g(i,I,(z0)=>{if(z0!=null)K0.push(z0);K0.push(null)},(z0)=>{D(K0,z0)}),K0=new O({objectMode:!0,writable:!1,read(){}})}throw new x(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],I)};function h(A){let{promise:I,resolve:n}=R(),i=new _,K0=i.signal;return{value:A(async function*(){while(!0){let z0=I;I=null;let{chunk:S,done:U0,cb:k}=await z0;if(q.nextTick(k),U0)return;if(K0.aborted)throw new v(void 0,{cause:K0.reason});({promise:I,resolve:n}=R()),yield S}}(),{signal:K0}),write(z0,S,U0){let k=n;n=null,k({chunk:z0,done:!1,cb:U0})},final(z0){let S=n;n=null,S({done:!0,cb:z0})},destroy(z0,S){i.abort(),S(z0)}}}function f(A){let I=A.readable&&typeof A.readable.read!=="function"?Y.wrap(A.readable):A.readable,n=A.writable,i=!!J(I),K0=!!Z(n),z0,S,U0,k,u;function Q0(E){let q0=k;if(k=null,q0)q0(E);else if(E)u.destroy(E)}if(u=new O({readableObjectMode:!!(I!==null&&I!==void 0&&I.readableObjectMode),writableObjectMode:!!(n!==null&&n!==void 0&&n.writableObjectMode),readable:i,writable:K0}),K0)M(n,(E)=>{if(K0=!1,E)D(I,E);Q0(E)}),u._write=function(E,q0,B0){if(n.write(E,q0))B0();else z0=B0},u._final=function(E){n.end(),S=E},n.on("drain",function(){if(z0){let E=z0;z0=null,E()}}),n.on("finish",function(){if(S){let E=S;S=null,E()}});if(i)M(I,(E)=>{if(i=!1,E)D(I,E);Q0(E)}),I.on("readable",function(){if(U0){let E=U0;U0=null,E()}}),I.on("end",function(){u.push(null)}),u._read=function(){while(!0){let E=I.read();if(E===null){U0=u._read;return}if(!u.push(E))return}};return u._destroy=function(E,q0){if(!E&&k!==null)E=new v;if(U0=null,z0=null,S=null,k===null)q0(E);else k=q0,D(n,E),D(I,E)},u}}),t1=x0((Q,$)=>{var{ObjectDefineProperties:q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=_0();$.exports=W;var G=n8(),B=H4();Z(W.prototype,G.prototype),Z(W,G);{let F=J(B.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:q,Symbol:K}=_0();$.exports=W;var{ERR_METHOD_NOT_IMPLEMENTED:J}=K1().codes,Z=t1(),{getHighWaterMark:G}=m8();q(W.prototype,Z.prototype),q(W,Z);var B=K("kCallback");function W(N){if(!(this instanceof W))return new W(N);let F=N?G(this,N,"readableHighWaterMark",!0):null;if(F===0)N={...N,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:N.writableHighWaterMark||0};if(Z.call(this,N),this._readableState.sync=!1,this[B]=null,N){if(typeof N.transform==="function")this._transform=N.transform;if(typeof N.flush==="function")this._flush=N.flush}this.on("prefinish",V)}function U(N){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(N)N(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),N)N()});else if(this.push(null),N)N()}function V(){if(this._final!==U)U.call(this)}W.prototype._final=U,W.prototype._transform=function(N,F,M){throw new J("_transform()")},W.prototype._write=function(N,F,M){let v=this._readableState,x=this._writableState,y=v.length;this._transform(N,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(x.ended||y===v.length||v.length{var{ObjectSetPrototypeOf:q}=_0();$.exports=J;var K=LQ();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,B){B(null,Z)}}),k4=x0((Q,$)=>{var q=_2(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=_0(),B=z2(),{once:W}=G1(),U=G6(),V=t1(),{aggregateTwoErrors:N,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:v,ERR_STREAM_DESTROYED:x,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:D}=K1(),{validateFunction:z,validateAbortSignal:Y}=q8(),{isIterable:H,isReadable:R,isReadableNodeStream:c,isNodeStream:m,isTransformStream:$0,isWebStream:_,isReadableStream:g,isReadableFinished:O}=e1(),h=globalThis.AbortController||Q8().AbortController,f,A,I;function n(E,q0,B0){let w0=!1;E.on("close",()=>{w0=!0});let M0=B(E,{readable:q0,writable:B0},(b)=>{w0=!b});return{destroy:(b)=>{if(w0)return;w0=!0,U.destroyer(E,b||new x("pipe"))},cleanup:M0}}function i(E){return z(E[E.length-1],"streams[stream.length - 1]"),E.pop()}function K0(E){if(H(E))return E;else if(c(E))return z0(E);throw new F("val",["Readable","Iterable","AsyncIterable"],E)}async function*z0(E){if(!A)A=n8();yield*A.prototype[Z].call(E)}async function S(E,q0,B0,{end:w0}){let M0,b=null,T=(W0)=>{if(W0)M0=W0;if(b){let C=b;b=null,C()}},t=()=>new J((W0,C)=>{if(M0)C(M0);else b=()=>{if(M0)C(M0);else W0()}});q0.on("drain",T);let Z0=B(q0,{readable:!1},T);try{if(q0.writableNeedDrain)await t();for await(let W0 of E)if(!q0.write(W0))await t();if(w0)q0.end(),await t();B0()}catch(W0){B0(M0!==W0?N(M0,W0):W0)}finally{Z0(),q0.off("drain",T)}}async function U0(E,q0,B0,{end:w0}){if($0(q0))q0=q0.writable;let M0=q0.getWriter();try{for await(let b of E)await M0.ready,M0.write(b).catch(()=>{});if(await M0.ready,w0)await M0.close();B0()}catch(b){try{await M0.abort(b),B0(b)}catch(T){B0(T)}}}function k(...E){return u(E,W(i(E)))}function u(E,q0,B0){if(E.length===1&&K(E[0]))E=E[0];if(E.length<2)throw new v("streams");let w0=new h,M0=w0.signal,b=B0===null||B0===void 0?void 0:B0.signal,T=[];Y(b,"options.signal");function t(){r(new D)}I=I||G1().addAbortListener;let Z0;if(b)Z0=I(b,t);let W0,C,X=[],P=0;function o(p){r(p,--P===0)}function r(p,G0){var P0;if(p&&(!W0||W0.code==="ERR_STREAM_PREMATURE_CLOSE"))W0=p;if(!W0&&!G0)return;while(X.length)X.shift()(W0);if((P0=Z0)===null||P0===void 0||P0[G](),w0.abort(),G0){if(!W0)T.forEach((k0)=>k0());q.nextTick(q0,W0,C)}}let l;for(let p=0;p0,I0=P0||(B0===null||B0===void 0?void 0:B0.end)!==!1,Q1=p===E.length-1;if(m(G0)){let A0=function(O0){if(O0&&O0.name!=="AbortError"&&O0.code!=="ERR_STREAM_PREMATURE_CLOSE")o(O0)};var j=A0;if(I0){let{destroy:O0,cleanup:F1}=n(G0,P0,k0);if(X.push(O0),R(G0)&&Q1)T.push(F1)}if(G0.on("error",A0),R(G0)&&Q1)T.push(()=>{G0.removeListener("error",A0)})}if(p===0)if(typeof G0==="function"){if(l=G0({signal:M0}),!H(l))throw new M("Iterable, AsyncIterable or Stream","source",l)}else if(H(G0)||c(G0)||$0(G0))l=G0;else l=V.from(G0);else if(typeof G0==="function"){if($0(l)){var d;l=K0((d=l)===null||d===void 0?void 0:d.readable)}else l=K0(l);if(l=G0(l,{signal:M0}),P0){if(!H(l,!0))throw new M("AsyncIterable",`transform[${p-1}]`,l)}else{var e;if(!f)f=DQ();let A0=new f({objectMode:!0}),O0=(e=l)===null||e===void 0?void 0:e.then;if(typeof O0==="function")P++,O0.call(l,(d0)=>{if(C=d0,d0!=null)A0.write(d0);if(I0)A0.end();q.nextTick(o)},(d0)=>{A0.destroy(d0),q.nextTick(o,d0)});else if(H(l,!0))P++,S(l,A0,o,{end:I0});else if(g(l)||$0(l)){let d0=l.readable||l;P++,S(d0,A0,o,{end:I0})}else throw new M("AsyncIterable or Promise","destination",l);l=A0;let{destroy:F1,cleanup:M1}=n(l,!1,!0);if(X.push(F1),Q1)T.push(M1)}}else if(m(G0)){if(c(l)){P+=2;let A0=Q0(l,G0,o,{end:I0});if(R(G0)&&Q1)T.push(A0)}else if($0(l)||g(l)){let A0=l.readable||l;P++,S(A0,G0,o,{end:I0})}else if(H(l))P++,S(l,G0,o,{end:I0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],l);l=G0}else if(_(G0)){if(c(l))P++,U0(K0(l),G0,o,{end:I0});else if(g(l)||H(l))P++,U0(l,G0,o,{end:I0});else if($0(l))P++,U0(l.readable,G0,o,{end:I0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],l);l=G0}else l=V.from(G0)}if(M0!==null&&M0!==void 0&&M0.aborted||b!==null&&b!==void 0&&b.aborted)q.nextTick(t);return l}function Q0(E,q0,B0,{end:w0}){let M0=!1;if(q0.on("close",()=>{if(!M0)B0(new y)}),E.pipe(q0,{end:!1}),w0){let T=function(){M0=!0,q0.end()};var b=T;if(O(E))q.nextTick(T);else E.once("end",T)}else B0();return B(E,{readable:!0,writable:!1},(T)=>{let t=E._readableState;if(T&&T.code==="ERR_STREAM_PREMATURE_CLOSE"&&t&&t.ended&&!t.errored&&!t.errorEmitted)E.once("end",B0).once("error",B0);else B0(T)}),B(q0,{readable:!1,writable:!0},B0)}$.exports={pipelineImpl:u,pipeline:k}}),HQ=x0((Q,$)=>{var{pipeline:q}=k4(),K=t1(),{destroyer:J}=G6(),{isNodeStream:Z,isReadable:G,isWritable:B,isWebStream:W,isTransformStream:U,isWritableStream:V,isReadableStream:N}=e1(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:v}}=K1(),x=z2();$.exports=function y(...D){if(D.length===0)throw new v("streams");if(D.length===1)return K.from(D[0]);let z=[...D];if(typeof D[0]==="function")D[0]=K.from(D[0]);if(typeof D[D.length-1]==="function"){let f=D.length-1;D[f]=K.from(D[f])}for(let f=0;f0&&!(B(D[f])||V(D[f])||U(D[f])))throw new M(`streams[${f}]`,z[f],"must be writable")}let Y,H,R,c,m;function $0(f){let A=c;if(c=null,A)A(f);else if(f)m.destroy(f);else if(!h&&!O)m.destroy()}let _=D[0],g=q(D,$0),O=!!(B(_)||V(_)||U(_)),h=!!(G(g)||N(g)||U(g));if(m=new K({writableObjectMode:!!(_!==null&&_!==void 0&&_.writableObjectMode),readableObjectMode:!!(g!==null&&g!==void 0&&g.readableObjectMode),writable:O,readable:h}),O){if(Z(_))m._write=function(A,I,n){if(_.write(A,I))n();else Y=n},m._final=function(A){_.end(),H=A},_.on("drain",function(){if(Y){let A=Y;Y=null,A()}});else if(W(_)){let A=(U(_)?_.writable:_).getWriter();m._write=async function(I,n,i){try{await A.ready,A.write(I).catch(()=>{}),i()}catch(K0){i(K0)}},m._final=async function(I){try{await A.ready,A.close().catch(()=>{}),H=I}catch(n){I(n)}}}let f=U(g)?g.readable:g;x(f,()=>{if(H){let A=H;H=null,A()}})}if(h){if(Z(g))g.on("readable",function(){if(R){let f=R;R=null,f()}}),g.on("end",function(){m.push(null)}),m._read=function(){while(!0){let f=g.read();if(f===null){R=m._read;return}if(!m.push(f))return}};else if(W(g)){let f=(U(g)?g.readable:g).getReader();m._read=async function(){while(!0)try{let{value:A,done:I}=await f.read();if(!m.push(A))return;if(I){m.push(null);return}}catch{return}}}}return m._destroy=function(f,A){if(!f&&c!==null)f=new F;if(R=null,Y=null,H=null,c===null)A(f);else if(c=A,Z(g))J(g,f)},m}}),GV=x0((Q,$)=>{var q=globalThis.AbortController||Q8().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:B}=K1(),{validateAbortSignal:W,validateInteger:U,validateObject:V}=q8(),N=_0().Symbol("kWeak"),F=_0().Symbol("kResistStopPropagation"),{finished:M}=z2(),v=HQ(),{addAbortSignalNoValidate:x}=d8(),{isWritable:y,isNodeStream:D}=e1(),{deprecate:z}=G1(),{ArrayPrototypePush:Y,Boolean:H,MathFloor:R,Number:c,NumberIsNaN:m,Promise:$0,PromiseReject:_,PromiseResolve:g,PromisePrototypeThen:O,Symbol:h}=_0(),f=h("kEmpty"),A=h("kEof");function I(b,T){if(T!=null)V(T,"options");if((T===null||T===void 0?void 0:T.signal)!=null)W(T.signal,"options.signal");if(D(b)&&!y(b))throw new K("stream",b,"must be writable");let t=v(this,b);if(T!==null&&T!==void 0&&T.signal)x(T.signal,t);return t}function n(b,T){if(typeof b!=="function")throw new J("fn",["Function","AsyncFunction"],b);if(T!=null)V(T,"options");if((T===null||T===void 0?void 0:T.signal)!=null)W(T.signal,"options.signal");let t=1;if((T===null||T===void 0?void 0:T.concurrency)!=null)t=R(T.concurrency);let Z0=t-1;if((T===null||T===void 0?void 0:T.highWaterMark)!=null)Z0=R(T.highWaterMark);return U(t,"options.concurrency",1),U(Z0,"options.highWaterMark",0),Z0+=t,async function*W0(){let C=G1().AbortSignalAny([T===null||T===void 0?void 0:T.signal].filter(H)),X=this,P=[],o={signal:C},r,l,j=!1,d=0;function e(){j=!0,p()}function p(){d-=1,G0()}function G0(){if(l&&!j&&d=Z0||d>=t))await new $0((I0)=>{l=I0})}P.push(A)}catch(k0){let I0=_(k0);O(I0,p,e),P.push(I0)}finally{if(j=!0,r)r(),r=null}}P0();try{while(!0){while(P.length>0){let k0=await P[0];if(k0===A)return;if(C.aborted)throw new B;if(k0!==f)yield k0;P.shift(),G0()}await new $0((k0)=>{r=k0})}}finally{if(j=!0,l)l(),l=null}}.call(this)}function i(b=void 0){if(b!=null)V(b,"options");if((b===null||b===void 0?void 0:b.signal)!=null)W(b.signal,"options.signal");return async function*T(){let t=0;for await(let W0 of this){var Z0;if(b!==null&&b!==void 0&&(Z0=b.signal)!==null&&Z0!==void 0&&Z0.aborted)throw new B({cause:b.signal.reason});yield[t++,W0]}}.call(this)}async function K0(b,T=void 0){for await(let t of k.call(this,b,T))return!0;return!1}async function z0(b,T=void 0){if(typeof b!=="function")throw new J("fn",["Function","AsyncFunction"],b);return!await K0.call(this,async(...t)=>{return!await b(...t)},T)}async function S(b,T){for await(let t of k.call(this,b,T))return t;return}async function U0(b,T){if(typeof b!=="function")throw new J("fn",["Function","AsyncFunction"],b);async function t(Z0,W0){return await b(Z0,W0),f}for await(let Z0 of n.call(this,t,T));}function k(b,T){if(typeof b!=="function")throw new J("fn",["Function","AsyncFunction"],b);async function t(Z0,W0){if(await b(Z0,W0))return Z0;return f}return n.call(this,t,T)}class u extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function Q0(b,T,t){var Z0;if(typeof b!=="function")throw new J("reducer",["Function","AsyncFunction"],b);if(t!=null)V(t,"options");if((t===null||t===void 0?void 0:t.signal)!=null)W(t.signal,"options.signal");let W0=arguments.length>1;if(t!==null&&t!==void 0&&(Z0=t.signal)!==null&&Z0!==void 0&&Z0.aborted){let r=new B(void 0,{cause:t.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let C=new q,X=C.signal;if(t!==null&&t!==void 0&&t.signal){let r={once:!0,[N]:this,[F]:!0};t.signal.addEventListener("abort",()=>C.abort(),r)}let P=!1;try{for await(let r of this){var o;if(P=!0,t!==null&&t!==void 0&&(o=t.signal)!==null&&o!==void 0&&o.aborted)throw new B;if(!W0)T=r,W0=!0;else T=await b(T,r,{signal:X})}if(!P&&!W0)throw new u}finally{C.abort()}return T}async function E(b){if(b!=null)V(b,"options");if((b===null||b===void 0?void 0:b.signal)!=null)W(b.signal,"options.signal");let T=[];for await(let Z0 of this){var t;if(b!==null&&b!==void 0&&(t=b.signal)!==null&&t!==void 0&&t.aborted)throw new B(void 0,{cause:b.signal.reason});Y(T,Z0)}return T}function q0(b,T){let t=n.call(this,b,T);return async function*Z0(){for await(let W0 of t)yield*W0}.call(this)}function B0(b){if(b=c(b),m(b))return 0;if(b<0)throw new G("number",">= 0",b);return b}function w0(b,T=void 0){if(T!=null)V(T,"options");if((T===null||T===void 0?void 0:T.signal)!=null)W(T.signal,"options.signal");return b=B0(b),async function*t(){var Z0;if(T!==null&&T!==void 0&&(Z0=T.signal)!==null&&Z0!==void 0&&Z0.aborted)throw new B;for await(let C of this){var W0;if(T!==null&&T!==void 0&&(W0=T.signal)!==null&&W0!==void 0&&W0.aborted)throw new B;if(b--<=0)yield C}}.call(this)}function M0(b,T=void 0){if(T!=null)V(T,"options");if((T===null||T===void 0?void 0:T.signal)!=null)W(T.signal,"options.signal");return b=B0(b),async function*t(){var Z0;if(T!==null&&T!==void 0&&(Z0=T.signal)!==null&&Z0!==void 0&&Z0.aborted)throw new B;for await(let C of this){var W0;if(T!==null&&T!==void 0&&(W0=T.signal)!==null&&W0!==void 0&&W0.aborted)throw new B;if(b-- >0)yield C;if(b<=0)return}}.call(this)}$.exports.streamReturningOperators={asIndexedPairs:z(i,"readable.asIndexedPairs will be removed in a future version."),drop:w0,filter:k,flatMap:q0,map:n,take:M0,compose:I},$.exports.promiseReturningOperators={every:z0,forEach:U0,reduce:Q0,toArray:E,some:K0,find:S}}),kQ=x0((Q,$)=>{var{ArrayPrototypePop:q,Promise:K}=_0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=e1(),{pipelineImpl:B}=k4(),{finished:W}=z2();vQ();function U(...V){return new K((N,F)=>{let M,v,x=V[V.length-1];if(x&&typeof x==="object"&&!Z(x)&&!J(x)&&!G(x)){let y=q(V);M=y.signal,v=y.end}B(V,(y,D)=>{if(y)F(y);else N(D)},{signal:M,end:v})})}$.exports={finished:W,pipeline:U}}),vQ=x0((Q,$)=>{var{Buffer:q}=(a0(),y0(s0)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=_0(),{promisify:{custom:G}}=G1(),{streamReturningOperators:B,promiseReturningOperators:W}=GV(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:U}}=K1(),V=HQ(),{setDefaultHighWaterMark:N,getDefaultHighWaterMark:F}=m8(),{pipeline:M}=k4(),{destroyer:v}=G6(),x=z2(),y=kQ(),D=e1(),z=$.exports=D4().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=n8();for(let H of J(B)){let R=function(...m){if(new.target)throw U();return z.Readable.from(Z(c,this,m))},c=B[H];K(R,"name",{__proto__:null,value:c.name}),K(R,"length",{__proto__:null,value:c.length}),K(z.Readable.prototype,H,{__proto__:null,value:R,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(W)){let R=function(...m){if(new.target)throw U();return Z(c,this,m)},c=W[H];K(R,"name",{__proto__:null,value:c.name}),K(R,"length",{__proto__:null,value:c.length}),K(z.Readable.prototype,H,{__proto__:null,value:R,enumerable:!1,configurable:!0,writable:!0})}z.Writable=H4(),z.Duplex=t1(),z.Transform=LQ(),z.PassThrough=DQ(),z.pipeline=M;var{addAbortSignal:Y}=d8();z.addAbortSignal=Y,z.finished=x,z.destroy=v,z.compose=V,z.setDefaultHighWaterMark=N,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return y}}),K(M,G,{__proto__:null,enumerable:!0,get(){return y.pipeline}}),K(x,G,{__proto__:null,enumerable:!0,get(){return y.finished}}),z.Stream=z,z._isUint8Array=function H(R){return R instanceof Uint8Array},z._uint8ArrayToBuffer=function H(R){return q.from(R.buffer,R.byteOffset,R.byteLength)}}),BV=x0((Q,$)=>{var q=p8();if(q&&process.env.READABLE_STREAM==="disable"){let K=q.promises;$.exports._uint8ArrayToBuffer=q._uint8ArrayToBuffer,$.exports._isUint8Array=q._isUint8Array,$.exports.isDisturbed=q.isDisturbed,$.exports.isErrored=q.isErrored,$.exports.isReadable=q.isReadable,$.exports.Readable=q.Readable,$.exports.Writable=q.Writable,$.exports.Duplex=q.Duplex,$.exports.Transform=q.Transform,$.exports.PassThrough=q.PassThrough,$.exports.addAbortSignal=q.addAbortSignal,$.exports.finished=q.finished,$.exports.destroy=q.destroy,$.exports.pipeline=q.pipeline,$.exports.compose=q.compose,Object.defineProperty(q,"promises",{configurable:!0,enumerable:!0,get(){return K}}),$.exports.Stream=q.Stream}else{let K=vQ(),J=kQ(),Z=K.Readable.destroy;$.exports=K.Readable,$.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,$.exports._isUint8Array=K._isUint8Array,$.exports.isDisturbed=K.isDisturbed,$.exports.isErrored=K.isErrored,$.exports.isReadable=K.isReadable,$.exports.Readable=K.Readable,$.exports.Writable=K.Writable,$.exports.Duplex=K.Duplex,$.exports.Transform=K.Transform,$.exports.PassThrough=K.PassThrough,$.exports.addAbortSignal=K.addAbortSignal,$.exports.finished=K.finished,$.exports.destroy=K.destroy,$.exports.destroy=Z,$.exports.pipeline=K.pipeline,$.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),$.exports.Stream=K.Stream}$.exports.default=$.exports});IQ.exports=BV()});var v4=N0((pz,RQ)=>{RQ.exports=p8()});var Q2=N0((w1)=>{w1.base64=!0;w1.array=!0;w1.string=!0;w1.arraybuffer=typeof ArrayBuffer!=="undefined"&&typeof Uint8Array!=="undefined";w1.nodebuffer=typeof Buffer!=="undefined";w1.uint8array=typeof Uint8Array!=="undefined";if(typeof ArrayBuffer==="undefined")w1.blob=!1;else{i8=new ArrayBuffer(0);try{w1.blob=new Blob([i8],{type:"application/zip"}).size===0}catch(Q){try{I4=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,l8=new I4,l8.append(i8),w1.blob=l8.getBlob("application/zip").size===0}catch($){w1.blob=!1}}}var i8,I4,l8;try{w1.nodestream=!!v4().Readable}catch(Q){w1.nodestream=!1}});var C4=N0((R4)=>{var WV=c0(),zV=Q2(),S1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";R4.encode=function(Q){var $=[],q,K,J,Z,G,B,W,U=0,V=Q.length,N=V,F=WV.getTypeOf(Q)!=="string";while(U>2,G=(q&3)<<4|K>>4,B=N>1?(K&15)<<2|J>>6:64,W=N>2?J&63:64,$.push(S1.charAt(Z)+S1.charAt(G)+S1.charAt(B)+S1.charAt(W))}return $.join("")};R4.decode=function(Q){var $,q,K,J,Z,G,B,W=0,U=0,V="data:";if(Q.substr(0,V.length)===V)throw new Error("Invalid base64 input, it looks like a data url.");Q=Q.replace(/[^A-Za-z0-9+/=]/g,"");var N=Q.length*3/4;if(Q.charAt(Q.length-1)===S1.charAt(64))N--;if(Q.charAt(Q.length-2)===S1.charAt(64))N--;if(N%1!==0)throw new Error("Invalid base64 input, bad content length.");var F;if(zV.uint8array)F=new Uint8Array(N|0);else F=new Array(N|0);while(W>4,q=(Z&15)<<4|G>>2,K=(G&3)<<6|B,F[U++]=$,G!==64)F[U++]=q;if(B!==64)F[U++]=K}return F}});var $8=N0((oz,CQ)=>{CQ.exports={isNode:typeof Buffer!=="undefined",newBufferFrom:function(Q,$){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(Q,$);else{if(typeof Q==="number")throw new Error('The "data" argument must not be a number');return new Buffer(Q,$)}},allocBuffer:function(Q){if(Buffer.alloc)return Buffer.alloc(Q);else{var $=new Buffer(Q);return $.fill(0),$}},isBuffer:function(Q){return Buffer.isBuffer(Q)},isStream:function(Q){return Q&&typeof Q.on==="function"&&typeof Q.pause==="function"&&typeof Q.resume==="function"}}});var AQ=N0((az,fQ)=>{var jQ=global.MutationObserver||global.WebKitMutationObserver,K8;if(jQ)a8=0,j4=new jQ(o8),r8=global.document.createTextNode(""),j4.observe(r8,{characterData:!0}),K8=function(){r8.data=a8=++a8%2};else if(!global.setImmediate&&typeof global.MessageChannel!=="undefined")s8=new global.MessageChannel,s8.port1.onmessage=o8,K8=function(){s8.port2.postMessage(0)};else if("document"in global&&"onreadystatechange"in global.document.createElement("script"))K8=function(){var Q=global.document.createElement("script");Q.onreadystatechange=function(){o8(),Q.onreadystatechange=null,Q.parentNode.removeChild(Q),Q=null},global.document.documentElement.appendChild(Q)};else K8=function(){setTimeout(o8,0)};var a8,j4,r8,s8,f4,J8=[];function o8(){f4=!0;var Q,$,q=J8.length;while(q){$=J8,J8=[],Q=-1;while(++Q{var MV=AQ();function B6(){}var e0={},gQ=["REJECTED"],A4=["FULFILLED"],XQ=["PENDING"];xQ.exports=F2;function F2(Q){if(typeof Q!=="function")throw new TypeError("resolver must be a function");if(this.state=XQ,this.queue=[],this.outcome=void 0,Q!==B6)yQ(this,Q)}F2.prototype.finally=function(Q){if(typeof Q!=="function")return this;var $=this.constructor;return this.then(q,K);function q(J){function Z(){return J}return $.resolve(Q()).then(Z)}function K(J){function Z(){throw J}return $.resolve(Q()).then(Z)}};F2.prototype.catch=function(Q){return this.then(null,Q)};F2.prototype.then=function(Q,$){if(typeof Q!=="function"&&this.state===A4||typeof $!=="function"&&this.state===gQ)return this;var q=new this.constructor(B6);if(this.state!==XQ){var K=this.state===A4?Q:$;g4(q,K,this.outcome)}else this.queue.push(new U8(q,Q,$));return q};function U8(Q,$,q){if(this.promise=Q,typeof $==="function")this.onFulfilled=$,this.callFulfilled=this.otherCallFulfilled;if(typeof q==="function")this.onRejected=q,this.callRejected=this.otherCallRejected}U8.prototype.callFulfilled=function(Q){e0.resolve(this.promise,Q)};U8.prototype.otherCallFulfilled=function(Q){g4(this.promise,this.onFulfilled,Q)};U8.prototype.callRejected=function(Q){e0.reject(this.promise,Q)};U8.prototype.otherCallRejected=function(Q){g4(this.promise,this.onRejected,Q)};function g4(Q,$,q){MV(function(){var K;try{K=$(q)}catch(J){return e0.reject(Q,J)}if(K===Q)e0.reject(Q,new TypeError("Cannot resolve promise with itself"));else e0.resolve(Q,K)})}e0.resolve=function(Q,$){var q=hQ(wV,$);if(q.status==="error")return e0.reject(Q,q.value);var K=q.value;if(K)yQ(Q,K);else{Q.state=A4,Q.outcome=$;var J=-1,Z=Q.queue.length;while(++J{var X4=null;if(typeof Promise!=="undefined")X4=Promise;else X4=OQ();PQ.exports={Promise:X4}});var EQ=N0((TQ)=>{(function(Q,$){if(Q.setImmediate)return;var q=1,K={},J=!1,Z=Q.document,G;function B(z){if(typeof z!=="function")z=new Function(""+z);var Y=new Array(arguments.length-1);for(var H=0;H{var M2=Q2(),HV=C4(),z6=$8(),y4=W6();EQ();function kV(Q){var $=null;if(M2.uint8array)$=new Uint8Array(Q.length);else $=new Array(Q.length);return e8(Q,$)}p0.newBlob=function(Q,$){p0.checkSupport("blob");try{return new Blob([Q],{type:$})}catch(J){try{var q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,K=new q;return K.append(Q),K.getBlob($)}catch(Z){throw new Error("Bug : can't construct the Blob.")}}};function V8(Q){return Q}function e8(Q,$){for(var q=0;q1)try{return t8.stringifyByChunk(Q,q,$)}catch(J){$=Math.floor($/2)}return t8.stringifyByChar(Q)}p0.applyFromCharCode=Z8;function Q5(Q,$){for(var q=0;q{function SQ(Q){this.name=Q||"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}SQ.prototype={push:function(Q){this.emit("data",Q)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Q){this.emit("error",Q)}return!0},error:function(Q){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=Q;else{if(this.isFinished=!0,this.emit("error",Q),this.previous)this.previous.error(Q);this.cleanUp()}return!0},on:function(Q,$){return this._listeners[Q].push($),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Q,$){if(this._listeners[Q])for(var q=0;q "+Q;else return Q}};uQ.exports=SQ});var M6=N0((N2)=>{var F6=c0(),c2=Q2(),vV=$8(),q5=N1(),G8=new Array(256);for(u1=0;u1<256;u1++)G8[u1]=u1>=252?6:u1>=248?5:u1>=240?4:u1>=224?3:u1>=192?2:1;var u1;G8[254]=G8[254]=1;var IV=function(Q){var $,q,K,J,Z,G=Q.length,B=0;for(J=0;J>>6,$[Z++]=128|q&63;else if(q<65536)$[Z++]=224|q>>>12,$[Z++]=128|q>>>6&63,$[Z++]=128|q&63;else $[Z++]=240|q>>>18,$[Z++]=128|q>>>12&63,$[Z++]=128|q>>>6&63,$[Z++]=128|q&63}return $},RV=function(Q,$){var q;if($=$||Q.length,$>Q.length)$=Q.length;q=$-1;while(q>=0&&(Q[q]&192)===128)q--;if(q<0)return $;if(q===0)return $;return q+G8[Q[q]]>$?q:$},CV=function(Q){var $,q,K,J,Z=Q.length,G=new Array(Z*2);for(q=0,$=0;$4){G[q++]=65533,$+=J-1;continue}K&=J===2?31:J===3?15:7;while(J>1&&$1){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 F6.applyFromCharCode(G)};N2.utf8encode=function Q($){if(c2.nodebuffer)return vV.newBufferFrom($,"utf-8");return IV($)};N2.utf8decode=function Q($){if(c2.nodebuffer)return F6.transformTo("nodebuffer",$).toString("utf-8");return $=F6.transformTo(c2.uint8array?"uint8array":"array",$),CV($)};function $5(){q5.call(this,"utf-8 decode"),this.leftOver=null}F6.inherits($5,q5);$5.prototype.processChunk=function(Q){var $=F6.transformTo(c2.uint8array?"uint8array":"array",Q.data);if(this.leftOver&&this.leftOver.length){if(c2.uint8array){var q=$;$=new Uint8Array(q.length+this.leftOver.length),$.set(this.leftOver,0),$.set(q,this.leftOver.length)}else $=this.leftOver.concat($);this.leftOver=null}var K=RV($),J=$;if(K!==$.length)if(c2.uint8array)J=$.subarray(0,K),this.leftOver=$.subarray(K,$.length);else J=$.slice(0,K),this.leftOver=$.slice(K,$.length);this.push({data:N2.utf8decode(J),meta:Q.meta})};$5.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:N2.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};N2.Utf8DecodeWorker=$5;function h4(){q5.call(this,"utf-8 encode")}F6.inherits(h4,q5);h4.prototype.processChunk=function(Q){this.push({data:N2.utf8encode(Q.data),meta:Q.meta})};N2.Utf8EncodeWorker=h4});var dQ=N0(($3,bQ)=>{var _Q=N1(),cQ=c0();function x4(Q){_Q.call(this,"ConvertWorker to "+Q),this.destType=Q}cQ.inherits(x4,_Q);x4.prototype.processChunk=function(Q){this.push({data:cQ.transformTo(this.destType,Q.data),meta:Q.meta})};bQ.exports=x4});var pQ=N0((K3,nQ)=>{var mQ=v4().Readable,jV=c0();jV.inherits(O4,mQ);function O4(Q,$,q){mQ.call(this,$),this._helper=Q;var K=this;Q.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)})}O4.prototype._read=function(){this._helper.resume()};nQ.exports=O4});var P4=N0((J3,oQ)=>{var b2=c0(),fV=dQ(),AV=N1(),gV=C4(),XV=Q2(),yV=W6(),iQ=null;if(XV.nodestream)try{iQ=pQ()}catch(Q){}function hV(Q,$,q){switch(Q){case"blob":return b2.newBlob(b2.transformTo("arraybuffer",$),q);case"base64":return gV.encode($);default:return b2.transformTo(Q,$)}}function xV(Q,$){var q,K=0,J=null,Z=0;for(q=0;q<$.length;q++)Z+=$[q].length;switch(Q){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":J=new Uint8Array(Z);for(q=0;q<$.length;q++)J.set($[q],K),K+=$[q].length;return J;case"nodebuffer":return Buffer.concat($);default:throw new Error("concat : unsupported type '"+Q+"'")}}function OV(Q,$){return new yV.Promise(function(q,K){var J=[],Z=Q._internalType,G=Q._outputType,B=Q._mimeType;Q.on("data",function(W,U){if(J.push(W),$)$(U)}).on("error",function(W){J=[],K(W)}).on("end",function(){try{var W=hV(G,xV(Z,J),B);q(W)}catch(U){K(U)}J=[]}).resume()})}function lQ(Q,$,q){var K=$;switch($){case"blob":case"arraybuffer":K="uint8array";break;case"base64":K="string";break}try{this._internalType=K,this._outputType=$,this._mimeType=q,b2.checkSupport(K),this._worker=Q.pipe(new fV(K)),Q.lock()}catch(J){this._worker=new AV("error"),this._worker.error(J)}}lQ.prototype={accumulate:function(Q){return OV(this,Q)},on:function(Q,$){var q=this;if(Q==="data")this._worker.on(Q,function(K){$.call(q,K.data,K.meta)});else this._worker.on(Q,function(){b2.delay($,arguments,q)});return this},resume:function(){return b2.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(Q){if(b2.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new iQ(this,{objectMode:this._outputType!=="nodebuffer"},Q)}};oQ.exports=lQ});var T4=N0((g1)=>{g1.base64=!1;g1.binary=!1;g1.dir=!1;g1.createFolders=!0;g1.date=null;g1.compression=null;g1.compressionOptions=null;g1.comment=null;g1.unixPermissions=null;g1.dosPermissions=null});var E4=N0((V3,aQ)=>{var K5=c0(),J5=N1(),PV=16384;function w6(Q){J5.call(this,"DataWorker");var $=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,Q.then(function(q){if($.dataIsReady=!0,$.data=q,$.max=q&&q.length||0,$.type=K5.getTypeOf(q),!$.isPaused)$._tickAndRepeat()},function(q){$.error(q)})}K5.inherits(w6,J5);w6.prototype.cleanUp=function(){J5.prototype.cleanUp.call(this),this.data=null};w6.prototype.resume=function(){if(!J5.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,K5.delay(this._tickAndRepeat,[],this);return!0};w6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)K5.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};w6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var Q=PV,$=null,q=Math.min(this.max,this.index+Q);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":$=this.data.substring(this.index,q);break;case"uint8array":$=this.data.subarray(this.index,q);break;case"array":case"nodebuffer":$=this.data.slice(this.index,q);break}return this.index=q,this.push({data:$,meta:{percent:this.max?this.index/this.max*100:0}})}};aQ.exports=w6});var U5=N0((Z3,sQ)=>{var TV=c0();function EV(){var Q,$=[];for(var q=0;q<256;q++){Q=q;for(var K=0;K<8;K++)Q=Q&1?3988292384^Q>>>1:Q>>>1;$[q]=Q}return $}var rQ=EV();function SV(Q,$,q,K){var J=rQ,Z=K+q;Q=Q^-1;for(var G=K;G>>8^J[(Q^$[G])&255];return Q^-1}function uV(Q,$,q,K){var J=rQ,Z=K+q;Q=Q^-1;for(var G=K;G>>8^J[(Q^$.charCodeAt(G))&255];return Q^-1}sQ.exports=function Q($,q){if(typeof $==="undefined"||!$.length)return 0;var K=TV.getTypeOf($)!=="string";if(K)return SV(q|0,$,$.length,0);else return uV(q|0,$,$.length,0)}});var u4=N0((G3,eQ)=>{var tQ=N1(),_V=U5(),cV=c0();function S4(){tQ.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}cV.inherits(S4,tQ);S4.prototype.processChunk=function(Q){this.streamInfo.crc32=_V(Q.data,this.streamInfo.crc32||0),this.push(Q)};eQ.exports=S4});var qq=N0((B3,Qq)=>{var bV=c0(),_4=N1();function c4(Q){_4.call(this,"DataLengthProbe for "+Q),this.propName=Q,this.withStreamInfo(Q,0)}bV.inherits(c4,_4);c4.prototype.processChunk=function(Q){if(Q){var $=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=$+Q.data.length}_4.prototype.processChunk.call(this,Q)};Qq.exports=c4});var V5=N0((W3,Jq)=>{var $q=W6(),Kq=E4(),dV=u4(),b4=qq();function d4(Q,$,q,K,J){this.compressedSize=Q,this.uncompressedSize=$,this.crc32=q,this.compression=K,this.compressedContent=J}d4.prototype={getContentWorker:function(){var Q=new Kq($q.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new b4("data_length")),$=this;return Q.on("end",function(){if(this.streamInfo.data_length!==$.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),Q},getCompressedWorker:function(){return new Kq($q.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};d4.createWorkerFrom=function(Q,$,q){return Q.pipe(new dV).pipe(new b4("uncompressedSize")).pipe($.compressWorker(q)).pipe(new b4("compressedSize")).withStreamInfo("compression",$)};Jq.exports=d4});var Gq=N0((z3,Zq)=>{var mV=P4(),nV=E4(),m4=M6(),n4=V5(),Uq=N1(),p4=function(Q,$,q){this.name=Q,this.dir=q.dir,this.date=q.date,this.comment=q.comment,this.unixPermissions=q.unixPermissions,this.dosPermissions=q.dosPermissions,this._data=$,this._dataBinary=q.binary,this.options={compression:q.compression,compressionOptions:q.compressionOptions}};p4.prototype={internalStream:function(Q){var $=null,q="string";try{if(!Q)throw new Error("No output type specified.");q=Q.toLowerCase();var K=q==="string"||q==="text";if(q==="binarystring"||q==="text")q="string";$=this._decompressWorker();var J=!this._dataBinary;if(J&&!K)$=$.pipe(new m4.Utf8EncodeWorker);if(!J&&K)$=$.pipe(new m4.Utf8DecodeWorker)}catch(Z){$=new Uq("error"),$.error(Z)}return new mV($,q,"")},async:function(Q,$){return this.internalStream(Q).accumulate($)},nodeStream:function(Q,$){return this.internalStream(Q||"nodebuffer").toNodejsStream($)},_compressWorker:function(Q,$){if(this._data instanceof n4&&this._data.compression.magic===Q.magic)return this._data.getCompressedWorker();else{var q=this._decompressWorker();if(!this._dataBinary)q=q.pipe(new m4.Utf8EncodeWorker);return n4.createWorkerFrom(q,Q,$)}},_decompressWorker:function(){if(this._data instanceof n4)return this._data.getContentWorker();else if(this._data instanceof Uq)return this._data;else return new nV(this._data)}};var Vq=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],pV=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(B8=0;B8{var iV=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Int32Array!=="undefined";function lV(Q,$){return Object.prototype.hasOwnProperty.call(Q,$)}J1.assign=function(Q){var $=Array.prototype.slice.call(arguments,1);while($.length){var q=$.shift();if(!q)continue;if(typeof q!=="object")throw new TypeError(q+"must be non-object");for(var K in q)if(lV(q,K))Q[K]=q[K]}return Q};J1.shrinkBuf=function(Q,$){if(Q.length===$)return Q;if(Q.subarray)return Q.subarray(0,$);return Q.length=$,Q};var oV={arraySet:function(Q,$,q,K,J){if($.subarray&&Q.subarray){Q.set($.subarray(q,q+K),J);return}for(var Z=0;Z{var rV=q2(),sV=4,Bq=0,Wq=1,tV=2;function Y6(Q){var $=Q.length;while(--$>=0)Q[$]=0}var eV=0,Yq=1,QZ=2,qZ=3,$Z=258,t4=29,N8=256,z8=N8+1+t4,N6=30,e4=19,Lq=2*z8+1,d2=15,i4=16,KZ=7,Q7=256,Dq=16,Hq=17,kq=18,r4=[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],Z5=[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],JZ=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],vq=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],UZ=512,$2=new Array((z8+2)*2);Y6($2);var W8=new Array(N6*2);Y6(W8);var F8=new Array(UZ);Y6(F8);var M8=new Array($Z-qZ+1);Y6(M8);var q7=new Array(t4);Y6(q7);var G5=new Array(N6);Y6(G5);function l4(Q,$,q,K,J){this.static_tree=Q,this.extra_bits=$,this.extra_base=q,this.elems=K,this.max_length=J,this.has_stree=Q&&Q.length}var Iq,Rq,Cq;function o4(Q,$){this.dyn_tree=Q,this.max_code=0,this.stat_desc=$}function jq(Q){return Q<256?F8[Q]:F8[256+(Q>>>7)]}function w8(Q,$){Q.pending_buf[Q.pending++]=$&255,Q.pending_buf[Q.pending++]=$>>>8&255}function B1(Q,$,q){if(Q.bi_valid>i4-q)Q.bi_buf|=$<>i4-Q.bi_valid,Q.bi_valid+=q-i4;else Q.bi_buf|=$<>>=1,q<<=1;while(--$>0);return q>>>1}function VZ(Q){if(Q.bi_valid===16)w8(Q,Q.bi_buf),Q.bi_buf=0,Q.bi_valid=0;else if(Q.bi_valid>=8)Q.pending_buf[Q.pending++]=Q.bi_buf&255,Q.bi_buf>>=8,Q.bi_valid-=8}function ZZ(Q,$){var{dyn_tree:q,max_code:K}=$,J=$.stat_desc.static_tree,Z=$.stat_desc.has_stree,G=$.stat_desc.extra_bits,B=$.stat_desc.extra_base,W=$.stat_desc.max_length,U,V,N,F,M,v,x=0;for(F=0;F<=d2;F++)Q.bl_count[F]=0;q[Q.heap[Q.heap_max]*2+1]=0;for(U=Q.heap_max+1;UW)F=W,x++;if(q[V*2+1]=F,V>K)continue;if(Q.bl_count[F]++,M=0,V>=B)M=G[V-B];if(v=q[V*2],Q.opt_len+=v*(F+M),Z)Q.static_len+=v*(J[V*2+1]+M)}if(x===0)return;do{F=W-1;while(Q.bl_count[F]===0)F--;Q.bl_count[F]--,Q.bl_count[F+1]+=2,Q.bl_count[W]--,x-=2}while(x>0);for(F=W;F!==0;F--){V=Q.bl_count[F];while(V!==0){if(N=Q.heap[--U],N>K)continue;if(q[N*2+1]!==F)Q.opt_len+=(F-q[N*2+1])*q[N*2],q[N*2+1]=F;V--}}}function Aq(Q,$,q){var K=new Array(d2+1),J=0,Z,G;for(Z=1;Z<=d2;Z++)K[Z]=J=J+q[Z-1]<<1;for(G=0;G<=$;G++){var B=Q[G*2+1];if(B===0)continue;Q[G*2]=fq(K[B]++,B)}}function GZ(){var Q,$,q,K,J,Z=new Array(d2+1);q=0;for(K=0;K>=7;for(;K8)w8(Q,Q.bi_buf);else if(Q.bi_valid>0)Q.pending_buf[Q.pending++]=Q.bi_buf;Q.bi_buf=0,Q.bi_valid=0}function BZ(Q,$,q,K){if(Xq(Q),K)w8(Q,q),w8(Q,~q);rV.arraySet(Q.pending_buf,Q.window,$,q,Q.pending),Q.pending+=q}function zq(Q,$,q,K){var J=$*2,Z=q*2;return Q[J]>1;G>=1;G--)a4(Q,q,G);U=Z;do G=Q.heap[1],Q.heap[1]=Q.heap[Q.heap_len--],a4(Q,q,1),B=Q.heap[1],Q.heap[--Q.heap_max]=G,Q.heap[--Q.heap_max]=B,q[U*2]=q[G*2]+q[B*2],Q.depth[U]=(Q.depth[G]>=Q.depth[B]?Q.depth[G]:Q.depth[B])+1,q[G*2+1]=q[B*2+1]=U,Q.heap[1]=U++,a4(Q,q,1);while(Q.heap_len>=2);Q.heap[--Q.heap_max]=Q.heap[1],ZZ(Q,$),Aq(q,W,Q.bl_count)}function Mq(Q,$,q){var K,J=-1,Z,G=$[1],B=0,W=7,U=4;if(G===0)W=138,U=3;$[(q+1)*2+1]=65535;for(K=0;K<=q;K++){if(Z=G,G=$[(K+1)*2+1],++B=3;$--)if(Q.bl_tree[vq[$]*2+1]!==0)break;return Q.opt_len+=3*($+1)+5+5+4,$}function zZ(Q,$,q,K){var J;B1(Q,$-257,5),B1(Q,q-1,5),B1(Q,K-4,4);for(J=0;J>>=1)if($&1&&Q.dyn_ltree[q*2]!==0)return Bq;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return Wq;for(q=32;q0){if(Q.strm.data_type===tV)Q.strm.data_type=FZ(Q);if(s4(Q,Q.l_desc),s4(Q,Q.d_desc),G=WZ(Q),J=Q.opt_len+3+7>>>3,Z=Q.static_len+3+7>>>3,Z<=J)J=Z}else J=Z=q+5;if(q+4<=J&&$!==-1)yq(Q,$,q,K);else if(Q.strategy===sV||Z===J)B1(Q,(Yq<<1)+(K?1:0),3),Fq(Q,$2,W8);else B1(Q,(QZ<<1)+(K?1:0),3),zZ(Q,Q.l_desc.max_code+1,Q.d_desc.max_code+1,G+1),Fq(Q,Q.dyn_ltree,Q.dyn_dtree);if(gq(Q),K)Xq(Q)}function YZ(Q,$,q){if(Q.pending_buf[Q.d_buf+Q.last_lit*2]=$>>>8&255,Q.pending_buf[Q.d_buf+Q.last_lit*2+1]=$&255,Q.pending_buf[Q.l_buf+Q.last_lit]=q&255,Q.last_lit++,$===0)Q.dyn_ltree[q*2]++;else Q.matches++,$--,Q.dyn_ltree[(M8[q]+N8+1)*2]++,Q.dyn_dtree[jq($)*2]++;return Q.last_lit===Q.lit_bufsize-1}L6._tr_init=MZ;L6._tr_stored_block=yq;L6._tr_flush_block=NZ;L6._tr_tally=YZ;L6._tr_align=wZ});var $7=N0((w3,xq)=>{function LZ(Q,$,q,K){var J=Q&65535|0,Z=Q>>>16&65535|0,G=0;while(q!==0){G=q>2000?2000:q,q-=G;do J=J+$[K++]|0,Z=Z+J|0;while(--G);J%=65521,Z%=65521}return J|Z<<16|0}xq.exports=LZ});var K7=N0((N3,Oq)=>{function DZ(){var Q,$=[];for(var q=0;q<256;q++){Q=q;for(var K=0;K<8;K++)Q=Q&1?3988292384^Q>>>1:Q>>>1;$[q]=Q}return $}var HZ=DZ();function kZ(Q,$,q,K){var J=HZ,Z=K+q;Q^=-1;for(var G=K;G>>8^J[(Q^$[G])&255];return Q^-1}Oq.exports=kZ});var B5=N0((Y3,Pq)=>{Pq.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 mq=N0((d1)=>{var U1=q2(),I1=hq(),uq=$7(),Y2=K7(),vZ=B5(),i2=0,IZ=1,RZ=3,v2=4,Tq=5,b1=0,Eq=1,R1=-2,CZ=-3,J7=-5,jZ=-1,fZ=1,W5=2,AZ=3,gZ=4,XZ=0,yZ=2,w5=8,hZ=9,xZ=15,OZ=8,PZ=29,TZ=256,V7=TZ+1+PZ,EZ=30,SZ=19,uZ=2*V7+1,_Z=15,j0=3,H2=258,X1=H2+j0+1,cZ=32,N5=42,Z7=69,z5=73,F5=91,M5=103,m2=113,L8=666,l0=1,D8=2,n2=3,k6=4,bZ=3;function k2(Q,$){return Q.msg=vZ[$],$}function Sq(Q){return(Q<<1)-(Q>4?9:0)}function D2(Q){var $=Q.length;while(--$>=0)Q[$]=0}function L2(Q){var $=Q.state,q=$.pending;if(q>Q.avail_out)q=Q.avail_out;if(q===0)return;if(U1.arraySet(Q.output,$.pending_buf,$.pending_out,q,Q.next_out),Q.next_out+=q,$.pending_out+=q,Q.total_out+=q,Q.avail_out-=q,$.pending-=q,$.pending===0)$.pending_out=0}function t0(Q,$){I1._tr_flush_block(Q,Q.block_start>=0?Q.block_start:-1,Q.strstart-Q.block_start,$),Q.block_start=Q.strstart,L2(Q.strm)}function X0(Q,$){Q.pending_buf[Q.pending++]=$}function Y8(Q,$){Q.pending_buf[Q.pending++]=$>>>8&255,Q.pending_buf[Q.pending++]=$&255}function dZ(Q,$,q,K){var J=Q.avail_in;if(J>K)J=K;if(J===0)return 0;if(Q.avail_in-=J,U1.arraySet($,Q.input,Q.next_in,J,q),Q.state.wrap===1)Q.adler=uq(Q.adler,$,J,q);else if(Q.state.wrap===2)Q.adler=Y2(Q.adler,$,J,q);return Q.next_in+=J,Q.total_in+=J,J}function _q(Q,$){var{max_chain_length:q,strstart:K}=Q,J,Z,G=Q.prev_length,B=Q.nice_match,W=Q.strstart>Q.w_size-X1?Q.strstart-(Q.w_size-X1):0,U=Q.window,V=Q.w_mask,N=Q.prev,F=Q.strstart+H2,M=U[K+G-1],v=U[K+G];if(Q.prev_length>=Q.good_match)q>>=2;if(B>Q.lookahead)B=Q.lookahead;do{if(J=$,U[J+G]!==v||U[J+G-1]!==M||U[J]!==U[K]||U[++J]!==U[K+1])continue;K+=2,J++;do;while(U[++K]===U[++J]&&U[++K]===U[++J]&&U[++K]===U[++J]&&U[++K]===U[++J]&&U[++K]===U[++J]&&U[++K]===U[++J]&&U[++K]===U[++J]&&U[++K]===U[++J]&&KG){if(Q.match_start=$,G=Z,Z>=B)break;M=U[K+G-1],v=U[K+G]}}while(($=N[$&V])>W&&--q!==0);if(G<=Q.lookahead)return G;return Q.lookahead}function p2(Q){var $=Q.w_size,q,K,J,Z,G;do{if(Z=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=$+($-X1)){U1.arraySet(Q.window,Q.window,$,$,0),Q.match_start-=$,Q.strstart-=$,Q.block_start-=$,K=Q.hash_size,q=K;do J=Q.head[--q],Q.head[q]=J>=$?J-$:0;while(--K);K=$,q=K;do J=Q.prev[--q],Q.prev[q]=J>=$?J-$:0;while(--K);Z+=$}if(Q.strm.avail_in===0)break;if(K=dZ(Q.strm,Q.window,Q.strstart+Q.lookahead,Z),Q.lookahead+=K,Q.lookahead+Q.insert>=j0){G=Q.strstart-Q.insert,Q.ins_h=Q.window[G],Q.ins_h=(Q.ins_h<Q.pending_buf_size-5)q=Q.pending_buf_size-5;for(;;){if(Q.lookahead<=1){if(p2(Q),Q.lookahead===0&&$===i2)return l0;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var K=Q.block_start+q;if(Q.strstart===0||Q.strstart>=K){if(Q.lookahead=Q.strstart-K,Q.strstart=K,t0(Q,!1),Q.strm.avail_out===0)return l0}if(Q.strstart-Q.block_start>=Q.w_size-X1){if(t0(Q,!1),Q.strm.avail_out===0)return l0}}if(Q.insert=0,$===v2){if(t0(Q,!0),Q.strm.avail_out===0)return n2;return k6}if(Q.strstart>Q.block_start){if(t0(Q,!1),Q.strm.avail_out===0)return l0}return l0}function U7(Q,$){var q,K;for(;;){if(Q.lookahead=j0)Q.ins_h=(Q.ins_h<=j0)if(K=I1._tr_tally(Q,Q.strstart-Q.match_start,Q.match_length-j0),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=j0){Q.match_length--;do Q.strstart++,Q.ins_h=(Q.ins_h<=j0)Q.ins_h=(Q.ins_h<4096))Q.match_length=j0-1}if(Q.prev_length>=j0&&Q.match_length<=Q.prev_length){J=Q.strstart+Q.lookahead-j0,K=I1._tr_tally(Q,Q.strstart-1-Q.prev_match,Q.prev_length-j0),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;do if(++Q.strstart<=J)Q.ins_h=(Q.ins_h<=j0&&Q.strstart>0){if(J=Q.strstart-1,K=G[J],K===G[++J]&&K===G[++J]&&K===G[++J]){Z=Q.strstart+H2;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]&&JQ.lookahead)Q.match_length=Q.lookahead}}if(Q.match_length>=j0)q=I1._tr_tally(Q,1,Q.match_length-j0),Q.lookahead-=Q.match_length,Q.strstart+=Q.match_length,Q.match_length=0;else q=I1._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++;if(q){if(t0(Q,!1),Q.strm.avail_out===0)return l0}}if(Q.insert=0,$===v2){if(t0(Q,!0),Q.strm.avail_out===0)return n2;return k6}if(Q.last_lit){if(t0(Q,!1),Q.strm.avail_out===0)return l0}return D8}function pZ(Q,$){var q;for(;;){if(Q.lookahead===0){if(p2(Q),Q.lookahead===0){if($===i2)return l0;break}}if(Q.match_length=0,q=I1._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++,q){if(t0(Q,!1),Q.strm.avail_out===0)return l0}}if(Q.insert=0,$===v2){if(t0(Q,!0),Q.strm.avail_out===0)return n2;return k6}if(Q.last_lit){if(t0(Q,!1),Q.strm.avail_out===0)return l0}return D8}function c1(Q,$,q,K,J){this.good_length=Q,this.max_lazy=$,this.nice_length=q,this.max_chain=K,this.func=J}var H6;H6=[new c1(0,0,0,0,mZ),new c1(4,4,8,4,U7),new c1(4,5,16,8,U7),new c1(4,6,32,32,U7),new c1(4,4,16,16,D6),new c1(8,16,32,32,D6),new c1(8,16,128,128,D6),new c1(8,32,128,256,D6),new c1(32,128,258,1024,D6),new c1(32,258,258,4096,D6)];function iZ(Q){Q.window_size=2*Q.w_size,D2(Q.head),Q.max_lazy_match=H6[Q.level].max_lazy,Q.good_match=H6[Q.level].good_length,Q.nice_match=H6[Q.level].nice_length,Q.max_chain_length=H6[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=j0-1,Q.match_available=0,Q.ins_h=0}function lZ(){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=w5,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 U1.Buf16(uZ*2),this.dyn_dtree=new U1.Buf16((2*EZ+1)*2),this.bl_tree=new U1.Buf16((2*SZ+1)*2),D2(this.dyn_ltree),D2(this.dyn_dtree),D2(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new U1.Buf16(_Z+1),this.heap=new U1.Buf16(2*V7+1),D2(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new U1.Buf16(2*V7+1),D2(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 cq(Q){var $;if(!Q||!Q.state)return k2(Q,R1);if(Q.total_in=Q.total_out=0,Q.data_type=yZ,$=Q.state,$.pending=0,$.pending_out=0,$.wrap<0)$.wrap=-$.wrap;return $.status=$.wrap?N5:m2,Q.adler=$.wrap===2?0:1,$.last_flush=i2,I1._tr_init($),b1}function bq(Q){var $=cq(Q);if($===b1)iZ(Q.state);return $}function oZ(Q,$){if(!Q||!Q.state)return R1;if(Q.state.wrap!==2)return R1;return Q.state.gzhead=$,b1}function dq(Q,$,q,K,J,Z){if(!Q)return R1;var G=1;if($===jZ)$=6;if(K<0)G=0,K=-K;else if(K>15)G=2,K-=16;if(J<1||J>hZ||q!==w5||K<8||K>15||$<0||$>9||Z<0||Z>gZ)return k2(Q,R1);if(K===8)K=9;var B=new lZ;return Q.state=B,B.strm=Q,B.wrap=G,B.gzhead=null,B.w_bits=K,B.w_size=1<Tq||$<0)return Q?k2(Q,R1):R1;if(K=Q.state,!Q.output||!Q.input&&Q.avail_in!==0||K.status===L8&&$!==v2)return k2(Q,Q.avail_out===0?J7:R1);if(K.strm=Q,q=K.last_flush,K.last_flush=$,K.status===N5)if(K.wrap===2)if(Q.adler=0,X0(K,31),X0(K,139),X0(K,8),!K.gzhead)X0(K,0),X0(K,0),X0(K,0),X0(K,0),X0(K,0),X0(K,K.level===9?2:K.strategy>=W5||K.level<2?4:0),X0(K,bZ),K.status=m2;else{if(X0(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)),X0(K,K.gzhead.time&255),X0(K,K.gzhead.time>>8&255),X0(K,K.gzhead.time>>16&255),X0(K,K.gzhead.time>>24&255),X0(K,K.level===9?2:K.strategy>=W5||K.level<2?4:0),X0(K,K.gzhead.os&255),K.gzhead.extra&&K.gzhead.extra.length)X0(K,K.gzhead.extra.length&255),X0(K,K.gzhead.extra.length>>8&255);if(K.gzhead.hcrc)Q.adler=Y2(Q.adler,K.pending_buf,K.pending,0);K.gzindex=0,K.status=Z7}else{var G=w5+(K.w_bits-8<<4)<<8,B=-1;if(K.strategy>=W5||K.level<2)B=0;else if(K.level<6)B=1;else if(K.level===6)B=2;else B=3;if(G|=B<<6,K.strstart!==0)G|=cZ;if(G+=31-G%31,K.status=m2,Y8(K,G),K.strstart!==0)Y8(K,Q.adler>>>16),Y8(K,Q.adler&65535);Q.adler=1}if(K.status===Z7)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)Q.adler=Y2(Q.adler,K.pending_buf,K.pending-J,J);if(L2(Q),J=K.pending,K.pending===K.pending_buf_size)break}X0(K,K.gzhead.extra[K.gzindex]&255),K.gzindex++}if(K.gzhead.hcrc&&K.pending>J)Q.adler=Y2(Q.adler,K.pending_buf,K.pending-J,J);if(K.gzindex===K.gzhead.extra.length)K.gzindex=0,K.status=z5}else K.status=z5;if(K.status===z5)if(K.gzhead.name){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)Q.adler=Y2(Q.adler,K.pending_buf,K.pending-J,J);if(L2(Q),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)Q.adler=Y2(Q.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.gzindex=0,K.status=F5}else K.status=F5;if(K.status===F5)if(K.gzhead.comment){J=K.pending;do{if(K.pending===K.pending_buf_size){if(K.gzhead.hcrc&&K.pending>J)Q.adler=Y2(Q.adler,K.pending_buf,K.pending-J,J);if(L2(Q),J=K.pending,K.pending===K.pending_buf_size){Z=1;break}}if(K.gzindexJ)Q.adler=Y2(Q.adler,K.pending_buf,K.pending-J,J);if(Z===0)K.status=M5}else K.status=M5;if(K.status===M5)if(K.gzhead.hcrc){if(K.pending+2>K.pending_buf_size)L2(Q);if(K.pending+2<=K.pending_buf_size)X0(K,Q.adler&255),X0(K,Q.adler>>8&255),Q.adler=0,K.status=m2}else K.status=m2;if(K.pending!==0){if(L2(Q),Q.avail_out===0)return K.last_flush=-1,b1}else if(Q.avail_in===0&&Sq($)<=Sq(q)&&$!==v2)return k2(Q,J7);if(K.status===L8&&Q.avail_in!==0)return k2(Q,J7);if(Q.avail_in!==0||K.lookahead!==0||$!==i2&&K.status!==L8){var W=K.strategy===W5?pZ(K,$):K.strategy===AZ?nZ(K,$):H6[K.level].func(K,$);if(W===n2||W===k6)K.status=L8;if(W===l0||W===n2){if(Q.avail_out===0)K.last_flush=-1;return b1}if(W===D8){if($===IZ)I1._tr_align(K);else if($!==Tq){if(I1._tr_stored_block(K,0,0,!1),$===RZ){if(D2(K.head),K.lookahead===0)K.strstart=0,K.block_start=0,K.insert=0}}if(L2(Q),Q.avail_out===0)return K.last_flush=-1,b1}}if($!==v2)return b1;if(K.wrap<=0)return Eq;if(K.wrap===2)X0(K,Q.adler&255),X0(K,Q.adler>>8&255),X0(K,Q.adler>>16&255),X0(K,Q.adler>>24&255),X0(K,Q.total_in&255),X0(K,Q.total_in>>8&255),X0(K,Q.total_in>>16&255),X0(K,Q.total_in>>24&255);else Y8(K,Q.adler>>>16),Y8(K,Q.adler&65535);if(L2(Q),K.wrap>0)K.wrap=-K.wrap;return K.pending!==0?b1:Eq}function sZ(Q){var $;if(!Q||!Q.state)return R1;if($=Q.state.status,$!==N5&&$!==Z7&&$!==z5&&$!==F5&&$!==M5&&$!==m2&&$!==L8)return k2(Q,R1);return Q.state=null,$===m2?k2(Q,CZ):b1}function tZ(Q,$){var q=$.length,K,J,Z,G,B,W,U,V;if(!Q||!Q.state)return R1;if(K=Q.state,G=K.wrap,G===2||G===1&&K.status!==N5||K.lookahead)return R1;if(G===1)Q.adler=uq(Q.adler,$,q,0);if(K.wrap=0,q>=K.w_size){if(G===0)D2(K.head),K.strstart=0,K.block_start=0,K.insert=0;V=new U1.Buf8(K.w_size),U1.arraySet(V,$,q-K.w_size,K.w_size,0),$=V,q=K.w_size}B=Q.avail_in,W=Q.next_in,U=Q.input,Q.avail_in=q,Q.next_in=0,Q.input=$,p2(K);while(K.lookahead>=j0){J=K.strstart,Z=K.lookahead-(j0-1);do K.ins_h=(K.ins_h<{var Y5=q2(),nq=!0,pq=!0;try{String.fromCharCode.apply(null,[0])}catch(Q){nq=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(Q){pq=!1}var H8=new Y5.Buf8(256);for(m1=0;m1<256;m1++)H8[m1]=m1>=252?6:m1>=248?5:m1>=240?4:m1>=224?3:m1>=192?2:1;var m1;H8[254]=H8[254]=1;v6.string2buf=function(Q){var $,q,K,J,Z,G=Q.length,B=0;for(J=0;J>>6,$[Z++]=128|q&63;else if(q<65536)$[Z++]=224|q>>>12,$[Z++]=128|q>>>6&63,$[Z++]=128|q&63;else $[Z++]=240|q>>>18,$[Z++]=128|q>>>12&63,$[Z++]=128|q>>>6&63,$[Z++]=128|q&63}return $};function iq(Q,$){if($<65534){if(Q.subarray&&pq||!Q.subarray&&nq)return String.fromCharCode.apply(null,Y5.shrinkBuf(Q,$))}var q="";for(var K=0;K<$;K++)q+=String.fromCharCode(Q[K]);return q}v6.buf2binstring=function(Q){return iq(Q,Q.length)};v6.binstring2buf=function(Q){var $=new Y5.Buf8(Q.length);for(var q=0,K=$.length;q4){B[K++]=65533,q+=Z-1;continue}J&=Z===2?31:Z===3?15:7;while(Z>1&&q1){B[K++]=65533;continue}if(J<65536)B[K++]=J;else J-=65536,B[K++]=55296|J>>10&1023,B[K++]=56320|J&1023}return iq(B,K)};v6.utf8border=function(Q,$){var q;if($=$||Q.length,$>Q.length)$=Q.length;q=$-1;while(q>=0&&(Q[q]&192)===128)q--;if(q<0)return $;if(q===0)return $;return q+H8[Q[q]]>$?q:$}});var B7=N0((H3,lq)=>{function eZ(){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}lq.exports=eZ});var sq=N0((I8)=>{var k8=mq(),v8=q2(),z7=G7(),F7=B5(),QG=B7(),rq=Object.prototype.toString,qG=0,W7=4,I6=0,oq=1,aq=2,$G=-1,KG=0,JG=8;function l2(Q){if(!(this instanceof l2))return new l2(Q);this.options=v8.assign({level:$G,method:JG,chunkSize:16384,windowBits:15,memLevel:8,strategy:KG,to:""},Q||{});var $=this.options;if($.raw&&$.windowBits>0)$.windowBits=-$.windowBits;else if($.gzip&&$.windowBits>0&&$.windowBits<16)$.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new QG,this.strm.avail_out=0;var q=k8.deflateInit2(this.strm,$.level,$.method,$.windowBits,$.memLevel,$.strategy);if(q!==I6)throw new Error(F7[q]);if($.header)k8.deflateSetHeader(this.strm,$.header);if($.dictionary){var K;if(typeof $.dictionary==="string")K=z7.string2buf($.dictionary);else if(rq.call($.dictionary)==="[object ArrayBuffer]")K=new Uint8Array($.dictionary);else K=$.dictionary;if(q=k8.deflateSetDictionary(this.strm,K),q!==I6)throw new Error(F7[q]);this._dict_set=!0}}l2.prototype.push=function(Q,$){var q=this.strm,K=this.options.chunkSize,J,Z;if(this.ended)return!1;if(Z=$===~~$?$:$===!0?W7:qG,typeof Q==="string")q.input=z7.string2buf(Q);else if(rq.call(Q)==="[object ArrayBuffer]")q.input=new Uint8Array(Q);else q.input=Q;q.next_in=0,q.avail_in=q.input.length;do{if(q.avail_out===0)q.output=new v8.Buf8(K),q.next_out=0,q.avail_out=K;if(J=k8.deflate(q,Z),J!==oq&&J!==I6)return this.onEnd(J),this.ended=!0,!1;if(q.avail_out===0||q.avail_in===0&&(Z===W7||Z===aq))if(this.options.to==="string")this.onData(z7.buf2binstring(v8.shrinkBuf(q.output,q.next_out)));else this.onData(v8.shrinkBuf(q.output,q.next_out))}while((q.avail_in>0||q.avail_out===0)&&J!==oq);if(Z===W7)return J=k8.deflateEnd(this.strm),this.onEnd(J),this.ended=!0,J===I6;if(Z===aq)return this.onEnd(I6),q.avail_out=0,!0;return!0};l2.prototype.onData=function(Q){this.chunks.push(Q)};l2.prototype.onEnd=function(Q){if(Q===I6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=v8.flattenChunks(this.chunks);this.chunks=[],this.err=Q,this.msg=this.strm.msg};function M7(Q,$){var q=new l2($);if(q.push(Q,!0),q.err)throw q.msg||F7[q.err];return q.result}function UG(Q,$){return $=$||{},$.raw=!0,M7(Q,$)}function VG(Q,$){return $=$||{},$.gzip=!0,M7(Q,$)}I8.Deflate=l2;I8.deflate=M7;I8.deflateRaw=UG;I8.gzip=VG});var eq=N0((v3,tq)=>{var L5=30,ZG=12;tq.exports=function Q($,q){var K,J,Z,G,B,W,U,V,N,F,M,v,x,y,D,z,Y,H,R,c,m,$0,_,g,O;K=$.state,J=$.next_in,g=$.input,Z=J+($.avail_in-5),G=$.next_out,O=$.output,B=G-(q-$.avail_out),W=G+($.avail_out-257),U=K.dmax,V=K.wsize,N=K.whave,F=K.wnext,M=K.window,v=K.hold,x=K.bits,y=K.lencode,D=K.distcode,z=(1<>>24,v>>>=R,x-=R,R=H>>>16&255,R===0)O[G++]=H&65535;else if(R&16){if(c=H&65535,R&=15,R){if(x>>=R,x-=R}if(x<15)v+=g[J++]<>>24,v>>>=R,x-=R,R=H>>>16&255,R&16){if(m=H&65535,R&=15,xU){$.msg="invalid distance too far back",K.mode=L5;break Q}if(v>>>=R,x-=R,R=G-B,m>R){if(R=m-R,R>N){if(K.sane){$.msg="invalid distance too far back",K.mode=L5;break Q}}if($0=0,_=M,F===0){if($0+=V-R,R2)O[G++]=_[$0++],O[G++]=_[$0++],O[G++]=_[$0++],c-=3;if(c){if(O[G++]=_[$0++],c>1)O[G++]=_[$0++]}}else{$0=G-m;do O[G++]=O[$0++],O[G++]=O[$0++],O[G++]=O[$0++],c-=3;while(c>2);if(c){if(O[G++]=O[$0++],c>1)O[G++]=O[$0++]}}}else if((R&64)===0){H=D[(H&65535)+(v&(1<>3,J-=c,x-=c<<3,v&=(1<{var Q$=q2(),R6=15,q$=852,$$=592,K$=0,w7=1,J$=2,GG=[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],BG=[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],WG=[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],zG=[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];U$.exports=function Q($,q,K,J,Z,G,B,W){var U=W.bits,V=0,N=0,F=0,M=0,v=0,x=0,y=0,D=0,z=0,Y=0,H,R,c,m,$0,_=null,g=0,O,h=new Q$.Buf16(R6+1),f=new Q$.Buf16(R6+1),A=null,I=0,n,i,K0;for(V=0;V<=R6;V++)h[V]=0;for(N=0;N=1;M--)if(h[M]!==0)break;if(v>M)v=M;if(M===0)return Z[G++]=20971520,Z[G++]=20971520,W.bits=1,0;for(F=1;F0&&($===K$||M!==1))return-1;f[1]=0;for(V=1;Vq$||$===J$&&z>$$)return 1;for(;;){if(n=V-y,B[N]O)i=A[I+B[N]],K0=_[g+B[N]];else i=96,K0=0;H=1<>y)+R]=n<<24|i<<16|K0|0;while(R!==0);H=1<>=1;if(H!==0)Y&=H-1,Y+=H;else Y=0;if(N++,--h[V]===0){if(V===M)break;V=q[K+B[N]]}if(V>v&&(Y&m)!==c){if(y===0)y=v;$0+=F,x=V-y,D=1<q$||$===J$&&z>$$)return 1;c=Y&m,Z[c]=v<<24|x<<16|$0-G|0}}if(Y!==0)Z[$0+Y]=V-y<<24|4194304|0;return W.bits=v,0}});var b$=N0((y1)=>{var Y1=q2(),k7=$7(),n1=K7(),FG=eq(),R8=V$(),MG=0,x$=1,O$=2,Z$=4,wG=5,D5=6,o2=0,NG=1,YG=2,C1=-2,P$=-3,v7=-4,LG=-5,G$=8,T$=1,B$=2,W$=3,z$=4,F$=5,M$=6,w$=7,N$=8,Y$=9,L$=10,v5=11,K2=12,N7=13,D$=14,Y7=15,H$=16,k$=17,v$=18,I$=19,H5=20,k5=21,R$=22,C$=23,j$=24,f$=25,A$=26,L7=27,g$=28,X$=29,u0=30,I7=31,DG=32,HG=852,kG=592,vG=15,IG=vG;function y$(Q){return(Q>>>24&255)+(Q>>>8&65280)+((Q&65280)<<8)+((Q&255)<<24)}function RG(){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 Y1.Buf16(320),this.work=new Y1.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function E$(Q){var $;if(!Q||!Q.state)return C1;if($=Q.state,Q.total_in=Q.total_out=$.total=0,Q.msg="",$.wrap)Q.adler=$.wrap&1;return $.mode=T$,$.last=0,$.havedict=0,$.dmax=32768,$.head=null,$.hold=0,$.bits=0,$.lencode=$.lendyn=new Y1.Buf32(HG),$.distcode=$.distdyn=new Y1.Buf32(kG),$.sane=1,$.back=-1,o2}function S$(Q){var $;if(!Q||!Q.state)return C1;return $=Q.state,$.wsize=0,$.whave=0,$.wnext=0,E$(Q)}function u$(Q,$){var q,K;if(!Q||!Q.state)return C1;if(K=Q.state,$<0)q=0,$=-$;else if(q=($>>4)+1,$<48)$&=15;if($&&($<8||$>15))return C1;if(K.window!==null&&K.wbits!==$)K.window=null;return K.wrap=q,K.wbits=$,S$(Q)}function _$(Q,$){var q,K;if(!Q)return C1;if(K=new RG,Q.state=K,K.window=null,q=u$(Q,$),q!==o2)Q.state=null;return q}function CG(Q){return _$(Q,IG)}var h$=!0,D7,H7;function jG(Q){if(h$){var $;D7=new Y1.Buf32(512),H7=new Y1.Buf32(32),$=0;while($<144)Q.lens[$++]=8;while($<256)Q.lens[$++]=9;while($<280)Q.lens[$++]=7;while($<288)Q.lens[$++]=8;R8(x$,Q.lens,0,288,D7,0,Q.work,{bits:9}),$=0;while($<32)Q.lens[$++]=5;R8(O$,Q.lens,0,32,H7,0,Q.work,{bits:5}),h$=!1}Q.lencode=D7,Q.lenbits=9,Q.distcode=H7,Q.distbits=5}function c$(Q,$,q,K){var J,Z=Q.state;if(Z.window===null)Z.wsize=1<=Z.wsize)Y1.arraySet(Z.window,$,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(Y1.arraySet(Z.window,$,q-K,J,Z.wnext),K-=J,K)Y1.arraySet(Z.window,$,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=n1(q.check,_,2,0),U=0,V=0,q.mode=B$;break}if(q.flags=0,q.head)q.head.done=!1;if(!(q.wrap&1)||(((U&255)<<8)+(U>>8))%31){Q.msg="incorrect header check",q.mode=u0;break}if((U&15)!==G$){Q.msg="unknown compression method",q.mode=u0;break}if(U>>>=4,V-=4,m=(U&15)+8,q.wbits===0)q.wbits=m;else if(m>q.wbits){Q.msg="invalid window size",q.mode=u0;break}q.dmax=1<>8&1;if(q.flags&512)_[0]=U&255,_[1]=U>>>8&255,q.check=n1(q.check,_,2,0);U=0,V=0,q.mode=W$;case W$:while(V<32){if(B===0)break Q;B--,U+=K[Z++]<>>8&255,_[2]=U>>>16&255,_[3]=U>>>24&255,q.check=n1(q.check,_,4,0);U=0,V=0,q.mode=z$;case z$:while(V<16){if(B===0)break Q;B--,U+=K[Z++]<>8;if(q.flags&512)_[0]=U&255,_[1]=U>>>8&255,q.check=n1(q.check,_,2,0);U=0,V=0,q.mode=F$;case F$:if(q.flags&1024){while(V<16){if(B===0)break Q;B--,U+=K[Z++]<>>8&255,q.check=n1(q.check,_,2,0);U=0,V=0}else if(q.head)q.head.extra=null;q.mode=M$;case M$:if(q.flags&1024){if(M=q.length,M>B)M=B;if(M){if(q.head){if(m=q.head.extra_len-q.length,!q.head.extra)q.head.extra=new Array(q.head.extra_len);Y1.arraySet(q.head.extra,K,Z,M,m)}if(q.flags&512)q.check=n1(q.check,K,M,Z);B-=M,Z+=M,q.length-=M}if(q.length)break Q}q.length=0,q.mode=w$;case w$:if(q.flags&2048){if(B===0)break Q;M=0;do if(m=K[Z+M++],q.head&&m&&q.length<65536)q.head.name+=String.fromCharCode(m);while(m&&M>9&1,q.head.done=!0;Q.adler=q.check=0,q.mode=K2;break;case L$:while(V<32){if(B===0)break Q;B--,U+=K[Z++]<>>=V&7,V-=V&7,q.mode=L7;break}while(V<3){if(B===0)break Q;B--,U+=K[Z++]<>>=1,V-=1,U&3){case 0:q.mode=D$;break;case 1:if(jG(q),q.mode=H5,$===D5){U>>>=2,V-=2;break Q}break;case 2:q.mode=k$;break;case 3:Q.msg="invalid block type",q.mode=u0}U>>>=2,V-=2;break;case D$:U>>>=V&7,V-=V&7;while(V<32){if(B===0)break Q;B--,U+=K[Z++]<>>16^65535)){Q.msg="invalid stored block lengths",q.mode=u0;break}if(q.length=U&65535,U=0,V=0,q.mode=Y7,$===D5)break Q;case Y7:q.mode=H$;case H$:if(M=q.length,M){if(M>B)M=B;if(M>W)M=W;if(M===0)break Q;Y1.arraySet(J,K,Z,M,G),B-=M,Z+=M,W-=M,G+=M,q.length-=M;break}q.mode=K2;break;case k$:while(V<14){if(B===0)break Q;B--,U+=K[Z++]<>>=5,V-=5,q.ndist=(U&31)+1,U>>>=5,V-=5,q.ncode=(U&15)+4,U>>>=4,V-=4,q.nlen>286||q.ndist>30){Q.msg="too many length or distance symbols",q.mode=u0;break}q.have=0,q.mode=v$;case v$:while(q.have>>=3,V-=3}while(q.have<19)q.lens[h[q.have++]]=0;if(q.lencode=q.lendyn,q.lenbits=7,g={bits:q.lenbits},$0=R8(MG,q.lens,0,19,q.lencode,0,q.work,g),q.lenbits=g.bits,$0){Q.msg="invalid code lengths set",q.mode=u0;break}q.have=0,q.mode=I$;case I$:while(q.have>>24,z=y>>>16&255,Y=y&65535,D<=V)break;if(B===0)break Q;B--,U+=K[Z++]<>>=D,V-=D,q.lens[q.have++]=Y;else{if(Y===16){O=D+2;while(V>>=D,V-=D,q.have===0){Q.msg="invalid bit length repeat",q.mode=u0;break}m=q.lens[q.have-1],M=3+(U&3),U>>>=2,V-=2}else if(Y===17){O=D+3;while(V>>=D,V-=D,m=0,M=3+(U&7),U>>>=3,V-=3}else{O=D+7;while(V>>=D,V-=D,m=0,M=11+(U&127),U>>>=7,V-=7}if(q.have+M>q.nlen+q.ndist){Q.msg="invalid bit length repeat",q.mode=u0;break}while(M--)q.lens[q.have++]=m}}if(q.mode===u0)break;if(q.lens[256]===0){Q.msg="invalid code -- missing end-of-block",q.mode=u0;break}if(q.lenbits=9,g={bits:q.lenbits},$0=R8(x$,q.lens,0,q.nlen,q.lencode,0,q.work,g),q.lenbits=g.bits,$0){Q.msg="invalid literal/lengths set",q.mode=u0;break}if(q.distbits=6,q.distcode=q.distdyn,g={bits:q.distbits},$0=R8(O$,q.lens,q.nlen,q.ndist,q.distcode,0,q.work,g),q.distbits=g.bits,$0){Q.msg="invalid distances set",q.mode=u0;break}if(q.mode=H5,$===D5)break Q;case H5:q.mode=k5;case k5:if(B>=6&&W>=258){if(Q.next_out=G,Q.avail_out=W,Q.next_in=Z,Q.avail_in=B,q.hold=U,q.bits=V,FG(Q,F),G=Q.next_out,J=Q.output,W=Q.avail_out,Z=Q.next_in,K=Q.input,B=Q.avail_in,U=q.hold,V=q.bits,q.mode===K2)q.back=-1;break}q.back=0;for(;;){if(y=q.lencode[U&(1<>>24,z=y>>>16&255,Y=y&65535,D<=V)break;if(B===0)break Q;B--,U+=K[Z++]<>H)],D=y>>>24,z=y>>>16&255,Y=y&65535,H+D<=V)break;if(B===0)break Q;B--,U+=K[Z++]<>>=H,V-=H,q.back+=H}if(U>>>=D,V-=D,q.back+=D,q.length=Y,z===0){q.mode=A$;break}if(z&32){q.back=-1,q.mode=K2;break}if(z&64){Q.msg="invalid literal/length code",q.mode=u0;break}q.extra=z&15,q.mode=R$;case R$:if(q.extra){O=q.extra;while(V>>=q.extra,V-=q.extra,q.back+=q.extra}q.was=q.length,q.mode=C$;case C$:for(;;){if(y=q.distcode[U&(1<>>24,z=y>>>16&255,Y=y&65535,D<=V)break;if(B===0)break Q;B--,U+=K[Z++]<>H)],D=y>>>24,z=y>>>16&255,Y=y&65535,H+D<=V)break;if(B===0)break Q;B--,U+=K[Z++]<>>=H,V-=H,q.back+=H}if(U>>>=D,V-=D,q.back+=D,z&64){Q.msg="invalid distance code",q.mode=u0;break}q.offset=Y,q.extra=z&15,q.mode=j$;case j$:if(q.extra){O=q.extra;while(V>>=q.extra,V-=q.extra,q.back+=q.extra}if(q.offset>q.dmax){Q.msg="invalid distance too far back",q.mode=u0;break}q.mode=f$;case f$:if(W===0)break Q;if(M=F-W,q.offset>M){if(M=q.offset-M,M>q.whave){if(q.sane){Q.msg="invalid distance too far back",q.mode=u0;break}}if(M>q.wnext)M-=q.wnext,v=q.wsize-M;else v=q.wnext-M;if(M>q.length)M=q.length;x=q.window}else x=J,v=G-q.offset,M=q.length;if(M>W)M=W;W-=M,q.length-=M;do J[G++]=x[v++];while(--M);if(q.length===0)q.mode=k5;break;case A$:if(W===0)break Q;J[G++]=q.length,W--,q.mode=k5;break;case L7:if(q.wrap){while(V<32){if(B===0)break Q;B--,U|=K[Z++]<{d$.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 n$=N0((j3,m$)=>{function yG(){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}m$.exports=yG});var i$=N0((j8)=>{var C6=b$(),C8=q2(),I5=G7(),n0=R7(),C7=B5(),hG=B7(),xG=n$(),p$=Object.prototype.toString;function a2(Q){if(!(this instanceof a2))return new a2(Q);this.options=C8.assign({chunkSize:16384,windowBits:0,to:""},Q||{});var $=this.options;if($.raw&&$.windowBits>=0&&$.windowBits<16){if($.windowBits=-$.windowBits,$.windowBits===0)$.windowBits=-15}if($.windowBits>=0&&$.windowBits<16&&!(Q&&Q.windowBits))$.windowBits+=32;if($.windowBits>15&&$.windowBits<48){if(($.windowBits&15)===0)$.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new hG,this.strm.avail_out=0;var q=C6.inflateInit2(this.strm,$.windowBits);if(q!==n0.Z_OK)throw new Error(C7[q]);if(this.header=new xG,C6.inflateGetHeader(this.strm,this.header),$.dictionary){if(typeof $.dictionary==="string")$.dictionary=I5.string2buf($.dictionary);else if(p$.call($.dictionary)==="[object ArrayBuffer]")$.dictionary=new Uint8Array($.dictionary);if($.raw){if(q=C6.inflateSetDictionary(this.strm,$.dictionary),q!==n0.Z_OK)throw new Error(C7[q])}}}a2.prototype.push=function(Q,$){var q=this.strm,K=this.options.chunkSize,J=this.options.dictionary,Z,G,B,W,U,V=!1;if(this.ended)return!1;if(G=$===~~$?$:$===!0?n0.Z_FINISH:n0.Z_NO_FLUSH,typeof Q==="string")q.input=I5.binstring2buf(Q);else if(p$.call(Q)==="[object ArrayBuffer]")q.input=new Uint8Array(Q);else q.input=Q;q.next_in=0,q.avail_in=q.input.length;do{if(q.avail_out===0)q.output=new C8.Buf8(K),q.next_out=0,q.avail_out=K;if(Z=C6.inflate(q,n0.Z_NO_FLUSH),Z===n0.Z_NEED_DICT&&J)Z=C6.inflateSetDictionary(this.strm,J);if(Z===n0.Z_BUF_ERROR&&V===!0)Z=n0.Z_OK,V=!1;if(Z!==n0.Z_STREAM_END&&Z!==n0.Z_OK)return this.onEnd(Z),this.ended=!0,!1;if(q.next_out){if(q.avail_out===0||Z===n0.Z_STREAM_END||q.avail_in===0&&(G===n0.Z_FINISH||G===n0.Z_SYNC_FLUSH))if(this.options.to==="string"){if(B=I5.utf8border(q.output,q.next_out),W=q.next_out-B,U=I5.buf2string(q.output,B),q.next_out=W,q.avail_out=K-W,W)C8.arraySet(q.output,q.output,B,W,0);this.onData(U)}else this.onData(C8.shrinkBuf(q.output,q.next_out))}if(q.avail_in===0&&q.avail_out===0)V=!0}while((q.avail_in>0||q.avail_out===0)&&Z!==n0.Z_STREAM_END);if(Z===n0.Z_STREAM_END)G=n0.Z_FINISH;if(G===n0.Z_FINISH)return Z=C6.inflateEnd(this.strm),this.onEnd(Z),this.ended=!0,Z===n0.Z_OK;if(G===n0.Z_SYNC_FLUSH)return this.onEnd(n0.Z_OK),q.avail_out=0,!0;return!0};a2.prototype.onData=function(Q){this.chunks.push(Q)};a2.prototype.onEnd=function(Q){if(Q===n0.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=C8.flattenChunks(this.chunks);this.chunks=[],this.err=Q,this.msg=this.strm.msg};function j7(Q,$){var q=new a2($);if(q.push(Q,!0),q.err)throw q.msg||C7[q.err];return q.result}function OG(Q,$){return $=$||{},$.raw=!0,j7(Q,$)}j8.Inflate=a2;j8.inflate=j7;j8.inflateRaw=OG;j8.ungzip=j7});var a$=N0((A3,o$)=>{var PG=q2().assign,TG=sq(),EG=i$(),SG=R7(),l$={};PG(l$,TG,EG,SG);o$.exports=l$});var s$=N0((C5)=>{var uG=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Uint32Array!=="undefined",_G=a$(),r$=c0(),R5=N1(),cG=uG?"uint8array":"array";C5.magic="\b\x00";function r2(Q,$){R5.call(this,"FlateWorker/"+Q),this._pako=null,this._pakoAction=Q,this._pakoOptions=$,this.meta={}}r$.inherits(r2,R5);r2.prototype.processChunk=function(Q){if(this.meta=Q.meta,this._pako===null)this._createPako();this._pako.push(r$.transformTo(cG,Q.data),!1)};r2.prototype.flush=function(){if(R5.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};r2.prototype.cleanUp=function(){R5.prototype.cleanUp.call(this),this._pako=null};r2.prototype._createPako=function(){this._pako=new _G[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var Q=this;this._pako.onData=function($){Q.push({data:$,meta:Q.meta})}};C5.compressWorker=function(Q){return new r2("Deflate",Q)};C5.uncompressWorker=function(){return new r2("Inflate",{})}});var A7=N0((f7)=>{var t$=N1();f7.STORE={magic:"\x00\x00",compressWorker:function(){return new t$("STORE compression")},uncompressWorker:function(){return new t$("STORE decompression")}};f7.DEFLATE=s$()});var g7=N0((s2)=>{s2.LOCAL_FILE_HEADER="PK\x03\x04";s2.CENTRAL_FILE_HEADER="PK\x01\x02";s2.CENTRAL_DIRECTORY_END="PK\x05\x06";s2.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";s2.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";s2.DATA_DESCRIPTOR="PK\x07\b"});var $K=N0((h3,qK)=>{var j6=c0(),f6=N1(),X7=M6(),e$=U5(),j5=g7(),T0=function(Q,$){var q="",K;for(K=0;K<$;K++)q+=String.fromCharCode(Q&255),Q=Q>>>8;return q},bG=function(Q,$){var q=Q;if(!Q)q=$?16893:33204;return(q&65535)<<16},dG=function(Q){return(Q||0)&63},QK=function(Q,$,q,K,J,Z){var{file:G,compression:B}=Q,W=Z!==X7.utf8encode,U=j6.transformTo("string",Z(G.name)),V=j6.transformTo("string",X7.utf8encode(G.name)),N=G.comment,F=j6.transformTo("string",Z(N)),M=j6.transformTo("string",X7.utf8encode(N)),v=V.length!==G.name.length,x=M.length!==N.length,y,D,z="",Y="",H="",R=G.dir,c=G.date,m={crc32:0,compressedSize:0,uncompressedSize:0};if(!$||q)m.crc32=Q.crc32,m.compressedSize=Q.compressedSize,m.uncompressedSize=Q.uncompressedSize;var $0=0;if($)$0|=8;if(!W&&(v||x))$0|=2048;var _=0,g=0;if(R)_|=16;if(J==="UNIX")g=798,_|=bG(G.unixPermissions,R);else g=20,_|=dG(G.dosPermissions,R);if(y=c.getUTCHours(),y=y<<6,y=y|c.getUTCMinutes(),y=y<<5,y=y|c.getUTCSeconds()/2,D=c.getUTCFullYear()-1980,D=D<<4,D=D|c.getUTCMonth()+1,D=D<<5,D=D|c.getUTCDate(),v)Y=T0(1,1)+T0(e$(U),4)+V,z+="up"+T0(Y.length,2)+Y;if(x)H=T0(1,1)+T0(e$(F),4)+M,z+="uc"+T0(H.length,2)+H;var O="";O+=` -\x00`,O+=T0($0,2),O+=B.magic,O+=T0(y,2),O+=T0(D,2),O+=T0(m.crc32,4),O+=T0(m.compressedSize,4),O+=T0(m.uncompressedSize,4),O+=T0(U.length,2),O+=T0(z.length,2);var h=j5.LOCAL_FILE_HEADER+O+U+z,f=j5.CENTRAL_FILE_HEADER+T0(g,2)+O+T0(F.length,2)+"\x00\x00\x00\x00"+T0(_,4)+T0(K,4)+U+z+F;return{fileRecord:h,dirRecord:f}},mG=function(Q,$,q,K,J){var Z="",G=j6.transformTo("string",J(K));return Z=j5.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+T0(Q,2)+T0(Q,2)+T0($,4)+T0(q,4)+T0(G.length,2)+G,Z},nG=function(Q){var $="";return $=j5.DATA_DESCRIPTOR+T0(Q.crc32,4)+T0(Q.compressedSize,4)+T0(Q.uncompressedSize,4),$};function h1(Q,$,q,K){f6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=$,this.zipPlatform=q,this.encodeFileName=K,this.streamFiles=Q,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}j6.inherits(h1,f6);h1.prototype.push=function(Q){var $=Q.meta.percent||0,q=this.entriesCount,K=this._sources.length;if(this.accumulate)this.contentBuffer.push(Q);else this.bytesWritten+=Q.data.length,f6.prototype.push.call(this,{data:Q.data,meta:{currentFile:this.currentFile,percent:q?($+100*(q-K-1))/q:100}})};h1.prototype.openedSource=function(Q){this.currentSourceOffset=this.bytesWritten,this.currentFile=Q.file.name;var $=this.streamFiles&&!Q.file.dir;if($){var q=QK(Q,$,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};h1.prototype.closedSource=function(Q){this.accumulate=!1;var $=this.streamFiles&&!Q.file.dir,q=QK(Q,$,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(q.dirRecord),$)this.push({data:nG(Q),meta:{percent:100}});else{this.push({data:q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};h1.prototype.flush=function(){var Q=this.bytesWritten;for(var $=0;${var pG=A7(),iG=$K(),lG=function(Q,$){var q=Q||$,K=pG[q];if(!K)throw new Error(q+" is not a valid compression method !");return K};KK.generateWorker=function(Q,$,q){var K=new iG($.streamFiles,q,$.platform,$.encodeFileName),J=0;try{Q.forEach(function(Z,G){J++;var B=lG(G.options.compression,$.compression),W=G.options.compressionOptions||$.compressionOptions||{},U=G.dir,V=G.date;G._compressWorker(B,W).withStreamInfo("file",{name:Z,dir:U,date:V,comment:G.comment||"",unixPermissions:G.unixPermissions,dosPermissions:G.dosPermissions}).pipe(K)}),K.entriesCount=J}catch(Z){K.error(Z)}return K}});var VK=N0((O3,UK)=>{var oG=c0(),f5=N1();function f8(Q,$){f5.call(this,"Nodejs stream input adapter for "+Q),this._upstreamEnded=!1,this._bindStream($)}oG.inherits(f8,f5);f8.prototype._bindStream=function(Q){var $=this;this._stream=Q,Q.pause(),Q.on("data",function(q){$.push({data:q,meta:{percent:0}})}).on("error",function(q){if($.isPaused)this.generatedError=q;else $.error(q)}).on("end",function(){if($.isPaused)$._upstreamEnded=!0;else $.end()})};f8.prototype.pause=function(){if(!f5.prototype.pause.call(this))return!1;return this._stream.pause(),!0};f8.prototype.resume=function(){if(!f5.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};UK.exports=f8});var YK=N0((P3,NK)=>{var aG=M6(),A8=c0(),WK=N1(),rG=P4(),zK=T4(),ZK=V5(),sG=Gq(),tG=JK(),GK=$8(),eG=VK(),FK=function(Q,$,q){var K=A8.getTypeOf($),J,Z=A8.extend(q||{},zK);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)Q=MK(Q);if(Z.createFolders&&(J=QB(Q)))wK.call(this,J,!0);var G=K==="string"&&Z.binary===!1&&Z.base64===!1;if(!q||typeof q.binary==="undefined")Z.binary=!G;var B=$ instanceof ZK&&$.uncompressedSize===0;if(B||Z.dir||!$||$.length===0)Z.base64=!1,Z.binary=!0,$="",Z.compression="STORE",K="string";var W=null;if($ instanceof ZK||$ instanceof WK)W=$;else if(GK.isNode&&GK.isStream($))W=new eG(Q,$);else W=A8.prepareContent(Q,$,Z.binary,Z.optimizedBinaryString,Z.base64);var U=new sG(Q,W,Z);this.files[Q]=U},QB=function(Q){if(Q.slice(-1)==="/")Q=Q.substring(0,Q.length-1);var $=Q.lastIndexOf("/");return $>0?Q.substring(0,$):""},MK=function(Q){if(Q.slice(-1)!=="/")Q+="/";return Q},wK=function(Q,$){if($=typeof $!=="undefined"?$:zK.createFolders,Q=MK(Q),!this.files[Q])FK.call(this,Q,null,{dir:!0,createFolders:$});return this.files[Q]};function BK(Q){return Object.prototype.toString.call(Q)==="[object RegExp]"}var qB={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(Q){var $,q,K;for($ in this.files)if(K=this.files[$],q=$.slice(this.root.length,$.length),q&&$.slice(0,this.root.length)===this.root)Q(q,K)},filter:function(Q){var $=[];return this.forEach(function(q,K){if(Q(q,K))$.push(K)}),$},file:function(Q,$,q){if(arguments.length===1)if(BK(Q)){var K=Q;return this.filter(function(Z,G){return!G.dir&&K.test(Z)})}else{var J=this.files[this.root+Q];if(J&&!J.dir)return J;else return null}else Q=this.root+Q,FK.call(this,Q,$,q);return this},folder:function(Q){if(!Q)return this;if(BK(Q))return this.filter(function(J,Z){return Z.dir&&Q.test(J)});var $=this.root+Q,q=wK.call(this,$),K=this.clone();return K.root=q.name,K},remove:function(Q){Q=this.root+Q;var $=this.files[Q];if(!$){if(Q.slice(-1)!=="/")Q+="/";$=this.files[Q]}if($&&!$.dir)delete this.files[Q];else{var q=this.filter(function(J,Z){return Z.name.slice(0,Q.length)===Q});for(var K=0;K{var $B=c0();function LK(Q){this.data=Q,this.length=Q.length,this.index=0,this.zero=0}LK.prototype={checkOffset:function(Q){this.checkIndex(this.index+Q)},checkIndex:function(Q){if(this.length=this.index;q--)$=($<<8)+this.byteAt(q);return this.index+=Q,$},readString:function(Q){return $B.transformTo("string",this.readData(Q))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var Q=this.readInt(4);return new Date(Date.UTC((Q>>25&127)+1980,(Q>>21&15)-1,Q>>16&31,Q>>11&31,Q>>5&63,(Q&31)<<1))}};DK.exports=LK});var h7=N0((E3,kK)=>{var HK=y7(),KB=c0();function A6(Q){HK.call(this,Q);for(var $=0;$=0;--Z)if(this.data[Z]===$&&this.data[Z+1]===q&&this.data[Z+2]===K&&this.data[Z+3]===J)return Z-this.zero;return-1};A6.prototype.readAndCheckSignature=function(Q){var $=Q.charCodeAt(0),q=Q.charCodeAt(1),K=Q.charCodeAt(2),J=Q.charCodeAt(3),Z=this.readData(4);return $===Z[0]&&q===Z[1]&&K===Z[2]&&J===Z[3]};A6.prototype.readData=function(Q){if(this.checkOffset(Q),Q===0)return[];var $=this.data.slice(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,$};kK.exports=A6});var RK=N0((S3,IK)=>{var vK=y7(),JB=c0();function g6(Q){vK.call(this,Q)}JB.inherits(g6,vK);g6.prototype.byteAt=function(Q){return this.data.charCodeAt(this.zero+Q)};g6.prototype.lastIndexOfSignature=function(Q){return this.data.lastIndexOf(Q)-this.zero};g6.prototype.readAndCheckSignature=function(Q){var $=this.readData(4);return Q===$};g6.prototype.readData=function(Q){this.checkOffset(Q);var $=this.data.slice(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,$};IK.exports=g6});var O7=N0((u3,jK)=>{var CK=h7(),UB=c0();function x7(Q){CK.call(this,Q)}UB.inherits(x7,CK);x7.prototype.readData=function(Q){if(this.checkOffset(Q),Q===0)return new Uint8Array(0);var $=this.data.subarray(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,$};jK.exports=x7});var gK=N0((_3,AK)=>{var fK=O7(),VB=c0();function P7(Q){fK.call(this,Q)}VB.inherits(P7,fK);P7.prototype.readData=function(Q){this.checkOffset(Q);var $=this.data.slice(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,$};AK.exports=P7});var T7=N0((c3,yK)=>{var A5=c0(),XK=Q2(),ZB=h7(),GB=RK(),BB=gK(),WB=O7();yK.exports=function(Q){var $=A5.getTypeOf(Q);if(A5.checkSupport($),$==="string"&&!XK.uint8array)return new GB(Q);if($==="nodebuffer")return new BB(Q);if(XK.uint8array)return new WB(A5.transformTo("uint8array",Q));return new ZB(A5.transformTo("array",Q))}});var PK=N0((b3,OK)=>{var E7=T7(),I2=c0(),zB=V5(),hK=U5(),g5=M6(),X5=A7(),FB=Q2(),MB=0,wB=3,NB=function(Q){for(var $ in X5){if(!Object.prototype.hasOwnProperty.call(X5,$))continue;if(X5[$].magic===Q)return X5[$]}return null};function xK(Q,$){this.options=Q,this.loadOptions=$}xK.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(Q){var $,q;if(Q.skip(22),this.fileNameLength=Q.readInt(2),q=Q.readInt(2),this.fileName=Q.readData(this.fileNameLength),Q.skip(q),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if($=NB(this.compressionMethod),$===null)throw new Error("Corrupted zip : compression "+I2.pretty(this.compressionMethod)+" unknown (inner file : "+I2.transformTo("string",this.fileName)+")");this.decompressed=new zB(this.compressedSize,this.uncompressedSize,this.crc32,$,Q.readData(this.compressedSize))},readCentralPart:function(Q){this.versionMadeBy=Q.readInt(2),Q.skip(2),this.bitFlag=Q.readInt(2),this.compressionMethod=Q.readString(2),this.date=Q.readDate(),this.crc32=Q.readInt(4),this.compressedSize=Q.readInt(4),this.uncompressedSize=Q.readInt(4);var $=Q.readInt(2);if(this.extraFieldsLength=Q.readInt(2),this.fileCommentLength=Q.readInt(2),this.diskNumberStart=Q.readInt(2),this.internalFileAttributes=Q.readInt(2),this.externalFileAttributes=Q.readInt(4),this.localHeaderOffset=Q.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");Q.skip($),this.readExtraFields(Q),this.parseZIP64ExtraField(Q),this.fileComment=Q.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var Q=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,Q===MB)this.dosPermissions=this.externalFileAttributes&63;if(Q===wB)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var Q=E7(this.extraFields[1].value);if(this.uncompressedSize===I2.MAX_VALUE_32BITS)this.uncompressedSize=Q.readInt(8);if(this.compressedSize===I2.MAX_VALUE_32BITS)this.compressedSize=Q.readInt(8);if(this.localHeaderOffset===I2.MAX_VALUE_32BITS)this.localHeaderOffset=Q.readInt(8);if(this.diskNumberStart===I2.MAX_VALUE_32BITS)this.diskNumberStart=Q.readInt(4)},readExtraFields:function(Q){var $=Q.index+this.extraFieldsLength,q,K,J;if(!this.extraFields)this.extraFields={};while(Q.index+4<$)q=Q.readInt(2),K=Q.readInt(2),J=Q.readData(K),this.extraFields[q]={id:q,length:K,value:J};Q.setIndex($)},handleUTF8:function(){var Q=FB.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=g5.utf8decode(this.fileName),this.fileCommentStr=g5.utf8decode(this.fileComment);else{var $=this.findExtraFieldUnicodePath();if($!==null)this.fileNameStr=$;else{var q=I2.transformTo(Q,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(q)}var K=this.findExtraFieldUnicodeComment();if(K!==null)this.fileCommentStr=K;else{var J=I2.transformTo(Q,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(J)}}},findExtraFieldUnicodePath:function(){var Q=this.extraFields[28789];if(Q){var $=E7(Q.value);if($.readInt(1)!==1)return null;if(hK(this.fileName)!==$.readInt(4))return null;return g5.utf8decode($.readData(Q.length-5))}return null},findExtraFieldUnicodeComment:function(){var Q=this.extraFields[25461];if(Q){var $=E7(Q.value);if($.readInt(1)!==1)return null;if(hK(this.fileComment)!==$.readInt(4))return null;return g5.utf8decode($.readData(Q.length-5))}return null}};OK.exports=xK});var SK=N0((d3,EK)=>{var YB=T7(),J2=c0(),x1=g7(),LB=PK(),DB=Q2();function TK(Q){this.files=[],this.loadOptions=Q}TK.prototype={checkSignature:function(Q){if(!this.reader.readAndCheckSignature(Q)){this.reader.index-=4;var $=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+J2.pretty($)+", expected "+J2.pretty(Q)+")")}},isSignature:function(Q,$){var q=this.reader.index;this.reader.setIndex(Q);var K=this.reader.readString(4),J=K===$;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 Q=this.reader.readData(this.zipCommentLength),$=DB.uint8array?"uint8array":"array",q=J2.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 Q=this.zip64EndOfCentralSize-44,$=0,q,K,J;while($1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var Q,$;for(Q=0;Q0)if(this.isSignature(q,x1.CENTRAL_FILE_HEADER));else this.reader.zero=J;else if(J<0)throw new Error("Corrupted zip: missing "+Math.abs(J)+" bytes.")},prepareReader:function(Q){this.reader=YB(Q)},load:function(Q){this.prepareReader(Q),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};EK.exports=TK});var cK=N0((m3,_K)=>{var S7=c0(),y5=W6(),HB=M6(),kB=SK(),vB=u4(),uK=$8();function IB(Q){return new y5.Promise(function($,q){var K=Q.decompressed.getContentWorker().pipe(new vB);K.on("error",function(J){q(J)}).on("end",function(){if(K.streamInfo.crc32!==Q.decompressed.crc32)q(new Error("Corrupted zip : CRC32 mismatch"));else $()}).resume()})}_K.exports=function(Q,$){var q=this;if($=S7.extend($||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:HB.utf8decode}),uK.isNode&&uK.isStream(Q))return y5.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file."));return S7.prepareContent("the loaded zip file",Q,!0,$.optimizedBinaryString,$.base64).then(function(K){var J=new kB($);return J.load(K),J}).then(function K(J){var Z=[y5.Promise.resolve(J)],G=J.files;if($.checkCRC32)for(var B=0;B{function j1(){if(!(this instanceof j1))return new j1;if(arguments.length)throw new 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 Q=new j1;for(var $ in this)if(typeof this[$]!=="function")Q[$]=this[$];return Q}}j1.prototype=YK();j1.prototype.loadAsync=cK();j1.support=Q2();j1.defaults=T4();j1.version="3.10.1";j1.loadAsync=function(Q,$){return new j1().loadAsync(Q,$)};j1.external=W6();bK.exports=j1});var oK={};h2(oK,{types:()=>xB,promisify:()=>bB,log:()=>_B,isUndefined:()=>X6,isSymbol:()=>PB,isString:()=>E5,isRegExp:()=>h5,isPrimitive:()=>TB,isObject:()=>y6,isNumber:()=>nK,isNullOrUndefined:()=>OB,isNull:()=>T5,isFunction:()=>O5,isError:()=>x5,isDate:()=>b7,isBuffer:()=>EB,isBoolean:()=>m7,isArray:()=>mK,inspect:()=>t2,inherits:()=>cB,format:()=>d7,deprecate:()=>CB,debuglog:()=>jB,callbackifyOnRejected:()=>lK,callbackify:()=>dB,_extend:()=>pK,TextEncoder:()=>mB,TextDecoder:()=>nB});function d7(Q,...$){if(!E5(Q)){var q=[Q];for(var K=0;K<$.length;K++)q.push(t2($[K]));return q.join(" ")}var K=0,J=$.length,Z=String(Q).replace(RB,function(B){if(B==="%%")return"%";if(K>=J)return B;switch(B){case"%s":return String($[K++]);case"%d":return Number($[K++]);case"%j":try{return JSON.stringify($[K++])}catch(W){return"[Circular]"}default:return B}});for(var G=$[K];K=0||Z.indexOf("description")>=0))return u7($);if(Z.length===0){if(O5($)){var B=$.name?": "+$.name:"";return Q.stylize("[Function"+B+"]","special")}if(h5($))return Q.stylize(RegExp.prototype.toString.call($),"regexp");if(b7($))return Q.stylize(Date.prototype.toString.call($),"date");if(x5($))return u7($)}var W="",U=!1,V=["{","}"];if(mK($))U=!0,V=["[","]"];if(O5($)){var N=$.name?": "+$.name:"";W=" [Function"+N+"]"}if(h5($))W=" "+RegExp.prototype.toString.call($);if(b7($))W=" "+Date.prototype.toUTCString.call($);if(x5($))W=" "+u7($);if(Z.length===0&&(!U||$.length==0))return V[0]+W+V[1];if(q<0)if(h5($))return Q.stylize(RegExp.prototype.toString.call($),"regexp");else return Q.stylize("[Object]","special");Q.seen.push($);var F;if(U)F=yB(Q,$,q,G,Z);else F=Z.map(function(M){return c7(Q,$,q,G,M,U)});return Q.seen.pop(),hB(F,W,V)}function XB(Q,$){if(X6($))return Q.stylize("undefined","undefined");if(E5($)){var q="'"+JSON.stringify($).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return Q.stylize(q,"string")}if(nK($))return Q.stylize(""+$,"number");if(m7($))return Q.stylize(""+$,"boolean");if(T5($))return Q.stylize("null","null")}function u7(Q){return"["+Error.prototype.toString.call(Q)+"]"}function yB(Q,$,q,K,J){var Z=[];for(var G=0,B=$.length;G-1)if(Z)B=B.split(` -`).map(function(U){return" "+U}).join(` -`).slice(2);else B=` -`+B.split(` -`).map(function(U){return" "+U}).join(` -`)}else B=Q.stylize("[Circular]","special");if(X6(G)){if(Z&&J.match(/^\d+$/))return B;if(G=JSON.stringify(""+J),G.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))G=G.slice(1,-1),G=Q.stylize(G,"name");else G=G.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),G=Q.stylize(G,"string")}return G+": "+B}function hB(Q,$,q){var K=0,J=Q.reduce(function(Z,G){if(K++,G.indexOf(` -`)>=0)K++;return Z+G.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(J>60)return q[0]+($===""?"":$+` - `)+" "+Q.join(`, - `)+" "+q[1];return q[0]+$+" "+Q.join(", ")+" "+q[1]}function mK(Q){return Array.isArray(Q)}function m7(Q){return typeof Q==="boolean"}function T5(Q){return Q===null}function OB(Q){return Q==null}function nK(Q){return typeof Q==="number"}function E5(Q){return typeof Q==="string"}function PB(Q){return typeof Q==="symbol"}function X6(Q){return Q===void 0}function h5(Q){return y6(Q)&&n7(Q)==="[object RegExp]"}function y6(Q){return typeof Q==="object"&&Q!==null}function b7(Q){return y6(Q)&&n7(Q)==="[object Date]"}function x5(Q){return y6(Q)&&(n7(Q)==="[object Error]"||Q instanceof Error)}function O5(Q){return typeof Q==="function"}function TB(Q){return Q===null||typeof Q==="boolean"||typeof Q==="number"||typeof Q==="string"||typeof Q==="symbol"||typeof Q==="undefined"}function EB(Q){return Q instanceof Buffer}function n7(Q){return Object.prototype.toString.call(Q)}function _7(Q){return Q<10?"0"+Q.toString(10):Q.toString(10)}function uB(){var Q=new Date,$=[_7(Q.getHours()),_7(Q.getMinutes()),_7(Q.getSeconds())].join(":");return[Q.getDate(),SB[Q.getMonth()],$].join(" ")}function _B(...Q){console.log("%s - %s",uB(),d7.apply(null,Q))}function cB(Q,$){if($)Q.super_=$,Q.prototype=Object.create($.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})}function pK(Q,$){if(!$||!y6($))return Q;var q=Object.keys($),K=q.length;while(K--)Q[q[K]]=$[q[K]];return Q}function iK(Q,$){return Object.prototype.hasOwnProperty.call(Q,$)}function lK(Q,$){if(!Q){var q=new Error("Promise was rejected with a falsy value");q.reason=Q,Q=q}return $(Q)}function dB(Q){if(typeof Q!=="function")throw new TypeError('The "original" argument must be of type Function');function $(...q){var K=q.pop();if(typeof K!=="function")throw new TypeError("The last argument must be of type Function");var J=this,Z=function(...G){return K.apply(J,...G)};Q.apply(this,q).then(function(G){process.nextTick(Z.bind(null,null,G))},function(G){process.nextTick(lK.bind(null,G,Z))})}return Object.setPrototypeOf($,Object.getPrototypeOf(Q)),Object.defineProperties($,Object.getOwnPropertyDescriptors(Q)),$}var RB,jB,t2,xB=()=>{},SB,bB,mB,nB;var aK=x2(()=>{RB=/%[sdj%]/g;jB=((Q={},$={},q)=>((q=typeof process!=="undefined"&&process.env.NODE_DEBUG)&&(q=q.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),$=new RegExp("^"+q+"$","i"),(K)=>{if(K=K.toUpperCase(),!Q[K])if($.test(K))Q[K]=function(...J){console.error("%s: %s",K,pid,d7.apply(null,...J))};else Q[K]=function(){};return Q[K]}))(),t2=((Q)=>(Q.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]},Q.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},Q.custom=Symbol.for("nodejs.util.inspect.custom"),Q))(function Q($,q,...K){var J={seen:[],stylize:AB};if(K.length>=1)J.depth=K[0];if(K.length>=2)J.colors=K[1];if(m7(q))J.showHidden=q;else if(q)pK(J,q);if(X6(J.showHidden))J.showHidden=!1;if(X6(J.depth))J.depth=2;if(X6(J.colors))J.colors=!1;if(J.colors)J.stylize=fB;return P5(J,$,J.depth)});SB=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];bB=((Q)=>(Q.custom=Symbol.for("nodejs.util.promisify.custom"),Q))(function Q($){if(typeof $!=="function")throw new TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&$[kCustomPromisifiedSymbol]){var q=$[kCustomPromisifiedSymbol];if(typeof q!=="function")throw new 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(...K){var J,Z,G=new Promise(function(B,W){J=B,Z=W});K.push(function(B,W){if(B)Z(B);else J(W)});try{$.apply(this,K)}catch(B){Z(B)}return G}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:mB,TextDecoder:nB}=globalThis)});var r7={};h2(r7,{resolveObject:()=>KJ,resolve:()=>$J,parse:()=>x6,format:()=>qJ,default:()=>QW,Url:()=>L1,URLSearchParams:()=>eK,URL:()=>o7});function a7(Q){return typeof Q==="string"}function QJ(Q){return typeof Q==="object"&&Q!==null}function S5(Q){return Q===null}function pB(Q){return Q==null}function L1(){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 x6(Q,$,q){if(Q&&QJ(Q)&&Q instanceof L1)return Q;var K=new L1;return K.parse(Q,$,q),K}function qJ(Q){if(a7(Q))Q=x6(Q);if(!(Q instanceof L1))return L1.prototype.format.call(Q);return Q.format()}function $J(Q,$){return x6(Q,!1,!0).resolve($)}function KJ(Q,$){if(!Q)return $;return x6(Q,!1,!0).resolveObject($)}var o7,eK,iB,lB,oB,aB,rB,p7,rK,sK,sB=255,tK,tB,eB,i7,h6,l7,QW;var s7=x2(()=>{({URL:o7,URLSearchParams:eK}=globalThis);iB=/^([a-z0-9.+-]+:)/i,lB=/:[0-9]*$/,oB=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,aB=["<",">",'"',"`"," ","\r",` -`,"\t"],rB=["{","}","|","\\","^","`"].concat(aB),p7=["'"].concat(rB),rK=["%","/","?",";","#"].concat(p7),sK=["/","?","#"],tK=/^[+a-z0-9A-Z_-]{0,63}$/,tB=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,eB={javascript:!0,"javascript:":!0},i7={javascript:!0,"javascript:":!0},h6={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},l7={parse(Q){var $=decodeURIComponent;return(Q+"").replace(/\+/g," ").split("&").filter(Boolean).reduce(function(q,K,J){var Z=K.split("="),G=$(Z[0]||""),B=$(Z[1]||""),W=q[G];return q[G]=W===void 0?B:[].concat(W,B),q},{})},stringify(Q){var $=encodeURIComponent;return Object.keys(Q||{}).reduce(function(q,K){return[].concat(Q[K]).forEach(function(J){q.push($(K)+"="+$(J))}),q},[]).join("&").replace(/\s/g,"+")}};L1.prototype.parse=function(Q,$,q){if(!a7(Q))throw new TypeError("Parameter 'url' must be a string, not "+typeof Q);var K=Q.indexOf("?"),J=K!==-1&&K127)R+="x";else R+=H[c];if(!R.match(tK)){var $0=z.slice(0,M),_=z.slice(M+1),g=H.match(tB);if(g)$0.push(g[1]),_.unshift(g[2]);if(_.length)B="/"+_.join(".")+B;this.hostname=$0.join(".");break}}}}if(this.hostname.length>sB)this.hostname="";else this.hostname=this.hostname.toLowerCase();if(!D)this.hostname=new o7(`https://${this.hostname}`).hostname;var O=this.port?":"+this.port:"",h=this.hostname||"";if(this.host=h+O,this.href+=this.host,D){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),B[0]!=="/")B="/"+B}}if(!eB[V])for(var M=0,Y=p7.length;M0?q.host.split("@"):!1;if(R)q.auth=R.shift(),q.host=q.hostname=R.shift()}if(q.search=Q.search,q.query=Q.query,!S5(q.pathname)||!S5(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 c=z.slice(-1)[0],m=(q.host||Q.host||z.length>1)&&(c==="."||c==="..")||c==="",$0=0;for(var _=z.length;_>=0;_--)if(c=z[_],c===".")z.splice(_,1);else if(c==="..")z.splice(_,1),$0++;else if($0)z.splice(_,1),$0--;if(!y&&!D)for(;$0--;$0)z.unshift("..");if(y&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/"))z.unshift("");if(m&&z.join("/").substr(-1)!=="/")z.push("");var g=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){q.hostname=q.host=g?"":z.length?z.shift():"";var R=q.host&&q.host.indexOf("@")>0?q.host.split("@"):!1;if(R)q.auth=R.shift(),q.host=q.hostname=R.shift()}if(y=y||q.host&&z.length,y&&!g)z.unshift("");if(!z.length)q.pathname=null,q.path=null;else q.pathname=z.join("/");if(!S5(q.pathname)||!S5(q.search))q.path=(q.pathname?q.pathname:"")+(q.search?q.search:"");return q.auth=Q.auth||q.auth,q.slashes=q.slashes||Q.slashes,q.href=q.format(),q};L1.prototype.parseHost=function(){var Q=this.host,$=lB.exec(Q);if($){if($=$[0],$!==":")this.port=$.substr(1);Q=Q.substr(0,Q.length-$.length)}if(Q)this.hostname=Q};QW={parse:x6,resolve:$J,resolveObject:KJ,format:qJ,Url:L1,URL:o7,URLSearchParams:eK}});var q9={};h2(q9,{request:()=>DW,globalAgent:()=>RW,get:()=>HW,STATUS_CODES:()=>CW,METHODS:()=>jW,IncomingMessage:()=>vW,ClientRequest:()=>kW,Agent:()=>IW});var qW,$W,JJ,KW,JW,UW=(Q,$,q)=>{q=Q!=null?qW($W(Q)):{};let K=$||!Q||!Q.__esModule?JJ(q,"default",{value:Q,enumerable:!0}):q;for(let J of KW(Q))if(!JW.call(K,J))JJ(K,J,{get:()=>Q[J],enumerable:!0});return K},R0=(Q,$)=>()=>($||Q(($={exports:{}}).exports,$),$.exports),UJ,VW,VJ,b0,ZJ,V1,ZW,g8,W1,X8,e2,V2,R2,O6,t7,u5,GW,_5,BW,WW,GJ,c5,e7,zW,U2,BJ,WJ,Q9,zJ,FW,FJ,MJ,wJ,NJ,MW,wW,NW,YW,LW,DW,HW,kW,vW,IW,RW,CW,jW;var $9=x2(()=>{qW=Object.create,{getPrototypeOf:$W,defineProperty:JJ,getOwnPropertyNames:KW}=Object,JW=Object.prototype.hasOwnProperty,UJ=R0((Q)=>{Q.fetch=J(global.fetch)&&J(global.ReadableStream),Q.writableStream=J(global.WritableStream),Q.abortController=J(global.AbortController);var $;function q(){if($!==void 0)return $;if(global.XMLHttpRequest){$=new global.XMLHttpRequest;try{$.open("GET",global.XDomainRequest?"/":"https://example.com")}catch(Z){$=null}}else $=null;return $}function K(Z){var G=q();if(!G)return!1;try{return G.responseType=Z,G.responseType===Z}catch(B){}return!1}Q.arraybuffer=Q.fetch||K("arraybuffer"),Q.msstream=!Q.fetch&&K("ms-stream"),Q.mozchunkedarraybuffer=!Q.fetch&&K("moz-chunked-arraybuffer"),Q.overrideMimeType=Q.fetch||(q()?J(q().overrideMimeType):!1);function J(Z){return typeof Z==="function"}$=null}),VW=R0((Q,$)=>{if(typeof Object.create==="function")$.exports=function q(K,J){if(J)K.super_=J,K.prototype=Object.create(J.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}})};else $.exports=function q(K,J){if(J){K.super_=J;var Z=function(){};Z.prototype=J.prototype,K.prototype=new Z,K.prototype.constructor=K}}}),VJ=R0((Q,$)=>{try{if(q=(aK(),y0(oK)),typeof q.inherits!=="function")throw"";$.exports=q.inherits}catch(K){$.exports=VW()}var q}),b0=R0((Q,$)=>{class q extends Error{constructor(K){if(!Array.isArray(K))throw new TypeError(`Expected input to be an Array, got ${typeof K}`);let J="";for(let Z=0;Z{$.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"{}"}}}}),V1=R0((Q,$)=>{var{format:q,inspect:K}=ZJ(),{AggregateError:J}=b0(),Z=globalThis.AggregateError||J,G=Symbol("kIsNodeError"),B=["string","function","number","object","Function","Object","boolean","bigint","symbol"],W=/^([A-Z][a-z0-9]*)+$/,U={};function V(D,z){if(!D)throw new U.ERR_INTERNAL_ASSERTION(z)}function N(D){let z="",Y=D.length,H=D[0]==="-"?1:0;for(;Y>=H+4;Y-=3)z=`_${D.slice(Y-3,Y)}${z}`;return`${D.slice(0,Y)}${z}`}function F(D,z,Y){if(typeof z==="function")return V(z.length<=Y.length,`Code: ${D}; The provided arguments length (${Y.length}) does not match the required ones (${z.length}).`),z(...Y);let H=(z.match(/%[dfijoOs]/g)||[]).length;if(V(H===Y.length,`Code: ${D}; The provided arguments length (${Y.length}) does not match the required ones (${H}).`),Y.length===0)return z;return q(z,...Y)}function M(D,z,Y){if(!Y)Y=Error;class H extends Y{constructor(...R){super(F(D,z,R))}toString(){return`${this.name} [${D}]: ${this.message}`}}Object.defineProperties(H.prototype,{name:{value:Y.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,U[D]=H}function v(D){let z="__node_internal_"+D.name;return Object.defineProperty(D,"name",{value:z}),D}function x(D,z){if(D&&z&&D!==z){if(Array.isArray(z.errors))return z.errors.push(D),z;let Y=new Z([z,D],z.message);return Y.code=z.code,Y}return D||z}class y extends Error{constructor(D="The operation was aborted",z=void 0){if(z!==void 0&&typeof z!=="object")throw new U.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,Y)=>{if(V(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 R=[],c=[],m=[];for(let _ of z)if(V(typeof _==="string","All expected entries have to be of type string"),B.includes(_))R.push(_.toLowerCase());else if(W.test(_))c.push(_);else V(_!=="object",'The value "object" should be written as "Object"'),m.push(_);if(c.length>0){let _=R.indexOf("object");if(_!==-1)R.splice(R,_,1),c.push("Object")}if(R.length>0){switch(R.length){case 1:H+=`of type ${R[0]}`;break;case 2:H+=`one of type ${R[0]} or ${R[1]}`;break;default:{let _=R.pop();H+=`one of type ${R.join(", ")}, or ${_}`}}if(c.length>0||m.length>0)H+=" or "}if(c.length>0){switch(c.length){case 1:H+=`an instance of ${c[0]}`;break;case 2:H+=`an instance of ${c[0]} or ${c[1]}`;break;default:{let _=c.pop();H+=`an instance of ${c.join(", ")}, or ${_}`}}if(m.length>0)H+=" or "}switch(m.length){case 0:break;case 1:if(m[0].toLowerCase()!==m[0])H+="an ";H+=`${m[0]}`;break;case 2:H+=`one of ${m[0]} or ${m[1]}`;break;default:{let _=m.pop();H+=`one of ${m.join(", ")}, or ${_}`}}if(Y==null)H+=`. Received ${Y}`;else if(typeof Y==="function"&&Y.name)H+=`. Received function ${Y.name}`;else if(typeof Y==="object"){var $0;if(($0=Y.constructor)!==null&&$0!==void 0&&$0.name)H+=`. Received an instance of ${Y.constructor.name}`;else{let _=K(Y,{depth:-1});H+=`. Received ${_}`}}else{let _=K(Y,{colors:!1});if(_.length>25)_=`${_.slice(0,25)}...`;H+=`. Received type ${typeof Y} (${_})`}return H},TypeError),M("ERR_INVALID_ARG_VALUE",(D,z,Y="is invalid")=>{let H=K(z);if(H.length>128)H=H.slice(0,128)+"...";return`The ${D.includes(".")?"property":"argument"} '${D}' ${Y}. Received ${H}`},TypeError),M("ERR_INVALID_RETURN_VALUE",(D,z,Y)=>{var H;let R=Y!==null&&Y!==void 0&&(H=Y.constructor)!==null&&H!==void 0&&H.name?`instance of ${Y.constructor.name}`:`type ${typeof Y}`;return`Expected ${D} to be returned from the "${z}" function but got ${R}.`},TypeError),M("ERR_MISSING_ARGS",(...D)=>{V(D.length>0,"At least one arg needs to be specified");let z,Y=D.length;switch(D=(Array.isArray(D)?D:[D]).map((H)=>`"${H}"`).join(" or "),Y){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,Y)=>{V(z,'Missing "range" argument');let H;if(Number.isInteger(Y)&&Math.abs(Y)>4294967296)H=N(String(Y));else if(typeof Y==="bigint"){H=String(Y);let R=BigInt(2)**BigInt(32);if(Y>R||Y<-R)H=N(H);H+="n"}else H=K(Y);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),$.exports={AbortError:y,aggregateTwoErrors:v(x),hideStackFrames:v,codes:U}}),ZW=R0((Q,$)=>{Object.defineProperty(Q,"__esModule",{value:!0});var q=new WeakMap,K=new WeakMap;function J(g){let O=q.get(g);return console.assert(O!=null,"'this' is expected an Event object, but got",g),O}function Z(g){if(g.passiveListener!=null){if(typeof console!=="undefined"&&typeof console.error==="function")console.error("Unable to preventDefault inside passive event listener invocation.",g.passiveListener);return}if(!g.event.cancelable)return;if(g.canceled=!0,typeof g.event.preventDefault==="function")g.event.preventDefault()}function G(g,O){q.set(this,{eventTarget:g,event:O,eventPhase:2,currentTarget:g,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:O.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let h=Object.keys(O);for(let f=0;f0){let g=new Array(arguments.length);for(let O=0;O{Object.defineProperty(Q,"__esModule",{value:!0});var q=ZW();class K extends q.EventTarget{constructor(){super();throw new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let V=G.get(this);if(typeof V!=="boolean")throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return V}}q.defineEventAttribute(K.prototype,"abort");function J(){let V=Object.create(K.prototype);return q.EventTarget.call(V),G.set(V,!1),V}function Z(V){if(G.get(V)!==!1)return;G.set(V,!0),V.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 B{constructor(){W.set(this,J())}get signal(){return U(this)}abort(){Z(U(this))}}var W=new WeakMap;function U(V){let N=W.get(V);if(N==null)throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${V===null?"null":typeof V}`);return N}if(Object.defineProperties(B.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol")Object.defineProperty(B.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});Q.AbortController=B,Q.AbortSignal=K,Q.default=B,$.exports=B,$.exports.AbortController=$.exports.default=B,$.exports.AbortSignal=K}),W1=R0((Q,$)=>{var q=(a0(),y0(s0)),{format:K,inspect:J}=ZJ(),{codes:{ERR_INVALID_ARG_TYPE:Z}}=V1(),{kResistStopPropagation:G,AggregateError:B,SymbolDispose:W}=b0(),U=globalThis.AbortSignal||g8().AbortSignal,V=globalThis.AbortController||g8().AbortController,N=Object.getPrototypeOf(async function(){}).constructor,F=globalThis.Blob||q.Blob,M=typeof F!=="undefined"?function y(D){return D instanceof F}:function y(D){return!1},v=(y,D)=>{if(y!==void 0&&(y===null||typeof y!=="object"||!("aborted"in y)))throw new Z(D,"AbortSignal",y)},x=(y,D)=>{if(typeof y!=="function")throw new Z(D,"Function",y)};$.exports={AggregateError:B,kEmptyObject:Object.freeze({}),once(y){let D=!1;return function(...z){if(D)return;D=!0,y.apply(this,z)}},createDeferredPromise:function(){let y,D;return{promise:new Promise((z,Y)=>{y=z,D=Y}),resolve:y,reject:D}},promisify(y){return new Promise((D,z)=>{y((Y,...H)=>{if(Y)return z(Y);return D(...H)})})},debuglog(){return function(){}},format:K,inspect:J,types:{isAsyncFunction(y){return y instanceof N},isArrayBufferView(y){return ArrayBuffer.isView(y)}},isBlob:M,deprecate(y,D){return y},addAbortListener:(a1(),y0(o1)).addAbortListener||function y(D,z){if(D===void 0)throw new Z("signal","AbortSignal",D);v(D,"signal"),x(z,"listener");let Y;if(D.aborted)queueMicrotask(()=>z());else D.addEventListener("abort",z,{__proto__:null,once:!0,[G]:!0}),Y=()=>{D.removeEventListener("abort",z)};return{__proto__:null,[W](){var H;(H=Y)===null||H===void 0||H()}}},AbortSignalAny:U.any||function y(D){if(D.length===1)return D[0];let z=new V,Y=()=>z.abort();return D.forEach((H)=>{v(H,"signals"),H.addEventListener("abort",Y,{once:!0})}),z.signal.addEventListener("abort",()=>{D.forEach((H)=>H.removeEventListener("abort",Y))},{once:!0}),z.signal}},$.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),X8=R0((Q,$)=>{var{ArrayIsArray:q,ArrayPrototypeIncludes:K,ArrayPrototypeJoin:J,ArrayPrototypeMap:Z,NumberIsInteger:G,NumberIsNaN:B,NumberMAX_SAFE_INTEGER:W,NumberMIN_SAFE_INTEGER:U,NumberParseInt:V,ObjectPrototypeHasOwnProperty:N,RegExpPrototypeExec:F,String:M,StringPrototypeToUpperCase:v,StringPrototypeTrim:x}=b0(),{hideStackFrames:y,codes:{ERR_SOCKET_BAD_PORT:D,ERR_INVALID_ARG_TYPE:z,ERR_INVALID_ARG_VALUE:Y,ERR_OUT_OF_RANGE:H,ERR_UNKNOWN_SIGNAL:R}}=V1(),{normalizeEncoding:c}=W1(),{isAsyncFunction:m,isArrayBufferView:$0}=W1().types,_={};function g(j){return j===(j|0)}function O(j){return j===j>>>0}var h=/^[0-7]+$/,f="must be a 32-bit unsigned integer or an octal string";function A(j,d,e){if(typeof j==="undefined")j=e;if(typeof j==="string"){if(F(h,j)===null)throw new Y(d,j,f);j=V(j,8)}return i(j,d),j}var I=y((j,d,e=U,p=W)=>{if(typeof j!=="number")throw new z(d,"number",j);if(!G(j))throw new H(d,"an integer",j);if(jp)throw new H(d,`>= ${e} && <= ${p}`,j)}),n=y((j,d,e=-2147483648,p=2147483647)=>{if(typeof j!=="number")throw new z(d,"number",j);if(!G(j))throw new H(d,"an integer",j);if(jp)throw new H(d,`>= ${e} && <= ${p}`,j)}),i=y((j,d,e=!1)=>{if(typeof j!=="number")throw new z(d,"number",j);if(!G(j))throw new H(d,"an integer",j);let p=e?1:0,G0=4294967295;if(jG0)throw new H(d,`>= ${p} && <= ${G0}`,j)});function K0(j,d){if(typeof j!=="string")throw new z(d,"string",j)}function z0(j,d,e=void 0,p){if(typeof j!=="number")throw new z(d,"number",j);if(e!=null&&jp||(e!=null||p!=null)&&B(j))throw new H(d,`${e!=null?`>= ${e}`:""}${e!=null&&p!=null?" && ":""}${p!=null?`<= ${p}`:""}`,j)}var S=y((j,d,e)=>{if(!K(e,j)){let p="must be one of: "+J(Z(e,(G0)=>typeof G0==="string"?`'${G0}'`:M(G0)),", ");throw new Y(d,j,p)}});function U0(j,d){if(typeof j!=="boolean")throw new z(d,"boolean",j)}function k(j,d,e){return j==null||!N(j,d)?e:j[d]}var u=y((j,d,e=null)=>{let p=k(e,"allowArray",!1),G0=k(e,"allowFunction",!1);if(!k(e,"nullable",!1)&&j===null||!p&&q(j)||typeof j!=="object"&&(!G0||typeof j!=="function"))throw new z(d,"Object",j)}),Q0=y((j,d)=>{if(j!=null&&typeof j!=="object"&&typeof j!=="function")throw new z(d,"a dictionary",j)}),E=y((j,d,e=0)=>{if(!q(j))throw new z(d,"Array",j);if(j.length{if(!$0(j))throw new z(d,["Buffer","TypedArray","DataView"],j)});function T(j,d){let e=c(d),p=j.length;if(e==="hex"&&p%2!==0)throw new Y("encoding",d,`is invalid for data of length ${p}`)}function t(j,d="Port",e=!0){if(typeof j!=="number"&&typeof j!=="string"||typeof j==="string"&&x(j).length===0||+j!==+j>>>0||j>65535||j===0&&!e)throw new D(d,j,e);return j|0}var Z0=y((j,d)=>{if(j!==void 0&&(j===null||typeof j!=="object"||!("aborted"in j)))throw new z(d,"AbortSignal",j)}),W0=y((j,d)=>{if(typeof j!=="function")throw new z(d,"Function",j)}),C=y((j,d)=>{if(typeof j!=="function"||m(j))throw new z(d,"Function",j)}),X=y((j,d)=>{if(j!==void 0)throw new z(d,"undefined",j)});function P(j,d,e){if(!K(e,j))throw new z(d,`('${J(e,"|")}')`,j)}var o=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function r(j,d){if(typeof j==="undefined"||!F(o,j))throw new Y(d,j,'must be an array or string of format "; rel=preload; as=style"')}function l(j){if(typeof j==="string")return r(j,"hints"),j;else if(q(j)){let d=j.length,e="";if(d===0)return e;for(let p=0;p; rel=preload; as=style"')}$.exports={isInt32:g,isUint32:O,parseFileMode:A,validateArray:E,validateStringArray:q0,validateBooleanArray:B0,validateAbortSignalArray:w0,validateBoolean:U0,validateBuffer:b,validateDictionary:Q0,validateEncoding:T,validateFunction:W0,validateInt32:n,validateInteger:I,validateNumber:z0,validateObject:u,validateOneOf:S,validatePlainFunction:C,validatePort:t,validateSignalName:M0,validateString:K0,validateUint32:i,validateUndefined:X,validateUnion:P,validateAbortSignal:Z0,validateLinkHeaderValue:l}}),e2=R0((Q,$)=>{$.exports=(L4(),y0(Y4))}),V2=R0((Q,$)=>{var{SymbolAsyncIterator:q,SymbolIterator:K,SymbolFor:J}=b0(),Z=J("nodejs.stream.destroyed"),G=J("nodejs.stream.errored"),B=J("nodejs.stream.readable"),W=J("nodejs.stream.writable"),U=J("nodejs.stream.disturbed"),V=J("nodejs.webstream.isClosedPromise"),N=J("nodejs.webstream.controllerErrorFunction");function F(k,u=!1){var Q0;return!!(k&&typeof k.pipe==="function"&&typeof k.on==="function"&&(!u||typeof k.pause==="function"&&typeof k.resume==="function")&&(!k._writableState||((Q0=k._readableState)===null||Q0===void 0?void 0:Q0.readable)!==!1)&&(!k._writableState||k._readableState))}function M(k){var u;return!!(k&&typeof k.write==="function"&&typeof k.on==="function"&&(!k._readableState||((u=k._writableState)===null||u===void 0?void 0:u.writable)!==!1))}function v(k){return!!(k&&typeof k.pipe==="function"&&k._readableState&&typeof k.on==="function"&&typeof k.write==="function")}function x(k){return k&&(k._readableState||k._writableState||typeof k.write==="function"&&typeof k.on==="function"||typeof k.pipe==="function"&&typeof k.on==="function")}function y(k){return!!(k&&!x(k)&&typeof k.pipeThrough==="function"&&typeof k.getReader==="function"&&typeof k.cancel==="function")}function D(k){return!!(k&&!x(k)&&typeof k.getWriter==="function"&&typeof k.abort==="function")}function z(k){return!!(k&&!x(k)&&typeof k.readable==="object"&&typeof k.writable==="object")}function Y(k){return y(k)||D(k)||z(k)}function H(k,u){if(k==null)return!1;if(u===!0)return typeof k[q]==="function";if(u===!1)return typeof k[K]==="function";return typeof k[q]==="function"||typeof k[K]==="function"}function R(k){if(!x(k))return null;let{_writableState:u,_readableState:Q0}=k,E=u||Q0;return!!(k.destroyed||k[Z]||E!==null&&E!==void 0&&E.destroyed)}function c(k){if(!M(k))return null;if(k.writableEnded===!0)return!0;let u=k._writableState;if(u!==null&&u!==void 0&&u.errored)return!1;if(typeof(u===null||u===void 0?void 0:u.ended)!=="boolean")return null;return u.ended}function m(k,u){if(!M(k))return null;if(k.writableFinished===!0)return!0;let Q0=k._writableState;if(Q0!==null&&Q0!==void 0&&Q0.errored)return!1;if(typeof(Q0===null||Q0===void 0?void 0:Q0.finished)!=="boolean")return null;return!!(Q0.finished||u===!1&&Q0.ended===!0&&Q0.length===0)}function $0(k){if(!F(k))return null;if(k.readableEnded===!0)return!0;let u=k._readableState;if(!u||u.errored)return!1;if(typeof(u===null||u===void 0?void 0:u.ended)!=="boolean")return null;return u.ended}function _(k,u){if(!F(k))return null;let Q0=k._readableState;if(Q0!==null&&Q0!==void 0&&Q0.errored)return!1;if(typeof(Q0===null||Q0===void 0?void 0:Q0.endEmitted)!=="boolean")return null;return!!(Q0.endEmitted||u===!1&&Q0.ended===!0&&Q0.length===0)}function g(k){if(k&&k[B]!=null)return k[B];if(typeof(k===null||k===void 0?void 0:k.readable)!=="boolean")return null;if(R(k))return!1;return F(k)&&k.readable&&!_(k)}function O(k){if(k&&k[W]!=null)return k[W];if(typeof(k===null||k===void 0?void 0:k.writable)!=="boolean")return null;if(R(k))return!1;return M(k)&&k.writable&&!c(k)}function h(k,u){if(!x(k))return null;if(R(k))return!0;if((u===null||u===void 0?void 0:u.readable)!==!1&&g(k))return!1;if((u===null||u===void 0?void 0:u.writable)!==!1&&O(k))return!1;return!0}function f(k){var u,Q0;if(!x(k))return null;if(k.writableErrored)return k.writableErrored;return(u=(Q0=k._writableState)===null||Q0===void 0?void 0:Q0.errored)!==null&&u!==void 0?u:null}function A(k){var u,Q0;if(!x(k))return null;if(k.readableErrored)return k.readableErrored;return(u=(Q0=k._readableState)===null||Q0===void 0?void 0:Q0.errored)!==null&&u!==void 0?u:null}function I(k){if(!x(k))return null;if(typeof k.closed==="boolean")return k.closed;let{_writableState:u,_readableState:Q0}=k;if(typeof(u===null||u===void 0?void 0:u.closed)==="boolean"||typeof(Q0===null||Q0===void 0?void 0:Q0.closed)==="boolean")return(u===null||u===void 0?void 0:u.closed)||(Q0===null||Q0===void 0?void 0:Q0.closed);if(typeof k._closed==="boolean"&&n(k))return k._closed;return null}function n(k){return typeof k._closed==="boolean"&&typeof k._defaultKeepAlive==="boolean"&&typeof k._removedConnection==="boolean"&&typeof k._removedContLen==="boolean"}function i(k){return typeof k._sent100==="boolean"&&n(k)}function K0(k){var u;return typeof k._consuming==="boolean"&&typeof k._dumped==="boolean"&&((u=k.req)===null||u===void 0?void 0:u.upgradeOrConnect)===void 0}function z0(k){if(!x(k))return null;let{_writableState:u,_readableState:Q0}=k,E=u||Q0;return!E&&i(k)||!!(E&&E.autoDestroy&&E.emitClose&&E.closed===!1)}function S(k){var u;return!!(k&&((u=k[U])!==null&&u!==void 0?u:k.readableDidRead||k.readableAborted))}function U0(k){var u,Q0,E,q0,B0,w0,M0,b,T,t;return!!(k&&((u=(Q0=(E=(q0=(B0=(w0=k[G])!==null&&w0!==void 0?w0:k.readableErrored)!==null&&B0!==void 0?B0:k.writableErrored)!==null&&q0!==void 0?q0:(M0=k._readableState)===null||M0===void 0?void 0:M0.errorEmitted)!==null&&E!==void 0?E:(b=k._writableState)===null||b===void 0?void 0:b.errorEmitted)!==null&&Q0!==void 0?Q0:(T=k._readableState)===null||T===void 0?void 0:T.errored)!==null&&u!==void 0?u:(t=k._writableState)===null||t===void 0?void 0:t.errored))}$.exports={isDestroyed:R,kIsDestroyed:Z,isDisturbed:S,kIsDisturbed:U,isErrored:U0,kIsErrored:G,isReadable:g,kIsReadable:B,kIsClosedPromise:V,kControllerErrorFunction:N,kIsWritable:W,isClosed:I,isDuplexNodeStream:v,isFinished:h,isIterable:H,isReadableNodeStream:F,isReadableStream:y,isReadableEnded:$0,isReadableFinished:_,isReadableErrored:A,isNodeStream:x,isWebStream:Y,isWritable:O,isWritableNodeStream:M,isWritableStream:D,isWritableEnded:c,isWritableFinished:m,isWritableErrored:f,isServerRequest:K0,isServerResponse:i,willEmitClose:z0,isTransformStream:z}}),R2=R0((Q,$)=>{var q=e2(),{AbortError:K,codes:J}=V1(),{ERR_INVALID_ARG_TYPE:Z,ERR_STREAM_PREMATURE_CLOSE:G}=J,{kEmptyObject:B,once:W}=W1(),{validateAbortSignal:U,validateFunction:V,validateObject:N,validateBoolean:F}=X8(),{Promise:M,PromisePrototypeThen:v,SymbolDispose:x}=b0(),{isClosed:y,isReadable:D,isReadableNodeStream:z,isReadableStream:Y,isReadableFinished:H,isReadableErrored:R,isWritable:c,isWritableNodeStream:m,isWritableStream:$0,isWritableFinished:_,isWritableErrored:g,isNodeStream:O,willEmitClose:h,kIsClosedPromise:f}=V2(),A;function I(S){return S.setHeader&&typeof S.abort==="function"}var n=()=>{};function i(S,U0,k){var u,Q0;if(arguments.length===2)k=U0,U0=B;else if(U0==null)U0=B;else N(U0,"options");if(V(k,"callback"),U(U0.signal,"options.signal"),k=W(k),Y(S)||$0(S))return K0(S,U0,k);if(!O(S))throw new Z("stream",["ReadableStream","WritableStream","Stream"],S);let E=(u=U0.readable)!==null&&u!==void 0?u:z(S),q0=(Q0=U0.writable)!==null&&Q0!==void 0?Q0:m(S),B0=S._writableState,w0=S._readableState,M0=()=>{if(!S.writable)t()},b=h(S)&&z(S)===E&&m(S)===q0,T=_(S,!1),t=()=>{if(T=!0,S.destroyed)b=!1;if(b&&(!S.readable||E))return;if(!E||Z0)k.call(S)},Z0=H(S,!1),W0=()=>{if(Z0=!0,S.destroyed)b=!1;if(b&&(!S.writable||q0))return;if(!q0||T)k.call(S)},C=(j)=>{k.call(S,j)},X=y(S),P=()=>{X=!0;let j=g(S)||R(S);if(j&&typeof j!=="boolean")return k.call(S,j);if(E&&!Z0&&z(S,!0)){if(!H(S,!1))return k.call(S,new G)}if(q0&&!T){if(!_(S,!1))return k.call(S,new G)}k.call(S)},o=()=>{X=!0;let j=g(S)||R(S);if(j&&typeof j!=="boolean")return k.call(S,j);k.call(S)},r=()=>{S.req.on("finish",t)};if(I(S)){if(S.on("complete",t),!b)S.on("abort",P);if(S.req)r();else S.on("request",r)}else if(q0&&!B0)S.on("end",M0),S.on("close",M0);if(!b&&typeof S.aborted==="boolean")S.on("aborted",P);if(S.on("end",W0),S.on("finish",t),U0.error!==!1)S.on("error",C);if(S.on("close",P),X)q.nextTick(P);else if(B0!==null&&B0!==void 0&&B0.errorEmitted||w0!==null&&w0!==void 0&&w0.errorEmitted){if(!b)q.nextTick(o)}else if(!E&&(!b||D(S))&&(T||c(S)===!1))q.nextTick(o);else if(!q0&&(!b||c(S))&&(Z0||D(S)===!1))q.nextTick(o);else if(w0&&S.req&&S.aborted)q.nextTick(o);let l=()=>{if(k=n,S.removeListener("aborted",P),S.removeListener("complete",t),S.removeListener("abort",P),S.removeListener("request",r),S.req)S.req.removeListener("finish",t);S.removeListener("end",M0),S.removeListener("close",M0),S.removeListener("finish",t),S.removeListener("end",W0),S.removeListener("error",C),S.removeListener("close",P)};if(U0.signal&&!X){let j=()=>{let d=k;l(),d.call(S,new K(void 0,{cause:U0.signal.reason}))};if(U0.signal.aborted)q.nextTick(j);else{A=A||W1().addAbortListener;let d=A(U0.signal,j),e=k;k=W((...p)=>{d[x](),e.apply(S,p)})}}return l}function K0(S,U0,k){let u=!1,Q0=n;if(U0.signal)if(Q0=()=>{u=!0,k.call(S,new K(void 0,{cause:U0.signal.reason}))},U0.signal.aborted)q.nextTick(Q0);else{A=A||W1().addAbortListener;let q0=A(U0.signal,Q0),B0=k;k=W((...w0)=>{q0[x](),B0.apply(S,w0)})}let E=(...q0)=>{if(!u)q.nextTick(()=>k.apply(S,q0))};return v(S[f].promise,E,E),n}function z0(S,U0){var k;let u=!1;if(U0===null)U0=B;if((k=U0)!==null&&k!==void 0&&k.cleanup)F(U0.cleanup,"cleanup"),u=U0.cleanup;return new M((Q0,E)=>{let q0=i(S,U0,(B0)=>{if(u)q0();if(B0)E(B0);else Q0()})})}$.exports=i,$.exports.finished=z0}),O6=R0((Q,$)=>{var q=e2(),{aggregateTwoErrors:K,codes:{ERR_MULTIPLE_CALLBACK:J},AbortError:Z}=V1(),{Symbol:G}=b0(),{kIsDestroyed:B,isDestroyed:W,isFinished:U,isServerRequest:V}=V2(),N=G("kDestroy"),F=G("kConstruct");function M(h,f,A){if(h){if(h.stack,f&&!f.errored)f.errored=h;if(A&&!A.errored)A.errored=h}}function v(h,f){let A=this._readableState,I=this._writableState,n=I||A;if(I!==null&&I!==void 0&&I.destroyed||A!==null&&A!==void 0&&A.destroyed){if(typeof f==="function")f();return this}if(M(h,I,A),I)I.destroyed=!0;if(A)A.destroyed=!0;if(!n.constructed)this.once(N,function(i){x(this,K(i,h),f)});else x(this,h,f);return this}function x(h,f,A){let I=!1;function n(i){if(I)return;I=!0;let{_readableState:K0,_writableState:z0}=h;if(M(i,z0,K0),z0)z0.closed=!0;if(K0)K0.closed=!0;if(typeof A==="function")A(i);if(i)q.nextTick(y,h,i);else q.nextTick(D,h)}try{h._destroy(f||null,n)}catch(i){n(i)}}function y(h,f){z(h,f),D(h)}function D(h){let{_readableState:f,_writableState:A}=h;if(A)A.closeEmitted=!0;if(f)f.closeEmitted=!0;if(A!==null&&A!==void 0&&A.emitClose||f!==null&&f!==void 0&&f.emitClose)h.emit("close")}function z(h,f){let{_readableState:A,_writableState:I}=h;if(I!==null&&I!==void 0&&I.errorEmitted||A!==null&&A!==void 0&&A.errorEmitted)return;if(I)I.errorEmitted=!0;if(A)A.errorEmitted=!0;h.emit("error",f)}function Y(){let h=this._readableState,f=this._writableState;if(h)h.constructed=!0,h.closed=!1,h.closeEmitted=!1,h.destroyed=!1,h.errored=null,h.errorEmitted=!1,h.reading=!1,h.ended=h.readable===!1,h.endEmitted=h.readable===!1;if(f)f.constructed=!0,f.destroyed=!1,f.closed=!1,f.closeEmitted=!1,f.errored=null,f.errorEmitted=!1,f.finalCalled=!1,f.prefinished=!1,f.ended=f.writable===!1,f.ending=f.writable===!1,f.finished=f.writable===!1}function H(h,f,A){let{_readableState:I,_writableState:n}=h;if(n!==null&&n!==void 0&&n.destroyed||I!==null&&I!==void 0&&I.destroyed)return this;if(I!==null&&I!==void 0&&I.autoDestroy||n!==null&&n!==void 0&&n.autoDestroy)h.destroy(f);else if(f){if(f.stack,n&&!n.errored)n.errored=f;if(I&&!I.errored)I.errored=f;if(A)q.nextTick(z,h,f);else z(h,f)}}function R(h,f){if(typeof h._construct!=="function")return;let{_readableState:A,_writableState:I}=h;if(A)A.constructed=!1;if(I)I.constructed=!1;if(h.once(F,f),h.listenerCount(F)>1)return;q.nextTick(c,h)}function c(h){let f=!1;function A(I){if(f){H(h,I!==null&&I!==void 0?I:new J);return}f=!0;let{_readableState:n,_writableState:i}=h,K0=i||n;if(n)n.constructed=!0;if(i)i.constructed=!0;if(K0.destroyed)h.emit(N,I);else if(I)H(h,I,!0);else q.nextTick(m,h)}try{h._construct((I)=>{q.nextTick(A,I)})}catch(I){q.nextTick(A,I)}}function m(h){h.emit(F)}function $0(h){return(h===null||h===void 0?void 0:h.setHeader)&&typeof h.abort==="function"}function _(h){h.emit("close")}function g(h,f){h.emit("error",f),q.nextTick(_,h)}function O(h,f){if(!h||W(h))return;if(!f&&!U(h))f=new Z;if(V(h))h.socket=null,h.destroy(f);else if($0(h))h.abort();else if($0(h.req))h.req.abort();else if(typeof h.destroy==="function")h.destroy(f);else if(typeof h.close==="function")h.close();else if(f)q.nextTick(g,h,f);else q.nextTick(_,h);if(!h.destroyed)h[B]=!0}$.exports={construct:R,destroyer:O,destroy:v,undestroy:Y,errorOrDestroy:H}}),t7=R0((Q,$)=>{var{ArrayIsArray:q,ObjectSetPrototypeOf:K}=b0(),{EventEmitter:J}=(a1(),y0(o1));function Z(B){J.call(this,B)}K(Z.prototype,J.prototype),K(Z,J),Z.prototype.pipe=function(B,W){let U=this;function V(D){if(B.writable&&B.write(D)===!1&&U.pause)U.pause()}U.on("data",V);function N(){if(U.readable&&U.resume)U.resume()}if(B.on("drain",N),!B._isStdio&&(!W||W.end!==!1))U.on("end",M),U.on("close",v);let F=!1;function M(){if(F)return;F=!0,B.end()}function v(){if(F)return;if(F=!0,typeof B.destroy==="function")B.destroy()}function x(D){if(y(),J.listenerCount(this,"error")===0)this.emit("error",D)}G(U,"error",x),G(B,"error",x);function y(){U.removeListener("data",V),B.removeListener("drain",N),U.removeListener("end",M),U.removeListener("close",v),U.removeListener("error",x),B.removeListener("error",x),U.removeListener("end",y),U.removeListener("close",y),B.removeListener("close",y)}return U.on("end",y),U.on("close",y),B.on("close",y),B.emit("pipe",U),B};function G(B,W,U){if(typeof B.prependListener==="function")return B.prependListener(W,U);if(!B._events||!B._events[W])B.on(W,U);else if(q(B._events[W]))B._events[W].unshift(U);else B._events[W]=[U,B._events[W]]}$.exports={Stream:Z,prependListener:G}}),u5=R0((Q,$)=>{var{SymbolDispose:q}=b0(),{AbortError:K,codes:J}=V1(),{isNodeStream:Z,isWebStream:G,kControllerErrorFunction:B}=V2(),W=R2(),{ERR_INVALID_ARG_TYPE:U}=J,V,N=(F,M)=>{if(typeof F!=="object"||!("aborted"in F))throw new U(M,"AbortSignal",F)};Q.addAbortSignal=function F(M,v){if(N(M,"signal"),!Z(v)&&!G(v))throw new U("stream",["ReadableStream","WritableStream","Stream"],v);return Q.addAbortSignalNoValidate(M,v)},Q.addAbortSignalNoValidate=function(F,M){if(typeof F!=="object"||!("aborted"in F))return M;let v=Z(M)?()=>{M.destroy(new K(void 0,{cause:F.reason}))}:()=>{M[B](new K(void 0,{cause:F.reason}))};if(F.aborted)v();else{V=V||W1().addAbortListener;let x=V(F,v);W(M,x[q])}return M}}),GW=R0((Q,$)=>{var{StringPrototypeSlice:q,SymbolIterator:K,TypedArrayPrototypeSet:J,Uint8Array:Z}=b0(),{Buffer:G}=(a0(),y0(s0)),{inspect:B}=W1();$.exports=class W{constructor(){this.head=null,this.tail=null,this.length=0}push(U){let V={data:U,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length}unshift(U){let V={data:U,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length}shift(){if(this.length===0)return;let U=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,U}clear(){this.head=this.tail=null,this.length=0}join(U){if(this.length===0)return"";let V=this.head,N=""+V.data;while((V=V.next)!==null)N+=U+V.data;return N}concat(U){if(this.length===0)return G.alloc(0);let V=G.allocUnsafe(U>>>0),N=this.head,F=0;while(N)J(V,N.data,F),F+=N.data.length,N=N.next;return V}consume(U,V){let N=this.head.data;if(UM.length)V+=M,U-=M.length;else{if(U===M.length)if(V+=M,++F,N.next)this.head=N.next;else this.head=this.tail=null;else V+=q(M,0,U),this.head=N,N.data=q(M,U);break}++F}while((N=N.next)!==null);return this.length-=F,V}_getBuffer(U){let V=G.allocUnsafe(U),N=U,F=this.head,M=0;do{let v=F.data;if(U>v.length)J(V,v,N-U),U-=v.length;else{if(U===v.length)if(J(V,v,N-U),++M,F.next)this.head=F.next;else this.head=this.tail=null;else J(V,new Z(v.buffer,v.byteOffset,U),N-U),this.head=F,F.data=v.slice(U);break}++M}while((F=F.next)!==null);return this.length-=M,V}[Symbol.for("nodejs.util.inspect.custom")](U,V){return B(this,{...V,depth:0,customInspect:!1})}}}),_5=R0((Q,$)=>{var{MathFloor:q,NumberIsInteger:K}=b0(),{validateInteger:J}=X8(),{ERR_INVALID_ARG_VALUE:Z}=V1().codes,G=16384,B=16;function W(F,M,v){return F.highWaterMark!=null?F.highWaterMark:M?F[v]:null}function U(F){return F?B:G}function V(F,M){if(J(M,"value",0),F)B=M;else G=M}function N(F,M,v,x){let y=W(M,x,v);if(y!=null){if(!K(y)||y<0){let D=x?`options.${v}`:"options.highWaterMark";throw new Z(D,y)}return q(y)}return U(F.objectMode)}$.exports={getHighWaterMark:N,getDefaultHighWaterMark:U,setDefaultHighWaterMark:V}}),BW=R0((Q,$)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh */var q=(a0(),y0(s0)),K=q.Buffer;function J(G,B){for(var W in G)B[W]=G[W]}if(K.from&&K.alloc&&K.allocUnsafe&&K.allocUnsafeSlow)$.exports=q;else J(q,Q),Q.Buffer=Z;function Z(G,B,W){return K(G,B,W)}Z.prototype=Object.create(K.prototype),J(K,Z),Z.from=function(G,B,W){if(typeof G==="number")throw new TypeError("Argument must not be a number");return K(G,B,W)},Z.alloc=function(G,B,W){if(typeof G!=="number")throw new TypeError("Argument must be a number");var U=K(G);if(B!==void 0)if(typeof W==="string")U.fill(B,W);else U.fill(B);else U.fill(0);return U},Z.allocUnsafe=function(G){if(typeof G!=="number")throw new TypeError("Argument must be a number");return K(G)},Z.allocUnsafeSlow=function(G){if(typeof G!=="number")throw new TypeError("Argument must be a number");return q.SlowBuffer(G)}}),WW=R0((Q)=>{var $=BW().Buffer,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 Y;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(Y)return;z=(""+z).toLowerCase(),Y=!0}}function J(z){var Y=K(z);if(typeof Y!=="string"&&($.isEncoding===q||!q(z)))throw new Error("Unknown encoding: "+z);return Y||z}Q.StringDecoder=Z;function Z(z){this.encoding=J(z);var Y;switch(this.encoding){case"utf16le":this.text=F,this.end=M,Y=4;break;case"utf8":this.fillLast=U,Y=4;break;case"base64":this.text=v,this.end=x,Y=3;break;default:this.write=y,this.end=D;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=$.allocUnsafe(Y)}Z.prototype.write=function(z){if(z.length===0)return"";var Y,H;if(this.lastNeed){if(Y=this.fillLast(z),Y===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 B(z,Y,H){var R=Y.length-1;if(R=0){if(c>0)z.lastNeed=c-1;return c}if(--R=0){if(c>0)z.lastNeed=c-2;return c}if(--R=0){if(c>0)if(c===2)c=0;else z.lastNeed=c-3;return c}return 0}function W(z,Y,H){if((Y[0]&192)!==128)return z.lastNeed=0,"�";if(z.lastNeed>1&&Y.length>1){if((Y[1]&192)!==128)return z.lastNeed=1,"�";if(z.lastNeed>2&&Y.length>2){if((Y[2]&192)!==128)return z.lastNeed=2,"�"}}}function U(z){var Y=this.lastTotal-this.lastNeed,H=W(this,z,Y);if(H!==void 0)return H;if(this.lastNeed<=z.length)return z.copy(this.lastChar,Y,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,Y,0,z.length),this.lastNeed-=z.length}function V(z,Y){var H=B(this,z,Y);if(!this.lastNeed)return z.toString("utf8",Y);this.lastTotal=H;var R=z.length-(H-this.lastNeed);return z.copy(this.lastChar,0,R),z.toString("utf8",Y,R)}function N(z){var Y=z&&z.length?this.write(z):"";if(this.lastNeed)return Y+"�";return Y}function F(z,Y){if((z.length-Y)%2===0){var H=z.toString("utf16le",Y);if(H){var R=H.charCodeAt(H.length-1);if(R>=55296&&R<=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",Y,z.length-1)}function M(z){var Y=z&&z.length?this.write(z):"";if(this.lastNeed){var H=this.lastTotal-this.lastNeed;return Y+this.lastChar.toString("utf16le",0,H)}return Y}function v(z,Y){var H=(z.length-Y)%3;if(H===0)return z.toString("base64",Y);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",Y,z.length-H)}function x(z){var Y=z&&z.length?this.write(z):"";if(this.lastNeed)return Y+this.lastChar.toString("base64",0,3-this.lastNeed);return Y}function y(z){return z.toString(this.encoding)}function D(z){return z&&z.length?this.write(z):""}}),GJ=R0((Q,$)=>{var q=e2(),{PromisePrototypeThen:K,SymbolAsyncIterator:J,SymbolIterator:Z}=b0(),{Buffer:G}=(a0(),y0(s0)),{ERR_INVALID_ARG_TYPE:B,ERR_STREAM_NULL_VALUES:W}=V1().codes;function U(V,N,F){let M;if(typeof N==="string"||N instanceof G)return new V({objectMode:!0,...F,read(){this.push(N),this.push(null)}});let v;if(N&&N[J])v=!0,M=N[J]();else if(N&&N[Z])v=!1,M=N[Z]();else throw new B("iterable",["Iterable"],N);let x=new V({objectMode:!0,highWaterMark:1,...F}),y=!1;x._read=function(){if(!y)y=!0,z()},x._destroy=function(Y,H){K(D(Y),()=>q.nextTick(H,Y),(R)=>q.nextTick(H,R||Y))};async function D(Y){let H=Y!==void 0&&Y!==null,R=typeof M.throw==="function";if(H&&R){let{value:c,done:m}=await M.throw(Y);if(await c,m)return}if(typeof M.return==="function"){let{value:c}=await M.return();await c}}async function z(){for(;;){try{let{value:Y,done:H}=v?await M.next():M.next();if(H)x.push(null);else{let R=Y&&typeof Y.then==="function"?await Y:Y;if(R===null)throw y=!1,new W;else if(x.push(R))continue;else y=!1}}catch(Y){x.destroy(Y)}break}}return x}$.exports=U}),c5=R0((Q,$)=>{var q=e2(),{ArrayPrototypeIndexOf:K,NumberIsInteger:J,NumberIsNaN:Z,NumberParseInt:G,ObjectDefineProperties:B,ObjectKeys:W,ObjectSetPrototypeOf:U,Promise:V,SafeSet:N,SymbolAsyncDispose:F,SymbolAsyncIterator:M,Symbol:v}=b0();$.exports=p,p.ReadableState=e;var{EventEmitter:x}=(a1(),y0(o1)),{Stream:y,prependListener:D}=t7(),{Buffer:z}=(a0(),y0(s0)),{addAbortSignal:Y}=u5(),H=R2(),R=W1().debuglog("stream",(w)=>{R=w}),c=GW(),m=O6(),{getHighWaterMark:$0,getDefaultHighWaterMark:_}=_5(),{aggregateTwoErrors:g,codes:{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:h,ERR_OUT_OF_RANGE:f,ERR_STREAM_PUSH_AFTER_EOF:A,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:I},AbortError:n}=V1(),{validateObject:i}=X8(),K0=v("kPaused"),{StringDecoder:z0}=WW(),S=GJ();U(p.prototype,y.prototype),U(p,y);var U0=()=>{},{errorOrDestroy:k}=m,u=1,Q0=2,E=4,q0=8,B0=16,w0=32,M0=64,b=128,T=256,t=512,Z0=1024,W0=2048,C=4096,X=8192,P=16384,o=32768,r=65536,l=131072,j=262144;function d(w){return{enumerable:!1,get(){return(this.state&w)!==0},set(L){if(L)this.state|=w;else this.state&=~w}}}B(e.prototype,{objectMode:d(u),ended:d(Q0),endEmitted:d(E),reading:d(q0),constructed:d(B0),sync:d(w0),needReadable:d(M0),emittedReadable:d(b),readableListening:d(T),resumeScheduled:d(t),errorEmitted:d(Z0),emitClose:d(W0),autoDestroy:d(C),destroyed:d(X),closed:d(P),closeEmitted:d(o),multiAwaitDrain:d(r),readingMore:d(l),dataEmitted:d(j)});function e(w,L,a){if(typeof a!=="boolean")a=L instanceof U2();if(this.state=W0|C|B0|w0,w&&w.objectMode)this.state|=u;if(a&&w&&w.readableObjectMode)this.state|=u;if(this.highWaterMark=w?$0(this,w,"readableHighWaterMark",a):_(!1),this.buffer=new c,this.length=0,this.pipes=[],this.flowing=null,this[K0]=null,w&&w.emitClose===!1)this.state&=~W0;if(w&&w.autoDestroy===!1)this.state&=~C;if(this.errored=null,this.defaultEncoding=w&&w.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,w&&w.encoding)this.decoder=new z0(w.encoding),this.encoding=w.encoding}function p(w){if(!(this instanceof p))return new p(w);let L=this instanceof U2();if(this._readableState=new e(w,this,L),w){if(typeof w.read==="function")this._read=w.read;if(typeof w.destroy==="function")this._destroy=w.destroy;if(typeof w.construct==="function")this._construct=w.construct;if(w.signal&&!L)Y(w.signal,this)}y.call(this,w),m.construct(this,()=>{if(this._readableState.needReadable)M1(this,this._readableState)})}p.prototype.destroy=m.destroy,p.prototype._undestroy=m.undestroy,p.prototype._destroy=function(w,L){L(w)},p.prototype[x.captureRejectionSymbol]=function(w){this.destroy(w)},p.prototype[F]=function(){let w;if(!this.destroyed)w=this.readableEnded?null:new n,this.destroy(w);return new V((L,a)=>H(this,(s)=>s&&s!==w?a(s):L(null)))},p.prototype.push=function(w,L){return G0(this,w,L,!1)},p.prototype.unshift=function(w,L){return G0(this,w,L,!0)};function G0(w,L,a,s){R("readableAddChunk",L);let V0=w._readableState,g0;if((V0.state&u)===0){if(typeof L==="string"){if(a=a||V0.defaultEncoding,V0.encoding!==a)if(s&&V0.encoding)L=z.from(L,a).toString(V0.encoding);else L=z.from(L,a),a=""}else if(L instanceof z)a="";else if(y._isUint8Array(L))L=y._uint8ArrayToBuffer(L),a="";else if(L!=null)g0=new O("chunk",["string","Buffer","Uint8Array"],L)}if(g0)k(w,g0);else if(L===null)V0.state&=~q0,A0(w,V0);else if((V0.state&u)!==0||L&&L.length>0)if(s)if((V0.state&E)!==0)k(w,new I);else if(V0.destroyed||V0.errored)return!1;else P0(w,V0,L,!0);else if(V0.ended)k(w,new A);else if(V0.destroyed||V0.errored)return!1;else if(V0.state&=~q0,V0.decoder&&!a)if(L=V0.decoder.write(L),V0.objectMode||L.length!==0)P0(w,V0,L,!1);else M1(w,V0);else P0(w,V0,L,!1);else if(!s)V0.state&=~q0,M1(w,V0);return!V0.ended&&(V0.length0){if((L.state&r)!==0)L.awaitDrainWriters.clear();else L.awaitDrainWriters=null;L.dataEmitted=!0,w.emit("data",a)}else{if(L.length+=L.objectMode?1:a.length,s)L.buffer.unshift(a);else L.buffer.push(a);if((L.state&M0)!==0)O0(w)}M1(w,L)}p.prototype.isPaused=function(){let w=this._readableState;return w[K0]===!0||w.flowing===!1},p.prototype.setEncoding=function(w){let L=new z0(w);this._readableState.decoder=L,this._readableState.encoding=this._readableState.decoder.encoding;let a=this._readableState.buffer,s="";for(let V0 of a)s+=L.write(V0);if(a.clear(),s!=="")a.push(s);return this._readableState.length=s.length,this};var k0=1073741824;function I0(w){if(w>k0)throw new f("size","<= 1GiB",w);else w--,w|=w>>>1,w|=w>>>2,w|=w>>>4,w|=w>>>8,w|=w>>>16,w++;return w}function Q1(w,L){if(w<=0||L.length===0&&L.ended)return 0;if((L.state&u)!==0)return 1;if(Z(w)){if(L.flowing&&L.length)return L.buffer.first().length;return L.length}if(w<=L.length)return w;return L.ended?L.length:0}p.prototype.read=function(w){if(R("read",w),w===void 0)w=NaN;else if(!J(w))w=G(w,10);let L=this._readableState,a=w;if(w>L.highWaterMark)L.highWaterMark=I0(w);if(w!==0)L.state&=~b;if(w===0&&L.needReadable&&((L.highWaterMark!==0?L.length>=L.highWaterMark:L.length>0)||L.ended)){if(R("read: emitReadable",L.length,L.ended),L.length===0&&L.ended)f2(this);else O0(this);return null}if(w=Q1(w,L),w===0&&L.ended){if(L.length===0)f2(this);return null}let s=(L.state&M0)!==0;if(R("need readable",s),L.length===0||L.length-w0)V0=p6(w,L);else V0=null;if(V0===null)L.needReadable=L.length<=L.highWaterMark,w=0;else if(L.length-=w,L.multiAwaitDrain)L.awaitDrainWriters.clear();else L.awaitDrainWriters=null;if(L.length===0){if(!L.ended)L.needReadable=!0;if(a!==w&&L.ended)f2(this)}if(V0!==null&&!L.errorEmitted&&!L.closeEmitted)L.dataEmitted=!0,this.emit("data",V0);return V0};function A0(w,L){if(R("onEofChunk"),L.ended)return;if(L.decoder){let a=L.decoder.end();if(a&&a.length)L.buffer.push(a),L.length+=L.objectMode?1:a.length}if(L.ended=!0,L.sync)O0(w);else L.needReadable=!1,L.emittedReadable=!0,F1(w)}function O0(w){let L=w._readableState;if(R("emitReadable",L.needReadable,L.emittedReadable),L.needReadable=!1,!L.emittedReadable)R("emitReadable",L.flowing),L.emittedReadable=!0,q.nextTick(F1,w)}function F1(w){let L=w._readableState;if(R("emitReadable_",L.destroyed,L.length,L.ended),!L.destroyed&&!L.errored&&(L.length||L.ended))w.emit("readable"),L.emittedReadable=!1;L.needReadable=!L.flowing&&!L.ended&&L.length<=L.highWaterMark,m6(w)}function M1(w,L){if(!L.readingMore&&L.constructed)L.readingMore=!0,q.nextTick(d0,w,L)}function d0(w,L){while(!L.reading&&!L.ended&&(L.length1&&s.pipes.includes(w))R("false write response, pause",s.awaitDrainWriters.size),s.awaitDrainWriters.add(w);a.pause()}if(!q1)q1=o5(a,w),w.on("drain",q1)}a.on("data",a6);function a6($1){R("ondata");let i0=w.write($1);if(R("dest.write",i0),i0===!1)o6()}function g2($1){if(R("onerror",$1),A1(),w.removeListener("error",g2),w.listenerCount("error")===0){let i0=w._writableState||w._readableState;if(i0&&!i0.errorEmitted)k(w,$1);else w.emit("error",$1)}}D(w,"error",g2);function X2(){w.removeListener("finish",y2),A1()}w.once("close",X2);function y2(){R("onfinish"),w.removeListener("close",X2),A1()}w.once("finish",y2);function A1(){R("unpipe"),a.unpipe(w)}if(w.emit("pipe",a),w.writableNeedDrain===!0)o6();else if(!s.flowing)R("pipe resume"),a.resume();return w};function o5(w,L){return function a(){let s=w._readableState;if(s.awaitDrainWriters===L)R("pipeOnDrain",1),s.awaitDrainWriters=null;else if(s.multiAwaitDrain)R("pipeOnDrain",s.awaitDrainWriters.size),s.awaitDrainWriters.delete(L);if((!s.awaitDrainWriters||s.awaitDrainWriters.size===0)&&w.listenerCount("data"))w.resume()}}p.prototype.unpipe=function(w){let L=this._readableState,a={hasUnpiped:!1};if(L.pipes.length===0)return this;if(!w){let V0=L.pipes;L.pipes=[],this.pause();for(let g0=0;g00,s.flowing!==!1)this.resume()}else if(w==="readable"){if(!s.endEmitted&&!s.readableListening){if(s.readableListening=s.needReadable=!0,s.flowing=!1,s.emittedReadable=!1,R("on readable",s.length,s.reading),s.length)O0(this);else if(!s.reading)q.nextTick(a5,this)}}return a},p.prototype.addListener=p.prototype.on,p.prototype.removeListener=function(w,L){let a=y.prototype.removeListener.call(this,w,L);if(w==="readable")q.nextTick(d6,this);return a},p.prototype.off=p.prototype.removeListener,p.prototype.removeAllListeners=function(w){let L=y.prototype.removeAllListeners.apply(this,arguments);if(w==="readable"||w===void 0)q.nextTick(d6,this);return L};function d6(w){let L=w._readableState;if(L.readableListening=w.listenerCount("readable")>0,L.resumeScheduled&&L[K0]===!1)L.flowing=!0;else if(w.listenerCount("data")>0)w.resume();else if(!L.readableListening)L.flowing=null}function a5(w){R("readable nexttick read 0"),w.read(0)}p.prototype.resume=function(){let w=this._readableState;if(!w.flowing)R("resume"),w.flowing=!w.readableListening,r5(this,w);return w[K0]=!1,this};function r5(w,L){if(!L.resumeScheduled)L.resumeScheduled=!0,q.nextTick(s5,w,L)}function s5(w,L){if(R("resume",L.reading),!L.reading)w.read(0);if(L.resumeScheduled=!1,w.emit("resume"),m6(w),L.flowing&&!L.reading)w.read(0)}p.prototype.pause=function(){if(R("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)R("pause"),this._readableState.flowing=!1,this.emit("pause");return this._readableState[K0]=!0,this};function m6(w){let L=w._readableState;R("flow",L.flowing);while(L.flowing&&w.read()!==null);}p.prototype.wrap=function(w){let L=!1;w.on("data",(s)=>{if(!this.push(s)&&w.pause)L=!0,w.pause()}),w.on("end",()=>{this.push(null)}),w.on("error",(s)=>{k(this,s)}),w.on("close",()=>{this.destroy()}),w.on("destroy",()=>{this.destroy()}),this._read=()=>{if(L&&w.resume)L=!1,w.resume()};let a=W(w);for(let s=1;s{V0=E0?g(V0,E0):null,a(),a=U0});try{while(!0){let E0=w.destroyed?null:w.read();if(E0!==null)yield E0;else if(V0)throw V0;else if(V0===null)return;else await new V(s)}}catch(E0){throw V0=g(V0,E0),V0}finally{if((V0||(L===null||L===void 0?void 0:L.destroyOnReturn)!==!1)&&(V0===void 0||w._readableState.autoDestroy))m.destroyer(w,null);else w.off("readable",s),g0()}}B(p.prototype,{readable:{__proto__:null,get(){let w=this._readableState;return!!w&&w.readable!==!1&&!w.destroyed&&!w.errorEmitted&&!w.endEmitted},set(w){if(this._readableState)this._readableState.readable=!!w}},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(w){if(this._readableState)this._readableState.flowing=w}},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(w){if(!this._readableState)return;this._readableState.destroyed=w}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),B(e.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[K0]!==!1},set(w){this[K0]=!!w}}}),p._fromList=p6;function p6(w,L){if(L.length===0)return null;let a;if(L.objectMode)a=L.buffer.shift();else if(!w||w>=L.length){if(L.decoder)a=L.buffer.join("");else if(L.buffer.length===1)a=L.buffer.first();else a=L.buffer.concat(L.length);L.buffer.clear()}else a=L.buffer.consume(w,L.decoder);return a}function f2(w){let L=w._readableState;if(R("endReadable",L.endEmitted),!L.endEmitted)L.ended=!0,q.nextTick(e5,L,w)}function e5(w,L){if(R("endReadableNT",w.endEmitted,w.length),!w.errored&&!w.closeEmitted&&!w.endEmitted&&w.length===0){if(w.endEmitted=!0,L.emit("end"),L.writable&&L.allowHalfOpen===!1)q.nextTick(Q4,L);else if(w.autoDestroy){let a=L._writableState;if(!a||a.autoDestroy&&(a.finished||a.writable===!1))L.destroy()}}}function Q4(w){if(w.writable&&!w.writableEnded&&!w.destroyed)w.end()}p.from=function(w,L){return S(p,w,L)};var A2;function i6(){if(A2===void 0)A2={};return A2}p.fromWeb=function(w,L){return i6().newStreamReadableFromReadableStream(w,L)},p.toWeb=function(w,L){return i6().newReadableStreamFromStreamReadable(w,L)},p.wrap=function(w,L){var a,s;return new p({objectMode:(a=(s=w.readableObjectMode)!==null&&s!==void 0?s:w.objectMode)!==null&&a!==void 0?a:!0,...L,destroy(V0,g0){m.destroyer(w,V0),g0(V0)}}).wrap(w)}}),e7=R0((Q,$)=>{var q=e2(),{ArrayPrototypeSlice:K,Error:J,FunctionPrototypeSymbolHasInstance:Z,ObjectDefineProperty:G,ObjectDefineProperties:B,ObjectSetPrototypeOf:W,StringPrototypeToLowerCase:U,Symbol:V,SymbolHasInstance:N}=b0();$.exports=i,i.WritableState=I;var{EventEmitter:F}=(a1(),y0(o1)),M=t7().Stream,{Buffer:v}=(a0(),y0(s0)),x=O6(),{addAbortSignal:y}=u5(),{getHighWaterMark:D,getDefaultHighWaterMark:z}=_5(),{ERR_INVALID_ARG_TYPE:Y,ERR_METHOD_NOT_IMPLEMENTED:H,ERR_MULTIPLE_CALLBACK:R,ERR_STREAM_CANNOT_PIPE:c,ERR_STREAM_DESTROYED:m,ERR_STREAM_ALREADY_FINISHED:$0,ERR_STREAM_NULL_VALUES:_,ERR_STREAM_WRITE_AFTER_END:g,ERR_UNKNOWN_ENCODING:O}=V1().codes,{errorOrDestroy:h}=x;W(i.prototype,M.prototype),W(i,M);function f(){}var A=V("kOnFinished");function I(C,X,P){if(typeof P!=="boolean")P=X instanceof U2();if(this.objectMode=!!(C&&C.objectMode),P)this.objectMode=this.objectMode||!!(C&&C.writableObjectMode);this.highWaterMark=C?D(this,C,"writableHighWaterMark",P):z(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let o=!!(C&&C.decodeStrings===!1);this.decodeStrings=!o,this.defaultEncoding=C&&C.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=k.bind(void 0,X),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,n(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!C||C.emitClose!==!1,this.autoDestroy=!C||C.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[A]=[]}function n(C){C.buffered=[],C.bufferedIndex=0,C.allBuffers=!0,C.allNoop=!0}I.prototype.getBuffer=function C(){return K(this.buffered,this.bufferedIndex)},G(I.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function i(C){let X=this instanceof U2();if(!X&&!Z(i,this))return new i(C);if(this._writableState=new I(C,this,X),C){if(typeof C.write==="function")this._write=C.write;if(typeof C.writev==="function")this._writev=C.writev;if(typeof C.destroy==="function")this._destroy=C.destroy;if(typeof C.final==="function")this._final=C.final;if(typeof C.construct==="function")this._construct=C.construct;if(C.signal)y(C.signal,this)}M.call(this,C),x.construct(this,()=>{let P=this._writableState;if(!P.writing)q0(this,P);b(this,P)})}G(i,N,{__proto__:null,value:function(C){if(Z(this,C))return!0;if(this!==i)return!1;return C&&C._writableState instanceof I}}),i.prototype.pipe=function(){h(this,new c)};function K0(C,X,P,o){let r=C._writableState;if(typeof P==="function")o=P,P=r.defaultEncoding;else{if(!P)P=r.defaultEncoding;else if(P!=="buffer"&&!v.isEncoding(P))throw new O(P);if(typeof o!=="function")o=f}if(X===null)throw new _;else if(!r.objectMode)if(typeof X==="string"){if(r.decodeStrings!==!1)X=v.from(X,P),P="buffer"}else if(X instanceof v)P="buffer";else if(M._isUint8Array(X))X=M._uint8ArrayToBuffer(X),P="buffer";else throw new Y("chunk",["string","Buffer","Uint8Array"],X);let l;if(r.ending)l=new g;else if(r.destroyed)l=new m("write");if(l)return q.nextTick(o,l),h(C,l,!0),l;return r.pendingcb++,z0(C,r,X,P,o)}i.prototype.write=function(C,X,P){return K0(this,C,X,P)===!0},i.prototype.cork=function(){this._writableState.corked++},i.prototype.uncork=function(){let C=this._writableState;if(C.corked){if(C.corked--,!C.writing)q0(this,C)}},i.prototype.setDefaultEncoding=function C(X){if(typeof X==="string")X=U(X);if(!v.isEncoding(X))throw new O(X);return this._writableState.defaultEncoding=X,this};function z0(C,X,P,o,r){let l=X.objectMode?1:P.length;X.length+=l;let j=X.lengthP.bufferedIndex)q0(C,P);if(o)if(P.afterWriteTickInfo!==null&&P.afterWriteTickInfo.cb===r)P.afterWriteTickInfo.count++;else P.afterWriteTickInfo={count:1,cb:r,stream:C,state:P},q.nextTick(u,P.afterWriteTickInfo);else Q0(C,P,1,r)}}function u({stream:C,state:X,count:P,cb:o}){return X.afterWriteTickInfo=null,Q0(C,X,P,o)}function Q0(C,X,P,o){if(!X.ending&&!C.destroyed&&X.length===0&&X.needDrain)X.needDrain=!1,C.emit("drain");while(P-- >0)X.pendingcb--,o();if(X.destroyed)E(X);b(C,X)}function E(C){if(C.writing)return;for(let r=C.bufferedIndex;r1&&C._writev){X.pendingcb-=l-1;let d=X.allNoop?f:(p)=>{for(let G0=j;G0256)P.splice(0,j),X.bufferedIndex=0;else X.bufferedIndex=j}X.bufferProcessing=!1}i.prototype._write=function(C,X,P){if(this._writev)this._writev([{chunk:C,encoding:X}],P);else throw new H("_write()")},i.prototype._writev=null,i.prototype.end=function(C,X,P){let o=this._writableState;if(typeof C==="function")P=C,C=null,X=null;else if(typeof X==="function")P=X,X=null;let r;if(C!==null&&C!==void 0){let l=K0(this,C,X);if(l instanceof J)r=l}if(o.corked)o.corked=1,this.uncork();if(r);else if(!o.errored&&!o.ending)o.ending=!0,b(this,o,!0),o.ended=!0;else if(o.finished)r=new $0("end");else if(o.destroyed)r=new m("end");if(typeof P==="function")if(r||o.finished)q.nextTick(P,r);else o[A].push(P);return this};function B0(C){return C.ending&&!C.destroyed&&C.constructed&&C.length===0&&!C.errored&&C.buffered.length===0&&!C.finished&&!C.writing&&!C.errorEmitted&&!C.closeEmitted}function w0(C,X){let P=!1;function o(r){if(P){h(C,r!==null&&r!==void 0?r:R());return}if(P=!0,X.pendingcb--,r){let l=X[A].splice(0);for(let j=0;j{if(B0(r))T(o,r);else r.pendingcb--},C,X);else if(B0(X))X.pendingcb++,T(C,X)}}}function T(C,X){X.pendingcb--,X.finished=!0;let P=X[A].splice(0);for(let o=0;o{var q=e2(),K=(a0(),y0(s0)),{isReadable:J,isWritable:Z,isIterable:G,isNodeStream:B,isReadableNodeStream:W,isWritableNodeStream:U,isDuplexNodeStream:V,isReadableStream:N,isWritableStream:F}=V2(),M=R2(),{AbortError:v,codes:{ERR_INVALID_ARG_TYPE:x,ERR_INVALID_RETURN_VALUE:y}}=V1(),{destroyer:D}=O6(),z=U2(),Y=c5(),H=e7(),{createDeferredPromise:R}=W1(),c=GJ(),m=globalThis.Blob||K.Blob,$0=typeof m!=="undefined"?function A(I){return I instanceof m}:function A(I){return!1},_=globalThis.AbortController||g8().AbortController,{FunctionPrototypeCall:g}=b0();class O extends z{constructor(A){super(A);if((A===null||A===void 0?void 0:A.readable)===!1)this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0;if((A===null||A===void 0?void 0:A.writable)===!1)this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0}}$.exports=function A(I,n){if(V(I))return I;if(W(I))return f({readable:I});if(U(I))return f({writable:I});if(B(I))return f({writable:!1,readable:!1});if(N(I))return f({readable:Y.fromWeb(I)});if(F(I))return f({writable:H.fromWeb(I)});if(typeof I==="function"){let{value:K0,write:z0,final:S,destroy:U0}=h(I);if(G(K0))return c(O,K0,{objectMode:!0,write:z0,final:S,destroy:U0});let k=K0===null||K0===void 0?void 0:K0.then;if(typeof k==="function"){let u,Q0=g(k,K0,(E)=>{if(E!=null)throw new y("nully","body",E)},(E)=>{D(u,E)});return u=new O({objectMode:!0,readable:!1,write:z0,final(E){S(async()=>{try{await Q0,q.nextTick(E,null)}catch(q0){q.nextTick(E,q0)}})},destroy:U0})}throw new y("Iterable, AsyncIterable or AsyncFunction",n,K0)}if($0(I))return A(I.arrayBuffer());if(G(I))return c(O,I,{objectMode:!0,writable:!1});if(N(I===null||I===void 0?void 0:I.readable)&&F(I===null||I===void 0?void 0:I.writable))return O.fromWeb(I);if(typeof(I===null||I===void 0?void 0:I.writable)==="object"||typeof(I===null||I===void 0?void 0:I.readable)==="object"){let K0=I!==null&&I!==void 0&&I.readable?W(I===null||I===void 0?void 0:I.readable)?I===null||I===void 0?void 0:I.readable:A(I.readable):void 0,z0=I!==null&&I!==void 0&&I.writable?U(I===null||I===void 0?void 0:I.writable)?I===null||I===void 0?void 0:I.writable:A(I.writable):void 0;return f({readable:K0,writable:z0})}let i=I===null||I===void 0?void 0:I.then;if(typeof i==="function"){let K0;return g(i,I,(z0)=>{if(z0!=null)K0.push(z0);K0.push(null)},(z0)=>{D(K0,z0)}),K0=new O({objectMode:!0,writable:!1,read(){}})}throw new x(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],I)};function h(A){let{promise:I,resolve:n}=R(),i=new _,K0=i.signal;return{value:A(async function*(){while(!0){let z0=I;I=null;let{chunk:S,done:U0,cb:k}=await z0;if(q.nextTick(k),U0)return;if(K0.aborted)throw new v(void 0,{cause:K0.reason});({promise:I,resolve:n}=R()),yield S}}(),{signal:K0}),write(z0,S,U0){let k=n;n=null,k({chunk:z0,done:!1,cb:U0})},final(z0){let S=n;n=null,S({done:!0,cb:z0})},destroy(z0,S){i.abort(),S(z0)}}}function f(A){let I=A.readable&&typeof A.readable.read!=="function"?Y.wrap(A.readable):A.readable,n=A.writable,i=!!J(I),K0=!!Z(n),z0,S,U0,k,u;function Q0(E){let q0=k;if(k=null,q0)q0(E);else if(E)u.destroy(E)}if(u=new O({readableObjectMode:!!(I!==null&&I!==void 0&&I.readableObjectMode),writableObjectMode:!!(n!==null&&n!==void 0&&n.writableObjectMode),readable:i,writable:K0}),K0)M(n,(E)=>{if(K0=!1,E)D(I,E);Q0(E)}),u._write=function(E,q0,B0){if(n.write(E,q0))B0();else z0=B0},u._final=function(E){n.end(),S=E},n.on("drain",function(){if(z0){let E=z0;z0=null,E()}}),n.on("finish",function(){if(S){let E=S;S=null,E()}});if(i)M(I,(E)=>{if(i=!1,E)D(I,E);Q0(E)}),I.on("readable",function(){if(U0){let E=U0;U0=null,E()}}),I.on("end",function(){u.push(null)}),u._read=function(){while(!0){let E=I.read();if(E===null){U0=u._read;return}if(!u.push(E))return}};return u._destroy=function(E,q0){if(!E&&k!==null)E=new v;if(U0=null,z0=null,S=null,k===null)q0(E);else k=q0,D(n,E),D(I,E)},u}}),U2=R0((Q,$)=>{var{ObjectDefineProperties:q,ObjectGetOwnPropertyDescriptor:K,ObjectKeys:J,ObjectSetPrototypeOf:Z}=b0();$.exports=W;var G=c5(),B=e7();Z(W.prototype,G.prototype),Z(W,G);{let F=J(B.prototype);for(let M=0;M{var{ObjectSetPrototypeOf:q,Symbol:K}=b0();$.exports=W;var{ERR_METHOD_NOT_IMPLEMENTED:J}=V1().codes,Z=U2(),{getHighWaterMark:G}=_5();q(W.prototype,Z.prototype),q(W,Z);var B=K("kCallback");function W(N){if(!(this instanceof W))return new W(N);let F=N?G(this,N,"readableHighWaterMark",!0):null;if(F===0)N={...N,highWaterMark:null,readableHighWaterMark:F,writableHighWaterMark:N.writableHighWaterMark||0};if(Z.call(this,N),this._readableState.sync=!1,this[B]=null,N){if(typeof N.transform==="function")this._transform=N.transform;if(typeof N.flush==="function")this._flush=N.flush}this.on("prefinish",V)}function U(N){if(typeof this._flush==="function"&&!this.destroyed)this._flush((F,M)=>{if(F){if(N)N(F);else this.destroy(F);return}if(M!=null)this.push(M);if(this.push(null),N)N()});else if(this.push(null),N)N()}function V(){if(this._final!==U)U.call(this)}W.prototype._final=U,W.prototype._transform=function(N,F,M){throw new J("_transform()")},W.prototype._write=function(N,F,M){let v=this._readableState,x=this._writableState,y=v.length;this._transform(N,F,(D,z)=>{if(D){M(D);return}if(z!=null)this.push(z);if(x.ended||y===v.length||v.length{var{ObjectSetPrototypeOf:q}=b0();$.exports=J;var K=BJ();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,B){B(null,Z)}}),Q9=R0((Q,$)=>{var q=e2(),{ArrayIsArray:K,Promise:J,SymbolAsyncIterator:Z,SymbolDispose:G}=b0(),B=R2(),{once:W}=W1(),U=O6(),V=U2(),{aggregateTwoErrors:N,codes:{ERR_INVALID_ARG_TYPE:F,ERR_INVALID_RETURN_VALUE:M,ERR_MISSING_ARGS:v,ERR_STREAM_DESTROYED:x,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:D}=V1(),{validateFunction:z,validateAbortSignal:Y}=X8(),{isIterable:H,isReadable:R,isReadableNodeStream:c,isNodeStream:m,isTransformStream:$0,isWebStream:_,isReadableStream:g,isReadableFinished:O}=V2(),h=globalThis.AbortController||g8().AbortController,f,A,I;function n(E,q0,B0){let w0=!1;E.on("close",()=>{w0=!0});let M0=B(E,{readable:q0,writable:B0},(b)=>{w0=!b});return{destroy:(b)=>{if(w0)return;w0=!0,U.destroyer(E,b||new x("pipe"))},cleanup:M0}}function i(E){return z(E[E.length-1],"streams[stream.length - 1]"),E.pop()}function K0(E){if(H(E))return E;else if(c(E))return z0(E);throw new F("val",["Readable","Iterable","AsyncIterable"],E)}async function*z0(E){if(!A)A=c5();yield*A.prototype[Z].call(E)}async function S(E,q0,B0,{end:w0}){let M0,b=null,T=(W0)=>{if(W0)M0=W0;if(b){let C=b;b=null,C()}},t=()=>new J((W0,C)=>{if(M0)C(M0);else b=()=>{if(M0)C(M0);else W0()}});q0.on("drain",T);let Z0=B(q0,{readable:!1},T);try{if(q0.writableNeedDrain)await t();for await(let W0 of E)if(!q0.write(W0))await t();if(w0)q0.end(),await t();B0()}catch(W0){B0(M0!==W0?N(M0,W0):W0)}finally{Z0(),q0.off("drain",T)}}async function U0(E,q0,B0,{end:w0}){if($0(q0))q0=q0.writable;let M0=q0.getWriter();try{for await(let b of E)await M0.ready,M0.write(b).catch(()=>{});if(await M0.ready,w0)await M0.close();B0()}catch(b){try{await M0.abort(b),B0(b)}catch(T){B0(T)}}}function k(...E){return u(E,W(i(E)))}function u(E,q0,B0){if(E.length===1&&K(E[0]))E=E[0];if(E.length<2)throw new v("streams");let w0=new h,M0=w0.signal,b=B0===null||B0===void 0?void 0:B0.signal,T=[];Y(b,"options.signal");function t(){r(new D)}I=I||W1().addAbortListener;let Z0;if(b)Z0=I(b,t);let W0,C,X=[],P=0;function o(p){r(p,--P===0)}function r(p,G0){var P0;if(p&&(!W0||W0.code==="ERR_STREAM_PREMATURE_CLOSE"))W0=p;if(!W0&&!G0)return;while(X.length)X.shift()(W0);if((P0=Z0)===null||P0===void 0||P0[G](),w0.abort(),G0){if(!W0)T.forEach((k0)=>k0());q.nextTick(q0,W0,C)}}let l;for(let p=0;p0,I0=P0||(B0===null||B0===void 0?void 0:B0.end)!==!1,Q1=p===E.length-1;if(m(G0)){let A0=function(O0){if(O0&&O0.name!=="AbortError"&&O0.code!=="ERR_STREAM_PREMATURE_CLOSE")o(O0)};var j=A0;if(I0){let{destroy:O0,cleanup:F1}=n(G0,P0,k0);if(X.push(O0),R(G0)&&Q1)T.push(F1)}if(G0.on("error",A0),R(G0)&&Q1)T.push(()=>{G0.removeListener("error",A0)})}if(p===0)if(typeof G0==="function"){if(l=G0({signal:M0}),!H(l))throw new M("Iterable, AsyncIterable or Stream","source",l)}else if(H(G0)||c(G0)||$0(G0))l=G0;else l=V.from(G0);else if(typeof G0==="function"){if($0(l)){var d;l=K0((d=l)===null||d===void 0?void 0:d.readable)}else l=K0(l);if(l=G0(l,{signal:M0}),P0){if(!H(l,!0))throw new M("AsyncIterable",`transform[${p-1}]`,l)}else{var e;if(!f)f=WJ();let A0=new f({objectMode:!0}),O0=(e=l)===null||e===void 0?void 0:e.then;if(typeof O0==="function")P++,O0.call(l,(d0)=>{if(C=d0,d0!=null)A0.write(d0);if(I0)A0.end();q.nextTick(o)},(d0)=>{A0.destroy(d0),q.nextTick(o,d0)});else if(H(l,!0))P++,S(l,A0,o,{end:I0});else if(g(l)||$0(l)){let d0=l.readable||l;P++,S(d0,A0,o,{end:I0})}else throw new M("AsyncIterable or Promise","destination",l);l=A0;let{destroy:F1,cleanup:M1}=n(l,!1,!0);if(X.push(F1),Q1)T.push(M1)}}else if(m(G0)){if(c(l)){P+=2;let A0=Q0(l,G0,o,{end:I0});if(R(G0)&&Q1)T.push(A0)}else if($0(l)||g(l)){let A0=l.readable||l;P++,S(A0,G0,o,{end:I0})}else if(H(l))P++,S(l,G0,o,{end:I0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],l);l=G0}else if(_(G0)){if(c(l))P++,U0(K0(l),G0,o,{end:I0});else if(g(l)||H(l))P++,U0(l,G0,o,{end:I0});else if($0(l))P++,U0(l.readable,G0,o,{end:I0});else throw new F("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],l);l=G0}else l=V.from(G0)}if(M0!==null&&M0!==void 0&&M0.aborted||b!==null&&b!==void 0&&b.aborted)q.nextTick(t);return l}function Q0(E,q0,B0,{end:w0}){let M0=!1;if(q0.on("close",()=>{if(!M0)B0(new y)}),E.pipe(q0,{end:!1}),w0){let T=function(){M0=!0,q0.end()};var b=T;if(O(E))q.nextTick(T);else E.once("end",T)}else B0();return B(E,{readable:!0,writable:!1},(T)=>{let t=E._readableState;if(T&&T.code==="ERR_STREAM_PREMATURE_CLOSE"&&t&&t.ended&&!t.errored&&!t.errorEmitted)E.once("end",B0).once("error",B0);else B0(T)}),B(q0,{readable:!1,writable:!0},B0)}$.exports={pipelineImpl:u,pipeline:k}}),zJ=R0((Q,$)=>{var{pipeline:q}=Q9(),K=U2(),{destroyer:J}=O6(),{isNodeStream:Z,isReadable:G,isWritable:B,isWebStream:W,isTransformStream:U,isWritableStream:V,isReadableStream:N}=V2(),{AbortError:F,codes:{ERR_INVALID_ARG_VALUE:M,ERR_MISSING_ARGS:v}}=V1(),x=R2();$.exports=function y(...D){if(D.length===0)throw new v("streams");if(D.length===1)return K.from(D[0]);let z=[...D];if(typeof D[0]==="function")D[0]=K.from(D[0]);if(typeof D[D.length-1]==="function"){let f=D.length-1;D[f]=K.from(D[f])}for(let f=0;f0&&!(B(D[f])||V(D[f])||U(D[f])))throw new M(`streams[${f}]`,z[f],"must be writable")}let Y,H,R,c,m;function $0(f){let A=c;if(c=null,A)A(f);else if(f)m.destroy(f);else if(!h&&!O)m.destroy()}let _=D[0],g=q(D,$0),O=!!(B(_)||V(_)||U(_)),h=!!(G(g)||N(g)||U(g));if(m=new K({writableObjectMode:!!(_!==null&&_!==void 0&&_.writableObjectMode),readableObjectMode:!!(g!==null&&g!==void 0&&g.readableObjectMode),writable:O,readable:h}),O){if(Z(_))m._write=function(A,I,n){if(_.write(A,I))n();else Y=n},m._final=function(A){_.end(),H=A},_.on("drain",function(){if(Y){let A=Y;Y=null,A()}});else if(W(_)){let A=(U(_)?_.writable:_).getWriter();m._write=async function(I,n,i){try{await A.ready,A.write(I).catch(()=>{}),i()}catch(K0){i(K0)}},m._final=async function(I){try{await A.ready,A.close().catch(()=>{}),H=I}catch(n){I(n)}}}let f=U(g)?g.readable:g;x(f,()=>{if(H){let A=H;H=null,A()}})}if(h){if(Z(g))g.on("readable",function(){if(R){let f=R;R=null,f()}}),g.on("end",function(){m.push(null)}),m._read=function(){while(!0){let f=g.read();if(f===null){R=m._read;return}if(!m.push(f))return}};else if(W(g)){let f=(U(g)?g.readable:g).getReader();m._read=async function(){while(!0)try{let{value:A,done:I}=await f.read();if(!m.push(A))return;if(I){m.push(null);return}}catch{return}}}}return m._destroy=function(f,A){if(!f&&c!==null)f=new F;if(R=null,Y=null,H=null,c===null)A(f);else if(c=A,Z(g))J(g,f)},m}}),FW=R0((Q,$)=>{var q=globalThis.AbortController||g8().AbortController,{codes:{ERR_INVALID_ARG_VALUE:K,ERR_INVALID_ARG_TYPE:J,ERR_MISSING_ARGS:Z,ERR_OUT_OF_RANGE:G},AbortError:B}=V1(),{validateAbortSignal:W,validateInteger:U,validateObject:V}=X8(),N=b0().Symbol("kWeak"),F=b0().Symbol("kResistStopPropagation"),{finished:M}=R2(),v=zJ(),{addAbortSignalNoValidate:x}=u5(),{isWritable:y,isNodeStream:D}=V2(),{deprecate:z}=W1(),{ArrayPrototypePush:Y,Boolean:H,MathFloor:R,Number:c,NumberIsNaN:m,Promise:$0,PromiseReject:_,PromiseResolve:g,PromisePrototypeThen:O,Symbol:h}=b0(),f=h("kEmpty"),A=h("kEof");function I(b,T){if(T!=null)V(T,"options");if((T===null||T===void 0?void 0:T.signal)!=null)W(T.signal,"options.signal");if(D(b)&&!y(b))throw new K("stream",b,"must be writable");let t=v(this,b);if(T!==null&&T!==void 0&&T.signal)x(T.signal,t);return t}function n(b,T){if(typeof b!=="function")throw new J("fn",["Function","AsyncFunction"],b);if(T!=null)V(T,"options");if((T===null||T===void 0?void 0:T.signal)!=null)W(T.signal,"options.signal");let t=1;if((T===null||T===void 0?void 0:T.concurrency)!=null)t=R(T.concurrency);let Z0=t-1;if((T===null||T===void 0?void 0:T.highWaterMark)!=null)Z0=R(T.highWaterMark);return U(t,"options.concurrency",1),U(Z0,"options.highWaterMark",0),Z0+=t,async function*W0(){let C=W1().AbortSignalAny([T===null||T===void 0?void 0:T.signal].filter(H)),X=this,P=[],o={signal:C},r,l,j=!1,d=0;function e(){j=!0,p()}function p(){d-=1,G0()}function G0(){if(l&&!j&&d=Z0||d>=t))await new $0((I0)=>{l=I0})}P.push(A)}catch(k0){let I0=_(k0);O(I0,p,e),P.push(I0)}finally{if(j=!0,r)r(),r=null}}P0();try{while(!0){while(P.length>0){let k0=await P[0];if(k0===A)return;if(C.aborted)throw new B;if(k0!==f)yield k0;P.shift(),G0()}await new $0((k0)=>{r=k0})}}finally{if(j=!0,l)l(),l=null}}.call(this)}function i(b=void 0){if(b!=null)V(b,"options");if((b===null||b===void 0?void 0:b.signal)!=null)W(b.signal,"options.signal");return async function*T(){let t=0;for await(let W0 of this){var Z0;if(b!==null&&b!==void 0&&(Z0=b.signal)!==null&&Z0!==void 0&&Z0.aborted)throw new B({cause:b.signal.reason});yield[t++,W0]}}.call(this)}async function K0(b,T=void 0){for await(let t of k.call(this,b,T))return!0;return!1}async function z0(b,T=void 0){if(typeof b!=="function")throw new J("fn",["Function","AsyncFunction"],b);return!await K0.call(this,async(...t)=>{return!await b(...t)},T)}async function S(b,T){for await(let t of k.call(this,b,T))return t;return}async function U0(b,T){if(typeof b!=="function")throw new J("fn",["Function","AsyncFunction"],b);async function t(Z0,W0){return await b(Z0,W0),f}for await(let Z0 of n.call(this,t,T));}function k(b,T){if(typeof b!=="function")throw new J("fn",["Function","AsyncFunction"],b);async function t(Z0,W0){if(await b(Z0,W0))return Z0;return f}return n.call(this,t,T)}class u extends Z{constructor(){super("reduce");this.message="Reduce of an empty stream requires an initial value"}}async function Q0(b,T,t){var Z0;if(typeof b!=="function")throw new J("reducer",["Function","AsyncFunction"],b);if(t!=null)V(t,"options");if((t===null||t===void 0?void 0:t.signal)!=null)W(t.signal,"options.signal");let W0=arguments.length>1;if(t!==null&&t!==void 0&&(Z0=t.signal)!==null&&Z0!==void 0&&Z0.aborted){let r=new B(void 0,{cause:t.signal.reason});throw this.once("error",()=>{}),await M(this.destroy(r)),r}let C=new q,X=C.signal;if(t!==null&&t!==void 0&&t.signal){let r={once:!0,[N]:this,[F]:!0};t.signal.addEventListener("abort",()=>C.abort(),r)}let P=!1;try{for await(let r of this){var o;if(P=!0,t!==null&&t!==void 0&&(o=t.signal)!==null&&o!==void 0&&o.aborted)throw new B;if(!W0)T=r,W0=!0;else T=await b(T,r,{signal:X})}if(!P&&!W0)throw new u}finally{C.abort()}return T}async function E(b){if(b!=null)V(b,"options");if((b===null||b===void 0?void 0:b.signal)!=null)W(b.signal,"options.signal");let T=[];for await(let Z0 of this){var t;if(b!==null&&b!==void 0&&(t=b.signal)!==null&&t!==void 0&&t.aborted)throw new B(void 0,{cause:b.signal.reason});Y(T,Z0)}return T}function q0(b,T){let t=n.call(this,b,T);return async function*Z0(){for await(let W0 of t)yield*W0}.call(this)}function B0(b){if(b=c(b),m(b))return 0;if(b<0)throw new G("number",">= 0",b);return b}function w0(b,T=void 0){if(T!=null)V(T,"options");if((T===null||T===void 0?void 0:T.signal)!=null)W(T.signal,"options.signal");return b=B0(b),async function*t(){var Z0;if(T!==null&&T!==void 0&&(Z0=T.signal)!==null&&Z0!==void 0&&Z0.aborted)throw new B;for await(let C of this){var W0;if(T!==null&&T!==void 0&&(W0=T.signal)!==null&&W0!==void 0&&W0.aborted)throw new B;if(b--<=0)yield C}}.call(this)}function M0(b,T=void 0){if(T!=null)V(T,"options");if((T===null||T===void 0?void 0:T.signal)!=null)W(T.signal,"options.signal");return b=B0(b),async function*t(){var Z0;if(T!==null&&T!==void 0&&(Z0=T.signal)!==null&&Z0!==void 0&&Z0.aborted)throw new B;for await(let C of this){var W0;if(T!==null&&T!==void 0&&(W0=T.signal)!==null&&W0!==void 0&&W0.aborted)throw new B;if(b-- >0)yield C;if(b<=0)return}}.call(this)}Q.streamReturningOperators={asIndexedPairs:z(i,"readable.asIndexedPairs will be removed in a future version."),drop:w0,filter:k,flatMap:q0,map:n,take:M0,compose:I},Q.promiseReturningOperators={every:z0,forEach:U0,reduce:Q0,toArray:E,some:K0,find:S}}),FJ=R0((Q,$)=>{var{ArrayPrototypePop:q,Promise:K}=b0(),{isIterable:J,isNodeStream:Z,isWebStream:G}=V2(),{pipelineImpl:B}=Q9(),{finished:W}=R2();MJ();function U(...V){return new K((N,F)=>{let M,v,x=V[V.length-1];if(x&&typeof x==="object"&&!Z(x)&&!J(x)&&!G(x)){let y=q(V);M=y.signal,v=y.end}B(V,(y,D)=>{if(y)F(y);else N(D)},{signal:M,end:v})})}$.exports={finished:W,pipeline:U}}),MJ=R0((Q,$)=>{var{Buffer:q}=(a0(),y0(s0)),{ObjectDefineProperty:K,ObjectKeys:J,ReflectApply:Z}=b0(),{promisify:{custom:G}}=W1(),{streamReturningOperators:B,promiseReturningOperators:W}=FW(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:U}}=V1(),V=zJ(),{setDefaultHighWaterMark:N,getDefaultHighWaterMark:F}=_5(),{pipeline:M}=Q9(),{destroyer:v}=O6(),x=R2(),y=FJ(),D=V2(),z=$.exports=t7().Stream;z.isDestroyed=D.isDestroyed,z.isDisturbed=D.isDisturbed,z.isErrored=D.isErrored,z.isReadable=D.isReadable,z.isWritable=D.isWritable,z.Readable=c5();for(let H of J(B)){let R=function(...m){if(new.target)throw U();return z.Readable.from(Z(c,this,m))},c=B[H];K(R,"name",{__proto__:null,value:c.name}),K(R,"length",{__proto__:null,value:c.length}),K(z.Readable.prototype,H,{__proto__:null,value:R,enumerable:!1,configurable:!0,writable:!0})}for(let H of J(W)){let R=function(...m){if(new.target)throw U();return Z(c,this,m)},c=W[H];K(R,"name",{__proto__:null,value:c.name}),K(R,"length",{__proto__:null,value:c.length}),K(z.Readable.prototype,H,{__proto__:null,value:R,enumerable:!1,configurable:!0,writable:!0})}z.Writable=e7(),z.Duplex=U2(),z.Transform=BJ(),z.PassThrough=WJ(),z.pipeline=M;var{addAbortSignal:Y}=u5();z.addAbortSignal=Y,z.finished=x,z.destroy=v,z.compose=V,z.setDefaultHighWaterMark=N,z.getDefaultHighWaterMark=F,K(z,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return y}}),K(M,G,{__proto__:null,enumerable:!0,get(){return y.pipeline}}),K(x,G,{__proto__:null,enumerable:!0,get(){return y.finished}}),z.Stream=z,z._isUint8Array=function H(R){return R instanceof Uint8Array},z._uint8ArrayToBuffer=function H(R){return q.from(R.buffer,R.byteOffset,R.byteLength)}}),wJ=R0((Q,$)=>{var q=p8();if(q&&process.env.READABLE_STREAM==="disable"){let K=q.promises;$.exports._uint8ArrayToBuffer=q._uint8ArrayToBuffer,$.exports._isUint8Array=q._isUint8Array,$.exports.isDisturbed=q.isDisturbed,$.exports.isErrored=q.isErrored,$.exports.isReadable=q.isReadable,$.exports.Readable=q.Readable,$.exports.Writable=q.Writable,$.exports.Duplex=q.Duplex,$.exports.Transform=q.Transform,$.exports.PassThrough=q.PassThrough,$.exports.addAbortSignal=q.addAbortSignal,$.exports.finished=q.finished,$.exports.destroy=q.destroy,$.exports.pipeline=q.pipeline,$.exports.compose=q.compose,Object.defineProperty(q,"promises",{configurable:!0,enumerable:!0,get(){return K}}),$.exports.Stream=q.Stream}else{let K=MJ(),J=FJ(),Z=K.Readable.destroy;$.exports=K.Readable,$.exports._uint8ArrayToBuffer=K._uint8ArrayToBuffer,$.exports._isUint8Array=K._isUint8Array,$.exports.isDisturbed=K.isDisturbed,$.exports.isErrored=K.isErrored,$.exports.isReadable=K.isReadable,$.exports.Readable=K.Readable,$.exports.Writable=K.Writable,$.exports.Duplex=K.Duplex,$.exports.Transform=K.Transform,$.exports.PassThrough=K.PassThrough,$.exports.addAbortSignal=K.addAbortSignal,$.exports.finished=K.finished,$.exports.destroy=K.destroy,$.exports.destroy=Z,$.exports.pipeline=K.pipeline,$.exports.compose=K.compose,Object.defineProperty(K,"promises",{configurable:!0,enumerable:!0,get(){return J}}),$.exports.Stream=K.Stream}$.exports.default=$.exports}),NJ=R0((Q)=>{var $=UJ(),q=VJ(),K=wJ(),J=Q.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Z=Q.IncomingMessage=function(G,B,W,U){var V=this;if(K.Readable.call(V),V._mode=W,V.headers={},V.rawHeaders=[],V.trailers={},V.rawTrailers=[],V.on("end",function(){process.nextTick(function(){V.emit("close")})}),W==="fetch"){let D=function(){M.read().then(function(z){if(V._destroyed)return;if(U(z.done),z.done){V.push(null);return}V.push(Buffer.from(z.value)),D()}).catch(function(z){if(U(!0),!V._destroyed)V.emit("error",z)})};var N=D;if(V._fetchResponse=B,V.url=B.url,V.statusCode=B.status,V.statusMessage=B.statusText,B.headers.forEach(function(z,Y){V.headers[Y.toLowerCase()]=z,V.rawHeaders.push(Y,z)}),$.writableStream){var F=new WritableStream({write:function(z){return U(!1),new Promise(function(Y,H){if(V._destroyed)H();else if(V.push(Buffer.from(z)))Y();else V._resumeFetch=Y})},close:function(){if(U(!0),!V._destroyed)V.push(null)},abort:function(z){if(U(!0),!V._destroyed)V.emit("error",z)}});try{B.body.pipeTo(F).catch(function(z){if(U(!0),!V._destroyed)V.emit("error",z)});return}catch(z){}}var M=B.body.getReader();D()}else{V._xhr=G,V._pos=0,V.url=G.responseURL,V.statusCode=G.status,V.statusMessage=G.statusText;var v=G.getAllResponseHeaders().split(/\r?\n/);if(v.forEach(function(D){var z=D.match(/^([^:]+):\s*(.*)/);if(z){var Y=z[1].toLowerCase();if(Y==="set-cookie"){if(V.headers[Y]===void 0)V.headers[Y]=[];V.headers[Y].push(z[2])}else if(V.headers[Y]!==void 0)V.headers[Y]+=", "+z[2];else V.headers[Y]=z[2];V.rawHeaders.push(z[1],z[2])}}),V._charset="x-user-defined",!$.overrideMimeType){var x=V.rawHeaders["mime-type"];if(x){var y=x.match(/;\s*charset=([^;])(;|$)/);if(y)V._charset=y[1].toLowerCase()}if(!V._charset)V._charset="utf-8"}}};q(Z,K.Readable),Z.prototype._read=function(){var G=this,B=G._resumeFetch;if(B)G._resumeFetch=null,B()},Z.prototype._onXHRProgress=function(G){var B=this,W=B._xhr,U=null;switch(B._mode){case"text":if(U=W.responseText,U.length>B._pos){var V=U.substr(B._pos);if(B._charset==="x-user-defined"){var N=Buffer.alloc(V.length);for(var F=0;FB._pos)B.push(Buffer.from(new Uint8Array(M.result.slice(B._pos)))),B._pos=M.result.byteLength},M.onload=function(){G(!0),B.push(null)},M.readAsArrayBuffer(U);break}if(B._xhr.readyState===J.DONE&&B._mode!=="ms-stream")G(!0),B.push(null)}}),MW=R0((Q,$)=>{var q=UJ(),K=VJ(),J=NJ(),Z=wJ(),G=J.IncomingMessage,B=J.readyStates;function W(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 U=$.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(y){M.setHeader(y,F.headers[y])});var v,x=!0;if(F.mode==="disable-fetch"||"requestTimeout"in F&&!q.abortController)x=!1,v=!0;else if(F.mode==="prefer-streaming")v=!1;else if(F.mode==="allow-wrong-content-type")v=!q.overrideMimeType;else if(!F.mode||F.mode==="default"||F.mode==="prefer-fast")v=!0;else throw new Error("Invalid value for opts.mode");M._mode=W(v,x),M._fetchTimer=null,M._socketTimeout=null,M._socketTimer=null,M.on("finish",function(){M._onFinish()})};K(U,Z.Writable),U.prototype.setHeader=function(F,M){var v=this,x=F.toLowerCase();if(N.indexOf(x)!==-1)return;v._headers[x]={name:F,value:M}},U.prototype.getHeader=function(F){var M=this._headers[F.toLowerCase()];if(M)return M.value;return null},U.prototype.removeHeader=function(F){var M=this;delete M._headers[F.toLowerCase()]},U.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 v=F._headers,x=null;if(M.method!=="GET"&&M.method!=="HEAD")x=new Blob(F._body,{type:(v["content-type"]||{}).value||""});var y=[];if(Object.keys(v).forEach(function(H){var R=v[H].name,c=v[H].value;if(Array.isArray(c))c.forEach(function(m){y.push([R,m])});else y.push([R,c])}),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=global.setTimeout(function(){if(F.emit("requestTimeout"),F._fetchAbortController)F._fetchAbortController.abort()},M.requestTimeout)}global.fetch(F._opts.url,{method:F._opts.method,headers:y,body:x||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 Y=F._xhr=new global.XMLHttpRequest;try{Y.open(F._opts.method,F._opts.url,!0)}catch(H){process.nextTick(function(){F.emit("error",H)});return}if("responseType"in Y)Y.responseType=F._mode;if("withCredentials"in Y)Y.withCredentials=!!M.withCredentials;if(F._mode==="text"&&"overrideMimeType"in Y)Y.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in M)Y.timeout=M.requestTimeout,Y.ontimeout=function(){F.emit("requestTimeout")};if(y.forEach(function(H){Y.setRequestHeader(H[0],H[1])}),F._response=null,Y.onreadystatechange=function(){switch(Y.readyState){case B.LOADING:case B.DONE:F._onXHRProgress();break}},F._mode==="moz-chunked-arraybuffer")Y.onprogress=function(){F._onXHRProgress()};Y.onerror=function(){if(F._destroyed)return;F._resetTimers(!0),F.emit("error",new Error("XHR error"))};try{Y.send(x)}catch(H){process.nextTick(function(){F.emit("error",H)});return}}};function V(F){try{var M=F.status;return M!==null&&M!==0}catch(v){return!1}}U.prototype._onXHRProgress=function(){var F=this;if(F._resetTimers(!1),!V(F._xhr)||F._destroyed)return;if(!F._response)F._connect();F._response._onXHRProgress(F._resetTimers.bind(F))},U.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)},U.prototype._write=function(F,M,v){var x=this;x._body.push(F),v()},U.prototype._resetTimers=function(F){var M=this;if(global.clearTimeout(M._socketTimer),M._socketTimer=null,F)global.clearTimeout(M._fetchTimer),M._fetchTimer=null;else if(M._socketTimeout)M._socketTimer=global.setTimeout(function(){M.emit("timeout")},M._socketTimeout)},U.prototype.abort=U.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)},U.prototype.end=function(F,M,v){var x=this;if(typeof F==="function")v=F,F=void 0;Z.Writable.prototype.end.call(x,F,M,v)},U.prototype.setTimeout=function(F,M){var v=this;if(M)v.once("timeout",M);v._socketTimeout=F,v._resetTimers(!1)},U.prototype.flushHeaders=function(){},U.prototype.setNoDelay=function(){},U.prototype.setSocketKeepAlive=function(){};var N=["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"]}),wW=R0((Q,$)=>{$.exports=K;var q=Object.prototype.hasOwnProperty;function K(){var J={};for(var Z=0;Z{$.exports=($9(),y0(q9)).STATUS_CODES}),YW=R0((Q)=>{var $=MW(),q=NJ(),K=wW(),J=NW(),Z=(s7(),y0(r7)),G=Q;G.request=function(B,W){if(typeof B==="string")B=Z.parse(B);else B=K(B);var U=global.location.protocol.search(/^https?:$/)===-1?"http:":"",V=B.protocol||U,N=B.hostname||B.host,F=B.port,M=B.path||"/";if(N&&N.indexOf(":")!==-1)N="["+N+"]";B.url=(N?V+"//"+N:"")+(F?":"+F:"")+M,B.method=(B.method||"GET").toUpperCase(),B.headers=B.headers||{};var v=new $(B);if(W)v.on("response",W);return v},G.get=function B(W,U){var V=G.request(W,U);return V.end(),V},G.ClientRequest=$,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"]}),LW=UW(YW(),1),{request:DW,get:HW,ClientRequest:kW,IncomingMessage:vW,Agent:IW,globalAgent:RW,STATUS_CODES:CW,METHODS:jW}=LW.default});var LJ={};h2(LJ,{validateHeaderValue:()=>aW,validateHeaderName:()=>oW,setMaxIdleHTTPParsers:()=>lW,request:()=>iW,maxHeaderSize:()=>pW,globalAgent:()=>nW,get:()=>mW,createServer:()=>dW,ServerResponse:()=>bW,Server:()=>cW,STATUS_CODES:()=>_W,OutgoingMessage:()=>uW,METHODS:()=>SW,IncomingMessage:()=>EW,ClientRequest:()=>TW,Agent:()=>PW});var fW,AW,YJ,gW,XW,yW=(Q,$,q)=>{q=Q!=null?fW(AW(Q)):{};let K=$||!Q||!Q.__esModule?YJ(q,"default",{value:Q,enumerable:!0}):q;for(let J of gW(Q))if(!XW.call(K,J))YJ(K,J,{get:()=>Q[J],enumerable:!0});return K},hW=(Q,$)=>()=>($||Q(($={exports:{}}).exports,$),$.exports),xW,OW,PW,TW,EW,SW,uW,_W,cW,bW,dW,mW,nW,pW,iW,lW,oW,aW;var DJ=x2(()=>{fW=Object.create,{getPrototypeOf:AW,defineProperty:YJ,getOwnPropertyNames:gW}=Object,XW=Object.prototype.hasOwnProperty,xW=hW((Q,$)=>{var q=($9(),y0(q9)),K=(s7(),y0(r7)),J=Q;for(Z in q)if(q.hasOwnProperty(Z))J[Z]=q[Z];var Z;J.request=function(B,W){return B=G(B),q.request.call(this,B,W)},J.get=function(B,W){return B=G(B),q.get.call(this,B,W)};function G(B){if(typeof B==="string")B=K.parse(B);if(!B.protocol)B.protocol="https:";if(B.protocol!=="https:")throw new Error('Protocol "'+B.protocol+'" not supported. Expected "https:"');return B}}),OW=yW(xW(),1),{Agent:PW,ClientRequest:TW,IncomingMessage:EW,METHODS:SW,OutgoingMessage:uW,STATUS_CODES:_W,Server:cW,ServerResponse:bW,createServer:dW,get:mW,globalAgent:nW,maxHeaderSize:pW,request:iW,setMaxIdleHTTPParsers:lW,validateHeaderName:oW,validateHeaderValue:aW}=OW});var A9=globalThis;if(typeof A9.global==="undefined")A9.global=globalThis;a0();var bz=E8(t9());var L9=E8(dK());function H1(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 B(V){try{U(K.next(V))}catch(N){G(N)}}function W(V){try{U(K.throw(V))}catch(N){G(N)}}function U(V){V.done?Z(V.value):J(V.value).then(B,W)}U((K=K.apply(Q,$||[])).next())})}var H0=914400,T8=12700,r0=`\r -`,rW=2147483649,K9=/^[0-9a-fA-F]{6}$/,sW=1.67,tW=27,P6={type:"solid",color:"666666",pt:1},CJ=[0.05,0.1,0.05,0.1],T6={color:"363636",pt:1},$6={color:"888888",style:"solid",size:1,cap:"flat"},z1="000000",f1=12,eW=18,E6="LAYOUT_16x9",B9="DEFAULT",jJ="333333",Q6={type:"outer",blur:3,offset:1.811023622047244,angle:90,color:"000000",opacity:0.35,rotateWithShape:!0},P8=[0.5,0.5,0.5,0.5],HJ={color:"000000"},Qz={size:8,color:"FFFFFF",opacity:0.75},Z2="2094734552",d5="2094734553",h8="2094734554",W9="2094734555",fJ="2094734556",y8="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),x8=["C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360","C0504D","4F81BD","9BBB59","8064A2","4BACC6","F79646","628FC6","C86360"],qz=["5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7","5DA5DA","FAA43A","60BD68","F17CB0","B2912F","B276B2","DECF3F","F15854","A7A7A7"],S6;(function(Q){Q.left="left",Q.center="center",Q.right="right",Q.justify="justify"})(S6||(S6={}));var u6;(function(Q){Q.b="b",Q.ctr="ctr",Q.t="t"})(u6||(u6={}));var AJ="{F7021451-1387-4CA6-816F-3879F97B5CBC}",z9;(function(Q){Q.arraybuffer="arraybuffer",Q.base64="base64",Q.binarystring="binarystring",Q.blob="blob",Q.nodebuffer="nodebuffer",Q.uint8array="uint8array"})(z9||(z9={}));var F9;(function(Q){Q.area="area",Q.bar="bar",Q.bar3d="bar3D",Q.bubble="bubble",Q.bubble3d="bubble3D",Q.doughnut="doughnut",Q.line="line",Q.pie="pie",Q.radar="radar",Q.scatter="scatter"})(F9||(F9={}));var M9;(function(Q){Q.accentBorderCallout1="accentBorderCallout1",Q.accentBorderCallout2="accentBorderCallout2",Q.accentBorderCallout3="accentBorderCallout3",Q.accentCallout1="accentCallout1",Q.accentCallout2="accentCallout2",Q.accentCallout3="accentCallout3",Q.actionButtonBackPrevious="actionButtonBackPrevious",Q.actionButtonBeginning="actionButtonBeginning",Q.actionButtonBlank="actionButtonBlank",Q.actionButtonDocument="actionButtonDocument",Q.actionButtonEnd="actionButtonEnd",Q.actionButtonForwardNext="actionButtonForwardNext",Q.actionButtonHelp="actionButtonHelp",Q.actionButtonHome="actionButtonHome",Q.actionButtonInformation="actionButtonInformation",Q.actionButtonMovie="actionButtonMovie",Q.actionButtonReturn="actionButtonReturn",Q.actionButtonSound="actionButtonSound",Q.arc="arc",Q.bentArrow="bentArrow",Q.bentUpArrow="bentUpArrow",Q.bevel="bevel",Q.blockArc="blockArc",Q.borderCallout1="borderCallout1",Q.borderCallout2="borderCallout2",Q.borderCallout3="borderCallout3",Q.bracePair="bracePair",Q.bracketPair="bracketPair",Q.callout1="callout1",Q.callout2="callout2",Q.callout3="callout3",Q.can="can",Q.chartPlus="chartPlus",Q.chartStar="chartStar",Q.chartX="chartX",Q.chevron="chevron",Q.chord="chord",Q.circularArrow="circularArrow",Q.cloud="cloud",Q.cloudCallout="cloudCallout",Q.corner="corner",Q.cornerTabs="cornerTabs",Q.cube="cube",Q.curvedDownArrow="curvedDownArrow",Q.curvedLeftArrow="curvedLeftArrow",Q.curvedRightArrow="curvedRightArrow",Q.curvedUpArrow="curvedUpArrow",Q.custGeom="custGeom",Q.decagon="decagon",Q.diagStripe="diagStripe",Q.diamond="diamond",Q.dodecagon="dodecagon",Q.donut="donut",Q.doubleWave="doubleWave",Q.downArrow="downArrow",Q.downArrowCallout="downArrowCallout",Q.ellipse="ellipse",Q.ellipseRibbon="ellipseRibbon",Q.ellipseRibbon2="ellipseRibbon2",Q.flowChartAlternateProcess="flowChartAlternateProcess",Q.flowChartCollate="flowChartCollate",Q.flowChartConnector="flowChartConnector",Q.flowChartDecision="flowChartDecision",Q.flowChartDelay="flowChartDelay",Q.flowChartDisplay="flowChartDisplay",Q.flowChartDocument="flowChartDocument",Q.flowChartExtract="flowChartExtract",Q.flowChartInputOutput="flowChartInputOutput",Q.flowChartInternalStorage="flowChartInternalStorage",Q.flowChartMagneticDisk="flowChartMagneticDisk",Q.flowChartMagneticDrum="flowChartMagneticDrum",Q.flowChartMagneticTape="flowChartMagneticTape",Q.flowChartManualInput="flowChartManualInput",Q.flowChartManualOperation="flowChartManualOperation",Q.flowChartMerge="flowChartMerge",Q.flowChartMultidocument="flowChartMultidocument",Q.flowChartOfflineStorage="flowChartOfflineStorage",Q.flowChartOffpageConnector="flowChartOffpageConnector",Q.flowChartOnlineStorage="flowChartOnlineStorage",Q.flowChartOr="flowChartOr",Q.flowChartPredefinedProcess="flowChartPredefinedProcess",Q.flowChartPreparation="flowChartPreparation",Q.flowChartProcess="flowChartProcess",Q.flowChartPunchedCard="flowChartPunchedCard",Q.flowChartPunchedTape="flowChartPunchedTape",Q.flowChartSort="flowChartSort",Q.flowChartSummingJunction="flowChartSummingJunction",Q.flowChartTerminator="flowChartTerminator",Q.folderCorner="folderCorner",Q.frame="frame",Q.funnel="funnel",Q.gear6="gear6",Q.gear9="gear9",Q.halfFrame="halfFrame",Q.heart="heart",Q.heptagon="heptagon",Q.hexagon="hexagon",Q.homePlate="homePlate",Q.horizontalScroll="horizontalScroll",Q.irregularSeal1="irregularSeal1",Q.irregularSeal2="irregularSeal2",Q.leftArrow="leftArrow",Q.leftArrowCallout="leftArrowCallout",Q.leftBrace="leftBrace",Q.leftBracket="leftBracket",Q.leftCircularArrow="leftCircularArrow",Q.leftRightArrow="leftRightArrow",Q.leftRightArrowCallout="leftRightArrowCallout",Q.leftRightCircularArrow="leftRightCircularArrow",Q.leftRightRibbon="leftRightRibbon",Q.leftRightUpArrow="leftRightUpArrow",Q.leftUpArrow="leftUpArrow",Q.lightningBolt="lightningBolt",Q.line="line",Q.lineInv="lineInv",Q.mathDivide="mathDivide",Q.mathEqual="mathEqual",Q.mathMinus="mathMinus",Q.mathMultiply="mathMultiply",Q.mathNotEqual="mathNotEqual",Q.mathPlus="mathPlus",Q.moon="moon",Q.noSmoking="noSmoking",Q.nonIsoscelesTrapezoid="nonIsoscelesTrapezoid",Q.notchedRightArrow="notchedRightArrow",Q.octagon="octagon",Q.parallelogram="parallelogram",Q.pentagon="pentagon",Q.pie="pie",Q.pieWedge="pieWedge",Q.plaque="plaque",Q.plaqueTabs="plaqueTabs",Q.plus="plus",Q.quadArrow="quadArrow",Q.quadArrowCallout="quadArrowCallout",Q.rect="rect",Q.ribbon="ribbon",Q.ribbon2="ribbon2",Q.rightArrow="rightArrow",Q.rightArrowCallout="rightArrowCallout",Q.rightBrace="rightBrace",Q.rightBracket="rightBracket",Q.round1Rect="round1Rect",Q.round2DiagRect="round2DiagRect",Q.round2SameRect="round2SameRect",Q.roundRect="roundRect",Q.rtTriangle="rtTriangle",Q.smileyFace="smileyFace",Q.snip1Rect="snip1Rect",Q.snip2DiagRect="snip2DiagRect",Q.snip2SameRect="snip2SameRect",Q.snipRoundRect="snipRoundRect",Q.squareTabs="squareTabs",Q.star10="star10",Q.star12="star12",Q.star16="star16",Q.star24="star24",Q.star32="star32",Q.star4="star4",Q.star5="star5",Q.star6="star6",Q.star7="star7",Q.star8="star8",Q.stripedRightArrow="stripedRightArrow",Q.sun="sun",Q.swooshArrow="swooshArrow",Q.teardrop="teardrop",Q.trapezoid="trapezoid",Q.triangle="triangle",Q.upArrow="upArrow",Q.upArrowCallout="upArrowCallout",Q.upDownArrow="upDownArrow",Q.upDownArrowCallout="upDownArrowCallout",Q.uturnArrow="uturnArrow",Q.verticalScroll="verticalScroll",Q.wave="wave",Q.wedgeEllipseCallout="wedgeEllipseCallout",Q.wedgeRectCallout="wedgeRectCallout",Q.wedgeRoundRectCallout="wedgeRoundRectCallout"})(M9||(M9={}));var D1;(function(Q){Q.text1="tx1",Q.text2="tx2",Q.background1="bg1",Q.background2="bg2",Q.accent1="accent1",Q.accent2="accent2",Q.accent3="accent3",Q.accent4="accent4",Q.accent5="accent5",Q.accent6="accent6"})(D1||(D1={}));var w9;(function(Q){Q.left="left",Q.center="center",Q.right="right",Q.justify="justify"})(w9||(w9={}));var N9;(function(Q){Q.top="top",Q.middle="middle",Q.bottom="bottom"})(N9||(N9={}));var j2;(function(Q){Q.ACTION_BUTTON_BACK_OR_PREVIOUS="actionButtonBackPrevious",Q.ACTION_BUTTON_BEGINNING="actionButtonBeginning",Q.ACTION_BUTTON_CUSTOM="actionButtonBlank",Q.ACTION_BUTTON_DOCUMENT="actionButtonDocument",Q.ACTION_BUTTON_END="actionButtonEnd",Q.ACTION_BUTTON_FORWARD_OR_NEXT="actionButtonForwardNext",Q.ACTION_BUTTON_HELP="actionButtonHelp",Q.ACTION_BUTTON_HOME="actionButtonHome",Q.ACTION_BUTTON_INFORMATION="actionButtonInformation",Q.ACTION_BUTTON_MOVIE="actionButtonMovie",Q.ACTION_BUTTON_RETURN="actionButtonReturn",Q.ACTION_BUTTON_SOUND="actionButtonSound",Q.ARC="arc",Q.BALLOON="wedgeRoundRectCallout",Q.BENT_ARROW="bentArrow",Q.BENT_UP_ARROW="bentUpArrow",Q.BEVEL="bevel",Q.BLOCK_ARC="blockArc",Q.CAN="can",Q.CHART_PLUS="chartPlus",Q.CHART_STAR="chartStar",Q.CHART_X="chartX",Q.CHEVRON="chevron",Q.CHORD="chord",Q.CIRCULAR_ARROW="circularArrow",Q.CLOUD="cloud",Q.CLOUD_CALLOUT="cloudCallout",Q.CORNER="corner",Q.CORNER_TABS="cornerTabs",Q.CROSS="plus",Q.CUBE="cube",Q.CURVED_DOWN_ARROW="curvedDownArrow",Q.CURVED_DOWN_RIBBON="ellipseRibbon",Q.CURVED_LEFT_ARROW="curvedLeftArrow",Q.CURVED_RIGHT_ARROW="curvedRightArrow",Q.CURVED_UP_ARROW="curvedUpArrow",Q.CURVED_UP_RIBBON="ellipseRibbon2",Q.CUSTOM_GEOMETRY="custGeom",Q.DECAGON="decagon",Q.DIAGONAL_STRIPE="diagStripe",Q.DIAMOND="diamond",Q.DODECAGON="dodecagon",Q.DONUT="donut",Q.DOUBLE_BRACE="bracePair",Q.DOUBLE_BRACKET="bracketPair",Q.DOUBLE_WAVE="doubleWave",Q.DOWN_ARROW="downArrow",Q.DOWN_ARROW_CALLOUT="downArrowCallout",Q.DOWN_RIBBON="ribbon",Q.EXPLOSION1="irregularSeal1",Q.EXPLOSION2="irregularSeal2",Q.FLOWCHART_ALTERNATE_PROCESS="flowChartAlternateProcess",Q.FLOWCHART_CARD="flowChartPunchedCard",Q.FLOWCHART_COLLATE="flowChartCollate",Q.FLOWCHART_CONNECTOR="flowChartConnector",Q.FLOWCHART_DATA="flowChartInputOutput",Q.FLOWCHART_DECISION="flowChartDecision",Q.FLOWCHART_DELAY="flowChartDelay",Q.FLOWCHART_DIRECT_ACCESS_STORAGE="flowChartMagneticDrum",Q.FLOWCHART_DISPLAY="flowChartDisplay",Q.FLOWCHART_DOCUMENT="flowChartDocument",Q.FLOWCHART_EXTRACT="flowChartExtract",Q.FLOWCHART_INTERNAL_STORAGE="flowChartInternalStorage",Q.FLOWCHART_MAGNETIC_DISK="flowChartMagneticDisk",Q.FLOWCHART_MANUAL_INPUT="flowChartManualInput",Q.FLOWCHART_MANUAL_OPERATION="flowChartManualOperation",Q.FLOWCHART_MERGE="flowChartMerge",Q.FLOWCHART_MULTIDOCUMENT="flowChartMultidocument",Q.FLOWCHART_OFFLINE_STORAGE="flowChartOfflineStorage",Q.FLOWCHART_OFFPAGE_CONNECTOR="flowChartOffpageConnector",Q.FLOWCHART_OR="flowChartOr",Q.FLOWCHART_PREDEFINED_PROCESS="flowChartPredefinedProcess",Q.FLOWCHART_PREPARATION="flowChartPreparation",Q.FLOWCHART_PROCESS="flowChartProcess",Q.FLOWCHART_PUNCHED_TAPE="flowChartPunchedTape",Q.FLOWCHART_SEQUENTIAL_ACCESS_STORAGE="flowChartMagneticTape",Q.FLOWCHART_SORT="flowChartSort",Q.FLOWCHART_STORED_DATA="flowChartOnlineStorage",Q.FLOWCHART_SUMMING_JUNCTION="flowChartSummingJunction",Q.FLOWCHART_TERMINATOR="flowChartTerminator",Q.FOLDED_CORNER="folderCorner",Q.FRAME="frame",Q.FUNNEL="funnel",Q.GEAR_6="gear6",Q.GEAR_9="gear9",Q.HALF_FRAME="halfFrame",Q.HEART="heart",Q.HEPTAGON="heptagon",Q.HEXAGON="hexagon",Q.HORIZONTAL_SCROLL="horizontalScroll",Q.ISOSCELES_TRIANGLE="triangle",Q.LEFT_ARROW="leftArrow",Q.LEFT_ARROW_CALLOUT="leftArrowCallout",Q.LEFT_BRACE="leftBrace",Q.LEFT_BRACKET="leftBracket",Q.LEFT_CIRCULAR_ARROW="leftCircularArrow",Q.LEFT_RIGHT_ARROW="leftRightArrow",Q.LEFT_RIGHT_ARROW_CALLOUT="leftRightArrowCallout",Q.LEFT_RIGHT_CIRCULAR_ARROW="leftRightCircularArrow",Q.LEFT_RIGHT_RIBBON="leftRightRibbon",Q.LEFT_RIGHT_UP_ARROW="leftRightUpArrow",Q.LEFT_UP_ARROW="leftUpArrow",Q.LIGHTNING_BOLT="lightningBolt",Q.LINE_CALLOUT_1="borderCallout1",Q.LINE_CALLOUT_1_ACCENT_BAR="accentCallout1",Q.LINE_CALLOUT_1_BORDER_AND_ACCENT_BAR="accentBorderCallout1",Q.LINE_CALLOUT_1_NO_BORDER="callout1",Q.LINE_CALLOUT_2="borderCallout2",Q.LINE_CALLOUT_2_ACCENT_BAR="accentCallout2",Q.LINE_CALLOUT_2_BORDER_AND_ACCENT_BAR="accentBorderCallout2",Q.LINE_CALLOUT_2_NO_BORDER="callout2",Q.LINE_CALLOUT_3="borderCallout3",Q.LINE_CALLOUT_3_ACCENT_BAR="accentCallout3",Q.LINE_CALLOUT_3_BORDER_AND_ACCENT_BAR="accentBorderCallout3",Q.LINE_CALLOUT_3_NO_BORDER="callout3",Q.LINE_CALLOUT_4="borderCallout4",Q.LINE_CALLOUT_4_ACCENT_BAR="accentCallout3=4",Q.LINE_CALLOUT_4_BORDER_AND_ACCENT_BAR="accentBorderCallout4",Q.LINE_CALLOUT_4_NO_BORDER="callout4",Q.LINE="line",Q.LINE_INVERSE="lineInv",Q.MATH_DIVIDE="mathDivide",Q.MATH_EQUAL="mathEqual",Q.MATH_MINUS="mathMinus",Q.MATH_MULTIPLY="mathMultiply",Q.MATH_NOT_EQUAL="mathNotEqual",Q.MATH_PLUS="mathPlus",Q.MOON="moon",Q.NON_ISOSCELES_TRAPEZOID="nonIsoscelesTrapezoid",Q.NOTCHED_RIGHT_ARROW="notchedRightArrow",Q.NO_SYMBOL="noSmoking",Q.OCTAGON="octagon",Q.OVAL="ellipse",Q.OVAL_CALLOUT="wedgeEllipseCallout",Q.PARALLELOGRAM="parallelogram",Q.PENTAGON="homePlate",Q.PIE="pie",Q.PIE_WEDGE="pieWedge",Q.PLAQUE="plaque",Q.PLAQUE_TABS="plaqueTabs",Q.QUAD_ARROW="quadArrow",Q.QUAD_ARROW_CALLOUT="quadArrowCallout",Q.RECTANGLE="rect",Q.RECTANGULAR_CALLOUT="wedgeRectCallout",Q.REGULAR_PENTAGON="pentagon",Q.RIGHT_ARROW="rightArrow",Q.RIGHT_ARROW_CALLOUT="rightArrowCallout",Q.RIGHT_BRACE="rightBrace",Q.RIGHT_BRACKET="rightBracket",Q.RIGHT_TRIANGLE="rtTriangle",Q.ROUNDED_RECTANGLE="roundRect",Q.ROUNDED_RECTANGULAR_CALLOUT="wedgeRoundRectCallout",Q.ROUND_1_RECTANGLE="round1Rect",Q.ROUND_2_DIAG_RECTANGLE="round2DiagRect",Q.ROUND_2_SAME_RECTANGLE="round2SameRect",Q.SMILEY_FACE="smileyFace",Q.SNIP_1_RECTANGLE="snip1Rect",Q.SNIP_2_DIAG_RECTANGLE="snip2DiagRect",Q.SNIP_2_SAME_RECTANGLE="snip2SameRect",Q.SNIP_ROUND_RECTANGLE="snipRoundRect",Q.SQUARE_TABS="squareTabs",Q.STAR_10_POINT="star10",Q.STAR_12_POINT="star12",Q.STAR_16_POINT="star16",Q.STAR_24_POINT="star24",Q.STAR_32_POINT="star32",Q.STAR_4_POINT="star4",Q.STAR_5_POINT="star5",Q.STAR_6_POINT="star6",Q.STAR_7_POINT="star7",Q.STAR_8_POINT="star8",Q.STRIPED_RIGHT_ARROW="stripedRightArrow",Q.SUN="sun",Q.SWOOSH_ARROW="swooshArrow",Q.TEAR="teardrop",Q.TRAPEZOID="trapezoid",Q.UP_ARROW="upArrow",Q.UP_ARROW_CALLOUT="upArrowCallout",Q.UP_DOWN_ARROW="upDownArrow",Q.UP_DOWN_ARROW_CALLOUT="upDownArrowCallout",Q.UP_RIBBON="ribbon2",Q.U_TURN_ARROW="uturnArrow",Q.VERTICAL_SCROLL="verticalScroll",Q.WAVE="wave"})(j2||(j2={}));var F0;(function(Q){Q.AREA="area",Q.BAR="bar",Q.BAR3D="bar3D",Q.BUBBLE="bubble",Q.BUBBLE3D="bubble3D",Q.DOUGHNUT="doughnut",Q.LINE="line",Q.PIE="pie",Q.RADAR="radar",Q.SCATTER="scatter"})(F0||(F0={}));var p5;(function(Q){Q.TEXT1="tx1",Q.TEXT2="tx2",Q.BACKGROUND1="bg1",Q.BACKGROUND2="bg2",Q.ACCENT1="accent1",Q.ACCENT2="accent2",Q.ACCENT3="accent3",Q.ACCENT4="accent4",Q.ACCENT5="accent5",Q.ACCENT6="accent6"})(p5||(p5={}));var C2;(function(Q){Q.chart="chart",Q.image="image",Q.line="line",Q.rect="rect",Q.text="text",Q.placeholder="placeholder"})(C2||(C2={}));var D0;(function(Q){Q.chart="chart",Q.hyperlink="hyperlink",Q.image="image",Q.media="media",Q.online="online",Q.placeholder="placeholder",Q.table="table",Q.tablecell="tablecell",Q.text="text",Q.notes="notes"})(D0||(D0={}));var O8;(function(Q){Q.title="title",Q.body="body",Q.image="pic",Q.chart="chart",Q.table="tbl",Q.media="media"})(O8||(O8={}));var _6;(function(Q){Q.DEFAULT="•",Q.CHECK="✓",Q.STAR="★",Q.TRIANGLE="▶"})(_6||(_6={}));var c6="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==",$z="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 v0(Q,$,q){if(typeof Q==="string"&&!isNaN(Number(Q)))Q=Number(Q);if(typeof Q==="number"&&Q<100)return C0(Q);if(typeof Q==="number"&&Q>=100)return Q;if(typeof Q==="string"&&Q.includes("%")){if($&&$==="X")return Math.round(parseFloat(Q)/100*q.width);if($&&$==="Y")return Math.round(parseFloat(Q)/100*q.height);return Math.round(parseFloat(Q)/100*q.width)}return 0}function m5(Q){return Q.replace(/[xy]/g,function($){let q=Math.random()*16|0;return($==="x"?q:q&3|8).toString(16)})}function L0(Q){if(typeof Q==="undefined"||Q==null)return"";return Q.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function C0(Q){if(typeof Q==="number"&&Q>100)return Q;if(typeof Q==="string")Q=Number(Q.replace(/in*/gi,""));return Math.round(H0*Q)}function Y0(Q){let $=Number(Q)||0;return isNaN($)?0:Math.round($*T8)}function K6(Q){return Q=Q||0,Math.round((Q>360?Q-360:Q)*60000)}function J9(Q){let $=Q.toString(16);return $.length===1?"0"+$:$}function U9(Q,$,q){return(J9(Q)+J9($)+J9(q)).toUpperCase()}function f0(Q,$){let q=(Q||"").replace("#","");if(!K9.test(q)&&q!==D1.background1&&q!==D1.background2&&q!==D1.text1&&q!==D1.text2&&q!==D1.accent1&&q!==D1.accent2&&q!==D1.accent3&&q!==D1.accent4&&q!==D1.accent5&&q!==D1.accent6)console.warn(`"${q}" is not a valid scheme color or hex RGB! "${z1}" used instead. Only provide 6-digit RGB or 'pptx.SchemeColor' values!`),q=z1;let K=K9.test(q)?"srgbClr":"schemeClr",J='val="'+(K9.test(q)?q.toUpperCase():q)+'"';return $?`${$}`:``}function Kz(Q,$){let q="",K=Object.assign(Object.assign({},$),Q),J=Math.round(K.size*T8),Z=K.color,G=Math.round(K.opacity*1e5);return q+=``,q+=f0(Z,``),q+="",q}function k1(Q){let $="solid",q="",K="",J="";if(Q){if(typeof Q==="string")q=Q;else{if(Q.type)$=Q.type;if(Q.color)q=Q.color;if(Q.alpha)K+=``;if(Q.transparency)K+=``}switch($){case"solid":J+=`${f0(q,K)}`;break;default:J+="";break}}return J}function G2(Q){return Q._rels.length+Q._relsChart.length+Q._relsMedia.length+1}function D9(Q){if(!Q||typeof Q!=="object")return;if(Q.type!=="outer"&&Q.type!=="inner"&&Q.type!=="none")console.warn("Warning: shadow.type options are `outer`, `inner` or `none`."),Q.type="outer";if(Q.angle){if(isNaN(Number(Q.angle))||Q.angle<0||Q.angle>359)console.warn("Warning: shadow.angle can only be 0-359"),Q.angle=270;Q.angle=Math.round(Number(Q.angle))}if(Q.opacity){if(isNaN(Number(Q.opacity))||Q.opacity<0||Q.opacity>1)console.warn("Warning: shadow.opacity can only be 0-1"),Q.opacity=0.75;Q.opacity=Number(Q.opacity)}if(Q.color){if(Q.color.startsWith("#"))console.warn('Warning: shadow.color should not include hash (#) character, , e.g. "FF0000"'),Q.color=Q.color.replace("#","")}return Q}function Jz(Q,$,q){var K,J;let Z=2.3+(((K=Q.options)===null||K===void 0?void 0:K.autoPageCharWeight)?Q.options.autoPageCharWeight:0),G=Math.floor($/T8*H0)/((((J=Q.options)===null||J===void 0?void 0:J.fontSize)?Q.options.fontSize:f1)/Z),B=[],W=[],U=[],V=[];if(Q.text&&Q.text.toString().trim().length===0)W.push({_type:D0.tablecell,text:" "});else if(typeof Q.text==="number"||typeof Q.text==="string")W.push({_type:D0.tablecell,text:(Q.text||"").toString().trim()});else if(Array.isArray(Q.text))W=Q.text;let N=[];return W.forEach((F)=>{var M;if(typeof F.text==="string"){if(F.text.split(` +(()=>{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=` +`+W.split(` +`).map(function(V){return" "+V}).join(` +`)}else W=$.stylize("[Circular]","special");if(N6(G)){if(Z&&J.match(/^\d+$/))return W;if(G=JSON.stringify(""+J),G.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))G=G.slice(1,-1),G=$.stylize(G,"name");else G=G.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),G=$.stylize(G,"string")}return G+": "+W}function $W($,q,Q){var K=0,J=$.reduce(function(Z,G){if(K++,G.indexOf(` +`)>=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(` `).length>1)F.text.split(` -`).forEach((v)=>{N.push({_type:D0.tablecell,text:v,options:Object.assign(Object.assign({},F.options),{breakLine:!0})})});else N.push({_type:D0.tablecell,text:F.text.trim(),options:F.options});if((M=F.options)===null||M===void 0?void 0:M.breakLine)U.push(N),N=[]}if(N.length>0)U.push(N),N=[]}),U.forEach((F)=>{F.forEach((M)=>{let v=[],y=String(M.text).split(" ");y.forEach((D,z)=>{let Y=Object.assign({},M.options);if(Y===null||Y===void 0?void 0:Y.breakLine)Y.breakLine=z+1===y.length;v.push({_type:D0.tablecell,text:D+(z+1{let M=[],v="";if(F.forEach((x)=>{if(v.length+x.text.length>G)B.push(M),M=[],v="";M.push(x),v+=x.text.toString()}),M.length>0)B.push(M)}),B}function gJ(Q=[],$={},q,K){let J=P8,Z=H0*1,G=H0*1,B=0,W=0,U=[],V=v0($.x,"X",q),N=v0($.y,"Y",q),F=v0($.w,"X",q),M=v0($.h,"Y",q),v=F;function x(){let D=0;if(U.length===0)D=N||C0(J[0]);if(U.length>0)D=C0($.autoPageSlideStartY||$.newSlideStartY||J[0]);if(G=(M||q.height)-D-C0(J[2]),U.length>1){if(typeof $.autoPageSlideStartY==="number")G=(M||q.height)-C0($.autoPageSlideStartY+J[2]);else if(typeof $.newSlideStartY==="number")G=(M||q.height)-C0($.newSlideStartY+J[2]);else if(N){if(G=(M||q.height)-C0((N/H0{if(!z)z={_type:D0.tablecell};let Y=z.options||null;W+=Number((Y===null||Y===void 0?void 0:Y.colspan)?Y.colspan:1)}),$.verbose)console.log(`| numCols ......................................... = ${W}`);if(!F&&$.colW){if(v=Array.isArray($.colW)?$.colW.reduce((D,z)=>D+z)*H0:$.colW*W||0,$.verbose)console.log(`| tableCalcW ...................................... = ${v/H0}`)}if(Z=v||C0((V?V/H0:J[1])+J[3]),$.verbose)console.log(`| emuSlideTabW .................................... = ${(Z/H0).toFixed(1)}`);if(!$.colW||!Array.isArray($.colW))if($.colW&&!isNaN(Number($.colW))){let D=[];(Q[0]||[]).forEach(()=>D.push($.colW)),$.colW=[],D.forEach((Y)=>{if(Array.isArray($.colW))$.colW.push(Y)})}else{$.colW=[];for(let D=0;D{let Y=[],H=0,R=0,c=[];if(D.forEach((g)=>{var O,h,f,A;if(c.push({_type:D0.tablecell,text:[],options:g.options}),g.options.margin&&g.options.margin[0]>=1){if(((O=g.options)===null||O===void 0?void 0:O.margin)&&g.options.margin[0]&&Y0(g.options.margin[0])>H)H=Y0(g.options.margin[0]);else if(($===null||$===void 0?void 0:$.margin)&&$.margin[0]&&Y0($.margin[0])>H)H=Y0($.margin[0]);if(((h=g.options)===null||h===void 0?void 0:h.margin)&&g.options.margin[2]&&Y0(g.options.margin[2])>R)R=Y0(g.options.margin[2]);else if(($===null||$===void 0?void 0:$.margin)&&$.margin[2]&&Y0($.margin[2])>R)R=Y0($.margin[2])}else{if(((f=g.options)===null||f===void 0?void 0:f.margin)&&g.options.margin[0]&&C0(g.options.margin[0])>H)H=C0(g.options.margin[0]);else if(($===null||$===void 0?void 0:$.margin)&&$.margin[0]&&C0($.margin[0])>H)H=C0($.margin[0]);if(((A=g.options)===null||A===void 0?void 0:A.margin)&&g.options.margin[2]&&C0(g.options.margin[2])>R)R=C0(g.options.margin[2]);else if(($===null||$===void 0?void 0:$.margin)&&$.margin[2]&&C0($.margin[2])>R)R=C0($.margin[2])}}),x(),B+=H+R,$.verbose&&z===0)console.log(`| SLIDE [${U.length}]: emuSlideTabH ...... = ${(G/H0).toFixed(1)} `);if(D.forEach((g,O)=>{var h;let f={_type:D0.tablecell,_lines:null,_lineHeight:C0((((h=g.options)===null||h===void 0?void 0:h.fontSize)?g.options.fontSize:$.fontSize?$.fontSize:f1)*(sW+($.autoPageLineWeight?$.autoPageLineWeight:0))/100),text:[],options:g.options};if(f.options.rowspan)f._lineHeight=0;f.options.autoPageCharWeight=$.autoPageCharWeight?$.autoPageCharWeight:null;let A=$.colW[O];if(g.options.colspan&&Array.isArray($.colW))A=$.colW.filter((I,n)=>n>=O&&nI+n);f._lines=Jz(g,A),Y.push(f)}),$.verbose)console.log(` -| SLIDE [${U.length}]: ROW [${z}]: START...`);let m=0,$0=0,_=!1;while(!_){let g=Y[m],O=c[m];if(Y.forEach((A)=>{if(A._lineHeight>=$0)$0=A._lineHeight}),B+$0>G){if($.verbose)console.log(` -|-----------------------------------------------------------------------|`),console.log(`|-- NEW SLIDE CREATED (currTabH+currLineH > maxH) => ${(B/H0).toFixed(2)} + ${(g._lineHeight/H0).toFixed(2)} > ${G/H0}`),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(c.length>0&&c.map((I)=>I.text.length).reduce((I,n)=>I+n)>0)y.rows.push(c);if(U.push(y),y={rows:[]},c=[],D.forEach((I)=>c.push({_type:D0.tablecell,text:[],options:I.options})),x(),B+=H+R,$.verbose)console.log(`| SLIDE [${U.length}]: emuSlideTabH ...... = ${(G/H0).toFixed(1)} `);if(B=0,($.addHeaderToEach||$.autoPageRepeatHeader)&&$._arrObjTabHeadRows)$._arrObjTabHeadRows.forEach((I)=>{let n=[],i=0;I.forEach((K0)=>{if(n.push(K0),K0._lineHeight>i)i=K0._lineHeight}),y.rows.push(n),B+=i});O=c[m]}let h=g._lines.shift();if(Array.isArray(O.text)){if(h)O.text=O.text.concat(h);else if(O.text.length===0)O.text=O.text.concat({_type:D0.tablecell,text:""})}if(m===Y.length-1)B+=$0;if(m=mA._lines.length).reduce((A,I)=>A+I)===0)_=!0}if(c.length>0)y.rows.push(c);if($.verbose)console.log(`- SLIDE [${U.length}]: ROW [${z}]: ...COMPLETE ...... emuTabCurrH = ${(B/H0).toFixed(2)} ( emuSlideTabH = ${(G/H0).toFixed(2)} )`)}),U.push(y),$.verbose)console.log(` -|================================================|`),console.log(`| FINAL: tableRowSlides.length = ${U.length}`),U.forEach((D)=>console.log(D)),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 U}function Uz(Q,$,q={},K){let J=q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||Q.presLayout.width,G=[],B=[],W=[],U=[],V=[],N=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById($))throw new Error('tableToSlides: Table ID "'+$+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))N=K._margin;else if(!isNaN(K._margin))N=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=N}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))N=J.slideMargin;else if(!isNaN(J.slideMargin))N=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?C0(J.w):Q.presLayout.width)-C0(N[1]+N[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 ........................... = ${(Q.presLayout.width/H0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${(Q.presLayout.height/H0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/H0).toFixed(1)}`);let M=document.querySelectorAll(`#${$} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${$} tr:first-child td`);if(M.forEach((x)=>{let y=x;if(y.getAttribute("colspan"))for(let D=0;D{F+=x}),V.forEach((x,y)=>{let D=Number((Number(Z)*(x/F*100)/100/H0).toFixed(2)),z=0,Y=document.querySelector(`#${$} thead tr:first-child th:nth-child(${y+1})`);if(Y)z=Number(Y.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${$} thead tr:first-child th:nth-child(${y+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));U.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${U.join(", ")}]`);["thead","tbody","tfoot"].forEach((x)=>{document.querySelectorAll(`#${$} ${x} tr`).forEach((y)=>{let D=y,z=[];switch(Array.from(D.cells).forEach((Y)=>{let H=window.getComputedStyle(Y).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),R=window.getComputedStyle(Y).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(Y).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(Y).getPropertyValue("transparent"))R=["255","255","255"];let c={align:null,bold:window.getComputedStyle(Y).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(Y).getPropertyValue("font-weight"))>=500,border:null,color:U9(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:U9(Number(R[0]),Number(R[1]),Number(R[2]))},fontFace:(window.getComputedStyle(Y).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(Y).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(Y.getAttribute("colspan"))||null,rowspan:Number(Y.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(Y).getPropertyValue("text-align"))){let m=window.getComputedStyle(Y).getPropertyValue("text-align").replace("start","left").replace("end","right");c.align=m==="center"?"center":m==="left"?"left":m==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(Y).getPropertyValue("vertical-align"))){let m=window.getComputedStyle(Y).getPropertyValue("vertical-align");c.valign=m==="top"?"top":m==="middle"?"middle":m==="bottom"?"bottom":null}if(window.getComputedStyle(Y).getPropertyValue("padding-left"))c.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach(($0,_)=>{c.margin[_]=Math.round(Number(window.getComputedStyle(Y).getPropertyValue($0).replace(/\D/gi,"")))});if(window.getComputedStyle(Y).getPropertyValue("border-top-width")||window.getComputedStyle(Y).getPropertyValue("border-right-width")||window.getComputedStyle(Y).getPropertyValue("border-bottom-width")||window.getComputedStyle(Y).getPropertyValue("border-left-width"))c.border=[null,null,null,null],["top","right","bottom","left"].forEach(($0,_)=>{let g=Math.round(Number(window.getComputedStyle(Y).getPropertyValue("border-"+$0+"-width").replace("px",""))),O=[];O=window.getComputedStyle(Y).getPropertyValue("border-"+$0+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let h=U9(Number(O[0]),Number(O[1]),Number(O[2]));c.border[_]={pt:g,color:h}});z.push({_type:D0.tablecell,text:Y.innerText,options:c})}),x){case"thead":G.push(z);break;case"tbody":B.push(z);break;case"tfoot":W.push(z);break;default:console.log(`table parsing: unexpected table part: ${x}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=U,gJ([...G,...B,...W],J,Q.presLayout,K).forEach((x,y)=>{let D=Q.addSlide({masterName:J.masterSlideName||null});if(y===0)J.y=J.y||N[0];if(y>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||N[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${N[0]} => opts.y = ${J.y}`);if(D.addTable(x.rows,{x:J.x||N[3],y:J.y,w:Number(Z)/H0,colW:U,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 Vz=0;function Zz(Q,$){if(Q.bkgd)$.bkgd=Q.bkgd;if(Q.objects&&Array.isArray(Q.objects)&&Q.objects.length>0)Q.objects.forEach((q,K)=>{let J=Object.keys(q)[0],Z=$;if(C2[J]&&J==="chart")XJ(Z,q[J].type,q[J].data,q[J].opts);else if(C2[J]&&J==="image")yJ(Z,q[J]);else if(C2[J]&&J==="line")Y9(Z,j2.LINE,q[J]);else if(C2[J]&&J==="rect")Y9(Z,j2.RECTANGLE,q[J]);else if(C2[J]&&J==="text")i5(Z,[{text:q[J].text}],q[J].options,!1);else if(C2[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,i5(Z,[{text:q[J].text}],q[J].options,!0)});if(Q.slideNumber&&typeof Q.slideNumber==="object")$._slideNumberProps=Q.slideNumber}function XJ(Q,$,q,K){var J;function Z(N){if(!N||N.style==="none")return;if(N.size!==void 0&&(isNaN(Number(N.size))||N.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete N.size;if(N.style&&!["solid","dash","dot"].includes(N.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete N.style;if(N.cap&&!["flat","square","round"].includes(N.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete N.cap}let G=++Vz,B={_type:null,text:null,options:null,chartRid:null},W=null,U=[];if(Array.isArray($))$.forEach((N)=>{U=U.concat(N.data)}),W=q||K;else U=q,W=K;U.forEach((N,F)=>{if(N._dataIndex=F,N.labels!==void 0&&!Array.isArray(N.labels[0]))N.labels=[N.labels]});let V=W&&typeof W==="object"?W:{};if(V._type=$,V.x=typeof V.x!=="undefined"&&V.x!=null&&!isNaN(Number(V.x))?V.x:1,V.y=typeof V.y!=="undefined"&&V.y!=null&&!isNaN(Number(V.y))?V.y:1,V.w=V.w||"50%",V.h=V.h||"50%",V.objectName=V.objectName?L0(V.objectName):`Chart ${Q._slideObjects.filter((N)=>N._type===D0.chart).length}`,!["bar","col"].includes(V.barDir||""))V.barDir="col";if(V._type===F0.AREA){if(!["stacked","standard","percentStacked"].includes(V.barGrouping||""))V.barGrouping="standard"}if(V._type===F0.BAR){if(!["clustered","stacked","percentStacked"].includes(V.barGrouping||""))V.barGrouping="clustered"}if(V._type===F0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(V.barGrouping||""))V.barGrouping="standard"}if((J=V.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!V.barGapWidthPct)V.barGapWidthPct=50}if(V.dataLabelPosition){if(V._type===F0.AREA||V._type===F0.BAR3D||V._type===F0.DOUGHNUT||V._type===F0.RADAR)delete V.dataLabelPosition;if(V._type===F0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(V.dataLabelPosition))delete V.dataLabelPosition}if(V._type===F0.BUBBLE||V._type===F0.BUBBLE3D||V._type===F0.LINE||V._type===F0.SCATTER){if(!["b","ctr","l","r","t"].includes(V.dataLabelPosition))delete V.dataLabelPosition}if(V._type===F0.BAR){if(!["stacked","percentStacked"].includes(V.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(V.dataLabelPosition))delete V.dataLabelPosition}if(!["clustered"].includes(V.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(V.dataLabelPosition))delete V.dataLabelPosition}}}if(V.dataLabelBkgrdColors=V.dataLabelBkgrdColors||!V.dataLabelBkgrdColors?V.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(V.legendPos||""))V.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(V.bar3DShape||""))V.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(V.lineDataSymbol||""))V.lineDataSymbol="circle";if(!["gap","span"].includes(V.displayBlanksAs||""))V.displayBlanksAs="span";if(!["standard","marker","filled"].includes(V.radarStyle||""))V.radarStyle="standard";if(V.lineDataSymbolSize=V.lineDataSymbolSize&&!isNaN(V.lineDataSymbolSize)?V.lineDataSymbolSize:6,V.lineDataSymbolLineSize=V.lineDataSymbolLineSize&&!isNaN(V.lineDataSymbolLineSize)?Y0(V.lineDataSymbolLineSize):Y0(0.75),V.layout)["x","y","w","h"].forEach((N)=>{let F=V.layout[N];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+N+" can only be 0-1"),delete V.layout[N]});if(V.catGridLine=V.catGridLine||(V._type===F0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),V.valGridLine=V.valGridLine||(V._type===F0.SCATTER?{color:"D9D9D9",size:1}:{}),V.serGridLine=V.serGridLine||(V._type===F0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(V.catGridLine),Z(V.valGridLine),Z(V.serGridLine),D9(V.shadow),V.showDataTable=V.showDataTable||!V.showDataTable?V.showDataTable:!1,V.showDataTableHorzBorder=V.showDataTableHorzBorder||!V.showDataTableHorzBorder?V.showDataTableHorzBorder:!0,V.showDataTableVertBorder=V.showDataTableVertBorder||!V.showDataTableVertBorder?V.showDataTableVertBorder:!0,V.showDataTableOutline=V.showDataTableOutline||!V.showDataTableOutline?V.showDataTableOutline:!0,V.showDataTableKeys=V.showDataTableKeys||!V.showDataTableKeys?V.showDataTableKeys:!0,V.showLabel=V.showLabel||!V.showLabel?V.showLabel:!1,V.showLegend=V.showLegend||!V.showLegend?V.showLegend:!1,V.showPercent=V.showPercent||!V.showPercent?V.showPercent:!0,V.showTitle=V.showTitle||!V.showTitle?V.showTitle:!1,V.showValue=V.showValue||!V.showValue?V.showValue:!1,V.showLeaderLines=V.showLeaderLines||!V.showLeaderLines?V.showLeaderLines:!1,V.catAxisLineShow=typeof V.catAxisLineShow!=="undefined"?V.catAxisLineShow:!0,V.valAxisLineShow=typeof V.valAxisLineShow!=="undefined"?V.valAxisLineShow:!0,V.serAxisLineShow=typeof V.serAxisLineShow!=="undefined"?V.serAxisLineShow:!0,V.v3DRotX=!isNaN(V.v3DRotX)&&V.v3DRotX>=-90&&V.v3DRotX<=90?V.v3DRotX:30,V.v3DRotY=!isNaN(V.v3DRotY)&&V.v3DRotY>=0&&V.v3DRotY<=360?V.v3DRotY:30,V.v3DRAngAx=V.v3DRAngAx||!V.v3DRAngAx?V.v3DRAngAx:!0,V.v3DPerspective=!isNaN(V.v3DPerspective)&&V.v3DPerspective>=0&&V.v3DPerspective<=240?V.v3DPerspective:30,V.barGapWidthPct=!isNaN(V.barGapWidthPct)&&V.barGapWidthPct>=0&&V.barGapWidthPct<=1000?V.barGapWidthPct:150,V.barGapDepthPct=!isNaN(V.barGapDepthPct)&&V.barGapDepthPct>=0&&V.barGapDepthPct<=1000?V.barGapDepthPct:150,V.chartColors=Array.isArray(V.chartColors)?V.chartColors:V._type===F0.PIE||V._type===F0.DOUGHNUT?qz:x8,V.chartColorsOpacity=V.chartColorsOpacity&&!isNaN(V.chartColorsOpacity)?V.chartColorsOpacity:null,V.border=V.border&&typeof V.border==="object"?V.border:null,V.border&&(!V.border.pt||isNaN(V.border.pt)))V.border.pt=T6.pt;if(V.border&&(!V.border.color||typeof V.border.color!=="string"))V.border.color=T6.color;if(V.plotArea=V.plotArea||{},V.plotArea.border=V.plotArea.border&&typeof V.plotArea.border==="object"?V.plotArea.border:null,V.plotArea.border&&(!V.plotArea.border.pt||isNaN(V.plotArea.border.pt)))V.plotArea.border.pt=T6.pt;if(V.plotArea.border&&(!V.plotArea.border.color||typeof V.plotArea.border.color!=="string"))V.plotArea.border.color=T6.color;if(V.border)V.plotArea.border=V.border;if(V.plotArea.fill=V.plotArea.fill||{color:null,transparency:null},V.fill)V.plotArea.fill.color=V.fill;if(V.chartArea=V.chartArea||{},V.chartArea.border=V.chartArea.border&&typeof V.chartArea.border==="object"?V.chartArea.border:null,V.chartArea.border)V.chartArea.border={color:V.chartArea.border.color||T6.color,pt:V.chartArea.border.pt||T6.pt};if(V.chartArea.roundedCorners=typeof V.chartArea.roundedCorners==="boolean"?V.chartArea.roundedCorners:!0,V.dataBorder=V.dataBorder&&typeof V.dataBorder==="object"?V.dataBorder:null,V.dataBorder&&(!V.dataBorder.pt||isNaN(V.dataBorder.pt)))V.dataBorder.pt=0.75;if(V.dataBorder&&V.dataBorder.color){let N=typeof V.dataBorder.color==="string"&&V.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(V.dataBorder.color),F=Object.values(p5).includes(V.dataBorder.color);if(!N&&!F)V.dataBorder.color="F9F9F9"}if(!V.dataLabelFormatCode&&V._type===F0.SCATTER)V.dataLabelFormatCode="General";if(!V.dataLabelFormatCode&&(V._type===F0.PIE||V._type===F0.DOUGHNUT))V.dataLabelFormatCode=V.showPercent?"0%":"General";if(V.dataLabelFormatCode=V.dataLabelFormatCode&&typeof V.dataLabelFormatCode==="string"?V.dataLabelFormatCode:"#,##0",!V.dataLabelFormatScatter&&V._type===F0.SCATTER)V.dataLabelFormatScatter="custom";if(V.lineSize=typeof V.lineSize==="number"?V.lineSize:2,V.valAxisMajorUnit=typeof V.valAxisMajorUnit==="number"?V.valAxisMajorUnit:null,V._type===F0.AREA||V._type===F0.BAR||V._type===F0.BAR3D||V._type===F0.LINE)V.catAxisMultiLevelLabels=!!V.catAxisMultiLevelLabels;else delete V.catAxisMultiLevelLabels;return B._type="chart",B.options=V,B.chartRid=G2(Q),Q._relsChart.push({rId:G2(Q),data:U,opts:V,type:V._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),Q._slideObjects.push(B),B}function yJ(Q,$){let q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=$.x||0,J=$.y||0,Z=$.w||0,G=$.h||0,B=$.sizing||null,W=$.hyperlink||"",U=$.data||"",V=$.path||"",N=G2(Q),F=$.objectName?L0($.objectName):`Image ${Q._slideObjects.filter((v)=>v._type===D0.image).length}`;if(!V&&!U)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(V)}`),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(U)}`),null;else if(U&&typeof U==="string"&&!U.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(V.substring(V.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(U&&/image\/(\w+);/.exec(U)&&/image\/(\w+);/.exec(U).length>0)M=/image\/(\w+);/.exec(U)[1];else if(U===null||U===void 0?void 0:U.toLowerCase().includes("image/svg+xml"))M="svg";if(q._type=D0.image,q.image=V||"preencoded.png",q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:$.altText||"",rounding:typeof $.rounding==="boolean"?$.rounding:!1,sizing:B,placeholder:$.placeholder,rotate:$.rotate||0,flipV:$.flipV||!1,flipH:$.flipH||!1,transparency:$.transparency||0,objectName:F,shadow:D9($.shadow)},M==="svg")Q._relsMedia.push({path:V||U+"png",type:"image/png",extn:"png",data:U||"",rId:N,Target:`../media/image-${Q._slideNum}-${Q._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:v0(q.options.w,"X",Q._presLayout),h:v0(q.options.h,"Y",Q._presLayout)}}),q.imageRid=N,Q._relsMedia.push({path:V||U,type:"image/svg+xml",extn:M,data:U||"",rId:N+1,Target:`../media/image-${Q._slideNum}-${Q._relsMedia.length+1}.${M}`}),q.imageRid=N+1;else{let v=Q._relsMedia.filter((x)=>x.path&&x.path===V&&x.type==="image/"+M&&!x.isDuplicate)[0];Q._relsMedia.push({path:V||"preencoded."+M,type:"image/"+M,extn:M,data:U||"",rId:N,isDuplicate:!!(v===null||v===void 0?void 0:v.Target),Target:(v===null||v===void 0?void 0:v.Target)?v.Target:`../media/image-${Q._slideNum}-${Q._relsMedia.length+1}.${M}`}),q.imageRid=N}if(typeof W==="object")if(!W.url&&!W.slide)throw new Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else N++,Q._rels.push({type:D0.hyperlink,data:W.slide?"slide":"dummy",rId:N,Target:W.url||W.slide.toString()}),W._rId=N,q.hyperlink=W;Q._slideObjects.push(q)}function Gz(Q,$){let q=$.x||0,K=$.y||0,J=$.w||2,Z=$.h||2,G=$.data||"",B=$.link||"",W=$.path||"",U=$.type||"audio",V="",N=$.cover||$z,F=$.objectName?L0($.objectName):`Media ${Q._slideObjects.filter((v)=>v._type===D0.media).length}`,M={_type:D0.media};if(!W&&!G&&U!=="online")throw new Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw new Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!N.toLowerCase().includes("base64,"))throw new Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(U==="online"&&!B)throw new Error("addMedia() error: online videos require `link` value");if(V=$.extn||(G?G.split(";")[0].split("/")[1]:W.split(".").pop())||"mp3",M.mtype=U,M.media=W||"preencoded.mov",M.options={},M.options.x=q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,U==="online"){let v=G2(Q);Q._relsMedia.push({path:W||"preencoded"+V,data:"dummy",type:"online",extn:V,rId:v,Target:B}),M.mediaRid=v,Q._relsMedia.push({path:"preencoded.png",data:N,type:"image/png",extn:"png",rId:G2(Q),Target:`../media/image-${Q._slideNum}-${Q._relsMedia.length+1}.png`})}else{let v=Q._relsMedia.filter((y)=>y.path&&y.path===W&&y.type===U+"/"+V&&!y.isDuplicate)[0],x=G2(Q);Q._relsMedia.push({path:W||"preencoded"+V,type:U+"/"+V,extn:V,data:G||"",rId:x,isDuplicate:!!(v===null||v===void 0?void 0:v.Target),Target:(v===null||v===void 0?void 0:v.Target)?v.Target:`../media/media-${Q._slideNum}-${Q._relsMedia.length+1}.${V}`}),M.mediaRid=x,Q._relsMedia.push({path:W||"preencoded"+V,type:U+"/"+V,extn:V,data:G||"",rId:G2(Q),isDuplicate:!!(v===null||v===void 0?void 0:v.Target),Target:(v===null||v===void 0?void 0:v.Target)?v.Target:`../media/media-${Q._slideNum}-${Q._relsMedia.length+0}.${V}`}),Q._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:N,rId:G2(Q),Target:`../media/image-${Q._slideNum}-${Q._relsMedia.length+1}.png`})}Q._slideObjects.push(M)}function Bz(Q,$){Q._slideObjects.push({_type:D0.notes,text:[{text:$}]})}function Y9(Q,$,q){let K=typeof q==="object"?q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:$||j2.RECTANGLE,options:K,text:null};if(!$)throw new 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||jJ,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?L0(K.objectName):`Shape ${Q._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;b6(Q,J),Q._slideObjects.push(J)}function Wz(Q,$,q,K,J,Z,G){let B=[Q],W=q&&typeof q==="object"?q:{};W.objectName=W.objectName?L0(W.objectName):`Table ${Q._slideObjects.filter((F)=>F._type===D0.table).length}`;{if($===null||$.length===0||!Array.isArray($))throw new Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!$[0]||!Array.isArray($[0]))throw new 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 U=[];if($.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((v)=>{let x={_type:D0.tablecell,text:"",options:typeof v==="object"&&v.options?v.options:{}};if(typeof v==="string"||typeof v==="number")x.text=v.toString();else if(v.text){if(typeof v.text==="string"||typeof v.text==="number")x.text=v.text.toString();else if(v.text)x.text=v.text;if(v.options&&typeof v.options==="object")x.options=v.options}x.options.border=x.options.border||W.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let y=x.options.border;if(!Array.isArray(y)&&typeof y==="object")x.options.border=[y,y,y,y];if(!x.options.border[0])x.options.border[0]={type:"none"};if(!x.options.border[1])x.options.border[1]={type:"none"};if(!x.options.border[2])x.options.border[2]={type:"none"};if(!x.options.border[3])x.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{x.options.border[z]={type:x.options.border[z].type||P6.type,color:x.options.border[z].color||P6.color,pt:typeof x.options.border[z].pt==="number"?x.options.border[z].pt:P6.pt}}),M.push(x)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);U.push(M)}),W.x=v0(W.x||(W.x===0?0:H0/2),"X",J),W.y=v0(W.y||(W.y===0?0:H0/2),"Y",J),W.h)W.h=v0(W.h,"Y",J);if(W.fontSize=W.fontSize||f1,W.margin=W.margin===0||W.margin?W.margin:CJ,typeof W.margin==="number")W.margin=[Number(W.margin),Number(W.margin),Number(W.margin),Number(W.margin)];if(JSON.stringify({arrRows:U}).indexOf("hyperlink")===-1){if(!W.color)W.color=W.color||z1}if(typeof W.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),W.border=null;else if(Array.isArray(W.border))[0,1,2,3].forEach((F)=>{W.border[F]=W.border[F]?{type:W.border[F].type||P6.type,color:W.border[F].color||P6.color,pt:W.border[F].pt||P6.pt}:{type:"none"}});if(W.autoPage=typeof W.autoPage==="boolean"?W.autoPage:!1,W.autoPageRepeatHeader=typeof W.autoPageRepeatHeader==="boolean"?W.autoPageRepeatHeader:!1,W.autoPageHeaderRows=typeof W.autoPageHeaderRows!=="undefined"&&!isNaN(Number(W.autoPageHeaderRows))?Number(W.autoPageHeaderRows):1,W.autoPageLineWeight=typeof W.autoPageLineWeight!=="undefined"&&!isNaN(Number(W.autoPageLineWeight))?Number(W.autoPageLineWeight):0,W.autoPageLineWeight){if(W.autoPageLineWeight>1)W.autoPageLineWeight=1;else if(W.autoPageLineWeight<-1)W.autoPageLineWeight=-1}let V=P8;if(K&&typeof K._margin!=="undefined"){if(Array.isArray(K._margin))V=K._margin;else if(!isNaN(Number(K._margin)))V=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(W.colW){let F=U[0].reduce((M,v)=>{var x;if(((x=v===null||v===void 0?void 0:v.options)===null||x===void 0?void 0:x.colspan)&&typeof v.options.colspan==="number")M+=v.options.colspan;else M+=1;return M},0);if(typeof W.colW==="string"||typeof W.colW==="number")W.w=Math.floor(Number(W.colW)*F),W.colW=null;else if(W.colW&&Array.isArray(W.colW)&&W.colW.length===1&&F>1)W.w=Math.floor(Number(W.colW)*F),W.colW=null;else if(W.colW&&Array.isArray(W.colW)&&W.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),W.colW=null}else if(W.w)W.w=v0(W.w,"X",J);else W.w=Math.floor(J._sizeW/H0-V[1]-V[3]);if(W.x&&W.x<20)W.x=C0(W.x);if(W.y&&W.y<20)W.y=C0(W.y);if(W.w&&typeof W.w==="number"&&W.w<20)W.w=C0(W.w);if(W.h&&typeof W.h==="number"&&W.h<20)W.h=C0(W.h);U.forEach((F)=>{F.forEach((M,v)=>{if(typeof M==="number"||typeof M==="string")F[v]={_type:D0.tablecell,text:String(F[v]),options:W};else if(typeof M==="object"){if(typeof M.text==="number")F[v].text=F[v].text.toString();else if(typeof M.text==="undefined"||M.text===null)F[v].text="";F[v].options=M.options||{},F[v]._type=D0.tablecell}})});let N=[];if(W&&!W.autoPage)b6(Q,U),Q._slideObjects.push({_type:D0.table,arrTabRows:U,options:Object.assign({},W)});else{if(W.autoPageRepeatHeader)W._arrObjTabHeadRows=U.filter((F,M)=>M{if(!G(Q._slideNum+M))B.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)W.y=C0(W.autoPageSlideStartY||W.newSlideStartY||V[0]);{let v=G(Q._slideNum+M);if(W.autoPage=!1,b6(v,F.rows),v.addTable(F.rows,Object.assign({},W)),M>0)N.push(v)}})}return N}function i5(Q,$,q,K){let J={_type:K?D0.placeholder:D0.text,shape:(q===null||q===void 0?void 0:q.shape)||j2.RECTANGLE,text:!$||$.length===0?[{text:"",options:null}]:$,options:q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||Q.color||z1;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&Q._slideLayout&&Q._slideLayout._slideObjects){let B=Q._slideLayout._slideObjects.filter((W)=>W._type==="placeholder"&&W.options&&W.options.placeholder&&W.options.placeholder===G.placeholder)[0];if(B===null||B===void 0?void 0:B.options)G=Object.assign(Object.assign({},G),B.options)}if(G.objectName=G.objectName?L0(G.objectName):`Text ${Q._slideObjects.filter((B)=>B._type===D0.text).length}`,G.shape===j2.LINE){let B={type:G.line.type||"solid",color:G.line.color||jJ,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=B;if(typeof G.line==="string"){let W=B;if(typeof G.line==="string")W.color=G.line;G.line=W}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?u6.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=C0(G.inset),G._bodyProp.rIns=C0(G.inset),G._bodyProp.tIns=C0(G.inset),G._bodyProp.bIns=C0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=S6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=S6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=S6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=S6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=u6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=u6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=u6.t}return D9(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),b6(Q,J.text||""),Q._slideObjects.push(J)}function zz(Q){(Q._slideLayout._slideObjects||[]).forEach(($)=>{if($._type===D0.placeholder){if(Q._slideObjects.filter((q)=>q.options&&q.options.placeholder===$.options.placeholder).length===0)i5(Q,[{text:""}],$.options,!1)}})}function hJ(Q,$){var q;if($.bkgd){if(!$.background)$.background={};if(typeof $.bkgd==="string")$.background.color=$.bkgd;else{if($.bkgd.data)$.background.data=$.bkgd.data;if($.bkgd.path)$.background.path=$.bkgd.path;if($.bkgd.src)$.background.path=$.bkgd.src}}if((q=$.background)===null||q===void 0?void 0:q.fill)$.background.color=$.background.fill;if(Q&&(Q.path||Q.data)){Q.path=Q.path||"preencoded.png";let K=(Q.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";$._relsMedia=$._relsMedia||[];let J=$._relsMedia.length+1;$._relsMedia.push({path:Q.path,type:D0.image,extn:K,data:Q.data||null,rId:J,Target:`../media/${($._name||"").replace(/\s+/gi,"-")}-image-${$._relsMedia.length+1}.${K}`}),$._bkgdImgRid=J}}function b6(Q,$,q){let K=[];if(typeof $==="string"||typeof $==="number")return;else if(Array.isArray($))K=$;else if(typeof $==="object")K=[$];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((B)=>{if(B.options&&!B.text.options)G.push(B.options)}),b6(Q,J,G)}else if(Array.isArray(J.text))b6(Q,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=G2(Q);Q._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:L0(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(Q._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)Q._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:L0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class xJ{constructor(Q){var $;this.addSlide=Q.addSlide,this.getSlide=Q.getSlide,this._name=`Slide ${Q.slideNumber}`,this._presLayout=Q.presLayout,this._rId=Q.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=Q.setSlideNum,this._slideId=Q.slideId,this._slideLayout=Q.slideLayout||null,this._slideNum=Q.slideNumber,this._slideObjects=[],this._slideNumberProps=(($=this._slideLayout)===null||$===void 0?void 0:$._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd(Q){if(this._bkgd=Q,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof Q==="string")this._background.color=Q}}get bkgd(){return this._bkgd}set background(Q){if(this._background=Q,Q)hJ(Q,this)}get background(){return this._background}set color(Q){this._color=Q}get color(){return this._color}set hidden(Q){this._hidden=Q}get hidden(){return this._hidden}set slideNumber(Q){this._slideNumberProps=Q,this._setSlideNum(Q)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart(Q,$,q){let K=q||{};return K._type=Q,XJ(this,Q,$,q),this}addImage(Q){return yJ(this,Q),this}addMedia(Q){return Gz(this,Q),this}addNotes(Q){return Bz(this,Q),this}addShape(Q,$){return Y9(this,Q,$),this}addTable(Q,$){return this._newAutoPagedSlides=Wz(this,Q,$,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText(Q,$){return i5(this,typeof Q==="string"||typeof Q==="number"?[{text:Q,options:$}]:Q,$,!1),this}}function Fz(Q,$){return H1(this,void 0,void 0,function*(){let q=Q.data;return yield new Promise((K,J)=>{var Z,G;let B=new L9.default,W=(q.length-1)*2+1,U=((G=(Z=q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;B.folder("_rels"),B.folder("docProps"),B.folder("xl/_rels"),B.folder("xl/tables"),B.folder("xl/theme"),B.folder("xl/worksheets"),B.folder("xl/worksheets/_rels"),B.file("[Content_Types].xml",' \n'),B.file("_rels/.rels",` -`),B.file("docProps/app.xml",`Microsoft Macintosh Excel0falseWorksheets1Sheet1falsefalsefalse16.0300 -`),B.file("docProps/core.xml",'PptxGenJSPptxGenJS'+new Date().toISOString()+''+new Date().toISOString()+""),B.file("xl/_rels/workbook.xml.rels",''),B.file("xl/styles.xml",'\n'),B.file("xl/theme/theme1.xml",''),B.file("xl/workbook.xml",` -`),B.file("xl/worksheets/_rels/sheet1.xml.rels",` -`);{let V='';if(Q.opts._type===F0.BUBBLE||Q.opts._type===F0.BUBBLE3D)V+=``;else if(Q.opts._type===F0.SCATTER)V+=``;else if(U){let N=q.length;q[0].labels.forEach((F)=>N+=F.filter((M)=>M&&M!=="").length),V+=``,V+=""}else{let N=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;V+=``,V+=''}if(Q.opts._type===F0.BUBBLE||Q.opts._type===F0.BUBBLE3D)q.forEach((N,F)=>{if(F===0)V+="X-Axis";else V+=`${L0(N.name||`Y-Axis${F}`)}`,V+=`${L0(`Size${F}`)}`});else q.forEach((N)=>{V+=`${L0((N.name||" ").replace("X-Axis","X-Values"))}`});if(Q.opts._type!==F0.BUBBLE&&Q.opts._type!==F0.BUBBLE3D&&Q.opts._type!==F0.SCATTER)q[0].labels.slice().reverse().forEach((N)=>{N.filter((F)=>F&&F!=="").forEach((F)=>{V+=`${L0(F)}`})});V+=` -`,B.file("xl/sharedStrings.xml",V)}{let V='';if(Q.opts._type===F0.BUBBLE||Q.opts._type===F0.BUBBLE3D){V+=``,V+=``;let N=1;q.forEach((F,M)=>{if(M===0)V+=``;else V+=``,N++,V+=``})}else if(Q.opts._type===F0.SCATTER)V+=`
`,V+=``,q.forEach((N,F)=>{V+=``});else V+=`
`,V+=``,q[0].labels.forEach((N,F)=>{V+=``}),q.forEach((N,F)=>{V+=``});V+="",V+='',V+="
",B.file("xl/tables/table1.xml",V)}{let V='';if(V+='',Q.opts._type===F0.BUBBLE||Q.opts._type===F0.BUBBLE3D)V+=``;else if(Q.opts._type===F0.SCATTER)V+=``;else V+=``;if(V+='',V+='',Q.opts._type===F0.BUBBLE||Q.opts._type===F0.BUBBLE3D){V+="",V+=``,V+='0';for(let N=1;N${N}`;V+="",q[0].values.forEach((N,F)=>{V+=``,V+=`${N}`;let M=2;for(let v=1;v${q[v].values[F]||""}`,M++,V+=`${q[v].sizes[F]||""}`,M++;V+=""})}else if(Q.opts._type===F0.SCATTER){V+="",V+=``;for(let N=0;N${N}`;V+="",q[0].values.forEach((N,F)=>{V+=``,V+=`${N}`;for(let M=1;M${q[M].values[F]||q[M].values[F]===0?q[M].values[F]:""}`;V+=""})}else if(V+="",!U){V+=``,q[0].labels.forEach((N,F)=>{V+=`0`});for(let N=0;N${N+1}`;V+="",q[0].labels[0].forEach((N,F)=>{V+=``;for(let M=q[0].labels.length-1;M>=0;M--)V+=``,V+=`${q.length+F+1}`,V+="";for(let M=0;M${q[M].values[F]||""}`;V+=""})}else{V+=``;for(let v=0;v0`;for(let v=q[0].labels.length-1;v${v}`;V+="";let N=q.length,F=q[0].labels[0].length,M=q[0].labels.length;for(let v=0;v`;let x=N,y=q[0].labels.slice().reverse();y.forEach((D,z)=>{if(D[v]){let H=z===0?1:y[z-1].filter((R)=>R&&R!=="").length;x+=H,V+=`${x}`}});for(let D=0;D${q[D].values[v]||0}`;V+=""}}V+="",V+='',V+=` -`,B.file("xl/worksheets/sheet1.xml",V)}B.generateAsync({type:"base64"}).then((V)=>{$.file(`ppt/embeddings/Microsoft_Excel_Worksheet${Q.globalId}.xlsx`,V,{base64:!0}),$.file("ppt/charts/_rels/"+Q.fileName+".rels",``),$.file(`ppt/charts/${Q.fileName}`,Mz(Q)),K("")}).catch((V)=>{J(V)})})})}function Mz(Q){var $,q,K,J;let Z='',G=!1;{if(Z+='',Z+='',Z+=``,Z+="",Q.opts.showTitle)Z+=l5({title:Q.opts.title||"Chart Title",color:Q.opts.titleColor,fontFace:Q.opts.titleFontFace,fontSize:Q.opts.titleFontSize||eW,titleAlign:Q.opts.titleAlign,titleBold:Q.opts.titleBold,titlePos:Q.opts.titlePos,titleRotate:Q.opts.titleRotate},Q.opts.x,Q.opts.y),Z+='';else Z+='';if(Q.opts._type===F0.BAR3D)Z+=``;if(Z+="",Q.opts.layout)Z+="",Z+=" ",Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=' ',Z+=" ",Z+="";else Z+=""}if(Array.isArray(Q.opts._type))Q.opts._type.forEach((B)=>{let W=Object.assign(Object.assign({},Q.opts),B.options),U=W.secondaryValAxis?d5:Z2,V=W.secondaryCatAxis?W9:h8;G=G||W.secondaryValAxis,Z+=kJ(B.type,B.data,W,U,V)});else Z+=kJ(Q.opts._type,Q.data,Q.opts,Z2,h8);if(Q.opts._type!==F0.PIE&&Q.opts._type!==F0.DOUGHNUT){if(Q.opts.valAxes&&Q.opts.valAxes.length>1&&!G)throw new Error("Secondary axis must be used by one of the multiple charts");if(Q.opts.catAxes){if(!Q.opts.valAxes||Q.opts.valAxes.length!==Q.opts.catAxes.length)throw new Error("There must be the same number of value and category axes.");Z+=V9(Object.assign(Object.assign({},Q.opts),Q.opts.catAxes[0]),h8,Z2)}else Z+=V9(Q.opts,h8,Z2);if(Q.opts.valAxes){if(Z+=Z9(Object.assign(Object.assign({},Q.opts),Q.opts.valAxes[0]),Z2),Q.opts.valAxes[1])Z+=Z9(Object.assign(Object.assign({},Q.opts),Q.opts.valAxes[1]),d5)}else if(Z+=Z9(Q.opts,Z2),Q.opts._type===F0.BAR3D)Z+=wz(Q.opts,fJ,Z2);if((($=Q.opts)===null||$===void 0?void 0:$.catAxes)&&((q=Q.opts)===null||q===void 0?void 0:q.catAxes[1]))Z+=V9(Object.assign(Object.assign({},Q.opts),Q.opts.catAxes[1]),W9,d5)}{if(Q.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=Q.opts.plotArea.fill)===null||K===void 0?void 0:K.color)?k1(Q.opts.plotArea.fill):"",Z+=Q.opts.plotArea.border?`${k1(Q.opts.plotArea.border.color)}`:"",Z+=" ",Z+=" ",Z+="",Q.opts.showLegend){if(Z+="",Z+='',Z+='',Q.opts.legendFontFace||Q.opts.legendFontSize||Q.opts.legendColor){if(Z+="",Z+=" ",Z+=" ",Z+=" ",Z+=" ",Z+=Q.opts.legendFontSize?``:"",Q.opts.legendColor)Z+=k1(Q.opts.legendColor);if(Q.opts.legendFontFace)Z+='';if(Q.opts.legendFontFace)Z+='';Z+=" ",Z+=" ",Z+=' ',Z+=" ",Z+=""}Z+=""}}if(Z+=' ',Z+=' ',Q.opts._type===F0.SCATTER)Z+='';return Z+="",Z+="",Z+=((J=Q.opts.chartArea.fill)===null||J===void 0?void 0:J.color)?k1(Q.opts.chartArea.fill):"",Z+=Q.opts.chartArea.border?`${k1(Q.opts.chartArea.border.color)}`:"",Z+=" ",Z+="",Z+='',Z+="",Z}function kJ(Q,$,q,K,J,Z){let G=-1,B=1,W=null,U="";switch(Q){case F0.AREA:case F0.BAR:case F0.BAR3D:case F0.LINE:case F0.RADAR:if(U+=``,Q===F0.AREA&&q.barGrouping==="stacked")U+='';if(Q===F0.BAR||Q===F0.BAR3D)U+='',U+='';if(Q===F0.RADAR)U+='';U+='',$.forEach((V)=>{var N;G++,U+="",U+=` `,U+=" ",U+=" ",U+=" Sheet1!$"+h0(V._dataIndex+V.labels.length+1)+"$1",U+=' '+L0(V.name)+"",U+=" ",U+=" ";let F=q.chartColors?q.chartColors[G%q.chartColors.length]:null;if(U+=" ",F==="transparent")U+="";else if(q.chartColorsOpacity)U+=""+f0(F,``)+"";else U+=""+f0(F)+"";if(Q===F0.LINE||Q===F0.RADAR)if(q.lineSize===0)U+="";else U+=`${f0(F)}`,U+='';else if(q.dataBorder)U+=`${f0(q.dataBorder.color)}`;if(U+=q6(q.shadow,Q6),U+=" ",U+=' ',Q!==F0.RADAR){if(U+="",U+=``,q.dataLabelBkgrdColors)U+=`${f0(F)}`;if(U+="",U+=``,U+=`${f0(q.dataLabelColor||z1)}`,U+=``,U+="",q.dataLabelPosition)U+=``;U+='',U+=``,U+=``,U+=``,U+=""}if(Q===F0.LINE||Q===F0.RADAR){if(U+="",U+=' ',q.lineDataSymbolSize)U+=``;U+=" ",U+=` ${f0(q.chartColors[V._dataIndex+1>q.chartColors.length?Math.floor(Math.random()*q.chartColors.length):V._dataIndex])}`,U+=` ${f0(q.lineDataSymbolLineColor||F)}`,U+=" ",U+=" ",U+=""}if((Q===F0.BAR||Q===F0.BAR3D)&&$.length===1&&(q.chartColors&&q.chartColors!==x8&&q.chartColors.length>1||((N=q.invertedColors)===null||N===void 0?void 0:N.length)))V.values.forEach((M,v)=>{let x=M<0?q.invertedColors||q.chartColors||x8:q.chartColors||[];if(U+=" ",U+=` `,U+=' ',U+=' ',U+=" ",q.lineSize===0)U+="";else if(Q===F0.BAR)U+="",U+=' ',U+="";else U+="",U+=" ",U+=' ',U+=" ",U+="";U+=q6(q.shadow,Q6),U+=" ",U+=" "});{if(U+="",q.catLabelFormatCode)U+=" ",U+=` Sheet1!$A$2:$A$${V.labels[0].length+1}`,U+=" ",U+=" "+(q.catLabelFormatCode||"General")+"",U+=` `,V.labels[0].forEach((M,v)=>U+=`${L0(M)}`),U+=" ",U+=" ";else U+=" ",U+=` Sheet1!$A$2:$${h0(V.labels.length)}$${V.labels[0].length+1}`,U+=" ",U+=` `,V.labels.forEach((M)=>{U+="",M.forEach((v,x)=>U+=`${L0(v)}`),U+=""}),U+=" ",U+=" ";U+=""}if(U+="",U+=" ",U+=`Sheet1!$${h0(V._dataIndex+V.labels.length+1)}$2:$${h0(V._dataIndex+V.labels.length+1)}$${V.labels[0].length+1}`,U+=" ",U+=" "+(q.valLabelFormatCode||q.dataTableFormatCode||"General")+"",U+=` `,V.values.forEach((M,v)=>U+=`${M||M===0?M:""}`),U+=" ",U+=" ",U+="",Q===F0.LINE)U+='';U+=""});{if(U+=" ",U+=` `,U+=" ",U+=" ",U+=" ",U+=" ",U+=` `,U+=" "+f0(q.dataLabelColor||z1)+"",U+=' ',U+=" ",U+=" ",U+=" ",q.dataLabelPosition)U+=' ';U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=` `,U+=" "}if(Q===F0.BAR)U+=` `,U+=` `;else if(Q===F0.BAR3D)U+=` `,U+=` `,U+=' ';else if(Q===F0.LINE)U+=' ';U+=``,U+=``;break;case F0.SCATTER:U+="",U+='',U+='',G=-1,$.filter((V,N)=>N>0).forEach((V,N)=>{G++,U+="",U+=` `,U+=` `,U+=" ",U+=" ",U+=` Sheet1!$${h0(N+2)}$1`,U+=' '+L0(V.name)+"",U+=" ",U+=" ",U+=" ";{let F=q.chartColors[G%q.chartColors.length];if(F==="transparent")U+="";else if(q.chartColorsOpacity)U+=""+f0(F,'')+"";else U+=""+f0(F)+"";if(q.lineSize===0)U+="";else U+=`${f0(F)}`,U+=``;U+=q6(q.shadow,Q6)}U+=" ";{if(U+="",U+=' ',q.lineDataSymbolSize)U+=``;U+="",U+=`${f0(q.chartColors[N+1>q.chartColors.length?Math.floor(Math.random()*q.chartColors.length):N])}`,U+=`${f0(q.lineDataSymbolLineColor||q.chartColors[G%q.chartColors.length])}`,U+="",U+="",U+=""}if(q.showLabel){let F=m5("-xxxx-xxxx-xxxx-xxxxxxxxxxxx");if(V.labels[0]&&(q.dataLabelFormatScatter==="custom"||q.dataLabelFormatScatter==="customXY"))U+="",V.labels[0].forEach((M,v)=>{if(q.dataLabelFormatScatter==="custom"||q.dataLabelFormatScatter==="customXY"){if(U+=" ",U+=` `,U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=' ',U+=" "+L0(M)+"",U+=" ",q.dataLabelFormatScatter==="customXY"&&!/^ *$/.test(M))U+=" ",U+=' ',U+=" (",U+=" ",U+=' ',U+=' ',U+=" ",U+=" ",U+=" ",U+=" ["+L0(V.name)+"",U+=" ",U+=" ",U+=' ',U+=" , ",U+=" ",U+=' ',U+=' ',U+=" ",U+=" ",U+=" ",U+=" ["+L0(V.name)+"]",U+=" ",U+=" ",U+=' ',U+=" )",U+=" ",U+=' ';if(U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",q.dataLabelPosition)U+=' ';U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=" ",U+=' ',U+=' ',U+=` `,U+=" ",U+=" ",U+=""}}),U+="";if(q.dataLabelFormatScatter==="XY"){if(U+="",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=' ',U+=" ",U+=" ",q.dataLabelPosition)U+=' ';U+=' ',U+=` `,U+=` `,U+=` `,U+=' ',U+=' ',U+=" ",U+=' ',U+=' ',U+=" ",U+=" ",U+=""}}if($.length===1&&q.chartColors!==x8)V.values.forEach((F,M)=>{let v=F<0?q.invertedColors||q.chartColors||x8:q.chartColors||[];if(U+=" ",U+=` `,U+=' ',U+=' ',U+=" ",q.lineSize===0)U+="";else U+="",U+=' ',U+="";U+=q6(q.shadow,Q6),U+=" ",U+=" "});U+="",U+=" ",U+=` Sheet1!$A$2:$A$${$[0].values.length+1}`,U+=" ",U+=" General",U+=` `,$[0].values.forEach((F,M)=>{U+=`${F||F===0?F:""}`}),U+=" ",U+=" ",U+="",U+="",U+=" ",U+=` Sheet1!$${h0(N+2)}$2:$${h0(N+2)}$${$[0].values.length+1}`,U+=" ",U+=" General",U+=` `,$[0].values.forEach((F,M)=>{U+=`${V.values[M]||V.values[M]===0?V.values[M]:""}`}),U+=" ",U+=" ",U+="",U+='',U+=""});{if(U+=" ",U+=` `,U+=" ",U+=" ",U+=" ",U+=" ",U+=` `,U+=" "+f0(q.dataLabelColor||z1)+"",U+=' ',U+=" ",U+=" ",U+=" ",q.dataLabelPosition)U+=' ';U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=" "}U+=``,U+="";break;case F0.BUBBLE:case F0.BUBBLE3D:U+="",U+='',G=-1,$.filter((V,N)=>N>0).forEach((V,N)=>{G++,U+="",U+=` `,U+=` `,U+=" ",U+=" ",U+=" Sheet1!$"+h0(B+1)+"$1",U+=' '+L0(V.name)+"",U+=" ",U+=" ";{U+="";let F=q.chartColors[G%q.chartColors.length];if(F==="transparent")U+="";else if(q.chartColorsOpacity)U+=`${f0(F,'')}`;else U+=""+f0(F)+"";if(q.lineSize===0)U+="";else if(q.dataBorder)U+=`${f0(q.dataBorder.color)}`;else U+=`${f0(F)}`,U+=``;U+=q6(q.shadow,Q6),U+=""}U+="",U+=" ",U+=` Sheet1!$A$2:$A$${$[0].values.length+1}`,U+=" ",U+=" General",U+=` `,$[0].values.forEach((F,M)=>{U+=`${F||F===0?F:""}`}),U+=" ",U+=" ",U+="",U+="",U+=" ",U+=`Sheet1!$${h0(B+1)}$2:$${h0(B+1)}$${$[0].values.length+1}`,B++,U+=" ",U+=" General",U+=` `,$[0].values.forEach((F,M)=>{U+=`${V.values[M]||V.values[M]===0?V.values[M]:""}`}),U+=" ",U+=" ",U+="",U+=" ",U+=" ",U+=`Sheet1!$${h0(B+1)}$2:$${h0(B+1)}$${V.sizes.length+1}`,B++,U+=" ",U+=" General",U+=` `,V.sizes.forEach((F,M)=>{U+=`${F||""}`}),U+=" ",U+=" ",U+=" ",U+=' ',U+=""});{if(U+="",U+=``,U+="",U+=``,U+=`${f0(q.dataLabelColor||z1)}`,U+=``,U+="",q.dataLabelPosition)U+=``;U+='',U+=``,U+=``,U+="",U+=' ',U+=' ',U+=" ",U+="",U+=""}U+=``,U+="";break;case F0.DOUGHNUT:case F0.PIE:if(W=$[0],U+="",U+=' ',U+="",U+=' ',U+=' ',U+=" ",U+=" ",U+=" Sheet1!$B$1",U+=" ",U+=' ',U+=' '+L0(W.name)+"",U+=" ",U+=" ",U+=" ",U+=" ",U+=' ',U+=' ',q.dataNoEffects)U+="";else U+=q6(q.shadow,Q6);if(U+=" ",W.labels[0].forEach((V,N)=>{if(U+="",U+=` `,U+=' ',U+=" ",U+=`${f0(q.chartColors[N+1>q.chartColors.length?Math.floor(Math.random()*q.chartColors.length):N])}`,q.dataBorder)U+=`${f0(q.dataBorder.color)}`;U+=q6(q.shadow,Q6),U+=" ",U+=""}),U+="",W.labels[0].forEach((V,N)=>{if(U+="",U+=` `,U+=` `,U+=" ",U+=" ",U+=" ",U+=` `,U+=" "+f0(q.dataLabelColor||z1)+"",U+=` `,U+=" ",U+=" ",U+=" ",Q===F0.PIE&&q.dataLabelPosition)U+=``;U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=" "}),U+=` `,U+=" ",U+=" ",U+=" ",U+=" ",U+=" ",U+=` `,U+=' ',U+=" ",U+=" ",U+=" ",U+=" ",U+=Q===F0.PIE?'':"",U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=' ',U+=` `,U+="",U+="",U+=" ",U+=` Sheet1!$A$2:$A$${W.labels[0].length+1}`,U+=" ",U+=` `,W.labels[0].forEach((V,N)=>{U+=`${L0(V)}`}),U+=" ",U+=" ",U+="",U+=" ",U+=" ",U+=` Sheet1!$B$2:$B$${W.labels[0].length+1}`,U+=" ",U+=` `,W.values.forEach((V,N)=>{U+=`${V||V===0?V:""}`}),U+=" ",U+=" ",U+=" ",U+=" ",U+=` `,Q===F0.DOUGHNUT)U+=``;U+="";break;default:U+="";break}return U}function V9(Q,$,q){let K="";if(Q._type===F0.SCATTER||Q._type===F0.BUBBLE||Q._type===F0.BUBBLE3D)K+="";else K+="";if(K+=' ',K+=" ",K+='',Q.catAxisMaxVal||Q.catAxisMaxVal===0)K+=``;if(Q.catAxisMinVal||Q.catAxisMinVal===0)K+=``;if(K+="",K+=' ',K+=' ',K+=Q.catGridLine.style!=="none"?H9(Q.catGridLine):"",Q.showCatAxisTitle)K+=l5({color:Q.catAxisTitleColor,fontFace:Q.catAxisTitleFontFace,fontSize:Q.catAxisTitleFontSize,titleRotate:Q.catAxisTitleRotate,title:Q.catAxisTitle||"Axis Title"});if(Q._type===F0.SCATTER||Q._type===F0.BUBBLE||Q._type===F0.BUBBLE3D)K+=' ';else K+=' ';if(Q._type===F0.SCATTER)K+=' ',K+=' ',K+=' ';else K+=' ',K+=' ',K+=' ';if(K+=" ",K+=` `,K+=!Q.catAxisLineShow?"":""+f0(Q.catAxisLineColor||$6.color)+"",K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",Q.catAxisLabelRotate)K+=``;else K+="";if(K+=" ",K+=" ",K+=" ",K+=` `,K+=" "+f0(Q.catAxisLabelColor||z1)+"",K+=' ',K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=` `,K+=' ',K+=' ',K+=` `,Q.catAxisLabelFrequency)K+=' ';if(Q.catLabelFormatCode||Q._type===F0.SCATTER||Q._type===F0.BUBBLE||Q._type===F0.BUBBLE3D){if(Q.catLabelFormatCode){if(["catAxisBaseTimeUnit","catAxisMajorTimeUnit","catAxisMinorTimeUnit"].forEach((J)=>{if(Q[J]&&(typeof Q[J]!=="string"||!["days","months","years"].includes(Q[J].toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),Q[J]=null}),Q.catAxisBaseTimeUnit)K+='';if(Q.catAxisMajorTimeUnit)K+='';if(Q.catAxisMinorTimeUnit)K+=''}if(Q.catAxisMajorUnit)K+=``;if(Q.catAxisMinorUnit)K+=``}if(Q._type===F0.SCATTER||Q._type===F0.BUBBLE||Q._type===F0.BUBBLE3D)K+="";else K+="";return K}function Z9(Q,$){let q=$===Z2?Q.barDir==="col"?"l":"b":Q.barDir!=="col"?"r":"t";if($===d5)q="r";let K=$===Z2?h8:W9,J="";if(J+="",J+=' ',J+=" ",Q.valAxisLogScaleBase)J+=``;if(J+='',Q.valAxisMaxVal||Q.valAxisMaxVal===0)J+=``;if(Q.valAxisMinVal||Q.valAxisMinVal===0)J+=``;if(J+=" ",J+=` `,J+=' ',Q.valGridLine.style!=="none")J+=H9(Q.valGridLine);if(Q.showValAxisTitle)J+=l5({color:Q.valAxisTitleColor,fontFace:Q.valAxisTitleFontFace,fontSize:Q.valAxisTitleFontSize,titleRotate:Q.valAxisTitleRotate,title:Q.valAxisTitle||"Axis Title"});if(J+=``,Q._type===F0.SCATTER)J+=' ',J+=' ',J+=' ';else J+=' ',J+=' ',J+=' ';if(J+=" ",J+=` `,J+=!Q.valAxisLineShow?"":""+f0(Q.valAxisLineColor||$6.color)+"",J+=' ',J+=" ",J+=" ",J+=" ",J+=" ",J+=` `,J+=" ",J+=" ",J+=" ",J+=` `,J+=" "+f0(Q.valAxisLabelColor||z1)+"",J+=' ',J+=" ",J+=" ",J+=' ',J+=" ",J+=" ",J+=' ',typeof Q.catAxisCrossesAt==="number")J+=` `;else if(typeof Q.catAxisCrossesAt==="string")J+=' ';else J+=' ';if(J+=' ',Q.valAxisMajorUnit)J+=` `;if(Q.valAxisDisplayUnit)J+=`${Q.valAxisDisplayUnitLabel?"":""}`;return J+="",J}function wz(Q,$,q){let K="";if(K+="",K+=' ',K+=' ',K+=' ',K+=' ',K+=Q.serGridLine.style!=="none"?H9(Q.serGridLine):"",Q.showSerAxisTitle)K+=l5({color:Q.serAxisTitleColor,fontFace:Q.serAxisTitleFontFace,fontSize:Q.serAxisTitleFontSize,titleRotate:Q.serAxisTitleRotate,title:Q.serAxisTitle||"Axis Title"});if(K+=` `,K+=' ',K+=' ',K+=` `,K+=" ",K+=' ',K+=!Q.serAxisLineShow?"":`${f0(Q.serAxisLineColor||$6.color)}`,K+=' ',K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=" ",K+=` `,K+=` ${f0(Q.serAxisLabelColor||z1)}`,K+=` `,K+=" ",K+=" ",K+=' ',K+=" ",K+=" ",K+=' ',K+=' ',Q.serAxisLabelFrequency)K+=' ';if(Q.serLabelFormatCode){if(["serAxisBaseTimeUnit","serAxisMajorTimeUnit","serAxisMinorTimeUnit"].forEach((J)=>{if(Q[J]&&(typeof Q[J]!=="string"||!["days","months","years"].includes(J.toLowerCase())))console.warn(`"${J}" must be one of: 'days','months','years' !`),Q[J]=null}),Q.serAxisBaseTimeUnit)K+=` `;if(Q.serAxisMajorTimeUnit)K+=` `;if(Q.serAxisMinorTimeUnit)K+=` `;if(Q.serAxisMajorUnit)K+=` `;if(Q.serAxisMinorUnit)K+=` `}return K+="",K}function l5(Q,$,q){let K=Q.titleAlign==="left"||Q.titleAlign==="right"?``:"",J=Q.titleRotate?``:"",Z=Q.fontSize?`sz="${Math.round(Q.fontSize*100)}"`:"",G=Q.titleBold?1:0,B="";if(Q.titlePos&&typeof Q.titlePos.x==="number"&&typeof Q.titlePos.y==="number"){let W=Q.titlePos.x+$,U=Q.titlePos.y+q,V=W===0?0:W*(W/5)/10;if(V>=1)V=V/10;if(V>=0.1)V=V/10;let N=U===0?0:U*(U/5)/10;if(N>=1)N=N/10;if(N>=0.1)N=N/10;B=``}return` +`);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}`,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} @@ -38,46 +37,46 @@ ${K} - ${f0(Q.color||z1)} - + ${R0($.color||Q2)} + - ${f0(Q.color||z1)} - + ${R0($.color||Q2)} + - ${L0(Q.title)||""} + ${k0($.title)||""} - ${B} + ${W} -
`}function h0(Q){let $="",q=Q-1;if(q<=25)$=y8[q];else $=`${y8[Math.floor(q/y8.length-1)]}${y8[q%y8.length]}`;return $}function q6(Q,$){if(!Q)return"";else if(typeof Q!=="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),B=Math.round(K.angle*60000),W=K.color,U=Math.round(K.opacity*1e5),V=K.rotateWithShape?1:0;return q+=``,q+=``,q+=``,q+=``,q+="",q}function H9(Q){let $="";return $+=" ",$+=` `,$+=' ',$+=' ',$+=" ",$+=" ",$+="",$}function n5(Q){if(!Q||Q==="flat")return"flat";else if(Q==="square")return"sq";else if(Q==="round")return"rnd";else throw new Error(`Invalid chart line cap: ${Q}`)}function G9(Q){var $,q;let K=typeof process!=="undefined"&&!!(($=process.versions)===null||$===void 0?void 0:$.node)&&((q=process.release)===null||q===void 0?void 0:q.name)==="node",J,Z,G=K?()=>H1(this,void 0,void 0,function*(){({default:J}=yield import("node:fs")),{default:Z}=yield Promise.resolve().then(() => (DJ(),LJ))}):()=>H1(this,void 0,void 0,function*(){});if(K)G();let B=[],W=Q._relsMedia.filter((V)=>V.type!=="online"&&!V.data&&(!V.path||V.path&&!V.path.includes("preencoded"))),U=[];return W.forEach((V)=>{if(!U.includes(V.path))V.isDuplicate=!1,U.push(V.path);else V.isDuplicate=!0}),W.filter((V)=>!V.isDuplicate).forEach((V)=>{B.push((()=>H1(this,void 0,void 0,function*(){if(!Z)yield G();if(K&&J&&V.path.indexOf("http")!==0)try{let N=J.readFileSync(V.path);return V.data=Buffer.from(N).toString("base64"),W.filter((F)=>F.isDuplicate&&F.path===V.path).forEach((F)=>F.data=V.data),"done"}catch(N){throw V.data=c6,W.filter((F)=>F.isDuplicate&&F.path===V.path).forEach((F)=>F.data=V.data),new Error(`ERROR: Unable to read media: "${V.path}" -${String(N)}`)}if(K&&Z&&V.path.startsWith("http"))return yield new Promise((N,F)=>{Z.get(V.path,(M)=>{let v="";M.setEncoding("binary"),M.on("data",(x)=>v+=x),M.on("end",()=>{V.data=Buffer.from(v,"binary").toString("base64"),W.filter((x)=>x.isDuplicate&&x.path===V.path).forEach((x)=>x.data=V.data),N("done")}),M.on("error",()=>{V.data=c6,W.filter((x)=>x.isDuplicate&&x.path===V.path).forEach((x)=>x.data=V.data),F(new Error(`ERROR! Unable to load image (https.get): ${V.path}`))})})});return yield new Promise((N,F)=>{let M=new XMLHttpRequest;M.onload=()=>{let v=new FileReader;v.onloadend=()=>{if(V.data=v.result,W.filter((x)=>x.isDuplicate&&x.path===V.path).forEach((x)=>x.data=V.data),!V.isSvgPng)N("done");else vJ(V).then(()=>N("done")).catch(F)},v.readAsDataURL(M.response)},M.onerror=()=>{V.data=c6,W.filter((v)=>v.isDuplicate&&v.path===V.path).forEach((v)=>v.data=V.data),F(new Error(`ERROR! Unable to load image (xhr.onerror): ${V.path}`))},M.open("GET",V.path),M.responseType="blob",M.send()})}))())}),Q._relsMedia.filter((V)=>V.isSvgPng&&V.data).forEach((V)=>{(()=>H1(this,void 0,void 0,function*(){if(K&&!J)yield G();if(K&&J)V.data=c6,B.push(Promise.resolve("done"));else B.push(vJ(V))}))()}),B}function vJ(Q){return H1(this,void 0,void 0,function*(){return yield new Promise(($,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{Q.data=J.toDataURL(Q.type),$("done")}catch(G){K.onerror(G.toString())}J=null},K.onerror=()=>{Q.data=c6,q(new Error(`ERROR! Unable to load image (image.onerror): ${Q.path}`))},K.src=typeof Q.data==="string"?Q.data:c6})})}var Nz={cover:function(Q,$){let q=Q.h/Q.w,J=$.h/$.w>q,Z=J?$.h/q:$.w,G=J?$.h:$.w*q,B=Math.round(50000*(1-$.w/Z)),W=Math.round(50000*(1-$.h/G));return``},contain:function(Q,$){let q=Q.h/Q.w,J=$.h/$.w>q,Z=J?$.w:$.h/q,G=J?$.w*q:$.h,B=Math.round(50000*(1-$.w/Z)),W=Math.round(50000*(1-$.h/G));return``},crop:function(Q,$){let q=$.x,K=Q.w-($.x+$.w),J=$.y,Z=Q.h-($.y+$.h),G=Math.round(1e5*(q/Q.w)),B=Math.round(1e5*(K/Q.w)),W=Math.round(1e5*(J/Q.h)),U=Math.round(1e5*(Z/Q.h));return``}};function k9(Q){var $;let q=Q._name?'':"",K=1;if(Q._bkgdImgRid)q+=``;else if(($=Q.background)===null||$===void 0?void 0:$.color)q+=`${k1(Q.background)}`;else if(!Q.bkgd&&Q._name&&Q._name===B9)q+='';if(q+="",q+='',q+='',q+='',Q._slideObjects.forEach((J,Z)=>{var G,B,W,U,V,N,F,M;let v=0,x=0,y=v0("75%","X",Q._presLayout),D=0,z,Y="",H=null,R=null,c=0,m=0,$0=null,_=null,g=(G=J.options)===null||G===void 0?void 0:G.sizing,O=(B=J.options)===null||B===void 0?void 0:B.rounding;if(Q._slideLayout!==void 0&&Q._slideLayout._slideObjects!==void 0&&J.options&&J.options.placeholder)z=Q._slideLayout._slideObjects.filter((A)=>A.options.placeholder===J.options.placeholder)[0];if(J.options=J.options||{},typeof J.options.x!=="undefined")v=v0(J.options.x,"X",Q._presLayout);if(typeof J.options.y!=="undefined")x=v0(J.options.y,"Y",Q._presLayout);if(typeof J.options.w!=="undefined")y=v0(J.options.w,"X",Q._presLayout);if(typeof J.options.h!=="undefined")D=v0(J.options.h,"Y",Q._presLayout);let h=y,f=D;if(z){if(z.options.x||z.options.x===0)v=v0(z.options.x,"X",Q._presLayout);if(z.options.y||z.options.y===0)x=v0(z.options.y,"Y",Q._presLayout);if(z.options.w||z.options.w===0)y=v0(z.options.w,"X",Q._presLayout);if(z.options.h||z.options.h===0)D=v0(z.options.h,"Y",Q._presLayout)}if(J.options.flipH)Y+=' flipH="1"';if(J.options.flipV)Y+=' flipV="1"';if(J.options.rotate)Y+=` rot="${K6(J.options.rotate)}"`;switch(J._type){case D0.table:if(H=J.arrTabRows,R=J.options,c=0,m=0,H[0].forEach((A)=>{$0=A.options||null,c+=($0===null||$0===void 0?void 0:$0.colspan)?Number($0.colspan):1}),_=``,_+=' ',_+=``,_+='',Array.isArray(R.colW)){_+="";for(let A=0;A`}_+=""}else{if(m=R.colW?R.colW:H0,J.options.w&&!R.colW)m=Math.round((typeof J.options.w==="number"?J.options.w:1)/c);_+="";for(let A=0;A`;_+=""}H.forEach((A)=>{var I,n;for(let i=0;i1){let U0=new Array(z0-1).fill(void 0).map(()=>{return{_type:D0.tablecell,options:{rowspan:S},_hmerge:!0}});A.splice(i+1,0,...U0),i+=z0}else i+=1}}),H.forEach((A,I)=>{let n=H[I+1];if(!n)return;A.forEach((i,K0)=>{var z0,S;let U0=i._rowContinue||((z0=i.options)===null||z0===void 0?void 0:z0.rowspan),k=(S=i.options)===null||S===void 0?void 0:S.colspan,u=i._hmerge;if(U0&&U0>1){let Q0={_type:D0.tablecell,options:{colspan:k},_rowContinue:U0-1,_vmerge:!0,_hmerge:u};n.splice(K0,0,Q0)}})}),H.forEach((A,I)=>{let n=0;if(Array.isArray(R.rowH)&&R.rowH[I])n=C0(Number(R.rowH[I]));else if(R.rowH&&!isNaN(Number(R.rowH)))n=C0(Number(R.rowH));else if(J.options.cy||J.options.h)n=Math.round((J.options.h?C0(J.options.h):typeof J.options.cy==="number"?J.options.cy:1)/H.length);_+=``,A.forEach((i)=>{var K0,z0,S,U0,k;let u=i,Q0={rowSpan:((K0=u.options)===null||K0===void 0?void 0:K0.rowspan)>1?u.options.rowspan:void 0,gridSpan:((z0=u.options)===null||z0===void 0?void 0:z0.colspan)>1?u.options.colspan:void 0,vMerge:u._vmerge?1:void 0,hMerge:u._hmerge?1:void 0},E=Object.keys(Q0).map((Z0)=>[Z0,Q0[Z0]]).filter(([,Z0])=>!!Z0).map(([Z0,W0])=>`${String(Z0)}="${String(W0)}"`).join(" ");if(E)E=" "+E;if(u._hmerge||u._vmerge){_+=``;return}let q0=u.options||{};u.options=q0,["align","bold","border","color","fill","fontFace","fontSize","margin","textDirection","underline","valign"].forEach((Z0)=>{if(R[Z0]&&!q0[Z0]&&q0[Z0]!==0)q0[Z0]=R[Z0]});let B0=q0.valign?` anchor="${q0.valign.replace(/^c$/i,"ctr").replace(/^m$/i,"ctr").replace("center","ctr").replace("middle","ctr").replace("top","t").replace("btm","b").replace("bottom","b")}"`:"",w0=q0.textDirection&&q0.textDirection!=="horz"?` vert="${q0.textDirection}"`:"",M0=((U0=(S=u._optImp)===null||S===void 0?void 0:S.fill)===null||U0===void 0?void 0:U0.color)?u._optImp.fill.color:((k=u._optImp)===null||k===void 0?void 0:k.fill)&&typeof u._optImp.fill==="string"?u._optImp.fill:"";M0=M0||q0.fill?q0.fill:"";let b=M0?k1(M0):"",T=q0.margin===0||q0.margin?q0.margin:CJ;if(!Array.isArray(T)&&typeof T==="number")T=[T,T,T,T];let t="";if(T[0]>=1)t=` marL="${Y0(T[3])}" marR="${Y0(T[1])}" marT="${Y0(T[0])}" marB="${Y0(T[2])}"`;else t=` marL="${C0(T[3])}" marR="${C0(T[1])}" marT="${C0(T[0])}" marB="${C0(T[2])}"`;if(_+=`${RJ(u)}`,q0.border&&Array.isArray(q0.border))[{idx:3,name:"lnL"},{idx:1,name:"lnR"},{idx:0,name:"lnT"},{idx:2,name:"lnB"}].forEach((Z0)=>{if(q0.border[Z0.idx].type!=="none")_+=``,_+=`${f0(q0.border[Z0.idx].color)}`,_+=``,_+=``;else _+=``});_+=b,_+=" ",_+=" "}),_+=""}),_+=" ",_+=" ",_+=" ",_+="",q+=_,K++;break;case D0.text:case D0.placeholder:if(!J.options.line&&D===0)D=H0*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+=``,(W=J.options.hyperlink)===null||W===void 0?void 0:W.url)q+=``;if((U=J.options.hyperlink)===null||U===void 0?void 0:U.slide)q+=``;if(q+="",q+="':"/>"),q+=`${J._type==="placeholder"?b5(J):b5(z)}`,q+="",q+=``,q+=``,q+=``,J.shape==="custGeom")q+="",q+="",q+="",q+="",q+="",q+="",q+='',q+="",q+=``,(N=J.options.points)===null||N===void 0||N.forEach((A,I)=>{if("curve"in A)switch(A.curve.type){case"arc":q+=``;break;case"cubic":q+=` - - - - `;break;case"quadratic":q+=` - - - `;break}else if("close"in A)q+="";else if(A.moveTo||I===0)q+=``;else q+=``}),q+="",q+="",q+="";else{if(q+='',J.options.rectRadius)q+=``;else if(J.options.angleRange){for(let A=0;A<2;A++){let I=J.options.angleRange[A];q+=``}if(J.options.arcThicknessRatio)q+=``}q+=""}if(q+=J.options.fill?k1(J.options.fill):"",J.options.line){if(q+=J.options.line.width?``:"",J.options.line.color)q+=k1(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||HJ.color,q+="",q+=` `,q+=` `,q+=` `,q+=" ",q+="";q+="",q+=RJ(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+=" "+b5(z)+"",q+=" ",q+="",(Q._relsMedia||[]).filter((A)=>A.rId===J.imageRid)[0]&&(Q._relsMedia||[]).filter((A)=>A.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(g===null||g===void 0?void 0:g.type){let A=g.w?v0(g.w,"X",Q._presLayout):y,I=g.h?v0(g.h,"Y",Q._presLayout):D,n=v0(g.x||0,"X",Q._presLayout),i=v0(g.y||0,"Y",Q._presLayout);q+=Nz[g.type]({w:h,h:f},{w:A,h:I,x:n,y:i}),h=A,f=I}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||HJ.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+=` ${b5(z)}`,q+=" ",q+=` `,q+=' ',q+=' ',q+=` `,q+=" ",q+=" ",q+="";break;default:q+="";break}}),Q._slideNumberProps){if(!Q._slideNumberProps.align)Q._slideNumberProps.align="left";if(q+="",q+=" ",q+=' ',q+=' ',q+=" ",q+=" ",q+=` `,q+="",q+="`,Q._slideNumberProps.color)q+=k1(Q._slideNumberProps.color);if(Q._slideNumberProps.fontFace)q+=``;q+=""}if(q+="",q+="",Q._slideNumberProps.align.startsWith("l"))q+='';else if(Q._slideNumberProps.align.startsWith("c"))q+='';else if(Q._slideNumberProps.align.startsWith("r"))q+='';else q+='';q+=``,q+=`${Q._slideNum}`,q+=""}return q+="",q+="",q}function v9(Q,$){let q=0,K=''+r0+'';return Q._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+=``}),(Q._relsChart||[]).forEach((J)=>{q=Math.max(q,J.rId),K+=``}),(Q._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+=''}),$.forEach((J,Z)=>{K+=``}),K+="",K}function IJ(Q,$){var q,K;let J="",Z="",G="",B="",W=$?"a:lvl1pPr":"a:pPr",U=Y0(tW),V=`<${W}${Q.options.rtlMode?' rtl="1" ':""}`;{if(Q.options.align)switch(Q.options.align){case"left":V+=' algn="l"';break;case"right":V+=' algn="r"';break;case"center":V+=' algn="ctr"';break;case"justify":V+=' algn="just"';break;default:V+="";break}if(Q.options.lineSpacing)Z=``;else if(Q.options.lineSpacingMultiple)Z=``;if(Q.options.indentLevel&&!isNaN(Number(Q.options.indentLevel))&&Q.options.indentLevel>0)V+=` lvl="${Q.options.indentLevel}"`;if(Q.options.paraSpaceBefore&&!isNaN(Number(Q.options.paraSpaceBefore))&&Q.options.paraSpaceBefore>0)G+=``;if(Q.options.paraSpaceAfter&&!isNaN(Number(Q.options.paraSpaceAfter))&&Q.options.paraSpaceAfter>0)G+=``;if(typeof Q.options.bullet==="object"){if((K=(q=Q===null||Q===void 0?void 0:Q.options)===null||q===void 0?void 0:q.bullet)===null||K===void 0?void 0:K.indent)U=Y0(Q.options.bullet.indent);if(Q.options.bullet.type){if(Q.options.bullet.type.toString().toLowerCase()==="number")V+=` marL="${Q.options.indentLevel&&Q.options.indentLevel>0?U+U*Q.options.indentLevel:U}" indent="-${U}"`,J=``}else if(Q.options.bullet.characterCode){let N=`&#x${Q.options.bullet.characterCode};`;if(!/^[0-9A-Fa-f]{4}$/.test(Q.options.bullet.characterCode))console.warn("Warning: `bullet.characterCode should be a 4-digit unicode charatcer (ex: 22AB)`!"),N=_6.DEFAULT;V+=` marL="${Q.options.indentLevel&&Q.options.indentLevel>0?U+U*Q.options.indentLevel:U}" indent="-${U}"`,J=''}else if(Q.options.bullet.code){let N=`&#x${Q.options.bullet.code};`;if(!/^[0-9A-Fa-f]{4}$/.test(Q.options.bullet.code))console.warn("Warning: `bullet.code should be a 4-digit hex code (ex: 22AB)`!"),N=_6.DEFAULT;V+=` marL="${Q.options.indentLevel&&Q.options.indentLevel>0?U+U*Q.options.indentLevel:U}" indent="-${U}"`,J=''}else V+=` marL="${Q.options.indentLevel&&Q.options.indentLevel>0?U+U*Q.options.indentLevel:U}" indent="-${U}"`,J=``}else if(Q.options.bullet)V+=` marL="${Q.options.indentLevel&&Q.options.indentLevel>0?U+U*Q.options.indentLevel:U}" indent="-${U}"`,J=``;else if(!Q.options.bullet)V+=' indent="0" marL="0"',J="";if(Q.options.tabStops&&Array.isArray(Q.options.tabStops))B=`${Q.options.tabStops.map((F)=>``).join("")}`;if(V+=">"+Z+G+J+B,$)V+=OJ(Q.options,!0);V+=""}return V}function OJ(Q,$){var q;let K="",J=$?"a:defRPr":"a:rPr";if(K+="<"+J+' lang="'+(Q.lang?Q.lang:"en-US")+'"'+(Q.lang?' altLang="en-US"':""),K+=Q.fontSize?` sz="${Math.round(Q.fontSize*100)}"`:"",K+=(Q===null||Q===void 0?void 0:Q.bold)?` b="${Q.bold?"1":"0"}"`:"",K+=(Q===null||Q===void 0?void 0:Q.italic)?` i="${Q.italic?"1":"0"}"`:"",K+=(Q===null||Q===void 0?void 0:Q.strike)?` strike="${typeof Q.strike==="string"?Q.strike:"sngStrike"}"`:"",typeof Q.underline==="object"&&((q=Q.underline)===null||q===void 0?void 0:q.style))K+=` u="${Q.underline.style}"`;else if(typeof Q.underline==="string")K+=` u="${String(Q.underline)}"`;else if(Q.hyperlink)K+=' u="sng"';if(Q.baseline)K+=` baseline="${Math.round(Q.baseline*50)}"`;else if(Q.subscript)K+=' baseline="-40000"';else if(Q.superscript)K+=' baseline="30000"';if(K+=Q.charSpacing?` spc="${Math.round(Q.charSpacing*100)}" kern="0"`:"",K+=' dirty="0">',Q.color||Q.fontFace||Q.outline||typeof Q.underline==="object"&&Q.underline.color){if(Q.outline&&typeof Q.outline==="object")K+=`${k1(Q.outline.color||"FFFFFF")}`;if(Q.color)K+=k1({color:Q.color,transparency:Q.transparency});if(Q.highlight)K+=`${f0(Q.highlight)}`;if(typeof Q.underline==="object"&&Q.underline.color)K+=`${k1(Q.underline.color)}`;if(Q.glow)K+=`${Kz(Q.glow,Qz)}`;if(Q.fontFace)K+=``}if(Q.hyperlink){if(typeof Q.hyperlink!=="object")throw new Error("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink:{url:'https://github.com'}` ");else if(!Q.hyperlink.url&&!Q.hyperlink.slide)throw new Error("ERROR: 'hyperlink requires either `url` or `slide`'");else if(Q.hyperlink.url)K+=`":"/>"}`;else if(Q.hyperlink.slide)K+=`":"/>"}`;if(Q.color)K+=" ",K+=' ',K+=' ',K+=" ",K+=" ",K+=""}return K+=``,K}function Yz(Q){return Q.text?`${OJ(Q.options,!1)}${L0(Q.text)}`:""}function Lz(Q){let $="";else if(Q.options.fit==="resize")$+=""}if(Q.options.shrinkText)$+="";$+=Q.options._bodyProp.autoFit?"":"",$+="
"}else $+=' wrap="square" rtlCol="0">',$+="
";return Q._type===D0.tablecell?"":$}function RJ(Q){let $=Q.options||{},q=[],K=[];if($&&Q._type!==D0.tablecell&&(typeof Q.text==="undefined"||Q.text===null))return"";let J=Q._type===D0.tablecell?"":"";if(J+=Lz(Q),$.h===0&&$.line&&$.align)J+='';else if(Q._type==="placeholder")J+=`${IJ(Q,!0)}`;else J+="";if(typeof Q.text==="string"||typeof Q.text==="number")q.push({text:Q.text.toString(),options:$||{}});else if(Q.text&&!Array.isArray(Q.text)&&typeof Q.text==="object"&&Object.keys(Q.text).includes("text"))q.push({text:Q.text||"",options:Q.options||{}});else if(Array.isArray(Q.text))q=Q.text.map((B)=>({text:B.text,options:B.options}));q.forEach((B,W)=>{if(!B.text)B.text="";if(B.options=B.options||$||{},W===0&&B.options&&!B.options.bullet&&$.bullet)B.options.bullet=$.bullet;if(typeof B.text==="string"||typeof B.text==="number")B.text=B.text.toString().replace(/\r*\n/g,r0);if(B.text.includes(r0)&&B.text.match(/\n$/g)===null)B.text.split(r0).forEach((U)=>{B.options.breakLine=!0,K.push({text:U,options:B.options})});else K.push(B)});let Z=[],G=[];if(K.forEach((B,W)=>{if(G.length>0&&(B.options.align||$.align)){if(B.options.align!==K[W-1].options.align)Z.push(G),G=[]}else if(G.length>0&&B.options.bullet&&G.length>0)Z.push(G),G=[],B.options.breakLine=!1;if(G.push(B),G.length>0&&B.options.breakLine){if(W+1{var W;let U=!1;J+="";let V=`{if(N.options._lineIdx=F,F>0&&N.options.softBreakBefore)J+="";if(N.options.align=N.options.align||$.align,N.options.lineSpacing=N.options.lineSpacing||$.lineSpacing,N.options.lineSpacingMultiple=N.options.lineSpacingMultiple||$.lineSpacingMultiple,N.options.indentLevel=N.options.indentLevel||$.indentLevel,N.options.paraSpaceBefore=N.options.paraSpaceBefore||$.paraSpaceBefore,N.options.paraSpaceAfter=N.options.paraSpaceAfter||$.paraSpaceAfter,V=IJ(N,!1),J+=V.replace("",""),Object.entries($).filter(([M])=>!(N.options.hyperlink&&M==="color")).forEach(([M,v])=>{if(M!=="bullet"&&!N.options[M])N.options[M]=v}),J+=Yz(N),!N.text&&$.fontSize||N.options.fontSize)U=!0,$.fontSize=$.fontSize||N.options.fontSize}),Q._type===D0.tablecell&&($.fontSize||$.fontFace))if($.fontFace)J+=`',J+=``,J+=``,J+=``,J+="";else J+=`';else if(U)J+=`';else J+=``;J+=""}),J.indexOf("")===-1)J+="";return J+=Q._type===D0.tablecell?"":"",J}function b5(Q){var $,q;if(!Q)return"";let K=(($=Q.options)===null||$===void 0?void 0:$._placeholderIdx)?Q.options._placeholderIdx:"",J=((q=Q.options)===null||q===void 0?void 0:q._placeholderType)?Q.options._placeholderType:"",Z=J&&O8[J]?O8[J].toString():"";return``}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+=` + + + + `;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`0?' hasCustomPrompt="1"':""} - />`}function Dz(Q,$,q){let K=''+r0;return K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',K+='',Q.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+='',Q.forEach((J,Z)=>{K+=``,K+=``,J._relsChart.forEach((G)=>{K+=``})}),K+='',K+='',K+='',K+='',$.forEach((J,Z)=>{K+=``,(J._relsChart||[]).forEach((G)=>{K+=' '})}),Q.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 Hz(){return`${r0} + ${Z&&F8[Z]?` type="${Z}"`:""} + ${$.text&&$.text.length>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 kz(Q,$){return`${r0} + `}function _B($,q){return`${n0} 0 0 Microsoft Office PowerPoint On-screen Show (16:9) 0 - ${Q.length} - ${Q.length} + ${$.length} + ${$.length} 0 0 false @@ -88,38 +87,38 @@ ${String(N)}`)}if(K&&Z&&V.path.startsWith("http"))return yield new Promise((N,F) Theme 1 Slide Titles - ${Q.length} + ${$.length} - + Arial Calibri Office Theme - ${Q.map((q,K)=>`Slide ${K+1}`).join("")} + ${$.map((Q,K)=>`Slide ${K+1}`).join("")} - ${$} + ${q} false false false 16.0000 - `}function vz(Q,$,q,K){return` + `}function cB($,q,Q,K){return` - ${L0(Q)} - ${L0($)} - ${L0(q)} - ${L0(q)} + ${k0($)} + ${k0(q)} + ${k0(Q)} + ${k0(Q)} ${K} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} ${new Date().toISOString().replace(/\.\d\d\dZ/,"Z")} - `}function Iz(Q){let $=1,q=''+r0;q+='',q+='';for(let K=1;K<=Q.length;K++)q+=``;return $++,q+=``,q}function Rz(Q){return`${r0}${k9(Q)}`}function Cz(Q){let $="";return Q._slideObjects.forEach((q)=>{if(q._type===D0.notes)$+=(q===null||q===void 0?void 0:q.text)&&q.text[0]?q.text[0].text:""}),$.replace(/\r*\n/g,r0)}function jz(){return`${r0}7/23/19Click to edit Master text stylesSecond levelThird levelFourth levelFifth level‹#›`}function fz(Q){return`${r0}${L0(Cz(Q))}${Q._slideNum}`}function Az(Q){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` - ${k9(Q)} - `}function gz(Q,$){let q=$.map((J,Z)=>``),K=''+r0;return K+='',K+=k9(Q),K+='',K+=""+q.join("")+"",K+='',K+=' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' ',K+="",K}function Xz(Q,$){return v9($[Q-1],[{target:"../slideMasters/slideMaster1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"}])}function yz(Q,$,q){return v9(Q[q-1],[{target:`../slideLayouts/slideLayout${Pz(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 hz(Q){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 xz(Q,$){let 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"}),v9(Q,q)}function Oz(){return`${r0} + + `}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 Pz(Q,$,q){for(let K=0;K<$.length;K++)if($[K]._name===Q[q-1]._slideLayout._name)return K+1;return 1}function Tz(Q){var $,q,K,J;let Z=(($=Q.theme)===null||$===void 0?void 0:$.headFontFace)?``:'',G=((K=Q.theme)===null||K===void 0?void 0:K.bodyFontFace)?``:'';return`${Z}${G}`}function Ez(Q){let $=`${r0}`;$+='',$+="",Q.slides.forEach((q)=>$+=``),$+="",$+=``,$+=``,$+=``,$+="";for(let q=1;q<10;q++)$+=``;if($+="",Q.sections&&Q.sections.length>0)$+='',$+='',Q.sections.forEach((q)=>{$+=``,q._slides.forEach((K)=>$+=``),$+=""}),$+="",$+='',$+="";return $+="",$}function Sz(){return`${r0}`}function uz(){return`${r0}`}function _z(){return`${r0}`}var cz="4.0.1";class I9{set layout(Q){let $=this.LAYOUTS[Q];if($)this._layout=Q,this._presLayout=$;else throw new Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author(Q){this._author=Q}get author(){return this._author}set company(Q){this._company=Q}get company(){return this._company}set revision(Q){this._revision=Q}get revision(){return this._revision}set subject(Q){this._subject=Q}get subject(){return this._subject}set theme(Q){this._theme=Q}get theme(){return this._theme}set title(Q){this._title=Q}get title(){return this._title}set rtlMode(Q){this._rtlMode=Q}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=cz,this._alignH=w9,this._alignV=N9,this._chartType=F9,this._outputType=z9,this._schemeColor=D1,this._shapeType=M9,this._charts=F0,this._colors=p5,this._shapes=j2,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===B9)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((B)=>G.push(Fz(B,Z))),J._relsMedia.forEach((B)=>{if(B.type!=="online"&&B.type!=="hyperlink"){let W=B.data&&typeof B.data==="string"?B.data:"";if(!W.includes(",")&&!W.includes(";"))W="image/png;base64,"+W;else if(!W.includes(","))W="image/png;base64,"+W;else if(!W.includes(";"))W="image/png;"+W;Z.file(B.Target.replace("..","ppt"),W.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>H1(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 B=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=B,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(B),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>H1(this,void 0,void 0,function*(){let Z=[],G=[],B=new L9.default;return this.slides.forEach((W)=>{G=G.concat(G9(W))}),this.slideLayouts.forEach((W)=>{G=G.concat(G9(W))}),G=G.concat(G9(this.masterSlide)),yield Promise.all(G).then(()=>H1(this,void 0,void 0,function*(){return this.slides.forEach((W)=>{if(W._slideLayout)zz(W)}),B.folder("_rels"),B.folder("docProps"),B.folder("ppt").folder("_rels"),B.folder("ppt/charts").folder("_rels"),B.folder("ppt/embeddings"),B.folder("ppt/media"),B.folder("ppt/slideLayouts").folder("_rels"),B.folder("ppt/slideMasters").folder("_rels"),B.folder("ppt/slides").folder("_rels"),B.folder("ppt/theme"),B.folder("ppt/notesMasters").folder("_rels"),B.folder("ppt/notesSlides").folder("_rels"),B.file("[Content_Types].xml",Dz(this.slides,this.slideLayouts,this.masterSlide)),B.file("_rels/.rels",Hz()),B.file("docProps/app.xml",kz(this.slides,this.company)),B.file("docProps/core.xml",vz(this.title,this.subject,this.author,this.revision)),B.file("ppt/_rels/presentation.xml.rels",Iz(this.slides)),B.file("ppt/theme/theme1.xml",Tz(this)),B.file("ppt/presentation.xml",Ez(this)),B.file("ppt/presProps.xml",Sz()),B.file("ppt/tableStyles.xml",uz()),B.file("ppt/viewProps.xml",_z()),this.slideLayouts.forEach((W,U)=>{B.file(`ppt/slideLayouts/slideLayout${U+1}.xml`,Az(W)),B.file(`ppt/slideLayouts/_rels/slideLayout${U+1}.xml.rels`,Xz(U+1,this.slideLayouts))}),this.slides.forEach((W,U)=>{B.file(`ppt/slides/slide${U+1}.xml`,Rz(W)),B.file(`ppt/slides/_rels/slide${U+1}.xml.rels`,yz(this.slides,this.slideLayouts,U+1)),B.file(`ppt/notesSlides/notesSlide${U+1}.xml`,fz(W)),B.file(`ppt/notesSlides/_rels/notesSlide${U+1}.xml.rels`,hz(U+1))}),B.file("ppt/slideMasters/slideMaster1.xml",gz(this.masterSlide,this.slideLayouts)),B.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",xz(this.masterSlide,this.slideLayouts)),B.file("ppt/notesMasters/notesMaster1.xml",jz()),B.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",Oz()),this.slideLayouts.forEach((W)=>{this.createChartMediaRels(W,B,Z)}),this.slides.forEach((W)=>{this.createChartMediaRels(W,B,Z)}),this.createChartMediaRels(this.masterSlide,B,Z),yield Promise.all(Z).then(()=>H1(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield B.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield B.generateAsync({type:J.outputType});else return yield B.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let Q={name:"screen4x3",width:9144000,height:6858000},$={name:"screen16x9",width:9144000,height:5143500},q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:Q,LAYOUT_16x9:$,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[E6].name,_sizeW:this.LAYOUTS[E6].width,_sizeH:this.LAYOUTS[E6].height,width:this.LAYOUTS[E6].width,height:this.LAYOUTS[E6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:P8,_name:B9,_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(Q){return H1(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:Q===null||Q===void 0?void 0:Q.compression,outputType:"STREAM"})})}write(Q){return H1(this,void 0,void 0,function*(){let $=typeof Q==="object"&&(Q===null||Q===void 0?void 0:Q.outputType)?Q.outputType:Q?Q:null,q=typeof Q==="object"&&(Q===null||Q===void 0?void 0:Q.compression)?Q.compression:!1;return yield this.exportPresentation({compression:q,outputType:$})})}writeFile(Q){return H1(this,void 0,void 0,function*(){var $,q;let K=typeof process!=="undefined"&&!!(($=process.versions)===null||$===void 0?void 0:$.node)&&((q=process.release)===null||q===void 0?void 0:q.name)==="node";if(typeof Q==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),Q={fileName:Q};let{fileName:J="Presentation.pptx",compression:Z=!1}=Q,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,B=K?"nodebuffer":null,W=yield this.exportPresentation({compression:Z,outputType:B});if(K){let{promises:U}=yield import("node:fs"),{writeFile:V}=U;return yield V(G,W),G}return yield this.writeFileToBrowser(G,W),G})}addSection(Q){if(!Q)console.warn("addSection requires an argument");else if(!Q.title)console.warn("addSection requires a title");let $={_type:"user",_slides:[],title:Q.title};if(Q.order)this.sections.splice(Q.order,0,$);else this._sections.push($)}addSlide(Q){let $=typeof Q==="string"?Q:(Q===null||Q===void 0?void 0:Q.masterName)?Q.masterName:"",q={_name:this.LAYOUTS[E6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if($){let J=this.slideLayouts.filter((Z)=>Z._name===$)[0];if(J)q=J}let K=new xJ({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),Q===null||Q===void 0?void 0:Q.sectionTitle){let J=this.sections.filter((Z)=>Z.title===Q.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${Q.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!(Q===null||Q===void 0?void 0:Q.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(Q){if(!Q)console.warn("defineLayout requires `{name, width, height}`");else if(!Q.name)console.warn("defineLayout requires `name`");else if(!Q.width)console.warn("defineLayout requires `width`");else if(!Q.height)console.warn("defineLayout requires `height`");else if(typeof Q.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof Q.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[Q.name]={name:Q.name,_sizeW:Math.round(Number(Q.width)*H0),_sizeH:Math.round(Number(Q.height)*H0),width:Math.round(Number(Q.width)*H0),height:Math.round(Number(Q.height)*H0)}}defineSlideMaster(Q){let $=JSON.parse(JSON.stringify(Q));if(!$.title)throw new Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let q={_margin:$.margin||P8,_name:$.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:$.slideNumber||null,_slideObjects:[],background:$.background||null,bkgd:$.bkgd||null};if(Zz($,q),this.slideLayouts.push(q),$.background||$.bkgd)hJ($.background,q);if(q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=q._slideNumberProps}tableToSlides(Q,$={}){Uz(this,Q,$,($===null||$===void 0?void 0:$.masterSlideName)?this.slideLayouts.filter((q)=>q._name===$.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer==="undefined")globalThis.Buffer=J0;if(typeof globalThis.process==="undefined")globalThis.process=bz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=I9;})(); + `}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/execution/sandbox/bundles/verify.test.ts b/apps/sim/lib/execution/sandbox/bundles/verify.test.ts new file mode 100644 index 00000000000..d5e1651f154 --- /dev/null +++ b/apps/sim/lib/execution/sandbox/bundles/verify.test.ts @@ -0,0 +1,40 @@ +/** + * @vitest-environment node + */ +import { readFileSync } from 'node:fs' +import { describe, expect, it } from 'vitest' +import { evaluateSandboxBundle } from '@/lib/execution/sandbox/bundles/verify' +import type { SandboxBundleName } from '@/lib/execution/sandbox/types' + +function loadCheckedInBundle(name: SandboxBundleName): Record { + const source = readFileSync(new URL(`./${name}.cjs`, import.meta.url), 'utf-8') + return evaluateSandboxBundle(source, name) as Record +} + +/** + * The checked-in bundles are what Trigger.dev workers run verbatim, so this is + * the only place a bundle that throws while being evaluated is caught before a + * deploy. Each case asserts the surface the matching sandbox task's bootstrap + * and finalize scripts reach for. + */ +describe('sandbox bundles', () => { + it('docx evaluates in a bare context and exposes the docx-generate surface', () => { + const docx = loadCheckedInBundle('docx') + expect(typeof docx.Document).toBe('function') + expect(typeof docx.Packer).toBe('function') + expect(typeof docx.ImageRun).toBe('function') + expect(typeof docx.Paragraph).toBe('function') + }) + + it('pdf-lib evaluates in a bare context and exposes the pdf-generate surface', () => { + const pdfLib = loadCheckedInBundle('pdf-lib') + expect(typeof pdfLib.PDFDocument).toBe('function') + expect(typeof pdfLib.rgb).toBe('function') + expect(typeof pdfLib.StandardFonts).toBe('object') + }) + + it('pptxgenjs evaluates in a bare context and exposes its constructor', () => { + const source = readFileSync(new URL('./pptxgenjs.cjs', import.meta.url), 'utf-8') + expect(typeof evaluateSandboxBundle(source, 'pptxgenjs')).toBe('function') + }) +}) diff --git a/apps/sim/lib/execution/sandbox/bundles/verify.ts b/apps/sim/lib/execution/sandbox/bundles/verify.ts new file mode 100644 index 00000000000..ebd509a4a37 --- /dev/null +++ b/apps/sim/lib/execution/sandbox/bundles/verify.ts @@ -0,0 +1,39 @@ +import vm from 'node:vm' +import type { SandboxBundleName } from '@/lib/execution/sandbox/types' + +/** + * Evaluates a built sandbox bundle the way the isolated-vm worker will: as a + * classic script in a context that has timers, `console`, and the text codecs + * but no `require`, `process`, or `Buffer` of its own. Returns the export the + * bundle registered on `globalThis.__bundles`, or throws with the bundle's own + * error, so a bundle that references a helper the bundler never emitted fails + * at build time and in the test suite instead of on the first document + * generated in production. + */ +export function evaluateSandboxBundle(source: string, name: SandboxBundleName): unknown { + const context: Record = { + setTimeout, + clearTimeout, + setInterval, + clearInterval, + queueMicrotask, + console, + TextEncoder, + TextDecoder, + } + context.globalThis = context + vm.createContext(context) + vm.runInContext(source, context, { filename: `sandbox/${name}.cjs` }) + + const bundles = context.__bundles + const bundle = + typeof bundles === 'object' && bundles !== null + ? (bundles as Record)[name] + : undefined + if (bundle === undefined || bundle === null) { + throw new Error( + `Sandbox bundle "${name}" evaluated without registering globalThis.__bundles["${name}"]` + ) + } + return bundle +} diff --git a/apps/sim/lib/internal/mcp/discover-tools.ts b/apps/sim/lib/internal/mcp/discover-tools.ts index 78050f11e9c..8d8be851166 100644 --- a/apps/sim/lib/internal/mcp/discover-tools.ts +++ b/apps/sim/lib/internal/mcp/discover-tools.ts @@ -1,7 +1,10 @@ +import { MANAGED_MCP_DELEGATION_AUDIENCE } from '@/lib/credentials/application/authorization' +import { discoverManagedMcpToolsUseCase } from '@/lib/credentials/application/discover-managed-mcp-tools' import { createExecutorPrincipalFromExecutionContext } from '@/lib/internal/principals/executor' import type { InternalToolOperationContext } from '@/lib/internal/tool-operations/types' import { MCP_SERVER_DELEGATION_AUDIENCE } from '@/lib/mcp/application/authorization' import { discoverMcpServerToolsUseCase } from '@/lib/mcp/application/use-cases' +import { isManagedMcpConnectionId, MANAGED_MCP_CONNECTION_PREFIX } from '@/lib/mcp/utils' export interface DiscoverMcpServerToolsAsExecutorInput { workspaceId: string @@ -17,15 +20,34 @@ export async function discoverMcpServerToolsAsExecutor({ signal, }: DiscoverMcpServerToolsAsExecutorInput) { signal?.throwIfAborted() + if (serverId.startsWith(MANAGED_MCP_CONNECTION_PREFIX)) { + if (!isManagedMcpConnectionId(serverId)) { + throw new Error('Invalid managed MCP connection ID') + } + const principal = await createExecutorPrincipalFromExecutionContext({ + context, + audience: MANAGED_MCP_DELEGATION_AUDIENCE, + resourceScope: { credentialId: serverId }, + }) + signal?.throwIfAborted() + const result = await discoverManagedMcpToolsUseCase.execute({ + principal, + input: { workspaceId, credentialId: serverId, signal }, + }) + signal?.throwIfAborted() + return result.tools + } + const principal = await createExecutorPrincipalFromExecutionContext({ context, audience: MCP_SERVER_DELEGATION_AUDIENCE, + resourceScope: { mcpServerId: serverId }, }) signal?.throwIfAborted() const result = await discoverMcpServerToolsUseCase.execute({ principal, - input: { workspaceId, serverId }, + input: { workspaceId, serverId, signal, requireComplete: true }, }) signal?.throwIfAborted() return result.tools diff --git a/apps/sim/lib/internal/mcp/execute-tool.test.ts b/apps/sim/lib/internal/mcp/execute-tool.test.ts index c85e58471af..f858701bfa2 100644 --- a/apps/sim/lib/internal/mcp/execute-tool.test.ts +++ b/apps/sim/lib/internal/mcp/execute-tool.test.ts @@ -93,6 +93,7 @@ describe('executeMcpTool', () => { expect(mocks.createPrincipal).toHaveBeenCalledWith({ context: CONTEXT, audience: 'sim:mcp-servers', + resourceScope: { mcpServerId: 'mcp-server' }, }) expect(mocks.executeUseCase).toHaveBeenCalledWith({ principal: PRINCIPAL, diff --git a/apps/sim/lib/internal/mcp/execute-tool.ts b/apps/sim/lib/internal/mcp/execute-tool.ts index 3e900d81af2..0f1b459f98f 100644 --- a/apps/sim/lib/internal/mcp/execute-tool.ts +++ b/apps/sim/lib/internal/mcp/execute-tool.ts @@ -9,6 +9,8 @@ import { getRemainingExecutionMs, } from '@/lib/core/execution-limits' import { asOrchestrationError, statusForOrchestrationError } from '@/lib/core/orchestration/types' +import { MANAGED_MCP_DELEGATION_AUDIENCE } from '@/lib/credentials/application/authorization' +import { ManagedMcpCredentialError } from '@/lib/credentials/managed-mcp' import { createExecutorPrincipalFromExecutionContext } from '@/lib/internal/principals/executor' import { classifyInternalToolIdentityFault, @@ -17,10 +19,11 @@ import { } from '@/lib/internal/tool-operations/identity-faults' import type { InternalToolOperationHandler } from '@/lib/internal/tool-operations/types' import { MCP_SERVER_DELEGATION_AUDIENCE } from '@/lib/mcp/application/authorization' +import { executeManagedMcpToolUseCase } from '@/lib/mcp/application/execute-managed-tool' import { executeMcpToolUseCase, McpToolsNotAllowedError } from '@/lib/mcp/application/execute-tool' import { McpOauthRedirectRequired } from '@/lib/mcp/oauth' import { McpOauthAuthorizationRequiredError } from '@/lib/mcp/types' -import { categorizeError, parseMcpToolId } from '@/lib/mcp/utils' +import { categorizeError, parseMcpToolTarget } from '@/lib/mcp/utils' import { ResolvedSecretTraceProvenanceAccumulator, type ResolvedSecretTraceRegistry, @@ -89,16 +92,17 @@ async function createResponse( export const executeMcpTool: InternalToolOperationHandler = async (request) => { request.signal?.throwIfAborted() - let serverId: string - let toolName: string + let target: ReturnType try { - ;({ serverId, toolName } = parseMcpToolId(request.toolId)) + target = parseMcpToolTarget(request.toolId) } catch (error) { return Response.json( { success: false, error: getErrorMessage(error, 'Invalid MCP tool ID') }, { status: 400 } ) } + const toolName = target.toolName + const targetId = target.kind === 'shared_server' ? target.serverId : target.credentialId if (!request.context.workspaceId) { return Response.json( @@ -126,7 +130,13 @@ export const executeMcpTool: InternalToolOperationHandler = async (request) => { try { const principal = await createExecutorPrincipalFromExecutionContext({ context: request.context, - audience: MCP_SERVER_DELEGATION_AUDIENCE, + audience: + target.kind === 'shared_server' + ? MCP_SERVER_DELEGATION_AUDIENCE + : MANAGED_MCP_DELEGATION_AUDIENCE, + ...(target.kind === 'managed_connection' + ? { resourceScope: { credentialId: target.credentialId } } + : { resourceScope: { mcpServerId: target.serverId } }), }) request.signal?.throwIfAborted() const subject = resolvePrincipalSubject(principal) @@ -144,21 +154,35 @@ export const executeMcpTool: InternalToolOperationHandler = async (request) => { policyTimeoutMs, getRemainingExecutionMs(request.signal) ) - const result = await executeMcpToolUseCase.execute({ - principal, - input: { - workspaceId: request.context.workspaceId, - serverId, - toolName, - arguments: args, - callChain: request.context.callChain, - timeoutMs, - signal: request.signal, - onResolvedSecretTraceProvenance: provenance - ? (value) => provenance?.record(value) - : undefined, - }, - }) + const result = + target.kind === 'shared_server' + ? await executeMcpToolUseCase.execute({ + principal, + input: { + workspaceId: request.context.workspaceId, + serverId: target.serverId, + toolName, + arguments: args, + callChain: request.context.callChain, + timeoutMs, + signal: request.signal, + onResolvedSecretTraceProvenance: provenance + ? (value) => provenance?.record(value) + : undefined, + }, + }) + : await executeManagedMcpToolUseCase.execute({ + principal, + input: { + workspaceId: request.context.workspaceId, + credentialId: target.credentialId, + toolName, + arguments: args, + callChain: request.context.callChain, + timeoutMs, + signal: request.signal, + }, + }) request.signal?.throwIfAborted() const body = result.success ? { success: true, data: { success: true, output: result.output } } @@ -188,13 +212,27 @@ export const executeMcpTool: InternalToolOperationHandler = async (request) => { request.toolId ) } + if (error instanceof ManagedMcpCredentialError && error.statusCode === 401) { + return createResponse( + { + success: false, + error: 'OAuth re-authorization required', + code: 'reauth_required', + serverId: targetId, + }, + 401, + provenance, + request.context.resolvedSecretTraceRegistry, + request.toolId + ) + } if ( error instanceof McpOauthAuthorizationRequiredError || error instanceof McpOauthRedirectRequired || error instanceof UnauthorizedError ) { const oauthServerId = - error instanceof McpOauthAuthorizationRequiredError ? error.serverId : serverId + error instanceof McpOauthAuthorizationRequiredError ? error.serverId : targetId return createResponse( { success: false, @@ -209,6 +247,19 @@ export const executeMcpTool: InternalToolOperationHandler = async (request) => { ) } + if (error instanceof ManagedMcpCredentialError) { + return createResponse( + { + success: false, + error: error.statusCode === 404 ? 'Resource not found' : 'Managed MCP connection failed', + }, + error.statusCode, + provenance, + request.context.resolvedSecretTraceRegistry, + request.toolId + ) + } + const orchestrationError = asOrchestrationError(error) if (orchestrationError) { const message = @@ -230,7 +281,7 @@ export const executeMcpTool: InternalToolOperationHandler = async (request) => { logger.error('MCP tool execution failed', { error: getErrorMessage(error), requestId: request.requestId, - serverId, + serverId: targetId, toolName, }) return createResponse( diff --git a/apps/sim/lib/mcp/application/authorization.ts b/apps/sim/lib/mcp/application/authorization.ts index 38a67e73f09..fba4915e18a 100644 --- a/apps/sim/lib/mcp/application/authorization.ts +++ b/apps/sim/lib/mcp/application/authorization.ts @@ -1,6 +1,7 @@ import { type Principal, resolvePrincipalExecutionActorUserId } from '@sim/auth/principal' import type { WorkspaceDelegationPolicy } from '@/lib/core/application' import { OrchestrationError } from '@/lib/core/orchestration/types' +import type { McpServerContext } from '@/lib/mcp/application/context' export const MCP_SERVER_DELEGATION_AUDIENCE = 'sim:mcp-servers' @@ -13,6 +14,14 @@ export const mcpServerDelegationPolicy = { allowPersonalApiKeys: boolean }> +export const mcpServerExecutionDelegationPolicy = { + audience: MCP_SERVER_DELEGATION_AUDIENCE, + isWithinScope: ( + principal: Extract, + context: McpServerContext + ) => principal.resourceScope?.mcpServerId === context.server.id, +} satisfies WorkspaceDelegationPolicy + /** * The user whose MCP server credentials an operation presents. * diff --git a/apps/sim/lib/mcp/application/execute-managed-tool.test.ts b/apps/sim/lib/mcp/application/execute-managed-tool.test.ts new file mode 100644 index 00000000000..7d1f44a1ae6 --- /dev/null +++ b/apps/sim/lib/mcp/application/execute-managed-tool.test.ts @@ -0,0 +1,216 @@ +/** + * @vitest-environment node + */ +import type { WorkflowExecutionDelegatedPrincipal } from '@sim/auth/principal' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + discoverTools: vi.fn(), + executeTool: vi.fn(), + loadAuthProvider: vi.fn(), + loadContext: vi.fn(), + loadRuntime: vi.fn(), + requireCredentialAccess: vi.fn(), + resolvePermission: vi.fn(), + saveToolSnapshot: vi.fn(), +})) + +vi.mock('@/lib/credentials/managed-mcp', () => ({ + loadManagedMcpCredentialApplicationContext: mocks.loadContext, + loadManagedMcpRuntimeCredential: mocks.loadRuntime, + saveManagedMcpToolSnapshot: mocks.saveToolSnapshot, +})) + +vi.mock('@/lib/credential-groups/application/authorization', () => ({ + requireCredentialGroupCredentialAccess: mocks.requireCredentialAccess, +})) + +vi.mock('@/lib/mcp/service', () => ({ + mcpService: { + discoverManagedMcpTools: mocks.discoverTools, + executeManagedMcpTool: mocks.executeTool, + }, +})) + +vi.mock('@/lib/mcp/oauth', () => ({ + withMcpOauthRefreshLock: vi.fn((_credentialId: string, operation: () => Promise) => + operation() + ), +})) + +vi.mock('@/lib/mcp/application/managed-auth-provider', () => ({ + loadManagedMcpAuthProvider: mocks.loadAuthProvider, +})) + +vi.mock('@sim/platform-authz/workspace', () => ({ + permissionSatisfies: (permission: string | null, required: string) => + permission === 'admin' || permission === 'write' || permission === required, + resolveEffectiveWorkspacePermission: mocks.resolvePermission, +})) + +import { executeManagedMcpToolUseCase } from '@/lib/mcp/application/execute-managed-tool' + +const context = { + credentialId: 'mcp-cg-123456789012345678901', + credentialGroupId: 'group-1', + credentialGroupEnrollmentId: 'enrollment-1', + mcpServerId: 'mcp-server-1', + mcpServerName: 'Fireflies', + workspaceId: 'workspace-1', + workspaceOrganizationId: null, + allowPersonalApiKeys: true, +} + +const principal: WorkflowExecutionDelegatedPrincipal = { + kind: 'delegated', + serviceId: 'executor', + subjectUserId: 'user-1', + workspaceId: 'workspace-1', + delegationId: 'delegation-1', + audience: 'sim:managed-mcp-credentials', + issuedAt: new Date(Date.now() - 1_000), + expiresAt: new Date(Date.now() + 60_000), + resourceScope: { credentialId: context.credentialId }, + delegationContext: { + kind: 'workflow_execution', + workflowId: 'workflow-1', + principal: { kind: 'session', userId: 'user-1', sessionId: 'session-1' }, + currentWorkflow: { + workflowId: 'workflow-1', + mode: 'deployment', + deploymentVersionId: 'version-1', + }, + }, +} + +describe('executeManagedMcpToolUseCase', () => { + beforeEach(() => { + vi.clearAllMocks() + mocks.loadContext.mockResolvedValue(context) + mocks.loadRuntime.mockResolvedValue({ + credentialId: context.credentialId, + mcpServerId: context.mcpServerId, + mcpServerName: context.mcpServerName, + workspaceId: context.workspaceId, + tokenVersion: 'encrypted-token-version-1', + tokens: { access_token: 'access-token' }, + tools: [], + }) + mocks.requireCredentialAccess.mockResolvedValue(undefined) + mocks.resolvePermission.mockResolvedValue('read') + mocks.loadAuthProvider.mockResolvedValue({}) + mocks.discoverTools.mockResolvedValue([]) + mocks.executeTool.mockResolvedValue({ content: [{ type: 'text', text: 'done' }] }) + }) + + it('does not load token material when Credential Group policy denies execution', async () => { + mocks.requireCredentialAccess.mockRejectedValueOnce({ + code: 'forbidden', + message: 'Credential Group credential access denied', + }) + + await expect( + executeManagedMcpToolUseCase.execute({ + principal, + input: { + workspaceId: 'workspace-1', + credentialId: context.credentialId, + toolName: 'search_transcripts', + arguments: {}, + }, + }) + ).rejects.toMatchObject({ + code: 'forbidden', + message: 'Credential Group credential access denied', + }) + + expect(mocks.requireCredentialAccess).toHaveBeenCalledWith(principal, context, { + resourceType: 'credential_group', + action: 'credential_groups.credentials.use', + }) + expect(mocks.loadRuntime).not.toHaveBeenCalled() + expect(mocks.executeTool).not.toHaveBeenCalled() + }) + + it('fails fast when the live tool schema is invalid', async () => { + mocks.discoverTools.mockResolvedValueOnce([{ name: 'search_transcripts', inputSchema: null }]) + + await expect( + executeManagedMcpToolUseCase.execute({ + principal, + input: { + workspaceId: 'workspace-1', + credentialId: context.credentialId, + toolName: 'search_transcripts', + arguments: {}, + }, + }) + ).rejects.toMatchObject({ + code: 'validation', + message: 'Managed MCP tool schema is invalid', + }) + + expect(mocks.executeTool).not.toHaveBeenCalled() + }) + + it('discovers and executes with the explicitly selected managed connection', async () => { + const signal = new AbortController().signal + mocks.discoverTools.mockResolvedValueOnce([ + { + name: 'search_transcripts', + description: 'Search Fireflies transcripts', + inputSchema: { + type: 'object', + required: ['query'], + properties: { query: { type: 'string' } }, + }, + }, + ]) + + const result = await executeManagedMcpToolUseCase.execute({ + principal, + input: { + workspaceId: context.workspaceId, + credentialId: context.credentialId, + toolName: 'search_transcripts', + arguments: { query: 'onboarding' }, + signal, + }, + }) + + expect(result).toEqual({ + success: true, + output: { content: [{ type: 'text', text: 'done' }] }, + }) + expect(mocks.loadRuntime).toHaveBeenCalledWith(context.credentialId, context.workspaceId) + expect(mocks.discoverTools).toHaveBeenCalledWith( + context.mcpServerId, + context.workspaceId, + {}, + signal, + { requireComplete: true } + ) + expect(mocks.saveToolSnapshot).toHaveBeenCalledWith(context.credentialId, [ + { + name: 'search_transcripts', + description: 'Search Fireflies transcripts', + inputSchema: { + type: 'object', + required: ['query'], + properties: { query: { type: 'string' } }, + }, + }, + ]) + expect(mocks.executeTool).toHaveBeenCalledWith( + expect.objectContaining({ + connectionId: context.credentialId, + serverId: context.mcpServerId, + workspaceId: context.workspaceId, + toolCall: { + name: 'search_transcripts', + arguments: { query: 'onboarding' }, + }, + }) + ) + }) +}) diff --git a/apps/sim/lib/mcp/application/execute-managed-tool.ts b/apps/sim/lib/mcp/application/execute-managed-tool.ts new file mode 100644 index 00000000000..8e2c43a61de --- /dev/null +++ b/apps/sim/lib/mcp/application/execute-managed-tool.ts @@ -0,0 +1,117 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { requireCredentialGroupCredentialAccess } from '@/lib/credential-groups/application/authorization' +import { managedMcpCredentialDelegationPolicy } from '@/lib/credentials/application/authorization' +import { credentialOperations } from '@/lib/credentials/application/operations' +import { + loadManagedMcpCredentialApplicationContext, + loadManagedMcpRuntimeCredential, + saveManagedMcpToolSnapshot, +} from '@/lib/credentials/managed-mcp' +import { SIM_VIA_HEADER, serializeCallChain } from '@/lib/execution/call-chain' +import { + coerceToolArguments, + type ExecuteMcpToolResult, + transformToolResult, + validateToolArguments, +} from '@/lib/mcp/application/execute-tool' +import { loadManagedMcpAuthProvider } from '@/lib/mcp/application/managed-auth-provider' +import { withMcpOauthRefreshLock } from '@/lib/mcp/oauth' +import { mcpService } from '@/lib/mcp/service' +import type { McpTool, McpToolCall, McpToolSchema } from '@/lib/mcp/types' + +export interface ExecuteManagedMcpToolInput { + workspaceId: string + credentialId: string + toolName: string + arguments?: Record + callChain?: string[] + timeoutMs?: number + signal?: AbortSignal +} + +function requireToolSchema(value: unknown): McpToolSchema { + if (!value || typeof value !== 'object' || !('type' in value) || value.type !== 'object') { + throw new OrchestrationError('validation', 'Managed MCP tool schema is invalid') + } + return value as McpToolSchema +} + +export const executeManagedMcpToolUseCase = defineAuthorizedWorkspaceUseCase({ + operation: credentialOperations.useManagedMcp, + resolveContext: async ({ input }: { input: ExecuteManagedMcpToolInput }) => { + const context = await loadManagedMcpCredentialApplicationContext(input.credentialId) + if (!context) throw new OrchestrationError('not_found', 'Managed MCP connection not found') + if (context.workspaceId !== input.workspaceId) { + throw new OrchestrationError('not_found', 'Managed MCP connection not found') + } + return context + }, + authorizationOptions: { delegation: managedMcpCredentialDelegationPolicy }, + async authorizeResource({ principal, context, resourcePolicy }) { + await requireCredentialGroupCredentialAccess(principal, context, resourcePolicy) + }, + async execute({ input, context }): Promise { + input.signal?.throwIfAborted() + const runtime = await loadManagedMcpRuntimeCredential(context.credentialId, context.workspaceId) + const tools = await withMcpOauthRefreshLock(runtime.credentialId, async () => + mcpService.discoverManagedMcpTools( + runtime.mcpServerId, + runtime.workspaceId, + await loadManagedMcpAuthProvider(runtime.credentialId, runtime.workspaceId), + input.signal, + { requireComplete: true } + ) + ) + await saveManagedMcpToolSnapshot( + runtime.credentialId, + tools.map((tool) => ({ + name: tool.name, + ...(tool.description ? { description: tool.description } : {}), + inputSchema: tool.inputSchema, + })) + ) + const discovered = tools.find((tool) => tool.name === input.toolName) + if (!discovered) { + throw new OrchestrationError('not_found', 'Tool not found on the managed MCP connection') + } + const tool: McpTool = { + name: discovered.name, + ...(discovered.description ? { description: discovered.description } : {}), + inputSchema: requireToolSchema(discovered.inputSchema), + serverId: runtime.credentialId, + serverName: runtime.mcpServerName, + } + const args = coerceToolArguments(tool, { ...input.arguments }) + validateToolArguments(tool, args) + const toolCall: McpToolCall = { name: input.toolName, arguments: args } + const extraHeaders = + input.callChain && input.callChain.length > 0 + ? { [SIM_VIA_HEADER]: serializeCallChain(input.callChain) } + : undefined + const providerResult = await mcpService.executeManagedMcpTool({ + connectionId: runtime.credentialId, + serverId: runtime.mcpServerId, + workspaceId: runtime.workspaceId, + toolCall, + extraHeaders, + signal: input.signal, + timeoutMs: input.timeoutMs, + loadAuthProvider: () => loadManagedMcpAuthProvider(context.credentialId, context.workspaceId), + }) + input.signal?.throwIfAborted() + return transformToolResult(providerResult) + }, + projectAudit: ({ input, context }) => ({ + action: AuditAction.CREDENTIAL_ACCESSED, + resourceType: AuditResourceType.CREDENTIAL, + resourceId: context.credentialId, + description: `Executed managed MCP tool ${input.toolName}`, + metadata: { + credentialType: 'managed_mcp', + mcpServerId: context.mcpServerId, + toolName: input.toolName, + }, + }), +}) diff --git a/apps/sim/lib/mcp/application/execute-tool.test.ts b/apps/sim/lib/mcp/application/execute-tool.test.ts index 8406c18a812..fefb84eb118 100644 --- a/apps/sim/lib/mcp/application/execute-tool.test.ts +++ b/apps/sim/lib/mcp/application/execute-tool.test.ts @@ -60,6 +60,7 @@ const PRINCIPAL: WorkflowExecutionDelegatedPrincipal = { issuedAt: new Date('2026-08-27T00:00:00.000Z'), expiresAt: new Date('2099-08-27T00:05:00.000Z'), delegationContext: { kind: 'workflow_execution', workflowId: 'workflow-1' }, + resourceScope: { mcpServerId: SERVER.id }, } const ACTORLESS_PRINCIPAL: WorkflowExecutionDelegatedPrincipal = { kind: 'delegated', @@ -84,6 +85,7 @@ const ACTORLESS_PRINCIPAL: WorkflowExecutionDelegatedPrincipal = { workflowId: 'workflow-1', }, }, + resourceScope: { mcpServerId: SERVER.id }, } const COMPATIBILITY_ACTOR_PRINCIPAL: WorkflowExecutionDelegatedPrincipal = { ...ACTORLESS_PRINCIPAL, @@ -178,6 +180,28 @@ describe('executeMcpToolUseCase', () => { expect(mocks.executeTool).not.toHaveBeenCalled() }) + it('does not infer a managed credential from the execution actor', async () => { + mocks.getServer.mockResolvedValueOnce({ ...SERVER, credentialGroupId: 'group-1' }) + + await expect( + executeMcpToolUseCase.execute({ + principal: PRINCIPAL, + input: { + workspaceId: WORKSPACE.workspaceId, + serverId: SERVER.id, + toolName: 'lookup', + }, + }) + ).rejects.toMatchObject({ + code: 'conflict', + message: 'Credential Group MCP servers require an explicit managed connection ID', + }) + + expect(mocks.assertPermissionsAllowed).not.toHaveBeenCalled() + expect(mocks.discoverServerTools).not.toHaveBeenCalled() + expect(mocks.executeTool).not.toHaveBeenCalled() + }) + it('keeps an unattended run connecting as its execution actor', async () => { // Pre-in-process behavior: the executor minted an internal token from // ExecutionContext.userId and MCP ran as that user. Preserved deliberately — diff --git a/apps/sim/lib/mcp/application/execute-tool.ts b/apps/sim/lib/mcp/application/execute-tool.ts index 60dba14a253..8f7388619be 100644 --- a/apps/sim/lib/mcp/application/execute-tool.ts +++ b/apps/sim/lib/mcp/application/execute-tool.ts @@ -4,7 +4,7 @@ import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application' import { OrchestrationError } from '@/lib/core/orchestration/types' import { SIM_VIA_HEADER, serializeCallChain } from '@/lib/execution/call-chain' import { - mcpServerDelegationPolicy, + mcpServerExecutionDelegationPolicy, requireMcpCredentialUserId, } from '@/lib/mcp/application/authorization' import { resolveMcpServerContext } from '@/lib/mcp/application/context' @@ -42,7 +42,7 @@ function hasType(value: unknown): value is SchemaProperty { return typeof value === 'object' && value !== null && 'type' in value } -function coerceToolArguments( +export function coerceToolArguments( tool: McpTool, input: Record ): Record { @@ -88,7 +88,7 @@ function coerceToolArguments( return result } -function validateToolArguments(tool: McpTool, args: Record): void { +export function validateToolArguments(tool: McpTool, args: Record): void { const schema = tool.inputSchema if (!schema) return @@ -115,7 +115,7 @@ function validateToolArguments(tool: McpTool, args: Record): vo } } -function transformToolResult(result: McpToolResult): ExecuteMcpToolResult { +export function transformToolResult(result: McpToolResult): ExecuteMcpToolResult { if (!result.isError) return { success: true, output: result } const firstContent = Array.isArray(result.content) ? result.content[0] : undefined const errorText = @@ -131,9 +131,15 @@ export const executeMcpToolUseCase = defineAuthorizedWorkspaceUseCase({ operation: mcpServerOperations.executeTool, resolveContext: ({ input }: { input: ExecuteMcpToolInput }) => resolveMcpServerContext(input.workspaceId, input.serverId), - authorizationOptions: { delegation: mcpServerDelegationPolicy }, + authorizationOptions: { delegation: mcpServerExecutionDelegationPolicy }, async execute({ principal, input, context }): Promise { input.signal?.throwIfAborted() + if (context.server.credentialGroupId) { + throw new OrchestrationError( + 'conflict', + 'Credential Group MCP servers require an explicit managed connection ID' + ) + } const userId = requireMcpCredentialUserId(principal) await assertPermissionsAllowed({ userId, diff --git a/apps/sim/lib/mcp/application/managed-auth-provider.ts b/apps/sim/lib/mcp/application/managed-auth-provider.ts new file mode 100644 index 00000000000..039062babfe --- /dev/null +++ b/apps/sim/lib/mcp/application/managed-auth-provider.ts @@ -0,0 +1,30 @@ +import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js' +import { + loadManagedMcpRuntimeCredential, + saveManagedMcpRuntimeTokens, +} from '@/lib/credentials/managed-mcp' +import { getOrCreateOauthRow, loadPreregisteredClient } from '@/lib/mcp/oauth' +import { ManagedMcpOauthProvider } from '@/lib/mcp/oauth/managed-provider' + +/** Creates an OAuth provider whose refresh writes stay bound to the same personal grant. */ +export async function loadManagedMcpAuthProvider( + credentialId: string, + workspaceId: string +): Promise { + const current = await loadManagedMcpRuntimeCredential(credentialId, workspaceId) + const clientRow = await getOrCreateOauthRow({ + mcpServerId: current.mcpServerId, + workspaceId: current.workspaceId, + }) + const preregistered = await loadPreregisteredClient(current.mcpServerId) + let tokenVersion: string | null = current.tokenVersion + return new ManagedMcpOauthProvider({ + clientRow, + preregistered, + tokens: current.tokens, + async onSaveTokens(tokens) { + if (!tokenVersion) throw new Error('Managed MCP credential grant is no longer active') + tokenVersion = await saveManagedMcpRuntimeTokens(current.credentialId, tokens, tokenVersion) + }, + }) +} diff --git a/apps/sim/lib/mcp/application/managed-connections.ts b/apps/sim/lib/mcp/application/managed-connections.ts new file mode 100644 index 00000000000..226d765fe15 --- /dev/null +++ b/apps/sim/lib/mcp/application/managed-connections.ts @@ -0,0 +1,156 @@ +import { db } from '@sim/db' +import { credential, credentialGroup, credentialGroupEnrollment, mcpServers } from '@sim/db/schema' +import { and, asc, eq, inArray, isNull, sql } from 'drizzle-orm' +import { getWorkspaceOwnerSubscriptionAccess } from '@/lib/billing/core/workspace-access' +import { defineAuthorizedWorkspaceUseCase } from '@/lib/core/application' +import { isCredentialGroupsAvailable } from '@/lib/credential-groups/availability' +import { getManagedMcpConnector } from '@/lib/credential-groups/managed-mcp-connectors' +import { resolveMcpWorkspaceContext } from '@/lib/mcp/application/context' +import { mcpServerOperations } from '@/lib/mcp/application/operations' +import type { McpToolSchema } from '@/lib/mcp/types' + +const MAX_MANAGED_MCP_CONNECTIONS = 500 +const MAX_MANAGED_MCP_CATALOG_BYTES = 5 * 1024 * 1024 + +function requireMcpToolSchema(inputSchema: unknown): McpToolSchema { + if ( + !inputSchema || + typeof inputSchema !== 'object' || + !('type' in inputSchema) || + inputSchema.type !== 'object' + ) { + throw new Error('Managed MCP tool snapshot must have an object input schema') + } + return inputSchema as McpToolSchema +} + +export const listManagedMcpConnectionsUseCase = defineAuthorizedWorkspaceUseCase({ + operation: mcpServerOperations.listManagedConnections, + resolveContext: ({ input }: { input: { workspaceId: string } }) => + resolveMcpWorkspaceContext(input.workspaceId), + authorizationOptions: {}, + async execute({ context }) { + const ownerBilling = await getWorkspaceOwnerSubscriptionAccess(context.workspaceId) + if (!(await isCredentialGroupsAvailable({ workspaceId: context.workspaceId, ownerBilling }))) { + return { servers: [], tools: [] } + } + const managedCatalogScope = () => + and( + eq(credential.workspaceId, context.workspaceId), + eq(credential.type, 'managed_mcp'), + eq(credential.managedOauthStatus, 'active'), + eq(credentialGroup.status, 'active'), + inArray(credentialGroupEnrollment.status, ['in_progress', 'completed']), + eq(mcpServers.workspaceId, context.workspaceId), + eq(mcpServers.authType, 'oauth'), + eq(mcpServers.enabled, true), + isNull(mcpServers.deletedAt), + sql`${mcpServers.credentialGroupId} = ${credentialGroup.id}` + ) + const metadataRows = await db + .select({ + id: credential.id, + serverId: mcpServers.id, + serverName: mcpServers.name, + serverDescription: mcpServers.description, + managedConnectorId: mcpServers.managedConnectorId, + email: credentialGroupEnrollment.email, + toolSnapshotBytes: + sql`COALESCE(octet_length(${credential.mcpTools}::text), 0)`.mapWith(Number), + createdAt: credential.createdAt, + updatedAt: credential.updatedAt, + }) + .from(credential) + .innerJoin( + credentialGroupEnrollment, + eq(credentialGroupEnrollment.id, credential.credentialGroupEnrollmentId) + ) + .innerJoin( + credentialGroup, + eq(credentialGroup.id, credentialGroupEnrollment.credentialGroupId) + ) + .innerJoin(mcpServers, eq(mcpServers.id, credential.mcpServerId)) + .where(managedCatalogScope()) + .orderBy(asc(mcpServers.name), asc(credentialGroupEnrollment.email), asc(credential.id)) + .limit(MAX_MANAGED_MCP_CONNECTIONS + 1) + + if (metadataRows.length > MAX_MANAGED_MCP_CONNECTIONS) { + throw new Error( + `Managed MCP catalog exceeds the ${MAX_MANAGED_MCP_CONNECTIONS}-connection limit` + ) + } + const catalogBytes = metadataRows.reduce((total, row) => total + row.toolSnapshotBytes, 0) + if (catalogBytes > MAX_MANAGED_MCP_CATALOG_BYTES) { + throw new Error( + `Managed MCP catalog exceeds the ${MAX_MANAGED_MCP_CATALOG_BYTES}-byte metadata limit` + ) + } + + const toolRows = + metadataRows.length === 0 + ? [] + : await db + .select({ id: credential.id, tools: credential.mcpTools }) + .from(credential) + .innerJoin( + credentialGroupEnrollment, + eq(credentialGroupEnrollment.id, credential.credentialGroupEnrollmentId) + ) + .innerJoin( + credentialGroup, + eq(credentialGroup.id, credentialGroupEnrollment.credentialGroupId) + ) + .innerJoin(mcpServers, eq(mcpServers.id, credential.mcpServerId)) + .where( + and( + managedCatalogScope(), + inArray( + credential.id, + metadataRows.map((row) => row.id) + ) + ) + ) + const toolsByConnectionId = new Map(toolRows.map((row) => [row.id, row.tools])) + const rows = metadataRows.map((row) => { + const tools = toolsByConnectionId.get(row.id) + if (!tools) { + throw new Error(`Managed MCP connection ${row.id} changed while loading its tool snapshot`) + } + if (!row.managedConnectorId) { + throw new Error(`Managed MCP server ${row.serverId} has no connector ID`) + } + return { + ...row, + managedConnectorId: getManagedMcpConnector(row.managedConnectorId).id, + tools, + } + }) + + return { + servers: rows.map((row) => ({ + id: row.id, + workspaceId: context.workspaceId, + name: `${row.serverName} — ${row.email}`, + ...(row.serverDescription ? { description: row.serverDescription } : {}), + transport: 'streamable-http' as const, + authType: 'oauth' as const, + managedConnectorId: row.managedConnectorId, + enabled: true, + connectionStatus: 'connected' as const, + toolCount: row.tools.length, + createdAt: row.createdAt.toISOString(), + updatedAt: row.updatedAt.toISOString(), + })), + tools: rows.flatMap((row) => { + return row.tools.map((tool) => ({ + name: tool.name, + description: tool.description, + inputSchema: requireMcpToolSchema(tool.inputSchema), + serverId: row.id, + serverName: `${row.serverName} — ${row.email}`, + managedConnectorId: row.managedConnectorId, + })) + }), + } + }, +}) diff --git a/apps/sim/lib/mcp/application/operations.test.ts b/apps/sim/lib/mcp/application/operations.test.ts index f145601905f..4238e5c4b83 100644 --- a/apps/sim/lib/mcp/application/operations.test.ts +++ b/apps/sim/lib/mcp/application/operations.test.ts @@ -150,6 +150,7 @@ const EXPECTED_CAPABILITIES: Record = delete: 'mcp_tools.use', discoverTools: 'mcp_tools.use', executeTool: 'mcp_tools.use', + listManagedConnections: 'mcp_tools.use', listWorkflowDeployments: 'deploy.mcp', readWorkflowDeploymentServer: 'deploy.mcp', listWorkflowDeploymentTools: 'deploy.mcp', diff --git a/apps/sim/lib/mcp/application/operations.ts b/apps/sim/lib/mcp/application/operations.ts index e5cba22f155..e9346e82078 100644 --- a/apps/sim/lib/mcp/application/operations.ts +++ b/apps/sim/lib/mcp/application/operations.ts @@ -39,6 +39,13 @@ export const mcpServerOperations = { capability: 'mcp_tools.use', ...ALL_PRINCIPAL_POLICY, }), + listManagedConnections: defineWorkspaceOperation({ + id: 'mcp_servers.managed_connections.list', + minimumRole: 'read', + workspaceApiKey: 'deny', + capability: 'mcp_tools.use', + principalKinds: ['session'], + }), discoverTools: defineWorkspaceOperation({ id: 'mcp_servers.tools.discover', minimumRole: 'read', diff --git a/apps/sim/lib/mcp/application/use-cases.test.ts b/apps/sim/lib/mcp/application/use-cases.test.ts index d75f79e7ada..b96b83c51ae 100644 --- a/apps/sim/lib/mcp/application/use-cases.test.ts +++ b/apps/sim/lib/mcp/application/use-cases.test.ts @@ -291,6 +291,22 @@ describe('MCP server application use cases', () => { expect(mocks.discoverServerTools).not.toHaveBeenCalled() }) + it('requires an explicit managed connection ID for a Credential Group server', async () => { + mocks.getServer.mockResolvedValueOnce({ ...server, credentialGroupId: 'group-1' }) + + await expect( + discoverMcpServerToolsUseCase.execute({ + principal: { kind: 'personal_api_key', userId: 'user-1', keyId: 'key-1' }, + input: { workspaceId: workspace.workspaceId, serverId: server.id }, + }) + ).rejects.toMatchObject({ + code: 'conflict', + message: 'Credential Group MCP servers require an explicit managed connection ID', + }) + + expect(mocks.discoverServerTools).not.toHaveBeenCalled() + }) + it('discovers one server tools for the acting subject, honouring refresh', async () => { const tools = [ { diff --git a/apps/sim/lib/mcp/application/use-cases.ts b/apps/sim/lib/mcp/application/use-cases.ts index 60bdb4840a7..5eec48638a5 100644 --- a/apps/sim/lib/mcp/application/use-cases.ts +++ b/apps/sim/lib/mcp/application/use-cases.ts @@ -118,6 +118,8 @@ export interface DiscoverMcpServerToolsInput { workspaceId: string serverId: string refresh?: boolean + signal?: AbortSignal + requireComplete?: boolean } /** @@ -139,6 +141,7 @@ export const discoverMcpServerToolsUseCase = defineAuthorizedWorkspaceUseCase({ resolveMcpServerContext(input.workspaceId, input.serverId), authorizationOptions, async execute({ principal, input, context }) { + input.signal?.throwIfAborted() /** * `enabled: false` is a documented registration value, but discovery loads * its configuration through a query that filters on `enabled`, so a @@ -152,18 +155,31 @@ export const discoverMcpServerToolsUseCase = defineAuthorizedWorkspaceUseCase({ 'The MCP server is disabled; enable it before listing its tools' ) } + if (context.server.credentialGroupId) { + throw new OrchestrationError( + 'conflict', + 'Credential Group MCP servers require an explicit managed connection ID' + ) + } - const tools = await mcpService.discoverServerTools( - requireMcpCredentialUserId(principal), - context.server.id, - context.workspaceId, - /** - * A public `refresh` skips the positive cache but keeps the failure - * cooldown; only an explicit user action on their own server may bypass - * both. See {@link McpDiscoveryRefresh}. - */ - input.refresh ? 'skip-cache' : 'cache-aside' - ) + const userId = requireMcpCredentialUserId(principal) + const refresh = input.refresh ? 'skip-cache' : 'cache-aside' + const tools = + input.signal || input.requireComplete + ? await mcpService.discoverServerTools( + userId, + context.server.id, + context.workspaceId, + refresh, + undefined, + { signal: input.signal, requireComplete: input.requireComplete } + ) + : await mcpService.discoverServerTools( + userId, + context.server.id, + context.workspaceId, + refresh + ) return { tools } }, }) @@ -337,6 +353,12 @@ async function updateMcpServer(args: { input: UpdateMcpServerInput context: McpServerContext }): Promise { + if (args.context.server.managedConnectorId) { + throw new OrchestrationError( + 'conflict', + 'This MCP server is managed from its Credential Group settings' + ) + } const attribution = resolvePrincipalAttribution(args.principal, { workspaceBillingOwnerUserId: args.context.billedAccountUserId, }) @@ -423,6 +445,12 @@ export const deleteMcpServerUseCase = defineAuthorizedWorkspaceUseCase({ resolveMcpServerContext(input.workspaceId, input.serverId), authorizationOptions, async execute({ principal, input, context }) { + if (context.server.managedConnectorId) { + throw new OrchestrationError( + 'conflict', + 'This MCP server is managed from its Credential Group settings' + ) + } const attribution = resolvePrincipalAttribution(principal, { workspaceBillingOwnerUserId: context.billedAccountUserId, }) diff --git a/apps/sim/lib/mcp/client.test.ts b/apps/sim/lib/mcp/client.test.ts index 8a87eac5a5f..27d3dbdca4b 100644 --- a/apps/sim/lib/mcp/client.test.ts +++ b/apps/sim/lib/mcp/client.test.ts @@ -248,6 +248,21 @@ describe('McpClient notification handler', () => { expect(tools.map((t) => t.name)).toEqual(['a']) }) + it('fails instead of returning partial tools when complete discovery is required', async () => { + mockSdkListTools + .mockResolvedValueOnce({ tools: [{ name: 'a' }], nextCursor: 'c1' }) + .mockRejectedValueOnce(new Error('page 2 blew up')) + const client = new McpClient({ + config: createConfig(), + securityPolicy: { requireConsent: false, auditLevel: 'basic' }, + }) + + await client.connect() + await expect(client.listTools(undefined, { requireComplete: true })).rejects.toThrow( + 'page 2 blew up' + ) + }) + it('keeps an empty partial (does not throw) when page one succeeds but a later page fails', async () => { // Page one is valid but empty with a cursor; page two fails. Page one succeeded, so // discovery must not fail the server — it returns [] rather than throwing. diff --git a/apps/sim/lib/mcp/client.ts b/apps/sim/lib/mcp/client.ts index c9b2607feac..6f0b2cd4828 100644 --- a/apps/sim/lib/mcp/client.ts +++ b/apps/sim/lib/mcp/client.ts @@ -275,7 +275,10 @@ export class McpClient { return { ...this.connectionStatus } } - async listTools(signal?: AbortSignal): Promise { + async listTools( + signal?: AbortSignal, + options: { requireComplete?: boolean } = {} + ): Promise { if (!this.isConnected) { throw new McpConnectionError('Not connected to server', this.config.name) } @@ -381,6 +384,12 @@ export class McpClient { toolsCollected: tools.length, pagesFetched, }) + if (options.requireComplete) { + throw new McpConnectionError( + `Tool discovery was truncated by the ${truncated} limit`, + this.config.name + ) + } } return tools @@ -397,6 +406,8 @@ export class McpClient { sessionIdPresent: Boolean(this.transport.sessionId), error: getMcpSafeErrorDiagnostics(error), }) + if (options.requireComplete) throw error + // At least one page succeeded → keep its (possibly empty) partial result rather than // failing discovery and marking the server unhealthy; only a page-one failure throws. if (pagesFetched > 0) return tools diff --git a/apps/sim/lib/mcp/connection-pool.ts b/apps/sim/lib/mcp/connection-pool.ts index 8eda72cbd3e..1a12fc5b27e 100644 --- a/apps/sim/lib/mcp/connection-pool.ts +++ b/apps/sim/lib/mcp/connection-pool.ts @@ -320,3 +320,8 @@ if (!('_mcpConnectionPool' in _g)) { } export const mcpConnectionPool: McpConnectionPool | null = _g._mcpConnectionPool ?? null + +/** Evicts every warm connection for a server without importing the full MCP service. */ +export async function evictMcpServerConnections(serverId: string, reason: string): Promise { + await mcpConnectionPool?.evictServer(serverId, reason) +} diff --git a/apps/sim/lib/mcp/oauth/managed-provider.ts b/apps/sim/lib/mcp/oauth/managed-provider.ts new file mode 100644 index 00000000000..1ca319716de --- /dev/null +++ b/apps/sim/lib/mcp/oauth/managed-provider.ts @@ -0,0 +1,128 @@ +import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js' +import type { + OAuthClientInformationMixed, + OAuthClientMetadata, + OAuthTokens, +} from '@modelcontextprotocol/sdk/shared/auth.js' +import { generateId } from '@sim/utils/id' +import { getBaseUrl } from '@/lib/core/utils/urls' +import { McpOauthRedirectRequired, type PreregisteredClient } from '@/lib/mcp/oauth/provider' +import { clearClient, type McpOauthRow, saveClientInformation } from '@/lib/mcp/oauth/storage' + +interface ManagedMcpOauthProviderInit { + clientRow: McpOauthRow + preregistered?: PreregisteredClient + tokens?: OAuthTokens + codeVerifier?: string + onSaveTokens: (tokens: OAuthTokens | null) => Promise +} + +/** Shares server client registration while keeping grant tokens scoped to one enrollment. */ +export class ManagedMcpOauthProvider implements OAuthClientProvider { + private readonly clientRow: McpOauthRow + private readonly preregistered?: PreregisteredClient + private readonly onSaveTokens: (tokens: OAuthTokens | null) => Promise + private currentTokens?: OAuthTokens + private currentState?: string + private currentCodeVerifier?: string + + constructor({ + clientRow, + preregistered, + tokens, + codeVerifier, + onSaveTokens, + }: ManagedMcpOauthProviderInit) { + this.clientRow = clientRow + this.preregistered = preregistered + this.currentTokens = tokens + this.currentCodeVerifier = codeVerifier + this.onSaveTokens = onSaveTokens + } + + get redirectUrl(): string { + return `${getBaseUrl().replace(/\/$/, '')}/api/mcp/oauth/callback` + } + + get clientMetadata(): OAuthClientMetadata { + return { + client_name: 'Sim', + redirect_uris: [this.redirectUrl], + grant_types: ['authorization_code', 'refresh_token'], + response_types: ['code'], + token_endpoint_auth_method: this.preregistered?.clientSecret ? 'client_secret_post' : 'none', + } + } + + async state(): Promise { + this.currentState = `mcp_cg_${generateId()}` + return this.currentState + } + + clientInformation(): OAuthClientInformationMixed | undefined { + if (this.clientRow.clientInformation) return this.clientRow.clientInformation + if (!this.preregistered) return undefined + return { + client_id: this.preregistered.clientId, + client_secret: this.preregistered.clientSecret, + redirect_uris: [this.redirectUrl], + grant_types: ['authorization_code', 'refresh_token'], + response_types: ['code'], + token_endpoint_auth_method: this.preregistered.clientSecret ? 'client_secret_post' : 'none', + } + } + + async saveClientInformation(info: OAuthClientInformationMixed): Promise { + if (this.preregistered) return + await saveClientInformation(this.clientRow.id, info) + this.clientRow.clientInformation = info + } + + tokens(): OAuthTokens | undefined { + return this.currentTokens + } + + async saveTokens(tokens: OAuthTokens): Promise { + await this.onSaveTokens(tokens) + this.currentTokens = tokens + } + + async redirectToAuthorization(authorizationUrl: URL): Promise { + throw new McpOauthRedirectRequired(authorizationUrl.toString()) + } + + async saveCodeVerifier(codeVerifier: string): Promise { + this.currentCodeVerifier = codeVerifier + } + + async codeVerifier(): Promise { + if (!this.currentCodeVerifier) { + throw new Error('No PKCE code verifier saved for this managed MCP OAuth session') + } + return this.currentCodeVerifier + } + + async invalidateCredentials( + scope: 'all' | 'client' | 'tokens' | 'verifier' | 'discovery' + ): Promise { + if (scope === 'all' || scope === 'client') { + await clearClient(this.clientRow.id) + this.clientRow.clientInformation = null + } + if (scope === 'all' || scope === 'tokens') { + await this.onSaveTokens(null) + this.currentTokens = undefined + } + if (scope === 'all' || scope === 'verifier') { + this.currentState = undefined + this.currentCodeVerifier = undefined + } + } + + requireAuthorizationAttempt(): { state: string; codeVerifier: string } { + if (!this.currentState || !this.currentCodeVerifier) { + throw new Error('Managed MCP OAuth provider did not produce state and PKCE verifier') + } + return { state: this.currentState, codeVerifier: this.currentCodeVerifier } + } +} diff --git a/apps/sim/lib/mcp/oauth/storage.ts b/apps/sim/lib/mcp/oauth/storage.ts index 63a567faaf8..c2e54c2e951 100644 --- a/apps/sim/lib/mcp/oauth/storage.ts +++ b/apps/sim/lib/mcp/oauth/storage.ts @@ -71,7 +71,7 @@ async function safeDecrypt( export async function getOrCreateOauthRow(params: { mcpServerId: string - userId: string + userId?: string | null workspaceId: string }): Promise { const existing = await loadOauthRow(params) @@ -82,7 +82,7 @@ export async function getOrCreateOauthRow(params: { await db.insert(mcpServerOauth).values({ id, mcpServerId: params.mcpServerId, - userId: params.userId, + userId: params.userId ?? null, workspaceId: params.workspaceId, }) } catch (error) { @@ -94,7 +94,7 @@ export async function getOrCreateOauthRow(params: { return { id, mcpServerId: params.mcpServerId, - userId: params.userId, + userId: params.userId ?? null, workspaceId: params.workspaceId, clientInformation: null, tokens: null, diff --git a/apps/sim/lib/mcp/orchestration/server-lifecycle.test.ts b/apps/sim/lib/mcp/orchestration/server-lifecycle.test.ts index 489d9cf4d05..0e07aa8f652 100644 --- a/apps/sim/lib/mcp/orchestration/server-lifecycle.test.ts +++ b/apps/sim/lib/mcp/orchestration/server-lifecycle.test.ts @@ -8,6 +8,7 @@ import { dbChainMockFns, encryptionMock, posthogServerMock, + queueTableRows, resetDbChainMock, schemaMock, } from '@sim/testing' @@ -33,6 +34,7 @@ vi.mock('@sim/db', () => ({ mcpServers: schemaMock.mcpServers, })) vi.mock('@sim/db/schema', () => ({ + credential: schemaMock.credential, mcpServerOauth: schemaMock.mcpServerOauth, })) vi.mock('@sim/utils/id', () => ({ generateId: vi.fn() })) @@ -635,9 +637,19 @@ describe('MCP server lifecycle orchestration', () => { }) it('evicts the deleted server from the connection pool (row is already gone from clearCache)', async () => { - dbChainMockFns.returning.mockResolvedValueOnce([ + queueTableRows(schemaMock.mcpServers, [ { id: 'server-1', workspaceId: 'workspace-1', name: 'Example', transport: 'streamable-http' }, ]) + dbChainMockFns.returning + .mockResolvedValueOnce([{ id: 'mcp-cg-connection-1' }]) + .mockResolvedValueOnce([ + { + id: 'server-1', + workspaceId: 'workspace-1', + name: 'Example', + transport: 'streamable-http', + }, + ]) const result = await performDeleteMcpServer({ workspaceId: 'workspace-1', @@ -648,5 +660,9 @@ describe('MCP server lifecycle orchestration', () => { expect(result.success).toBe(true) expect(mockRevokeOauthTokens).toHaveBeenCalledWith('server-1', 'workspace-1') expect(mockEvictServerConnections).toHaveBeenCalledWith('server-1', expect.any(String)) + expect(mockEvictServerConnections).toHaveBeenCalledWith( + 'mcp-cg-connection-1', + 'managed connection retired' + ) }) }) diff --git a/apps/sim/lib/mcp/orchestration/server-lifecycle.ts b/apps/sim/lib/mcp/orchestration/server-lifecycle.ts index f0a7cc64f34..aa893f3fde4 100644 --- a/apps/sim/lib/mcp/orchestration/server-lifecycle.ts +++ b/apps/sim/lib/mcp/orchestration/server-lifecycle.ts @@ -1,6 +1,6 @@ import { AuditAction, AuditResourceType, auditUpdatedFields, recordAudit } from '@sim/audit' import { db, mcpServers } from '@sim/db' -import { mcpServerOauth } from '@sim/db/schema' +import { credential, mcpServerOauth } from '@sim/db/schema' import { createLogger } from '@sim/logger' import { generateId } from '@sim/utils/id' import { and, eq, isNull } from 'drizzle-orm' @@ -99,6 +99,7 @@ export interface PerformMcpServerResult { revived?: boolean authType?: McpAuthType configurationChanged?: boolean + retiredManagedConnectionIds?: string[] /** * Fields the update's SET clause wrote, minus `updatedAt`, for audit. Only * the writer knows these: a param is not a write, and callers cannot see the @@ -169,6 +170,7 @@ export async function createMcpServer( authType: mcpServers.authType, oauthClientId: mcpServers.oauthClientId, oauthClientSecret: mcpServers.oauthClientSecret, + managedConnectorId: mcpServers.managedConnectorId, }) .from(mcpServers) .where(and(eq(mcpServers.id, serverId), eq(mcpServers.workspaceId, params.workspaceId))) @@ -176,6 +178,14 @@ export async function createMcpServer( const urlChanged = existingServer ? existingServer.url !== params.url : true + if (existingServer?.managedConnectorId) { + return { + success: false, + error: 'This MCP server is managed by a Credential Group', + errorCode: 'conflict', + } + } + if ( existingServer && existingServer.deletedAt === null && @@ -506,16 +516,40 @@ export async function deleteMcpServer( ): Promise { try { await revokeMcpOauthTokens(params.serverId, params.workspaceId) - const [server] = await db - .delete(mcpServers) - .where( - and(eq(mcpServers.id, params.serverId), eq(mcpServers.workspaceId, params.workspaceId)) - ) - .returning() + const deleted = await db.transaction(async (tx) => { + const [target] = await tx + .select() + .from(mcpServers) + .where( + and(eq(mcpServers.id, params.serverId), eq(mcpServers.workspaceId, params.workspaceId)) + ) + .limit(1) + .for('update') + if (!target) return null - if (!server) return { success: false, error: 'Server not found', errorCode: 'not_found' } + const retired = await tx + .delete(credential) + .where( + and( + eq(credential.workspaceId, params.workspaceId), + eq(credential.type, 'managed_mcp'), + eq(credential.mcpServerId, params.serverId) + ) + ) + .returning({ id: credential.id }) + const [server] = await tx + .delete(mcpServers) + .where( + and(eq(mcpServers.id, params.serverId), eq(mcpServers.workspaceId, params.workspaceId)) + ) + .returning() + if (!server) throw new Error('MCP server disappeared during deletion') + return { server, retiredManagedConnectionIds: retired.map((row) => row.id) } + }) + + if (!deleted) return { success: false, error: 'Server not found', errorCode: 'not_found' } - return { success: true, server } + return { success: true, ...deleted } } catch (error) { logger.error('Failed to delete MCP server', { error }) throw error @@ -700,6 +734,11 @@ export async function applyMcpServerMutationEffects(params: { action === 'delete' ? 'server deleted' : 'config changed' ) } + await Promise.all( + (result.retiredManagedConnectionIds ?? []).map((connectionId) => + mcpService.evictServerConnections(connectionId, 'managed connection retired') + ) + ) if (action === 'create' && result.updated === false && result.server) { const { PlatformEvents } = await import('@/lib/core/telemetry') diff --git a/apps/sim/lib/mcp/service-pool.test.ts b/apps/sim/lib/mcp/service-pool.test.ts index 3f1566b7ab9..144890f0103 100644 --- a/apps/sim/lib/mcp/service-pool.test.ts +++ b/apps/sim/lib/mcp/service-pool.test.ts @@ -112,7 +112,7 @@ vi.mock('@/lib/mcp/oauth', () => ({ getOrCreateOauthRow: vi.fn(), loadPreregisteredClient: vi.fn(), SimMcpOauthProvider: vi.fn(), - withMcpOauthRefreshLock: vi.fn(), + withMcpOauthRefreshLock: vi.fn((_id: string, fn: () => Promise) => fn()), })) vi.mock('@/lib/mcp/resolve-config', () => ({ resolveMcpConfigEnvVars: (...args: unknown[]) => mockResolveEnvVars(...args), diff --git a/apps/sim/lib/mcp/service.test.ts b/apps/sim/lib/mcp/service.test.ts index 8b297d5272d..f85f29feec4 100644 --- a/apps/sim/lib/mcp/service.test.ts +++ b/apps/sim/lib/mcp/service.test.ts @@ -111,7 +111,7 @@ vi.mock('@/lib/mcp/oauth', () => ({ getOrCreateOauthRow: vi.fn(), loadPreregisteredClient: vi.fn(), SimMcpOauthProvider: vi.fn(), - withMcpOauthRefreshLock: vi.fn(), + withMcpOauthRefreshLock: vi.fn((_id: string, fn: () => Promise) => fn()), })) vi.mock('@/lib/mcp/resolve-config', () => ({ diff --git a/apps/sim/lib/mcp/service.ts b/apps/sim/lib/mcp/service.ts index bb5914156c8..9aeb3620556 100644 --- a/apps/sim/lib/mcp/service.ts +++ b/apps/sim/lib/mcp/service.ts @@ -1,4 +1,7 @@ -import { UnauthorizedError } from '@modelcontextprotocol/sdk/client/auth.js' +import { + type OAuthClientProvider, + UnauthorizedError, +} from '@modelcontextprotocol/sdk/client/auth.js' import { StreamableHTTPError } from '@modelcontextprotocol/sdk/client/streamableHttp.js' import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js' import { db } from '@sim/db' @@ -12,7 +15,7 @@ import { and, eq, isNull, lte, or, sql } from 'drizzle-orm' import { generateRequestId } from '@/lib/core/utils/request' import { McpClient } from '@/lib/mcp/client' import { mcpConnectionManager } from '@/lib/mcp/connection-manager' -import { mcpConnectionPool } from '@/lib/mcp/connection-pool' +import { evictMcpServerConnections, mcpConnectionPool } from '@/lib/mcp/connection-pool' import { MAX_MCP_LAST_ERROR_LENGTH } from '@/lib/mcp/constants' import { isMcpDomainAllowed, @@ -43,6 +46,7 @@ import { type McpTransport, } from '@/lib/mcp/types' import { MCP_CLIENT_CONSTANTS, MCP_CONSTANTS } from '@/lib/mcp/utils' +import { createEnvVarPattern } from '@/executor/utils/reference-validation' import { isResolvedSecretTraceProvenanceV1, type ResolvedSecretTraceProvenanceV1, @@ -64,6 +68,7 @@ type ResolvedSecretTraceProvenanceCallback = (provenance: ResolvedSecretTracePro interface McpRequestOptions { signal?: AbortSignal + requireComplete?: boolean } interface McpToolExecutionOptions extends McpRequestOptions { @@ -454,6 +459,90 @@ class McpService { }) } + private async createManagedOauthClient( + config: McpServerConfig, + authProvider: OAuthClientProvider, + signal?: AbortSignal + ): Promise { + if (config.authType !== 'oauth' || !config.url) { + throw new Error('Managed MCP connection requires an OAuth HTTP server') + } + if ( + [config.url, ...Object.values(config.headers ?? {})].some((value) => + createEnvVarPattern().test(value) + ) + ) { + throw new Error('Credential Group MCP servers cannot use personal environment references') + } + validateMcpDomain(config.url) + const resolvedIP = await validateMcpServerSsrf(config.url) + const client = new McpClient({ + config, + securityPolicy: { + requireConsent: true, + auditLevel: 'basic', + maxToolExecutionsPerHour: 1000, + allowedOrigins: [new URL(config.url).origin], + }, + authProvider, + resolvedIP: resolvedIP ?? undefined, + }) + await client.connect({ signal }) + return client + } + + async discoverManagedMcpTools( + serverId: string, + workspaceId: string, + authProvider: OAuthClientProvider, + signal?: AbortSignal, + options: { requireComplete?: boolean } = {} + ): Promise { + const config = await this.getServerConfig(serverId, workspaceId) + if (!config) throw new Error('Managed MCP server is unavailable') + return this.withServerClient( + { key: '', serverId, allowPool: false }, + () => this.createManagedOauthClient(config, authProvider, signal), + (client) => + options.requireComplete + ? client.listTools(signal, { requireComplete: true }) + : client.listTools(signal) + ) + } + + async executeManagedMcpTool(params: { + connectionId: string + serverId: string + workspaceId: string + toolCall: McpToolCall + loadAuthProvider: () => Promise + extraHeaders?: Record + signal?: AbortSignal + timeoutMs?: number + }): Promise { + const config = await this.getServerConfig(params.serverId, params.workspaceId) + if (!config) throw new Error('Managed MCP server is unavailable') + const effectiveConfig = params.extraHeaders + ? { ...config, headers: { ...config.headers, ...params.extraHeaders } } + : config + return withMcpOauthRefreshLock(params.connectionId, () => + this.withServerClient( + { key: '', serverId: params.serverId, allowPool: false }, + async () => + this.createManagedOauthClient( + effectiveConfig, + await params.loadAuthProvider(), + params.signal + ), + (client) => + client.callTool(params.toolCall, { + signal: params.signal, + timeoutMs: params.timeoutMs, + }) + ) + ) + } + /** Auth-scoped pool key: a server's resolved credentials depend on the (user, workspace) env. */ private poolKey( serverId: string, @@ -512,7 +601,8 @@ class McpService { userId: string, workspaceId: string, onResolvedSecretTraceProvenance?: ResolvedSecretTraceProvenanceCallback, - signal?: AbortSignal + signal?: AbortSignal, + requireComplete = false ): Promise { for (let attempt = 0; ; attempt++) { signal?.throwIfAborted() @@ -538,7 +628,9 @@ class McpService { workspaceId, onResolvedSecretTraceProvenance ) - return client.listTools(signal) + return requireComplete + ? client.listTools(signal, { requireComplete: true }) + : client.listTools(signal) } ) } catch (error) { @@ -1041,18 +1133,19 @@ class McpService { onResolvedSecretTraceProvenance?: ResolvedSecretTraceProvenanceCallback, options: McpRequestOptions = {} ): Promise { - if (onResolvedSecretTraceProvenance || options.signal) { + if (onResolvedSecretTraceProvenance || options.signal || options.requireComplete) { return this.discoverServerToolsImpl( userId, serverId, workspaceId, refresh, createInvocationProvenanceReporter(onResolvedSecretTraceProvenance), - options.signal + options.signal, + options.requireComplete ) } - const inflightKey = `${workspaceId}:${serverId}:${userId}:${refresh}` + const inflightKey = `${workspaceId}:${serverId}:${userId}:${refresh}:partial-ok` const existing = this.inflightServerDiscovery.get(inflightKey) if (existing) return existing @@ -1062,7 +1155,8 @@ class McpService { workspaceId, refresh, undefined, - undefined + undefined, + false ).finally(() => { this.inflightServerDiscovery.delete(inflightKey) }) @@ -1076,14 +1170,15 @@ class McpService { workspaceId: string, refresh: McpDiscoveryRefresh, onResolvedSecretTraceProvenance?: ResolvedSecretTraceProvenanceCallback, - signal?: AbortSignal + signal?: AbortSignal, + requireComplete = false ): Promise { signal?.throwIfAborted() const requestId = generateRequestId() const discoveryStartedAt = new Date() const maxRetries = 2 - if (refresh === 'cache-aside') { + if (refresh === 'cache-aside' && !requireComplete) { try { const cached = await this.cacheAdapter.get(serverCacheKey(workspaceId, serverId)) if (cached) { @@ -1119,7 +1214,8 @@ class McpService { userId, workspaceId, onResolvedSecretTraceProvenance, - signal + signal, + requireComplete ) logger.info(`[${requestId}] Discovered ${tools.length} tools from server ${config.name}`) await Promise.allSettled([ @@ -1265,7 +1361,7 @@ class McpService { /** Evict a single server's warm pooled connections (all users) — call on config change/delete. */ async evictServerConnections(serverId: string, reason: string): Promise { - await mcpConnectionPool?.evictServer(serverId, reason) + await evictMcpServerConnections(serverId, reason) } } diff --git a/apps/sim/lib/mcp/shared.test.ts b/apps/sim/lib/mcp/shared.test.ts new file mode 100644 index 00000000000..2de40f97495 --- /dev/null +++ b/apps/sim/lib/mcp/shared.test.ts @@ -0,0 +1,63 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { assertValidMcpServerToolBindings } from '@/lib/mcp/shared' + +describe('assertValidMcpServerToolBindings', () => { + it('accepts distinct server-wide bindings and unrelated individual tools', () => { + expect(() => + assertValidMcpServerToolBindings([ + { type: 'mcp-server-advanced', params: { serverId: 'mcp-a' } }, + { type: 'mcp-server-advanced', params: { serverId: 'mcp-b' } }, + { type: 'mcp', params: { serverId: 'mcp-c', toolName: 'lookup' } }, + ]) + ).not.toThrow() + }) + + it('rejects duplicate server-wide bindings', () => { + expect(() => + assertValidMcpServerToolBindings([ + { type: 'mcp-server-advanced', params: { serverId: 'mcp-a' } }, + { type: 'mcp-server-advanced', params: { serverId: 'mcp-a' } }, + ]) + ).toThrow('Duplicate MCP Server (Advanced) binding for mcp-a') + }) + + it('rejects mixing a server-wide binding with individual tools from that server', () => { + expect(() => + assertValidMcpServerToolBindings([ + { type: 'mcp', params: { serverId: 'mcp-a', toolName: 'lookup' } }, + { type: 'mcp-server-advanced', params: { serverId: 'mcp-a' } }, + ]) + ).toThrow('cannot be attached as both an advanced server and individual tools') + }) + + it('ignores disabled bindings when checking conflicts', () => { + expect(() => + assertValidMcpServerToolBindings([ + { type: 'mcp', params: { serverId: 'mcp-a', toolName: 'lookup' } }, + { + type: 'mcp-server-advanced', + params: { serverId: 'mcp-a' }, + usageControl: 'none', + }, + ]) + ).not.toThrow() + }) + + it('ignores server-wide bindings with blank server IDs', () => { + expect(() => + assertValidMcpServerToolBindings([ + { type: 'mcp-server-advanced', params: { serverId: '' } }, + { type: 'mcp-server-advanced', params: { serverId: ' ' } }, + ]) + ).not.toThrow() + }) + + it('fails fast on a malformed active server-wide binding', () => { + expect(() => + assertValidMcpServerToolBindings([{ type: 'mcp-server-advanced', params: {} }]) + ).toThrow('requires params.serverId') + }) +}) diff --git a/apps/sim/lib/mcp/shared.ts b/apps/sim/lib/mcp/shared.ts index eaecff1f0e9..522fe514e52 100644 --- a/apps/sim/lib/mcp/shared.ts +++ b/apps/sim/lib/mcp/shared.ts @@ -5,6 +5,68 @@ import { isMcpTool, MCP } from '@/executor/constants' +export const MCP_SERVER_ADVANCED_TOOL_TYPE = 'mcp-server-advanced' as const + +export interface McpServerAdvancedToolBinding { + type: typeof MCP_SERVER_ADVANCED_TOOL_TYPE + params: { + serverId: string + } + usageControl?: 'auto' | 'force' | 'none' +} + +export function isMcpServerAdvancedToolBinding( + value: unknown +): value is McpServerAdvancedToolBinding { + if (!value || typeof value !== 'object' || Array.isArray(value)) return false + const binding = value as { type?: unknown; params?: unknown } + if (binding.type !== MCP_SERVER_ADVANCED_TOOL_TYPE) return false + if (!binding.params || typeof binding.params !== 'object' || Array.isArray(binding.params)) { + return false + } + const serverId = (binding.params as { serverId?: unknown }).serverId + return typeof serverId === 'string' && serverId.trim().length > 0 +} + +/** Rejects ambiguous server-wide bindings while leaving legacy MCP entries untouched. */ +export function assertValidMcpServerToolBindings(value: unknown): void { + if (!Array.isArray(value)) return + const advancedServerIds = new Set() + const individualServerIds = new Set() + for (const candidate of value) { + if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) continue + const tool = candidate as { + type?: unknown + usageControl?: unknown + params?: { serverId?: unknown } + } + if (tool.usageControl === 'none') continue + if (tool.type === 'mcp') { + if (typeof tool.params?.serverId === 'string' && tool.params.serverId) { + individualServerIds.add(tool.params.serverId) + } + continue + } + if (tool.type !== MCP_SERVER_ADVANCED_TOOL_TYPE) continue + const serverId = tool.params?.serverId + if (typeof serverId !== 'string') { + throw new Error('MCP Server (Advanced) requires params.serverId') + } + if (!serverId.trim()) continue + if (advancedServerIds.has(serverId)) { + throw new Error(`Duplicate MCP Server (Advanced) binding for ${serverId}`) + } + advancedServerIds.add(serverId) + } + for (const serverId of advancedServerIds) { + if (individualServerIds.has(serverId)) { + throw new Error( + `MCP server ${serverId} cannot be attached as both an advanced server and individual tools` + ) + } + } +} + /** * Sanitizes a string by removing invisible Unicode characters that cause HTTP header errors. * Handles characters like U+2028 (Line Separator) that can be introduced via copy-paste. diff --git a/apps/sim/lib/mcp/types.ts b/apps/sim/lib/mcp/types.ts index c6d4e584666..e4a557329d9 100644 --- a/apps/sim/lib/mcp/types.ts +++ b/apps/sim/lib/mcp/types.ts @@ -1,4 +1,5 @@ import type { Tool } from '@modelcontextprotocol/sdk/types.js' +import type { ManagedMcpConnectorId } from '@/lib/credential-groups/managed-mcp-connectors' import type { ResolvedSecretTraceProvenanceV1 } from '@/executor/utils/resolved-secret-trace-registry' export type McpTransport = 'streamable-http' @@ -91,6 +92,7 @@ export interface McpTool extends Pick { inputSchema: McpToolSchema serverId: string serverName: string + managedConnectorId?: ManagedMcpConnectorId } export interface McpToolCall { diff --git a/apps/sim/lib/mcp/utils.test.ts b/apps/sim/lib/mcp/utils.test.ts index 3fa3d61806c..8a459a48c3e 100644 --- a/apps/sim/lib/mcp/utils.test.ts +++ b/apps/sim/lib/mcp/utils.test.ts @@ -9,10 +9,13 @@ import { import { categorizeError, createMcpToolId, + generateManagedMcpConnectionId, generateMcpServerId, + isManagedMcpConnectionId, MCP_CLIENT_CONSTANTS, MCP_CONSTANTS, parseMcpToolId, + parseMcpToolTarget, validateRequiredFields, validateStringParam, } from './utils' @@ -431,3 +434,40 @@ describe('parseMcpToolId', () => { expect(result.toolName).toBe('tool-with-many-parts') }) }) + +describe('parseMcpToolTarget', () => { + it('preserves a managed connection ID even when its random segment contains hyphens', () => { + const credentialId = 'mcp-cg-abcd-efghijklmnopqrst' + const result = parseMcpToolTarget(`${credentialId}-fireflies-search-transcripts`) + + expect(result).toEqual({ + kind: 'managed_connection', + credentialId, + toolName: 'fireflies-search-transcripts', + }) + }) + + it('keeps existing shared MCP tool IDs unchanged', () => { + expect(parseMcpToolTarget('mcp-12345678-search-transcripts')).toEqual({ + kind: 'shared_server', + serverId: 'mcp-12345678', + toolName: 'search-transcripts', + }) + }) + + it('rejects a managed connection ID without a tool name', () => { + const credentialId = generateManagedMcpConnectionId() + expect(() => parseMcpToolTarget(credentialId)).toThrow('Invalid managed MCP tool ID format') + }) +}) + +describe('isManagedMcpConnectionId', () => { + it('accepts only a complete managed connection ID', () => { + const credentialId = generateManagedMcpConnectionId() + + expect(isManagedMcpConnectionId(credentialId)).toBe(true) + expect(isManagedMcpConnectionId(`${credentialId}-tool`)).toBe(false) + expect(isManagedMcpConnectionId('mcp-cg-short')).toBe(false) + expect(isManagedMcpConnectionId('mcp-shared')).toBe(false) + }) +}) diff --git a/apps/sim/lib/mcp/utils.ts b/apps/sim/lib/mcp/utils.ts index 5f29e46acf8..b5b417dc421 100644 --- a/apps/sim/lib/mcp/utils.ts +++ b/apps/sim/lib/mcp/utils.ts @@ -1,4 +1,5 @@ import { UnauthorizedError } from '@modelcontextprotocol/sdk/client/auth.js' +import { generateShortId } from '@sim/utils/id' import { NextResponse } from 'next/server' import { DEFAULT_EXECUTION_TIMEOUT_MS } from '@/lib/core/execution-limits' import { @@ -24,6 +25,22 @@ export const MCP_CONSTANTS = { */ export const MCP_TOOL_CORE_PARAMS = new Set(['serverId', 'serverUrl', 'toolName', 'serverName']) +export const MANAGED_MCP_CONNECTION_PREFIX = 'mcp-cg-' +const MANAGED_MCP_RANDOM_ID_LENGTH = 21 +const MANAGED_MCP_CONNECTION_ID_LENGTH = + MANAGED_MCP_CONNECTION_PREFIX.length + MANAGED_MCP_RANDOM_ID_LENGTH + +export function generateManagedMcpConnectionId(): string { + return `${MANAGED_MCP_CONNECTION_PREFIX}${generateShortId(MANAGED_MCP_RANDOM_ID_LENGTH)}` +} + +export function isManagedMcpConnectionId(value: string): boolean { + return ( + value.startsWith(MANAGED_MCP_CONNECTION_PREFIX) && + value.length === MANAGED_MCP_CONNECTION_ID_LENGTH + ) +} + /** * Sanitizes a string by removing invisible Unicode characters that cause HTTP header errors. * Handles characters like U+2028 (Line Separator) that can be introduced via copy-paste. @@ -220,6 +237,29 @@ export function parseMcpToolId(toolId: string): { serverId: string; toolName: st return { serverId, toolName } } +export type ParsedMcpToolTarget = + | { kind: 'shared_server'; serverId: string; toolName: string } + | { kind: 'managed_connection'; credentialId: string; toolName: string } + +export function parseMcpToolTarget(toolId: string): ParsedMcpToolTarget { + if (toolId.startsWith(MANAGED_MCP_CONNECTION_PREFIX)) { + if ( + toolId.length <= MANAGED_MCP_CONNECTION_ID_LENGTH || + toolId[MANAGED_MCP_CONNECTION_ID_LENGTH] !== '-' + ) { + throw new Error( + `Invalid managed MCP tool ID format: ${toolId}. Expected: mcp-cg-connectionId-toolName` + ) + } + const credentialId = toolId.slice(0, MANAGED_MCP_CONNECTION_ID_LENGTH) + const toolName = toolId.slice(MANAGED_MCP_CONNECTION_ID_LENGTH + 1) + if (!toolName) throw new Error(`Invalid managed MCP tool ID format: ${toolId}`) + return { kind: 'managed_connection', credentialId, toolName } + } + const { serverId, toolName } = parseMcpToolId(toolId) + return { kind: 'shared_server', serverId, toolName } +} + /** * Generate a deterministic MCP server ID based on workspace and URL. * diff --git a/apps/sim/lib/oauth/monday.test.ts b/apps/sim/lib/oauth/monday.test.ts new file mode 100644 index 00000000000..bf12e745e4f --- /dev/null +++ b/apps/sim/lib/oauth/monday.test.ts @@ -0,0 +1,158 @@ +/** + * @vitest-environment node + */ +import { afterEach, describe, expect, it, vi } from 'vitest' +import { + exchangeMondayAuthorizationCode, + MONDAY_OAUTH_TOKEN_URL, + resolveMondayAccessTokenExpiresAt, +} from '@/lib/oauth/monday' + +const SCOPES = [ + 'boards:read', + 'boards:write', + 'updates:read', + 'updates:write', + 'webhooks:read', + 'webhooks:write', + 'me:read', +] + +function unsignedJwt(payload: Record): string { + const header = Buffer.from(JSON.stringify({ alg: 'none', typ: 'JWT' })).toString('base64url') + const body = Buffer.from(JSON.stringify(payload)).toString('base64url') + return `${header}.${body}.signature` +} + +function tokenResponse(overrides: Record = {}): Response { + return new Response( + JSON.stringify({ + access_token: unsignedJwt({ exp: Math.floor(Date.now() / 1000) + 3600 }), + refresh_token: 'monday-refresh-token', + token_type: 'Bearer', + scope: SCOPES.join(' '), + ...overrides, + }), + { status: 200, headers: { 'Content-Type': 'application/json' } } + ) +} + +describe('Monday OAuth 2.1', () => { + afterEach(() => { + vi.unstubAllGlobals() + }) + + it('exchanges a PKCE authorization code at the v2 endpoint', async () => { + const fetchMock = vi.fn().mockResolvedValue(tokenResponse()) + vi.stubGlobal('fetch', fetchMock) + + const tokens = await exchangeMondayAuthorizationCode({ + clientId: 'monday-client-id', + clientSecret: 'monday-client-secret', + code: 'authorization-code', + codeVerifier: 'pkce-verifier', + redirectUri: 'https://www.sim.ai/api/auth/oauth2/callback/monday', + }) + + expect(tokens).toMatchObject({ + refreshToken: 'monday-refresh-token', + tokenType: 'Bearer', + scopes: SCOPES, + }) + expect(tokens.accessTokenExpiresAt).toBeInstanceOf(Date) + + const [endpoint, request] = fetchMock.mock.calls[0] as [string, RequestInit] + expect(endpoint).toBe(MONDAY_OAUTH_TOKEN_URL) + expect(request).toMatchObject({ + method: 'POST', + redirect: 'error', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + }) + expect(JSON.parse(request.body as string)).toEqual({ + grant_type: 'authorization_code', + client_id: 'monday-client-id', + client_secret: 'monday-client-secret', + code: 'authorization-code', + redirect_uri: 'https://www.sim.ai/api/auth/oauth2/callback/monday', + code_verifier: 'pkce-verifier', + }) + }) + + it('uses the access-token JWT expiration before response and fallback lifetimes', () => { + const now = new Date('2026-09-01T12:00:00.000Z') + const jwtExpirySeconds = Math.floor(now.getTime() / 1000) + 2700 + const expiresAt = resolveMondayAccessTokenExpiresAt( + unsignedJwt({ exp: jwtExpirySeconds }), + 1800, + now + ) + + expect(expiresAt).toEqual(new Date(jwtExpirySeconds * 1000)) + }) + + it('preserves an expired JWT expiration so the credential refreshes immediately', () => { + const now = new Date('2026-09-01T12:00:00.000Z') + const jwtExpirySeconds = Math.floor(now.getTime() / 1000) - 60 + + expect( + resolveMondayAccessTokenExpiresAt(unsignedJwt({ exp: jwtExpirySeconds }), 3600, now) + ).toEqual(new Date(jwtExpirySeconds * 1000)) + }) + + it('falls back to expires_in and then one hour for an opaque access token', () => { + const now = new Date('2026-09-01T12:00:00.000Z') + + expect(resolveMondayAccessTokenExpiresAt('opaque-token', 1200, now)).toEqual( + new Date('2026-09-01T12:20:00.000Z') + ) + expect(resolveMondayAccessTokenExpiresAt('opaque-token', undefined, now)).toEqual( + new Date('2026-09-01T13:00:00.000Z') + ) + }) + + it.each([ + ['missing refresh token', { refresh_token: undefined }], + ['missing access token', { access_token: undefined }], + ['non-bearer token', { token_type: 'mac' }], + ])('rejects an incomplete response: %s', async (_label, overrides) => { + vi.stubGlobal('fetch', vi.fn().mockResolvedValue(tokenResponse(overrides))) + + await expect( + exchangeMondayAuthorizationCode({ + clientId: 'client-id', + clientSecret: 'client-secret', + code: 'authorization-code', + codeVerifier: 'pkce-verifier', + redirectUri: 'https://www.sim.ai/api/auth/oauth2/callback/monday', + }) + ).rejects.toThrow('Monday OAuth token response was incomplete') + }) + + it('does not expose a provider error response or request secrets', async () => { + const providerSecret = 'provider-secret-that-must-not-escape' + vi.stubGlobal( + 'fetch', + vi.fn().mockResolvedValue( + new Response(JSON.stringify({ error: providerSecret }), { + status: 400, + headers: { 'Content-Type': 'application/json' }, + }) + ) + ) + + const error = await exchangeMondayAuthorizationCode({ + clientId: 'client-id', + clientSecret: 'client-secret-that-must-not-escape', + code: 'authorization-code-that-must-not-escape', + codeVerifier: 'pkce-verifier-that-must-not-escape', + redirectUri: 'https://www.sim.ai/api/auth/oauth2/callback/monday', + }).catch((caught: unknown) => caught) + + expect(error).toBeInstanceOf(Error) + expect((error as Error).message).toBe('Monday OAuth token exchange failed with HTTP 400') + expect((error as Error).message).not.toContain(providerSecret) + }) +}) diff --git a/apps/sim/lib/oauth/monday.ts b/apps/sim/lib/oauth/monday.ts new file mode 100644 index 00000000000..ace87d76433 --- /dev/null +++ b/apps/sim/lib/oauth/monday.ts @@ -0,0 +1,124 @@ +import type { OAuth2Tokens } from 'better-auth/oauth2' +import { decodeJwt } from 'jose' +import { z } from 'zod' +import { + DEFAULT_MAX_ERROR_BODY_BYTES, + readResponseJsonWithLimit, + readResponseTextWithLimit, +} from '@/lib/core/utils/stream-limits' + +export const MONDAY_OAUTH_AUTHORIZATION_URL = 'https://auth.monday.com/oauth2/authorize' +export const MONDAY_OAUTH_TOKEN_URL = 'https://auth.monday.com/oauth_ms/oauth/token' + +const MONDAY_OAUTH_TOKEN_TIMEOUT_MS = 15_000 +const MONDAY_ACCESS_TOKEN_FALLBACK_LIFETIME_SECONDS = 60 * 60 +const MONDAY_ACCESS_TOKEN_MAX_RESPONSE_LIFETIME_SECONDS = 24 * 60 * 60 + +const mondayOAuthTokenResponseSchema = z.object({ + access_token: z.string().min(1), + refresh_token: z.string().min(1), + token_type: z.string().min(1), + expires_in: z.union([z.number(), z.string()]).optional(), + scope: z.string().optional(), +}) + +interface ExchangeMondayAuthorizationCodeParams { + clientId: string + clientSecret: string + code: string + codeVerifier: string + redirectUri: string +} + +function parsePositiveLifetimeSeconds(value: unknown): number | undefined { + const parsed = typeof value === 'number' || typeof value === 'string' ? Number(value) : Number.NaN + return Number.isFinite(parsed) && + parsed > 0 && + parsed <= MONDAY_ACCESS_TOKEN_MAX_RESPONSE_LIFETIME_SECONDS + ? parsed + : undefined +} + +/** + * Resolves monday.com's access-token expiry for storage and refresh scheduling. + * + * OAuth 2.1 access tokens are JWTs and monday.com documents the `exp` claim as + * authoritative. The response lifetime and one-hour documented default keep + * credentials refreshable if a deployment temporarily receives an opaque token. + */ +export function resolveMondayAccessTokenExpiresAt( + accessToken: string, + expiresIn?: unknown, + now = new Date() +): Date { + try { + const { exp } = decodeJwt(accessToken) + if (typeof exp === 'number' && Number.isFinite(exp)) { + const expiresAt = new Date(exp * 1000) + if (!Number.isNaN(expiresAt.getTime())) return expiresAt + } + } catch {} + + const lifetimeSeconds = + parsePositiveLifetimeSeconds(expiresIn) ?? MONDAY_ACCESS_TOKEN_FALLBACK_LIFETIME_SECONDS + return new Date(now.getTime() + lifetimeSeconds * 1000) +} + +/** Exchanges a monday.com OAuth 2.1 authorization code without exposing token material. */ +export async function exchangeMondayAuthorizationCode({ + clientId, + clientSecret, + code, + codeVerifier, + redirectUri, +}: ExchangeMondayAuthorizationCodeParams): Promise { + const signal = AbortSignal.timeout(MONDAY_OAUTH_TOKEN_TIMEOUT_MS) + const response = await fetch(MONDAY_OAUTH_TOKEN_URL, { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + grant_type: 'authorization_code', + client_id: clientId, + client_secret: clientSecret, + code, + redirect_uri: redirectUri, + code_verifier: codeVerifier, + }), + redirect: 'error', + signal, + }) + if (!response.ok) { + await readResponseTextWithLimit(response, { + maxBytes: DEFAULT_MAX_ERROR_BODY_BYTES, + label: 'Monday OAuth token error response', + signal, + }).catch(() => {}) + throw new Error(`Monday OAuth token exchange failed with HTTP ${response.status}`) + } + + const payload = await readResponseJsonWithLimit(response, { + maxBytes: DEFAULT_MAX_ERROR_BODY_BYTES, + label: 'Monday OAuth token response', + signal, + }) + + const parsed = mondayOAuthTokenResponseSchema.safeParse(payload) + if (!parsed.success || parsed.data.token_type.toLowerCase() !== 'bearer') { + throw new Error('Monday OAuth token response was incomplete') + } + + const scopes = parsed.data.scope?.split(/\s+/).filter(Boolean) + return { + accessToken: parsed.data.access_token, + refreshToken: parsed.data.refresh_token, + tokenType: parsed.data.token_type, + accessTokenExpiresAt: resolveMondayAccessTokenExpiresAt( + parsed.data.access_token, + parsed.data.expires_in + ), + ...(scopes ? { scopes } : {}), + } +} diff --git a/apps/sim/lib/oauth/oauth.test.ts b/apps/sim/lib/oauth/oauth.test.ts index 3aadd1da130..d5411450953 100644 --- a/apps/sim/lib/oauth/oauth.test.ts +++ b/apps/sim/lib/oauth/oauth.test.ts @@ -1,5 +1,5 @@ import { createMockFetch, resetEnvMock, setEnv } from '@sim/testing' -import { getOAuth2Tokens } from 'better-auth/oauth2' +import { createAuthorizationURL, getOAuth2Tokens } from 'better-auth/oauth2' import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' beforeAll(() => { @@ -50,7 +50,7 @@ beforeAll(() => { SALESFORCE_CLIENT_ID: 'salesforce_client_id', SALESFORCE_CLIENT_SECRET: 'salesforce_client_secret', ZOHO_CLIENT_ID: 'zoho_client_id', - ZOHO_CLIENT_SECRET: 'zoho_client_secret', + ZOHO_CLIENT_SECRET: undefined, SHOPIFY_CLIENT_ID: 'shopify_client_id', SHOPIFY_CLIENT_SECRET: 'shopify_client_secret', ZOOM_CLIENT_ID: 'zoom_client_id', @@ -61,7 +61,7 @@ beforeAll(() => { SPOTIFY_CLIENT_SECRET: 'spotify_client_secret', CALCOM_CLIENT_ID: 'calcom_client_id', MONDAY_CLIENT_ID: 'monday_client_id', - MONDAY_CLIENT_SECRET: undefined, + MONDAY_CLIENT_SECRET: 'monday_client_secret', }) }) @@ -93,6 +93,12 @@ const defaultOAuthResponse = { }, } +function oauthTestJwt(payload: Record): string { + const header = Buffer.from(JSON.stringify({ alg: 'none', typ: 'JWT' })).toString('base64url') + const body = Buffer.from(JSON.stringify(payload)).toString('base64url') + return `${header}.${body}.signature` +} + /** * Helper to run a function with a mocked global fetch. */ @@ -146,6 +152,74 @@ describe('Atlassian OAuth connectors', () => { ) }) +function getMondayConnector() { + const connector = buildConnectorProviders().find((candidate) => candidate.providerId === 'monday') + if (!connector) throw new Error('Monday OAuth connector is not configured in this test') + return connector +} + +describe('Monday OAuth connector', () => { + it('generates the OAuth 2.1 authorization request from the connector contract', async () => { + const connector = getMondayConnector() + expect(connector).toMatchObject({ + providerId: 'monday', + authorizationUrl: 'https://auth.monday.com/oauth2/authorize', + tokenUrl: 'https://auth.monday.com/oauth_ms/oauth/token', + scopes: [ + 'boards:read', + 'boards:write', + 'updates:read', + 'updates:write', + 'webhooks:read', + 'webhooks:write', + 'me:read', + ], + responseType: 'code', + pkce: true, + authentication: 'post', + redirectURI: 'http://localhost:3000/api/auth/oauth2/callback/monday', + }) + const authorizationUrl = await createAuthorizationURL({ + id: connector.providerId, + options: { + clientId: connector.clientId, + clientSecret: connector.clientSecret, + redirectURI: connector.redirectURI, + }, + authorizationEndpoint: connector.authorizationUrl!, + state: 'state-1', + codeVerifier: 'a'.repeat(128), + scopes: connector.scopes, + redirectURI: connector.redirectURI!, + responseType: connector.responseType, + }) + + expect(authorizationUrl.searchParams.get('redirect_uri')).toBe( + 'http://localhost:3000/api/auth/oauth2/callback/monday' + ) + expect(authorizationUrl.searchParams.get('scope')).toBe(connector.scopes?.join(' ')) + expect(authorizationUrl.searchParams.get('code_challenge_method')).toBe('S256') + expect(authorizationUrl.searchParams.get('code_challenge')).toBeTruthy() + }) + + it('rejects GraphQL errors returned with HTTP 200 during user-info lookup', async () => { + const getUserInfo = getMondayConnector().getUserInfo + if (!getUserInfo) throw new Error('Monday OAuth connector must define getUserInfo') + + const userInfo = await withMockFetch( + createMockFetch({ + json: { + data: { me: { id: 'user-1', name: 'Person', email: 'person@example.com' } }, + errors: [{ message: 'Permission denied' }], + }, + }), + () => getUserInfo({ accessToken: 'access-token' }) + ) + + expect(userInfo).toBeNull() + }) +}) + describe('Microsoft Dataverse OAuth connector', () => { it('keeps static connector scopes empty and supplies the canonical legacy grant per request', () => { const connector = buildConnectorProviders().find( @@ -645,13 +719,13 @@ describe('OAuth Token Refresh', () => { const mockFetch = createMockFetch(defaultOAuthResponse) const result = await withMockFetch(mockFetch, () => - refreshOAuthToken('monday', 'test_refresh_token') + refreshOAuthToken('zoho-desk', 'test_refresh_token') ) expect(result).toEqual({ ok: false, message: - 'OAuth client monday is partially configured — missing MONDAY_CLIENT_SECRET. Run npx sim-setup add integration monday.', + 'OAuth client zoho-desk is partially configured — missing ZOHO_CLIENT_SECRET. Run npx sim-setup add integration zoho-desk.', }) expect(mockFetch).not.toHaveBeenCalled() }) @@ -827,6 +901,59 @@ describe('OAuth Token Refresh', () => { }) }) + it.concurrent('refreshes Monday with JSON body credentials and rotates its token', async () => { + const expiresAtSeconds = Math.floor(Date.now() / 1000) + 2700 + const mockFetch = createMockFetch({ + json: { + access_token: oauthTestJwt({ exp: expiresAtSeconds }), + refresh_token: 'rotated-monday-refresh-token', + token_type: 'Bearer', + scope: 'boards:read me:read', + }, + }) + + const result = await withMockFetch(mockFetch, () => + refreshOAuthToken('monday', 'old-monday-refresh-token') + ) + + expect(result).toMatchObject({ + ok: true, + refreshToken: 'rotated-monday-refresh-token', + }) + if (result.ok) { + expect(result.expiresIn).toBeGreaterThanOrEqual(2699) + expect(result.expiresIn).toBeLessThanOrEqual(2700) + } + + const [endpoint, request] = mockFetch.mock.calls[0] as [string, RequestInit] + expect(endpoint).toBe('https://auth.monday.com/oauth_ms/oauth/token') + expect(request.headers).toMatchObject({ 'Content-Type': 'application/json' }) + expect(JSON.parse(request.body as string)).toEqual({ + grant_type: 'refresh_token', + refresh_token: 'old-monday-refresh-token', + client_id: 'monday_client_id', + client_secret: 'monday_client_secret', + }) + }) + + it.concurrent('rejects a Monday refresh response that omits token rotation', async () => { + const mockFetch = createMockFetch({ + json: { + access_token: oauthTestJwt({ exp: Math.floor(Date.now() / 1000) + 3600 }), + token_type: 'Bearer', + }, + }) + + const result = await withMockFetch(mockFetch, () => + refreshOAuthToken('monday', 'old-monday-refresh-token') + ) + + expect(result).toEqual({ + ok: false, + message: 'Invalid Monday token refresh response', + }) + }) + it.concurrent('should return Bitbucket rotating refresh tokens', async () => { const mockFetch = createMockFetch({ json: { diff --git a/apps/sim/lib/oauth/oauth.ts b/apps/sim/lib/oauth/oauth.ts index a8d07519aaa..b77cc07bd95 100644 --- a/apps/sim/lib/oauth/oauth.ts +++ b/apps/sim/lib/oauth/oauth.ts @@ -78,6 +78,7 @@ import { } from '@/lib/core/utils/stream-limits' import { getDocusignOAuthUrl } from '@/lib/oauth/docusign' import { parseInstagramLongLivedToken } from '@/lib/oauth/instagram' +import { MONDAY_OAUTH_TOKEN_URL, resolveMondayAccessTokenExpiresAt } from '@/lib/oauth/monday' import { SALESFORCE_ADDITIONAL_PROVIDER_IDS, SALESFORCE_LOGIN_HOSTS, @@ -1891,11 +1892,12 @@ function getProviderAuthConfig(provider: string): ProviderAuthConfig { 'MONDAY_CLIENT_SECRET' ) return { - tokenEndpoint: 'https://auth.monday.com/oauth2/token', + tokenEndpoint: MONDAY_OAUTH_TOKEN_URL, clientId, clientSecret, useBasicAuth: false, - supportsRefreshTokenRotation: false, + useJsonBody: true, + supportsRefreshTokenRotation: true, } } case 'zoho-desk': { @@ -2206,14 +2208,29 @@ export async function refreshOAuthToken( newRefreshToken = data.refresh_token logger.info(`Received new refresh token from ${provider}`) } + if (provider === 'monday' && !newRefreshToken) { + logger.warn('Monday token refresh response omitted its rotating refresh token') + return { ok: false, message: 'Invalid Monday token refresh response' } + } const rawExpiresIn = data.expires_in ?? data.expiresIn const parsedExpiresIn = typeof rawExpiresIn === 'number' || typeof rawExpiresIn === 'string' ? Number(rawExpiresIn) : Number.NaN + const responseExpiresIn = + Number.isFinite(parsedExpiresIn) && parsedExpiresIn > 0 ? parsedExpiresIn : undefined const expiresIn = - Number.isFinite(parsedExpiresIn) && parsedExpiresIn > 0 ? parsedExpiresIn : 3600 + provider === 'monday' && accessToken + ? Math.max( + 1, + Math.ceil( + (resolveMondayAccessTokenExpiresAt(accessToken, responseExpiresIn).getTime() - + Date.now()) / + 1000 + ) + ) + : (responseExpiresIn ?? 3600) if (!accessToken) { // Log only the shape, never `data` itself - on a partial success it can diff --git a/apps/sim/lib/uploads/contexts/workspace/workspace-file-manager-download.test.ts b/apps/sim/lib/uploads/contexts/workspace/workspace-file-manager-download.test.ts new file mode 100644 index 00000000000..cf600727ae4 --- /dev/null +++ b/apps/sim/lib/uploads/contexts/workspace/workspace-file-manager-download.test.ts @@ -0,0 +1,114 @@ +/** + * @vitest-environment node + */ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const { mockDownloadFile } = vi.hoisted(() => ({ + mockDownloadFile: vi.fn(), +})) + +vi.mock('@/lib/billing/storage', () => ({ + decrementStorageUsageForBillingContextInTx: vi.fn(), + incrementStorageUsageForBillingContextInTx: vi.fn(), + maybeNotifyStorageLimitForBillingContext: vi.fn(), + resolveStorageBillingContext: vi.fn(), +})) + +vi.mock('@/lib/uploads', () => ({ + getServePathPrefix: vi.fn(() => '/api/files/serve/s3/'), +})) + +vi.mock('@/lib/uploads/core/storage-service', () => ({ + deleteFile: vi.fn(), + downloadFile: mockDownloadFile, + hasCloudStorage: vi.fn(() => false), + headObject: vi.fn(), + uploadFile: vi.fn(), +})) + +vi.mock('@/lib/uploads/contexts/workspace/workspace-file-folder-manager', () => ({ + assertWorkspaceFileFolderTarget: vi.fn(async () => null), + buildWorkspaceFileFolderPathMap: vi.fn(() => new Map()), + fileNameExistsInWorkspaceFolder: vi.fn(async () => false), + findWorkspaceFileFolderIdByPath: vi.fn(), + getWorkspaceFileFolderPath: vi.fn(), + listWorkspaceFileFolders: vi.fn(async () => []), + normalizeWorkspaceFileItemName: vi.fn((name: string) => name), + resolveWorkspaceFileFolderTarget: vi.fn(async () => null), +})) + +import { assertKnownSizeWithinLimit, isPayloadSizeLimitError } from '@/lib/core/utils/stream-limits' +import { + fetchWorkspaceFileBuffer, + type WorkspaceFileRecord, +} from '@/lib/uploads/contexts/workspace/workspace-file-manager' + +const FILE: WorkspaceFileRecord = { + id: 'file-1', + workspaceId: 'workspace-1', + name: 'notes.txt', + key: 'workspace/workspace-1/notes.txt', + path: '/api/files/serve/workspace/workspace-1/notes.txt', + size: 5, + type: 'text/plain', + uploadedBy: 'user-1', + uploadedAt: new Date('2026-09-01T00:00:00.000Z'), + updatedAt: new Date('2026-09-01T00:00:00.000Z'), +} + +function sizeLimitError(): unknown { + try { + assertKnownSizeWithinLimit(2, 1, 'test') + } catch (error) { + return error + } + throw new Error('assertKnownSizeWithinLimit did not throw') +} + +describe('fetchWorkspaceFileBuffer', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('forwards the byte ceiling and the cancellation signal to storage', async () => { + const bytes = Buffer.from('hello') + mockDownloadFile.mockResolvedValue(bytes) + const signal = new AbortController().signal + + await expect(fetchWorkspaceFileBuffer(FILE, { maxBytes: 10, signal })).resolves.toBe(bytes) + expect(mockDownloadFile).toHaveBeenCalledWith({ + key: FILE.key, + context: 'workspace', + maxBytes: 10, + signal, + }) + }) + + it('surfaces a cancelled read as the abort rather than a download failure', async () => { + const controller = new AbortController() + mockDownloadFile.mockImplementation(async () => { + controller.abort() + throw new Error('read interrupted') + }) + + await expect( + fetchWorkspaceFileBuffer(FILE, { maxBytes: 10, signal: controller.signal }) + ).rejects.toMatchObject({ name: 'AbortError' }) + }) + + it('rethrows a byte-ceiling breach unwrapped', async () => { + mockDownloadFile.mockRejectedValue(sizeLimitError()) + + await expect(fetchWorkspaceFileBuffer(FILE, { maxBytes: 10 })).rejects.toSatisfy( + isPayloadSizeLimitError + ) + }) + + it('wraps other transport failures', async () => { + mockDownloadFile.mockRejectedValue(new Error('socket hang up')) + + await expect(fetchWorkspaceFileBuffer(FILE, { maxBytes: 10 })).rejects.toThrow( + 'Failed to download file: socket hang up' + ) + }) +}) diff --git a/apps/sim/lib/uploads/contexts/workspace/workspace-file-manager.ts b/apps/sim/lib/uploads/contexts/workspace/workspace-file-manager.ts index 8abdc85a040..bbf605e300a 100644 --- a/apps/sim/lib/uploads/contexts/workspace/workspace-file-manager.ts +++ b/apps/sim/lib/uploads/contexts/workspace/workspace-file-manager.ts @@ -1678,7 +1678,7 @@ export async function fetchServableWorkspaceFileBuffer( */ export async function fetchWorkspaceFileBuffer( fileRecord: WorkspaceFileRecord, - options: { maxBytes: number } + options: { maxBytes: number; signal?: AbortSignal } ): Promise { logger.info(`Downloading workspace file: ${fileRecord.name}`) @@ -1687,12 +1687,16 @@ export async function fetchWorkspaceFileBuffer( key: fileRecord.key, context: fileRecord.storageContext ?? 'workspace', maxBytes: options.maxBytes, + signal: options.signal, }) logger.info( `Successfully downloaded workspace file: ${fileRecord.name} (${buffer.length} bytes)` ) return buffer } catch (error) { + // A cancelled read is not a download failure: surface the abort itself so the + // caller sees cancellation, not a transport error it might retry or record. + options.signal?.throwIfAborted() logger.error(`Failed to download workspace file ${fileRecord.name}:`, error) // Rethrow a `maxBytes` breach unwrapped: callers distinguish "too large" from a // transport failure to answer with their own placeholder, and re-wrapping it in a diff --git a/apps/sim/lib/users/queries.ts b/apps/sim/lib/users/queries.ts index 7d3e783a571..867997cb966 100644 --- a/apps/sim/lib/users/queries.ts +++ b/apps/sim/lib/users/queries.ts @@ -1,12 +1,9 @@ import { db } from '@sim/db' import { settings, user } from '@sim/db/schema' -import { createLogger } from '@sim/logger' -import { getErrorMessage } from '@sim/utils/errors' import { eq, inArray } from 'drizzle-orm' import type { UserSettingsApi } from '@/lib/api/contracts/user' import { normalizeStringArray } from '@/lib/core/utils/arrays' -const logger = createLogger('UserQueries') const MAX_USER_EMAIL_BATCH = 1000 /** @@ -86,23 +83,18 @@ export async function getUserSettings(userId: string | null): Promise { - try { - const [userRecord] = await db - .select({ email: user.email }) - .from(user) - .where(eq(user.id, userId)) - .limit(1) - - return userRecord?.email ?? null - } catch (error) { - logger.warn('Failed to load user email', { userId, error: getErrorMessage(error) }) - return null - } +export async function getUserEmailById(userId: string): Promise { + const [userRecord] = await db + .select({ email: user.email }) + .from(user) + .where(eq(user.id, userId)) + .limit(1) + + if (!userRecord?.email) throw new Error(`Authenticated user ${userId} has no email address`) + return userRecord.email } /** diff --git a/apps/sim/lib/workflows/blocks/block-outputs.test.ts b/apps/sim/lib/workflows/blocks/block-outputs.test.ts index 070a20a07d3..a8ba7281112 100644 --- a/apps/sim/lib/workflows/blocks/block-outputs.test.ts +++ b/apps/sim/lib/workflows/blocks/block-outputs.test.ts @@ -79,11 +79,17 @@ describe('block outputs parity', () => { const paths = getEffectiveBlockOutputPaths('start_trigger', subBlocks, options) expect(outputs).toHaveProperty('metadata') - expect(paths).toContain('metadata.userEmail') + expect(paths).toContain('metadata.subject.kind') + expect(paths).toContain('metadata.subject.userId') + expect(paths).toContain('metadata.subject.email') + expect(paths).toContain('metadata.subject.provider') + expect(paths).toContain('metadata.subject.tenantId') + expect(paths).toContain('metadata.subject.subjectId') + expect(paths).not.toContain('metadata.userEmail') expect(paths).toContain('metadata.executionType') expect(paths).toContain('metadata.workflowId') expect( - getEffectiveBlockOutputType('start_trigger', 'metadata.userEmail', subBlocks, options) + getEffectiveBlockOutputType('start_trigger', 'metadata.subject.kind', subBlocks, options) ).toBe('string') const offOutputs = getEffectiveBlockOutputs('start_trigger', {}, options) diff --git a/apps/sim/lib/workflows/blocks/block-outputs.ts b/apps/sim/lib/workflows/blocks/block-outputs.ts index 3556a5150c0..ed8f324b9e2 100644 --- a/apps/sim/lib/workflows/blocks/block-outputs.ts +++ b/apps/sim/lib/workflows/blocks/block-outputs.ts @@ -149,9 +149,27 @@ const START_RUN_METADATA_OUTPUT = { type: 'json', description: 'Trusted run metadata (server-injected)', properties: { - userEmail: { - type: 'string', - description: 'Email of the user who invoked the run (for custom blocks, the invoking user)', + subject: { + type: 'json', + description: + 'Authenticated caller subject, or null for actorless runs such as workspace API keys and schedules', + properties: { + kind: { + type: 'string', + description: 'Subject kind: sim_user, authenticated_email, or external_user', + }, + userId: { type: 'string', description: 'Sim user ID for a sim_user subject' }, + email: { + type: 'string', + description: 'Email for a Sim user or email-authenticated chat subject', + }, + provider: { type: 'string', description: 'Provider for an external_user subject' }, + tenantId: { + type: 'string', + description: 'Provider tenant ID for an external_user subject', + }, + subjectId: { type: 'string', description: 'Provider user ID for an external_user subject' }, + }, }, workspaceId: { type: 'string', diff --git a/apps/sim/lib/workflows/editing/builders.ts b/apps/sim/lib/workflows/editing/builders.ts index 2218ea5915d..3b45b30325c 100644 --- a/apps/sim/lib/workflows/editing/builders.ts +++ b/apps/sim/lib/workflows/editing/builders.ts @@ -7,6 +7,7 @@ import { normalizeBlockRetryWaitMs, } from '@sim/workflow-types/workflow' import { isIntegrationDeploymentAvailableForVisibility } from '@/lib/integrations/availability.server' +import { MCP_SERVER_ADVANCED_TOOL_TYPE } from '@/lib/mcp/shared' import { capabilityDeniedBy } from '@/lib/permission-groups/capability-assertions' import type { PermissionGroupConfig } from '@/lib/permission-groups/fields' import { createModelAccessGate } from '@/lib/permission-groups/model-access' @@ -801,13 +802,16 @@ export function filterDisallowedTools( }) continue } - if (tool.type === 'mcp' && capabilityDeniedBy('mcp_tools.use', permissionConfig)) { + if ( + (tool.type === 'mcp' || tool.type === MCP_SERVER_ADVANCED_TOOL_TYPE) && + capabilityDeniedBy('mcp_tools.use', permissionConfig) + ) { logSkippedItem(skippedItems, { type: 'tool_not_allowed', operationType: 'add', blockId, reason: `MCP tool "${tool.title || 'unknown'}" is not allowed by permission group - tool not added`, - details: { toolType: 'mcp', serverId: tool.params?.serverId }, + details: { toolType: tool.type, serverId: tool.params?.serverId }, }) continue } diff --git a/apps/sim/lib/workflows/editing/validation.test.ts b/apps/sim/lib/workflows/editing/validation.test.ts index f3255a20200..00d596acc31 100644 --- a/apps/sim/lib/workflows/editing/validation.test.ts +++ b/apps/sim/lib/workflows/editing/validation.test.ts @@ -1493,6 +1493,33 @@ describe('collectUnresolvedAgentToolReferences', () => { expect(mockValidateSelectorIds).toHaveBeenCalledWith('mcp-server-selector', 'srv_missing', CTX) }) + it('defers an advanced MCP server reference until workflow execution', async () => { + const state = { + blocks: { + a1: { + type: 'agent', + subBlocks: { + tools: { + value: [ + { + type: 'mcp-server-advanced', + params: { + serverId: '', + }, + }, + ], + }, + }, + }, + }, + } + + const refs = await collectUnresolvedAgentToolReferences(state, CTX) + + expect(refs).toHaveLength(0) + expect(mockValidateSelectorIds).not.toHaveBeenCalled() + }) + it('flags a skill whose skillId does not resolve', async () => { mockGetSkillById.mockResolvedValue(null) const state = { diff --git a/apps/sim/lib/workflows/editing/validation.ts b/apps/sim/lib/workflows/editing/validation.ts index 5a676c57e0c..aada8e73d19 100644 --- a/apps/sim/lib/workflows/editing/validation.ts +++ b/apps/sim/lib/workflows/editing/validation.ts @@ -3,11 +3,13 @@ import { toError } from '@sim/utils/errors' import { omit } from '@sim/utils/object' import { isHosted as isHostedDeployment } from '@/lib/core/config/env-flags' import { isIntegrationDeploymentAvailableForVisibility } from '@/lib/integrations/availability.server' +import { MCP_SERVER_ADVANCED_TOOL_TYPE } from '@/lib/mcp/shared' import { isBlockTypeAccessControlExempt } from '@/lib/permission-groups/block-access' import type { PermissionGroupConfig } from '@/lib/permission-groups/fields' import { resolveAccessControlBlockType } from '@/lib/permission-groups/integration-allowlist' import { getCustomToolById } from '@/lib/workflows/custom-tools/operations' import { validateSelectorIds } from '@/lib/workflows/editing/selector-validator' +import { containsReference } from '@/lib/workflows/sanitization/references' import { getSkillById } from '@/lib/workflows/skills/operations' import { buildCanonicalIndex, @@ -282,6 +284,14 @@ function validateAgentToolEntry(item: any, index: number): string | null { return null } + if (type === MCP_SERVER_ADVANCED_TOOL_TYPE) { + const serverId = item.params?.serverId + if (typeof serverId !== 'string' || !serverId.trim()) { + return `${where} (${MCP_SERVER_ADVANCED_TOOL_TYPE}) must include params.serverId` + } + return null + } + // Integration/block-based tool: the type must be a real registry block that // actually exposes callable tools. A known block with an empty tools.access // (control-flow blocks like condition/loop/parallel/router, or the agent block @@ -1303,9 +1313,13 @@ export async function collectUnresolvedAgentToolReferences( error: toError(error).message, }) } - } else if (tool.type === 'mcp' && workspaceId) { + } else if ( + (tool.type === 'mcp' || tool.type === MCP_SERVER_ADVANCED_TOOL_TYPE) && + workspaceId + ) { const serverId = tool.params?.serverId if (typeof serverId !== 'string' || serverId.trim() === '') continue + if (containsReference(serverId)) continue try { const result = await validateSelectorIds('mcp-server-selector', serverId, context) if (result.invalid.length > 0) { diff --git a/apps/sim/lib/workflows/executor/execution-core.ts b/apps/sim/lib/workflows/executor/execution-core.ts index 595fa7c35a0..a38c7ad0ac3 100644 --- a/apps/sim/lib/workflows/executor/execution-core.ts +++ b/apps/sim/lib/workflows/executor/execution-core.ts @@ -27,9 +27,9 @@ import type { LoggingSession } from '@/lib/logs/execution/logging-session' import { redactLargeValueRefsInValue } from '@/lib/logs/execution/pii-large-values' import { redactObjectStrings } from '@/lib/logs/execution/pii-redaction' import { buildTraceSpans } from '@/lib/logs/execution/trace-spans/trace-spans' -import { getUserEmailById } from '@/lib/users/queries' import { waitForChildRuns } from '@/lib/workflows/custom-blocks/child-execution' import { getCustomBlockRowsForWorkspace } from '@/lib/workflows/custom-blocks/operations' +import { resolveStartBlockRunIdentity } from '@/lib/workflows/executor/start-run-identity' import { loadDeployedWorkflowState, loadWorkflowDeploymentVersionState, @@ -933,8 +933,9 @@ async function executeWorkflowCoreImpl( (block) => block.id === resolvedTriggerBlockId ) if (entryBlock && isRunMetadataEnabled(entryBlock)) { + const runIdentity = await resolveStartBlockRunIdentity(metadata.principal) startRunMetadata = { - userEmail: await getUserEmailById(userId), + ...runIdentity, workspaceId: providedWorkspaceId, workflowId, executionId, diff --git a/apps/sim/lib/workflows/executor/start-run-identity.test.ts b/apps/sim/lib/workflows/executor/start-run-identity.test.ts new file mode 100644 index 00000000000..9f1a319daff --- /dev/null +++ b/apps/sim/lib/workflows/executor/start-run-identity.test.ts @@ -0,0 +1,106 @@ +/** + * @vitest-environment node + */ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const { mockGetUserEmailById } = vi.hoisted(() => ({ + mockGetUserEmailById: vi.fn(), +})) + +vi.mock('@/lib/users/queries', () => ({ + getUserEmailById: mockGetUserEmailById, +})) + +import { resolveStartBlockRunIdentity } from '@/lib/workflows/executor/start-run-identity' + +describe('resolveStartBlockRunIdentity', () => { + beforeEach(() => { + vi.clearAllMocks() + }) + + it('identifies the owner of a personal API key', async () => { + mockGetUserEmailById.mockResolvedValue('owner@example.com') + + await expect( + resolveStartBlockRunIdentity({ + kind: 'personal_api_key', + userId: 'user-1', + keyId: 'key-1', + }) + ).resolves.toEqual({ + subject: { + kind: 'sim_user', + userId: 'user-1', + email: 'owner@example.com', + }, + }) + expect(mockGetUserEmailById).toHaveBeenCalledWith('user-1') + }) + + it('exposes the email proven by a chat authentication gate', async () => { + await expect( + resolveStartBlockRunIdentity({ + kind: 'system', + serviceId: 'chat', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + subject: { kind: 'authenticated_email', email: 'person@example.com' }, + }) + ).resolves.toEqual({ + subject: { kind: 'authenticated_email', email: 'person@example.com' }, + }) + expect(mockGetUserEmailById).not.toHaveBeenCalled() + }) + + it('preserves an external webhook subject without treating it as a Sim user', async () => { + await expect( + resolveStartBlockRunIdentity({ + kind: 'system', + serviceId: 'webhook', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + webhookId: 'webhook-1', + provider: 'slack', + subject: { + kind: 'external_user', + provider: 'slack', + tenantId: 'team-1', + subjectId: 'slack-user-1', + }, + }) + ).resolves.toEqual({ + subject: { + kind: 'external_user', + provider: 'slack', + tenantId: 'team-1', + subjectId: 'slack-user-1', + }, + }) + expect(mockGetUserEmailById).not.toHaveBeenCalled() + }) + + it('does not invent a user for an actorless workspace API key', async () => { + await expect( + resolveStartBlockRunIdentity({ + kind: 'workspace_api_key', + workspaceId: 'workspace-1', + keyId: 'key-1', + }) + ).resolves.toEqual({ subject: null }) + expect(mockGetUserEmailById).not.toHaveBeenCalled() + }) + + it('fails fast when an authenticated Sim user has no resolvable email', async () => { + mockGetUserEmailById.mockRejectedValue( + new Error('Authenticated user user-1 has no email address') + ) + + await expect( + resolveStartBlockRunIdentity({ + kind: 'session', + userId: 'user-1', + sessionId: 'session-1', + }) + ).rejects.toThrow('Authenticated user user-1 has no email address') + }) +}) diff --git a/apps/sim/lib/workflows/executor/start-run-identity.ts b/apps/sim/lib/workflows/executor/start-run-identity.ts new file mode 100644 index 00000000000..9bec8991505 --- /dev/null +++ b/apps/sim/lib/workflows/executor/start-run-identity.ts @@ -0,0 +1,26 @@ +import { resolvePrincipalSubject, type WorkflowExecutionPrincipal } from '@sim/auth/principal' +import { getUserEmailById } from '@/lib/users/queries' +import type { StartBlockRunSubject } from '@/executor/types' + +export interface StartBlockRunIdentity { + subject: StartBlockRunSubject | null +} + +/** Projects the authenticated execution principal into workflow-visible identity metadata. */ +export async function resolveStartBlockRunIdentity( + principal: WorkflowExecutionPrincipal +): Promise { + const subject = resolvePrincipalSubject(principal) + if (!subject) return { subject: null } + + switch (subject.kind) { + case 'sim_user': { + const email = await getUserEmailById(subject.userId) + return { subject: { ...subject, email } } + } + case 'authenticated_email': + return { subject: { ...subject } } + case 'external_user': + return { subject: { ...subject } } + } +} diff --git a/apps/sim/lib/workflows/subblocks/display.ts b/apps/sim/lib/workflows/subblocks/display.ts index 4c2b25d4a70..a4239f60da3 100644 --- a/apps/sim/lib/workflows/subblocks/display.ts +++ b/apps/sim/lib/workflows/subblocks/display.ts @@ -8,6 +8,7 @@ */ import { isRecordLike } from '@sim/utils/object' import { truncate } from '@sim/utils/string' +import { MCP_SERVER_ADVANCED_TOOL_TYPE } from '@/lib/mcp/shared' import type { FilterRule, SortRule } from '@/lib/table/types' import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/workflow-labels' import { getBlock } from '@/blocks' @@ -507,6 +508,10 @@ export function resolveStoredToolName( return storedTitle } + if (t.type === MCP_SERVER_ADVANCED_TOOL_TYPE) { + return storedTitle || 'MCP Server (Advanced)' + } + if (typeof t.type === 'string' && t.type) { const blockConfig = getBlockConfig(t.type) if (blockConfig?.name) return blockConfig.name diff --git a/apps/sim/lib/workspace-files/search/extract.test.ts b/apps/sim/lib/workspace-files/search/extract.test.ts new file mode 100644 index 00000000000..71215f8c87b --- /dev/null +++ b/apps/sim/lib/workspace-files/search/extract.test.ts @@ -0,0 +1,235 @@ +/** + * @vitest-environment node + */ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const { + mockFetchWorkspaceFileBuffer, + mockIsSupportedFileType, + mockParseBuffer, + mockResolveServableDoc, +} = vi.hoisted(() => ({ + mockFetchWorkspaceFileBuffer: vi.fn(), + mockIsSupportedFileType: vi.fn(), + mockParseBuffer: vi.fn(), + mockResolveServableDoc: vi.fn(), +})) + +vi.mock('@/lib/uploads/contexts/workspace', () => ({ + fetchWorkspaceFileBuffer: mockFetchWorkspaceFileBuffer, +})) +vi.mock('@/lib/copilot/tools/server/files/doc-compile', () => ({ + resolveServableDoc: mockResolveServableDoc, +})) +vi.mock('@/lib/file-parsers', () => ({ + isSupportedFileType: mockIsSupportedFileType, + parseBuffer: mockParseBuffer, +})) + +import { assertKnownSizeWithinLimit, isPayloadSizeLimitError } from '@/lib/core/utils/stream-limits' +import { FileParserError } from '@/lib/file-parsers/errors' +import type { WorkspaceFileRecord } from '@/lib/uploads/contexts/workspace' +import { FILE_SEARCH_MAX_SOURCE_BYTES } from '@/lib/workspace-files/search/constants' +import { extractIndexText, loadIndexableBytes } from '@/lib/workspace-files/search/extract' + +const FILE: WorkspaceFileRecord = { + id: 'file-1', + workspaceId: 'workspace-1', + name: 'report.docx', + key: 'workspace/workspace-1/report.docx', + path: '/api/files/serve/workspace/workspace-1/report.docx', + size: 12, + type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + uploadedBy: 'user-1', + uploadedAt: new Date('2026-09-01T00:00:00.000Z'), + updatedAt: new Date('2026-09-01T00:00:00.000Z'), +} + +const SOURCE = Buffer.from('const doc = new docx.Document({ sections: [] })', 'utf-8') +const FENCED_JSON = Buffer.from('```json\n[\n { "a": 1 }\n]\n```\n', 'utf-8') +const BINARY = Buffer.from([0x50, 0x4b, 0x03, 0x04, 0x00, 0x00, 0xff, 0xfe]) + +function sizeLimitError(): unknown { + try { + assertKnownSizeWithinLimit(2, 1, 'test') + } catch (error) { + return error + } + throw new Error('assertKnownSizeWithinLimit did not throw') +} + +describe('loadIndexableBytes', () => { + beforeEach(() => { + vi.clearAllMocks() + mockFetchWorkspaceFileBuffer.mockResolvedValue(SOURCE) + }) + + it('reads the compiled artifact of a generated document', async () => { + const artifact = Buffer.from('PKcompiled') + mockResolveServableDoc.mockResolvedValue({ + kind: 'artifact', + buffer: artifact, + contentType: FILE.type, + }) + const signal = new AbortController().signal + + await expect(loadIndexableBytes(FILE, signal)).resolves.toEqual({ + buffer: artifact, + kind: 'artifact', + }) + expect(mockFetchWorkspaceFileBuffer).toHaveBeenCalledWith(FILE, { + maxBytes: FILE_SEARCH_MAX_SOURCE_BYTES, + signal, + }) + expect(mockResolveServableDoc).toHaveBeenCalledWith(FILE.workspaceId, SOURCE, FILE.name) + }) + + it('settles for the generation source when no artifact exists, without compiling', async () => { + mockResolveServableDoc.mockResolvedValue({ kind: 'unavailable' }) + + await expect(loadIndexableBytes(FILE, new AbortController().signal)).resolves.toEqual({ + buffer: SOURCE, + kind: 'source', + }) + }) + + it('passes stored bytes through for everything else', async () => { + mockResolveServableDoc.mockResolvedValue({ kind: 'passthrough' }) + + await expect(loadIndexableBytes(FILE, new AbortController().signal)).resolves.toEqual({ + buffer: SOURCE, + kind: 'stored', + }) + }) + + it('refuses an artifact above the source ceiling as a size-limit breach', async () => { + mockResolveServableDoc.mockResolvedValue({ + kind: 'artifact', + buffer: Buffer.alloc(FILE_SEARCH_MAX_SOURCE_BYTES + 1), + contentType: FILE.type, + }) + + await expect(loadIndexableBytes(FILE, new AbortController().signal)).rejects.toSatisfy( + isPayloadSizeLimitError + ) + }) + + it('stops before resolving once the run is aborted', async () => { + const controller = new AbortController() + controller.abort() + + await expect(loadIndexableBytes(FILE, controller.signal)).rejects.toMatchObject({ + name: 'AbortError', + }) + expect(mockResolveServableDoc).not.toHaveBeenCalled() + }) +}) + +describe('extractIndexText', () => { + beforeEach(() => { + vi.clearAllMocks() + mockIsSupportedFileType.mockReturnValue(true) + }) + + it('indexes parser output for a structured format', async () => { + const signal = new AbortController().signal + mockParseBuffer.mockResolvedValue({ content: 'hello world', metadata: { truncated: true } }) + + await expect( + extractIndexText({ buffer: FENCED_JSON, kind: 'stored' }, 'data.json', signal) + ).resolves.toEqual({ text: 'hello world', partial: true }) + expect(mockParseBuffer).toHaveBeenCalledWith(FENCED_JSON, 'json', { signal }) + }) + + it('indexes the raw text when the parser rejects a text file', async () => { + mockParseBuffer.mockRejectedValue( + new FileParserError('invalid_format', "Invalid JSON: Unexpected token '`'") + ) + + await expect( + extractIndexText( + { buffer: FENCED_JSON, kind: 'stored' }, + 'data.json', + new AbortController().signal + ) + ).resolves.toEqual({ text: FENCED_JSON.toString('utf8'), partial: false }) + }) + + it('indexes nothing when the parser rejects a binary file', async () => { + mockParseBuffer.mockRejectedValue(new FileParserError('invalid_format', 'not a docx')) + + await expect( + extractIndexText( + { buffer: BINARY, kind: 'stored' }, + 'broken.docx', + new AbortController().signal + ) + ).resolves.toBeNull() + }) + + it('rethrows a size-limit breach from the parser', async () => { + mockParseBuffer.mockRejectedValue(sizeLimitError()) + + await expect( + extractIndexText( + { buffer: FENCED_JSON, kind: 'stored' }, + 'data.json', + new AbortController().signal + ) + ).rejects.toSatisfy(isPayloadSizeLimitError) + }) + + it('rethrows the abort instead of falling back once the run is aborted', async () => { + const controller = new AbortController() + mockParseBuffer.mockImplementation(async () => { + controller.abort() + throw new Error('parser interrupted') + }) + + await expect( + extractIndexText({ buffer: FENCED_JSON, kind: 'stored' }, 'data.json', controller.signal) + ).rejects.toMatchObject({ name: 'AbortError' }) + }) + + it('skips a structured file the parser reports as degraded', async () => { + mockParseBuffer.mockResolvedValue({ content: '', metadata: { degraded: true } }) + + await expect( + extractIndexText( + { buffer: BINARY, kind: 'artifact' }, + 'deck.pptx', + new AbortController().signal + ) + ).resolves.toBeNull() + }) + + it('reads generation source as text without touching the office parser', async () => { + await expect( + extractIndexText( + { buffer: SOURCE, kind: 'source' }, + 'report.docx', + new AbortController().signal + ) + ).resolves.toEqual({ text: SOURCE.toString('utf8'), partial: false }) + expect(mockParseBuffer).not.toHaveBeenCalled() + }) + + it('indexes nothing for binary bytes that have no parser', async () => { + mockIsSupportedFileType.mockReturnValue(false) + + await expect( + extractIndexText({ buffer: BINARY, kind: 'stored' }, 'blob.bin', new AbortController().signal) + ).resolves.toBeNull() + expect(mockParseBuffer).not.toHaveBeenCalled() + }) + + it('indexes an empty file as empty text', async () => { + await expect( + extractIndexText( + { buffer: Buffer.alloc(0), kind: 'stored' }, + 'empty.txt', + new AbortController().signal + ) + ).resolves.toEqual({ text: '', partial: false }) + }) +}) diff --git a/apps/sim/lib/workspace-files/search/extract.ts b/apps/sim/lib/workspace-files/search/extract.ts new file mode 100644 index 00000000000..7cf369c1c1a --- /dev/null +++ b/apps/sim/lib/workspace-files/search/extract.ts @@ -0,0 +1,116 @@ +import { type Buffer, isUtf8 } from 'node:buffer' +import { createLogger } from '@sim/logger' +import { toError } from '@sim/utils/errors' +import { resolveServableDoc } from '@/lib/copilot/tools/server/files/doc-compile' +import { assertKnownSizeWithinLimit, isPayloadSizeLimitError } from '@/lib/core/utils/stream-limits' +import { isSupportedFileType, parseBuffer } from '@/lib/file-parsers' +import { + fetchWorkspaceFileBuffer, + type WorkspaceFileRecord, +} from '@/lib/uploads/contexts/workspace' +import { getFileExtension } from '@/lib/uploads/utils/file-utils' +import { + FILE_SEARCH_MAX_EXTRACTED_BYTES, + FILE_SEARCH_MAX_SOURCE_BYTES, +} from '@/lib/workspace-files/search/constants' +import { truncateUtf8ToBytes } from '@/lib/workspace-files/search/text' + +const logger = createLogger('WorkspaceFileSearchExtract') + +/** + * What the index reads for one file revision. + * + * - `stored`: the bytes as uploaded, structured formats included. + * - `artifact`: the compiled document of a generated doc, read from the artifact store. + * - `source`: a generated doc whose artifact does not exist. The bytes are its generation + * source, which is text and must never be handed to the office parsers or executed. + */ +export interface IndexableBytes { + buffer: Buffer + kind: 'stored' | 'artifact' | 'source' +} + +export interface ExtractedIndexText { + text: string + partial: boolean +} + +/** + * Loads the bytes to index without executing anything. + * + * Generated documents store their generation source as the primary file and keep the rendered + * binary in the compiled-artifact store. This reads the artifact when it exists and otherwise + * settles for the source text, the same read-only resolution the public share route uses. + * Compile-on-read belongs to download surfaces acting for a principal: an indexer running as + * nobody inside a worker must not run a document's source, whatever compiler that worker has. + */ +export async function loadIndexableBytes( + file: WorkspaceFileRecord, + signal: AbortSignal +): Promise { + const raw = await fetchWorkspaceFileBuffer(file, { + maxBytes: FILE_SEARCH_MAX_SOURCE_BYTES, + signal, + }) + signal.throwIfAborted() + const servable = await resolveServableDoc(file.workspaceId, raw, file.name) + if (servable.kind === 'artifact') { + assertKnownSizeWithinLimit( + servable.buffer.length, + FILE_SEARCH_MAX_SOURCE_BYTES, + 'search index artifact' + ) + return { buffer: servable.buffer, kind: 'artifact' } + } + return { buffer: raw, kind: servable.kind === 'unavailable' ? 'source' : 'stored' } +} + +function isPlainText(buffer: Buffer): boolean { + return isUtf8(buffer) && !buffer.includes(0) +} + +function boundText(content: string, truncated: boolean): ExtractedIndexText { + const bounded = truncateUtf8ToBytes(content, FILE_SEARCH_MAX_EXTRACTED_BYTES) + return { text: bounded, partial: truncated || bounded.length < content.length } +} + +/** + * Turns bytes into the text to index, or `null` when there is no text to index. + * + * Structured formats go through the shared parser registry, exactly as the knowledge base and + * the file tool read them, so a spreadsheet or a PDF indexes as its text. The registry answers + * bytes it cannot parse with an exception, and for search that is too strict: a `.json` file a + * model wrapped in a code fence is still text worth finding. A parser failure on UTF-8 bytes + * therefore falls back to the raw text, the policy the file tool already applies, while a + * failure on binary bytes means there is nothing to index. Size-limit breaches and aborts + * propagate so the caller records them as what they are. + */ +export async function extractIndexText( + bytes: IndexableBytes, + fileName: string, + signal: AbortSignal +): Promise { + const { buffer } = bytes + if (buffer.length === 0) return { text: '', partial: false } + const extension = getFileExtension(fileName) + if (bytes.kind !== 'source' && extension && isSupportedFileType(extension)) { + try { + const parsed = await parseBuffer(buffer, extension, { signal }) + if (parsed.metadata?.degraded) return null + return boundText(parsed.content ?? '', parsed.metadata?.truncated === true) + } catch (error) { + signal.throwIfAborted() + if (isPayloadSizeLimitError(error)) throw error + const plainText = isPlainText(buffer) + logger.warn( + plainText + ? 'Parser rejected a text workspace file; indexing its raw text' + : 'Parser rejected a binary workspace file; nothing to index', + { extension, kind: bytes.kind, errorType: toError(error).name } + ) + if (!plainText) return null + } + } + if (!isPlainText(buffer)) return null + return boundText(buffer.toString('utf8'), false) +} diff --git a/apps/sim/lib/workspace-files/search/indexing.ts b/apps/sim/lib/workspace-files/search/indexing.ts index e09978e5bee..d62b56c065a 100644 --- a/apps/sim/lib/workspace-files/search/indexing.ts +++ b/apps/sim/lib/workspace-files/search/indexing.ts @@ -1,4 +1,4 @@ -import { Buffer, isUtf8 } from 'node:buffer' +import { Buffer } from 'node:buffer' import { db } from '@sim/db' import { workspaceFileSearchIndex, @@ -9,23 +9,14 @@ import { createLogger } from '@sim/logger' import { toError } from '@sim/utils/errors' import { and, eq, isNull, ne, or } from 'drizzle-orm' import { isPayloadSizeLimitError } from '@/lib/core/utils/stream-limits' -import { isSupportedFileType, parseBuffer } from '@/lib/file-parsers' -import { - fetchServableWorkspaceFileBuffer, - getWorkspaceFile, -} from '@/lib/uploads/contexts/workspace' -import { getFileExtension } from '@/lib/uploads/utils/file-utils' +import { getWorkspaceFile } from '@/lib/uploads/contexts/workspace' import { FILE_SEARCH_INSERT_BATCH_BYTES, FILE_SEARCH_INSERT_BATCH_ROWS, - FILE_SEARCH_MAX_EXTRACTED_BYTES, FILE_SEARCH_MAX_SOURCE_BYTES, } from '@/lib/workspace-files/search/constants' -import { - iterateLogicalLines, - segmentLogicalLine, - truncateUtf8ToBytes, -} from '@/lib/workspace-files/search/text' +import { extractIndexText, loadIndexableBytes } from '@/lib/workspace-files/search/extract' +import { iterateLogicalLines, segmentLogicalLine } from '@/lib/workspace-files/search/text' const logger = createLogger('WorkspaceFileSearchIndexer') @@ -37,39 +28,10 @@ export interface WorkspaceFileSearchIndexPayload { type SearchIndexStatus = 'ready' | 'skipped' | 'failed' -interface ExtractedIndexText { - text: string - partial: boolean -} - function sameRevision(left: Date | null | undefined, right: Date): boolean { return Boolean(left && left.getTime() === right.getTime()) } -async function extractIndexText( - buffer: Buffer, - fileName: string -): Promise { - if (buffer.length === 0) return { text: '', partial: false } - const extension = getFileExtension(fileName) - if (extension && isSupportedFileType(extension)) { - const parsed = await parseBuffer(buffer, extension) - if (parsed.metadata?.degraded) return null - const content = parsed.content ?? '' - const bounded = truncateUtf8ToBytes(content, FILE_SEARCH_MAX_EXTRACTED_BYTES) - return { - text: bounded, - partial: parsed.metadata?.truncated === true || bounded.length < content.length, - } - } - if (!isUtf8(buffer) || buffer.includes(0)) return null - const content = buffer.toString('utf8') - return { - text: truncateUtf8ToBytes(content, FILE_SEARCH_MAX_EXTRACTED_BYTES), - partial: buffer.length > FILE_SEARCH_MAX_EXTRACTED_BYTES, - } -} - async function clearRevision( workspaceId: string, fileId: string, @@ -324,12 +286,9 @@ export async function indexWorkspaceFileForSearch( } try { - const { buffer } = await fetchServableWorkspaceFileBuffer(file, { - maxBytes: FILE_SEARCH_MAX_SOURCE_BYTES, - signal, - }) + const bytes = await loadIndexableBytes(file, signal) signal.throwIfAborted() - const extracted = await extractIndexText(buffer, file.name) + const extracted = await extractIndexText(bytes, file.name, signal) if (!extracted) { await markTerminal({ ...payload, diff --git a/apps/sim/stores/panel/types.ts b/apps/sim/stores/panel/types.ts index 42c4a8cfd54..ebab08f7bc0 100644 --- a/apps/sim/stores/panel/types.ts +++ b/apps/sim/stores/panel/types.ts @@ -1,3 +1,5 @@ +import type { ManagedMcpConnectorId } from '@/lib/credential-groups/managed-mcp-connectors' + /** * Available panel tabs */ @@ -89,4 +91,9 @@ export type ChatContext = | { kind: 'slash_command'; command: string; label: string } | { kind: 'integration'; blockType: string; label: string } | { kind: 'skill'; skillId: string; label: string } - | { kind: 'mcp'; serverId: string; label: string } + | { + kind: 'mcp' + serverId: string + label: string + managedConnectorId?: ManagedMcpConnectorId + } diff --git a/apps/sim/trigger.config.ts b/apps/sim/trigger.config.ts index 1088f27d14e..fa4b4d76da3 100644 --- a/apps/sim/trigger.config.ts +++ b/apps/sim/trigger.config.ts @@ -26,6 +26,19 @@ if (grafanaConfigured && !grafanaFullyConfigured) { ) } +/** + * Environment a run needs for sandboxed work. Function block runs and the + * document compiler share one provider selection, and the doc-template + * variables decide whether a run reads a generated document through the doc + * sandbox's artifact store or the isolated-vm fallback. The app authors + * documents for whichever compiler it sees, so a worker missing the doc + * template falls back to isolated-vm and tries to run Python or Node-style + * sources as sandbox JavaScript. Reading a generated document under the doc + * sandbox means loading its compiled artifact from the copilot storage + * context, so that bucket has to be visible to the run as well. The values + * still have to exist in the Trigger.dev environment; syncing only keeps the + * worker's view of them aligned with the app's. + */ const FUNCTION_EXECUTION_ENV = [ { name: 'REDIS_URL', secret: true }, { name: 'REDIS_TLS_SERVERNAME', secret: false }, @@ -34,8 +47,13 @@ const FUNCTION_EXECUTION_ENV = [ { name: 'E2B_API_KEY', secret: true }, { name: 'E2B_FUNCTION_TEMPLATE_ID', secret: false }, { name: 'E2B_FUNCTION_TEMPLATE_GENERATION', secret: false }, + { name: 'MOTHERSHIP_E2B_DOC_TEMPLATE_ID', secret: false }, { name: 'DAYTONA_API_KEY', secret: true }, { name: 'DAYTONA_FUNCTION_SNAPSHOT_ID', secret: false }, + { name: 'DAYTONA_DOC_SNAPSHOT_ID', secret: false }, + { name: 'S3_COPILOT_BUCKET_NAME', secret: false }, + { name: 'AZURE_STORAGE_COPILOT_CONTAINER_NAME', secret: false }, + { name: 'GCS_COPILOT_BUCKET_NAME', secret: false }, ] as const function getFunctionExecutionEnvVars() { diff --git a/packages/auth/src/principal.ts b/packages/auth/src/principal.ts index e47e9dd9262..d535d29f23e 100644 --- a/packages/auth/src/principal.ts +++ b/packages/auth/src/principal.ts @@ -31,11 +31,25 @@ export interface ExternalUserSubject { subjectId: string } +/** Email address proven by a deployment's OTP or SSO authentication gate. */ +export interface AuthenticatedEmailSubject { + kind: 'authenticated_email' + email: string +} + interface ActorlessSystemPrincipal { kind: 'system' - serviceId: 'public_api' | 'schedule' | 'internal' | 'table' | 'chat' + serviceId: 'public_api' | 'schedule' | 'internal' | 'table' + workspaceId: string + workflowId: string +} + +export interface ChatSystemPrincipal { + kind: 'system' + serviceId: 'chat' workspaceId: string workflowId: string + subject?: AuthenticatedEmailSubject } export interface WebhookSystemPrincipal { @@ -48,7 +62,10 @@ export interface WebhookSystemPrincipal { subject?: ExternalUserSubject } -export type SystemPrincipal = ActorlessSystemPrincipal | WebhookSystemPrincipal +export type SystemPrincipal = + | ActorlessSystemPrincipal + | ChatSystemPrincipal + | WebhookSystemPrincipal interface DelegatedPrincipalBase { kind: 'delegated' @@ -64,6 +81,7 @@ interface DelegatedPrincipalBase { executionId?: string credentialId?: string credentialGroupId?: string + mcpServerId?: string } } @@ -231,6 +249,7 @@ function parseResourceScope(value: unknown): DelegatedPrincipal['resourceScope'] 'executionId', 'credentialId', 'credentialGroupId', + 'mcpServerId', ] as const requireExactKeys(scope, [], keys) const parsed: NonNullable = {} @@ -254,6 +273,18 @@ function parseExternalUserSubject(value: unknown): ExternalUserSubject { } } +function parseAuthenticatedEmailSubject(value: unknown): AuthenticatedEmailSubject { + const subject = requireRecord(value, 'Serialized principal subject') + if (subject.kind !== 'authenticated_email') { + throw new Error(`Unsupported serialized principal subject kind ${String(subject.kind)}`) + } + requireExactKeys(subject, ['kind', 'email']) + return { + kind: 'authenticated_email', + email: requireString(subject.email, 'subject.email'), + } +} + /** Encodes a workflow caller without persisting bearer credentials or invitation proofs. */ export function serializePrincipal(principal: WorkflowExecutionPrincipal): SerializedPrincipalV1 { switch (principal.kind) { @@ -326,12 +357,12 @@ export function parsePrincipal(value: unknown): WorkflowExecutionPrincipal { : requireString(principal.webhookId, 'webhookId') const provider = principal.provider === undefined ? undefined : requireString(principal.provider, 'provider') - const subject = - principal.subject === undefined ? undefined : parseExternalUserSubject(principal.subject) if (serviceId === 'webhook') { if (!webhookId || !provider) { throw new Error('Webhook system principals require webhookId and provider') } + const subject = + principal.subject === undefined ? undefined : parseExternalUserSubject(principal.subject) if (subject && subject.provider !== provider) { throw new Error('Webhook system principal subject provider must match its provider') } @@ -345,8 +376,26 @@ export function parsePrincipal(value: unknown): WorkflowExecutionPrincipal { ...(subject ? { subject } : {}), } } - if (webhookId || provider || subject) { - throw new Error(`System principal service ${serviceId} cannot carry webhook identity`) + if (serviceId === 'chat') { + if (webhookId || provider) { + throw new Error('Chat system principals cannot carry webhook identity') + } + const subject = + principal.subject === undefined + ? undefined + : parseAuthenticatedEmailSubject(principal.subject) + return { + kind, + serviceId, + workspaceId: requireString(principal.workspaceId, 'workspaceId'), + workflowId: requireString(principal.workflowId, 'workflowId'), + ...(subject ? { subject } : {}), + } + } + if (webhookId || provider || principal.subject !== undefined) { + throw new Error( + `System principal service ${serviceId} cannot carry a subject or webhook identity` + ) } return { kind, @@ -406,7 +455,7 @@ export type PrincipalActor = workflowId: string webhookId?: string provider?: string - subject?: ExternalUserSubject + subject?: ExternalUserSubject | AuthenticatedEmailSubject } | { kind: 'delegated' @@ -445,7 +494,10 @@ export interface PrincipalAttributionContext { workspaceBillingOwnerUserId?: string } -export type PrincipalSubject = { kind: 'sim_user'; userId: string } | ExternalUserSubject +export type PrincipalSubject = + | { kind: 'sim_user'; userId: string } + | ExternalUserSubject + | AuthenticatedEmailSubject /** Resolves a stable human or provider subject without inventing one for actorless callers. */ export function resolvePrincipalSubject(principal: Principal): PrincipalSubject | null { @@ -462,7 +514,9 @@ export function resolvePrincipalSubject(principal: Principal): PrincipalSubject } return principal.subjectUserId ? { kind: 'sim_user', userId: principal.subjectUserId } : null case 'system': - return principal.serviceId === 'webhook' ? (principal.subject ?? null) : null + return principal.serviceId === 'webhook' || principal.serviceId === 'chat' + ? (principal.subject ?? null) + : null case 'workspace_api_key': case 'credential_group_enrollment': return null @@ -493,7 +547,9 @@ export function toPrincipalActor(principal: Principal): PrincipalActor { provider: principal.provider, ...(principal.subject ? { subject: principal.subject } : {}), } - : {}), + : principal.serviceId === 'chat' && principal.subject + ? { subject: principal.subject } + : {}), } case 'delegated': return { diff --git a/packages/db/migrations/0318_credential_group_managed_mcp.sql b/packages/db/migrations/0318_credential_group_managed_mcp.sql new file mode 100644 index 00000000000..0d2332ec0a7 --- /dev/null +++ b/packages/db/migrations/0318_credential_group_managed_mcp.sql @@ -0,0 +1,114 @@ +-- Adds per-enrollment managed MCP grants without changing existing credential rows. +-- Pure expand: every new column is nullable, and no managed_mcp row can predate this migration. +-- Every pre-COMMIT statement is replay-safe because a concurrent index failure leaves this file +-- unjournaled while preserving the committed schema changes. +ALTER TYPE "public"."credential_type" ADD VALUE IF NOT EXISTS 'managed_mcp' BEFORE 'env_workspace';--> statement-breakpoint +ALTER TABLE "credential" ADD COLUMN IF NOT EXISTS "mcp_server_id" text;--> statement-breakpoint +ALTER TABLE "credential" ADD COLUMN IF NOT EXISTS "mcp_tools" jsonb;--> statement-breakpoint +ALTER TABLE "credential" ADD COLUMN IF NOT EXISTS "mcp_tools_refreshed_at" timestamp;--> statement-breakpoint +ALTER TABLE "mcp_servers" ADD COLUMN IF NOT EXISTS "credential_group_id" text;--> statement-breakpoint +ALTER TABLE "mcp_servers" ADD COLUMN IF NOT EXISTS "managed_connector_id" text;--> statement-breakpoint + +-- PostgreSQL has no ADD CONSTRAINT IF NOT EXISTS, so replay guards are scoped to each table. +-- NOT VALID keeps foreign-key installation to a metadata change before validation. +DO $$ BEGIN + IF NOT EXISTS ( + SELECT 1 FROM "pg_constraint" + WHERE "conname" = 'credential_mcp_server_id_mcp_servers_id_fk' + AND "conrelid" = '"credential"'::regclass + ) THEN + ALTER TABLE "credential" ADD CONSTRAINT "credential_mcp_server_id_mcp_servers_id_fk" FOREIGN KEY ("mcp_server_id") REFERENCES "public"."mcp_servers"("id") ON DELETE cascade ON UPDATE no action NOT VALID; + END IF; +END $$;--> statement-breakpoint +ALTER TABLE "credential" VALIDATE CONSTRAINT "credential_mcp_server_id_mcp_servers_id_fk";--> statement-breakpoint +DO $$ BEGIN + IF NOT EXISTS ( + SELECT 1 FROM "pg_constraint" + WHERE "conname" = 'mcp_servers_credential_group_id_credential_group_id_fk' + AND "conrelid" = '"mcp_servers"'::regclass + ) THEN + ALTER TABLE "mcp_servers" ADD CONSTRAINT "mcp_servers_credential_group_id_credential_group_id_fk" FOREIGN KEY ("credential_group_id") REFERENCES "public"."credential_group"("id") ON DELETE set null ON UPDATE no action NOT VALID; + END IF; +END $$;--> statement-breakpoint +ALTER TABLE "mcp_servers" VALIDATE CONSTRAINT "mcp_servers_credential_group_id_credential_group_id_fk";--> statement-breakpoint +DO $$ BEGIN + IF NOT EXISTS ( + SELECT 1 FROM "pg_constraint" + WHERE "conname" = 'mcp_servers_credential_group_managed_connector_check' + AND "conrelid" = '"mcp_servers"'::regclass + ) THEN + ALTER TABLE "mcp_servers" ADD CONSTRAINT "mcp_servers_credential_group_managed_connector_check" CHECK ("credential_group_id" IS NULL OR "managed_connector_id" IS NOT NULL) NOT VALID; + END IF; +END $$;--> statement-breakpoint +ALTER TABLE "mcp_servers" VALIDATE CONSTRAINT "mcp_servers_credential_group_managed_connector_check";--> statement-breakpoint +DO $$ BEGIN + IF NOT EXISTS ( + SELECT 1 FROM "pg_constraint" + WHERE "conname" = 'mcp_servers_managed_connector_oauth_check' + AND "conrelid" = '"mcp_servers"'::regclass + ) THEN + ALTER TABLE "mcp_servers" ADD CONSTRAINT "mcp_servers_managed_connector_oauth_check" CHECK ("managed_connector_id" IS NULL OR "auth_type" = 'oauth') NOT VALID; + END IF; +END $$;--> statement-breakpoint +ALTER TABLE "mcp_servers" VALIDATE CONSTRAINT "mcp_servers_managed_connector_oauth_check";--> statement-breakpoint + +DO $$ BEGIN + IF NOT EXISTS ( + SELECT 1 FROM "pg_constraint" + WHERE "conname" = 'credential_managed_mcp_source_check' + AND "conrelid" = '"credential"'::regclass + ) THEN + ALTER TABLE "credential" ADD CONSTRAINT "credential_managed_mcp_source_check" CHECK ((type::text <> 'managed_mcp') OR ( + id LIKE 'mcp-cg-%' + AND account_id IS NULL + AND provider_id IS NULL + AND authorization_app_id IS NULL + AND credential_group_enrollment_id IS NOT NULL + AND credential_group_option_id IS NULL + AND mcp_server_id IS NOT NULL + AND managed_oauth_status IS NOT NULL + AND (managed_oauth_status <> 'active' OR ( + encrypted_oauth_token_set IS NOT NULL + AND mcp_tools IS NOT NULL + )) + AND granted_at IS NOT NULL + AND managed_oauth_scope_version IS NULL + AND provider_subject_id IS NULL + AND provider_tenant_id IS NULL + AND granted_scopes IS NULL + AND provider_metadata IS NULL + AND created_by IS NULL + AND env_key IS NULL + AND env_owner_user_id IS NULL + AND encrypted_service_account_key IS NULL + AND unredacted = false + )) NOT VALID; + END IF; +END $$;--> statement-breakpoint +ALTER TABLE "credential" VALIDATE CONSTRAINT "credential_managed_mcp_source_check";--> statement-breakpoint +DO $$ BEGIN + IF NOT EXISTS ( + SELECT 1 FROM "pg_constraint" + WHERE "conname" = 'credential_creator_source_check' + AND "conrelid" = '"credential"'::regclass + ) THEN + ALTER TABLE "credential" ADD CONSTRAINT "credential_creator_source_check" CHECK ((type::text = 'managed_mcp') OR created_by IS NOT NULL) NOT VALID; + END IF; +END $$;--> statement-breakpoint +ALTER TABLE "credential" VALIDATE CONSTRAINT "credential_creator_source_check";--> statement-breakpoint +ALTER TABLE "credential" ALTER COLUMN "created_by" DROP NOT NULL;--> statement-breakpoint + +-- The commit makes the new enum label visible and moves index builds outside the migration +-- runner's transaction, as required by PostgreSQL for the partial and concurrent indexes. +COMMIT;--> statement-breakpoint +SET lock_timeout = 0;--> statement-breakpoint +-- A failed concurrent build leaves an invalid index behind, so each replay removes it first. +DROP INDEX CONCURRENTLY IF EXISTS "credential_mcp_server_idx";--> statement-breakpoint +CREATE INDEX CONCURRENTLY IF NOT EXISTS "credential_mcp_server_idx" ON "credential" USING btree ("mcp_server_id");--> statement-breakpoint +DROP INDEX CONCURRENTLY IF EXISTS "credential_managed_mcp_enrollment_server_unique";--> statement-breakpoint +CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS "credential_managed_mcp_enrollment_server_unique" ON "credential" USING btree ("credential_group_enrollment_id","mcp_server_id") WHERE "credential"."type" = 'managed_mcp';--> statement-breakpoint +DROP INDEX CONCURRENTLY IF EXISTS "mcp_servers_credential_group_idx";--> statement-breakpoint +CREATE INDEX CONCURRENTLY IF NOT EXISTS "mcp_servers_credential_group_idx" ON "mcp_servers" USING btree ("credential_group_id");--> statement-breakpoint +DROP INDEX CONCURRENTLY IF EXISTS "mcp_servers_credential_group_managed_connector_unique";--> statement-breakpoint +CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS "mcp_servers_credential_group_managed_connector_unique" ON "mcp_servers" USING btree ("credential_group_id","managed_connector_id") WHERE "credential_group_id" IS NOT NULL AND "managed_connector_id" IS NOT NULL AND "deleted_at" IS NULL;--> statement-breakpoint +SET lock_timeout = '5s'; diff --git a/packages/db/migrations/meta/0318_snapshot.json b/packages/db/migrations/meta/0318_snapshot.json new file mode 100644 index 00000000000..67e56469a50 --- /dev/null +++ b/packages/db/migrations/meta/0318_snapshot.json @@ -0,0 +1,20986 @@ +{ + "id": "cc128588-30bb-4ad9-b799-ff047f1a0f89", + "prevId": "abfcce0a-145e-4180-ad24-9e80f206903c", + "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 + }, + "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_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": {}, + "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 + }, + "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": {} + } + }, + "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" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "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.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 + }, + "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", + "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 ac3f8cd70f3..ccaaab0e94e 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -2220,6 +2220,13 @@ "when": 1788304042423, "tag": "0317_giant_kitty_pryde", "breakpoints": true + }, + { + "idx": 318, + "version": "7", + "when": 1788313105264, + "tag": "0318_credential_group_managed_mcp", + "breakpoints": true } ] } diff --git a/packages/db/schema.ts b/packages/db/schema.ts index 33e9ab77a15..446ed0bbe26 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -3634,6 +3634,11 @@ export const mcpServers = pgTable( workspaceId: text('workspace_id') .notNull() .references(() => workspace.id, { onDelete: 'cascade' }), + credentialGroupId: text('credential_group_id').references( + (): AnyPgColumn => credentialGroup.id, + { onDelete: 'set null' } + ), + managedConnectorId: text('managed_connector_id'), // Track who created the server, but workspace owns it createdBy: text('created_by').references(() => user.id, { onDelete: 'set null' }), @@ -3679,6 +3684,22 @@ export const mcpServers = pgTable( table.workspaceId, table.enabled ), + credentialGroupIdx: index('mcp_servers_credential_group_idx').on(table.credentialGroupId), + credentialGroupManagedConnectorUnique: uniqueIndex( + 'mcp_servers_credential_group_managed_connector_unique' + ) + .on(table.credentialGroupId, table.managedConnectorId) + .where( + sql`${table.credentialGroupId} IS NOT NULL AND ${table.managedConnectorId} IS NOT NULL AND ${table.deletedAt} IS NULL` + ), + credentialGroupManagedConnectorCheck: check( + 'mcp_servers_credential_group_managed_connector_check', + sql`${table.credentialGroupId} IS NULL OR ${table.managedConnectorId} IS NOT NULL` + ), + managedConnectorOauthCheck: check( + 'mcp_servers_managed_connector_oauth_check', + sql`${table.managedConnectorId} IS NULL OR ${table.authType} = 'oauth'` + ), // Soft delete pattern - workspace + not deleted (partial: only deleted rows) workspaceDeletedIdx: index('mcp_servers_workspace_deleted_partial_idx') @@ -4136,6 +4157,7 @@ export const usageLog = pgTable( export const credentialTypeEnum = pgEnum('credential_type', [ 'oauth', 'managed_oauth', + 'managed_mcp', 'env_workspace', 'env_personal', 'service_account', @@ -4155,6 +4177,12 @@ export interface ManagedOAuthProviderMetadata { tenantDisplayName?: string } +export interface ManagedMcpToolSnapshot { + name: string + description?: string + inputSchema: Record +} + export const credential = pgTable( 'credential', { @@ -4183,6 +4211,9 @@ export const credential = pgTable( { onDelete: 'cascade' } ), credentialGroupOptionId: text('credential_group_option_id'), + mcpServerId: text('mcp_server_id').references(() => mcpServers.id, { + onDelete: 'cascade', + }), managedOauthScopeVersion: integer('managed_oauth_scope_version'), providerSubjectId: text('provider_subject_id'), providerTenantId: text('provider_tenant_id'), @@ -4190,14 +4221,14 @@ export const credential = pgTable( grantedScopes: text('granted_scopes').array(), providerMetadata: jsonb('provider_metadata').$type(), encryptedOauthTokenSet: text('encrypted_oauth_token_set'), + mcpTools: jsonb('mcp_tools').$type(), + mcpToolsRefreshedAt: timestamp('mcp_tools_refreshed_at'), grantedAt: timestamp('granted_at'), revokedAt: timestamp('revoked_at'), accessTokenExpiresAt: timestamp('access_token_expires_at'), refreshTokenExpiresAt: timestamp('refresh_token_expires_at'), lastRefreshedAt: timestamp('last_refreshed_at'), - createdBy: text('created_by') - .notNull() - .references(() => user.id, { onDelete: 'cascade' }), + createdBy: text('created_by').references(() => user.id, { onDelete: 'cascade' }), createdAt: timestamp('created_at').notNull().defaultNow(), updatedAt: timestamp('updated_at').notNull().defaultNow(), }, @@ -4210,9 +4241,13 @@ export const credential = pgTable( credentialGroupEnrollmentIdx: index('credential_group_enrollment_idx').on( table.credentialGroupEnrollmentId ), + mcpServerIdx: index('credential_mcp_server_idx').on(table.mcpServerId), credentialGroupOptionUnique: uniqueIndex('credential_group_option_unique') .on(table.credentialGroupEnrollmentId, table.credentialGroupOptionId) .where(sql`${table.type} = 'managed_oauth'`), + managedMcpEnrollmentServerUnique: uniqueIndex('credential_managed_mcp_enrollment_server_unique') + .on(table.credentialGroupEnrollmentId, table.mcpServerId) + .where(sql`${table.type} = 'managed_mcp'`), workspaceAccountUnique: uniqueIndex('credential_workspace_account_unique') .on(table.workspaceId, table.accountId) .where(sql`account_id IS NOT NULL`), @@ -4249,6 +4284,38 @@ export const credential = pgTable( AND managed_oauth_scope_version > 0 )` ), + managedMcpSourceConstraint: check( + 'credential_managed_mcp_source_check', + sql`(type::text <> 'managed_mcp') OR ( + id LIKE 'mcp-cg-%' + AND account_id IS NULL + AND provider_id IS NULL + AND authorization_app_id IS NULL + AND credential_group_enrollment_id IS NOT NULL + AND credential_group_option_id IS NULL + AND mcp_server_id IS NOT NULL + AND managed_oauth_status IS NOT NULL + AND (managed_oauth_status <> 'active' OR ( + encrypted_oauth_token_set IS NOT NULL + AND mcp_tools IS NOT NULL + )) + AND granted_at IS NOT NULL + AND managed_oauth_scope_version IS NULL + AND provider_subject_id IS NULL + AND provider_tenant_id IS NULL + AND granted_scopes IS NULL + AND provider_metadata IS NULL + AND created_by IS NULL + AND env_key IS NULL + AND env_owner_user_id IS NULL + AND encrypted_service_account_key IS NULL + AND unredacted = false + )` + ), + creatorSourceConstraint: check( + 'credential_creator_source_check', + sql`(type::text = 'managed_mcp') OR created_by IS NOT NULL` + ), workspaceEnvSourceConstraint: check( 'credential_workspace_env_source_check', sql`(type <> 'env_workspace') OR (env_key IS NOT NULL AND env_owner_user_id IS NULL)` diff --git a/packages/desktop-bridge/contract-snapshot.ts b/packages/desktop-bridge/contract-snapshot.ts index b4f37265219..e044e056469 100644 --- a/packages/desktop-bridge/contract-snapshot.ts +++ b/packages/desktop-bridge/contract-snapshot.ts @@ -75,6 +75,15 @@ export type BrowserToolName = (typeof BROWSER_TOOL_NAMES)[number] export const BROWSER_WAIT_FOR_DEFAULT_TIMEOUT_MS = 10_000 export const BROWSER_WAIT_FOR_MAX_TIMEOUT_MS = 120_000 export const BROWSER_WAIT_FOR_RENDERER_GRACE_MS = 15_000 +export const BROWSER_TOOL_AUTHORIZATION_TIMEOUT_MS = 8_000 +export const BROWSER_NAVIGATION_NATIVE_WATCHDOG_MS = 60_000 +export const BROWSER_TOOL_QUEUE_WAIT_TIMEOUT_MS = BROWSER_NAVIGATION_NATIVE_WATCHDOG_MS +const BROWSER_RENDERER_TRANSPORT_GRACE_MS = 2_000 +export const BROWSER_NAVIGATION_RENDERER_TIMEOUT_MS = + BROWSER_TOOL_AUTHORIZATION_TIMEOUT_MS + + BROWSER_TOOL_QUEUE_WAIT_TIMEOUT_MS + + BROWSER_NAVIGATION_NATIVE_WATCHDOG_MS + + BROWSER_RENDERER_TRANSPORT_GRACE_MS /** * Normalizes the model-visible `browser_wait_for.timeoutMs` consistently in @@ -1819,9 +1828,9 @@ export interface SimDesktopTerminalThemesApi { } /** - * Where the shell's update pipeline currently is. `available` only occurs - * when automatic downloads are disabled; with them enabled the shell moves - * straight to `downloading`. + * Where the shell's update pipeline currently is. `available` occurs when + * automatic downloads are disabled or the shell requires a manual installer; + * self-updating shells with automatic downloads enabled move to `downloading`. */ export type DesktopUpdateStatus = | 'idle' @@ -1838,11 +1847,9 @@ export interface DesktopUpdateState { /** Whole-number download progress (0-100) while `downloading`. */ percent?: number /** - * True when this shell cannot apply updates in place (a build without a - * Developer ID signature — local installs and pre-signing CI prereleases; - * Squirrel.Mac refuses to swap unsigned bundles). `available` is then the - * pipeline's terminal state and the advance action opens the download in - * the browser instead of downloading in the background. + * True when this shell cannot apply updates in place, such as an unsigned build + * or an app running outside /Applications. `available` is then the terminal state + * and the advance action opens the installer in the browser. */ manual?: boolean } @@ -1851,11 +1858,11 @@ export interface DesktopUpdateState { export interface SimDesktopUpdatesApi { getState(): Promise /** - * Advance the pipeline: checks for an update, or starts the download when - * one is already known to be available (auto-download off). + * Advances the pipeline: checks for an update, downloads an available + * self-update, or opens an available manual installer. */ check(): void - /** Quit and install a `ready` update. No-op in any other state. */ + /** Installs a ready update or opens the installer for an available manual update. */ install(): void /** Subscribe to pipeline state changes. Returns an unsubscribe function. */ onState(callback: (state: DesktopUpdateState) => void): () => void diff --git a/packages/desktop-bridge/src/index.ts b/packages/desktop-bridge/src/index.ts index 77f3f6208d9..cb8dc0926bf 100644 --- a/packages/desktop-bridge/src/index.ts +++ b/packages/desktop-bridge/src/index.ts @@ -956,9 +956,9 @@ export interface SimDesktopTerminalThemesApi { } /** - * Where the shell's update pipeline currently is. `available` only occurs - * when automatic downloads are disabled; with them enabled the shell moves - * straight to `downloading`. + * Where the shell's update pipeline currently is. `available` occurs when + * automatic downloads are disabled or the shell requires a manual installer; + * self-updating shells with automatic downloads enabled move to `downloading`. */ export type DesktopUpdateStatus = | 'idle' @@ -975,11 +975,9 @@ export interface DesktopUpdateState { /** Whole-number download progress (0-100) while `downloading`. */ percent?: number /** - * True when this shell cannot apply updates in place (a build without a - * Developer ID signature — local installs and pre-signing CI prereleases; - * Squirrel.Mac refuses to swap unsigned bundles). `available` is then the - * pipeline's terminal state and the advance action opens the download in - * the browser instead of downloading in the background. + * True when this shell cannot apply updates in place, such as an unsigned build + * or an app running outside /Applications. `available` is then the terminal state + * and the advance action opens the installer in the browser. */ manual?: boolean } @@ -988,11 +986,11 @@ export interface DesktopUpdateState { export interface SimDesktopUpdatesApi { getState(): Promise /** - * Advance the pipeline: checks for an update, or starts the download when - * one is already known to be available (auto-download off). + * Advances the pipeline: checks for an update, downloads an available + * self-update, or opens an available manual installer. */ check(): void - /** Quit and install a `ready` update. No-op in any other state. */ + /** Installs a ready update or opens the installer for an available manual update. */ install(): void /** Subscribe to pipeline state changes. Returns an unsubscribe function. */ onState(callback: (state: DesktopUpdateState) => void): () => void diff --git a/packages/emcn/src/components/chip-modal/chip-modal.test.tsx b/packages/emcn/src/components/chip-modal/chip-modal.test.tsx index 826ef07752f..5be4ab182ff 100644 --- a/packages/emcn/src/components/chip-modal/chip-modal.test.tsx +++ b/packages/emcn/src/components/chip-modal/chip-modal.test.tsx @@ -270,6 +270,16 @@ describe('ChipConfirmModal pending', () => { }) }) +describe('ChipModalBody', () => { + it('scrolls vertically without exposing incidental horizontal overflow', () => { + mount(Content) + + const body = document.querySelector('[data-testid="modal-body"]') + expect(body?.className).toContain('overflow-x-hidden') + expect(body?.className).toContain('overflow-y-auto') + }) +}) + describe('ChipModal default actions', () => { beforeEach(makeElementsVisible) diff --git a/packages/emcn/src/components/chip-modal/chip-modal.tsx b/packages/emcn/src/components/chip-modal/chip-modal.tsx index 2809994057a..610528b77a1 100644 --- a/packages/emcn/src/components/chip-modal/chip-modal.tsx +++ b/packages/emcn/src/components/chip-modal/chip-modal.tsx @@ -414,7 +414,7 @@ const ChipModalBody = React.forwardRef( ref={ref} className={cn( 'flex min-h-0 flex-1 flex-col', - fullBleed ? 'overflow-hidden' : 'gap-4 overflow-y-auto px-2 pt-4 pb-4.5', + fullBleed ? 'overflow-hidden' : 'gap-4 overflow-y-auto overflow-x-hidden px-2 pt-4 pb-4.5', className )} {...props} diff --git a/packages/emcn/src/components/combobox/combobox.dom.test.tsx b/packages/emcn/src/components/combobox/combobox.dom.test.tsx index 69442177c14..9e999cfedb9 100644 --- a/packages/emcn/src/components/combobox/combobox.dom.test.tsx +++ b/packages/emcn/src/components/combobox/combobox.dom.test.tsx @@ -64,6 +64,14 @@ afterEach(() => { }) describe('Combobox onOpenChange', () => { + it('renders the dropdown inside the component subtree when portals are disabled', () => { + render() + + click(trigger()) + + expect(container?.querySelector('[role="listbox"]')).not.toBeNull() + }) + it('uses the overlay label for the interactive overflow layer', () => { render( atomic?: boolean diff --git a/packages/testing/src/mocks/env.mock.ts b/packages/testing/src/mocks/env.mock.ts index 13ede7a5d41..8114dc86905 100644 --- a/packages/testing/src/mocks/env.mock.ts +++ b/packages/testing/src/mocks/env.mock.ts @@ -136,7 +136,7 @@ export function envNumberImpl( ) { return value } - if (value === undefined || value === null || value === '') return fallback + if (value === undefined || value === null || String(value).trim() === '') return fallback const parsed = Number(value) return Number.isFinite(parsed) && parsed >= min && (!options.integer || Number.isInteger(parsed)) ? parsed diff --git a/packages/testing/src/mocks/schema.mock.ts b/packages/testing/src/mocks/schema.mock.ts index c02f0dadb22..8cb8847ccb3 100644 --- a/packages/testing/src/mocks/schema.mock.ts +++ b/packages/testing/src/mocks/schema.mock.ts @@ -1097,6 +1097,7 @@ export const schemaMock = { mcpServers: { id: 'mcpServers.id', workspaceId: 'mcpServers.workspaceId', + credentialGroupId: 'mcpServers.credentialGroupId', createdBy: 'mcpServers.createdBy', name: 'mcpServers.name', description: 'mcpServers.description', @@ -1216,6 +1217,7 @@ export const schemaMock = { enumValues: [ 'oauth', 'managed_oauth', + 'managed_mcp', 'env_workspace', 'env_personal', 'service_account', @@ -1236,12 +1238,18 @@ export const schemaMock = { envOwnerUserId: 'credential.envOwnerUserId', encryptedServiceAccountKey: 'credential.encryptedServiceAccountKey', authorizationAppId: 'credential.authorizationAppId', + credentialGroupEnrollmentId: 'credential.credentialGroupEnrollmentId', + credentialGroupOptionId: 'credential.credentialGroupOptionId', + mcpServerId: 'credential.mcpServerId', + managedOauthScopeVersion: 'credential.managedOauthScopeVersion', providerSubjectId: 'credential.providerSubjectId', providerTenantId: 'credential.providerTenantId', managedOauthStatus: 'credential.managedOauthStatus', grantedScopes: 'credential.grantedScopes', providerMetadata: 'credential.providerMetadata', encryptedOauthTokenSet: 'credential.encryptedOauthTokenSet', + mcpTools: 'credential.mcpTools', + mcpToolsRefreshedAt: 'credential.mcpToolsRefreshedAt', grantedAt: 'credential.grantedAt', revokedAt: 'credential.revokedAt', accessTokenExpiresAt: 'credential.accessTokenExpiresAt', diff --git a/scripts/openapi/documents.test.ts b/scripts/openapi/documents.test.ts index a3e14d01498..d2c31bd694b 100644 --- a/scripts/openapi/documents.test.ts +++ b/scripts/openapi/documents.test.ts @@ -307,7 +307,7 @@ describe('generated OpenAPI documents', () => { ) }) - it('publishes Agent tools as named integration, custom, and MCP schemas', () => { + it('publishes Agent tools as integration, custom, MCP tool, and advanced MCP schemas', () => { const workflowsSpec = generatedDocument(workflowsOpenApiDocument) const schemas = (workflowsSpec.components as JsonObject).schemas as JsonObject const agentToolInput = schemas.AgentToolInput as JsonObject @@ -332,6 +332,7 @@ describe('generated OpenAPI documents', () => { { $ref: '#/components/schemas/AgentIntegrationTool' }, { $ref: '#/components/schemas/AgentCustomTool' }, { $ref: '#/components/schemas/AgentMcpTool' }, + { $ref: '#/components/schemas/AgentMcpServerAdvanced' }, ]) expect(agentToolInput).toEqual( expect.objectContaining({ type: 'array', maxItems: MAX_AGENT_TOOLS_PER_BLOCK })