@ryuzaki13/react-foundation-lib 2.1.5 → 2.3.0
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/error-report/index.d.ts +1 -1
- package/dist/error-report/index.d.ts.map +1 -1
- package/dist/error-report/index.js +1 -1
- package/dist/error-report-build/index.d.ts +3 -0
- package/dist/error-report-build/index.d.ts.map +1 -0
- package/dist/error-report-build/index.js +6 -0
- package/dist/error-report-build/index.js.map +1 -0
- package/dist/error-report-source-maps/index.d.ts +1 -1
- package/dist/error-report-source-maps/index.d.ts.map +1 -1
- package/dist/error-report-source-maps/index.js +1 -1
- package/dist/error-report-source-maps/index.js.map +1 -1
- package/dist/table-document/index.d.ts +7 -0
- package/dist/table-document/index.d.ts.map +1 -0
- package/dist/table-document/index.js +227 -0
- package/dist/table-document/index.js.map +1 -0
- package/dist/table-document/insertTableDocumentAxis.d.ts +7 -0
- package/dist/table-document/insertTableDocumentAxis.d.ts.map +1 -0
- package/dist/table-document/mergeTableDocumentCells.d.ts +6 -0
- package/dist/table-document/mergeTableDocumentCells.d.ts.map +1 -0
- package/dist/table-document/tableDocument.d.ts +41 -0
- package/dist/table-document/tableDocument.d.ts.map +1 -0
- package/dist/table-document/tableDocumentAxisGroups.d.ts +13 -0
- package/dist/table-document/tableDocumentAxisGroups.d.ts.map +1 -0
- package/dist/table-document/tableDocumentGeometry.d.ts +15 -0
- package/dist/table-document/tableDocumentGeometry.d.ts.map +1 -0
- package/dist/table-document/updateTableDocumentCell.d.ts +4 -0
- package/dist/table-document/updateTableDocumentCell.d.ts.map +1 -0
- package/package.json +9 -1
- package/src/table-document/README.md +23 -0
- package/dist/chunks/buildIdentity-uQE5d9pd.js +0 -6
- package/dist/chunks/buildIdentity-uQE5d9pd.js.map +0 -1
- package/dist/error-report/buildIdentity.d.ts +0 -3
- package/dist/error-report/buildIdentity.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error-report/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error-report/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { Jt as e } from "../chunks/formatters-DVE1YVNQ.js";
|
|
|
2
2
|
import { _ as t } from "../chunks/array-D-_yMMUK.js";
|
|
3
3
|
import { stableStringify as n } from "../utils/index.js";
|
|
4
4
|
import { hashString128 as r, uuidv4 as i } from "../crypto/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ERROR_REPORT_BUILD_ID_PATTERN as a } from "../error-report-build/index.js";
|
|
6
6
|
import { an as o } from "../chunks/odata-service-CWkHASdw.js";
|
|
7
7
|
import { createIndexedDbQueryStorage as s } from "../query-client/index.js";
|
|
8
8
|
import { getSessionStorageId as ee } from "../session-storage/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error-report-build/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,eAAO,MAAM,6BAA6B,QAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/error-report-build/index.ts"],"sourcesContent":["/** Полный lowercase Git commit SHA является identity одной production-сборки. */\nexport const ERROR_REPORT_BUILD_ID_PATTERN = /^[0-9a-f]{40}$/;\n"],"mappings":";AACA,IAAa,IAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error-report-source-maps/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error-report-source-maps/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ERROR_REPORT_BUILD_ID_PATTERN as e } from "../error-report-build/index.js";
|
|
2
2
|
import { z as t } from "zod";
|
|
3
3
|
import { createHash as n } from "node:crypto";
|
|
4
4
|
import { lstat as r, mkdir as i, readFile as a, readdir as o, realpath as s, rename as c, rm as l, stat as u, unlink as d, writeFile as f } from "node:fs/promises";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["sortComparator","resolveUri"],"sources":["../../src/error-report-source-maps/types.ts","../../src/error-report-source-maps/manifest.ts","../../src/error-report-source-maps/artifact.ts","../../src/error-report-source-maps/archive.ts","../../src/error-report-source-maps/package.ts","../../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs","../../node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js","../../node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs","../../src/error-report-source-maps/symbolicate.ts"],"sourcesContent":["/** Версия immutable manifest, общего для build packager и server reader. */\nexport const PRIVATE_SOURCE_MAP_MANIFEST_VERSION = 1 as const;\n\n/**\n * Лимиты едины для build и runtime: packager не должен создавать artifact,\n * который server reader затем не сможет безопасно прочитать.\n */\nexport const PRIVATE_SOURCE_MAP_MANIFEST_MAX_BYTES = 2 * 1024 * 1024;\nexport const PRIVATE_SOURCE_MAP_MAX_BYTES = 32 * 1024 * 1024;\nexport const PRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES = 256 * 1024 * 1024;\nexport const PRIVATE_SOURCE_MAP_ARTIFACT_RETENTION_MS = 97 * 24 * 60 * 60 * 1_000;\n\nexport type PrivateSourceMapManifestEntry = {\n\treadonly kind: \"client\" | \"server\";\n\treadonly bundle: string;\n\treadonly map: string;\n\treadonly sha256: string;\n\treadonly size: number;\n};\n\nexport type PrivateSourceMapManifest = {\n\treadonly version: typeof PRIVATE_SOURCE_MAP_MANIFEST_VERSION;\n\treadonly application: string;\n\treadonly buildId: string;\n\treadonly createdUtc: string;\n\treadonly entries: readonly PrivateSourceMapManifestEntry[];\n};\n\nexport type LoadedPrivateSourceMapArtifact = {\n\treadonly buildDirectory: string;\n\treadonly manifest: PrivateSourceMapManifest;\n\treadonly entriesByBundle: ReadonlyMap<string, PrivateSourceMapManifestEntry>;\n};\n\nexport type ErrorReportSourceContextLine = {\n\treadonly line: number;\n\treadonly content: string;\n\treadonly focus: boolean;\n};\n\nexport type ErrorReportStackFrame = {\n\treadonly functionName?: string;\n\treadonly generated: {\n\t\treadonly source: string;\n\t\treadonly line: number;\n\t\treadonly column: number;\n\t};\n\treadonly original?: {\n\t\treadonly source: string;\n\t\treadonly line: number;\n\t\treadonly column: number;\n\t\treadonly name?: string;\n\t};\n\treadonly sourceContext?: readonly ErrorReportSourceContextLine[];\n};\n\nexport type ErrorReportSymbolicationResult = {\n\treadonly status: \"not-required\" | \"resolved\" | \"maps-unavailable\" | \"failed\";\n\treadonly stackTrace?: string;\n\treadonly frames?: readonly ErrorReportStackFrame[];\n};\n\nexport type PackageErrorReportSourceMapsOptions = {\n\treadonly outputRoot: string;\n\treadonly artifactRoot: string;\n\t/** Staging вне outputRoot нужен, когда Nitro очищает свой output после client build. */\n\treadonly clientSourceMapStagingRoot?: string;\n\treadonly application: string;\n\treadonly buildId: string;\n\treadonly createdUtc?: string;\n};\n\nexport type PrivateSourceMapArchiveOptions = {\n\treadonly archiveRoot: string;\n\treadonly seedRoot?: string;\n\treadonly application: string;\n\treadonly buildId: string;\n\treadonly now?: () => Date;\n\treadonly onError?: (error: unknown) => void;\n};\n\nexport type SymbolicateErrorReportStackOptions = {\n\treadonly artifactRoots?: readonly string[];\n};\n","import { z } from \"zod\";\n\nimport { ERROR_REPORT_BUILD_ID_PATTERN } from \"../error-report/buildIdentity\";\n\nimport {\n\tPRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES,\n\tPRIVATE_SOURCE_MAP_MANIFEST_VERSION,\n\tPRIVATE_SOURCE_MAP_MAX_BYTES,\n\ttype PrivateSourceMapManifest\n} from \"./types\";\n\nconst APPLICATION_ID_PATTERN = /^[a-z0-9]+(?:[.-][a-z0-9]+)*$/;\nconst SHA256_PATTERN = /^[0-9a-f]{64}$/;\n\nfunction isNormalizedRelativePath(value: string): boolean {\n\tif (!value || value.startsWith(\"/\") || value.includes(\"\\\\\") || value.includes(\"\\0\")) return false;\n\treturn value.split(\"/\").every((segment) => segment !== \"\" && segment !== \".\" && segment !== \"..\");\n}\n\nfunction isNormalizedBundlePath(value: string, kind: \"client\" | \"server\"): boolean {\n\tif (value.includes(\"\\\\\") || value.includes(\"\\0\") || value.includes(\"?\") || value.includes(\"#\")) return false;\n\tif (kind === \"client\") return value.startsWith(\"/\") && isNormalizedRelativePath(value.slice(1));\n\treturn value.startsWith(\"server/\") && isNormalizedRelativePath(value);\n}\n\nconst privateSourceMapManifestEntrySchema = z\n\t.object({\n\t\tkind: z.enum([\"client\", \"server\"]),\n\t\tbundle: z.string().max(1_024),\n\t\tmap: z.string().max(1_024),\n\t\tsha256: z.string().regex(SHA256_PATTERN),\n\t\tsize: z.number().int().positive().max(PRIVATE_SOURCE_MAP_MAX_BYTES)\n\t})\n\t.strict()\n\t.superRefine((entry, context) => {\n\t\tif (!isNormalizedBundlePath(entry.bundle, entry.kind)) {\n\t\t\tcontext.addIssue({ code: \"custom\", path: [\"bundle\"], message: \"Bundle path должен быть нормализован.\" });\n\t\t}\n\t\tif (!isNormalizedRelativePath(entry.map) || !entry.map.startsWith(`${entry.kind}/`) || !entry.map.endsWith(\".map\")) {\n\t\t\tcontext.addIssue({ code: \"custom\", path: [\"map\"], message: \"Map path должен оставаться внутри kind-каталога.\" });\n\t\t}\n\t});\n\nconst privateSourceMapManifestSchema = z\n\t.object({\n\t\tversion: z.literal(PRIVATE_SOURCE_MAP_MANIFEST_VERSION),\n\t\tapplication: z.string().min(1).max(128).regex(APPLICATION_ID_PATTERN),\n\t\tbuildId: z.string().regex(ERROR_REPORT_BUILD_ID_PATTERN),\n\t\tcreatedUtc: z.iso.datetime({ offset: true }),\n\t\tentries: z.array(privateSourceMapManifestEntrySchema).max(10_000)\n\t})\n\t.strict()\n\t.superRefine((manifest, context) => {\n\t\tconst bundles = new Set<string>();\n\t\tconst maps = new Set<string>();\n\t\tlet totalBytes = 0;\n\t\tfor (const [index, entry] of manifest.entries.entries()) {\n\t\t\tif (bundles.has(entry.bundle)) {\n\t\t\t\tcontext.addIssue({ code: \"custom\", path: [\"entries\", index, \"bundle\"], message: \"Bundle должен быть уникальным.\" });\n\t\t\t}\n\t\t\tif (maps.has(entry.map)) {\n\t\t\t\tcontext.addIssue({ code: \"custom\", path: [\"entries\", index, \"map\"], message: \"Map path должен быть уникальным.\" });\n\t\t\t}\n\t\t\tbundles.add(entry.bundle);\n\t\t\tmaps.add(entry.map);\n\t\t\ttotalBytes += entry.size;\n\t\t}\n\t\tif (totalBytes > PRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES) {\n\t\t\tcontext.addIssue({ code: \"custom\", path: [\"entries\"], message: \"Private source-map artifact превышает общий предел.\" });\n\t\t}\n\t});\n\n/** Проверяет manifest до любого обращения к указанным в нём файлам. */\nexport function parsePrivateSourceMapManifest(value: unknown): PrivateSourceMapManifest | null {\n\tconst parsed = privateSourceMapManifestSchema.safeParse(value);\n\treturn parsed.success ? parsed.data : null;\n}\n\n/** Проверяет недоверенные application/build path segments до filesystem access. */\nexport function isPrivateSourceMapApplicationId(value: unknown): value is string {\n\treturn typeof value === \"string\" && value.length <= 128 && APPLICATION_ID_PATTERN.test(value);\n}\n\nexport function isErrorReportBuildId(value: unknown): value is string {\n\treturn typeof value === \"string\" && ERROR_REPORT_BUILD_ID_PATTERN.test(value);\n}\n","import { isErrorReportBuildId, isPrivateSourceMapApplicationId, parsePrivateSourceMapManifest } from \"./manifest\";\nimport { PRIVATE_SOURCE_MAP_MANIFEST_MAX_BYTES, type LoadedPrivateSourceMapArtifact, type PrivateSourceMapManifestEntry } from \"./types\";\n\nimport { createHash } from \"node:crypto\";\nimport { lstat, readFile, realpath } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport class PrivateSourceMapArtifactError extends Error {\n\tpublic constructor() {\n\t\tsuper(\"Private source-map artifact не прошёл проверку целостности.\");\n\t\tthis.name = \"PrivateSourceMapArtifactError\";\n\t}\n}\n\nfunction isMissingFileError(error: unknown): boolean {\n\treturn error instanceof Error && \"code\" in error && error.code === \"ENOENT\";\n}\n\nfunction isPathInside(parent: string, candidate: string): boolean {\n\tconst relativePath = path.relative(parent, candidate);\n\treturn relativePath !== \"\" && !relativePath.startsWith(\"..\") && !path.isAbsolute(relativePath);\n}\n\nasync function readBoundedRegularFile(filePath: string, buildDirectory: string, maxBytes: number): Promise<Buffer> {\n\tconst fileInfo = await lstat(filePath);\n\tif (!fileInfo.isFile() || fileInfo.isSymbolicLink() || fileInfo.size <= 0 || fileInfo.size > maxBytes) {\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n\tconst resolvedFilePath = await realpath(filePath);\n\tif (!isPathInside(buildDirectory, resolvedFilePath)) throw new PrivateSourceMapArtifactError();\n\tconst content = await readFile(resolvedFilePath);\n\tif (content.byteLength !== fileInfo.size) throw new PrivateSourceMapArtifactError();\n\treturn content;\n}\n\n/** Загружает manifest только из каталога точного application/build ID. */\nexport async function loadPrivateSourceMapArtifact(\n\troot: string,\n\tapplication: string,\n\tbuildId: string\n): Promise<LoadedPrivateSourceMapArtifact | null> {\n\tif (!isPrivateSourceMapApplicationId(application) || !isErrorReportBuildId(buildId)) throw new PrivateSourceMapArtifactError();\n\n\tlet resolvedRoot: string;\n\tlet buildDirectory: string;\n\ttry {\n\t\tresolvedRoot = await realpath(path.resolve(root));\n\t\tbuildDirectory = await realpath(path.join(resolvedRoot, application, buildId));\n\t} catch (error) {\n\t\tif (isMissingFileError(error)) return null;\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n\tif (!isPathInside(resolvedRoot, buildDirectory)) throw new PrivateSourceMapArtifactError();\n\n\tlet manifestContent: Buffer;\n\ttry {\n\t\tmanifestContent = await readBoundedRegularFile(\n\t\t\tpath.join(buildDirectory, \"manifest.json\"),\n\t\t\tbuildDirectory,\n\t\t\tPRIVATE_SOURCE_MAP_MANIFEST_MAX_BYTES\n\t\t);\n\t} catch (error) {\n\t\tif (isMissingFileError(error)) return null;\n\t\tif (error instanceof PrivateSourceMapArtifactError) throw error;\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n\n\tlet rawManifest: unknown;\n\ttry {\n\t\trawManifest = JSON.parse(manifestContent.toString(\"utf8\"));\n\t} catch {\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n\tconst manifest = parsePrivateSourceMapManifest(rawManifest);\n\tif (!manifest || manifest.application !== application || manifest.buildId !== buildId) throw new PrivateSourceMapArtifactError();\n\n\treturn {\n\t\tbuildDirectory,\n\t\tmanifest,\n\t\tentriesByBundle: new Map(manifest.entries.map((entry) => [entry.bundle, entry]))\n\t};\n}\n\n/** Читает карту только после size/hash verification из manifest. */\nexport async function readPrivateSourceMap(\n\tartifact: LoadedPrivateSourceMapArtifact,\n\tentry: PrivateSourceMapManifestEntry\n): Promise<string> {\n\ttry {\n\t\tconst content = await readBoundedRegularFile(path.join(artifact.buildDirectory, entry.map), artifact.buildDirectory, entry.size);\n\t\tif (content.byteLength !== entry.size || createHash(\"sha256\").update(content).digest(\"hex\") !== entry.sha256) {\n\t\t\tthrow new PrivateSourceMapArtifactError();\n\t\t}\n\t\treturn content.toString(\"utf8\");\n\t} catch (error) {\n\t\tif (error instanceof PrivateSourceMapArtifactError) throw error;\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n}\n","import { loadPrivateSourceMapArtifact, readPrivateSourceMap } from \"./artifact\";\nimport { isErrorReportBuildId } from \"./manifest\";\nimport {\n\tPRIVATE_SOURCE_MAP_ARTIFACT_RETENTION_MS,\n\ttype LoadedPrivateSourceMapArtifact,\n\ttype PrivateSourceMapArchiveOptions\n} from \"./types\";\n\nimport { mkdir, readdir, rename, rm, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nconst ARCHIVE_MAINTENANCE_INTERVAL_MS = 24 * 60 * 60 * 1_000;\n\nasync function copyArtifact(\n\tartifact: LoadedPrivateSourceMapArtifact,\n\tarchiveRoot: string,\n\tapplication: string,\n\tbuildId: string\n): Promise<void> {\n\tconst applicationDirectory = path.join(path.resolve(archiveRoot), application);\n\tconst buildDirectory = path.join(applicationDirectory, buildId);\n\tconst temporaryDirectory = path.join(applicationDirectory, `.${buildId}.tmp-${process.pid}`);\n\tawait mkdir(applicationDirectory, { recursive: true });\n\tawait rm(temporaryDirectory, { force: true, recursive: true });\n\tawait mkdir(temporaryDirectory, { recursive: false });\n\n\ttry {\n\t\tfor (const entry of artifact.manifest.entries) {\n\t\t\tconst content = await readPrivateSourceMap(artifact, entry);\n\t\t\tconst targetPath = path.join(temporaryDirectory, entry.map);\n\t\t\tawait mkdir(path.dirname(targetPath), { recursive: true });\n\t\t\tawait writeFile(targetPath, content, { encoding: \"utf8\", flag: \"wx\" });\n\t\t}\n\t\tawait writeFile(path.join(temporaryDirectory, \"manifest.json\"), `${JSON.stringify(artifact.manifest, null, 2)}\\n`, {\n\t\t\tencoding: \"utf8\",\n\t\t\tflag: \"wx\"\n\t\t});\n\t\tawait rename(temporaryDirectory, buildDirectory);\n\t} catch (error) {\n\t\tawait rm(temporaryDirectory, { force: true, recursive: true });\n\t\tconst concurrentlyInstalled = await loadPrivateSourceMapArtifact(archiveRoot, application, buildId).catch(() => null);\n\t\tif (!concurrentlyInstalled) throw error;\n\t}\n}\n\n/** Устанавливает seed и удаляет только валидные завершённые artifacts старше retention. */\nexport async function maintainPrivateSourceMapArchive(options: PrivateSourceMapArchiveOptions): Promise<void> {\n\tif (!isErrorReportBuildId(options.buildId)) return;\n\tawait mkdir(options.archiveRoot, { recursive: true });\n\n\tconst existing = await loadPrivateSourceMapArtifact(options.archiveRoot, options.application, options.buildId);\n\tconst seed = options.seedRoot ? await loadPrivateSourceMapArtifact(options.seedRoot, options.application, options.buildId) : null;\n\tif (existing && seed && JSON.stringify(existing.manifest.entries) !== JSON.stringify(seed.manifest.entries)) {\n\t\tthrow new Error(\"Persistent source-map artifact не совпадает с image seed для того же build ID.\");\n\t}\n\tif (!existing && seed) await copyArtifact(seed, options.archiveRoot, options.application, options.buildId);\n\n\tconst applicationDirectory = path.join(path.resolve(options.archiveRoot), options.application);\n\tawait mkdir(applicationDirectory, { recursive: true });\n\tconst now = (options.now ?? (() => new Date()))().getTime();\n\tfor (const entry of await readdir(applicationDirectory, { withFileTypes: true })) {\n\t\tif (!entry.isDirectory() || !isErrorReportBuildId(entry.name) || entry.name === options.buildId) continue;\n\t\ttry {\n\t\t\tconst artifact = await loadPrivateSourceMapArtifact(options.archiveRoot, options.application, entry.name);\n\t\t\tif (!artifact) continue;\n\t\t\tconst createdAt = Date.parse(artifact.manifest.createdUtc);\n\t\t\tif (Number.isFinite(createdAt) && createdAt + PRIVATE_SOURCE_MAP_ARTIFACT_RETENTION_MS <= now) {\n\t\t\t\tawait rm(artifact.buildDirectory, { recursive: true });\n\t\t\t}\n\t\t} catch {\n\t\t\t// Повреждённый artifact сохраняется как forensic evidence.\n\t\t}\n\t}\n}\n\n/** Запускает bounded daily maintenance и возвращает явный cleanup timer. */\nexport function startPrivateSourceMapArchiveMaintenance(options: PrivateSourceMapArchiveOptions): () => void {\n\tconst run = () => void maintainPrivateSourceMapArchive(options).catch((error: unknown) => options.onError?.(error));\n\trun();\n\tconst timer = setInterval(run, ARCHIVE_MAINTENANCE_INTERVAL_MS);\n\ttimer.unref();\n\treturn () => clearInterval(timer);\n}\n","import { isErrorReportBuildId, isPrivateSourceMapApplicationId } from \"./manifest\";\nimport {\n\tPRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES,\n\tPRIVATE_SOURCE_MAP_MANIFEST_VERSION,\n\tPRIVATE_SOURCE_MAP_MAX_BYTES,\n\ttype PackageErrorReportSourceMapsOptions,\n\ttype PrivateSourceMapManifest,\n\ttype PrivateSourceMapManifestEntry\n} from \"./types\";\n\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, readdir, rename, rm, stat, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nconst SOURCE_MAP_REFERENCE_PATTERN = /(?:\\/\\*[#@]\\s*sourceMappingURL=[^*]*\\*\\/|\\/\\/[#@]\\s*sourceMappingURL=.*)$/gm;\nconst PUBLIC_TEXT_ASSET_PATTERN = /\\.(?:css|html|js|mjs)$/;\nconst NITRO_PUBLIC_SOURCE_MAP_ENTRY_PATTERN = /\"(\\/[^\"\\n]+\\.map)\"\\s*:\\s*\\{/;\n\n/** Временное расположение client maps между client и Nitro server build. */\nexport const STAGED_CLIENT_SOURCE_MAP_DIRECTORY = \".private-source-maps-staging/client\";\n\nasync function listFiles(directory: string, skippedPaths: ReadonlySet<string> = new Set()): Promise<string[]> {\n\tconst files: string[] = [];\n\tfor (const entry of await readdir(directory, { withFileTypes: true })) {\n\t\tconst entryPath = path.join(directory, entry.name);\n\t\tif (skippedPaths.has(path.resolve(entryPath))) continue;\n\t\tif (entry.isSymbolicLink()) throw new Error(`Build output содержит недопустимую symbolic link: ${entryPath}`);\n\t\tif (entry.isDirectory()) files.push(...(await listFiles(entryPath, skippedPaths)));\n\t\telse if (entry.isFile()) files.push(entryPath);\n\t}\n\treturn files.sort((left, right) => left.localeCompare(right));\n}\n\nfunction validateSourceMap(content: Buffer, filePath: string): void {\n\tif (content.byteLength === 0 || content.byteLength > PRIVATE_SOURCE_MAP_MAX_BYTES) {\n\t\tthrow new Error(`Source map выходит за предел ${PRIVATE_SOURCE_MAP_MAX_BYTES} bytes: ${filePath}`);\n\t}\n\tlet sourceMap: unknown;\n\ttry {\n\t\tsourceMap = JSON.parse(content.toString(\"utf8\"));\n\t} catch {\n\t\tthrow new Error(`Source map содержит некорректный JSON: ${filePath}`);\n\t}\n\tif (!sourceMap || typeof sourceMap !== \"object\" || !(\"version\" in sourceMap) || sourceMap.version !== 3) {\n\t\tthrow new Error(`Source map имеет неподдерживаемый формат: ${filePath}`);\n\t}\n\tconst sources = \"sources\" in sourceMap ? sourceMap.sources : undefined;\n\tconst sourcesContent = \"sourcesContent\" in sourceMap ? sourceMap.sourcesContent : undefined;\n\tif (!Array.isArray(sources)) throw new Error(`Source map не содержит список sources: ${filePath}`);\n\t// Nitro вправе не встраивать исходный текст в server maps. Координаты и\n\t// имена кадров при этом восстанавливаются, а source context просто остаётся\n\t// недоступным. Если sourcesContent присутствует, проверяем его целостность.\n\tif (sourcesContent !== undefined && (!Array.isArray(sourcesContent) || sourcesContent.length !== sources.length)) {\n\t\tthrow new Error(`Source map содержит неполный sourcesContent: ${filePath}`);\n\t}\n}\n\nfunction resolveArtifactPaths(\n\toutputRoot: string,\n\tclientSourceMapStagingRoot: string,\n\tmapPath: string\n): Pick<PrivateSourceMapManifestEntry, \"kind\" | \"bundle\" | \"map\"> {\n\tconst publicRoot = path.join(outputRoot, \"public\");\n\tconst serverRoot = path.join(outputRoot, \"server\");\n\tconst relativeToPublic = path.relative(publicRoot, mapPath);\n\tif (relativeToPublic && !relativeToPublic.startsWith(\"..\") && !path.isAbsolute(relativeToPublic)) {\n\t\tconst normalizedMap = relativeToPublic.split(path.sep).join(\"/\");\n\t\treturn { kind: \"client\", bundle: `/${normalizedMap.slice(0, -\".map\".length)}`, map: `client/${normalizedMap}` };\n\t}\n\tconst relativeToStagedClient = path.relative(clientSourceMapStagingRoot, mapPath);\n\tif (relativeToStagedClient && !relativeToStagedClient.startsWith(\"..\") && !path.isAbsolute(relativeToStagedClient)) {\n\t\tconst normalizedMap = relativeToStagedClient.split(path.sep).join(\"/\");\n\t\treturn { kind: \"client\", bundle: `/${normalizedMap.slice(0, -\".map\".length)}`, map: `client/${normalizedMap}` };\n\t}\n\tconst relativeToServer = path.relative(serverRoot, mapPath);\n\tif (relativeToServer && !relativeToServer.startsWith(\"..\") && !path.isAbsolute(relativeToServer)) {\n\t\tconst normalizedMap = relativeToServer.split(path.sep).join(\"/\");\n\t\treturn { kind: \"server\", bundle: `server/${normalizedMap.slice(0, -\".map\".length)}`, map: `server/${normalizedMap}` };\n\t}\n\tthrow new Error(`Source map находится вне public/server output: ${mapPath}`);\n}\n\nasync function stripSourceMapReferences(filePath: string): Promise<void> {\n\tconst source = await readFile(filePath, \"utf8\");\n\tconst withoutReferences = source.replace(SOURCE_MAP_REFERENCE_PATTERN, \"\");\n\tif (withoutReferences !== source) await writeFile(filePath, withoutReferences, \"utf8\");\n}\n\n/** Извлекает клиентские карты до формирования Nitro static asset manifest. */\nexport async function stageClientSourceMapsForNitro(\n\toutputRoot: string,\n\toptions: { readonly publicRoot?: string; readonly clientSourceMapStagingRoot?: string } = {}\n): Promise<number> {\n\tconst resolvedOutputRoot = path.resolve(outputRoot);\n\tconst publicRoot = path.resolve(options.publicRoot ?? path.join(resolvedOutputRoot, \"public\"));\n\tconst stagingRoot = path.resolve(\n\t\toptions.clientSourceMapStagingRoot ?? path.join(resolvedOutputRoot, STAGED_CLIENT_SOURCE_MAP_DIRECTORY)\n\t);\n\tconst publicFiles = await listFiles(publicRoot);\n\tconst sourceMapFiles = publicFiles.filter((filePath) => filePath.endsWith(\".map\"));\n\tfor (const mapFile of sourceMapFiles) {\n\t\tconst relativePath = path.relative(publicRoot, mapFile);\n\t\tconst stagedPath = path.join(stagingRoot, relativePath);\n\t\tawait mkdir(path.dirname(stagedPath), { recursive: true });\n\t\tawait rename(mapFile, stagedPath);\n\t}\n\tfor (const filePath of publicFiles) {\n\t\tif (!filePath.endsWith(\".map\") && PUBLIC_TEXT_ASSET_PATTERN.test(filePath)) await stripSourceMapReferences(filePath);\n\t}\n\treturn sourceMapFiles.length;\n}\n\n/** Проверяет скомпилированный Nitro manifest, а не только оставшиеся файлы. */\nexport async function assertNoNitroSourceMapManifestLeaks(serverEntryPath: string): Promise<void> {\n\tconst serverEntry = await readFile(serverEntryPath, \"utf8\");\n\tconst leakedEntry = NITRO_PUBLIC_SOURCE_MAP_ENTRY_PATTERN.exec(serverEntry)?.[1];\n\tif (leakedEntry) throw new Error(`Nitro static asset manifest содержит source map: ${leakedEntry}`);\n}\n\n/** Доказывает отсутствие карт и sourceMappingURL в public output. */\nexport async function assertNoPublicSourceMapLeaks(publicRoot: string): Promise<void> {\n\tfor (const filePath of await listFiles(publicRoot)) {\n\t\tif (filePath.endsWith(\".map\")) throw new Error(`Public output содержит source map: ${filePath}`);\n\t\tif (!PUBLIC_TEXT_ASSET_PATTERN.test(filePath)) continue;\n\t\tconst source = await readFile(filePath, \"utf8\");\n\t\tif (source.includes(\"sourceMappingURL\")) throw new Error(`Public output содержит sourceMappingURL: ${filePath}`);\n\t}\n}\n\n/** Извлекает карты из multi-environment output в immutable private artifact. */\nexport async function packageErrorReportSourceMaps(options: PackageErrorReportSourceMapsOptions): Promise<PrivateSourceMapManifest> {\n\tif (!isPrivateSourceMapApplicationId(options.application) || !isErrorReportBuildId(options.buildId)) {\n\t\tthrow new Error(\"Application или build ID private source-map artifact недопустим.\");\n\t}\n\tconst outputRoot = path.resolve(options.outputRoot);\n\tconst artifactRoot = path.resolve(options.artifactRoot);\n\tconst clientSourceMapStagingRoot = path.resolve(\n\t\toptions.clientSourceMapStagingRoot ?? path.join(outputRoot, STAGED_CLIENT_SOURCE_MAP_DIRECTORY)\n\t);\n\tconst buildDirectory = path.join(artifactRoot, options.application, options.buildId);\n\tconst temporaryBuildDirectory = `${buildDirectory}.tmp-${process.pid}`;\n\t// Nitro v2 создаёт служебное dependency tree с допустимыми package-manager\n\t// symlink. Оно не является исполняемым bundle output и не участвует в maps.\n\tconst outputFiles = await listFiles(outputRoot, new Set([path.resolve(outputRoot, \"server/node_modules\")]));\n\tconst stagingIsInsideOutput = (() => {\n\t\tconst relative = path.relative(outputRoot, clientSourceMapStagingRoot);\n\t\treturn relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n\t})();\n\tconst stagedClientFiles = stagingIsInsideOutput ? [] : await listFiles(clientSourceMapStagingRoot);\n\tconst mapFiles = [...outputFiles, ...stagedClientFiles].filter((filePath) => filePath.endsWith(\".map\"));\n\tif (mapFiles.length === 0) throw new Error(\"Production build не создал private source maps.\");\n\n\tawait rm(temporaryBuildDirectory, { force: true, recursive: true });\n\tawait mkdir(temporaryBuildDirectory, { recursive: true });\n\tconst entries: PrivateSourceMapManifestEntry[] = [];\n\tlet totalBytes = 0;\n\ttry {\n\t\tfor (const mapFile of mapFiles) {\n\t\t\tconst content = await readFile(mapFile);\n\t\t\tvalidateSourceMap(content, mapFile);\n\t\t\ttotalBytes += content.byteLength;\n\t\t\tif (totalBytes > PRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES) {\n\t\t\t\tthrow new Error(`Private source-map artifact превышает ${PRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES} bytes.`);\n\t\t\t}\n\t\t\tconst artifactPaths = resolveArtifactPaths(outputRoot, clientSourceMapStagingRoot, mapFile);\n\t\t\tconst targetPath = path.join(temporaryBuildDirectory, artifactPaths.map);\n\t\t\tawait mkdir(path.dirname(targetPath), { recursive: true });\n\t\t\tawait writeFile(targetPath, content, { flag: \"wx\" });\n\t\t\tentries.push({\n\t\t\t\t...artifactPaths,\n\t\t\t\tsha256: createHash(\"sha256\").update(content).digest(\"hex\"),\n\t\t\t\tsize: content.byteLength\n\t\t\t});\n\t\t}\n\t\tif (!entries.some((entry) => entry.kind === \"client\")) throw new Error(\"Private source-map artifact не содержит client maps.\");\n\t\tif (!entries.some((entry) => entry.kind === \"server\")) throw new Error(\"Private source-map artifact не содержит server maps.\");\n\t\tentries.sort((left, right) => left.bundle.localeCompare(right.bundle));\n\t\tconst manifest: PrivateSourceMapManifest = {\n\t\t\tversion: PRIVATE_SOURCE_MAP_MANIFEST_VERSION,\n\t\t\tapplication: options.application,\n\t\t\tbuildId: options.buildId,\n\t\t\tcreatedUtc: options.createdUtc ?? new Date().toISOString(),\n\t\t\tentries\n\t\t};\n\t\tawait writeFile(path.join(temporaryBuildDirectory, \"manifest.json\"), `${JSON.stringify(manifest, null, 2)}\\n`, {\n\t\t\tencoding: \"utf8\",\n\t\t\tflag: \"wx\"\n\t\t});\n\t\tawait rm(buildDirectory, { force: true, recursive: true });\n\t\tawait mkdir(path.dirname(buildDirectory), { recursive: true });\n\t\tawait rename(temporaryBuildDirectory, buildDirectory);\n\t\tfor (const mapFile of mapFiles) await unlink(mapFile);\n\t\tfor (const filePath of outputFiles) {\n\t\t\tif (!filePath.endsWith(\".map\") && PUBLIC_TEXT_ASSET_PATTERN.test(filePath)) await stripSourceMapReferences(filePath);\n\t\t}\n\t\tawait assertNoPublicSourceMapLeaks(path.join(outputRoot, \"public\"));\n\t\tawait assertNoNitroSourceMapManifestLeaks(path.join(outputRoot, \"server/index.mjs\"));\n\t\tconst manifestStat = await stat(path.join(buildDirectory, \"manifest.json\"));\n\t\tif (!manifestStat.isFile()) throw new Error(\"Private source-map manifest не был создан.\");\n\t\treturn manifest;\n\t} catch (error) {\n\t\tawait rm(temporaryBuildDirectory, { force: true, recursive: true });\n\t\tthrow error;\n\t}\n}\n","// src/vlq.ts\nvar comma = \",\".charCodeAt(0);\nvar semicolon = \";\".charCodeAt(0);\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar intToChar = new Uint8Array(64);\nvar charToInt = new Uint8Array(128);\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\nfunction decodeInteger(reader, relative) {\n let value = 0;\n let shift = 0;\n let integer = 0;\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n const shouldNegate = value & 1;\n value >>>= 1;\n if (shouldNegate) {\n value = -2147483648 | -value;\n }\n return relative + value;\n}\nfunction encodeInteger(builder, num, relative) {\n let delta = num - relative;\n delta = delta < 0 ? -delta << 1 | 1 : delta << 1;\n do {\n let clamped = delta & 31;\n delta >>>= 5;\n if (delta > 0) clamped |= 32;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n return num;\n}\nfunction hasMoreVlq(reader, max) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n\n// src/strings.ts\nvar bufLength = 1024 * 16;\nvar td = typeof TextDecoder !== \"undefined\" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== \"undefined\" ? {\n decode(buf) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n }\n} : {\n decode(buf) {\n let out = \"\";\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n }\n};\nvar StringWriter = class {\n constructor() {\n this.pos = 0;\n this.out = \"\";\n this.buffer = new Uint8Array(bufLength);\n }\n write(v) {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n flush() {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n};\nvar StringReader = class {\n constructor(buffer) {\n this.pos = 0;\n this.buffer = buffer;\n }\n next() {\n return this.buffer.charCodeAt(this.pos++);\n }\n peek() {\n return this.buffer.charCodeAt(this.pos);\n }\n indexOf(char) {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n};\n\n// src/scopes.ts\nvar EMPTY = [];\nfunction decodeOriginalScopes(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes = [];\n const stack = [];\n let line = 0;\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop();\n last[2] = line;\n last[3] = column;\n continue;\n }\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 1;\n const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];\n let vars = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n scopes.push(scope);\n stack.push(scope);\n }\n return scopes;\n}\nfunction encodeOriginalScopes(scopes) {\n const writer = new StringWriter();\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n return writer.flush();\n}\nfunction _encodeOriginalScopes(scopes, index, writer, state) {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n if (index > 0) writer.write(comma);\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n const fields = scope.length === 6 ? 1 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n return index;\n}\nfunction decodeGeneratedRanges(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges = [];\n const stack = [];\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n do {\n const semi = reader.indexOf(\";\");\n let genColumn = 0;\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop();\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 1;\n const hasCallsite = fields & 2;\n const hasScope = fields & 4;\n let callsite = null;\n let bindings = EMPTY;\n let range;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0\n );\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];\n } else {\n range = [genLine, genColumn, 0, 0];\n }\n range.isScope = !!hasScope;\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0\n );\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges;\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n ranges.push(range);\n stack.push(range);\n }\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n return ranges;\n}\nfunction encodeGeneratedRanges(ranges) {\n if (ranges.length === 0) return \"\";\n const writer = new StringWriter();\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n return writer.flush();\n}\nfunction _encodeGeneratedRanges(ranges, index, writer, state) {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings\n } = range;\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, range[1], state[1]);\n const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);\n encodeInteger(writer, fields, 0);\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);\n encodeInteger(writer, expRange[0], 0);\n }\n }\n }\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n return index;\n}\nfunction catchupLine(writer, lastLine, line) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n\n// src/sourcemap-codec.ts\nfunction decode(mappings) {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n do {\n const semi = reader.indexOf(\";\");\n const line = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n while (reader.pos < semi) {\n let seg;\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n line.push(seg);\n reader.pos++;\n }\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n return decoded;\n}\nfunction sort(line) {\n line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[0] - b[0];\n}\nfunction encode(decoded) {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n let genColumn = 0;\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n genColumn = encodeInteger(writer, segment[0], genColumn);\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n return writer.flush();\n}\nexport {\n decode,\n decodeGeneratedRanges,\n decodeOriginalScopes,\n encode,\n encodeGeneratedRanges,\n encodeOriginalScopes\n};\n//# sourceMappingURL=sourcemap-codec.mjs.map\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory());\n})(this, (function () { 'use strict';\n\n // Matches the scheme of a URL, eg \"http://\"\n const schemeRegex = /^[\\w+.-]+:\\/\\//;\n /**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\n const urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n /**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\n const fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n function isAbsoluteUrl(input) {\n return schemeRegex.test(input);\n }\n function isSchemeRelativeUrl(input) {\n return input.startsWith('//');\n }\n function isAbsolutePath(input) {\n return input.startsWith('/');\n }\n function isFileUrl(input) {\n return input.startsWith('file:');\n }\n function isRelative(input) {\n return /^[.?#]/.test(input);\n }\n function parseAbsoluteUrl(input) {\n const match = urlRegex.exec(input);\n return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');\n }\n function parseFileUrl(input) {\n const match = fileRegex.exec(input);\n const path = match[2];\n return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');\n }\n function makeUrl(scheme, user, host, port, path, query, hash) {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: 7 /* Absolute */,\n };\n }\n function parseUrl(input) {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = 6 /* SchemeRelative */;\n return url;\n }\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = 5 /* AbsolutePath */;\n return url;\n }\n if (isFileUrl(input))\n return parseFileUrl(input);\n if (isAbsoluteUrl(input))\n return parseAbsoluteUrl(input);\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? 3 /* Query */\n : input.startsWith('#')\n ? 2 /* Hash */\n : 4 /* RelativePath */\n : 1 /* Empty */;\n return url;\n }\n function stripPathFilename(path) {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..'))\n return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n }\n function mergePaths(url, base) {\n normalizePath(base, base.type);\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n }\n else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n }\n /**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\n function normalizePath(url, type) {\n const rel = type <= 4 /* RelativePath */;\n const pieces = url.path.split('/');\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n // A current directory, which we can always drop.\n if (piece === '.')\n continue;\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n }\n else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n }\n /**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\n function resolve(input, base) {\n if (!input && !base)\n return '';\n const url = parseUrl(input);\n let inputType = url.type;\n if (base && inputType !== 7 /* Absolute */) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n switch (inputType) {\n case 1 /* Empty */:\n url.hash = baseUrl.hash;\n // fall through\n case 2 /* Hash */:\n url.query = baseUrl.query;\n // fall through\n case 3 /* Query */:\n case 4 /* RelativePath */:\n mergePaths(url, baseUrl);\n // fall through\n case 5 /* AbsolutePath */:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n case 6 /* SchemeRelative */:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType)\n inputType = baseType;\n }\n normalizePath(url, inputType);\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n case 2 /* Hash */:\n case 3 /* Query */:\n return queryHash;\n case 4 /* RelativePath */: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n if (!path)\n return queryHash || '.';\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n return path + queryHash;\n }\n case 5 /* AbsolutePath */:\n return url.path + queryHash;\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n }\n\n return resolve;\n\n}));\n//# sourceMappingURL=resolve-uri.umd.js.map\n","// src/trace-mapping.ts\nimport { encode, decode } from \"@jridgewell/sourcemap-codec\";\n\n// src/resolve.ts\nimport resolveUri from \"@jridgewell/resolve-uri\";\n\n// src/strip-filename.ts\nfunction stripFilename(path) {\n if (!path) return \"\";\n const index = path.lastIndexOf(\"/\");\n return path.slice(0, index + 1);\n}\n\n// src/resolve.ts\nfunction resolver(mapUrl, sourceRoot) {\n const from = stripFilename(mapUrl);\n const prefix = sourceRoot ? sourceRoot + \"/\" : \"\";\n return (source) => resolveUri(prefix + (source || \"\"), from);\n}\n\n// src/sourcemap-segment.ts\nvar COLUMN = 0;\nvar SOURCES_INDEX = 1;\nvar SOURCE_LINE = 2;\nvar SOURCE_COLUMN = 3;\nvar NAMES_INDEX = 4;\nvar REV_GENERATED_LINE = 1;\nvar REV_GENERATED_COLUMN = 2;\n\n// src/sort.ts\nfunction maybeSort(mappings, owned) {\n const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);\n if (unsortedIndex === mappings.length) return mappings;\n if (!owned) mappings = mappings.slice();\n for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {\n mappings[i] = sortSegments(mappings[i], owned);\n }\n return mappings;\n}\nfunction nextUnsortedSegmentLine(mappings, start) {\n for (let i = start; i < mappings.length; i++) {\n if (!isSorted(mappings[i])) return i;\n }\n return mappings.length;\n}\nfunction isSorted(line) {\n for (let j = 1; j < line.length; j++) {\n if (line[j][COLUMN] < line[j - 1][COLUMN]) {\n return false;\n }\n }\n return true;\n}\nfunction sortSegments(line, owned) {\n if (!owned) line = line.slice();\n return line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[COLUMN] - b[COLUMN];\n}\n\n// src/by-source.ts\nfunction buildBySources(decoded, memos) {\n const sources = memos.map(() => []);\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n if (seg.length === 1) continue;\n const sourceIndex2 = seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n const source = sources[sourceIndex2];\n const segs = source[sourceLine] || (source[sourceLine] = []);\n segs.push([sourceColumn, i, seg[COLUMN]]);\n }\n }\n for (let i = 0; i < sources.length; i++) {\n const source = sources[i];\n for (let j = 0; j < source.length; j++) {\n const line = source[j];\n if (line) line.sort(sortComparator);\n }\n }\n return sources;\n}\n\n// src/binary-search.ts\nvar found = false;\nfunction binarySearch(haystack, needle, low, high) {\n while (low <= high) {\n const mid = low + (high - low >> 1);\n const cmp = haystack[mid][COLUMN] - needle;\n if (cmp === 0) {\n found = true;\n return mid;\n }\n if (cmp < 0) {\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n found = false;\n return low - 1;\n}\nfunction upperBound(haystack, needle, index) {\n for (let i = index + 1; i < haystack.length; index = i++) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\nfunction lowerBound(haystack, needle, index) {\n for (let i = index - 1; i >= 0; index = i--) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\nfunction memoizedState() {\n return {\n lastKey: -1,\n lastNeedle: -1,\n lastIndex: -1\n };\n}\nfunction memoizedBinarySearch(haystack, needle, state, key) {\n const { lastKey, lastNeedle, lastIndex } = state;\n let low = 0;\n let high = haystack.length - 1;\n if (key === lastKey) {\n if (needle === lastNeedle) {\n found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;\n return lastIndex;\n }\n if (needle >= lastNeedle) {\n low = lastIndex === -1 ? 0 : lastIndex;\n } else {\n high = lastIndex;\n }\n }\n state.lastKey = key;\n state.lastNeedle = needle;\n return state.lastIndex = binarySearch(haystack, needle, low, high);\n}\n\n// src/types.ts\nfunction parse(map) {\n return typeof map === \"string\" ? JSON.parse(map) : map;\n}\n\n// src/flatten-map.ts\nvar FlattenMap = function(map, mapUrl) {\n const parsed = parse(map);\n if (!(\"sections\" in parsed)) {\n return new TraceMap(parsed, mapUrl);\n }\n const mappings = [];\n const sources = [];\n const sourcesContent = [];\n const names = [];\n const ignoreList = [];\n recurse(\n parsed,\n mapUrl,\n mappings,\n sources,\n sourcesContent,\n names,\n ignoreList,\n 0,\n 0,\n Infinity,\n Infinity\n );\n const joined = {\n version: 3,\n file: parsed.file,\n names,\n sources,\n sourcesContent,\n mappings,\n ignoreList\n };\n return presortedDecodedMap(joined);\n};\nfunction recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {\n const { sections } = input;\n for (let i = 0; i < sections.length; i++) {\n const { map, offset } = sections[i];\n let sl = stopLine;\n let sc = stopColumn;\n if (i + 1 < sections.length) {\n const nextOffset = sections[i + 1].offset;\n sl = Math.min(stopLine, lineOffset + nextOffset.line);\n if (sl === stopLine) {\n sc = Math.min(stopColumn, columnOffset + nextOffset.column);\n } else if (sl < stopLine) {\n sc = columnOffset + nextOffset.column;\n }\n }\n addSection(\n map,\n mapUrl,\n mappings,\n sources,\n sourcesContent,\n names,\n ignoreList,\n lineOffset + offset.line,\n columnOffset + offset.column,\n sl,\n sc\n );\n }\n}\nfunction addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {\n const parsed = parse(input);\n if (\"sections\" in parsed) return recurse(...arguments);\n const map = new TraceMap(parsed, mapUrl);\n const sourcesOffset = sources.length;\n const namesOffset = names.length;\n const decoded = decodedMappings(map);\n const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map;\n append(sources, resolvedSources);\n append(names, map.names);\n if (contents) append(sourcesContent, contents);\n else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);\n if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset);\n for (let i = 0; i < decoded.length; i++) {\n const lineI = lineOffset + i;\n if (lineI > stopLine) return;\n const out = getLine(mappings, lineI);\n const cOffset = i === 0 ? columnOffset : 0;\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n const column = cOffset + seg[COLUMN];\n if (lineI === stopLine && column >= stopColumn) return;\n if (seg.length === 1) {\n out.push([column]);\n continue;\n }\n const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n out.push(\n seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]\n );\n }\n }\n}\nfunction append(arr, other) {\n for (let i = 0; i < other.length; i++) arr.push(other[i]);\n}\nfunction getLine(arr, index) {\n for (let i = arr.length; i <= index; i++) arr[i] = [];\n return arr[index];\n}\n\n// src/trace-mapping.ts\nvar LINE_GTR_ZERO = \"`line` must be greater than 0 (lines start at line 1)\";\nvar COL_GTR_EQ_ZERO = \"`column` must be greater than or equal to 0 (columns start at column 0)\";\nvar LEAST_UPPER_BOUND = -1;\nvar GREATEST_LOWER_BOUND = 1;\nvar TraceMap = class {\n constructor(map, mapUrl) {\n const isString = typeof map === \"string\";\n if (!isString && map._decodedMemo) return map;\n const parsed = parse(map);\n const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;\n this.version = version;\n this.file = file;\n this.names = names || [];\n this.sourceRoot = sourceRoot;\n this.sources = sources;\n this.sourcesContent = sourcesContent;\n this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;\n const resolve = resolver(mapUrl, sourceRoot);\n this.resolvedSources = sources.map(resolve);\n const { mappings } = parsed;\n if (typeof mappings === \"string\") {\n this._encoded = mappings;\n this._decoded = void 0;\n } else if (Array.isArray(mappings)) {\n this._encoded = void 0;\n this._decoded = maybeSort(mappings, isString);\n } else if (parsed.sections) {\n throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);\n } else {\n throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);\n }\n this._decodedMemo = memoizedState();\n this._bySources = void 0;\n this._bySourceMemos = void 0;\n }\n};\nfunction cast(map) {\n return map;\n}\nfunction encodedMappings(map) {\n var _a, _b;\n return (_b = (_a = cast(map))._encoded) != null ? _b : _a._encoded = encode(cast(map)._decoded);\n}\nfunction decodedMappings(map) {\n var _a;\n return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));\n}\nfunction traceSegment(map, line, column) {\n const decoded = decodedMappings(map);\n if (line >= decoded.length) return null;\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n cast(map)._decodedMemo,\n line,\n column,\n GREATEST_LOWER_BOUND\n );\n return index === -1 ? null : segments[index];\n}\nfunction originalPositionFor(map, needle) {\n let { line, column, bias } = needle;\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n const decoded = decodedMappings(map);\n if (line >= decoded.length) return OMapping(null, null, null, null);\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n cast(map)._decodedMemo,\n line,\n column,\n bias || GREATEST_LOWER_BOUND\n );\n if (index === -1) return OMapping(null, null, null, null);\n const segment = segments[index];\n if (segment.length === 1) return OMapping(null, null, null, null);\n const { names, resolvedSources } = map;\n return OMapping(\n resolvedSources[segment[SOURCES_INDEX]],\n segment[SOURCE_LINE] + 1,\n segment[SOURCE_COLUMN],\n segment.length === 5 ? names[segment[NAMES_INDEX]] : null\n );\n}\nfunction generatedPositionFor(map, needle) {\n const { source, line, column, bias } = needle;\n return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);\n}\nfunction allGeneratedPositionsFor(map, needle) {\n const { source, line, column, bias } = needle;\n return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);\n}\nfunction eachMapping(map, cb) {\n const decoded = decodedMappings(map);\n const { names, resolvedSources } = map;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n const generatedLine = i + 1;\n const generatedColumn = seg[0];\n let source = null;\n let originalLine = null;\n let originalColumn = null;\n let name = null;\n if (seg.length !== 1) {\n source = resolvedSources[seg[1]];\n originalLine = seg[2] + 1;\n originalColumn = seg[3];\n }\n if (seg.length === 5) name = names[seg[4]];\n cb({\n generatedLine,\n generatedColumn,\n source,\n originalLine,\n originalColumn,\n name\n });\n }\n }\n}\nfunction sourceIndex(map, source) {\n const { sources, resolvedSources } = map;\n let index = sources.indexOf(source);\n if (index === -1) index = resolvedSources.indexOf(source);\n return index;\n}\nfunction sourceContentFor(map, source) {\n const { sourcesContent } = map;\n if (sourcesContent == null) return null;\n const index = sourceIndex(map, source);\n return index === -1 ? null : sourcesContent[index];\n}\nfunction isIgnored(map, source) {\n const { ignoreList } = map;\n if (ignoreList == null) return false;\n const index = sourceIndex(map, source);\n return index === -1 ? false : ignoreList.includes(index);\n}\nfunction presortedDecodedMap(map, mapUrl) {\n const tracer = new TraceMap(clone(map, []), mapUrl);\n cast(tracer)._decoded = map.mappings;\n return tracer;\n}\nfunction decodedMap(map) {\n return clone(map, decodedMappings(map));\n}\nfunction encodedMap(map) {\n return clone(map, encodedMappings(map));\n}\nfunction clone(map, mappings) {\n return {\n version: map.version,\n file: map.file,\n names: map.names,\n sourceRoot: map.sourceRoot,\n sources: map.sources,\n sourcesContent: map.sourcesContent,\n mappings,\n ignoreList: map.ignoreList || map.x_google_ignoreList\n };\n}\nfunction OMapping(source, line, column, name) {\n return { source, line, column, name };\n}\nfunction GMapping(line, column) {\n return { line, column };\n}\nfunction traceSegmentInternal(segments, memo, line, column, bias) {\n let index = memoizedBinarySearch(segments, column, memo, line);\n if (found) {\n index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);\n } else if (bias === LEAST_UPPER_BOUND) index++;\n if (index === -1 || index === segments.length) return -1;\n return index;\n}\nfunction sliceGeneratedPositions(segments, memo, line, column, bias) {\n let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);\n if (!found && bias === LEAST_UPPER_BOUND) min++;\n if (min === -1 || min === segments.length) return [];\n const matchedColumn = found ? column : segments[min][COLUMN];\n if (!found) min = lowerBound(segments, matchedColumn, min);\n const max = upperBound(segments, matchedColumn, min);\n const result = [];\n for (; min <= max; min++) {\n const segment = segments[min];\n result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));\n }\n return result;\n}\nfunction generatedPosition(map, source, line, column, bias, all) {\n var _a, _b;\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n const { sources, resolvedSources } = map;\n let sourceIndex2 = sources.indexOf(source);\n if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source);\n if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);\n const bySourceMemos = (_a = cast(map))._bySourceMemos || (_a._bySourceMemos = sources.map(memoizedState));\n const generated = (_b = cast(map))._bySources || (_b._bySources = buildBySources(decodedMappings(map), bySourceMemos));\n const segments = generated[sourceIndex2][line];\n if (segments == null) return all ? [] : GMapping(null, null);\n const memo = bySourceMemos[sourceIndex2];\n if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);\n const index = traceSegmentInternal(segments, memo, line, column, bias);\n if (index === -1) return GMapping(null, null);\n const segment = segments[index];\n return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);\n}\nexport {\n FlattenMap as AnyMap,\n FlattenMap,\n GREATEST_LOWER_BOUND,\n LEAST_UPPER_BOUND,\n TraceMap,\n allGeneratedPositionsFor,\n decodedMap,\n decodedMappings,\n eachMapping,\n encodedMap,\n encodedMappings,\n generatedPositionFor,\n isIgnored,\n originalPositionFor,\n presortedDecodedMap,\n sourceContentFor,\n traceSegment\n};\n//# sourceMappingURL=trace-mapping.mjs.map\n","import { AnyMap, originalPositionFor, sourceContentFor, type TraceMap } from \"@jridgewell/trace-mapping\";\n\nimport { loadPrivateSourceMapArtifact, readPrivateSourceMap } from \"./artifact\";\nimport {\n\ttype ErrorReportStackFrame,\n\ttype ErrorReportSymbolicationResult,\n\ttype LoadedPrivateSourceMapArtifact,\n\ttype PrivateSourceMapManifestEntry,\n\ttype SymbolicateErrorReportStackOptions\n} from \"./types\";\n\nconst MAX_STACK_FRAMES = 40;\nconst MAX_CONTEXT_FRAMES = 10;\nconst CONTEXT_RADIUS = 2;\nconst MAX_SOURCE_LINE_LENGTH = 500;\nconst MAX_SYMBOLICATED_STACK_LENGTH = 262_144;\n\ntype ParsedStackFrame = {\n\treadonly lineIndex: number;\n\treadonly style: \"chromium\" | \"safari\";\n\treadonly functionName?: string;\n\treadonly source: string;\n\treadonly line: number;\n\treadonly column: number;\n\treadonly bundle: string;\n};\n\nfunction parsePositiveInteger(value: string): number | null {\n\tconst parsed = Number(value);\n\treturn Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;\n}\n\nfunction normalizeFunctionName(value: string | undefined): string | undefined {\n\tconst normalized = value\n\t\t?.trim()\n\t\t.replace(/^async\\s+/, \"\")\n\t\t.slice(0, 256);\n\treturn normalized || undefined;\n}\n\nfunction safeUrlPathname(value: string): string | null {\n\ttry {\n\t\treturn new URL(value).pathname;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction resolveBundle(source: string): string | null {\n\tconst withoutLocationSuffix = source.replace(/[?#].*$/, \"\").replaceAll(\"\\\\\", \"/\");\n\tconst urlPathname = safeUrlPathname(withoutLocationSuffix);\n\tconst normalized = (urlPathname ?? withoutLocationSuffix).replaceAll(\"\\\\\", \"/\");\n\tif (normalized.startsWith(\"/static/\") || normalized === \"/sw.js\" || normalized === \"/sw.mjs\") return normalized;\n\tif (normalized.startsWith(\"server/\")) return normalized;\n\tconst serverMarker = normalized.lastIndexOf(\"/server/\");\n\treturn serverMarker >= 0 ? `server/${normalized.slice(serverMarker + \"/server/\".length)}` : null;\n}\n\nfunction parseStackFrame(line: string, lineIndex: number): ParsedStackFrame | null {\n\tconst chromiumWithFunction = /^\\s*at\\s+(.+?)\\s+\\((.+):(\\d+):(\\d+)\\)\\s*$/.exec(line);\n\tconst chromiumBare = /^\\s*at\\s+(.+):(\\d+):(\\d+)\\s*$/.exec(line);\n\tconst safari = /^([^@]*)@(.+):(\\d+):(\\d+)\\s*$/.exec(line);\n\tconst match = chromiumWithFunction ?? chromiumBare ?? safari;\n\tif (!match) return null;\n\n\tconst hasChromiumFunction = match === chromiumWithFunction;\n\tconst hasSafariFunction = match === safari;\n\tconst sourceIndex = hasChromiumFunction ? 2 : hasSafariFunction ? 2 : 1;\n\tconst source = match[sourceIndex];\n\tconst generatedLine = match[sourceIndex + 1] ? parsePositiveInteger(match[sourceIndex + 1]) : null;\n\tconst generatedColumn = match[sourceIndex + 2] ? parsePositiveInteger(match[sourceIndex + 2]) : null;\n\tif (!source || generatedLine === null || generatedColumn === null) return null;\n\tconst bundle = resolveBundle(source);\n\tif (!bundle) return null;\n\treturn {\n\t\tlineIndex,\n\t\tstyle: hasSafariFunction ? \"safari\" : \"chromium\",\n\t\tfunctionName: normalizeFunctionName(hasChromiumFunction || hasSafariFunction ? match[1] : undefined),\n\t\tsource,\n\t\tline: generatedLine,\n\t\tcolumn: generatedColumn,\n\t\tbundle\n\t};\n}\n\nfunction normalizeOriginalSource(source: string): string {\n\tconst normalized = source\n\t\t.replaceAll(\"\\\\\", \"/\")\n\t\t.replace(/[?#].*$/, \"\")\n\t\t.replaceAll(\"\\0\", \"\");\n\tfor (const marker of [\"/src/\", \"/config/\", \"/scripts/\", \"/node_modules/\"] as const) {\n\t\tconst markerIndex = normalized.lastIndexOf(marker);\n\t\tif (markerIndex >= 0) return normalized.slice(markerIndex + 1).slice(0, 1_024);\n\t}\n\tfor (const prefix of [\"src/\", \"config/\", \"scripts/\", \"node_modules/\"] as const) {\n\t\tconst prefixIndex = normalized.indexOf(prefix);\n\t\tif (prefixIndex >= 0) return normalized.slice(prefixIndex).slice(0, 1_024);\n\t}\n\tconst filename = normalized.split(\"/\").filter(Boolean).at(-1) ?? \"unknown-source\";\n\treturn `source/${filename.slice(0, 512)}`;\n}\n\nfunction createSourceContext(traceMap: TraceMap, source: string, line: number) {\n\tconst content = sourceContentFor(traceMap, source);\n\tif (content === null) return undefined;\n\tconst lines = content.split(/\\r?\\n/);\n\tconst firstLine = Math.max(1, line - CONTEXT_RADIUS);\n\tconst lastLine = Math.min(lines.length, line + CONTEXT_RADIUS);\n\treturn Array.from({ length: lastLine - firstLine + 1 }, (_, index) => {\n\t\tconst sourceLine = firstLine + index;\n\t\treturn { line: sourceLine, content: (lines[sourceLine - 1] ?? \"\").slice(0, MAX_SOURCE_LINE_LENGTH), focus: sourceLine === line };\n\t});\n}\n\nfunction formatSymbolicatedLine(frame: ParsedStackFrame, resolved: ErrorReportStackFrame): string {\n\tconst original = resolved.original;\n\tif (!original) return \"\";\n\tconst functionName = original.name ?? frame.functionName;\n\tconst location = `${original.source}:${original.line}:${original.column}`;\n\tif (frame.style === \"safari\") return `${functionName ?? \"global code\"}@${location}`;\n\treturn functionName ? ` at ${functionName} (${location})` : ` at ${location}`;\n}\n\nasync function findArtifact(\n\troots: readonly string[],\n\tapplication: string,\n\tbuildId: string\n): Promise<LoadedPrivateSourceMapArtifact | null> {\n\tfor (const root of roots) {\n\t\tconst artifact = await loadPrivateSourceMapArtifact(root, application, buildId);\n\t\tif (artifact) return artifact;\n\t}\n\treturn null;\n}\n\nfunction resolveDefaultArtifactRoots(): string[] {\n\treturn [process.env.ERROR_REPORT_SOURCE_MAP_SEED_ROOT, process.env.ERROR_REPORT_SOURCE_MAP_ROOT].filter((root): root is string =>\n\t\tBoolean(root)\n\t);\n}\n\n/** Символизирует только bundle frames из artifact того же application/build ID. */\nexport async function symbolicateErrorReportStack(\n\tapplication: string,\n\tbuildId: string,\n\tstackTrace: string | undefined,\n\toptions: SymbolicateErrorReportStackOptions = {}\n): Promise<ErrorReportSymbolicationResult> {\n\tif (!stackTrace?.trim()) return { status: \"not-required\" };\n\tconst stackLines = stackTrace.split(\"\\n\");\n\tconst parsedFrames = stackLines.map(parseStackFrame).filter((frame): frame is ParsedStackFrame => frame !== null);\n\tif (parsedFrames.length === 0) return { status: \"not-required\" };\n\tconst boundedFrames = parsedFrames.slice(0, MAX_STACK_FRAMES);\n\tconst generatedFrames = boundedFrames.map<ErrorReportStackFrame>((frame) => ({\n\t\t...(frame.functionName ? { functionName: frame.functionName } : {}),\n\t\tgenerated: { source: frame.bundle, line: frame.line, column: frame.column }\n\t}));\n\n\ttry {\n\t\tconst artifact = await findArtifact(options.artifactRoots ?? resolveDefaultArtifactRoots(), application, buildId);\n\t\tif (!artifact) return { status: \"maps-unavailable\", frames: generatedFrames };\n\t\tconst traceMaps = new Map<string, TraceMap>();\n\t\tconst resultFrames: ErrorReportStackFrame[] = [];\n\t\tlet failed = parsedFrames.length > MAX_STACK_FRAMES;\n\t\tlet contextFrames = 0;\n\n\t\tfor (const frame of boundedFrames) {\n\t\t\tconst entry: PrivateSourceMapManifestEntry | undefined = artifact.entriesByBundle.get(frame.bundle);\n\t\t\tif (!entry) {\n\t\t\t\tfailed = true;\n\t\t\t\tresultFrames.push({\n\t\t\t\t\t...(frame.functionName ? { functionName: frame.functionName } : {}),\n\t\t\t\t\tgenerated: { source: frame.bundle, line: frame.line, column: frame.column }\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet traceMap = traceMaps.get(entry.map);\n\t\t\tif (!traceMap) {\n\t\t\t\ttraceMap = new AnyMap(await readPrivateSourceMap(artifact, entry), entry.map);\n\t\t\t\ttraceMaps.set(entry.map, traceMap);\n\t\t\t}\n\t\t\tconst original = originalPositionFor(traceMap, { line: frame.line, column: frame.column - 1 });\n\t\t\tif (original.source === null || original.line === null || original.column === null) {\n\t\t\t\tfailed = true;\n\t\t\t\tresultFrames.push({\n\t\t\t\t\t...(frame.functionName ? { functionName: frame.functionName } : {}),\n\t\t\t\t\tgenerated: { source: frame.bundle, line: frame.line, column: frame.column }\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst sourceContext =\n\t\t\t\tcontextFrames < MAX_CONTEXT_FRAMES ? createSourceContext(traceMap, original.source, original.line) : undefined;\n\t\t\tif (sourceContext) contextFrames += 1;\n\t\t\tconst resolvedFrame: ErrorReportStackFrame = {\n\t\t\t\t...(frame.functionName ? { functionName: frame.functionName } : {}),\n\t\t\t\tgenerated: { source: frame.bundle, line: frame.line, column: frame.column },\n\t\t\t\toriginal: {\n\t\t\t\t\tsource: normalizeOriginalSource(original.source),\n\t\t\t\t\tline: original.line,\n\t\t\t\t\tcolumn: original.column + 1,\n\t\t\t\t\t...(original.name ? { name: original.name.slice(0, 256) } : {})\n\t\t\t\t},\n\t\t\t\t...(sourceContext ? { sourceContext } : {})\n\t\t\t};\n\t\t\tresultFrames.push(resolvedFrame);\n\t\t\tstackLines[frame.lineIndex] = formatSymbolicatedLine(frame, resolvedFrame);\n\t\t}\n\n\t\tconst hasResolvedFrame = resultFrames.some((frame) => frame.original !== undefined);\n\t\treturn {\n\t\t\tstatus: failed || !hasResolvedFrame ? \"failed\" : \"resolved\",\n\t\t\t...(hasResolvedFrame ? { stackTrace: stackLines.join(\"\\n\").slice(0, MAX_SYMBOLICATED_STACK_LENGTH) } : {}),\n\t\t\tframes: resultFrames\n\t\t};\n\t} catch {\n\t\treturn { status: \"failed\", frames: generatedFrames };\n\t}\n}\n"],"x_google_ignoreList":[5,6,7],"mappings":";;;;;;;;;;;;;;;aACa,KAAsC,GAMtC,KAAwC,SACxC,IAA+B,UAC/B,IAAwC,WACxC,KAA2C,SCClD,IAAyB,iCACzB,KAAiB;AAEvB,SAAS,EAAyB,GAAwB;CAEzD,OADI,CAAC,KAAS,EAAM,WAAW,G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EAAM;KAAM,QAAQ,EAAM;IAAO;IAC1E,UAAU;KACT,QAAQ,GAAwB,EAAS,MAAM;KAC/C,MAAM,EAAS;KACf,QAAQ,EAAS,SAAS;KAC1B,GAAI,EAAS,OAAO,EAAE,MAAM,EAAS,KAAK,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC;IAC9D;IACA,GAAI,IAAgB,EAAE,iBAAc,IAAI,CAAC;GAC1C;GAEA,AADA,EAAa,KAAK,CAAa,GAC/B,EAAW,EAAM,aAAa,GAAuB,GAAO,CAAa;EAC1E;EAEA,IAAM,IAAmB,EAAa,MAAM,MAAU,EAAM,aAAa,KAAA,CAAS;EAClF,OAAO;GACN,QAAQ,KAAU,CAAC,IAAmB,WAAW;GACjD,GAAI,IAAmB,EAAE,YAAY,EAAW,KAAK,IAAI,CAAC,CAAC,MAAM,GAAG,EAA6B,EAAE,IAAI,CAAC;GACxG,QAAQ;EACT;CACD,QAAQ;EACP,OAAO;GAAE,QAAQ;GAAU,QAAQ;EAAgB;CACpD;AACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["sortComparator","resolveUri"],"sources":["../../src/error-report-source-maps/types.ts","../../src/error-report-source-maps/manifest.ts","../../src/error-report-source-maps/artifact.ts","../../src/error-report-source-maps/archive.ts","../../src/error-report-source-maps/package.ts","../../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs","../../node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js","../../node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs","../../src/error-report-source-maps/symbolicate.ts"],"sourcesContent":["/** Версия immutable manifest, общего для build packager и server reader. */\nexport const PRIVATE_SOURCE_MAP_MANIFEST_VERSION = 1 as const;\n\n/**\n * Лимиты едины для build и runtime: packager не должен создавать artifact,\n * который server reader затем не сможет безопасно прочитать.\n */\nexport const PRIVATE_SOURCE_MAP_MANIFEST_MAX_BYTES = 2 * 1024 * 1024;\nexport const PRIVATE_SOURCE_MAP_MAX_BYTES = 32 * 1024 * 1024;\nexport const PRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES = 256 * 1024 * 1024;\nexport const PRIVATE_SOURCE_MAP_ARTIFACT_RETENTION_MS = 97 * 24 * 60 * 60 * 1_000;\n\nexport type PrivateSourceMapManifestEntry = {\n\treadonly kind: \"client\" | \"server\";\n\treadonly bundle: string;\n\treadonly map: string;\n\treadonly sha256: string;\n\treadonly size: number;\n};\n\nexport type PrivateSourceMapManifest = {\n\treadonly version: typeof PRIVATE_SOURCE_MAP_MANIFEST_VERSION;\n\treadonly application: string;\n\treadonly buildId: string;\n\treadonly createdUtc: string;\n\treadonly entries: readonly PrivateSourceMapManifestEntry[];\n};\n\nexport type LoadedPrivateSourceMapArtifact = {\n\treadonly buildDirectory: string;\n\treadonly manifest: PrivateSourceMapManifest;\n\treadonly entriesByBundle: ReadonlyMap<string, PrivateSourceMapManifestEntry>;\n};\n\nexport type ErrorReportSourceContextLine = {\n\treadonly line: number;\n\treadonly content: string;\n\treadonly focus: boolean;\n};\n\nexport type ErrorReportStackFrame = {\n\treadonly functionName?: string;\n\treadonly generated: {\n\t\treadonly source: string;\n\t\treadonly line: number;\n\t\treadonly column: number;\n\t};\n\treadonly original?: {\n\t\treadonly source: string;\n\t\treadonly line: number;\n\t\treadonly column: number;\n\t\treadonly name?: string;\n\t};\n\treadonly sourceContext?: readonly ErrorReportSourceContextLine[];\n};\n\nexport type ErrorReportSymbolicationResult = {\n\treadonly status: \"not-required\" | \"resolved\" | \"maps-unavailable\" | \"failed\";\n\treadonly stackTrace?: string;\n\treadonly frames?: readonly ErrorReportStackFrame[];\n};\n\nexport type PackageErrorReportSourceMapsOptions = {\n\treadonly outputRoot: string;\n\treadonly artifactRoot: string;\n\t/** Staging вне outputRoot нужен, когда Nitro очищает свой output после client build. */\n\treadonly clientSourceMapStagingRoot?: string;\n\treadonly application: string;\n\treadonly buildId: string;\n\treadonly createdUtc?: string;\n};\n\nexport type PrivateSourceMapArchiveOptions = {\n\treadonly archiveRoot: string;\n\treadonly seedRoot?: string;\n\treadonly application: string;\n\treadonly buildId: string;\n\treadonly now?: () => Date;\n\treadonly onError?: (error: unknown) => void;\n};\n\nexport type SymbolicateErrorReportStackOptions = {\n\treadonly artifactRoots?: readonly string[];\n};\n","import { z } from \"zod\";\n\nimport { ERROR_REPORT_BUILD_ID_PATTERN } from \"../error-report-build\";\n\nimport {\n\tPRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES,\n\tPRIVATE_SOURCE_MAP_MANIFEST_VERSION,\n\tPRIVATE_SOURCE_MAP_MAX_BYTES,\n\ttype PrivateSourceMapManifest\n} from \"./types\";\n\nconst APPLICATION_ID_PATTERN = /^[a-z0-9]+(?:[.-][a-z0-9]+)*$/;\nconst SHA256_PATTERN = /^[0-9a-f]{64}$/;\n\nfunction isNormalizedRelativePath(value: string): boolean {\n\tif (!value || value.startsWith(\"/\") || value.includes(\"\\\\\") || value.includes(\"\\0\")) return false;\n\treturn value.split(\"/\").every((segment) => segment !== \"\" && segment !== \".\" && segment !== \"..\");\n}\n\nfunction isNormalizedBundlePath(value: string, kind: \"client\" | \"server\"): boolean {\n\tif (value.includes(\"\\\\\") || value.includes(\"\\0\") || value.includes(\"?\") || value.includes(\"#\")) return false;\n\tif (kind === \"client\") return value.startsWith(\"/\") && isNormalizedRelativePath(value.slice(1));\n\treturn value.startsWith(\"server/\") && isNormalizedRelativePath(value);\n}\n\nconst privateSourceMapManifestEntrySchema = z\n\t.object({\n\t\tkind: z.enum([\"client\", \"server\"]),\n\t\tbundle: z.string().max(1_024),\n\t\tmap: z.string().max(1_024),\n\t\tsha256: z.string().regex(SHA256_PATTERN),\n\t\tsize: z.number().int().positive().max(PRIVATE_SOURCE_MAP_MAX_BYTES)\n\t})\n\t.strict()\n\t.superRefine((entry, context) => {\n\t\tif (!isNormalizedBundlePath(entry.bundle, entry.kind)) {\n\t\t\tcontext.addIssue({ code: \"custom\", path: [\"bundle\"], message: \"Bundle path должен быть нормализован.\" });\n\t\t}\n\t\tif (!isNormalizedRelativePath(entry.map) || !entry.map.startsWith(`${entry.kind}/`) || !entry.map.endsWith(\".map\")) {\n\t\t\tcontext.addIssue({ code: \"custom\", path: [\"map\"], message: \"Map path должен оставаться внутри kind-каталога.\" });\n\t\t}\n\t});\n\nconst privateSourceMapManifestSchema = z\n\t.object({\n\t\tversion: z.literal(PRIVATE_SOURCE_MAP_MANIFEST_VERSION),\n\t\tapplication: z.string().min(1).max(128).regex(APPLICATION_ID_PATTERN),\n\t\tbuildId: z.string().regex(ERROR_REPORT_BUILD_ID_PATTERN),\n\t\tcreatedUtc: z.iso.datetime({ offset: true }),\n\t\tentries: z.array(privateSourceMapManifestEntrySchema).max(10_000)\n\t})\n\t.strict()\n\t.superRefine((manifest, context) => {\n\t\tconst bundles = new Set<string>();\n\t\tconst maps = new Set<string>();\n\t\tlet totalBytes = 0;\n\t\tfor (const [index, entry] of manifest.entries.entries()) {\n\t\t\tif (bundles.has(entry.bundle)) {\n\t\t\t\tcontext.addIssue({ code: \"custom\", path: [\"entries\", index, \"bundle\"], message: \"Bundle должен быть уникальным.\" });\n\t\t\t}\n\t\t\tif (maps.has(entry.map)) {\n\t\t\t\tcontext.addIssue({ code: \"custom\", path: [\"entries\", index, \"map\"], message: \"Map path должен быть уникальным.\" });\n\t\t\t}\n\t\t\tbundles.add(entry.bundle);\n\t\t\tmaps.add(entry.map);\n\t\t\ttotalBytes += entry.size;\n\t\t}\n\t\tif (totalBytes > PRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES) {\n\t\t\tcontext.addIssue({ code: \"custom\", path: [\"entries\"], message: \"Private source-map artifact превышает общий предел.\" });\n\t\t}\n\t});\n\n/** Проверяет manifest до любого обращения к указанным в нём файлам. */\nexport function parsePrivateSourceMapManifest(value: unknown): PrivateSourceMapManifest | null {\n\tconst parsed = privateSourceMapManifestSchema.safeParse(value);\n\treturn parsed.success ? parsed.data : null;\n}\n\n/** Проверяет недоверенные application/build path segments до filesystem access. */\nexport function isPrivateSourceMapApplicationId(value: unknown): value is string {\n\treturn typeof value === \"string\" && value.length <= 128 && APPLICATION_ID_PATTERN.test(value);\n}\n\nexport function isErrorReportBuildId(value: unknown): value is string {\n\treturn typeof value === \"string\" && ERROR_REPORT_BUILD_ID_PATTERN.test(value);\n}\n","import { isErrorReportBuildId, isPrivateSourceMapApplicationId, parsePrivateSourceMapManifest } from \"./manifest\";\nimport { PRIVATE_SOURCE_MAP_MANIFEST_MAX_BYTES, type LoadedPrivateSourceMapArtifact, type PrivateSourceMapManifestEntry } from \"./types\";\n\nimport { createHash } from \"node:crypto\";\nimport { lstat, readFile, realpath } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport class PrivateSourceMapArtifactError extends Error {\n\tpublic constructor() {\n\t\tsuper(\"Private source-map artifact не прошёл проверку целостности.\");\n\t\tthis.name = \"PrivateSourceMapArtifactError\";\n\t}\n}\n\nfunction isMissingFileError(error: unknown): boolean {\n\treturn error instanceof Error && \"code\" in error && error.code === \"ENOENT\";\n}\n\nfunction isPathInside(parent: string, candidate: string): boolean {\n\tconst relativePath = path.relative(parent, candidate);\n\treturn relativePath !== \"\" && !relativePath.startsWith(\"..\") && !path.isAbsolute(relativePath);\n}\n\nasync function readBoundedRegularFile(filePath: string, buildDirectory: string, maxBytes: number): Promise<Buffer> {\n\tconst fileInfo = await lstat(filePath);\n\tif (!fileInfo.isFile() || fileInfo.isSymbolicLink() || fileInfo.size <= 0 || fileInfo.size > maxBytes) {\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n\tconst resolvedFilePath = await realpath(filePath);\n\tif (!isPathInside(buildDirectory, resolvedFilePath)) throw new PrivateSourceMapArtifactError();\n\tconst content = await readFile(resolvedFilePath);\n\tif (content.byteLength !== fileInfo.size) throw new PrivateSourceMapArtifactError();\n\treturn content;\n}\n\n/** Загружает manifest только из каталога точного application/build ID. */\nexport async function loadPrivateSourceMapArtifact(\n\troot: string,\n\tapplication: string,\n\tbuildId: string\n): Promise<LoadedPrivateSourceMapArtifact | null> {\n\tif (!isPrivateSourceMapApplicationId(application) || !isErrorReportBuildId(buildId)) throw new PrivateSourceMapArtifactError();\n\n\tlet resolvedRoot: string;\n\tlet buildDirectory: string;\n\ttry {\n\t\tresolvedRoot = await realpath(path.resolve(root));\n\t\tbuildDirectory = await realpath(path.join(resolvedRoot, application, buildId));\n\t} catch (error) {\n\t\tif (isMissingFileError(error)) return null;\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n\tif (!isPathInside(resolvedRoot, buildDirectory)) throw new PrivateSourceMapArtifactError();\n\n\tlet manifestContent: Buffer;\n\ttry {\n\t\tmanifestContent = await readBoundedRegularFile(\n\t\t\tpath.join(buildDirectory, \"manifest.json\"),\n\t\t\tbuildDirectory,\n\t\t\tPRIVATE_SOURCE_MAP_MANIFEST_MAX_BYTES\n\t\t);\n\t} catch (error) {\n\t\tif (isMissingFileError(error)) return null;\n\t\tif (error instanceof PrivateSourceMapArtifactError) throw error;\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n\n\tlet rawManifest: unknown;\n\ttry {\n\t\trawManifest = JSON.parse(manifestContent.toString(\"utf8\"));\n\t} catch {\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n\tconst manifest = parsePrivateSourceMapManifest(rawManifest);\n\tif (!manifest || manifest.application !== application || manifest.buildId !== buildId) throw new PrivateSourceMapArtifactError();\n\n\treturn {\n\t\tbuildDirectory,\n\t\tmanifest,\n\t\tentriesByBundle: new Map(manifest.entries.map((entry) => [entry.bundle, entry]))\n\t};\n}\n\n/** Читает карту только после size/hash verification из manifest. */\nexport async function readPrivateSourceMap(\n\tartifact: LoadedPrivateSourceMapArtifact,\n\tentry: PrivateSourceMapManifestEntry\n): Promise<string> {\n\ttry {\n\t\tconst content = await readBoundedRegularFile(path.join(artifact.buildDirectory, entry.map), artifact.buildDirectory, entry.size);\n\t\tif (content.byteLength !== entry.size || createHash(\"sha256\").update(content).digest(\"hex\") !== entry.sha256) {\n\t\t\tthrow new PrivateSourceMapArtifactError();\n\t\t}\n\t\treturn content.toString(\"utf8\");\n\t} catch (error) {\n\t\tif (error instanceof PrivateSourceMapArtifactError) throw error;\n\t\tthrow new PrivateSourceMapArtifactError();\n\t}\n}\n","import { loadPrivateSourceMapArtifact, readPrivateSourceMap } from \"./artifact\";\nimport { isErrorReportBuildId } from \"./manifest\";\nimport {\n\tPRIVATE_SOURCE_MAP_ARTIFACT_RETENTION_MS,\n\ttype LoadedPrivateSourceMapArtifact,\n\ttype PrivateSourceMapArchiveOptions\n} from \"./types\";\n\nimport { mkdir, readdir, rename, rm, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nconst ARCHIVE_MAINTENANCE_INTERVAL_MS = 24 * 60 * 60 * 1_000;\n\nasync function copyArtifact(\n\tartifact: LoadedPrivateSourceMapArtifact,\n\tarchiveRoot: string,\n\tapplication: string,\n\tbuildId: string\n): Promise<void> {\n\tconst applicationDirectory = path.join(path.resolve(archiveRoot), application);\n\tconst buildDirectory = path.join(applicationDirectory, buildId);\n\tconst temporaryDirectory = path.join(applicationDirectory, `.${buildId}.tmp-${process.pid}`);\n\tawait mkdir(applicationDirectory, { recursive: true });\n\tawait rm(temporaryDirectory, { force: true, recursive: true });\n\tawait mkdir(temporaryDirectory, { recursive: false });\n\n\ttry {\n\t\tfor (const entry of artifact.manifest.entries) {\n\t\t\tconst content = await readPrivateSourceMap(artifact, entry);\n\t\t\tconst targetPath = path.join(temporaryDirectory, entry.map);\n\t\t\tawait mkdir(path.dirname(targetPath), { recursive: true });\n\t\t\tawait writeFile(targetPath, content, { encoding: \"utf8\", flag: \"wx\" });\n\t\t}\n\t\tawait writeFile(path.join(temporaryDirectory, \"manifest.json\"), `${JSON.stringify(artifact.manifest, null, 2)}\\n`, {\n\t\t\tencoding: \"utf8\",\n\t\t\tflag: \"wx\"\n\t\t});\n\t\tawait rename(temporaryDirectory, buildDirectory);\n\t} catch (error) {\n\t\tawait rm(temporaryDirectory, { force: true, recursive: true });\n\t\tconst concurrentlyInstalled = await loadPrivateSourceMapArtifact(archiveRoot, application, buildId).catch(() => null);\n\t\tif (!concurrentlyInstalled) throw error;\n\t}\n}\n\n/** Устанавливает seed и удаляет только валидные завершённые artifacts старше retention. */\nexport async function maintainPrivateSourceMapArchive(options: PrivateSourceMapArchiveOptions): Promise<void> {\n\tif (!isErrorReportBuildId(options.buildId)) return;\n\tawait mkdir(options.archiveRoot, { recursive: true });\n\n\tconst existing = await loadPrivateSourceMapArtifact(options.archiveRoot, options.application, options.buildId);\n\tconst seed = options.seedRoot ? await loadPrivateSourceMapArtifact(options.seedRoot, options.application, options.buildId) : null;\n\tif (existing && seed && JSON.stringify(existing.manifest.entries) !== JSON.stringify(seed.manifest.entries)) {\n\t\tthrow new Error(\"Persistent source-map artifact не совпадает с image seed для того же build ID.\");\n\t}\n\tif (!existing && seed) await copyArtifact(seed, options.archiveRoot, options.application, options.buildId);\n\n\tconst applicationDirectory = path.join(path.resolve(options.archiveRoot), options.application);\n\tawait mkdir(applicationDirectory, { recursive: true });\n\tconst now = (options.now ?? (() => new Date()))().getTime();\n\tfor (const entry of await readdir(applicationDirectory, { withFileTypes: true })) {\n\t\tif (!entry.isDirectory() || !isErrorReportBuildId(entry.name) || entry.name === options.buildId) continue;\n\t\ttry {\n\t\t\tconst artifact = await loadPrivateSourceMapArtifact(options.archiveRoot, options.application, entry.name);\n\t\t\tif (!artifact) continue;\n\t\t\tconst createdAt = Date.parse(artifact.manifest.createdUtc);\n\t\t\tif (Number.isFinite(createdAt) && createdAt + PRIVATE_SOURCE_MAP_ARTIFACT_RETENTION_MS <= now) {\n\t\t\t\tawait rm(artifact.buildDirectory, { recursive: true });\n\t\t\t}\n\t\t} catch {\n\t\t\t// Повреждённый artifact сохраняется как forensic evidence.\n\t\t}\n\t}\n}\n\n/** Запускает bounded daily maintenance и возвращает явный cleanup timer. */\nexport function startPrivateSourceMapArchiveMaintenance(options: PrivateSourceMapArchiveOptions): () => void {\n\tconst run = () => void maintainPrivateSourceMapArchive(options).catch((error: unknown) => options.onError?.(error));\n\trun();\n\tconst timer = setInterval(run, ARCHIVE_MAINTENANCE_INTERVAL_MS);\n\ttimer.unref();\n\treturn () => clearInterval(timer);\n}\n","import { isErrorReportBuildId, isPrivateSourceMapApplicationId } from \"./manifest\";\nimport {\n\tPRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES,\n\tPRIVATE_SOURCE_MAP_MANIFEST_VERSION,\n\tPRIVATE_SOURCE_MAP_MAX_BYTES,\n\ttype PackageErrorReportSourceMapsOptions,\n\ttype PrivateSourceMapManifest,\n\ttype PrivateSourceMapManifestEntry\n} from \"./types\";\n\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, readdir, rename, rm, stat, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nconst SOURCE_MAP_REFERENCE_PATTERN = /(?:\\/\\*[#@]\\s*sourceMappingURL=[^*]*\\*\\/|\\/\\/[#@]\\s*sourceMappingURL=.*)$/gm;\nconst PUBLIC_TEXT_ASSET_PATTERN = /\\.(?:css|html|js|mjs)$/;\nconst NITRO_PUBLIC_SOURCE_MAP_ENTRY_PATTERN = /\"(\\/[^\"\\n]+\\.map)\"\\s*:\\s*\\{/;\n\n/** Временное расположение client maps между client и Nitro server build. */\nexport const STAGED_CLIENT_SOURCE_MAP_DIRECTORY = \".private-source-maps-staging/client\";\n\nasync function listFiles(directory: string, skippedPaths: ReadonlySet<string> = new Set()): Promise<string[]> {\n\tconst files: string[] = [];\n\tfor (const entry of await readdir(directory, { withFileTypes: true })) {\n\t\tconst entryPath = path.join(directory, entry.name);\n\t\tif (skippedPaths.has(path.resolve(entryPath))) continue;\n\t\tif (entry.isSymbolicLink()) throw new Error(`Build output содержит недопустимую symbolic link: ${entryPath}`);\n\t\tif (entry.isDirectory()) files.push(...(await listFiles(entryPath, skippedPaths)));\n\t\telse if (entry.isFile()) files.push(entryPath);\n\t}\n\treturn files.sort((left, right) => left.localeCompare(right));\n}\n\nfunction validateSourceMap(content: Buffer, filePath: string): void {\n\tif (content.byteLength === 0 || content.byteLength > PRIVATE_SOURCE_MAP_MAX_BYTES) {\n\t\tthrow new Error(`Source map выходит за предел ${PRIVATE_SOURCE_MAP_MAX_BYTES} bytes: ${filePath}`);\n\t}\n\tlet sourceMap: unknown;\n\ttry {\n\t\tsourceMap = JSON.parse(content.toString(\"utf8\"));\n\t} catch {\n\t\tthrow new Error(`Source map содержит некорректный JSON: ${filePath}`);\n\t}\n\tif (!sourceMap || typeof sourceMap !== \"object\" || !(\"version\" in sourceMap) || sourceMap.version !== 3) {\n\t\tthrow new Error(`Source map имеет неподдерживаемый формат: ${filePath}`);\n\t}\n\tconst sources = \"sources\" in sourceMap ? sourceMap.sources : undefined;\n\tconst sourcesContent = \"sourcesContent\" in sourceMap ? sourceMap.sourcesContent : undefined;\n\tif (!Array.isArray(sources)) throw new Error(`Source map не содержит список sources: ${filePath}`);\n\t// Nitro вправе не встраивать исходный текст в server maps. Координаты и\n\t// имена кадров при этом восстанавливаются, а source context просто остаётся\n\t// недоступным. Если sourcesContent присутствует, проверяем его целостность.\n\tif (sourcesContent !== undefined && (!Array.isArray(sourcesContent) || sourcesContent.length !== sources.length)) {\n\t\tthrow new Error(`Source map содержит неполный sourcesContent: ${filePath}`);\n\t}\n}\n\nfunction resolveArtifactPaths(\n\toutputRoot: string,\n\tclientSourceMapStagingRoot: string,\n\tmapPath: string\n): Pick<PrivateSourceMapManifestEntry, \"kind\" | \"bundle\" | \"map\"> {\n\tconst publicRoot = path.join(outputRoot, \"public\");\n\tconst serverRoot = path.join(outputRoot, \"server\");\n\tconst relativeToPublic = path.relative(publicRoot, mapPath);\n\tif (relativeToPublic && !relativeToPublic.startsWith(\"..\") && !path.isAbsolute(relativeToPublic)) {\n\t\tconst normalizedMap = relativeToPublic.split(path.sep).join(\"/\");\n\t\treturn { kind: \"client\", bundle: `/${normalizedMap.slice(0, -\".map\".length)}`, map: `client/${normalizedMap}` };\n\t}\n\tconst relativeToStagedClient = path.relative(clientSourceMapStagingRoot, mapPath);\n\tif (relativeToStagedClient && !relativeToStagedClient.startsWith(\"..\") && !path.isAbsolute(relativeToStagedClient)) {\n\t\tconst normalizedMap = relativeToStagedClient.split(path.sep).join(\"/\");\n\t\treturn { kind: \"client\", bundle: `/${normalizedMap.slice(0, -\".map\".length)}`, map: `client/${normalizedMap}` };\n\t}\n\tconst relativeToServer = path.relative(serverRoot, mapPath);\n\tif (relativeToServer && !relativeToServer.startsWith(\"..\") && !path.isAbsolute(relativeToServer)) {\n\t\tconst normalizedMap = relativeToServer.split(path.sep).join(\"/\");\n\t\treturn { kind: \"server\", bundle: `server/${normalizedMap.slice(0, -\".map\".length)}`, map: `server/${normalizedMap}` };\n\t}\n\tthrow new Error(`Source map находится вне public/server output: ${mapPath}`);\n}\n\nasync function stripSourceMapReferences(filePath: string): Promise<void> {\n\tconst source = await readFile(filePath, \"utf8\");\n\tconst withoutReferences = source.replace(SOURCE_MAP_REFERENCE_PATTERN, \"\");\n\tif (withoutReferences !== source) await writeFile(filePath, withoutReferences, \"utf8\");\n}\n\n/** Извлекает клиентские карты до формирования Nitro static asset manifest. */\nexport async function stageClientSourceMapsForNitro(\n\toutputRoot: string,\n\toptions: { readonly publicRoot?: string; readonly clientSourceMapStagingRoot?: string } = {}\n): Promise<number> {\n\tconst resolvedOutputRoot = path.resolve(outputRoot);\n\tconst publicRoot = path.resolve(options.publicRoot ?? path.join(resolvedOutputRoot, \"public\"));\n\tconst stagingRoot = path.resolve(\n\t\toptions.clientSourceMapStagingRoot ?? path.join(resolvedOutputRoot, STAGED_CLIENT_SOURCE_MAP_DIRECTORY)\n\t);\n\tconst publicFiles = await listFiles(publicRoot);\n\tconst sourceMapFiles = publicFiles.filter((filePath) => filePath.endsWith(\".map\"));\n\tfor (const mapFile of sourceMapFiles) {\n\t\tconst relativePath = path.relative(publicRoot, mapFile);\n\t\tconst stagedPath = path.join(stagingRoot, relativePath);\n\t\tawait mkdir(path.dirname(stagedPath), { recursive: true });\n\t\tawait rename(mapFile, stagedPath);\n\t}\n\tfor (const filePath of publicFiles) {\n\t\tif (!filePath.endsWith(\".map\") && PUBLIC_TEXT_ASSET_PATTERN.test(filePath)) await stripSourceMapReferences(filePath);\n\t}\n\treturn sourceMapFiles.length;\n}\n\n/** Проверяет скомпилированный Nitro manifest, а не только оставшиеся файлы. */\nexport async function assertNoNitroSourceMapManifestLeaks(serverEntryPath: string): Promise<void> {\n\tconst serverEntry = await readFile(serverEntryPath, \"utf8\");\n\tconst leakedEntry = NITRO_PUBLIC_SOURCE_MAP_ENTRY_PATTERN.exec(serverEntry)?.[1];\n\tif (leakedEntry) throw new Error(`Nitro static asset manifest содержит source map: ${leakedEntry}`);\n}\n\n/** Доказывает отсутствие карт и sourceMappingURL в public output. */\nexport async function assertNoPublicSourceMapLeaks(publicRoot: string): Promise<void> {\n\tfor (const filePath of await listFiles(publicRoot)) {\n\t\tif (filePath.endsWith(\".map\")) throw new Error(`Public output содержит source map: ${filePath}`);\n\t\tif (!PUBLIC_TEXT_ASSET_PATTERN.test(filePath)) continue;\n\t\tconst source = await readFile(filePath, \"utf8\");\n\t\tif (source.includes(\"sourceMappingURL\")) throw new Error(`Public output содержит sourceMappingURL: ${filePath}`);\n\t}\n}\n\n/** Извлекает карты из multi-environment output в immutable private artifact. */\nexport async function packageErrorReportSourceMaps(options: PackageErrorReportSourceMapsOptions): Promise<PrivateSourceMapManifest> {\n\tif (!isPrivateSourceMapApplicationId(options.application) || !isErrorReportBuildId(options.buildId)) {\n\t\tthrow new Error(\"Application или build ID private source-map artifact недопустим.\");\n\t}\n\tconst outputRoot = path.resolve(options.outputRoot);\n\tconst artifactRoot = path.resolve(options.artifactRoot);\n\tconst clientSourceMapStagingRoot = path.resolve(\n\t\toptions.clientSourceMapStagingRoot ?? path.join(outputRoot, STAGED_CLIENT_SOURCE_MAP_DIRECTORY)\n\t);\n\tconst buildDirectory = path.join(artifactRoot, options.application, options.buildId);\n\tconst temporaryBuildDirectory = `${buildDirectory}.tmp-${process.pid}`;\n\t// Nitro v2 создаёт служебное dependency tree с допустимыми package-manager\n\t// symlink. Оно не является исполняемым bundle output и не участвует в maps.\n\tconst outputFiles = await listFiles(outputRoot, new Set([path.resolve(outputRoot, \"server/node_modules\")]));\n\tconst stagingIsInsideOutput = (() => {\n\t\tconst relative = path.relative(outputRoot, clientSourceMapStagingRoot);\n\t\treturn relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n\t})();\n\tconst stagedClientFiles = stagingIsInsideOutput ? [] : await listFiles(clientSourceMapStagingRoot);\n\tconst mapFiles = [...outputFiles, ...stagedClientFiles].filter((filePath) => filePath.endsWith(\".map\"));\n\tif (mapFiles.length === 0) throw new Error(\"Production build не создал private source maps.\");\n\n\tawait rm(temporaryBuildDirectory, { force: true, recursive: true });\n\tawait mkdir(temporaryBuildDirectory, { recursive: true });\n\tconst entries: PrivateSourceMapManifestEntry[] = [];\n\tlet totalBytes = 0;\n\ttry {\n\t\tfor (const mapFile of mapFiles) {\n\t\t\tconst content = await readFile(mapFile);\n\t\t\tvalidateSourceMap(content, mapFile);\n\t\t\ttotalBytes += content.byteLength;\n\t\t\tif (totalBytes > PRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES) {\n\t\t\t\tthrow new Error(`Private source-map artifact превышает ${PRIVATE_SOURCE_MAP_ARTIFACT_MAX_BYTES} bytes.`);\n\t\t\t}\n\t\t\tconst artifactPaths = resolveArtifactPaths(outputRoot, clientSourceMapStagingRoot, mapFile);\n\t\t\tconst targetPath = path.join(temporaryBuildDirectory, artifactPaths.map);\n\t\t\tawait mkdir(path.dirname(targetPath), { recursive: true });\n\t\t\tawait writeFile(targetPath, content, { flag: \"wx\" });\n\t\t\tentries.push({\n\t\t\t\t...artifactPaths,\n\t\t\t\tsha256: createHash(\"sha256\").update(content).digest(\"hex\"),\n\t\t\t\tsize: content.byteLength\n\t\t\t});\n\t\t}\n\t\tif (!entries.some((entry) => entry.kind === \"client\")) throw new Error(\"Private source-map artifact не содержит client maps.\");\n\t\tif (!entries.some((entry) => entry.kind === \"server\")) throw new Error(\"Private source-map artifact не содержит server maps.\");\n\t\tentries.sort((left, right) => left.bundle.localeCompare(right.bundle));\n\t\tconst manifest: PrivateSourceMapManifest = {\n\t\t\tversion: PRIVATE_SOURCE_MAP_MANIFEST_VERSION,\n\t\t\tapplication: options.application,\n\t\t\tbuildId: options.buildId,\n\t\t\tcreatedUtc: options.createdUtc ?? new Date().toISOString(),\n\t\t\tentries\n\t\t};\n\t\tawait writeFile(path.join(temporaryBuildDirectory, \"manifest.json\"), `${JSON.stringify(manifest, null, 2)}\\n`, {\n\t\t\tencoding: \"utf8\",\n\t\t\tflag: \"wx\"\n\t\t});\n\t\tawait rm(buildDirectory, { force: true, recursive: true });\n\t\tawait mkdir(path.dirname(buildDirectory), { recursive: true });\n\t\tawait rename(temporaryBuildDirectory, buildDirectory);\n\t\tfor (const mapFile of mapFiles) await unlink(mapFile);\n\t\tfor (const filePath of outputFiles) {\n\t\t\tif (!filePath.endsWith(\".map\") && PUBLIC_TEXT_ASSET_PATTERN.test(filePath)) await stripSourceMapReferences(filePath);\n\t\t}\n\t\tawait assertNoPublicSourceMapLeaks(path.join(outputRoot, \"public\"));\n\t\tawait assertNoNitroSourceMapManifestLeaks(path.join(outputRoot, \"server/index.mjs\"));\n\t\tconst manifestStat = await stat(path.join(buildDirectory, \"manifest.json\"));\n\t\tif (!manifestStat.isFile()) throw new Error(\"Private source-map manifest не был создан.\");\n\t\treturn manifest;\n\t} catch (error) {\n\t\tawait rm(temporaryBuildDirectory, { force: true, recursive: true });\n\t\tthrow error;\n\t}\n}\n","// src/vlq.ts\nvar comma = \",\".charCodeAt(0);\nvar semicolon = \";\".charCodeAt(0);\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar intToChar = new Uint8Array(64);\nvar charToInt = new Uint8Array(128);\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\nfunction decodeInteger(reader, relative) {\n let value = 0;\n let shift = 0;\n let integer = 0;\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n const shouldNegate = value & 1;\n value >>>= 1;\n if (shouldNegate) {\n value = -2147483648 | -value;\n }\n return relative + value;\n}\nfunction encodeInteger(builder, num, relative) {\n let delta = num - relative;\n delta = delta < 0 ? -delta << 1 | 1 : delta << 1;\n do {\n let clamped = delta & 31;\n delta >>>= 5;\n if (delta > 0) clamped |= 32;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n return num;\n}\nfunction hasMoreVlq(reader, max) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n\n// src/strings.ts\nvar bufLength = 1024 * 16;\nvar td = typeof TextDecoder !== \"undefined\" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== \"undefined\" ? {\n decode(buf) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n }\n} : {\n decode(buf) {\n let out = \"\";\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n }\n};\nvar StringWriter = class {\n constructor() {\n this.pos = 0;\n this.out = \"\";\n this.buffer = new Uint8Array(bufLength);\n }\n write(v) {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n flush() {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n};\nvar StringReader = class {\n constructor(buffer) {\n this.pos = 0;\n this.buffer = buffer;\n }\n next() {\n return this.buffer.charCodeAt(this.pos++);\n }\n peek() {\n return this.buffer.charCodeAt(this.pos);\n }\n indexOf(char) {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n};\n\n// src/scopes.ts\nvar EMPTY = [];\nfunction decodeOriginalScopes(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes = [];\n const stack = [];\n let line = 0;\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop();\n last[2] = line;\n last[3] = column;\n continue;\n }\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 1;\n const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];\n let vars = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n scopes.push(scope);\n stack.push(scope);\n }\n return scopes;\n}\nfunction encodeOriginalScopes(scopes) {\n const writer = new StringWriter();\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n return writer.flush();\n}\nfunction _encodeOriginalScopes(scopes, index, writer, state) {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n if (index > 0) writer.write(comma);\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n const fields = scope.length === 6 ? 1 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n return index;\n}\nfunction decodeGeneratedRanges(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges = [];\n const stack = [];\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n do {\n const semi = reader.indexOf(\";\");\n let genColumn = 0;\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop();\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 1;\n const hasCallsite = fields & 2;\n const hasScope = fields & 4;\n let callsite = null;\n let bindings = EMPTY;\n let range;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0\n );\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];\n } else {\n range = [genLine, genColumn, 0, 0];\n }\n range.isScope = !!hasScope;\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0\n );\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges;\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n ranges.push(range);\n stack.push(range);\n }\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n return ranges;\n}\nfunction encodeGeneratedRanges(ranges) {\n if (ranges.length === 0) return \"\";\n const writer = new StringWriter();\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n return writer.flush();\n}\nfunction _encodeGeneratedRanges(ranges, index, writer, state) {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings\n } = range;\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, range[1], state[1]);\n const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);\n encodeInteger(writer, fields, 0);\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);\n encodeInteger(writer, expRange[0], 0);\n }\n }\n }\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n return index;\n}\nfunction catchupLine(writer, lastLine, line) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n\n// src/sourcemap-codec.ts\nfunction decode(mappings) {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n do {\n const semi = reader.indexOf(\";\");\n const line = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n while (reader.pos < semi) {\n let seg;\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n line.push(seg);\n reader.pos++;\n }\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n return decoded;\n}\nfunction sort(line) {\n line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[0] - b[0];\n}\nfunction encode(decoded) {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n let genColumn = 0;\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n genColumn = encodeInteger(writer, segment[0], genColumn);\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n return writer.flush();\n}\nexport {\n decode,\n decodeGeneratedRanges,\n decodeOriginalScopes,\n encode,\n encodeGeneratedRanges,\n encodeOriginalScopes\n};\n//# sourceMappingURL=sourcemap-codec.mjs.map\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory());\n})(this, (function () { 'use strict';\n\n // Matches the scheme of a URL, eg \"http://\"\n const schemeRegex = /^[\\w+.-]+:\\/\\//;\n /**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\n const urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n /**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\n const fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n function isAbsoluteUrl(input) {\n return schemeRegex.test(input);\n }\n function isSchemeRelativeUrl(input) {\n return input.startsWith('//');\n }\n function isAbsolutePath(input) {\n return input.startsWith('/');\n }\n function isFileUrl(input) {\n return input.startsWith('file:');\n }\n function isRelative(input) {\n return /^[.?#]/.test(input);\n }\n function parseAbsoluteUrl(input) {\n const match = urlRegex.exec(input);\n return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');\n }\n function parseFileUrl(input) {\n const match = fileRegex.exec(input);\n const path = match[2];\n return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');\n }\n function makeUrl(scheme, user, host, port, path, query, hash) {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: 7 /* Absolute */,\n };\n }\n function parseUrl(input) {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = 6 /* SchemeRelative */;\n return url;\n }\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = 5 /* AbsolutePath */;\n return url;\n }\n if (isFileUrl(input))\n return parseFileUrl(input);\n if (isAbsoluteUrl(input))\n return parseAbsoluteUrl(input);\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? 3 /* Query */\n : input.startsWith('#')\n ? 2 /* Hash */\n : 4 /* RelativePath */\n : 1 /* Empty */;\n return url;\n }\n function stripPathFilename(path) {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..'))\n return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n }\n function mergePaths(url, base) {\n normalizePath(base, base.type);\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n }\n else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n }\n /**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\n function normalizePath(url, type) {\n const rel = type <= 4 /* RelativePath */;\n const pieces = url.path.split('/');\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n // A current directory, which we can always drop.\n if (piece === '.')\n continue;\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n }\n else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n }\n /**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\n function resolve(input, base) {\n if (!input && !base)\n return '';\n const url = parseUrl(input);\n let inputType = url.type;\n if (base && inputType !== 7 /* Absolute */) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n switch (inputType) {\n case 1 /* Empty */:\n url.hash = baseUrl.hash;\n // fall through\n case 2 /* Hash */:\n url.query = baseUrl.query;\n // fall through\n case 3 /* Query */:\n case 4 /* RelativePath */:\n mergePaths(url, baseUrl);\n // fall through\n case 5 /* AbsolutePath */:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n case 6 /* SchemeRelative */:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType)\n inputType = baseType;\n }\n normalizePath(url, inputType);\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n case 2 /* Hash */:\n case 3 /* Query */:\n return queryHash;\n case 4 /* RelativePath */: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n if (!path)\n return queryHash || '.';\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n return path + queryHash;\n }\n case 5 /* AbsolutePath */:\n return url.path + queryHash;\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n }\n\n return resolve;\n\n}));\n//# sourceMappingURL=resolve-uri.umd.js.map\n","// src/trace-mapping.ts\nimport { encode, decode } from \"@jridgewell/sourcemap-codec\";\n\n// src/resolve.ts\nimport resolveUri from \"@jridgewell/resolve-uri\";\n\n// src/strip-filename.ts\nfunction stripFilename(path) {\n if (!path) return \"\";\n const index = path.lastIndexOf(\"/\");\n return path.slice(0, index + 1);\n}\n\n// src/resolve.ts\nfunction resolver(mapUrl, sourceRoot) {\n const from = stripFilename(mapUrl);\n const prefix = sourceRoot ? sourceRoot + \"/\" : \"\";\n return (source) => resolveUri(prefix + (source || \"\"), from);\n}\n\n// src/sourcemap-segment.ts\nvar COLUMN = 0;\nvar SOURCES_INDEX = 1;\nvar SOURCE_LINE = 2;\nvar SOURCE_COLUMN = 3;\nvar NAMES_INDEX = 4;\nvar REV_GENERATED_LINE = 1;\nvar REV_GENERATED_COLUMN = 2;\n\n// src/sort.ts\nfunction maybeSort(mappings, owned) {\n const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);\n if (unsortedIndex === mappings.length) return mappings;\n if (!owned) mappings = mappings.slice();\n for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {\n mappings[i] = sortSegments(mappings[i], owned);\n }\n return mappings;\n}\nfunction nextUnsortedSegmentLine(mappings, start) {\n for (let i = start; i < mappings.length; i++) {\n if (!isSorted(mappings[i])) return i;\n }\n return mappings.length;\n}\nfunction isSorted(line) {\n for (let j = 1; j < line.length; j++) {\n if (line[j][COLUMN] < line[j - 1][COLUMN]) {\n return false;\n }\n }\n return true;\n}\nfunction sortSegments(line, owned) {\n if (!owned) line = line.slice();\n return line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[COLUMN] - b[COLUMN];\n}\n\n// src/by-source.ts\nfunction buildBySources(decoded, memos) {\n const sources = memos.map(() => []);\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n if (seg.length === 1) continue;\n const sourceIndex2 = seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n const source = sources[sourceIndex2];\n const segs = source[sourceLine] || (source[sourceLine] = []);\n segs.push([sourceColumn, i, seg[COLUMN]]);\n }\n }\n for (let i = 0; i < sources.length; i++) {\n const source = sources[i];\n for (let j = 0; j < source.length; j++) {\n const line = source[j];\n if (line) line.sort(sortComparator);\n }\n }\n return sources;\n}\n\n// src/binary-search.ts\nvar found = false;\nfunction binarySearch(haystack, needle, low, high) {\n while (low <= high) {\n const mid = low + (high - low >> 1);\n const cmp = haystack[mid][COLUMN] - needle;\n if (cmp === 0) {\n found = true;\n return mid;\n }\n if (cmp < 0) {\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n found = false;\n return low - 1;\n}\nfunction upperBound(haystack, needle, index) {\n for (let i = index + 1; i < haystack.length; index = i++) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\nfunction lowerBound(haystack, needle, index) {\n for (let i = index - 1; i >= 0; index = i--) {\n if (haystack[i][COLUMN] !== needle) break;\n }\n return index;\n}\nfunction memoizedState() {\n return {\n lastKey: -1,\n lastNeedle: -1,\n lastIndex: -1\n };\n}\nfunction memoizedBinarySearch(haystack, needle, state, key) {\n const { lastKey, lastNeedle, lastIndex } = state;\n let low = 0;\n let high = haystack.length - 1;\n if (key === lastKey) {\n if (needle === lastNeedle) {\n found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;\n return lastIndex;\n }\n if (needle >= lastNeedle) {\n low = lastIndex === -1 ? 0 : lastIndex;\n } else {\n high = lastIndex;\n }\n }\n state.lastKey = key;\n state.lastNeedle = needle;\n return state.lastIndex = binarySearch(haystack, needle, low, high);\n}\n\n// src/types.ts\nfunction parse(map) {\n return typeof map === \"string\" ? JSON.parse(map) : map;\n}\n\n// src/flatten-map.ts\nvar FlattenMap = function(map, mapUrl) {\n const parsed = parse(map);\n if (!(\"sections\" in parsed)) {\n return new TraceMap(parsed, mapUrl);\n }\n const mappings = [];\n const sources = [];\n const sourcesContent = [];\n const names = [];\n const ignoreList = [];\n recurse(\n parsed,\n mapUrl,\n mappings,\n sources,\n sourcesContent,\n names,\n ignoreList,\n 0,\n 0,\n Infinity,\n Infinity\n );\n const joined = {\n version: 3,\n file: parsed.file,\n names,\n sources,\n sourcesContent,\n mappings,\n ignoreList\n };\n return presortedDecodedMap(joined);\n};\nfunction recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {\n const { sections } = input;\n for (let i = 0; i < sections.length; i++) {\n const { map, offset } = sections[i];\n let sl = stopLine;\n let sc = stopColumn;\n if (i + 1 < sections.length) {\n const nextOffset = sections[i + 1].offset;\n sl = Math.min(stopLine, lineOffset + nextOffset.line);\n if (sl === stopLine) {\n sc = Math.min(stopColumn, columnOffset + nextOffset.column);\n } else if (sl < stopLine) {\n sc = columnOffset + nextOffset.column;\n }\n }\n addSection(\n map,\n mapUrl,\n mappings,\n sources,\n sourcesContent,\n names,\n ignoreList,\n lineOffset + offset.line,\n columnOffset + offset.column,\n sl,\n sc\n );\n }\n}\nfunction addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {\n const parsed = parse(input);\n if (\"sections\" in parsed) return recurse(...arguments);\n const map = new TraceMap(parsed, mapUrl);\n const sourcesOffset = sources.length;\n const namesOffset = names.length;\n const decoded = decodedMappings(map);\n const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map;\n append(sources, resolvedSources);\n append(names, map.names);\n if (contents) append(sourcesContent, contents);\n else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);\n if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset);\n for (let i = 0; i < decoded.length; i++) {\n const lineI = lineOffset + i;\n if (lineI > stopLine) return;\n const out = getLine(mappings, lineI);\n const cOffset = i === 0 ? columnOffset : 0;\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n const column = cOffset + seg[COLUMN];\n if (lineI === stopLine && column >= stopColumn) return;\n if (seg.length === 1) {\n out.push([column]);\n continue;\n }\n const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];\n const sourceLine = seg[SOURCE_LINE];\n const sourceColumn = seg[SOURCE_COLUMN];\n out.push(\n seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]\n );\n }\n }\n}\nfunction append(arr, other) {\n for (let i = 0; i < other.length; i++) arr.push(other[i]);\n}\nfunction getLine(arr, index) {\n for (let i = arr.length; i <= index; i++) arr[i] = [];\n return arr[index];\n}\n\n// src/trace-mapping.ts\nvar LINE_GTR_ZERO = \"`line` must be greater than 0 (lines start at line 1)\";\nvar COL_GTR_EQ_ZERO = \"`column` must be greater than or equal to 0 (columns start at column 0)\";\nvar LEAST_UPPER_BOUND = -1;\nvar GREATEST_LOWER_BOUND = 1;\nvar TraceMap = class {\n constructor(map, mapUrl) {\n const isString = typeof map === \"string\";\n if (!isString && map._decodedMemo) return map;\n const parsed = parse(map);\n const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;\n this.version = version;\n this.file = file;\n this.names = names || [];\n this.sourceRoot = sourceRoot;\n this.sources = sources;\n this.sourcesContent = sourcesContent;\n this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;\n const resolve = resolver(mapUrl, sourceRoot);\n this.resolvedSources = sources.map(resolve);\n const { mappings } = parsed;\n if (typeof mappings === \"string\") {\n this._encoded = mappings;\n this._decoded = void 0;\n } else if (Array.isArray(mappings)) {\n this._encoded = void 0;\n this._decoded = maybeSort(mappings, isString);\n } else if (parsed.sections) {\n throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);\n } else {\n throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);\n }\n this._decodedMemo = memoizedState();\n this._bySources = void 0;\n this._bySourceMemos = void 0;\n }\n};\nfunction cast(map) {\n return map;\n}\nfunction encodedMappings(map) {\n var _a, _b;\n return (_b = (_a = cast(map))._encoded) != null ? _b : _a._encoded = encode(cast(map)._decoded);\n}\nfunction decodedMappings(map) {\n var _a;\n return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));\n}\nfunction traceSegment(map, line, column) {\n const decoded = decodedMappings(map);\n if (line >= decoded.length) return null;\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n cast(map)._decodedMemo,\n line,\n column,\n GREATEST_LOWER_BOUND\n );\n return index === -1 ? null : segments[index];\n}\nfunction originalPositionFor(map, needle) {\n let { line, column, bias } = needle;\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n const decoded = decodedMappings(map);\n if (line >= decoded.length) return OMapping(null, null, null, null);\n const segments = decoded[line];\n const index = traceSegmentInternal(\n segments,\n cast(map)._decodedMemo,\n line,\n column,\n bias || GREATEST_LOWER_BOUND\n );\n if (index === -1) return OMapping(null, null, null, null);\n const segment = segments[index];\n if (segment.length === 1) return OMapping(null, null, null, null);\n const { names, resolvedSources } = map;\n return OMapping(\n resolvedSources[segment[SOURCES_INDEX]],\n segment[SOURCE_LINE] + 1,\n segment[SOURCE_COLUMN],\n segment.length === 5 ? names[segment[NAMES_INDEX]] : null\n );\n}\nfunction generatedPositionFor(map, needle) {\n const { source, line, column, bias } = needle;\n return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);\n}\nfunction allGeneratedPositionsFor(map, needle) {\n const { source, line, column, bias } = needle;\n return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);\n}\nfunction eachMapping(map, cb) {\n const decoded = decodedMappings(map);\n const { names, resolvedSources } = map;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n const generatedLine = i + 1;\n const generatedColumn = seg[0];\n let source = null;\n let originalLine = null;\n let originalColumn = null;\n let name = null;\n if (seg.length !== 1) {\n source = resolvedSources[seg[1]];\n originalLine = seg[2] + 1;\n originalColumn = seg[3];\n }\n if (seg.length === 5) name = names[seg[4]];\n cb({\n generatedLine,\n generatedColumn,\n source,\n originalLine,\n originalColumn,\n name\n });\n }\n }\n}\nfunction sourceIndex(map, source) {\n const { sources, resolvedSources } = map;\n let index = sources.indexOf(source);\n if (index === -1) index = resolvedSources.indexOf(source);\n return index;\n}\nfunction sourceContentFor(map, source) {\n const { sourcesContent } = map;\n if (sourcesContent == null) return null;\n const index = sourceIndex(map, source);\n return index === -1 ? null : sourcesContent[index];\n}\nfunction isIgnored(map, source) {\n const { ignoreList } = map;\n if (ignoreList == null) return false;\n const index = sourceIndex(map, source);\n return index === -1 ? false : ignoreList.includes(index);\n}\nfunction presortedDecodedMap(map, mapUrl) {\n const tracer = new TraceMap(clone(map, []), mapUrl);\n cast(tracer)._decoded = map.mappings;\n return tracer;\n}\nfunction decodedMap(map) {\n return clone(map, decodedMappings(map));\n}\nfunction encodedMap(map) {\n return clone(map, encodedMappings(map));\n}\nfunction clone(map, mappings) {\n return {\n version: map.version,\n file: map.file,\n names: map.names,\n sourceRoot: map.sourceRoot,\n sources: map.sources,\n sourcesContent: map.sourcesContent,\n mappings,\n ignoreList: map.ignoreList || map.x_google_ignoreList\n };\n}\nfunction OMapping(source, line, column, name) {\n return { source, line, column, name };\n}\nfunction GMapping(line, column) {\n return { line, column };\n}\nfunction traceSegmentInternal(segments, memo, line, column, bias) {\n let index = memoizedBinarySearch(segments, column, memo, line);\n if (found) {\n index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);\n } else if (bias === LEAST_UPPER_BOUND) index++;\n if (index === -1 || index === segments.length) return -1;\n return index;\n}\nfunction sliceGeneratedPositions(segments, memo, line, column, bias) {\n let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);\n if (!found && bias === LEAST_UPPER_BOUND) min++;\n if (min === -1 || min === segments.length) return [];\n const matchedColumn = found ? column : segments[min][COLUMN];\n if (!found) min = lowerBound(segments, matchedColumn, min);\n const max = upperBound(segments, matchedColumn, min);\n const result = [];\n for (; min <= max; min++) {\n const segment = segments[min];\n result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));\n }\n return result;\n}\nfunction generatedPosition(map, source, line, column, bias, all) {\n var _a, _b;\n line--;\n if (line < 0) throw new Error(LINE_GTR_ZERO);\n if (column < 0) throw new Error(COL_GTR_EQ_ZERO);\n const { sources, resolvedSources } = map;\n let sourceIndex2 = sources.indexOf(source);\n if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source);\n if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);\n const bySourceMemos = (_a = cast(map))._bySourceMemos || (_a._bySourceMemos = sources.map(memoizedState));\n const generated = (_b = cast(map))._bySources || (_b._bySources = buildBySources(decodedMappings(map), bySourceMemos));\n const segments = generated[sourceIndex2][line];\n if (segments == null) return all ? [] : GMapping(null, null);\n const memo = bySourceMemos[sourceIndex2];\n if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);\n const index = traceSegmentInternal(segments, memo, line, column, bias);\n if (index === -1) return GMapping(null, null);\n const segment = segments[index];\n return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);\n}\nexport {\n FlattenMap as AnyMap,\n FlattenMap,\n GREATEST_LOWER_BOUND,\n LEAST_UPPER_BOUND,\n TraceMap,\n allGeneratedPositionsFor,\n decodedMap,\n decodedMappings,\n eachMapping,\n encodedMap,\n encodedMappings,\n generatedPositionFor,\n isIgnored,\n originalPositionFor,\n presortedDecodedMap,\n sourceContentFor,\n traceSegment\n};\n//# sourceMappingURL=trace-mapping.mjs.map\n","import { AnyMap, originalPositionFor, sourceContentFor, type TraceMap } from \"@jridgewell/trace-mapping\";\n\nimport { loadPrivateSourceMapArtifact, readPrivateSourceMap } from \"./artifact\";\nimport {\n\ttype ErrorReportStackFrame,\n\ttype ErrorReportSymbolicationResult,\n\ttype LoadedPrivateSourceMapArtifact,\n\ttype PrivateSourceMapManifestEntry,\n\ttype SymbolicateErrorReportStackOptions\n} from \"./types\";\n\nconst MAX_STACK_FRAMES = 40;\nconst MAX_CONTEXT_FRAMES = 10;\nconst CONTEXT_RADIUS = 2;\nconst MAX_SOURCE_LINE_LENGTH = 500;\nconst MAX_SYMBOLICATED_STACK_LENGTH = 262_144;\n\ntype ParsedStackFrame = {\n\treadonly lineIndex: number;\n\treadonly style: \"chromium\" | \"safari\";\n\treadonly functionName?: string;\n\treadonly source: string;\n\treadonly line: number;\n\treadonly column: number;\n\treadonly bundle: string;\n};\n\nfunction parsePositiveInteger(value: string): number | null {\n\tconst parsed = Number(value);\n\treturn Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;\n}\n\nfunction normalizeFunctionName(value: string | undefined): string | undefined {\n\tconst normalized = value\n\t\t?.trim()\n\t\t.replace(/^async\\s+/, \"\")\n\t\t.slice(0, 256);\n\treturn normalized || undefined;\n}\n\nfunction safeUrlPathname(value: string): string | null {\n\ttry {\n\t\treturn new URL(value).pathname;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction resolveBundle(source: string): string | null {\n\tconst withoutLocationSuffix = source.replace(/[?#].*$/, \"\").replaceAll(\"\\\\\", \"/\");\n\tconst urlPathname = safeUrlPathname(withoutLocationSuffix);\n\tconst normalized = (urlPathname ?? withoutLocationSuffix).replaceAll(\"\\\\\", \"/\");\n\tif (normalized.startsWith(\"/static/\") || normalized === \"/sw.js\" || normalized === \"/sw.mjs\") return normalized;\n\tif (normalized.startsWith(\"server/\")) return normalized;\n\tconst serverMarker = normalized.lastIndexOf(\"/server/\");\n\treturn serverMarker >= 0 ? `server/${normalized.slice(serverMarker + \"/server/\".length)}` : null;\n}\n\nfunction parseStackFrame(line: string, lineIndex: number): ParsedStackFrame | null {\n\tconst chromiumWithFunction = /^\\s*at\\s+(.+?)\\s+\\((.+):(\\d+):(\\d+)\\)\\s*$/.exec(line);\n\tconst chromiumBare = /^\\s*at\\s+(.+):(\\d+):(\\d+)\\s*$/.exec(line);\n\tconst safari = /^([^@]*)@(.+):(\\d+):(\\d+)\\s*$/.exec(line);\n\tconst match = chromiumWithFunction ?? chromiumBare ?? safari;\n\tif (!match) return null;\n\n\tconst hasChromiumFunction = match === chromiumWithFunction;\n\tconst hasSafariFunction = match === safari;\n\tconst sourceIndex = hasChromiumFunction ? 2 : hasSafariFunction ? 2 : 1;\n\tconst source = match[sourceIndex];\n\tconst generatedLine = match[sourceIndex + 1] ? parsePositiveInteger(match[sourceIndex + 1]) : null;\n\tconst generatedColumn = match[sourceIndex + 2] ? parsePositiveInteger(match[sourceIndex + 2]) : null;\n\tif (!source || generatedLine === null || generatedColumn === null) return null;\n\tconst bundle = resolveBundle(source);\n\tif (!bundle) return null;\n\treturn {\n\t\tlineIndex,\n\t\tstyle: hasSafariFunction ? \"safari\" : \"chromium\",\n\t\tfunctionName: normalizeFunctionName(hasChromiumFunction || hasSafariFunction ? match[1] : undefined),\n\t\tsource,\n\t\tline: generatedLine,\n\t\tcolumn: generatedColumn,\n\t\tbundle\n\t};\n}\n\nfunction normalizeOriginalSource(source: string): string {\n\tconst normalized = source\n\t\t.replaceAll(\"\\\\\", \"/\")\n\t\t.replace(/[?#].*$/, \"\")\n\t\t.replaceAll(\"\\0\", \"\");\n\tfor (const marker of [\"/src/\", \"/config/\", \"/scripts/\", \"/node_modules/\"] as const) {\n\t\tconst markerIndex = normalized.lastIndexOf(marker);\n\t\tif (markerIndex >= 0) return normalized.slice(markerIndex + 1).slice(0, 1_024);\n\t}\n\tfor (const prefix of [\"src/\", \"config/\", \"scripts/\", \"node_modules/\"] as const) {\n\t\tconst prefixIndex = normalized.indexOf(prefix);\n\t\tif (prefixIndex >= 0) return normalized.slice(prefixIndex).slice(0, 1_024);\n\t}\n\tconst filename = normalized.split(\"/\").filter(Boolean).at(-1) ?? \"unknown-source\";\n\treturn `source/${filename.slice(0, 512)}`;\n}\n\nfunction createSourceContext(traceMap: TraceMap, source: string, line: number) {\n\tconst content = sourceContentFor(traceMap, source);\n\tif (content === null) return undefined;\n\tconst lines = content.split(/\\r?\\n/);\n\tconst firstLine = Math.max(1, line - CONTEXT_RADIUS);\n\tconst lastLine = Math.min(lines.length, line + CONTEXT_RADIUS);\n\treturn Array.from({ length: lastLine - firstLine + 1 }, (_, index) => {\n\t\tconst sourceLine = firstLine + index;\n\t\treturn { line: sourceLine, content: (lines[sourceLine - 1] ?? \"\").slice(0, MAX_SOURCE_LINE_LENGTH), focus: sourceLine === line };\n\t});\n}\n\nfunction formatSymbolicatedLine(frame: ParsedStackFrame, resolved: ErrorReportStackFrame): string {\n\tconst original = resolved.original;\n\tif (!original) return \"\";\n\tconst functionName = original.name ?? frame.functionName;\n\tconst location = `${original.source}:${original.line}:${original.column}`;\n\tif (frame.style === \"safari\") return `${functionName ?? \"global code\"}@${location}`;\n\treturn functionName ? ` at ${functionName} (${location})` : ` at ${location}`;\n}\n\nasync function findArtifact(\n\troots: readonly string[],\n\tapplication: string,\n\tbuildId: string\n): Promise<LoadedPrivateSourceMapArtifact | null> {\n\tfor (const root of roots) {\n\t\tconst artifact = await loadPrivateSourceMapArtifact(root, application, buildId);\n\t\tif (artifact) return artifact;\n\t}\n\treturn null;\n}\n\nfunction resolveDefaultArtifactRoots(): string[] {\n\treturn [process.env.ERROR_REPORT_SOURCE_MAP_SEED_ROOT, process.env.ERROR_REPORT_SOURCE_MAP_ROOT].filter((root): root is string =>\n\t\tBoolean(root)\n\t);\n}\n\n/** Символизирует только bundle frames из artifact того же application/build ID. */\nexport async function symbolicateErrorReportStack(\n\tapplication: string,\n\tbuildId: string,\n\tstackTrace: string | undefined,\n\toptions: SymbolicateErrorReportStackOptions = {}\n): Promise<ErrorReportSymbolicationResult> {\n\tif (!stackTrace?.trim()) return { status: \"not-required\" };\n\tconst stackLines = stackTrace.split(\"\\n\");\n\tconst parsedFrames = stackLines.map(parseStackFrame).filter((frame): frame is ParsedStackFrame => frame !== null);\n\tif (parsedFrames.length === 0) return { status: \"not-required\" };\n\tconst boundedFrames = parsedFrames.slice(0, MAX_STACK_FRAMES);\n\tconst generatedFrames = boundedFrames.map<ErrorReportStackFrame>((frame) => ({\n\t\t...(frame.functionName ? { functionName: frame.functionName } : {}),\n\t\tgenerated: { source: frame.bundle, line: frame.line, column: frame.column }\n\t}));\n\n\ttry {\n\t\tconst artifact = await findArtifact(options.artifactRoots ?? resolveDefaultArtifactRoots(), application, buildId);\n\t\tif (!artifact) return { status: \"maps-unavailable\", frames: generatedFrames };\n\t\tconst traceMaps = new Map<string, TraceMap>();\n\t\tconst resultFrames: ErrorReportStackFrame[] = [];\n\t\tlet failed = parsedFrames.length > MAX_STACK_FRAMES;\n\t\tlet contextFrames = 0;\n\n\t\tfor (const frame of boundedFrames) {\n\t\t\tconst entry: PrivateSourceMapManifestEntry | undefined = artifact.entriesByBundle.get(frame.bundle);\n\t\t\tif (!entry) {\n\t\t\t\tfailed = true;\n\t\t\t\tresultFrames.push({\n\t\t\t\t\t...(frame.functionName ? { functionName: frame.functionName } : {}),\n\t\t\t\t\tgenerated: { source: frame.bundle, line: frame.line, column: frame.column }\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet traceMap = traceMaps.get(entry.map);\n\t\t\tif (!traceMap) {\n\t\t\t\ttraceMap = new AnyMap(await readPrivateSourceMap(artifact, entry), entry.map);\n\t\t\t\ttraceMaps.set(entry.map, traceMap);\n\t\t\t}\n\t\t\tconst original = originalPositionFor(traceMap, { line: frame.line, column: frame.column - 1 });\n\t\t\tif (original.source === null || original.line === null || original.column === null) {\n\t\t\t\tfailed = true;\n\t\t\t\tresultFrames.push({\n\t\t\t\t\t...(frame.functionName ? { functionName: frame.functionName } : {}),\n\t\t\t\t\tgenerated: { source: frame.bundle, line: frame.line, column: frame.column }\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst sourceContext =\n\t\t\t\tcontextFrames < MAX_CONTEXT_FRAMES ? createSourceContext(traceMap, original.source, original.line) : undefined;\n\t\t\tif (sourceContext) contextFrames += 1;\n\t\t\tconst resolvedFrame: ErrorReportStackFrame = {\n\t\t\t\t...(frame.functionName ? { functionName: frame.functionName } : {}),\n\t\t\t\tgenerated: { source: frame.bundle, line: frame.line, column: frame.column },\n\t\t\t\toriginal: {\n\t\t\t\t\tsource: normalizeOriginalSource(original.source),\n\t\t\t\t\tline: original.line,\n\t\t\t\t\tcolumn: original.column + 1,\n\t\t\t\t\t...(original.name ? { name: original.name.slice(0, 256) } : {})\n\t\t\t\t},\n\t\t\t\t...(sourceContext ? { sourceContext } : {})\n\t\t\t};\n\t\t\tresultFrames.push(resolvedFrame);\n\t\t\tstackLines[frame.lineIndex] = formatSymbolicatedLine(frame, resolvedFrame);\n\t\t}\n\n\t\tconst hasResolvedFrame = resultFrames.some((frame) => frame.original !== undefined);\n\t\treturn {\n\t\t\tstatus: failed || !hasResolvedFrame ? \"failed\" : \"resolved\",\n\t\t\t...(hasResolvedFrame ? { stackTrace: stackLines.join(\"\\n\").slice(0, MAX_SYMBOLICATED_STACK_LENGTH) } : {}),\n\t\t\tframes: resultFrames\n\t\t};\n\t} catch {\n\t\treturn { status: \"failed\", frames: generatedFrames };\n\t}\n}\n"],"x_google_ignoreList":[5,6,7],"mappings":";;;;;;;;;;;;;;;aACa,KAAsC,GAMtC,KAAwC,SACxC,IAA+B,UAC/B,IAAwC,WACxC,KAA2C,SCClD,IAAyB,iCACzB,KAAiB;AAEvB,SAAS,EAAyB,GAAwB;CAEzD,OADI,CAAC,KAAS,EAAM,WAAW,GAAG,KAAK,EAAM,SAAS,IAAI,KAAK,EAAM,SAAS,IAAI,IAAU,KACrF,EAAM,MAAM,GAAG,CAAC,CAAC,OAAO,MAAY,MAAY,MAAM,MAAY,OAAO,MAAY,IAAI;AACjG;AAEA,SAAS,GAAuB,GAAe,GAAoC;CAGlF,OAFI,EAAM,SAAS,IAAI,KAAK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AAI,IAAgB,EAAE,iBAAc,IAAI,CAAC;GAC1C;GAEA,AADA,EAAa,KAAK,CAAa,GAC/B,EAAW,EAAM,aAAa,GAAuB,GAAO,CAAa;EAC1E;EAEA,IAAM,IAAmB,EAAa,MAAM,MAAU,EAAM,aAAa,KAAA,CAAS;EAClF,OAAO;GACN,QAAQ,KAAU,CAAC,IAAmB,WAAW;GACjD,GAAI,IAAmB,EAAE,YAAY,EAAW,KAAK,IAAI,CAAC,CAAC,MAAM,GAAG,EAA6B,EAAE,IAAI,CAAC;GACxG,QAAQ;EACT;CACD,QAAQ;EACP,OAAO;GAAE,QAAQ;GAAU,QAAQ;EAAgB;CACpD;AACD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./tableDocument";
|
|
2
|
+
export * from "./tableDocumentGeometry";
|
|
3
|
+
export * from "./mergeTableDocumentCells";
|
|
4
|
+
export * from "./insertTableDocumentAxis";
|
|
5
|
+
export * from "./updateTableDocumentCell";
|
|
6
|
+
export * from "./tableDocumentAxisGroups";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/table-document/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { n as e } from "../chunks/array-D-_yMMUK.js";
|
|
2
|
+
//#region src/table-document/tableDocument.ts
|
|
3
|
+
var t = 2e4;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/table-document/tableDocumentGeometry.ts
|
|
6
|
+
function n(e, t) {
|
|
7
|
+
return e.row < t.row + t.rowSpan && t.row < e.row + e.rowSpan && e.column < t.column + t.columnSpan && t.column < e.column + e.columnSpan;
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
let t = e.rows.length, n = e.columns.length;
|
|
11
|
+
if (e.version !== 1 || !t || !n || t * n > 2e4) throw Error("Недопустимый размер таблицы.");
|
|
12
|
+
if (!Number.isInteger(e.headerRowCount) || e.headerRowCount < 0 || e.headerRowCount > t) throw Error("Некорректное число строк заголовка.");
|
|
13
|
+
let r = /* @__PURE__ */ new Set(), a = (e) => {
|
|
14
|
+
if (!e || r.has(e)) throw Error("Идентификаторы строк, столбцов и ячеек должны быть уникальными.");
|
|
15
|
+
r.add(e);
|
|
16
|
+
};
|
|
17
|
+
for (let t of e.columns) if (a(t.id), t.width !== null && (!Number.isFinite(t.width) || t.width <= 0)) throw Error("Некорректная ширина столбца.");
|
|
18
|
+
for (let t of e.rows) {
|
|
19
|
+
if (a(t.id), t.cells.length !== n) throw Error("Все строки должны иметь одинаковое число ячеек.");
|
|
20
|
+
t.cells.forEach((e) => a(e.id));
|
|
21
|
+
}
|
|
22
|
+
let o = /* @__PURE__ */ new Set();
|
|
23
|
+
for (let t of e.merges) {
|
|
24
|
+
if (i(e, t), t.rowSpan * t.columnSpan === 1) throw Error("Объединение должно содержать несколько ячеек.");
|
|
25
|
+
if (t.row < e.headerRowCount && t.row + t.rowSpan > e.headerRowCount) throw Error("Нельзя объединять заголовок с основной частью таблицы.");
|
|
26
|
+
for (let e = t.row; e < t.row + t.rowSpan; e++) for (let r = t.column; r < t.column + t.columnSpan; r++) {
|
|
27
|
+
let t = e * n + r;
|
|
28
|
+
if (o.has(t)) throw Error("Объединённые области пересекаются.");
|
|
29
|
+
o.add(t);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function i(e, t) {
|
|
34
|
+
if (![
|
|
35
|
+
t.row,
|
|
36
|
+
t.column,
|
|
37
|
+
t.rowSpan,
|
|
38
|
+
t.columnSpan
|
|
39
|
+
].every(Number.isInteger) || t.row < 0 || t.column < 0 || t.rowSpan < 1 || t.columnSpan < 1 || t.row + t.rowSpan > e.rows.length || t.column + t.columnSpan > e.columns.length) throw Error("Выделение выходит за границы таблицы.");
|
|
40
|
+
}
|
|
41
|
+
function a(e, t) {
|
|
42
|
+
let r = {
|
|
43
|
+
...t,
|
|
44
|
+
rowSpan: 1,
|
|
45
|
+
columnSpan: 1
|
|
46
|
+
};
|
|
47
|
+
return i(e, r), e.merges.find((e) => n(e, r)) ?? r;
|
|
48
|
+
}
|
|
49
|
+
function o(e, t, r) {
|
|
50
|
+
let a = {
|
|
51
|
+
row: Math.min(t.row, r.row),
|
|
52
|
+
column: Math.min(t.column, r.column),
|
|
53
|
+
rowSpan: Math.abs(t.row - r.row) + 1,
|
|
54
|
+
columnSpan: Math.abs(t.column - r.column) + 1
|
|
55
|
+
};
|
|
56
|
+
i(e, a);
|
|
57
|
+
let o = !0;
|
|
58
|
+
for (; o;) {
|
|
59
|
+
o = !1;
|
|
60
|
+
for (let t of e.merges) {
|
|
61
|
+
if (!n(a, t)) continue;
|
|
62
|
+
let e = Math.min(a.row, t.row), r = Math.min(a.column, t.column), i = Math.max(a.row + a.rowSpan, t.row + t.rowSpan) - e, s = Math.max(a.column + a.columnSpan, t.column + t.columnSpan) - r;
|
|
63
|
+
(e !== a.row || r !== a.column || i !== a.rowSpan || s !== a.columnSpan) && (a = {
|
|
64
|
+
row: e,
|
|
65
|
+
column: r,
|
|
66
|
+
rowSpan: i,
|
|
67
|
+
columnSpan: s
|
|
68
|
+
}, o = !0);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return a;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/table-document/mergeTableDocumentCells.ts
|
|
75
|
+
function s(e, t, i) {
|
|
76
|
+
r(e);
|
|
77
|
+
let a = o(e, t, i);
|
|
78
|
+
if (a.rowSpan * a.columnSpan === 1) return e;
|
|
79
|
+
let s = e.merges.filter((e) => n(e, a));
|
|
80
|
+
if (s.length === 1 && a.row === s[0].row && a.column === s[0].column && a.rowSpan === s[0].rowSpan && a.columnSpan === s[0].columnSpan) return e;
|
|
81
|
+
let c = {
|
|
82
|
+
...e,
|
|
83
|
+
merges: [...e.merges.filter((e) => !n(e, a)), a]
|
|
84
|
+
};
|
|
85
|
+
return r(c), c;
|
|
86
|
+
}
|
|
87
|
+
function c(e, t) {
|
|
88
|
+
r(e);
|
|
89
|
+
let n = a(e, t);
|
|
90
|
+
return n.rowSpan * n.columnSpan === 1 ? e : {
|
|
91
|
+
...e,
|
|
92
|
+
merges: e.merges.filter((e) => e !== n)
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/table-document/insertTableDocumentAxis.ts
|
|
97
|
+
function l(e, t, n, i, a, o = "body") {
|
|
98
|
+
r(e);
|
|
99
|
+
let s = t === "row" ? e.rows.length : e.columns.length;
|
|
100
|
+
if (!Number.isInteger(n) || n < 0 || n > s) throw Error("Некорректная позиция вставки.");
|
|
101
|
+
if (a.length !== (t === "row" ? e.columns.length : e.rows.length)) throw Error("Неверное число новых ячеек.");
|
|
102
|
+
if (t === "row" && (o === "header" ? n > e.headerRowCount : n < e.headerRowCount)) throw Error("Строка вставляется вне выбранной части таблицы.");
|
|
103
|
+
let c = t === "row" ? "rowSpan" : "columnSpan", l = e.merges.map((e) => n <= e[t] ? {
|
|
104
|
+
...e,
|
|
105
|
+
[t]: e[t] + 1
|
|
106
|
+
} : n < e[t] + e[c] ? {
|
|
107
|
+
...e,
|
|
108
|
+
[c]: e[c] + 1
|
|
109
|
+
} : e), u = t === "row" ? {
|
|
110
|
+
...e,
|
|
111
|
+
merges: l,
|
|
112
|
+
headerRowCount: e.headerRowCount + +(o === "header"),
|
|
113
|
+
rows: [
|
|
114
|
+
...e.rows.slice(0, n),
|
|
115
|
+
{
|
|
116
|
+
id: i,
|
|
117
|
+
cells: a
|
|
118
|
+
},
|
|
119
|
+
...e.rows.slice(n)
|
|
120
|
+
]
|
|
121
|
+
} : {
|
|
122
|
+
...e,
|
|
123
|
+
merges: l,
|
|
124
|
+
columns: [
|
|
125
|
+
...e.columns.slice(0, n),
|
|
126
|
+
{
|
|
127
|
+
id: i,
|
|
128
|
+
width: null
|
|
129
|
+
},
|
|
130
|
+
...e.columns.slice(n)
|
|
131
|
+
],
|
|
132
|
+
rows: e.rows.map((e, t) => ({
|
|
133
|
+
...e,
|
|
134
|
+
cells: [
|
|
135
|
+
...e.cells.slice(0, n),
|
|
136
|
+
a[t],
|
|
137
|
+
...e.cells.slice(n)
|
|
138
|
+
]
|
|
139
|
+
}))
|
|
140
|
+
};
|
|
141
|
+
return r(u), u;
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/table-document/updateTableDocumentCell.ts
|
|
145
|
+
function u(e, t, n) {
|
|
146
|
+
return i(e, {
|
|
147
|
+
...t,
|
|
148
|
+
rowSpan: 1,
|
|
149
|
+
columnSpan: 1
|
|
150
|
+
}), Object.is(e.rows[t.row].cells[t.column].value, n) ? e : {
|
|
151
|
+
...e,
|
|
152
|
+
rows: e.rows.map((e, r) => r === t.row ? {
|
|
153
|
+
...e,
|
|
154
|
+
cells: e.cells.map((e, r) => r === t.column ? {
|
|
155
|
+
...e,
|
|
156
|
+
value: n
|
|
157
|
+
} : e)
|
|
158
|
+
} : e)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/table-document/tableDocumentAxisGroups.ts
|
|
163
|
+
function d(e, t) {
|
|
164
|
+
r(e);
|
|
165
|
+
let n = t === "row" ? e.rows.length : e.columns.length, i = /* @__PURE__ */ new Set();
|
|
166
|
+
for (let n of e.merges) {
|
|
167
|
+
let e = t === "row" ? n.rowSpan : n.columnSpan;
|
|
168
|
+
for (let r = 1; r < e; r++) i.add(n[t] + r);
|
|
169
|
+
}
|
|
170
|
+
let a = [], o = 0;
|
|
171
|
+
for (let e = 1; e <= n; e++) (e === n || !i.has(e)) && (a.push({
|
|
172
|
+
start: o,
|
|
173
|
+
count: e - o
|
|
174
|
+
}), o = e);
|
|
175
|
+
return a;
|
|
176
|
+
}
|
|
177
|
+
function f(e, t, n) {
|
|
178
|
+
let i = d(e, t).find((e) => n >= e.start && n < e.start + e.count);
|
|
179
|
+
if (!i) throw Error("Группа не найдена.");
|
|
180
|
+
let a = t === "row" ? e.rows.length : e.columns.length;
|
|
181
|
+
if (i.count === a) throw Error("В таблице должна остаться хотя бы одна строка и один столбец.");
|
|
182
|
+
let o = i.start + i.count, s = e.merges.filter((e) => e[t] < i.start || e[t] >= o).map((e) => e[t] < o ? e : {
|
|
183
|
+
...e,
|
|
184
|
+
[t]: e[t] - i.count
|
|
185
|
+
}), c = t === "row" ? {
|
|
186
|
+
...e,
|
|
187
|
+
merges: s,
|
|
188
|
+
rows: e.rows.filter((e, t) => t < i.start || t >= o),
|
|
189
|
+
headerRowCount: e.headerRowCount - (i.start < e.headerRowCount ? i.count : 0)
|
|
190
|
+
} : {
|
|
191
|
+
...e,
|
|
192
|
+
merges: s,
|
|
193
|
+
columns: e.columns.filter((e, t) => t < i.start || t >= o),
|
|
194
|
+
rows: e.rows.map((e) => ({
|
|
195
|
+
...e,
|
|
196
|
+
cells: e.cells.filter((e, t) => t < i.start || t >= o)
|
|
197
|
+
}))
|
|
198
|
+
};
|
|
199
|
+
return r(c), c;
|
|
200
|
+
}
|
|
201
|
+
function p(t, n, i, a) {
|
|
202
|
+
let o = d(t, n), s = o.findIndex((e) => i >= e.start && i < e.start + e.count);
|
|
203
|
+
if (s < 0) throw Error("Группа не найдена.");
|
|
204
|
+
let c = s + a;
|
|
205
|
+
if (c < 0 || c >= o.length || n === "row" && o[s].start < t.headerRowCount != o[c].start < t.headerRowCount) return t;
|
|
206
|
+
let l = e(o, s, a === -1 ? "up" : "down").flatMap((e) => Array.from({ length: e.count }, (t, n) => e.start + n)), u = new Map(l.map((e, t) => [e, t])), f = t.merges.map((e) => ({
|
|
207
|
+
...e,
|
|
208
|
+
[n]: u.get(e[n]) ?? e[n]
|
|
209
|
+
})), p = n === "row" ? {
|
|
210
|
+
...t,
|
|
211
|
+
merges: f,
|
|
212
|
+
rows: l.map((e) => t.rows[e])
|
|
213
|
+
} : {
|
|
214
|
+
...t,
|
|
215
|
+
merges: f,
|
|
216
|
+
columns: l.map((e) => t.columns[e]),
|
|
217
|
+
rows: t.rows.map((e) => ({
|
|
218
|
+
...e,
|
|
219
|
+
cells: l.map((t) => e.cells[t])
|
|
220
|
+
}))
|
|
221
|
+
};
|
|
222
|
+
return r(p), p;
|
|
223
|
+
}
|
|
224
|
+
//#endregion
|
|
225
|
+
export { t as TABLE_DOCUMENT_MAX_CELLS, r as assertTableDocument, i as assertTableDocumentRange, f as deleteTableDocumentAxisGroup, o as expandTableDocumentRange, d as getTableDocumentAxisGroups, a as getTableDocumentCellRange, l as insertTableDocumentAxis, s as mergeTableDocumentCells, p as moveTableDocumentAxisGroup, c as splitTableDocumentCell, n as tableDocumentRangesIntersect, u as updateTableDocumentCell };
|
|
226
|
+
|
|
227
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/table-document/tableDocument.ts","../../src/table-document/tableDocumentGeometry.ts","../../src/table-document/mergeTableDocumentCells.ts","../../src/table-document/insertTableDocumentAxis.ts","../../src/table-document/updateTableDocumentCell.ts","../../src/table-document/tableDocumentAxisGroups.ts"],"sourcesContent":["/** Координаты относятся к полной сетке, включая скрытые объединением ячейки. */\nexport type TableDocumentPosition = { readonly row: number; readonly column: number };\n\n/** Прямоугольная область; spans всегда положительные целые числа. */\nexport type TableDocumentRange = TableDocumentPosition & { readonly rowSpan: number; readonly columnSpan: number };\n\n/** Значение принадлежит приложению; ядро никогда не преобразует и не объединяет содержимое. */\nexport type TableDocumentCell<T> = { readonly id: string; readonly value: T };\nexport type TableDocumentRow<T> = { readonly id: string; readonly cells: readonly TableDocumentCell<T>[] };\nexport type TableDocumentColumn = { readonly id: string; readonly width: number | null };\n\n/**\n * Документ редактора, независимый от TanStack и DOM. Полная матрица хранит все\n * значения; merges содержит только непересекающиеся видимые объединения.\n * Это исключает устаревшие spans у скрытых ячеек после повторного merge/split.\n */\nexport type TableDocument<T> = {\n\treadonly version: 1;\n\treadonly caption: string;\n\treadonly columns: readonly TableDocumentColumn[];\n\treadonly rows: readonly TableDocumentRow<T>[];\n\treadonly merges: readonly TableDocumentRange[];\n\treadonly headerRowCount: number;\n\treadonly hideHeaders: boolean;\n\treadonly showRowNumbers: boolean;\n};\n\n/** Лимит защищает проверки геометрии и UI от случайно огромной сетки. */\nexport const TABLE_DOCUMENT_MAX_CELLS = 20_000;\n","import { TABLE_DOCUMENT_MAX_CELLS, type TableDocument, type TableDocumentPosition, type TableDocumentRange } from \"./tableDocument\";\n\n/** Проверяет пересечение двух включительных прямоугольников полной сетки. */\nexport function tableDocumentRangesIntersect(a: TableDocumentRange, b: TableDocumentRange): boolean {\n\treturn (\n\t\ta.row < b.row + b.rowSpan && b.row < a.row + a.rowSpan && a.column < b.column + b.columnSpan && b.column < a.column + a.columnSpan\n\t);\n}\n\n/** Fail-closed инварианты для команд и внешней runtime-schema приложения. */\nexport function assertTableDocument<T>(document: TableDocument<T>): void {\n\tconst height = document.rows.length;\n\tconst width = document.columns.length;\n\tif (document.version !== 1 || !height || !width || height * width > TABLE_DOCUMENT_MAX_CELLS)\n\t\tthrow new Error(\"Недопустимый размер таблицы.\");\n\tif (!Number.isInteger(document.headerRowCount) || document.headerRowCount < 0 || document.headerRowCount > height)\n\t\tthrow new Error(\"Некорректное число строк заголовка.\");\n\tconst identities = new Set<string>();\n\tconst checkId = (id: string) => {\n\t\tif (!id || identities.has(id)) throw new Error(\"Идентификаторы строк, столбцов и ячеек должны быть уникальными.\");\n\t\tidentities.add(id);\n\t};\n\tfor (const column of document.columns) {\n\t\tcheckId(column.id);\n\t\tif (column.width !== null && (!Number.isFinite(column.width) || column.width <= 0)) throw new Error(\"Некорректная ширина столбца.\");\n\t}\n\tfor (const row of document.rows) {\n\t\tcheckId(row.id);\n\t\tif (row.cells.length !== width) throw new Error(\"Все строки должны иметь одинаковое число ячеек.\");\n\t\trow.cells.forEach((cell) => checkId(cell.id));\n\t}\n\tconst occupied = new Set<number>();\n\tfor (const merge of document.merges) {\n\t\tassertTableDocumentRange(document, merge);\n\t\tif (merge.rowSpan * merge.columnSpan === 1) throw new Error(\"Объединение должно содержать несколько ячеек.\");\n\t\tif (merge.row < document.headerRowCount && merge.row + merge.rowSpan > document.headerRowCount)\n\t\t\tthrow new Error(\"Нельзя объединять заголовок с основной частью таблицы.\");\n\t\tfor (let r = merge.row; r < merge.row + merge.rowSpan; r++) {\n\t\t\tfor (let c = merge.column; c < merge.column + merge.columnSpan; c++) {\n\t\t\t\tconst key = r * width + c;\n\t\t\t\tif (occupied.has(key)) throw new Error(\"Объединённые области пересекаются.\");\n\t\t\t\toccupied.add(key);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Проверяет границы до выполнения команды, не исправляя ошибочный ввод молча. */\nexport function assertTableDocumentRange<T>(document: TableDocument<T>, range: TableDocumentRange): void {\n\tif (\n\t\t![range.row, range.column, range.rowSpan, range.columnSpan].every(Number.isInteger) ||\n\t\trange.row < 0 ||\n\t\trange.column < 0 ||\n\t\trange.rowSpan < 1 ||\n\t\trange.columnSpan < 1 ||\n\t\trange.row + range.rowSpan > document.rows.length ||\n\t\trange.column + range.columnSpan > document.columns.length\n\t)\n\t\tthrow new Error(\"Выделение выходит за границы таблицы.\");\n}\n\n/** Возвращает видимый anchor для любой позиции, включая покрытую объединением. */\nexport function getTableDocumentCellRange<T>(document: TableDocument<T>, position: TableDocumentPosition): TableDocumentRange {\n\tconst point = { ...position, rowSpan: 1, columnSpan: 1 };\n\tassertTableDocumentRange(document, point);\n\treturn document.merges.find((merge) => tableDocumentRangesIntersect(merge, point)) ?? point;\n}\n\n/**\n * Замыкает выделение до неподвижной точки. Повторный обход обязателен: новая\n * строка прямоугольника может пересечь ещё одно объединение вне исходной области.\n */\nexport function expandTableDocumentRange<T>(\n\tdocument: TableDocument<T>,\n\tstart: TableDocumentPosition,\n\tend: TableDocumentPosition\n): TableDocumentRange {\n\tlet range = {\n\t\trow: Math.min(start.row, end.row),\n\t\tcolumn: Math.min(start.column, end.column),\n\t\trowSpan: Math.abs(start.row - end.row) + 1,\n\t\tcolumnSpan: Math.abs(start.column - end.column) + 1\n\t};\n\tassertTableDocumentRange(document, range);\n\tlet changed = true;\n\twhile (changed) {\n\t\tchanged = false;\n\t\tfor (const merge of document.merges) {\n\t\t\tif (!tableDocumentRangesIntersect(range, merge)) continue;\n\t\t\tconst row = Math.min(range.row, merge.row);\n\t\t\tconst column = Math.min(range.column, merge.column);\n\t\t\tconst rowSpan = Math.max(range.row + range.rowSpan, merge.row + merge.rowSpan) - row;\n\t\t\tconst columnSpan = Math.max(range.column + range.columnSpan, merge.column + merge.columnSpan) - column;\n\t\t\tif (row !== range.row || column !== range.column || rowSpan !== range.rowSpan || columnSpan !== range.columnSpan) {\n\t\t\t\trange = { row, column, rowSpan, columnSpan };\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t}\n\t}\n\treturn range;\n}\n","import { type TableDocument, type TableDocumentPosition } from \"./tableDocument\";\nimport {\n\tassertTableDocument,\n\texpandTableDocumentRange,\n\tgetTableDocumentCellRange,\n\ttableDocumentRangesIntersect\n} from \"./tableDocumentGeometry\";\n\n/** Объединяет геометрию; исходные значения и identities всех ячеек остаются неизменными. */\nexport function mergeTableDocumentCells<T>(\n\tdocument: TableDocument<T>,\n\tstart: TableDocumentPosition,\n\tend: TableDocumentPosition\n): TableDocument<T> {\n\tassertTableDocument(document);\n\tconst range = expandTableDocumentRange(document, start, end);\n\tif (range.rowSpan * range.columnSpan === 1) return document;\n\tconst intersected = document.merges.filter((merge) => tableDocumentRangesIntersect(merge, range));\n\tif (\n\t\tintersected.length === 1 &&\n\t\trange.row === intersected[0].row &&\n\t\trange.column === intersected[0].column &&\n\t\trange.rowSpan === intersected[0].rowSpan &&\n\t\trange.columnSpan === intersected[0].columnSpan\n\t)\n\t\treturn document;\n\tconst result = { ...document, merges: [...document.merges.filter((merge) => !tableDocumentRangesIntersect(merge, range)), range] };\n\tassertTableDocument(result);\n\treturn result;\n}\n\n/** Разъединяет область целиком; скрытые значения становятся видны без восстановления из копий. */\nexport function splitTableDocumentCell<T>(document: TableDocument<T>, position: TableDocumentPosition): TableDocument<T> {\n\tassertTableDocument(document);\n\tconst range = getTableDocumentCellRange(document, position);\n\tif (range.rowSpan * range.columnSpan === 1) return document;\n\treturn { ...document, merges: document.merges.filter((merge) => merge !== range) };\n}\n","import { type TableDocument, type TableDocumentCell } from \"./tableDocument\";\nimport { assertTableDocument } from \"./tableDocumentGeometry\";\n\n/**\n * Вставка внутрь объединения увеличивает его span; вставка перед anchor сдвигает\n * область. ID и значения создаются вызывающим кодом до изменения React state.\n */\nexport function insertTableDocumentAxis<T>(\n\tdocument: TableDocument<T>,\n\taxis: \"row\" | \"column\",\n\tindex: number,\n\tid: string,\n\tcells: readonly TableDocumentCell<T>[],\n\tsection: \"header\" | \"body\" = \"body\"\n): TableDocument<T> {\n\tassertTableDocument(document);\n\tconst count = axis === \"row\" ? document.rows.length : document.columns.length;\n\tif (!Number.isInteger(index) || index < 0 || index > count) throw new Error(\"Некорректная позиция вставки.\");\n\tif (cells.length !== (axis === \"row\" ? document.columns.length : document.rows.length)) throw new Error(\"Неверное число новых ячеек.\");\n\tif (axis === \"row\" && (section === \"header\" ? index > document.headerRowCount : index < document.headerRowCount))\n\t\tthrow new Error(\"Строка вставляется вне выбранной части таблицы.\");\n\tconst spanKey = axis === \"row\" ? \"rowSpan\" : \"columnSpan\";\n\tconst merges = document.merges.map((merge) =>\n\t\tindex <= merge[axis]\n\t\t\t? { ...merge, [axis]: merge[axis] + 1 }\n\t\t\t: index < merge[axis] + merge[spanKey]\n\t\t\t\t? { ...merge, [spanKey]: merge[spanKey] + 1 }\n\t\t\t\t: merge\n\t);\n\tconst result: TableDocument<T> =\n\t\taxis === \"row\"\n\t\t\t? {\n\t\t\t\t\t...document,\n\t\t\t\t\tmerges,\n\t\t\t\t\theaderRowCount: document.headerRowCount + (section === \"header\" ? 1 : 0),\n\t\t\t\t\trows: [...document.rows.slice(0, index), { id, cells }, ...document.rows.slice(index)]\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\t...document,\n\t\t\t\t\tmerges,\n\t\t\t\t\tcolumns: [...document.columns.slice(0, index), { id, width: null }, ...document.columns.slice(index)],\n\t\t\t\t\trows: document.rows.map((row, r) => ({\n\t\t\t\t\t\t...row,\n\t\t\t\t\t\tcells: [...row.cells.slice(0, index), cells[r], ...row.cells.slice(index)]\n\t\t\t\t\t}))\n\t\t\t\t};\n\tassertTableDocument(result);\n\treturn result;\n}\n","import { type TableDocument, type TableDocumentPosition } from \"./tableDocument\";\nimport { assertTableDocumentRange } from \"./tableDocumentGeometry\";\n\n/** Меняет ровно одну логическую ячейку; преобразование rich text/документов выполняет приложение. */\nexport function updateTableDocumentCell<T>(document: TableDocument<T>, position: TableDocumentPosition, value: T): TableDocument<T> {\n\tassertTableDocumentRange(document, { ...position, rowSpan: 1, columnSpan: 1 });\n\tif (Object.is(document.rows[position.row].cells[position.column].value, value)) return document;\n\treturn {\n\t\t...document,\n\t\trows: document.rows.map((row, r) =>\n\t\t\tr !== position.row ? row : { ...row, cells: row.cells.map((cell, c) => (c !== position.column ? cell : { ...cell, value })) }\n\t\t)\n\t};\n}\n","import { moveArrayItemByIndex } from \"../array\";\n\nimport { type TableDocument } from \"./tableDocument\";\nimport { assertTableDocument } from \"./tableDocumentGeometry\";\n\n/** Неразрывная группа строк/столбцов; применима к reorder и подтверждению удаления. */\nexport type TableDocumentAxisGroup = { readonly start: number; readonly count: number };\n\n/** Находит безопасные границы без случайных ID и без повторного учёта скрытых spans. */\nexport function getTableDocumentAxisGroups<T>(document: TableDocument<T>, axis: \"row\" | \"column\"): readonly TableDocumentAxisGroup[] {\n\tassertTableDocument(document);\n\tconst length = axis === \"row\" ? document.rows.length : document.columns.length;\n\tconst blocked = new Set<number>();\n\tfor (const merge of document.merges) {\n\t\tconst span = axis === \"row\" ? merge.rowSpan : merge.columnSpan;\n\t\tfor (let offset = 1; offset < span; offset++) blocked.add(merge[axis] + offset);\n\t}\n\tconst groups: TableDocumentAxisGroup[] = [];\n\tlet start = 0;\n\tfor (let i = 1; i <= length; i++) {\n\t\tif (i === length || !blocked.has(i)) {\n\t\t\tgroups.push({ start, count: i - start });\n\t\t\tstart = i;\n\t\t}\n\t}\n\treturn groups;\n}\n\n/** Удаляет только явно выбранную неразрывную группу; UI обязан показать её размер до подтверждения. */\nexport function deleteTableDocumentAxisGroup<T>(document: TableDocument<T>, axis: \"row\" | \"column\", index: number): TableDocument<T> {\n\tconst group = getTableDocumentAxisGroups(document, axis).find((item) => index >= item.start && index < item.start + item.count);\n\tif (!group) throw new Error(\"Группа не найдена.\");\n\tconst length = axis === \"row\" ? document.rows.length : document.columns.length;\n\tif (group.count === length) throw new Error(\"В таблице должна остаться хотя бы одна строка и один столбец.\");\n\tconst end = group.start + group.count;\n\tconst merges = document.merges\n\t\t.filter((merge) => merge[axis] < group.start || merge[axis] >= end)\n\t\t.map((merge) => (merge[axis] < end ? merge : { ...merge, [axis]: merge[axis] - group.count }));\n\tconst result: TableDocument<T> =\n\t\taxis === \"row\"\n\t\t\t? {\n\t\t\t\t\t...document,\n\t\t\t\t\tmerges,\n\t\t\t\t\trows: document.rows.filter((_, r) => r < group.start || r >= end),\n\t\t\t\t\theaderRowCount: document.headerRowCount - (group.start < document.headerRowCount ? group.count : 0)\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\t...document,\n\t\t\t\t\tmerges,\n\t\t\t\t\tcolumns: document.columns.filter((_, c) => c < group.start || c >= end),\n\t\t\t\t\trows: document.rows.map((row) => ({ ...row, cells: row.cells.filter((_, c) => c < group.start || c >= end) }))\n\t\t\t\t};\n\tassertTableDocument(result);\n\treturn result;\n}\n\n/** Меняет местами соседние неразрывные группы, сохраняя порядок внутри объединений. */\nexport function moveTableDocumentAxisGroup<T>(\n\tdocument: TableDocument<T>,\n\taxis: \"row\" | \"column\",\n\tindex: number,\n\tdirection: -1 | 1\n): TableDocument<T> {\n\tconst groups = getTableDocumentAxisGroups(document, axis);\n\tconst current = groups.findIndex((item) => index >= item.start && index < item.start + item.count);\n\tif (current < 0) throw new Error(\"Группа не найдена.\");\n\tconst neighbor = current + direction;\n\tif (neighbor < 0 || neighbor >= groups.length) return document;\n\tif (axis === \"row\" && groups[current].start < document.headerRowCount !== groups[neighbor].start < document.headerRowCount)\n\t\treturn document;\n\tconst ordered = moveArrayItemByIndex(groups, current, direction === -1 ? \"up\" : \"down\");\n\tconst indices = ordered.flatMap((group) => Array.from({ length: group.count }, (_, offset) => group.start + offset));\n\tconst inverse = new Map(indices.map((oldIndex, newIndex) => [oldIndex, newIndex]));\n\tconst merges = document.merges.map((merge) => ({ ...merge, [axis]: inverse.get(merge[axis]) ?? merge[axis] }));\n\tconst result =\n\t\taxis === \"row\"\n\t\t\t? { ...document, merges, rows: indices.map((i) => document.rows[i]) }\n\t\t\t: {\n\t\t\t\t\t...document,\n\t\t\t\t\tmerges,\n\t\t\t\t\tcolumns: indices.map((i) => document.columns[i]),\n\t\t\t\t\trows: document.rows.map((row) => ({ ...row, cells: indices.map((i) => row.cells[i]) }))\n\t\t\t\t};\n\tassertTableDocument(result);\n\treturn result;\n}\n"],"mappings":";;AA4BA,IAAa,IAA2B;;;ACzBxC,SAAgB,EAA6B,GAAuB,GAAgC;CACnG,OACC,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE;AAE1H;AAGA,SAAgB,EAAuB,GAAkC;CACxE,IAAM,IAAS,EAAS,KAAK,QACvB,IAAQ,EAAS,QAAQ;CAC/B,IAAI,EAAS,YAAY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AAK,MAAM,EAAS,QAAQ,EAAE;EAC/C,MAAM,EAAS,KAAK,KAAK,OAAS;GAAE,GAAG;GAAK,OAAO,EAAQ,KAAK,MAAM,EAAI,MAAM,EAAE;EAAE,EAAE;CACvF;CAEH,OADA,EAAoB,CAAM,GACnB;AACR"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TableDocument, type TableDocumentCell } from "./tableDocument";
|
|
2
|
+
/**
|
|
3
|
+
* Вставка внутрь объединения увеличивает его span; вставка перед anchor сдвигает
|
|
4
|
+
* область. ID и значения создаются вызывающим кодом до изменения React state.
|
|
5
|
+
*/
|
|
6
|
+
export declare function insertTableDocumentAxis<T>(document: TableDocument<T>, axis: "row" | "column", index: number, id: string, cells: readonly TableDocumentCell<T>[], section?: "header" | "body"): TableDocument<T>;
|
|
7
|
+
//# sourceMappingURL=insertTableDocumentAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insertTableDocumentAxis.d.ts","sourceRoot":"","sources":["../../src/table-document/insertTableDocumentAxis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAG7E;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACxC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,IAAI,EAAE,KAAK,GAAG,QAAQ,EACtB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,SAAS,iBAAiB,CAAC,CAAC,CAAC,EAAE,EACtC,OAAO,GAAE,QAAQ,GAAG,MAAe,GACjC,aAAa,CAAC,CAAC,CAAC,CAkClB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TableDocument, type TableDocumentPosition } from "./tableDocument";
|
|
2
|
+
/** Объединяет геометрию; исходные значения и identities всех ячеек остаются неизменными. */
|
|
3
|
+
export declare function mergeTableDocumentCells<T>(document: TableDocument<T>, start: TableDocumentPosition, end: TableDocumentPosition): TableDocument<T>;
|
|
4
|
+
/** Разъединяет область целиком; скрытые значения становятся видны без восстановления из копий. */
|
|
5
|
+
export declare function splitTableDocumentCell<T>(document: TableDocument<T>, position: TableDocumentPosition): TableDocument<T>;
|
|
6
|
+
//# sourceMappingURL=mergeTableDocumentCells.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeTableDocumentCells.d.ts","sourceRoot":"","sources":["../../src/table-document/mergeTableDocumentCells.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAQjF,4FAA4F;AAC5F,wBAAgB,uBAAuB,CAAC,CAAC,EACxC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,KAAK,EAAE,qBAAqB,EAC5B,GAAG,EAAE,qBAAqB,GACxB,aAAa,CAAC,CAAC,CAAC,CAgBlB;AAED,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,qBAAqB,GAAG,aAAa,CAAC,CAAC,CAAC,CAKvH"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Координаты относятся к полной сетке, включая скрытые объединением ячейки. */
|
|
2
|
+
export type TableDocumentPosition = {
|
|
3
|
+
readonly row: number;
|
|
4
|
+
readonly column: number;
|
|
5
|
+
};
|
|
6
|
+
/** Прямоугольная область; spans всегда положительные целые числа. */
|
|
7
|
+
export type TableDocumentRange = TableDocumentPosition & {
|
|
8
|
+
readonly rowSpan: number;
|
|
9
|
+
readonly columnSpan: number;
|
|
10
|
+
};
|
|
11
|
+
/** Значение принадлежит приложению; ядро никогда не преобразует и не объединяет содержимое. */
|
|
12
|
+
export type TableDocumentCell<T> = {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly value: T;
|
|
15
|
+
};
|
|
16
|
+
export type TableDocumentRow<T> = {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly cells: readonly TableDocumentCell<T>[];
|
|
19
|
+
};
|
|
20
|
+
export type TableDocumentColumn = {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly width: number | null;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Документ редактора, независимый от TanStack и DOM. Полная матрица хранит все
|
|
26
|
+
* значения; merges содержит только непересекающиеся видимые объединения.
|
|
27
|
+
* Это исключает устаревшие spans у скрытых ячеек после повторного merge/split.
|
|
28
|
+
*/
|
|
29
|
+
export type TableDocument<T> = {
|
|
30
|
+
readonly version: 1;
|
|
31
|
+
readonly caption: string;
|
|
32
|
+
readonly columns: readonly TableDocumentColumn[];
|
|
33
|
+
readonly rows: readonly TableDocumentRow<T>[];
|
|
34
|
+
readonly merges: readonly TableDocumentRange[];
|
|
35
|
+
readonly headerRowCount: number;
|
|
36
|
+
readonly hideHeaders: boolean;
|
|
37
|
+
readonly showRowNumbers: boolean;
|
|
38
|
+
};
|
|
39
|
+
/** Лимит защищает проверки геометрии и UI от случайно огромной сетки. */
|
|
40
|
+
export declare const TABLE_DOCUMENT_MAX_CELLS = 20000;
|
|
41
|
+
//# sourceMappingURL=tableDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableDocument.d.ts","sourceRoot":"","sources":["../../src/table-document/tableDocument.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,qBAAqB,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtF,qEAAqE;AACrE,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnH,+FAA+F;AAC/F,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC;AAC9E,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAA;CAAE,CAAC;AAC3G,MAAM,MAAM,mBAAmB,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzF;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC9B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC/C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,wBAAwB,QAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TableDocument } from "./tableDocument";
|
|
2
|
+
/** Неразрывная группа строк/столбцов; применима к reorder и подтверждению удаления. */
|
|
3
|
+
export type TableDocumentAxisGroup = {
|
|
4
|
+
readonly start: number;
|
|
5
|
+
readonly count: number;
|
|
6
|
+
};
|
|
7
|
+
/** Находит безопасные границы без случайных ID и без повторного учёта скрытых spans. */
|
|
8
|
+
export declare function getTableDocumentAxisGroups<T>(document: TableDocument<T>, axis: "row" | "column"): readonly TableDocumentAxisGroup[];
|
|
9
|
+
/** Удаляет только явно выбранную неразрывную группу; UI обязан показать её размер до подтверждения. */
|
|
10
|
+
export declare function deleteTableDocumentAxisGroup<T>(document: TableDocument<T>, axis: "row" | "column", index: number): TableDocument<T>;
|
|
11
|
+
/** Меняет местами соседние неразрывные группы, сохраняя порядок внутри объединений. */
|
|
12
|
+
export declare function moveTableDocumentAxisGroup<T>(document: TableDocument<T>, axis: "row" | "column", index: number, direction: -1 | 1): TableDocument<T>;
|
|
13
|
+
//# sourceMappingURL=tableDocumentAxisGroups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableDocumentAxisGroups.d.ts","sourceRoot":"","sources":["../../src/table-document/tableDocumentAxisGroups.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,uFAAuF;AACvF,MAAM,MAAM,sBAAsB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExF,wFAAwF;AACxF,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,sBAAsB,EAAE,CAiBnI;AAED,uGAAuG;AACvG,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAyBnI;AAED,uFAAuF;AACvF,wBAAgB,0BAA0B,CAAC,CAAC,EAC3C,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,IAAI,EAAE,KAAK,GAAG,QAAQ,EACtB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,GACf,aAAa,CAAC,CAAC,CAAC,CAuBlB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TableDocument, type TableDocumentPosition, type TableDocumentRange } from "./tableDocument";
|
|
2
|
+
/** Проверяет пересечение двух включительных прямоугольников полной сетки. */
|
|
3
|
+
export declare function tableDocumentRangesIntersect(a: TableDocumentRange, b: TableDocumentRange): boolean;
|
|
4
|
+
/** Fail-closed инварианты для команд и внешней runtime-schema приложения. */
|
|
5
|
+
export declare function assertTableDocument<T>(document: TableDocument<T>): void;
|
|
6
|
+
/** Проверяет границы до выполнения команды, не исправляя ошибочный ввод молча. */
|
|
7
|
+
export declare function assertTableDocumentRange<T>(document: TableDocument<T>, range: TableDocumentRange): void;
|
|
8
|
+
/** Возвращает видимый anchor для любой позиции, включая покрытую объединением. */
|
|
9
|
+
export declare function getTableDocumentCellRange<T>(document: TableDocument<T>, position: TableDocumentPosition): TableDocumentRange;
|
|
10
|
+
/**
|
|
11
|
+
* Замыкает выделение до неподвижной точки. Повторный обход обязателен: новая
|
|
12
|
+
* строка прямоугольника может пересечь ещё одно объединение вне исходной области.
|
|
13
|
+
*/
|
|
14
|
+
export declare function expandTableDocumentRange<T>(document: TableDocument<T>, start: TableDocumentPosition, end: TableDocumentPosition): TableDocumentRange;
|
|
15
|
+
//# sourceMappingURL=tableDocumentGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableDocumentGeometry.d.ts","sourceRoot":"","sources":["../../src/table-document/tableDocumentGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,aAAa,EAAE,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEpI,6EAA6E;AAC7E,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAIlG;AAED,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAmCvE;AAED,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAWvG;AAED,kFAAkF;AAClF,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,qBAAqB,GAAG,kBAAkB,CAI5H;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EACzC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,KAAK,EAAE,qBAAqB,EAC5B,GAAG,EAAE,qBAAqB,GACxB,kBAAkB,CAwBpB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type TableDocument, type TableDocumentPosition } from "./tableDocument";
|
|
2
|
+
/** Меняет ровно одну логическую ячейку; преобразование rich text/документов выполняет приложение. */
|
|
3
|
+
export declare function updateTableDocumentCell<T>(document: TableDocument<T>, position: TableDocumentPosition, value: T): TableDocument<T>;
|
|
4
|
+
//# sourceMappingURL=updateTableDocumentCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateTableDocumentCell.d.ts","sourceRoot":"","sources":["../../src/table-document/updateTableDocumentCell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGjF,qGAAqG;AACrG,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CASlI"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryuzaki13/react-foundation-lib",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Reusable React and TypeScript foundation utilities, hooks, and primitives.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ryuzaki13",
|
|
@@ -73,6 +73,10 @@
|
|
|
73
73
|
"types": "./dist/error-report/index.d.ts",
|
|
74
74
|
"import": "./dist/error-report/index.js"
|
|
75
75
|
},
|
|
76
|
+
"./error-report-build": {
|
|
77
|
+
"types": "./dist/error-report-build/index.d.ts",
|
|
78
|
+
"import": "./dist/error-report-build/index.js"
|
|
79
|
+
},
|
|
76
80
|
"./error-report-source-maps": {
|
|
77
81
|
"types": "./dist/error-report-source-maps/index.d.ts",
|
|
78
82
|
"import": "./dist/error-report-source-maps/index.js"
|
|
@@ -161,6 +165,10 @@
|
|
|
161
165
|
"types": "./dist/table/index.d.ts",
|
|
162
166
|
"import": "./dist/table/index.js"
|
|
163
167
|
},
|
|
168
|
+
"./table-document": {
|
|
169
|
+
"types": "./dist/table-document/index.d.ts",
|
|
170
|
+
"import": "./dist/table-document/index.js"
|
|
171
|
+
},
|
|
164
172
|
"./three-scene": {
|
|
165
173
|
"types": "./dist/three-scene/index.d.ts",
|
|
166
174
|
"import": "./dist/three-scene/index.js"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Документ редактируемой таблицы
|
|
2
|
+
|
|
3
|
+
Public API: `@ryuzaki13/react-foundation-lib/table-document`.
|
|
4
|
+
|
|
5
|
+
Чистое ядро для конструктора таблиц. Полная прямоугольная матрица хранит значения
|
|
6
|
+
всех ячеек, а отдельный массив `merges` — непересекающиеся объединения. Merge
|
|
7
|
+
никогда не удаляет содержимое покрытых ячеек; split возвращает их видимость.
|
|
8
|
+
Значения generic: приложение владеет rich text, ссылками, DTO и сериализацией.
|
|
9
|
+
|
|
10
|
+
Команды возвращают новый документ без мутации исходного. Неизменённые строки
|
|
11
|
+
и значения сохраняются по ссылке, что позволяет строить историю undo/redo.
|
|
12
|
+
Выделение замыкается по всем пересечённым объединениям до неподвижной точки.
|
|
13
|
+
Заголовок не объединяется и не переставляется с body. Вставка внутри области
|
|
14
|
+
увеличивает span; удаление и перемещение работают с неразрывной группой.
|
|
15
|
+
Перед удалением UI должен показать фактический размер группы и подтвердить его.
|
|
16
|
+
|
|
17
|
+
`assertTableDocument` проверяет геометрию типизированного документа, но не
|
|
18
|
+
заменяет runtime-парсер неизвестного JSON на внешней границе приложения.
|
|
19
|
+
Лимит — 20 000 логических ячеек. ID должны быть непустыми и уникальными во всём
|
|
20
|
+
документе. Генерацию ID выполнять в обработчике события, не во время render.
|
|
21
|
+
|
|
22
|
+
Это новый additive API, существующий `/table` и его selection contracts не
|
|
23
|
+
изменяются. Миграцию базы потребителя пакет не выполняет.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildIdentity-uQE5d9pd.js","names":[],"sources":["../../src/error-report/buildIdentity.ts"],"sourcesContent":["/** Полный lowercase Git commit SHA является переносимым identity production-сборки. */\nexport const ERROR_REPORT_BUILD_ID_PATTERN = /^[0-9a-f]{40}$/;\n"],"mappings":";AACA,IAAa,IAAgC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildIdentity.d.ts","sourceRoot":"","sources":["../../src/error-report/buildIdentity.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,eAAO,MAAM,6BAA6B,QAAmB,CAAC"}
|