@powerhousedao/shared 6.2.3-dev.1 → 6.2.3-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clis/args/{access-token-To5LaIfL.mjs → access-token-zW_7Brog.mjs} +2 -2
- package/dist/clis/args/{access-token-To5LaIfL.mjs.map → access-token-zW_7Brog.mjs.map} +1 -1
- package/dist/clis/args/access-token.mjs +1 -1
- package/dist/clis/args/{common-CcYbXrBx.mjs → common-BT8ABM57.mjs} +9 -2
- package/dist/clis/args/common-BT8ABM57.mjs.map +1 -0
- package/dist/clis/args/{common-Dsf1vpHV.d.mts → common-yKU4B741.d.mts} +6 -3
- package/dist/clis/args/common-yKU4B741.d.mts.map +1 -0
- package/dist/clis/args/common.d.mts +1 -1
- package/dist/clis/args/common.mjs +1 -1
- package/dist/clis/args/{connect-BVVvCmL9.mjs → connect-BJs9xNFX.mjs} +2 -2
- package/dist/clis/args/{connect-BVVvCmL9.mjs.map → connect-BJs9xNFX.mjs.map} +1 -1
- package/dist/clis/args/{connect-DetTnI8g.d.mts → connect-BtU0MTTc.d.mts} +6 -6
- package/dist/clis/args/{connect-DetTnI8g.d.mts.map → connect-BtU0MTTc.d.mts.map} +1 -1
- package/dist/clis/args/connect.d.mts +1 -1
- package/dist/clis/args/connect.mjs +1 -1
- package/dist/clis/args/{generate-CA916Fvj.mjs → generate-DkFqeNX3.mjs} +2 -2
- package/dist/clis/args/{generate-CA916Fvj.mjs.map → generate-DkFqeNX3.mjs.map} +1 -1
- package/dist/clis/args/generate.mjs +1 -1
- package/dist/clis/args/{help-Bqbgbalu.mjs → help-mSyWtycB.mjs} +15 -15
- package/dist/clis/args/{help-Bqbgbalu.mjs.map → help-mSyWtycB.mjs.map} +1 -1
- package/dist/clis/args/help.mjs +1 -1
- package/dist/clis/args/index.d.mts +3 -3
- package/dist/clis/args/index.mjs +18 -18
- package/dist/clis/args/{init-rz9Ei7nq.mjs → init-Bu8-Ovk8.mjs} +2 -2
- package/dist/clis/args/{init-rz9Ei7nq.mjs.map → init-Bu8-Ovk8.mjs.map} +1 -1
- package/dist/clis/args/init.mjs +1 -1
- package/dist/clis/args/{inspect-tckH8mSw.mjs → inspect-GjiR0Qqd.mjs} +2 -2
- package/dist/clis/args/{inspect-tckH8mSw.mjs.map → inspect-GjiR0Qqd.mjs.map} +1 -1
- package/dist/clis/args/inspect.mjs +1 -1
- package/dist/clis/args/{install-Sz2DlCHh.mjs → install-B2hLryPk.mjs} +2 -2
- package/dist/clis/args/{install-Sz2DlCHh.mjs.map → install-B2hLryPk.mjs.map} +1 -1
- package/dist/clis/args/install.mjs +1 -1
- package/dist/clis/args/{list-DM2d6f1m.mjs → list-O6VmV3Cw.mjs} +2 -2
- package/dist/clis/args/{list-DM2d6f1m.mjs.map → list-O6VmV3Cw.mjs.map} +1 -1
- package/dist/clis/args/list.mjs +1 -1
- package/dist/clis/args/{login-DiKT5Jfu.mjs → login-BWXdMfMX.mjs} +2 -2
- package/dist/clis/args/{login-DiKT5Jfu.mjs.map → login-BWXdMfMX.mjs.map} +1 -1
- package/dist/clis/args/login.mjs +1 -1
- package/dist/clis/args/{migrate-CG_gWc4k.mjs → migrate-3MTmDiXt.mjs} +2 -2
- package/dist/clis/args/{migrate-CG_gWc4k.mjs.map → migrate-3MTmDiXt.mjs.map} +1 -1
- package/dist/clis/args/migrate.mjs +1 -1
- package/dist/clis/args/{publish-DDZYsUfV.mjs → publish--zdKYIOl.mjs} +2 -2
- package/dist/clis/args/{publish-DDZYsUfV.mjs.map → publish--zdKYIOl.mjs.map} +1 -1
- package/dist/clis/args/publish.mjs +1 -1
- package/dist/clis/args/{registry-C_OVFQmI.mjs → registry-BNVeE6qR.mjs} +2 -2
- package/dist/clis/args/{registry-C_OVFQmI.mjs.map → registry-BNVeE6qR.mjs.map} +1 -1
- package/dist/clis/args/registry.mjs +1 -1
- package/dist/clis/args/{service-CHOOr0Gg.mjs → service-x6wsNujS.mjs} +2 -2
- package/dist/clis/args/{service-CHOOr0Gg.mjs.map → service-x6wsNujS.mjs.map} +1 -1
- package/dist/clis/args/service.mjs +1 -1
- package/dist/clis/args/{switchboard-Dsp7nosi.mjs → switchboard-Cryy_3Qc.mjs} +2 -2
- package/dist/clis/args/{switchboard-Dsp7nosi.mjs.map → switchboard-Cryy_3Qc.mjs.map} +1 -1
- package/dist/clis/args/switchboard.mjs +1 -1
- package/dist/clis/args/{uninstall-CTwTX0u_.mjs → uninstall-DQUsLzCG.mjs} +2 -2
- package/dist/clis/args/{uninstall-CTwTX0u_.mjs.map → uninstall-DQUsLzCG.mjs.map} +1 -1
- package/dist/clis/args/uninstall.mjs +1 -1
- package/dist/clis/args/{unpublish-BPMkGEg5.mjs → unpublish-CeDsvgMv.mjs} +2 -2
- package/dist/clis/args/{unpublish-BPMkGEg5.mjs.map → unpublish-CeDsvgMv.mjs.map} +1 -1
- package/dist/clis/args/unpublish.mjs +1 -1
- package/dist/clis/args/{vetra-DLQ6lhLl.d.mts → vetra-CoMvTJK7.d.mts} +2 -2
- package/dist/clis/args/{vetra-DLQ6lhLl.d.mts.map → vetra-CoMvTJK7.d.mts.map} +1 -1
- package/dist/clis/args/{vetra-b4KUu1Ax.mjs → vetra-pYJXVf_o.mjs} +2 -2
- package/dist/clis/args/{vetra-b4KUu1Ax.mjs.map → vetra-pYJXVf_o.mjs.map} +1 -1
- package/dist/clis/args/vetra.d.mts +1 -1
- package/dist/clis/args/vetra.mjs +1 -1
- package/dist/clis/build-config.d.mts +29 -1
- package/dist/clis/build-config.d.mts.map +1 -1
- package/dist/clis/build-config.mjs +138 -19
- package/dist/clis/build-config.mjs.map +1 -1
- package/dist/clis/constants.d.mts +13 -0
- package/dist/clis/constants.d.mts.map +1 -1
- package/dist/clis/constants.mjs +8 -0
- package/dist/clis/constants.mjs.map +1 -1
- package/dist/clis/index.d.mts +16 -0
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +16 -1
- package/dist/clis/index.mjs.map +1 -1
- package/dist/connect/config-loader.d.ts +1 -1
- package/dist/connect/index.d.ts +93 -2
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +180 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/document-drive/index.d.ts +43 -3
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-drive/index.js +94 -34
- package/dist/document-drive/index.js.map +1 -1
- package/dist/document-model/index.d.ts +2 -2
- package/dist/document-model/index.js +1 -0
- package/dist/document-model/index.js.map +1 -1
- package/dist/{index-DyYIJtVy.d.ts → index-DP3QgHTq.d.ts} +2 -2
- package/dist/{index-DyYIJtVy.d.ts.map → index-DP3QgHTq.d.ts.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/processors/index.d.ts +1 -1
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/manifest-slim.d.ts +1 -1
- package/dist/registry/manifest-slim.d.ts.map +1 -1
- package/dist/registry/manifest-slim.js +2 -1
- package/dist/registry/manifest-slim.js.map +1 -1
- package/dist/{types-CpnWmiFY.d.ts → types-BIoOWpOT.d.ts} +6 -1
- package/dist/types-BIoOWpOT.d.ts.map +1 -0
- package/dist/{types-YqLqb0Zb.d.ts → types-jzM0X9cd.d.ts} +8 -2
- package/dist/{types-YqLqb0Zb.d.ts.map → types-jzM0X9cd.d.ts.map} +1 -1
- package/package.json +1 -1
- package/dist/clis/args/common-CcYbXrBx.mjs.map +0 -1
- package/dist/clis/args/common-Dsf1vpHV.d.mts.map +0 -1
- package/dist/types-CpnWmiFY.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../connect/env-config.ts","../../connect/pwa-config.ts","../../connect/pwa-manifest.ts","../../connect/schema-fragments.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Coerces string values to boolean.\n * Accepts: \"true\", \"false\", true, false\n */\nconst booleanString = z\n .union([z.boolean(), z.enum([\"true\", \"false\"])])\n .transform((val) => {\n if (typeof val === \"boolean\") return val;\n return val === \"true\";\n });\n\n// ============================================================================\n// Build-time Environment Variables\n// ============================================================================\n\n/**\n * Build-time configuration schema\n */\nconst buildEnvSchema = z.object({\n /**\n * Comma-separated list of package names to load\n * @example \"package1,package2\"\n */\n PH_PACKAGES: z.string().optional(),\n\n /**\n * Path to local package to load during development\n */\n PH_LOCAL_PACKAGE: z.string().optional(),\n\n /**\n * Sentry authentication token for uploading source maps\n */\n PH_SENTRY_AUTH_TOKEN: z.string().optional(),\n\n /**\n * Sentry organization slug\n */\n PH_SENTRY_ORG: z.string().optional(),\n\n /**\n * Sentry project slug\n */\n PH_SENTRY_PROJECT: z.string().optional(),\n});\n\n// ============================================================================\n// Application Configuration (build metadata only)\n// ============================================================================\n\n/**\n * Connect runtime values (anything in `PHConnectRuntimeConfig`) are NOT\n * settable from env vars. They live in `powerhouse.config.json` and are\n * overridden via `ph connect build --<field>` or `ph connect config\n * --<field>`.\n *\n * What stays env-driven below is non-runtime: build metadata, Sentry\n * credentials, analytics processor toggles, etc.\n */\nconst appConfigSchema = z.object({\n /**\n * Application version number (build metadata stamp)\n * @default \"unknown\"\n */\n PH_CONNECT_VERSION: z.string().default(\"unknown\"),\n\n /**\n * CLI version number (build metadata stamp)\n */\n PH_CONNECT_CLI_VERSION: z.string().optional(),\n});\n\n// ============================================================================\n// Analytics Processor Configuration\n// ============================================================================\n\n/**\n * Analytics processor configuration schema. These are non-runtime feature\n * toggles for the analytics subsystem — they don't live in the runtime\n * schema and stay env-driven.\n */\nconst processorsConfigSchema = z.object({\n /**\n * Enable diff analytics tracking\n * @default false\n */\n PH_CONNECT_DIFF_ANALYTICS_ENABLED: booleanString.default(false),\n\n /**\n * Enable drive analytics tracking\n * @default true\n */\n PH_CONNECT_DRIVE_ANALYTICS_ENABLED: booleanString.default(true),\n\n /**\n * Enable external analytics processors\n * @default true\n */\n PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED: booleanString.default(true),\n});\n\n// ============================================================================\n// OpenPanel Configuration\n// ============================================================================\n\n/**\n * OpenPanel analytics configuration schema\n */\nconst openPanelConfigSchema = z.object({\n /**\n * OpenPanel client ID. When unset, the OpenPanel subsystem is a no-op.\n */\n PH_CONNECT_OPENPANEL_CLIENT_ID: z.string().optional(),\n\n /**\n * OpenPanel API URL override. Defaults to the OpenPanel cloud when unset.\n */\n PH_CONNECT_OPENPANEL_API_URL: z.string().optional(),\n\n /**\n * Track UI events via the useOpenPanel() hook\n * @default true\n */\n PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS: booleanString.default(true),\n\n /**\n * Track document operations via the OpenPanel processor\n * @default true\n */\n PH_CONNECT_OPENPANEL_TRACK_OPERATIONS: booleanString.default(true),\n});\n\n// ============================================================================\n// Combined Schemas\n// ============================================================================\n\n/**\n * Complete runtime environment schema (all PH_CONNECT_* vars). Only\n * build-metadata + analytics-processor toggles live here; all Connect\n * runtime config lives in `powerhouse.config.json`.\n */\nexport const runtimeEnvSchema = appConfigSchema\n .extend(processorsConfigSchema.shape)\n .extend(openPanelConfigSchema.shape);\n\n/**\n * Complete environment schema (build + runtime)\n */\nexport const connectEnvSchema = buildEnvSchema.extend(runtimeEnvSchema.shape);\n\n/**\n * Inferred TypeScript types from schemas\n */\nexport type ConnectBuildEnv = z.infer<typeof buildEnvSchema>;\nexport type ConnectRuntimeEnv = z.infer<typeof runtimeEnvSchema>;\nexport type ConnectEnv = z.infer<typeof connectEnvSchema>;\n\n// ============================================================================\n// Environment Loading Functions\n// ============================================================================\n\n/**\n * Options for loading environment variables\n */\nexport interface LoadEnvOptions {\n /**\n * Environment variables from process.env (highest priority)\n */\n processEnv?: Record<string, string | undefined>;\n /**\n * Environment variables from .env file (lowest priority)\n */\n fileEnv?: Record<string, string | undefined>;\n}\n\n/**\n * Internal helper to merge environment sources with priority.\n * Validates each value and falls back to next priority if invalid.\n */\nfunction mergeEnvSources(\n options: LoadEnvOptions,\n keys: Set<string>,\n schema: z.ZodObject<Record<string, z.ZodTypeAny>>,\n): Record<string, unknown> {\n const { processEnv = {}, fileEnv = {} } = options;\n const merged: Record<string, unknown> = {};\n\n // Apply priority: fileEnv < processEnv\n for (const key of keys) {\n const sources = [\n { name: \"process.env\", value: processEnv[key] },\n { name: \"fileEnv\", value: fileEnv[key] },\n ];\n\n // Try each source in priority order\n for (const source of sources) {\n const value = source.value;\n if (value === undefined || value === \"\") continue;\n\n // Try to validate just this field\n try {\n const fieldSchema = schema.shape[key];\n if (fieldSchema) {\n fieldSchema.parse(value);\n merged[key] = value;\n break; // Successfully validated, use this value\n }\n // No schema for this key, accept it\n console.warn(`Unknown environment variable: '${key}'`);\n merged[key] = value;\n break;\n } catch {\n // Validation failed, log warning and try next source\n const valueStr =\n value === null\n ? \"null\"\n : typeof value === \"object\"\n ? JSON.stringify(value)\n : (value as string);\n console.warn(\n `Invalid value for ${key} from ${source.name}: ${valueStr}. Trying next source.`,\n );\n }\n }\n }\n\n return merged;\n}\n\n/**\n * Loads and validates environment variables with priority:\n * 1. process.env (highest)\n * 2. fileEnv\n * 3. defaults from schema (lowest)\n *\n * @param options - Environment sources in priority order\n * @returns Validated and typed environment configuration\n */\nexport function loadConnectEnv(options: LoadEnvOptions = {}): ConnectEnv {\n const allKeys = new Set([\n ...Object.keys(buildEnvSchema.shape),\n ...Object.keys(runtimeEnvSchema.shape),\n ]);\n\n const merged = mergeEnvSources(options, allKeys, connectEnvSchema);\n return connectEnvSchema.parse(merged);\n}\n\n/**\n * Loads only runtime environment variables (build metadata + Sentry +\n * analytics-processor toggles — everything in the Connect runtime schema\n * is sourced from powerhouse.config.json, not env).\n *\n * @param options - Environment sources in priority order\n * @returns Validated runtime environment configuration\n */\nexport function loadRuntimeEnv(\n options: LoadEnvOptions = {},\n): ConnectRuntimeEnv {\n const allKeys = new Set(Object.keys(runtimeEnvSchema.shape));\n const merged = mergeEnvSources(options, allKeys, runtimeEnvSchema);\n return runtimeEnvSchema.parse(merged);\n}\n\n/**\n * Safely sets Connect environment variables with validation.\n * Invalid values will log a warning and be skipped.\n *\n * @param values - Type-safe object with key-value pairs to set\n *\n * @example\n * ```ts\n * setConnectEnv({\n * PH_CONNECT_VERSION: \"1.2.3\",\n * PH_CONNECT_SENTRY_DSN: \"https://…\",\n * });\n * ```\n */\nexport function setConnectEnv(values: Partial<ConnectEnv>): void {\n for (const [key, value] of Object.entries(values)) {\n // Check if key exists in schema\n const fieldSchema =\n connectEnvSchema.shape[key as keyof typeof connectEnvSchema.shape];\n\n if (!fieldSchema) {\n console.warn(\n `Unknown environment variable: ${key}. Variable not set. Valid keys: ${Object.keys(connectEnvSchema.shape).join(\", \")}`,\n );\n continue;\n }\n\n try {\n // Validate the value\n fieldSchema.parse(value);\n\n // Set the value (convert to string for process.env compatibility)\n process.env[key] = String(value);\n } catch (error) {\n console.warn(\n `Invalid value for ${key}: ${String(value)}. Validation failed.`,\n error,\n );\n }\n }\n}\n\n/**\n * Normalizes a base path to ensure it:\n * - Starts with a forward slash (/)\n * - Ends with a forward slash (/)\n * - Has no relative path prefix (.)\n *\n * @param basePath - The base path to normalize\n * @returns The normalized base path\n *\n * @example\n * normalizeBasePath('/app') // '/app/'\n * normalizeBasePath('./app/') // '/app/'\n * normalizeBasePath('app') // '/app/'\n * normalizeBasePath('/') // '/'\n * normalizeBasePath('') // '/'\n */\nexport function normalizeBasePath(basePath: string): string {\n if (!basePath) {\n return \"/\";\n }\n\n let normalized = basePath;\n\n // Remove relative path prefix\n if (normalized.startsWith(\".\")) {\n normalized = normalized.slice(1);\n }\n\n // Ensure it starts with a forward slash\n if (!normalized.startsWith(\"/\")) {\n normalized = `/${normalized}`;\n }\n\n // Ensure it ends with a forward slash\n if (!normalized.endsWith(\"/\")) {\n normalized = `${normalized}/`;\n }\n\n return normalized;\n}\n\n/**\n * Base storage namespace for a Connect instance served at the root of an\n * origin. Kept as a literal so root deployments resolve to a byte-identical\n * value with no migration.\n */\nexport const ROOT_STORAGE_NAMESPACE = \"reactor\";\n\n/**\n * Derives the origin-scoped storage namespace from a Connect base path.\n *\n * Connect instances served under different path prefixes of the same origin\n * (e.g. behind a reverse proxy) otherwise share all origin-scoped browser\n * storage (PGlite data dirs, IndexedDB). This produces a deterministic,\n * collision-free namespace per distinct prefix that is valid as an\n * IndexedDB database name.\n *\n * - root base path (\"/\" or unset) -> \"reactor\" (byte-identical to the legacy\n * key, so existing root deployments keep their data with zero migration)\n * - any non-root base path -> \"reactor--<slug>\", e.g.\n * \"/reactor-project/vetra-studio/\" -> \"reactor--reactor-project-vetra-studio\"\n *\n * @param basePath - The Connect base path (env.PH_CONNECT_BASE_PATH ||\n * import.meta.env.BASE_URL); normalized internally.\n * @returns The storage namespace.\n *\n * @example\n * getStorageNamespace('/') // 'reactor'\n * getStorageNamespace('/reactor-project/vetra-studio/') // 'reactor--reactor-project-vetra-studio'\n */\nexport function getStorageNamespace(basePath: string): string {\n const normalized = normalizeBasePath(basePath);\n if (normalized === \"/\") {\n return ROOT_STORAGE_NAMESPACE;\n }\n const slug = normalized\n .slice(1, -1)\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n // A non-root base path whose slug normalizes to nothing (e.g. \"/-/\") must\n // not collapse into the root namespace and share its storage.\n return `${ROOT_STORAGE_NAMESPACE}--${slug || \"default\"}`;\n}\n","// Merging of Connect PWA override fragments.\n//\n// PWA config comes from several layers — Connect's hardcoded defaults, each\n// build-time-known package's `pwa` fragment, and the project's `connect.pwa`\n// block. A naive deep-merge is wrong here: runtime-caching rules and precache\n// globs are ADDITIVE (a later layer must not drop an earlier layer's offline\n// coverage), and the precache size ceiling must be the MAX so no contributor\n// can silently shrink another's limit. This module encodes those per-field\n// strategies: `mergePwaConfig(contributions)` folds an ordered list of\n// serialisable `PHConnectPwa` fragments (lowest precedence first) into one\n// effective fragment, warning when multiple packages set the same manifest\n// scalar to different values.\n//\n// Laying the effective fragment over Connect's hardcoded VitePWA base happens\n// in builder-tools (`connect-utils/vite-plugins/pwa-overrides.ts`), where\n// vite-plugin-pwa's manifest types are available.\n\nimport type {\n PHConnectPwa,\n PHConnectPwaManifest,\n PHConnectPwaUrlPattern,\n} from \"../clis/types.js\";\nimport { deepMerge } from \"./config-loader.js\";\n\n// Re-exported so the PWA override types are reachable from the same\n// `@powerhousedao/shared/connect` entry as the merge helpers that consume them.\nexport type {\n PHConnectPwa,\n PHConnectPwaCacheStrategy,\n PHConnectPwaFileHandler,\n PHConnectPwaIcon,\n PHConnectPwaManifest,\n PHConnectPwaRuntimeCaching,\n PHConnectPwaUrlPattern,\n} from \"../clis/types.js\";\n\n/** A labelled PWA fragment, so merge diagnostics can name the contributor. */\nexport type PwaContribution = {\n /** Human-readable origin (package name, or the project config file). */\n source: string;\n config: PHConnectPwa;\n};\n\n// Manifest scalar fields — the ones where \"two layers set it\" is a genuine\n// conflict (as opposed to the additive arrays, which never conflict).\nconst MANIFEST_SCALAR_KEYS: readonly (keyof PHConnectPwaManifest)[] = [\n \"name\",\n \"short_name\",\n \"description\",\n \"theme_color\",\n \"background_color\",\n \"display\",\n \"start_url\",\n \"scope\",\n \"launch_handler\",\n];\n\n// Manifest fields merged additively (concatenated/unioned across every layer),\n// never as scalar conflicts. Kept out of the deepMerge path, which replaces\n// arrays wholesale and would drop earlier contributions. `categories` is\n// derived (from the manifest `category` field) but merges the same additive way.\nconst ADDITIVE_MANIFEST_KEYS = new Set<keyof PHConnectPwaManifest>([\n \"icons\",\n \"file_handlers\",\n \"categories\",\n]);\n\n// Structural icon shape shared by PHConnectPwaIcon and vite-plugin-pwa's\n// IconResource (whose `purpose` may also be an array of purposes).\ntype IconLike = {\n src: string;\n sizes?: string;\n purpose?: string | readonly string[];\n};\n\nfunction iconKey(icon: IconLike): string {\n const purpose =\n typeof icon.purpose === \"string\"\n ? icon.purpose\n : (icon.purpose?.join(\",\") ?? \"\");\n return `${icon.src}|${icon.sizes ?? \"\"}|${purpose}`;\n}\n\n/** Concatenate, keeping the first occurrence per `key`. */\nfunction dedupeBy<T>(items: T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n const result: T[] = [];\n for (const item of items) {\n const k = key(item);\n if (seen.has(k)) continue;\n seen.add(k);\n result.push(item);\n }\n return result;\n}\n\n/** Concatenate icons, keeping the first occurrence of each (src,sizes,purpose). */\nexport function dedupeIcons<T extends IconLike>(icons: T[]): T[] {\n return dedupeBy(icons, iconKey);\n}\n\n/** `JSON.stringify` with object keys sorted recursively, so two structurally\n * equal values always serialise identically (accept-map key order etc.). */\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(\",\")}]`;\n }\n if (value !== null && typeof value === \"object\") {\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`);\n return `{${entries.join(\",\")}}`;\n }\n return JSON.stringify(value);\n}\n\n/**\n * Concatenate file handlers, keeping the first occurrence of each entry.\n * Deduped on the WHOLE entry (canonical JSON) rather than any single field:\n * every handler shares Connect's fixed action, and two handlers accepting\n * different file types are both real contributions — only the exact same\n * fragment arriving via two layers is a duplicate. Structural, so it also\n * works on the vite-plugin-pwa handler shape in builder-tools.\n */\nexport function dedupeFileHandlers<T extends object>(handlers: T[]): T[] {\n return dedupeBy(handlers, stableStringify);\n}\n\n/** Fold a manifest's top-level `category` string into a PWA config as a\n * `categories: [category]` entry. PWA `categories` is DERIVED from the\n * `category` field of every contributing `powerhouse.manifest.json` (never\n * authored under `pwa`); `mergePwaConfig`/`mergeManifest` then union them\n * across contributors. No-op when there is no usable category. */\nexport function withInferredCategory(\n config: PHConnectPwa,\n category: unknown,\n): PHConnectPwa {\n if (typeof category !== \"string\" || !category) return config;\n return {\n ...config,\n manifest: { ...config.manifest, categories: [category] },\n };\n}\n\n/** Order-preserving string union (used for the precache glob lists). */\nexport function unionStrings(\n base: string[] | undefined,\n extra: string[],\n): string[] {\n const result = [...(base ?? [])];\n for (const item of extra) if (!result.includes(item)) result.push(item);\n return result;\n}\n\nfunction patternKey(pattern: PHConnectPwaUrlPattern): string {\n return typeof pattern === \"string\"\n ? `s:${pattern}`\n : `r:${pattern.source}:${pattern.flags ?? \"\"}`;\n}\n\nfunction unionPatterns(\n base: PHConnectPwaUrlPattern[] | undefined,\n extra: PHConnectPwaUrlPattern[],\n): PHConnectPwaUrlPattern[] {\n const result = [...(base ?? [])];\n const seen = new Set(result.map(patternKey));\n for (const pattern of extra) {\n const key = patternKey(pattern);\n if (seen.has(key)) continue;\n seen.add(key);\n result.push(pattern);\n }\n return result;\n}\n\n/** Merge one fragment into `target` in place, applying the per-field\n * strategies (manifest scalars deep-merge and win; icons/file_handlers/globs/\n * rules/denylist are additive; size ceiling takes the max). */\nfunction mergeInto(target: PHConnectPwa, config: PHConnectPwa): void {\n if (config.manifest) {\n // The additive arrays are pulled out of the deepMerge path: deepMerge\n // replaces arrays wholesale, which would drop earlier contributions.\n const { icons, file_handlers, categories, ...scalars } = config.manifest;\n if (Object.keys(scalars).length > 0) {\n target.manifest = deepMerge(\n target.manifest ?? {},\n scalars as PHConnectPwaManifest,\n );\n }\n if (icons?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n icons: dedupeIcons([...(target.manifest?.icons ?? []), ...icons]),\n };\n }\n if (file_handlers?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n file_handlers: dedupeFileHandlers([\n ...(target.manifest?.file_handlers ?? []),\n ...file_handlers,\n ]),\n };\n }\n if (categories?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n categories: unionStrings(target.manifest?.categories, categories),\n };\n }\n }\n if (config.globPatterns?.length) {\n target.globPatterns = unionStrings(\n target.globPatterns,\n config.globPatterns,\n );\n }\n if (config.globIgnores?.length) {\n target.globIgnores = unionStrings(target.globIgnores, config.globIgnores);\n }\n if (config.runtimeCaching?.length) {\n target.runtimeCaching = [\n ...(target.runtimeCaching ?? []),\n ...config.runtimeCaching,\n ];\n }\n if (config.navigateFallbackDenylist?.length) {\n target.navigateFallbackDenylist = unionPatterns(\n target.navigateFallbackDenylist,\n config.navigateFallbackDenylist,\n );\n }\n if (typeof config.maximumFileSizeToCacheInBytes === \"number\") {\n target.maximumFileSizeToCacheInBytes = Math.max(\n target.maximumFileSizeToCacheInBytes ?? 0,\n config.maximumFileSizeToCacheInBytes,\n );\n }\n}\n\n/**\n * Fold the build-time-known package PWA fragments and the project's\n * `connect.pwa` block into one effective fragment. Precedence is\n * `packageContributions (in order) < projectConfig` — the project config wins\n * scalar fields, while arrays (`icons`, globs, `runtimeCaching`,\n * `navigateFallbackDenylist`) are additive across every layer and the size\n * ceiling takes the max.\n *\n * `onWarn` fires when two or more PACKAGES set the same manifest scalar to\n * different values and the project config doesn't settle it — the winner is\n * otherwise decided silently by package load order. The operator resolves it\n * by setting that field in `connect.pwa`, which both wins and silences the\n * warning.\n */\nexport function mergePwaConfig(\n packageContributions: PwaContribution[],\n projectConfig?: PHConnectPwa,\n onWarn: (message: string) => void = () => {},\n): PHConnectPwa {\n const merged: PHConnectPwa = {};\n // Which packages set each manifest scalar, and to what (for the conflict\n // warning). The project config is deliberately excluded — it is the\n // authority, not a conflicting sibling.\n const packageScalarSetters: Partial<\n Record<string, { source: string; value: unknown }[]>\n > = {};\n\n for (const { source, config } of packageContributions) {\n mergeInto(merged, config);\n for (const [key, value] of Object.entries(config.manifest ?? {})) {\n if (ADDITIVE_MANIFEST_KEYS.has(key as keyof PHConnectPwaManifest)) {\n continue;\n }\n (packageScalarSetters[key] ??= []).push({ source, value });\n }\n }\n if (projectConfig) mergeInto(merged, projectConfig);\n\n const projectManifest = projectConfig?.manifest ?? {};\n for (const key of MANIFEST_SCALAR_KEYS) {\n const setters = packageScalarSetters[key];\n const projectSettles = projectManifest[key] !== undefined;\n if (!setters || setters.length < 2 || projectSettles) continue;\n // Same value from every package is agreement, not a conflict. Compared\n // via stableStringify, not by identity — launch_handler is object-valued,\n // and two packages sending equal objects (in any key order) must not read\n // as a conflict.\n const distinctValues = new Set(\n setters.map((s) => stableStringify(s.value)),\n );\n if (distinctValues.size < 2) continue;\n const sources = setters.map((s) => s.source);\n onWarn(\n `PWA config: manifest.${key} set by multiple packages (${sources.join(\n \", \",\n )}); '${sources[sources.length - 1]}' wins by load order. Set connect.pwa.manifest.${key} in the project config to make the winner explicit.`,\n );\n }\n\n return merged;\n}\n\n/** A serialisable URL pattern as Workbox consumes it: strings pass through\n * verbatim, `{ source, flags }` is rebuilt into a RegExp. */\nexport function toRegExpOrString(\n pattern: PHConnectPwaUrlPattern,\n): string | RegExp {\n return typeof pattern === \"string\"\n ? pattern\n : new RegExp(pattern.source, pattern.flags);\n}\n","// Building the effective web-app manifest from a base manifest plus a\n// `PHConnectPwaManifest` fragment. Pure JSON in / JSON out — no PWA-toolchain\n// or DOM dependency — so the SAME code path runs at build time (laying the\n// effective build-merged fragment over Connect's hardcoded base, see\n// applyPwaOverrides) and at runtime inside the service worker (laying a\n// dynamically-installed package's fragment over the build-embedded base to\n// serve the live manifest).\n//\n// Connect owns the \"where\" of every OS integration: file handlers open at the\n// app root, `web+…` protocol links and shared files route through fixed\n// in-scope endpoints. Contributors declare only WHAT they accept; the routes\n// below are injected here so a package can never point the OS at an arbitrary\n// URL. Injection is idempotent, so re-merging a manifest that already carries\n// the routes is a no-op.\n\nimport type {\n PHConnectPwaFileHandler,\n PHConnectPwaIcon,\n PHConnectPwaManifest,\n} from \"../clis/types.js\";\nimport { dedupeFileHandlers, dedupeIcons, unionStrings } from \"./pwa-config.js\";\n\n/**\n * The one route launched files open at, shared by the built-in handler and\n * injected into every contributed one. Not configurable: consuming launched\n * files takes runtime code that lives in Connect itself, and a relative \".\"\n * resolves against the manifest URL so it tracks any deploy base (the\n * webmanifest is served dynamically and never rewritten by the dynamic-base\n * plugin) — same trick as the base start_url/scope.\n */\nexport const PWA_FILE_HANDLER_ACTION = \".\";\n\n// IndexedDB schema for the page->service-worker PWA-fragment mirror. A SW can't\n// read localStorage (where the installed-package list lives), so the SPA\n// mirrors the merged fragment here and the SW reads it to serve a live\n// manifest. Both sides MUST agree, so the schema lives here as the single\n// source of truth (the SPA writer and the SW reader both import these) —\n// a rename or version bump can no longer desync one side silently.\nexport const PWA_IDB_NAME = \"ph-pwa\";\nexport const PWA_IDB_STORE = \"fragments\";\nexport const PWA_IDB_KEY = \"merged\";\nexport const PWA_IDB_VERSION = 1;\n\n/** The subset of a web-app manifest this module reads/writes, plus an index\n * signature so untouched fields (name, theme_color, launch_handler, …) pass\n * through verbatim. */\nexport interface PwaWebManifest {\n icons?: PHConnectPwaIcon[];\n file_handlers?: (PHConnectPwaFileHandler & { action?: string })[];\n categories?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Lay a `PHConnectPwaManifest` fragment over a base web-manifest object.\n *\n * - **scalars** (name, theme_color, launch_handler, …): governed by\n * `scalarPolicy`. `\"fragment-wins\"` lets the fragment overwrite the base;\n * `\"base-wins\"` keeps the base and only fills fields it left unset. Keys\n * listed in `protectedScalars` always behave as base-wins even under a\n * fragment-wins policy — used at runtime to fragment-win cosmetic scalars\n * while still protecting navigation-critical ones (`start_url`/`scope`) from\n * an untrusted dynamically-installed package.\n * - **arrays** (icons, file_handlers): always additive, base entries first,\n * de-duplicated — so a package can extend but never displace a built-in\n * (Chromium is first-registered-wins per file extension, so `.phd`/`.phdm`\n * stay Connect's).\n * - **categories**: order-preserving string union (derived from the manifest\n * `category` field, not authored under `pwa`).\n *\n * The Connect-owned file-handler action is injected idempotently.\n */\nexport function mergeManifest(\n base: PwaWebManifest,\n fragment: PHConnectPwaManifest | undefined,\n opts?: {\n scalarPolicy?: \"base-wins\" | \"fragment-wins\";\n protectedScalars?: readonly string[];\n },\n): PwaWebManifest {\n const scalarPolicy = opts?.scalarPolicy ?? \"base-wins\";\n const protectedScalars = opts?.protectedScalars ?? [];\n const result: PwaWebManifest = { ...base };\n const { icons, file_handlers, categories, ...scalars } = fragment ?? {};\n\n const takeScalar = (key: string): boolean => {\n // Protected keys stay base-wins regardless of the policy.\n const policy = protectedScalars.includes(key) ? \"base-wins\" : scalarPolicy;\n return policy === \"fragment-wins\" || result[key] === undefined;\n };\n\n for (const [key, value] of Object.entries(scalars)) {\n if (takeScalar(key)) result[key] = value;\n }\n\n if (icons?.length) {\n result.icons = dedupeIcons([...(result.icons ?? []), ...icons]);\n }\n if (file_handlers?.length) {\n // Force the Connect-owned action (spread first, action last) so contributed\n // handlers match the base's already-injected shape and de-dupe correctly.\n const injected = file_handlers.map((handler) => ({\n ...handler,\n action: PWA_FILE_HANDLER_ACTION,\n }));\n result.file_handlers = dedupeFileHandlers([\n ...(result.file_handlers ?? []),\n ...injected,\n ]);\n }\n if (categories?.length) {\n result.categories = unionStrings(result.categories, categories);\n }\n\n // Idempotently (re-)assert the Connect-owned file-handler action across the\n // merged result, covering both fragment contributions and any base entries.\n if (result.file_handlers?.length) {\n result.file_handlers = result.file_handlers.map((handler) => ({\n ...handler,\n action: PWA_FILE_HANDLER_ACTION,\n }));\n }\n\n return result;\n}\n","// Single source of truth for JSON Schema shapes shared between the source\n// PowerhouseConfig schema (packages/shared/clis/source-config-schema.ts) and\n// the runtime RuntimePowerhouseConfig schema\n// (packages/builder-tools/connect-utils/runtime-config-schema.ts).\n//\n// When a shared shape changes, edit it here — both schemas pick it up.\n\nexport const powerhousePackageSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"packageName\"],\n properties: {\n packageName: {\n type: \"string\",\n description: \"Fully qualified npm package name (e.g. @scope/name).\",\n },\n version: {\n type: \"string\",\n description: \"Exact version (registry providers) or omit to take latest.\",\n },\n provider: {\n type: \"string\",\n enum: [\"npm\", \"github\", \"local\", \"registry\"],\n description: \"Where Connect should resolve the package from at runtime.\",\n },\n url: {\n type: \"string\",\n description:\n \"Override URL for non-registry providers (e.g. github tarball).\",\n },\n },\n} as const;\n\n// Reusable shape for `connect.drives.sections.{remote,local}` — three\n// affirmative-named toggles per section. The legacy public+cloud sections\n// have been collapsed into a single `remote`.\nconst driveSectionSchema = {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Visibility and add/delete affordances for a drive section in the sidebar.\",\n properties: {\n enabled: {\n type: \"boolean\",\n description: \"When false, the section is hidden in the sidebar.\",\n default: true,\n },\n allowAdd: {\n type: \"boolean\",\n description:\n \"When false, the section's 'add drive' affordance is hidden.\",\n default: true,\n },\n allowDelete: {\n type: \"boolean\",\n description:\n \"When false, drives in this section cannot be deleted from the UI.\",\n default: true,\n },\n },\n} as const;\n\n// Reusable shape for a runtime-caching / denylist URL match. A string is\n// handed to Workbox verbatim; `{ source, flags }` is rebuilt into a RegExp at\n// build time. Function patterns aren't serialisable and can't be expressed\n// from config — only Connect's built-in rules use them (see the runtime-caching\n// rules in builder-tools' connect-utils/service-worker/service-worker.ts).\nconst pwaUrlPatternSchema = {\n description:\n \"URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.\",\n oneOf: [\n { type: \"string\" },\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"source\"],\n properties: {\n source: { type: \"string\", description: \"RegExp source.\" },\n flags: { type: \"string\", description: \"RegExp flags (e.g. 'i').\" },\n },\n },\n ],\n} as const;\n\n// Reusable web-app-manifest icon shape (manifest.icons and file-handler icons).\nconst pwaIconSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"src\"],\n properties: {\n src: { type: \"string\" },\n sizes: { type: \"string\" },\n type: { type: \"string\" },\n purpose: { type: \"string\" },\n },\n} as const;\n\nexport const phConnectRuntimeConfigSchema = {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.\",\n properties: {\n branding: {\n type: \"object\",\n additionalProperties: false,\n description: \"App identity and visual branding.\",\n properties: {\n appName: {\n type: \"string\",\n description:\n \"Browser tab title and any in-app brand text. Defaults to 'Powerhouse Connect'.\",\n },\n homeBackground: {\n type: [\"string\", \"null\"],\n description:\n \"Hero image on the empty home screen. URL or path to override; null or omitted uses the bundled default image.\",\n },\n },\n },\n app: {\n type: \"object\",\n additionalProperties: false,\n description: \"Top-level Connect application behaviour.\",\n properties: {\n logLevel: {\n type: \"string\",\n enum: [\"debug\", \"info\", \"warn\", \"error\"],\n description:\n \"Log level applied by Connect's logger at boot. Affects browser-side output only.\",\n default: \"info\",\n },\n basePath: {\n type: \"string\",\n description:\n \"Base path Connect is mounted under (e.g. '/connect' for subpath deploys). Normalised at runtime to start and end with '/'. Defaults to the build-time BASE_URL.\",\n default: \"/\",\n },\n offline: {\n type: \"boolean\",\n description:\n \"When true (default), the build emits a precaching service worker so Connect's app shell works offline, and the SPA registers it at boot. Set false to opt this deployment out: no service worker is built, the SPA skips registration, and any previously-installed worker is unregistered.\",\n default: true,\n },\n studioMode: {\n type: \"boolean\",\n description:\n \"Studio mode. Enables builder-only capabilities: Connect loads the vetra package and exposes DocumentModel (and vetra spec types) as creatable documents. Forced on by `ph vetra` / `ph connect studio`; false by default.\",\n default: false,\n },\n },\n },\n ai: {\n type: \"object\",\n additionalProperties: false,\n description: \"AI assistant (chat) behaviour.\",\n properties: {\n assistantEnabled: {\n type: \"boolean\",\n description:\n \"When true, Connect mounts the in-browser AI assistant (bottom-right chat FAB that talks to a user-configured OpenAI-compatible endpoint and acts on the reactor). Disabled by default.\",\n default: false,\n },\n },\n },\n packages: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).\",\n properties: {\n externalEnabled: {\n type: \"boolean\",\n description:\n \"When false, Connect refuses to load any package that wasn't bundled at build time. Affirmative replacement for the legacy PH_CONNECT_EXTERNAL_PACKAGES_DISABLED env var.\",\n default: true,\n },\n liveReload: {\n type: \"boolean\",\n description:\n \"When true, Connect subscribes to the static-mode `/__packages` SSE channel so live publishes flow into the running tab without a page reload. Only works under hosting that serves this channel (e.g. ph-clint static mode).\",\n default: false,\n },\n },\n },\n drives: {\n type: \"object\",\n additionalProperties: false,\n description: \"Default-drive and add-drive UI behaviour.\",\n properties: {\n allowAddDrive: {\n type: \"boolean\",\n description:\n \"When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.\",\n default: true,\n },\n defaultDrives: {\n type: \"array\",\n description:\n \"Drives the SPA auto-connects to on first load. Each entry is either a remote drive (a URL, with optional name/icon overrides) or a local drive (created locally on first boot, with a stable id and optional name/icon/app).\",\n default: [],\n items: {\n oneOf: [\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"url\"],\n properties: {\n url: { type: \"string\" },\n name: { type: [\"string\", \"null\"] },\n icon: { type: [\"string\", \"null\"] },\n },\n },\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"local\", \"id\"],\n properties: {\n local: {\n const: true,\n description:\n \"Discriminator: this entry is a local drive created on first boot.\",\n },\n id: {\n type: \"string\",\n description:\n \"Stable drive id. The drive is created with this id on first boot and is not re-created on later boots.\",\n },\n name: { type: [\"string\", \"null\"] },\n icon: { type: [\"string\", \"null\"] },\n app: {\n type: \"string\",\n description:\n \"Drive app (preferred editor) to open on the drive.\",\n },\n },\n },\n ],\n },\n },\n preserveStrategy: {\n type: \"string\",\n enum: [\"preserve-all\", \"preserve-by-url-and-detach\"],\n description:\n \"Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default — opt-in only.\",\n },\n sections: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.\",\n properties: {\n remote: driveSectionSchema,\n local: driveSectionSchema,\n },\n },\n },\n },\n renown: {\n type: \"object\",\n additionalProperties: false,\n description: \"Renown identity / authentication coordinates.\",\n properties: {\n url: {\n type: \"string\",\n description: \"Renown auth service URL.\",\n default: \"https://www.renown.id\",\n },\n networkId: {\n type: \"string\",\n description: \"CAIP-2 network namespace (e.g. 'eip155').\",\n default: \"eip155\",\n },\n chainId: {\n type: \"number\",\n description: \"CAIP-2 chain reference within the network namespace.\",\n default: 1,\n },\n namespace: {\n type: \"string\",\n description:\n \"Renown localStorage namespace; share it across Connects to share login.\",\n },\n switchboardUrl: {\n type: \"string\",\n description:\n \"Switchboard GraphQL URL. When set, Connect enables in-page (no-redirect) Renown sign-in; otherwise it falls back to the redirect flow via `url`.\",\n },\n adapters: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.\",\n properties: {\n rainbow: {\n type: \"object\",\n additionalProperties: false,\n description: \"wagmi + RainbowKit external-wallet adapter config.\",\n properties: {\n walletConnectProjectId: {\n type: \"string\",\n description:\n \"WalletConnect project id; required for this adapter to function.\",\n },\n infuraProjectId: {\n type: \"string\",\n description:\n \"Optional Infura project id used to build RPC transports.\",\n },\n },\n },\n privy: {\n type: \"object\",\n additionalProperties: false,\n description: \"Privy embedded/social adapter config.\",\n properties: {\n appId: {\n type: \"string\",\n description:\n \"Privy application id; required for this adapter to function.\",\n },\n clientId: {\n type: \"string\",\n description: \"Optional Privy client id.\",\n },\n methods: {\n type: \"array\",\n description:\n \"Login methods this adapter offers; default per adapter when omitted.\",\n items: { type: \"string\" },\n },\n },\n },\n },\n },\n },\n },\n sentry: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Sentry error-tracking coordinates. Set `dsn` to enable Sentry; leave `dsn` null to disable. The Sentry release tag stays build-time (stamped via Vite's `define` from WORKSPACE_VERSION) so it always matches the sourcemaps uploaded by CI.\",\n properties: {\n dsn: {\n type: [\"string\", \"null\"],\n description:\n \"Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.\",\n default: null,\n },\n env: {\n type: \"string\",\n description:\n \"Sentry environment label, surfaced as the `environment` tag on every event.\",\n default: \"dev\",\n },\n tracing: {\n type: \"boolean\",\n description: \"Enable Sentry performance tracing.\",\n default: false,\n },\n },\n },\n instance: {\n type: \"object\",\n additionalProperties: false,\n required: [\"namespace\", \"reactorWorker\"],\n description:\n \"Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.\",\n properties: {\n namespace: {\n type: [\"string\", \"null\"],\n description:\n \"Explicit storage/SharedWorker namespace for this instance. `null` derives it from the base path (and, later, the configured endpoint), so root deployments stay byte-identical.\",\n default: null,\n },\n reactorWorker: {\n type: \"boolean\",\n description:\n \"Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified.\",\n default: false,\n },\n },\n },\n reactor: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.\",\n properties: {\n featureFlags: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Enforcement flags. Each implies its predecessors, and the reactor refuses to boot on a set that names a later flag without an earlier one. These are consensus settings: a Connect syncing with a fleet must carry the same flags the fleet does, or the two reach different replay outcomes for the same history and diverge.\",\n properties: {\n documentDecisions: {\n type: \"boolean\",\n description:\n \"Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.\",\n default: false,\n },\n authEnforcement: {\n type: \"boolean\",\n description:\n \"Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.\",\n default: false,\n },\n authGroups: {\n type: \"boolean\",\n description:\n \"Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.\",\n default: false,\n },\n authConditions: {\n type: \"boolean\",\n description:\n \"Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.\",\n default: false,\n },\n },\n },\n },\n },\n pwa: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here — it is derived from the manifest's category field.) Only applied when connect.app.offline is true.\",\n properties: {\n manifest: {\n type: \"object\",\n additionalProperties: false,\n description: \"Web-app-manifest field overrides.\",\n properties: {\n name: { type: \"string\" },\n short_name: { type: \"string\" },\n description: { type: \"string\" },\n theme_color: { type: \"string\" },\n background_color: { type: \"string\" },\n display: {\n type: \"string\",\n enum: [\"fullscreen\", \"standalone\", \"minimal-ui\", \"browser\"],\n },\n start_url: { type: \"string\" },\n scope: { type: \"string\" },\n icons: {\n type: \"array\",\n description:\n \"Icons appended to the built-in set and de-duplicated by (src, sizes, purpose).\",\n items: pwaIconSchema,\n },\n file_handlers: {\n type: \"array\",\n description:\n \"File associations appended after Connect's built-in .phd/.phdm handler and de-duplicated on the whole entry. Entries only declare accepted types; there is no action field, because opening the files requires Connect's own runtime handling, so every handler opens at the app root.\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"accept\"],\n properties: {\n accept: {\n type: \"object\",\n description:\n \"MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it.\",\n additionalProperties: {\n type: \"array\",\n items: { type: \"string\", pattern: \"^\\\\.\" },\n },\n },\n icons: {\n type: \"array\",\n description: \"OS-level file-type icons.\",\n items: pwaIconSchema,\n },\n launch_type: {\n type: \"string\",\n enum: [\"single-client\", \"multiple-clients\"],\n },\n },\n },\n },\n launch_handler: {\n type: \"object\",\n additionalProperties: false,\n required: [\"client_mode\"],\n description:\n \"How the OS launches the app for handled files/links. Connect defaults to focus-existing.\",\n properties: {\n client_mode: {\n type: \"string\",\n enum: [\n \"auto\",\n \"focus-existing\",\n \"navigate-existing\",\n \"navigate-new\",\n ],\n },\n },\n },\n },\n },\n globPatterns: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Extra Workbox precache globs, unioned with the built-ins.\",\n },\n globIgnores: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Extra precache ignore globs, unioned with the built-ins.\",\n },\n maximumFileSizeToCacheInBytes: {\n type: \"number\",\n description:\n \"Raise the precache file-size ceiling. The max across all contributors wins, so no contributor can shrink another's limit.\",\n },\n runtimeCaching: {\n type: \"array\",\n description:\n \"Runtime-caching rules appended after the built-in rules. Workbox is first-match-wins, so these cannot override a built-in rule matching the same URL.\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"urlPattern\", \"handler\"],\n properties: {\n urlPattern: pwaUrlPatternSchema,\n handler: {\n type: \"string\",\n enum: [\n \"CacheFirst\",\n \"CacheOnly\",\n \"NetworkFirst\",\n \"NetworkOnly\",\n \"StaleWhileRevalidate\",\n ],\n },\n method: {\n type: \"string\",\n enum: [\"GET\", \"POST\", \"PUT\", \"DELETE\", \"HEAD\", \"PATCH\"],\n },\n options: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n cacheName: { type: \"string\" },\n networkTimeoutSeconds: {\n type: \"number\",\n description:\n \"Seconds a NetworkFirst rule waits for the network before falling back to the cache.\",\n },\n expiration: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n maxEntries: { type: \"number\" },\n maxAgeSeconds: { type: \"number\" },\n },\n },\n cacheableResponse: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n statuses: { type: \"array\", items: { type: \"number\" } },\n headers: {\n type: \"object\",\n additionalProperties: { type: \"string\" },\n },\n },\n },\n },\n },\n },\n },\n },\n navigateFallbackDenylist: {\n type: \"array\",\n description:\n \"Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.\",\n items: pwaUrlPatternSchema,\n },\n },\n },\n },\n} as const;\n"],"mappings":";;;;;;;;AAMA,MAAM,gBAAgB,EACnB,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,QAAQ,QAAQ,CAAC,CAAC,CAAC,CAC/C,WAAW,QAAQ;AAClB,KAAI,OAAO,QAAQ,UAAW,QAAO;AACrC,QAAO,QAAQ;EACf;;;;AASJ,MAAM,iBAAiB,EAAE,OAAO;CAK9B,aAAa,EAAE,QAAQ,CAAC,UAAU;CAKlC,kBAAkB,EAAE,QAAQ,CAAC,UAAU;CAKvC,sBAAsB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AAC,MAAM;CACjB,YAAY;EACV,KAAK,EAAE,MAAM,UAAU;EACvB,OAAO,EAAE,MAAM,UAAU;EACzB,MAAM,EAAE,MAAM,UAAU;EACxB,SAAS,EAAE,MAAM,UAAU;EAC5B;CACF;AAED,MAAa,+BAA+B;CAC1C,MAAM;CACN,sBAAsB;CACtB,aACE;CACF,YAAY;EACV,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,SAAS;KACP,MAAM;KACN,aACE;KACH;IACD,gBAAgB;KACd,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACH;IACF;GACF;EACD,KAAK;GACH,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,UAAU;KACR,MAAM;KACN,MAAM;MAAC;MAAS;MAAQ;MAAQ;MAAQ;KACxC,aACE;KACF,SAAS;KACV;IACD,UAAU;KACR,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,YAAY;KACV,MAAM;KACN,aACE;KACF,SAAS;KACV;IACF;GACF;EACD,IAAI;GACF,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY,EACV,kBAAkB;IAChB,MAAM;IACN,aACE;IACF,SAAS;IACV,EACF;GACF;EACD,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,iBAAiB;KACf,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,YAAY;KACV,MAAM;KACN,aACE;KACF,SAAS;KACV;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS,EAAE;KACX,OAAO,EACL,OAAO,CACL;MACE,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,MAAM;MACjB,YAAY;OACV,KAAK,EAAE,MAAM,UAAU;OACvB,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OAClC,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OACnC;MACF,EACD;MACE,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,SAAS,KAAK;MACzB,YAAY;OACV,OAAO;QACL,OAAO;QACP,aACE;QACH;OACD,IAAI;QACF,MAAM;QACN,aACE;QACH;OACD,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OAClC,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OAClC,KAAK;QACH,MAAM;QACN,aACE;QACH;OACF;MACF,CACF,EACF;KACF;IACD,kBAAkB;KAChB,MAAM;KACN,MAAM,CAAC,gBAAgB,6BAA6B;KACpD,aACE;KACH;IACD,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,QAAQ;MACR,OAAO;MACR;KACF;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,KAAK;KACH,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,WAAW;KACT,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,WAAW;KACT,MAAM;KACN,aACE;KACH;IACD,gBAAgB;KACd,MAAM;KACN,aACE;KACH;IACD,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,SAAS;OACP,MAAM;OACN,sBAAsB;OACtB,aAAa;OACb,YAAY;QACV,wBAAwB;SACtB,MAAM;SACN,aACE;SACH;QACD,iBAAiB;SACf,MAAM;SACN,aACE;SACH;QACF;OACF;MACD,OAAO;OACL,MAAM;OACN,sBAAsB;OACtB,aAAa;OACb,YAAY;QACV,OAAO;SACL,MAAM;SACN,aACE;SACH;QACD,UAAU;SACR,MAAM;SACN,aAAa;SACd;QACD,SAAS;SACP,MAAM;SACN,aACE;SACF,OAAO,EAAE,MAAM,UAAU;SAC1B;QACF;OACF;MACF;KACF;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,KAAK;KACH,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACF,SAAS;KACV;IACD,KAAK;KACH,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACF;GACF;EACD,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,UAAU,CAAC,aAAa,gBAAgB;GACxC,aACE;GACF,YAAY;IACV,WAAW;KACT,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACF,SAAS;KACV;IACD,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;KACV;IACF;GACF;EACD,SAAS;GACP,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY,EACV,cAAc;IACZ,MAAM;IACN,sBAAsB;IACtB,aACE;IACF,YAAY;KACV,mBAAmB;MACjB,MAAM;MACN,aACE;MACF,SAAS;MACV;KACD,iBAAiB;MACf,MAAM;MACN,aACE;MACF,SAAS;MACV;KACD,YAAY;MACV,MAAM;MACN,aACE;MACF,SAAS;MACV;KACD,gBAAgB;MACd,MAAM;MACN,aACE;MACF,SAAS;MACV;KACF;IACF,EACF;GACF;EACD,KAAK;GACH,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aAAa;KACb,YAAY;MACV,MAAM,EAAE,MAAM,UAAU;MACxB,YAAY,EAAE,MAAM,UAAU;MAC9B,aAAa,EAAE,MAAM,UAAU;MAC/B,aAAa,EAAE,MAAM,UAAU;MAC/B,kBAAkB,EAAE,MAAM,UAAU;MACpC,SAAS;OACP,MAAM;OACN,MAAM;QAAC;QAAc;QAAc;QAAc;QAAU;OAC5D;MACD,WAAW,EAAE,MAAM,UAAU;MAC7B,OAAO,EAAE,MAAM,UAAU;MACzB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;SACD,mBAAmB;UACjB,MAAM;UACN,sBAAsB;UACtB,YAAY;WACV,UAAU;YAAE,MAAM;YAAS,OAAO,EAAE,MAAM,UAAU;YAAE;WACtD,SAAS;YACP,MAAM;YACN,sBAAsB,EAAE,MAAM,UAAU;YACzC;WACF;UACF;SACF;QACF;OACF;MACF;KACF;IACD,0BAA0B;KACxB,MAAM;KACN,aACE;KACF,OAAO;KACR;IACF;GACF;EACF;CACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../connect/dynamic-base.ts","../../connect/env-config.ts","../../connect/pwa-config.ts","../../connect/pwa-manifest.ts","../../connect/schema-fragments.ts","../../connect/shared-deps.ts"],"sourcesContent":["/**\n * The base a dynamic-base Connect build is compiled against. The build emits\n * this literal wherever a base-relative URL would go, and the serving layer\n * (the dynamic-base vite plugin at build time, the connect proxy at serve\n * time) rewrites it to the base the app is actually deployed under.\n *\n * It lives here, in the browser-safe shared package, rather than in\n * `@powerhousedao/builder-tools`, because both the node-only build toolchain\n * and Connect's own browser code need it. Importing builder-tools from app\n * code pulls the whole build toolchain (and its node-only `read-pkg`\n * dependency) into the browser graph.\n */\nexport const DYNAMIC_BASE_PLACEHOLDER = \"/__PH_DYNAMIC_BASE__/\";\n","import { z } from \"zod\";\n\n/**\n * Coerces string values to boolean.\n * Accepts: \"true\", \"false\", true, false\n */\nconst booleanString = z\n .union([z.boolean(), z.enum([\"true\", \"false\"])])\n .transform((val) => {\n if (typeof val === \"boolean\") return val;\n return val === \"true\";\n });\n\n// ============================================================================\n// Build-time Environment Variables\n// ============================================================================\n\n/**\n * Build-time configuration schema\n */\nconst buildEnvSchema = z.object({\n /**\n * Comma-separated list of package names to load\n * @example \"package1,package2\"\n */\n PH_PACKAGES: z.string().optional(),\n\n /**\n * Path to local package to load during development\n */\n PH_LOCAL_PACKAGE: z.string().optional(),\n\n /**\n * Sentry authentication token for uploading source maps\n */\n PH_SENTRY_AUTH_TOKEN: z.string().optional(),\n\n /**\n * Sentry organization slug\n */\n PH_SENTRY_ORG: z.string().optional(),\n\n /**\n * Sentry project slug\n */\n PH_SENTRY_PROJECT: z.string().optional(),\n});\n\n// ============================================================================\n// Application Configuration (build metadata only)\n// ============================================================================\n\n/**\n * Connect runtime values (anything in `PHConnectRuntimeConfig`) are NOT\n * settable from env vars. They live in `powerhouse.config.json` and are\n * overridden via `ph connect build --<field>` or `ph connect config\n * --<field>`.\n *\n * What stays env-driven below is non-runtime: build metadata, Sentry\n * credentials, analytics processor toggles, etc.\n */\nconst appConfigSchema = z.object({\n /**\n * Application version number (build metadata stamp)\n * @default \"unknown\"\n */\n PH_CONNECT_VERSION: z.string().default(\"unknown\"),\n\n /**\n * CLI version number (build metadata stamp)\n */\n PH_CONNECT_CLI_VERSION: z.string().optional(),\n});\n\n// ============================================================================\n// Analytics Processor Configuration\n// ============================================================================\n\n/**\n * Analytics processor configuration schema. These are non-runtime feature\n * toggles for the analytics subsystem — they don't live in the runtime\n * schema and stay env-driven.\n */\nconst processorsConfigSchema = z.object({\n /**\n * Enable diff analytics tracking\n * @default false\n */\n PH_CONNECT_DIFF_ANALYTICS_ENABLED: booleanString.default(false),\n\n /**\n * Enable drive analytics tracking\n * @default true\n */\n PH_CONNECT_DRIVE_ANALYTICS_ENABLED: booleanString.default(true),\n\n /**\n * Enable external analytics processors\n * @default true\n */\n PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED: booleanString.default(true),\n});\n\n// ============================================================================\n// OpenPanel Configuration\n// ============================================================================\n\n/**\n * OpenPanel analytics configuration schema\n */\nconst openPanelConfigSchema = z.object({\n /**\n * OpenPanel client ID. When unset, the OpenPanel subsystem is a no-op.\n */\n PH_CONNECT_OPENPANEL_CLIENT_ID: z.string().optional(),\n\n /**\n * OpenPanel API URL override. Defaults to the OpenPanel cloud when unset.\n */\n PH_CONNECT_OPENPANEL_API_URL: z.string().optional(),\n\n /**\n * Track UI events via the useOpenPanel() hook\n * @default true\n */\n PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS: booleanString.default(true),\n\n /**\n * Track document operations via the OpenPanel processor\n * @default true\n */\n PH_CONNECT_OPENPANEL_TRACK_OPERATIONS: booleanString.default(true),\n});\n\n// ============================================================================\n// Combined Schemas\n// ============================================================================\n\n/**\n * Complete runtime environment schema (all PH_CONNECT_* vars). Only\n * build-metadata + analytics-processor toggles live here; all Connect\n * runtime config lives in `powerhouse.config.json`.\n */\nexport const runtimeEnvSchema = appConfigSchema\n .extend(processorsConfigSchema.shape)\n .extend(openPanelConfigSchema.shape);\n\n/**\n * Complete environment schema (build + runtime)\n */\nexport const connectEnvSchema = buildEnvSchema.extend(runtimeEnvSchema.shape);\n\n/**\n * Inferred TypeScript types from schemas\n */\nexport type ConnectBuildEnv = z.infer<typeof buildEnvSchema>;\nexport type ConnectRuntimeEnv = z.infer<typeof runtimeEnvSchema>;\nexport type ConnectEnv = z.infer<typeof connectEnvSchema>;\n\n// ============================================================================\n// Environment Loading Functions\n// ============================================================================\n\n/**\n * Options for loading environment variables\n */\nexport interface LoadEnvOptions {\n /**\n * Environment variables from process.env (highest priority)\n */\n processEnv?: Record<string, string | undefined>;\n /**\n * Environment variables from .env file (lowest priority)\n */\n fileEnv?: Record<string, string | undefined>;\n}\n\n/**\n * Internal helper to merge environment sources with priority.\n * Validates each value and falls back to next priority if invalid.\n */\nfunction mergeEnvSources(\n options: LoadEnvOptions,\n keys: Set<string>,\n schema: z.ZodObject<Record<string, z.ZodTypeAny>>,\n): Record<string, unknown> {\n const { processEnv = {}, fileEnv = {} } = options;\n const merged: Record<string, unknown> = {};\n\n // Apply priority: fileEnv < processEnv\n for (const key of keys) {\n const sources = [\n { name: \"process.env\", value: processEnv[key] },\n { name: \"fileEnv\", value: fileEnv[key] },\n ];\n\n // Try each source in priority order\n for (const source of sources) {\n const value = source.value;\n if (value === undefined || value === \"\") continue;\n\n // Try to validate just this field\n try {\n const fieldSchema = schema.shape[key];\n if (fieldSchema) {\n fieldSchema.parse(value);\n merged[key] = value;\n break; // Successfully validated, use this value\n }\n // No schema for this key, accept it\n console.warn(`Unknown environment variable: '${key}'`);\n merged[key] = value;\n break;\n } catch {\n // Validation failed, log warning and try next source\n const valueStr =\n value === null\n ? \"null\"\n : typeof value === \"object\"\n ? JSON.stringify(value)\n : (value as string);\n console.warn(\n `Invalid value for ${key} from ${source.name}: ${valueStr}. Trying next source.`,\n );\n }\n }\n }\n\n return merged;\n}\n\n/**\n * Loads and validates environment variables with priority:\n * 1. process.env (highest)\n * 2. fileEnv\n * 3. defaults from schema (lowest)\n *\n * @param options - Environment sources in priority order\n * @returns Validated and typed environment configuration\n */\nexport function loadConnectEnv(options: LoadEnvOptions = {}): ConnectEnv {\n const allKeys = new Set([\n ...Object.keys(buildEnvSchema.shape),\n ...Object.keys(runtimeEnvSchema.shape),\n ]);\n\n const merged = mergeEnvSources(options, allKeys, connectEnvSchema);\n return connectEnvSchema.parse(merged);\n}\n\n/**\n * Loads only runtime environment variables (build metadata + Sentry +\n * analytics-processor toggles — everything in the Connect runtime schema\n * is sourced from powerhouse.config.json, not env).\n *\n * @param options - Environment sources in priority order\n * @returns Validated runtime environment configuration\n */\nexport function loadRuntimeEnv(\n options: LoadEnvOptions = {},\n): ConnectRuntimeEnv {\n const allKeys = new Set(Object.keys(runtimeEnvSchema.shape));\n const merged = mergeEnvSources(options, allKeys, runtimeEnvSchema);\n return runtimeEnvSchema.parse(merged);\n}\n\n/**\n * Safely sets Connect environment variables with validation.\n * Invalid values will log a warning and be skipped.\n *\n * @param values - Type-safe object with key-value pairs to set\n *\n * @example\n * ```ts\n * setConnectEnv({\n * PH_CONNECT_VERSION: \"1.2.3\",\n * PH_CONNECT_SENTRY_DSN: \"https://…\",\n * });\n * ```\n */\nexport function setConnectEnv(values: Partial<ConnectEnv>): void {\n for (const [key, value] of Object.entries(values)) {\n // Check if key exists in schema\n const fieldSchema =\n connectEnvSchema.shape[key as keyof typeof connectEnvSchema.shape];\n\n if (!fieldSchema) {\n console.warn(\n `Unknown environment variable: ${key}. Variable not set. Valid keys: ${Object.keys(connectEnvSchema.shape).join(\", \")}`,\n );\n continue;\n }\n\n try {\n // Validate the value\n fieldSchema.parse(value);\n\n // Set the value (convert to string for process.env compatibility)\n process.env[key] = String(value);\n } catch (error) {\n console.warn(\n `Invalid value for ${key}: ${String(value)}. Validation failed.`,\n error,\n );\n }\n }\n}\n\n/**\n * Normalizes a base path to ensure it:\n * - Starts with a forward slash (/)\n * - Ends with a forward slash (/)\n * - Has no relative path prefix (.)\n *\n * @param basePath - The base path to normalize\n * @returns The normalized base path\n *\n * @example\n * normalizeBasePath('/app') // '/app/'\n * normalizeBasePath('./app/') // '/app/'\n * normalizeBasePath('app') // '/app/'\n * normalizeBasePath('/') // '/'\n * normalizeBasePath('') // '/'\n */\nexport function normalizeBasePath(basePath: string): string {\n if (!basePath) {\n return \"/\";\n }\n\n let normalized = basePath;\n\n // Remove relative path prefix\n if (normalized.startsWith(\".\")) {\n normalized = normalized.slice(1);\n }\n\n // Ensure it starts with a forward slash\n if (!normalized.startsWith(\"/\")) {\n normalized = `/${normalized}`;\n }\n\n // Ensure it ends with a forward slash\n if (!normalized.endsWith(\"/\")) {\n normalized = `${normalized}/`;\n }\n\n return normalized;\n}\n\n/**\n * Base storage namespace for a Connect instance served at the root of an\n * origin. Kept as a literal so root deployments resolve to a byte-identical\n * value with no migration.\n */\nexport const ROOT_STORAGE_NAMESPACE = \"reactor\";\n\n/**\n * Derives the origin-scoped storage namespace from a Connect base path.\n *\n * Connect instances served under different path prefixes of the same origin\n * (e.g. behind a reverse proxy) otherwise share all origin-scoped browser\n * storage (PGlite data dirs, IndexedDB). This produces a deterministic,\n * collision-free namespace per distinct prefix that is valid as an\n * IndexedDB database name.\n *\n * - root base path (\"/\" or unset) -> \"reactor\" (byte-identical to the legacy\n * key, so existing root deployments keep their data with zero migration)\n * - any non-root base path -> \"reactor--<slug>\", e.g.\n * \"/reactor-project/vetra-studio/\" -> \"reactor--reactor-project-vetra-studio\"\n *\n * @param basePath - The Connect base path (env.PH_CONNECT_BASE_PATH ||\n * import.meta.env.BASE_URL); normalized internally.\n * @returns The storage namespace.\n *\n * @example\n * getStorageNamespace('/') // 'reactor'\n * getStorageNamespace('/reactor-project/vetra-studio/') // 'reactor--reactor-project-vetra-studio'\n */\nexport function getStorageNamespace(basePath: string): string {\n const normalized = normalizeBasePath(basePath);\n if (normalized === \"/\") {\n return ROOT_STORAGE_NAMESPACE;\n }\n const slug = normalized\n .slice(1, -1)\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n // A non-root base path whose slug normalizes to nothing (e.g. \"/-/\") must\n // not collapse into the root namespace and share its storage.\n return `${ROOT_STORAGE_NAMESPACE}--${slug || \"default\"}`;\n}\n","// Merging of Connect PWA override fragments.\n//\n// PWA config comes from several layers — Connect's hardcoded defaults, each\n// build-time-known package's `pwa` fragment, and the project's `connect.pwa`\n// block. A naive deep-merge is wrong here: runtime-caching rules and precache\n// globs are ADDITIVE (a later layer must not drop an earlier layer's offline\n// coverage), and the precache size ceiling must be the MAX so no contributor\n// can silently shrink another's limit. This module encodes those per-field\n// strategies: `mergePwaConfig(contributions)` folds an ordered list of\n// serialisable `PHConnectPwa` fragments (lowest precedence first) into one\n// effective fragment, warning when multiple packages set the same manifest\n// scalar to different values.\n//\n// Laying the effective fragment over Connect's hardcoded VitePWA base happens\n// in builder-tools (`connect-utils/vite-plugins/pwa-overrides.ts`), where\n// vite-plugin-pwa's manifest types are available.\n\nimport type {\n PHConnectPwa,\n PHConnectPwaManifest,\n PHConnectPwaUrlPattern,\n} from \"../clis/types.js\";\nimport { deepMerge } from \"./config-loader.js\";\n\n// Re-exported so the PWA override types are reachable from the same\n// `@powerhousedao/shared/connect` entry as the merge helpers that consume them.\nexport type {\n PHConnectPwa,\n PHConnectPwaCacheStrategy,\n PHConnectPwaFileHandler,\n PHConnectPwaIcon,\n PHConnectPwaManifest,\n PHConnectPwaRuntimeCaching,\n PHConnectPwaUrlPattern,\n} from \"../clis/types.js\";\n\n/** A labelled PWA fragment, so merge diagnostics can name the contributor. */\nexport type PwaContribution = {\n /** Human-readable origin (package name, or the project config file). */\n source: string;\n config: PHConnectPwa;\n};\n\n// Manifest scalar fields — the ones where \"two layers set it\" is a genuine\n// conflict (as opposed to the additive arrays, which never conflict).\nconst MANIFEST_SCALAR_KEYS: readonly (keyof PHConnectPwaManifest)[] = [\n \"name\",\n \"short_name\",\n \"description\",\n \"theme_color\",\n \"background_color\",\n \"display\",\n \"start_url\",\n \"scope\",\n \"launch_handler\",\n];\n\n// Manifest fields merged additively (concatenated/unioned across every layer),\n// never as scalar conflicts. Kept out of the deepMerge path, which replaces\n// arrays wholesale and would drop earlier contributions. `categories` is\n// derived (from the manifest `category` field) but merges the same additive way.\nconst ADDITIVE_MANIFEST_KEYS = new Set<keyof PHConnectPwaManifest>([\n \"icons\",\n \"file_handlers\",\n \"categories\",\n]);\n\n// Structural icon shape shared by PHConnectPwaIcon and vite-plugin-pwa's\n// IconResource (whose `purpose` may also be an array of purposes).\ntype IconLike = {\n src: string;\n sizes?: string;\n purpose?: string | readonly string[];\n};\n\nfunction iconKey(icon: IconLike): string {\n const purpose =\n typeof icon.purpose === \"string\"\n ? icon.purpose\n : (icon.purpose?.join(\",\") ?? \"\");\n return `${icon.src}|${icon.sizes ?? \"\"}|${purpose}`;\n}\n\n/** Concatenate, keeping the first occurrence per `key`. */\nfunction dedupeBy<T>(items: T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n const result: T[] = [];\n for (const item of items) {\n const k = key(item);\n if (seen.has(k)) continue;\n seen.add(k);\n result.push(item);\n }\n return result;\n}\n\n/** Concatenate icons, keeping the first occurrence of each (src,sizes,purpose). */\nexport function dedupeIcons<T extends IconLike>(icons: T[]): T[] {\n return dedupeBy(icons, iconKey);\n}\n\n/** `JSON.stringify` with object keys sorted recursively, so two structurally\n * equal values always serialise identically (accept-map key order etc.). */\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(\",\")}]`;\n }\n if (value !== null && typeof value === \"object\") {\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`);\n return `{${entries.join(\",\")}}`;\n }\n return JSON.stringify(value);\n}\n\n/**\n * Concatenate file handlers, keeping the first occurrence of each entry.\n * Deduped on the WHOLE entry (canonical JSON) rather than any single field:\n * every handler shares Connect's fixed action, and two handlers accepting\n * different file types are both real contributions — only the exact same\n * fragment arriving via two layers is a duplicate. Structural, so it also\n * works on the vite-plugin-pwa handler shape in builder-tools.\n */\nexport function dedupeFileHandlers<T extends object>(handlers: T[]): T[] {\n return dedupeBy(handlers, stableStringify);\n}\n\n/** Fold a manifest's top-level `category` string into a PWA config as a\n * `categories: [category]` entry. PWA `categories` is DERIVED from the\n * `category` field of every contributing `powerhouse.manifest.json` (never\n * authored under `pwa`); `mergePwaConfig`/`mergeManifest` then union them\n * across contributors. No-op when there is no usable category. */\nexport function withInferredCategory(\n config: PHConnectPwa,\n category: unknown,\n): PHConnectPwa {\n if (typeof category !== \"string\" || !category) return config;\n return {\n ...config,\n manifest: { ...config.manifest, categories: [category] },\n };\n}\n\n/** Order-preserving string union (used for the precache glob lists). */\nexport function unionStrings(\n base: string[] | undefined,\n extra: string[],\n): string[] {\n const result = [...(base ?? [])];\n for (const item of extra) if (!result.includes(item)) result.push(item);\n return result;\n}\n\nfunction patternKey(pattern: PHConnectPwaUrlPattern): string {\n return typeof pattern === \"string\"\n ? `s:${pattern}`\n : `r:${pattern.source}:${pattern.flags ?? \"\"}`;\n}\n\nfunction unionPatterns(\n base: PHConnectPwaUrlPattern[] | undefined,\n extra: PHConnectPwaUrlPattern[],\n): PHConnectPwaUrlPattern[] {\n const result = [...(base ?? [])];\n const seen = new Set(result.map(patternKey));\n for (const pattern of extra) {\n const key = patternKey(pattern);\n if (seen.has(key)) continue;\n seen.add(key);\n result.push(pattern);\n }\n return result;\n}\n\n/** Merge one fragment into `target` in place, applying the per-field\n * strategies (manifest scalars deep-merge and win; icons/file_handlers/globs/\n * rules/denylist are additive; size ceiling takes the max). */\nfunction mergeInto(target: PHConnectPwa, config: PHConnectPwa): void {\n if (config.manifest) {\n // The additive arrays are pulled out of the deepMerge path: deepMerge\n // replaces arrays wholesale, which would drop earlier contributions.\n const { icons, file_handlers, categories, ...scalars } = config.manifest;\n if (Object.keys(scalars).length > 0) {\n target.manifest = deepMerge(\n target.manifest ?? {},\n scalars as PHConnectPwaManifest,\n );\n }\n if (icons?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n icons: dedupeIcons([...(target.manifest?.icons ?? []), ...icons]),\n };\n }\n if (file_handlers?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n file_handlers: dedupeFileHandlers([\n ...(target.manifest?.file_handlers ?? []),\n ...file_handlers,\n ]),\n };\n }\n if (categories?.length) {\n target.manifest = {\n ...(target.manifest ?? {}),\n categories: unionStrings(target.manifest?.categories, categories),\n };\n }\n }\n if (config.globPatterns?.length) {\n target.globPatterns = unionStrings(\n target.globPatterns,\n config.globPatterns,\n );\n }\n if (config.globIgnores?.length) {\n target.globIgnores = unionStrings(target.globIgnores, config.globIgnores);\n }\n if (config.runtimeCaching?.length) {\n target.runtimeCaching = [\n ...(target.runtimeCaching ?? []),\n ...config.runtimeCaching,\n ];\n }\n if (config.navigateFallbackDenylist?.length) {\n target.navigateFallbackDenylist = unionPatterns(\n target.navigateFallbackDenylist,\n config.navigateFallbackDenylist,\n );\n }\n if (typeof config.maximumFileSizeToCacheInBytes === \"number\") {\n target.maximumFileSizeToCacheInBytes = Math.max(\n target.maximumFileSizeToCacheInBytes ?? 0,\n config.maximumFileSizeToCacheInBytes,\n );\n }\n}\n\n/**\n * Fold the build-time-known package PWA fragments and the project's\n * `connect.pwa` block into one effective fragment. Precedence is\n * `packageContributions (in order) < projectConfig` — the project config wins\n * scalar fields, while arrays (`icons`, globs, `runtimeCaching`,\n * `navigateFallbackDenylist`) are additive across every layer and the size\n * ceiling takes the max.\n *\n * `onWarn` fires when two or more PACKAGES set the same manifest scalar to\n * different values and the project config doesn't settle it — the winner is\n * otherwise decided silently by package load order. The operator resolves it\n * by setting that field in `connect.pwa`, which both wins and silences the\n * warning.\n */\nexport function mergePwaConfig(\n packageContributions: PwaContribution[],\n projectConfig?: PHConnectPwa,\n onWarn: (message: string) => void = () => {},\n): PHConnectPwa {\n const merged: PHConnectPwa = {};\n // Which packages set each manifest scalar, and to what (for the conflict\n // warning). The project config is deliberately excluded — it is the\n // authority, not a conflicting sibling.\n const packageScalarSetters: Partial<\n Record<string, { source: string; value: unknown }[]>\n > = {};\n\n for (const { source, config } of packageContributions) {\n mergeInto(merged, config);\n for (const [key, value] of Object.entries(config.manifest ?? {})) {\n if (ADDITIVE_MANIFEST_KEYS.has(key as keyof PHConnectPwaManifest)) {\n continue;\n }\n (packageScalarSetters[key] ??= []).push({ source, value });\n }\n }\n if (projectConfig) mergeInto(merged, projectConfig);\n\n const projectManifest = projectConfig?.manifest ?? {};\n for (const key of MANIFEST_SCALAR_KEYS) {\n const setters = packageScalarSetters[key];\n const projectSettles = projectManifest[key] !== undefined;\n if (!setters || setters.length < 2 || projectSettles) continue;\n // Same value from every package is agreement, not a conflict. Compared\n // via stableStringify, not by identity — launch_handler is object-valued,\n // and two packages sending equal objects (in any key order) must not read\n // as a conflict.\n const distinctValues = new Set(\n setters.map((s) => stableStringify(s.value)),\n );\n if (distinctValues.size < 2) continue;\n const sources = setters.map((s) => s.source);\n onWarn(\n `PWA config: manifest.${key} set by multiple packages (${sources.join(\n \", \",\n )}); '${sources[sources.length - 1]}' wins by load order. Set connect.pwa.manifest.${key} in the project config to make the winner explicit.`,\n );\n }\n\n return merged;\n}\n\n/** A serialisable URL pattern as Workbox consumes it: strings pass through\n * verbatim, `{ source, flags }` is rebuilt into a RegExp. */\nexport function toRegExpOrString(\n pattern: PHConnectPwaUrlPattern,\n): string | RegExp {\n return typeof pattern === \"string\"\n ? pattern\n : new RegExp(pattern.source, pattern.flags);\n}\n","// Building the effective web-app manifest from a base manifest plus a\n// `PHConnectPwaManifest` fragment. Pure JSON in / JSON out — no PWA-toolchain\n// or DOM dependency — so the SAME code path runs at build time (laying the\n// effective build-merged fragment over Connect's hardcoded base, see\n// applyPwaOverrides) and at runtime inside the service worker (laying a\n// dynamically-installed package's fragment over the build-embedded base to\n// serve the live manifest).\n//\n// Connect owns the \"where\" of every OS integration: file handlers open at the\n// app root, `web+…` protocol links and shared files route through fixed\n// in-scope endpoints. Contributors declare only WHAT they accept; the routes\n// below are injected here so a package can never point the OS at an arbitrary\n// URL. Injection is idempotent, so re-merging a manifest that already carries\n// the routes is a no-op.\n\nimport type {\n PHConnectPwaFileHandler,\n PHConnectPwaIcon,\n PHConnectPwaManifest,\n} from \"../clis/types.js\";\nimport { dedupeFileHandlers, dedupeIcons, unionStrings } from \"./pwa-config.js\";\n\n/**\n * The one route launched files open at, shared by the built-in handler and\n * injected into every contributed one. Not configurable: consuming launched\n * files takes runtime code that lives in Connect itself, and a relative \".\"\n * resolves against the manifest URL so it tracks any deploy base (the\n * webmanifest is served dynamically and never rewritten by the dynamic-base\n * plugin) — same trick as the base start_url/scope.\n */\nexport const PWA_FILE_HANDLER_ACTION = \".\";\n\n// IndexedDB schema for the page->service-worker PWA-fragment mirror. A SW can't\n// read localStorage (where the installed-package list lives), so the SPA\n// mirrors the merged fragment here and the SW reads it to serve a live\n// manifest. Both sides MUST agree, so the schema lives here as the single\n// source of truth (the SPA writer and the SW reader both import these) —\n// a rename or version bump can no longer desync one side silently.\nexport const PWA_IDB_NAME = \"ph-pwa\";\nexport const PWA_IDB_STORE = \"fragments\";\nexport const PWA_IDB_KEY = \"merged\";\nexport const PWA_IDB_VERSION = 1;\n\n/** The subset of a web-app manifest this module reads/writes, plus an index\n * signature so untouched fields (name, theme_color, launch_handler, …) pass\n * through verbatim. */\nexport interface PwaWebManifest {\n icons?: PHConnectPwaIcon[];\n file_handlers?: (PHConnectPwaFileHandler & { action?: string })[];\n categories?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Lay a `PHConnectPwaManifest` fragment over a base web-manifest object.\n *\n * - **scalars** (name, theme_color, launch_handler, …): governed by\n * `scalarPolicy`. `\"fragment-wins\"` lets the fragment overwrite the base;\n * `\"base-wins\"` keeps the base and only fills fields it left unset. Keys\n * listed in `protectedScalars` always behave as base-wins even under a\n * fragment-wins policy — used at runtime to fragment-win cosmetic scalars\n * while still protecting navigation-critical ones (`start_url`/`scope`) from\n * an untrusted dynamically-installed package.\n * - **arrays** (icons, file_handlers): always additive, base entries first,\n * de-duplicated — so a package can extend but never displace a built-in\n * (Chromium is first-registered-wins per file extension, so `.phd`/`.phdm`\n * stay Connect's).\n * - **categories**: order-preserving string union (derived from the manifest\n * `category` field, not authored under `pwa`).\n *\n * The Connect-owned file-handler action is injected idempotently.\n */\nexport function mergeManifest(\n base: PwaWebManifest,\n fragment: PHConnectPwaManifest | undefined,\n opts?: {\n scalarPolicy?: \"base-wins\" | \"fragment-wins\";\n protectedScalars?: readonly string[];\n },\n): PwaWebManifest {\n const scalarPolicy = opts?.scalarPolicy ?? \"base-wins\";\n const protectedScalars = opts?.protectedScalars ?? [];\n const result: PwaWebManifest = { ...base };\n const { icons, file_handlers, categories, ...scalars } = fragment ?? {};\n\n const takeScalar = (key: string): boolean => {\n // Protected keys stay base-wins regardless of the policy.\n const policy = protectedScalars.includes(key) ? \"base-wins\" : scalarPolicy;\n return policy === \"fragment-wins\" || result[key] === undefined;\n };\n\n for (const [key, value] of Object.entries(scalars)) {\n if (takeScalar(key)) result[key] = value;\n }\n\n if (icons?.length) {\n result.icons = dedupeIcons([...(result.icons ?? []), ...icons]);\n }\n if (file_handlers?.length) {\n // Force the Connect-owned action (spread first, action last) so contributed\n // handlers match the base's already-injected shape and de-dupe correctly.\n const injected = file_handlers.map((handler) => ({\n ...handler,\n action: PWA_FILE_HANDLER_ACTION,\n }));\n result.file_handlers = dedupeFileHandlers([\n ...(result.file_handlers ?? []),\n ...injected,\n ]);\n }\n if (categories?.length) {\n result.categories = unionStrings(result.categories, categories);\n }\n\n // Idempotently (re-)assert the Connect-owned file-handler action across the\n // merged result, covering both fragment contributions and any base entries.\n if (result.file_handlers?.length) {\n result.file_handlers = result.file_handlers.map((handler) => ({\n ...handler,\n action: PWA_FILE_HANDLER_ACTION,\n }));\n }\n\n return result;\n}\n","// Single source of truth for JSON Schema shapes shared between the source\n// PowerhouseConfig schema (packages/shared/clis/source-config-schema.ts) and\n// the runtime RuntimePowerhouseConfig schema\n// (packages/builder-tools/connect-utils/runtime-config-schema.ts).\n//\n// When a shared shape changes, edit it here — both schemas pick it up.\n\nexport const powerhousePackageSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"packageName\"],\n properties: {\n packageName: {\n type: \"string\",\n description: \"Fully qualified npm package name (e.g. @scope/name).\",\n },\n version: {\n type: \"string\",\n description: \"Exact version (registry providers) or omit to take latest.\",\n },\n provider: {\n type: \"string\",\n enum: [\"npm\", \"github\", \"local\", \"registry\"],\n description: \"Where Connect should resolve the package from at runtime.\",\n },\n url: {\n type: \"string\",\n description:\n \"Override URL for non-registry providers (e.g. github tarball).\",\n },\n },\n} as const;\n\n// Reusable shape for `connect.drives.sections.{remote,local}` — three\n// affirmative-named toggles per section. The legacy public+cloud sections\n// have been collapsed into a single `remote`.\nconst driveSectionSchema = {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Visibility and add/delete affordances for a drive section in the sidebar.\",\n properties: {\n enabled: {\n type: \"boolean\",\n description: \"When false, the section is hidden in the sidebar.\",\n default: true,\n },\n allowAdd: {\n type: \"boolean\",\n description:\n \"When false, the section's 'add drive' affordance is hidden.\",\n default: true,\n },\n allowDelete: {\n type: \"boolean\",\n description:\n \"When false, drives in this section cannot be deleted from the UI.\",\n default: true,\n },\n },\n} as const;\n\n// Reusable shape for a runtime-caching / denylist URL match. A string is\n// handed to Workbox verbatim; `{ source, flags }` is rebuilt into a RegExp at\n// build time. Function patterns aren't serialisable and can't be expressed\n// from config — only Connect's built-in rules use them (see the runtime-caching\n// rules in builder-tools' connect-utils/service-worker/service-worker.ts).\nconst pwaUrlPatternSchema = {\n description:\n \"URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.\",\n oneOf: [\n { type: \"string\" },\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"source\"],\n properties: {\n source: { type: \"string\", description: \"RegExp source.\" },\n flags: { type: \"string\", description: \"RegExp flags (e.g. 'i').\" },\n },\n },\n ],\n} as const;\n\n// Reusable web-app-manifest icon shape (manifest.icons and file-handler icons).\nconst pwaIconSchema = {\n type: \"object\",\n additionalProperties: false,\n required: [\"src\"],\n properties: {\n src: { type: \"string\" },\n sizes: { type: \"string\" },\n type: { type: \"string\" },\n purpose: { type: \"string\" },\n },\n} as const;\n\nexport const phConnectRuntimeConfigSchema = {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.\",\n properties: {\n branding: {\n type: \"object\",\n additionalProperties: false,\n description: \"App identity and visual branding.\",\n properties: {\n appName: {\n type: \"string\",\n description:\n \"Browser tab title and any in-app brand text. Defaults to 'Powerhouse Connect'.\",\n },\n homeBackground: {\n type: [\"string\", \"null\"],\n description:\n \"Hero image on the empty home screen. URL or path to override; null or omitted uses the bundled default image.\",\n },\n },\n },\n app: {\n type: \"object\",\n additionalProperties: false,\n description: \"Top-level Connect application behaviour.\",\n properties: {\n logLevel: {\n type: \"string\",\n enum: [\"debug\", \"info\", \"warn\", \"error\"],\n description:\n \"Log level applied by Connect's logger at boot. Affects browser-side output only.\",\n default: \"info\",\n },\n basePath: {\n type: \"string\",\n description:\n \"Base path Connect is mounted under (e.g. '/connect' for subpath deploys). Normalised at runtime to start and end with '/'. Defaults to the build-time BASE_URL.\",\n default: \"/\",\n },\n offline: {\n type: \"boolean\",\n description:\n \"When true (default), the build emits a precaching service worker so Connect's app shell works offline, and the SPA registers it at boot. Set false to opt this deployment out: no service worker is built, the SPA skips registration, and any previously-installed worker is unregistered.\",\n default: true,\n },\n studioMode: {\n type: \"boolean\",\n description:\n \"Studio mode. Enables builder-only capabilities: Connect loads the vetra package and exposes DocumentModel (and vetra spec types) as creatable documents. Forced on by `ph vetra` / `ph connect studio`; false by default.\",\n default: false,\n },\n },\n },\n ai: {\n type: \"object\",\n additionalProperties: false,\n description: \"AI assistant (chat) behaviour.\",\n properties: {\n assistantEnabled: {\n type: \"boolean\",\n description:\n \"When true, Connect mounts the in-browser AI assistant (bottom-right chat FAB that talks to a user-configured OpenAI-compatible endpoint and acts on the reactor). Disabled by default.\",\n default: false,\n },\n },\n },\n packages: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).\",\n properties: {\n externalEnabled: {\n type: \"boolean\",\n description:\n \"When false, Connect refuses to load any package that wasn't bundled at build time. Affirmative replacement for the legacy PH_CONNECT_EXTERNAL_PACKAGES_DISABLED env var.\",\n default: true,\n },\n liveReload: {\n type: \"boolean\",\n description:\n \"When true, Connect subscribes to the static-mode `/__packages` SSE channel so live publishes flow into the running tab without a page reload. Only works under hosting that serves this channel (e.g. ph-clint static mode).\",\n default: false,\n },\n },\n },\n drives: {\n type: \"object\",\n additionalProperties: false,\n description: \"Default-drive and add-drive UI behaviour.\",\n properties: {\n allowAddDrive: {\n type: \"boolean\",\n description:\n \"When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.\",\n default: true,\n },\n defaultDrives: {\n type: \"array\",\n description:\n \"Drives the SPA auto-connects to on first load. Each entry is either a remote drive (a URL, with optional name/icon overrides) or a local drive (created locally on first boot, with a stable id and optional name/icon/app).\",\n default: [],\n items: {\n oneOf: [\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"url\"],\n properties: {\n url: { type: \"string\" },\n name: { type: [\"string\", \"null\"] },\n icon: { type: [\"string\", \"null\"] },\n },\n },\n {\n type: \"object\",\n additionalProperties: false,\n required: [\"local\", \"id\"],\n properties: {\n local: {\n const: true,\n description:\n \"Discriminator: this entry is a local drive created on first boot.\",\n },\n id: {\n type: \"string\",\n description:\n \"Stable drive id. The drive is created with this id on first boot and is not re-created on later boots.\",\n },\n name: { type: [\"string\", \"null\"] },\n icon: { type: [\"string\", \"null\"] },\n app: {\n type: \"string\",\n description:\n \"Drive app (preferred editor) to open on the drive.\",\n },\n },\n },\n ],\n },\n },\n preserveStrategy: {\n type: \"string\",\n enum: [\"preserve-all\", \"preserve-by-url-and-detach\"],\n description:\n \"Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default — opt-in only.\",\n },\n sections: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.\",\n properties: {\n remote: driveSectionSchema,\n local: driveSectionSchema,\n },\n },\n },\n },\n renown: {\n type: \"object\",\n additionalProperties: false,\n description: \"Renown identity / authentication coordinates.\",\n properties: {\n url: {\n type: \"string\",\n description: \"Renown auth service URL.\",\n default: \"https://www.renown.id\",\n },\n networkId: {\n type: \"string\",\n description: \"CAIP-2 network namespace (e.g. 'eip155').\",\n default: \"eip155\",\n },\n chainId: {\n type: \"number\",\n description: \"CAIP-2 chain reference within the network namespace.\",\n default: 1,\n },\n namespace: {\n type: \"string\",\n description:\n \"Renown localStorage namespace; share it across Connects to share login.\",\n },\n switchboardUrl: {\n type: \"string\",\n description:\n \"Switchboard GraphQL URL. When set, Connect enables in-page (no-redirect) Renown sign-in; otherwise it falls back to the redirect flow via `url`.\",\n },\n adapters: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.\",\n properties: {\n rainbow: {\n type: \"object\",\n additionalProperties: false,\n description: \"wagmi + RainbowKit external-wallet adapter config.\",\n properties: {\n walletConnectProjectId: {\n type: \"string\",\n description:\n \"WalletConnect project id; required for this adapter to function.\",\n },\n infuraProjectId: {\n type: \"string\",\n description:\n \"Optional Infura project id used to build RPC transports.\",\n },\n },\n },\n privy: {\n type: \"object\",\n additionalProperties: false,\n description: \"Privy embedded/social adapter config.\",\n properties: {\n appId: {\n type: \"string\",\n description:\n \"Privy application id; required for this adapter to function.\",\n },\n clientId: {\n type: \"string\",\n description: \"Optional Privy client id.\",\n },\n methods: {\n type: \"array\",\n description:\n \"Login methods this adapter offers; default per adapter when omitted.\",\n items: { type: \"string\" },\n },\n },\n },\n },\n },\n },\n },\n sentry: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Sentry error-tracking coordinates. Set `dsn` to enable Sentry; leave `dsn` null to disable. The Sentry release tag stays build-time (stamped via Vite's `define` from WORKSPACE_VERSION) so it always matches the sourcemaps uploaded by CI.\",\n properties: {\n dsn: {\n type: [\"string\", \"null\"],\n description:\n \"Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.\",\n default: null,\n },\n env: {\n type: \"string\",\n description:\n \"Sentry environment label, surfaced as the `environment` tag on every event.\",\n default: \"dev\",\n },\n tracing: {\n type: \"boolean\",\n description: \"Enable Sentry performance tracing.\",\n default: false,\n },\n },\n },\n instance: {\n type: \"object\",\n additionalProperties: false,\n required: [\"namespace\", \"reactorWorker\"],\n description:\n \"Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.\",\n properties: {\n namespace: {\n type: [\"string\", \"null\"],\n description:\n \"Explicit storage/SharedWorker namespace for this instance. `null` derives it from the base path (and, later, the configured endpoint), so root deployments stay byte-identical.\",\n default: null,\n },\n reactorWorker: {\n type: \"boolean\",\n description:\n \"Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified.\",\n default: false,\n },\n },\n },\n reactor: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.\",\n properties: {\n featureFlags: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Enforcement flags. Each implies its predecessors, and the reactor refuses to boot on a set that names a later flag without an earlier one. These are consensus settings: a Connect syncing with a fleet must carry the same flags the fleet does, or the two reach different replay outcomes for the same history and diverge.\",\n properties: {\n documentDecisions: {\n type: \"boolean\",\n description:\n \"Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.\",\n default: false,\n },\n authEnforcement: {\n type: \"boolean\",\n description:\n \"Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.\",\n default: false,\n },\n authGroups: {\n type: \"boolean\",\n description:\n \"Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.\",\n default: false,\n },\n authConditions: {\n type: \"boolean\",\n description:\n \"Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.\",\n default: false,\n },\n },\n },\n },\n },\n pwa: {\n type: \"object\",\n additionalProperties: false,\n description:\n \"Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here — it is derived from the manifest's category field.) Only applied when connect.app.offline is true.\",\n properties: {\n manifest: {\n type: \"object\",\n additionalProperties: false,\n description: \"Web-app-manifest field overrides.\",\n properties: {\n name: { type: \"string\" },\n short_name: { type: \"string\" },\n description: { type: \"string\" },\n theme_color: { type: \"string\" },\n background_color: { type: \"string\" },\n display: {\n type: \"string\",\n enum: [\"fullscreen\", \"standalone\", \"minimal-ui\", \"browser\"],\n },\n start_url: { type: \"string\" },\n scope: { type: \"string\" },\n icons: {\n type: \"array\",\n description:\n \"Icons appended to the built-in set and de-duplicated by (src, sizes, purpose).\",\n items: pwaIconSchema,\n },\n file_handlers: {\n type: \"array\",\n description:\n \"File associations appended after Connect's built-in .phd/.phdm handler and de-duplicated on the whole entry. Entries only declare accepted types; there is no action field, because opening the files requires Connect's own runtime handling, so every handler opens at the app root.\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"accept\"],\n properties: {\n accept: {\n type: \"object\",\n description:\n \"MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it.\",\n additionalProperties: {\n type: \"array\",\n items: { type: \"string\", pattern: \"^\\\\.\" },\n },\n },\n icons: {\n type: \"array\",\n description: \"OS-level file-type icons.\",\n items: pwaIconSchema,\n },\n launch_type: {\n type: \"string\",\n enum: [\"single-client\", \"multiple-clients\"],\n },\n },\n },\n },\n launch_handler: {\n type: \"object\",\n additionalProperties: false,\n required: [\"client_mode\"],\n description:\n \"How the OS launches the app for handled files/links. Connect defaults to focus-existing.\",\n properties: {\n client_mode: {\n type: \"string\",\n enum: [\n \"auto\",\n \"focus-existing\",\n \"navigate-existing\",\n \"navigate-new\",\n ],\n },\n },\n },\n },\n },\n globPatterns: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Extra Workbox precache globs, unioned with the built-ins.\",\n },\n globIgnores: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Extra precache ignore globs, unioned with the built-ins.\",\n },\n maximumFileSizeToCacheInBytes: {\n type: \"number\",\n description:\n \"Raise the precache file-size ceiling. The max across all contributors wins, so no contributor can shrink another's limit.\",\n },\n runtimeCaching: {\n type: \"array\",\n description:\n \"Runtime-caching rules appended after the built-in rules. Workbox is first-match-wins, so these cannot override a built-in rule matching the same URL.\",\n items: {\n type: \"object\",\n additionalProperties: false,\n required: [\"urlPattern\", \"handler\"],\n properties: {\n urlPattern: pwaUrlPatternSchema,\n handler: {\n type: \"string\",\n enum: [\n \"CacheFirst\",\n \"CacheOnly\",\n \"NetworkFirst\",\n \"NetworkOnly\",\n \"StaleWhileRevalidate\",\n ],\n },\n method: {\n type: \"string\",\n enum: [\"GET\", \"POST\", \"PUT\", \"DELETE\", \"HEAD\", \"PATCH\"],\n },\n options: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n cacheName: { type: \"string\" },\n networkTimeoutSeconds: {\n type: \"number\",\n description:\n \"Seconds a NetworkFirst rule waits for the network before falling back to the cache.\",\n },\n expiration: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n maxEntries: { type: \"number\" },\n maxAgeSeconds: { type: \"number\" },\n },\n },\n cacheableResponse: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n statuses: { type: \"array\", items: { type: \"number\" } },\n headers: {\n type: \"object\",\n additionalProperties: { type: \"string\" },\n },\n },\n },\n },\n },\n },\n },\n },\n navigateFallbackDenylist: {\n type: \"array\",\n description:\n \"Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.\",\n items: pwaUrlPatternSchema,\n },\n },\n },\n },\n} as const;\n","import { satisfies, validRange } from \"semver\";\n\nexport type SharedDep = { specifier: string; package: string };\n\n/**\n * The dependency set Connect and loaded packages share via the import map.\n * `@powerhousedao/connect` is deliberately absent: it is the Connect app\n * itself (no importable exports), so there is nothing to share.\n */\nexport const SHARED_DEPS: readonly SharedDep[] = [\n { specifier: \"document-model\", package: \"document-model\" },\n {\n specifier: \"@powerhousedao/document-engineering\",\n package: \"@powerhousedao/document-engineering\",\n },\n { specifier: \"@powerhousedao/shared\", package: \"@powerhousedao/shared\" },\n {\n specifier: \"@powerhousedao/shared/registry/urls\",\n package: \"@powerhousedao/shared\",\n },\n {\n specifier: \"@powerhousedao/design-system/connect\",\n package: \"@powerhousedao/design-system\",\n },\n {\n specifier: \"@powerhousedao/reactor-browser\",\n package: \"@powerhousedao/reactor-browser\",\n },\n // Connect already vendors zod (it is in DEFAULT_VENDOR_INCLUDE, so the\n // import map publishes an entry for it) and every generated project already\n // declares it as a peerDependency -- yet it was missing from this set, so\n // each package inlined a private copy anyway. It is the single biggest\n // dependency left in a minimal package.\n { specifier: \"zod\", package: \"zod\" },\n];\n\nexport const SHARED_DEP_SPECIFIERS: readonly string[] = SHARED_DEPS.map(\n (d) => d.specifier,\n);\n\n/**\n * The `@powerhousedao/shared` subpaths the production vendor bundles. The\n * bare root is deliberately absent: its type barrel references node-only\n * modules (`clis/`), which the current vite/rolldown cannot bundle for the\n * browser — vendoring the root fails the build (a pre-existing latent\n * issue). A package that imports the bare root is simply not shared; it\n * bundles its own copy.\n */\nexport const SHARED_SUBPATHS: readonly string[] = [\n \"connect\",\n \"document-model\",\n \"processors\",\n \"document-drive\",\n \"registry\",\n \"registry/urls\",\n \"registry/manifest-slim\",\n];\n\n/**\n * The specifiers a package build may safely externalize onto the host's\n * import map — i.e. the ones the vendor actually publishes an entry for.\n *\n * `@powerhousedao/shared` is narrowed to SHARED_SUBPATHS rather than taken as\n * a prefix: the bare root is never vendored (see SHARED_SUBPATHS), and\n * neither are its other subpaths (`analytics`, `constants`, `clis`, ...).\n * Externalizing those would leave a bare specifier in the package's output\n * that nothing in the import map resolves, so the package would fail to load\n * at runtime instead of simply bundling its own copy.\n */\nexport const EXTERNALIZABLE_SHARED_SPECIFIERS: readonly string[] = [\n ...new Set([\n ...SHARED_DEP_SPECIFIERS.filter((s) => s !== \"@powerhousedao/shared\"),\n ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`),\n ]),\n];\n\n/** Split a specifier into its package name and subpath (\"\" for a root). */\nexport function parseDepSpec(spec: string): { pkg: string; sub: string } {\n if (spec.startsWith(\"@\")) {\n const parts = spec.split(\"/\");\n return { pkg: parts.slice(0, 2).join(\"/\"), sub: parts.slice(2).join(\"/\") };\n }\n const i = spec.indexOf(\"/\");\n return i === -1\n ? { pkg: spec, sub: \"\" }\n : { pkg: spec.slice(0, i), sub: spec.slice(i + 1) };\n}\n\nfunction isSharedSpecifier(spec: string, specs: readonly string[]): boolean {\n return specs.some((s) => spec === s || spec.startsWith(s + \"/\"));\n}\n\n/**\n * Return the import/export specifiers in `source` that are a shared\n * specifier (or a subpath of one), sorted. Heuristic: only statement\n * positions are scanned (`from \"x\"`, `import \"x\"`, `import(\"x\")`;\n * `export … from \"x\"` is covered by the `from` pattern), so import-like\n * text inside comments or strings can be reported too. That errs toward\n * over-reporting, which is the safe direction for the advisory build\n * warning.\n */\nexport function findSharedImports(\n source: string,\n specs: readonly string[] = SHARED_DEP_SPECIFIERS,\n): string[] {\n const found = new Set<string>();\n const patterns = [\n /\\bfrom\\s+[\"']([^\"'\\\\]+)[\"']/g,\n /\\bimport\\s+[\"']([^\"'\\\\]+)[\"']/g,\n /\\bimport\\s*\\(\\s*[\"']([^\"'\\\\]+)[\"']\\s*\\)/g,\n ];\n for (const re of patterns) {\n for (const m of source.matchAll(re)) {\n const spec = m[1];\n if (isSharedSpecifier(spec, specs)) found.add(spec);\n }\n }\n return [...found].sort();\n}\n\n/**\n * Rewrite a package source for blob import in a worker context (import maps\n * don't apply there): shared specifiers become their mapped URLs, and\n * relative (`./`, `../`) specifiers become absolute against `sourceUrl`\n * (a blob URL has no directory to resolve against). `#` subpath imports are\n * deliberately left alone: they resolve via the package's own\n * `package.json` \"imports\" field, which the rewrite cannot reproduce.\n * Returns the input unchanged when nothing matched.\n */\nexport function rewritePackageSource(\n source: string,\n sourceUrl: string,\n imports: Record<string, string>,\n): string {\n if (!Object.keys(imports).length) return source;\n const base = new URL(sourceUrl);\n const map = (spec: string): string | null => {\n const mapped = imports[spec];\n if (mapped) return mapped;\n if (spec.startsWith(\"./\") || spec.startsWith(\"../\")) {\n return new URL(spec, base).href;\n }\n return null;\n };\n let out = source;\n // The quote character is captured and reused: a source that quotes its\n // specifiers with ' would otherwise never match the replacement and be\n // left un-rewritten — silently, since the specifier still maps.\n for (const re of [\n /\\bfrom\\s+([\"'])([^\"'\\\\]+)\\1/g,\n /\\bimport\\s+([\"'])([^\"'\\\\]+)\\1/g,\n /\\bimport\\s*\\(\\s*([\"'])([^\"'\\\\]+)\\1\\s*\\)/g,\n ]) {\n out = out.replace(re, (match, quote: string, spec: string) => {\n // The match contains the quoted specifier exactly once and the\n // captured group has no quotes/backslashes ([^\"'\\\\]), so a literal\n // replace is safe.\n const mapped = map(spec);\n return mapped\n ? match.replace(`${quote}${spec}${quote}`, `${quote}${mapped}${quote}`)\n : match;\n });\n }\n return out;\n}\n\nexport type SharedDepMismatch = {\n package: string;\n required: string;\n provided: string;\n};\n\nexport type PackageDeps = {\n dependencies?: Record<string, unknown>;\n peerDependencies?: Record<string, unknown>;\n};\n\n/**\n * Compare a package's declared ranges against the host's version table.\n * `hostVersions` defines the checked set (only deps present in it are\n * checked). `*`, non-semver protocols (workspace:, file:, git:, npm:, URLs)\n * and unparseable ranges never mismatch.\n */\nexport function checkSharedDeps(\n pkgJson: PackageDeps,\n hostVersions: Record<string, string>,\n): SharedDepMismatch[] {\n const out: SharedDepMismatch[] = [];\n const entries = [\n ...Object.entries(pkgJson.dependencies ?? {}),\n ...Object.entries(pkgJson.peerDependencies ?? {}),\n ];\n for (const [dep, range] of entries) {\n const provided = hostVersions[dep];\n if (provided === undefined || typeof range !== \"string\") continue;\n if (range === \"*\" || /^[a-z]+:/i.test(range)) continue;\n if (!validRange(range)) continue;\n if (!satisfies(provided, range, { includePrerelease: true })) {\n out.push({ package: dep, required: range, provided });\n }\n }\n return out;\n}\n\nexport function formatSharedDepWarnings(\n mismatches: SharedDepMismatch[],\n): string[] {\n return mismatches.map(\n (m) =>\n `${m.package}: requires ${m.required}, Connect provides ${m.provided}`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAa,2BAA2B;;;;;;;ACNxC,MAAM,gBAAgB,EACnB,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,QAAQ,QAAQ,CAAC,CAAC,CAAC,CAC/C,WAAW,QAAQ;AAClB,KAAI,OAAO,QAAQ,UAAW,QAAO;AACrC,QAAO,QAAQ;EACf;;;;AASJ,MAAM,iBAAiB,EAAE,OAAO;CAK9B,aAAa,EAAE,QAAQ,CAAC,UAAU;CAKlC,kBAAkB,EAAE,QAAQ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M;CACN,sBAAsB;CACtB,UAAU,CAAC,MAAM;CACjB,YAAY;EACV,KAAK,EAAE,MAAM,UAAU;EACvB,OAAO,EAAE,MAAM,UAAU;EACzB,MAAM,EAAE,MAAM,UAAU;EACxB,SAAS,EAAE,MAAM,UAAU;EAC5B;CACF;AAED,MAAa,+BAA+B;CAC1C,MAAM;CACN,sBAAsB;CACtB,aACE;CACF,YAAY;EACV,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,SAAS;KACP,MAAM;KACN,aACE;KACH;IACD,gBAAgB;KACd,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACH;IACF;GACF;EACD,KAAK;GACH,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,UAAU;KACR,MAAM;KACN,MAAM;MAAC;MAAS;MAAQ;MAAQ;MAAQ;KACxC,aACE;KACF,SAAS;KACV;IACD,UAAU;KACR,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,YAAY;KACV,MAAM;KACN,aACE;KACF,SAAS;KACV;IACF;GACF;EACD,IAAI;GACF,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY,EACV,kBAAkB;IAChB,MAAM;IACN,aACE;IACF,SAAS;IACV,EACF;GACF;EACD,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,iBAAiB;KACf,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,YAAY;KACV,MAAM;KACN,aACE;KACF,SAAS;KACV;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS,EAAE;KACX,OAAO,EACL,OAAO,CACL;MACE,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,MAAM;MACjB,YAAY;OACV,KAAK,EAAE,MAAM,UAAU;OACvB,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OAClC,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OACnC;MACF,EACD;MACE,MAAM;MACN,sBAAsB;MACtB,UAAU,CAAC,SAAS,KAAK;MACzB,YAAY;OACV,OAAO;QACL,OAAO;QACP,aACE;QACH;OACD,IAAI;QACF,MAAM;QACN,aACE;QACH;OACD,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OAClC,MAAM,EAAE,MAAM,CAAC,UAAU,OAAO,EAAE;OAClC,KAAK;QACH,MAAM;QACN,aACE;QACH;OACF;MACF,CACF,EACF;KACF;IACD,kBAAkB;KAChB,MAAM;KACN,MAAM,CAAC,gBAAgB,6BAA6B;KACpD,aACE;KACH;IACD,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,QAAQ;MACR,OAAO;MACR;KACF;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aAAa;GACb,YAAY;IACV,KAAK;KACH,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,WAAW;KACT,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACD,WAAW;KACT,MAAM;KACN,aACE;KACH;IACD,gBAAgB;KACd,MAAM;KACN,aACE;KACH;IACD,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aACE;KACF,YAAY;MACV,SAAS;OACP,MAAM;OACN,sBAAsB;OACtB,aAAa;OACb,YAAY;QACV,wBAAwB;SACtB,MAAM;SACN,aACE;SACH;QACD,iBAAiB;SACf,MAAM;SACN,aACE;SACH;QACF;OACF;MACD,OAAO;OACL,MAAM;OACN,sBAAsB;OACtB,aAAa;OACb,YAAY;QACV,OAAO;SACL,MAAM;SACN,aACE;SACH;QACD,UAAU;SACR,MAAM;SACN,aAAa;SACd;QACD,SAAS;SACP,MAAM;SACN,aACE;SACF,OAAO,EAAE,MAAM,UAAU;SAC1B;QACF;OACF;MACF;KACF;IACF;GACF;EACD,QAAQ;GACN,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,KAAK;KACH,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACF,SAAS;KACV;IACD,KAAK;KACH,MAAM;KACN,aACE;KACF,SAAS;KACV;IACD,SAAS;KACP,MAAM;KACN,aAAa;KACb,SAAS;KACV;IACF;GACF;EACD,UAAU;GACR,MAAM;GACN,sBAAsB;GACtB,UAAU,CAAC,aAAa,gBAAgB;GACxC,aACE;GACF,YAAY;IACV,WAAW;KACT,MAAM,CAAC,UAAU,OAAO;KACxB,aACE;KACF,SAAS;KACV;IACD,eAAe;KACb,MAAM;KACN,aACE;KACF,SAAS;KACV;IACF;GACF;EACD,SAAS;GACP,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY,EACV,cAAc;IACZ,MAAM;IACN,sBAAsB;IACtB,aACE;IACF,YAAY;KACV,mBAAmB;MACjB,MAAM;MACN,aACE;MACF,SAAS;MACV;KACD,iBAAiB;MACf,MAAM;MACN,aACE;MACF,SAAS;MACV;KACD,YAAY;MACV,MAAM;MACN,aACE;MACF,SAAS;MACV;KACD,gBAAgB;MACd,MAAM;MACN,aACE;MACF,SAAS;MACV;KACF;IACF,EACF;GACF;EACD,KAAK;GACH,MAAM;GACN,sBAAsB;GACtB,aACE;GACF,YAAY;IACV,UAAU;KACR,MAAM;KACN,sBAAsB;KACtB,aAAa;KACb,YAAY;MACV,MAAM,EAAE,MAAM,UAAU;MACxB,YAAY,EAAE,MAAM,UAAU;MAC9B,aAAa,EAAE,MAAM,UAAU;MAC/B,aAAa,EAAE,MAAM,UAAU;MAC/B,kBAAkB,EAAE,MAAM,UAAU;MACpC,SAAS;OACP,MAAM;OACN,MAAM;QAAC;QAAc;QAAc;QAAc;QAAU;OAC5D;MACD,WAAW,EAAE,MAAM,UAAU;MAC7B,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CAAC,KAAK,UAAU,SAAS;EAClC,MAAM,WAAW,aAAa;AAC9B,MAAI,aAAa,KAAA,KAAa,OAAO,UAAU,SAAU;AACzD,MAAI,UAAU,OAAO,YAAY,KAAK,MAAM,CAAE;AAC9C,MAAI,CAAC,WAAW,MAAM,CAAE;AACxB,MAAI,CAAC,UAAU,UAAU,OAAO,EAAE,mBAAmB,MAAM,CAAC,CAC1D,KAAI,KAAK;GAAE,SAAS;GAAK,UAAU;GAAO;GAAU,CAAC;;AAGzD,QAAO;;AAGT,SAAgB,wBACd,YACU;AACV,QAAO,WAAW,KACf,MACC,GAAG,EAAE,QAAQ,aAAa,EAAE,SAAS,qBAAqB,EAAE,WAC/D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Bt as DocumentModelGlobalState, En as IsStateOfType, On as LoadFromInput, Qu as PHBaseState, Rn as Maybe, Tn as IsDocumentOfType, bi as SaveToFileHandle, ei as Reducer, gt as CreateDocument, ot as AssertIsDocumentOfType, st as AssertIsStateOfType, yt as CreateState } from "../types-
|
|
2
|
-
import { $ as LegacySynchronizationUnit, A as TriggerData, C as RemoveTriggerInput, D as SetSharingTypeInput, E as SetDriveNameInput, G as DriveInput, J as SharingType, K as GenerateNodesCopyIdGenerator, M as TriggerType, N as UpdateFileInput, O as TransmitterType, P as UpdateNodeInput, Q as LegacyAddFileInput, S as RemoveListenerInput, T as SetDriveIconInput, U as DocumentDrivePHState, W as DriveDocumentModelModule, X as DocumentDriveDocument, Y as DocumentDriveAction, Z as LegacyAddFileAction, _ as ListenerInput, _t as SetDriveNameAction, a as CopyNodeInput, at as DocumentDriveNodeOperations, b as PullResponderTriggerData, c as DocumentDriveLocalState, ct as UpdateNodeAction, d as FolderNode, dt as DocumentDriveDriveAction, et as AddFileAction, f as Listener, ft as DocumentDriveDriveOperations, g as ListenerFilterInput, gt as SetDriveIconAction, h as ListenerFilter, ht as SetAvailableOfflineAction, i as AddTriggerInput, it as DocumentDriveNodeAction, j as TriggerInput, k as Trigger, l as DocumentDrivePHState$1, lt as AddListenerAction, m as ListenerCallInfoInput, mt as RemoveTriggerAction, n as AddFolderInput, nt as CopyNodeAction, o as DeleteNodeInput, ot as MoveNodeAction, p as ListenerCallInfo, pt as RemoveListenerAction, q as GenerateNodesCopySrc, r as AddListenerInput, rt as DeleteNodeAction, s as DocumentDriveGlobalState, st as UpdateFileAction, t as AddFileInput, tt as AddFolderAction, u as FileNode, ut as AddTriggerAction, v as MoveNodeInput, vt as SetSharingTypeAction, w as SetAvailableOfflineInput, x as PullResponderTriggerDataInput, y as Node } from "../types-
|
|
1
|
+
import { Bt as DocumentModelGlobalState, En as IsStateOfType, On as LoadFromInput, Qu as PHBaseState, Rn as Maybe, Tn as IsDocumentOfType, bi as SaveToFileHandle, ei as Reducer, gt as CreateDocument, ot as AssertIsDocumentOfType, st as AssertIsStateOfType, yt as CreateState } from "../types-BIoOWpOT.js";
|
|
2
|
+
import { $ as LegacySynchronizationUnit, A as TriggerData, C as RemoveTriggerInput, D as SetSharingTypeInput, E as SetDriveNameInput, G as DriveInput, J as SharingType, K as GenerateNodesCopyIdGenerator, M as TriggerType, N as UpdateFileInput, O as TransmitterType, P as UpdateNodeInput, Q as LegacyAddFileInput, S as RemoveListenerInput, T as SetDriveIconInput, U as DocumentDrivePHState, W as DriveDocumentModelModule, X as DocumentDriveDocument, Y as DocumentDriveAction, Z as LegacyAddFileAction, _ as ListenerInput, _t as SetDriveNameAction, a as CopyNodeInput, at as DocumentDriveNodeOperations, b as PullResponderTriggerData, c as DocumentDriveLocalState, ct as UpdateNodeAction, d as FolderNode, dt as DocumentDriveDriveAction, et as AddFileAction, f as Listener, ft as DocumentDriveDriveOperations, g as ListenerFilterInput, gt as SetDriveIconAction, h as ListenerFilter, ht as SetAvailableOfflineAction, i as AddTriggerInput, it as DocumentDriveNodeAction, j as TriggerInput, k as Trigger, l as DocumentDrivePHState$1, lt as AddListenerAction, m as ListenerCallInfoInput, mt as RemoveTriggerAction, n as AddFolderInput, nt as CopyNodeAction, o as DeleteNodeInput, ot as MoveNodeAction, p as ListenerCallInfo, pt as RemoveListenerAction, q as GenerateNodesCopySrc, r as AddListenerInput, rt as DeleteNodeAction, s as DocumentDriveGlobalState, st as UpdateFileAction, t as AddFileInput, tt as AddFolderAction, u as FileNode, ut as AddTriggerAction, v as MoveNodeInput, vt as SetSharingTypeAction, w as SetAvailableOfflineInput, x as PullResponderTriggerDataInput, y as Node } from "../types-jzM0X9cd.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region document-drive/constants.d.ts
|
|
@@ -212,6 +212,46 @@ declare function getDescendants(node: Node, allNodes: Node[]): Node[];
|
|
|
212
212
|
declare function generateNodesCopy(src: GenerateNodesCopySrc, idGenerator: GenerateNodesCopyIdGenerator, nodes: Node[]): CopyNodeInput[];
|
|
213
213
|
declare function getNextCopyNumber(files: string[], baseFilename: string): number;
|
|
214
214
|
declare function escapeRegExp(string: string): string;
|
|
215
|
+
/**
|
|
216
|
+
* A plain, unfrozen copy of the node list for read-only scans. Inside a
|
|
217
|
+
* mutative draft the copy is taken from the untouched base list, so a find or
|
|
218
|
+
* filter over it does not create a child draft per element it visits, and it is
|
|
219
|
+
* a copy because the stored list is frozen and V8 scans a frozen array several
|
|
220
|
+
* times slower than a normal one. Callers must read before they write: the base
|
|
221
|
+
* list does not see mutations made earlier in the same action.
|
|
222
|
+
*/
|
|
223
|
+
declare function readNodes(state: {
|
|
224
|
+
nodes: Node[];
|
|
225
|
+
}): Node[];
|
|
226
|
+
/**
|
|
227
|
+
* A copy of the given list, sorted by id and frozen, which is the shape the
|
|
228
|
+
* node reducer assigns. Read the list with readNodes, build the new list from
|
|
229
|
+
* it, and pass what this returns to assignNodes. The copy is what keeps the
|
|
230
|
+
* freeze off the caller's array.
|
|
231
|
+
*/
|
|
232
|
+
declare function sortNodesById(nodes: readonly Node[]): readonly Node[];
|
|
233
|
+
/**
|
|
234
|
+
* The node list with a node added, ordered by id and frozen, in the same shape
|
|
235
|
+
* sortNodesById returns. The list is built and sorted as plain objects, so
|
|
236
|
+
* inside a mutative draft the comparator never reads an element through the
|
|
237
|
+
* draft proxy. Pass the list read with readNodes: the draft's own list would
|
|
238
|
+
* put child drafts in the result, which the freeze then keeps mutative from
|
|
239
|
+
* resolving.
|
|
240
|
+
*/
|
|
241
|
+
declare function insertNodeSorted(nodes: readonly Node[], node: Node): readonly Node[];
|
|
242
|
+
/**
|
|
243
|
+
* Installs a node list as state.nodes. Every assignment the node reducer makes
|
|
244
|
+
* goes through here, and this is the one place a frozen array crosses into
|
|
245
|
+
* state: the generated DocumentDriveGlobalState types nodes as a mutable
|
|
246
|
+
* Node[], so the cast below is where that gap is paid rather than spread over
|
|
247
|
+
* the reducer. Consumers must treat drive.state.global.nodes as read-only --
|
|
248
|
+
* mutating it in place (push, sort, splice) throws in strict mode; copy it
|
|
249
|
+
* first, as readNodes does. Note that LOAD_STATE replaces a whole scope and can
|
|
250
|
+
* install a list this function never saw.
|
|
251
|
+
*/
|
|
252
|
+
declare function assignNodes(state: {
|
|
253
|
+
nodes: Node[];
|
|
254
|
+
}, nodes: readonly Node[]): void;
|
|
215
255
|
declare function handleTargetNameCollisions(params: {
|
|
216
256
|
nodes: Node[];
|
|
217
257
|
targetParentFolder: string | null;
|
|
@@ -220,5 +260,5 @@ declare function handleTargetNameCollisions(params: {
|
|
|
220
260
|
}): string;
|
|
221
261
|
declare const isValidName: (name: string) => boolean;
|
|
222
262
|
//#endregion
|
|
223
|
-
export { AddFileAction, AddFileInput, AddFileInputSchema, AddFolderAction, AddFolderInput, AddFolderInputSchema, AddListenerAction, AddListenerInput, AddListenerInputSchema, AddTriggerAction, AddTriggerInput, AddTriggerInputSchema, CopyNodeAction, CopyNodeInput, CopyNodeInputSchema, DeleteNodeAction, DeleteNodeInput, DeleteNodeInputSchema, DocumentDriveAction, DocumentDriveDocument, DocumentDriveDriveAction, DocumentDriveDriveOperations, DocumentDriveGlobalState, DocumentDriveLocalState, DocumentDriveLocalStateSchema, DocumentDriveNodeAction, DocumentDriveNodeOperations, DocumentDrivePHState, DocumentDriveStateSchema, DriveDocumentHeaderSchema, DriveDocumentModelModule, DriveDocumentSchema, DriveInput, DrivePHStateSchema, FileNode, FileNodeSchema, FolderNode, FolderNodeSchema, GenerateNodesCopyIdGenerator, GenerateNodesCopySrc, LegacyAddFileAction, LegacyAddFileInput, LegacySynchronizationUnit, Listener, ListenerCallInfo, ListenerCallInfoInput, ListenerCallInfoInputSchema, ListenerCallInfoSchema, ListenerFilter, ListenerFilterInput, ListenerFilterInputSchema, ListenerFilterSchema, ListenerInput, ListenerInputSchema, ListenerSchema, MoveNodeAction, MoveNodeInput, MoveNodeInputSchema, Node, NodeSchema, PullResponderTriggerData, PullResponderTriggerDataInput, PullResponderTriggerDataInputSchema, PullResponderTriggerDataSchema, RemoveListenerAction, RemoveListenerInput, RemoveListenerInputSchema, RemoveTriggerAction, RemoveTriggerInput, RemoveTriggerInputSchema, SetAvailableOfflineAction, SetAvailableOfflineInput, SetAvailableOfflineInputSchema, SetDriveIconAction, SetDriveIconInput, SetDriveIconInputSchema, SetDriveNameAction, SetDriveNameInput, SetDriveNameInputSchema, SetSharingTypeAction, SetSharingTypeInput, SetSharingTypeInputSchema, SharingType, TransmitterType, TransmitterTypeSchema, Trigger, TriggerData, TriggerDataSchema, TriggerInput, TriggerInputSchema, TriggerSchema, TriggerType, TriggerTypeSchema, UpdateFileAction, UpdateFileInput, UpdateFileInputSchema, UpdateNodeAction, UpdateNodeInput, UpdateNodeInputSchema, addFile, addFolder, addListener, addTrigger, assertIsDocumentOfType, assertIsDriveDocument, assertIsDriveState, assertIsStateOfType, copyNode, createGlobalState, createLocalState, createState, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, deleteNode, driveCreateDocument, driveCreateState, driveDocumentFileExtension, driveDocumentModel, driveDocumentModelModule, driveDocumentReducer, driveDocumentType, driveLoadFromInput, driveReducer, driveSaveToFileHandle, escapeRegExp, generateNodesCopy, getAncestors, getDescendants, getNextCopyNumber, handleTargetNameCollisions, initialGlobalState, initialLocalState, isDefinedNonNullAny, isDocumentOfType, isDriveDocument, isDriveState, isFileNode, isFolderNode, isStateOfType, isValidName, moveNode, nodeReducer, removeListener, removeTrigger, setAvailableOffline, setDriveIcon, setDriveName, setSharingType, updateFile, updateNode };
|
|
263
|
+
export { AddFileAction, AddFileInput, AddFileInputSchema, AddFolderAction, AddFolderInput, AddFolderInputSchema, AddListenerAction, AddListenerInput, AddListenerInputSchema, AddTriggerAction, AddTriggerInput, AddTriggerInputSchema, CopyNodeAction, CopyNodeInput, CopyNodeInputSchema, DeleteNodeAction, DeleteNodeInput, DeleteNodeInputSchema, DocumentDriveAction, DocumentDriveDocument, DocumentDriveDriveAction, DocumentDriveDriveOperations, DocumentDriveGlobalState, DocumentDriveLocalState, DocumentDriveLocalStateSchema, DocumentDriveNodeAction, DocumentDriveNodeOperations, DocumentDrivePHState, DocumentDriveStateSchema, DriveDocumentHeaderSchema, DriveDocumentModelModule, DriveDocumentSchema, DriveInput, DrivePHStateSchema, FileNode, FileNodeSchema, FolderNode, FolderNodeSchema, GenerateNodesCopyIdGenerator, GenerateNodesCopySrc, LegacyAddFileAction, LegacyAddFileInput, LegacySynchronizationUnit, Listener, ListenerCallInfo, ListenerCallInfoInput, ListenerCallInfoInputSchema, ListenerCallInfoSchema, ListenerFilter, ListenerFilterInput, ListenerFilterInputSchema, ListenerFilterSchema, ListenerInput, ListenerInputSchema, ListenerSchema, MoveNodeAction, MoveNodeInput, MoveNodeInputSchema, Node, NodeSchema, PullResponderTriggerData, PullResponderTriggerDataInput, PullResponderTriggerDataInputSchema, PullResponderTriggerDataSchema, RemoveListenerAction, RemoveListenerInput, RemoveListenerInputSchema, RemoveTriggerAction, RemoveTriggerInput, RemoveTriggerInputSchema, SetAvailableOfflineAction, SetAvailableOfflineInput, SetAvailableOfflineInputSchema, SetDriveIconAction, SetDriveIconInput, SetDriveIconInputSchema, SetDriveNameAction, SetDriveNameInput, SetDriveNameInputSchema, SetSharingTypeAction, SetSharingTypeInput, SetSharingTypeInputSchema, SharingType, TransmitterType, TransmitterTypeSchema, Trigger, TriggerData, TriggerDataSchema, TriggerInput, TriggerInputSchema, TriggerSchema, TriggerType, TriggerTypeSchema, UpdateFileAction, UpdateFileInput, UpdateFileInputSchema, UpdateNodeAction, UpdateNodeInput, UpdateNodeInputSchema, addFile, addFolder, addListener, addTrigger, assertIsDocumentOfType, assertIsDriveDocument, assertIsDriveState, assertIsStateOfType, assignNodes, copyNode, createGlobalState, createLocalState, createState, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, deleteNode, driveCreateDocument, driveCreateState, driveDocumentFileExtension, driveDocumentModel, driveDocumentModelModule, driveDocumentReducer, driveDocumentType, driveLoadFromInput, driveReducer, driveSaveToFileHandle, escapeRegExp, generateNodesCopy, getAncestors, getDescendants, getNextCopyNumber, handleTargetNameCollisions, initialGlobalState, initialLocalState, insertNodeSorted, isDefinedNonNullAny, isDocumentOfType, isDriveDocument, isDriveState, isFileNode, isFolderNode, isStateOfType, isValidName, moveNode, nodeReducer, readNodes, removeListener, removeTrigger, setAvailableOffline, setDriveIcon, setDriveName, setSharingType, sortNodesById, updateFile, updateNode };
|
|
224
264
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../document-drive/constants.ts","../../document-drive/gen/node/creators.ts","../../document-drive/gen/drive/creators.ts","../../document-drive/gen/document-model.ts","../../document-drive/gen/document-schema.ts","../../document-drive/gen/document-type.ts","../../document-drive/gen/ph-factories.ts","../../document-drive/gen/reducer.ts","../../document-drive/gen/schema/zod.ts","../../document-drive/gen/utils.ts","../../document-drive/module.ts","../../document-drive/src/reducers/drive.ts","../../document-drive/src/reducers/node.ts","../../document-drive/src/utils.ts"],"mappings":";;;;;cAAa,0BAAA;;;;;;iBCiCG,OAAA,CAAQ,KAAA,EAAO,kBAAA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sBAAA;AAAA,cAMzC,gBAAA,EAAkB,gBAAA,CAAiB,sBAAA;AAAA,cAMnC,sBAAA,EAAwB,sBAAA,CACnC,sBAAA;;;cCrEW,wBAAA,EAA0B,wBAAA;;;cCP1B,YAAA,EAAc,4BAAA;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../document-drive/constants.ts","../../document-drive/gen/node/creators.ts","../../document-drive/gen/drive/creators.ts","../../document-drive/gen/document-model.ts","../../document-drive/gen/document-schema.ts","../../document-drive/gen/document-type.ts","../../document-drive/gen/ph-factories.ts","../../document-drive/gen/reducer.ts","../../document-drive/gen/schema/zod.ts","../../document-drive/gen/utils.ts","../../document-drive/module.ts","../../document-drive/src/reducers/drive.ts","../../document-drive/src/reducers/node.ts","../../document-drive/src/utils.ts"],"mappings":";;;;;cAAa,0BAAA;;;;;;iBCiCG,OAAA,CAAQ,KAAA,EAAO,kBAAA,GAAqB,mBAAA;AAAA,iBACpC,OAAA,CAAQ,KAAA,EAAO,YAAA,GAAe,aAAA;AAAA,cA0BjC,SAAA,GAAa,KAAA,EAAO,cAAA,KAAc,eAAA;AAAA,cASlC,UAAA,GAAc,KAAA,EAAO,eAAA,KAAe,gBAAA;AAAA,cASpC,UAAA,GAAc,KAAA,EAAO,eAAA,KAAe,gBAAA;AAAA,cASpC,UAAA,GAAc,KAAA,EAAO,eAAA,KAAe,gBAAA;AAAA,cASpC,QAAA,GAAY,KAAA,EAAO,aAAA,KAAa,cAAA;AAAA,cAShC,QAAA,GAAY,KAAA,EAAO,aAAA,KAAa,cAAA;;;cCzEhC,YAAA,GAAgB,KAAA,EAAO,iBAAA,KAAiB,kBAAA;AAAA,cASxC,YAAA,GAAgB,KAAA,EAAO,iBAAA,KAAiB,kBAAA;AAAA,cASxC,cAAA,GAAkB,KAAA,EAAO,mBAAA,KAAmB,oBAAA;AAAA,cAS5C,mBAAA,GAAuB,KAAA,EAAO,wBAAA,KAAwB,yBAAA;AAAA,cAStD,WAAA,GAAe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