muon-ui 0.22.0 → 0.23.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.
Files changed (43) hide show
  1. package/dist/cli.cjs +12 -11
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/index.cjs +2 -2
  4. package/dist/index.mjs +2 -2
  5. package/dist/native/linux-amd64/muon-builder +0 -0
  6. package/dist/native/linux-amd64/muon-launcher +0 -0
  7. package/dist/native/linux-amd64/muon-runtime-helper +0 -0
  8. package/dist/native/linux-arm64/muon-builder +0 -0
  9. package/dist/native/linux-arm64/muon-launcher +0 -0
  10. package/dist/native/linux-arm64/muon-runtime-helper +0 -0
  11. package/dist/native/linux-armhf/muon-builder +0 -0
  12. package/dist/native/linux-armhf/muon-launcher +0 -0
  13. package/dist/native/linux-armhf/muon-runtime-helper +0 -0
  14. package/dist/native/windows-amd64/muon-builder.exe +0 -0
  15. package/dist/native/windows-amd64/muon-launcher.exe +0 -0
  16. package/dist/native/windows-amd64/muon-plugin-inspector.exe +0 -0
  17. package/dist/native/windows-i686/muon-builder.exe +0 -0
  18. package/dist/native/windows-i686/muon-launcher.exe +0 -0
  19. package/dist/native/windows-i686/muon-plugin-inspector.exe +0 -0
  20. package/dist/runtime/linux-amd64/muon-core +0 -0
  21. package/dist/runtime/linux-amd64/plugins/node-bridge.mjs +2 -2
  22. package/dist/runtime/linux-arm64/muon-core +0 -0
  23. package/dist/runtime/linux-arm64/plugins/node-bridge.mjs +2 -2
  24. package/dist/runtime/linux-armhf/muon-core +0 -0
  25. package/dist/runtime/linux-armhf/plugins/node-bridge.mjs +2 -2
  26. package/dist/runtime/windows-amd64/libcardio.dll +0 -0
  27. package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
  28. package/dist/runtime/windows-amd64/muon-core.exe +0 -0
  29. package/dist/runtime/windows-amd64/plugins/node-bridge.mjs +2 -2
  30. package/dist/runtime/windows-amd64/plugins/node.dll +0 -0
  31. package/dist/runtime/windows-i686/libcardio.dll +0 -0
  32. package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
  33. package/dist/runtime/windows-i686/muon-core.exe +0 -0
  34. package/dist/runtime/windows-i686/plugins/node-bridge.mjs +2 -2
  35. package/dist/runtime/windows-i686/plugins/node.dll +0 -0
  36. package/dist/{vite-internals-BA4riWRd.cjs → vite-internals-Dk85Y_D_.cjs} +12 -9
  37. package/dist/{vite-internals-BA4riWRd.cjs.map → vite-internals-Dk85Y_D_.cjs.map} +1 -1
  38. package/dist/vite.cjs +3 -3
  39. package/dist/vite.cjs.map +1 -1
  40. package/dist/vite.mjs +11 -8
  41. package/dist/vite.mjs.map +1 -1
  42. package/package.json +7 -7
  43. package/vite.d.ts +9 -6
@@ -1 +1 @@
1
- {"version":3,"file":"vite-internals-BA4riWRd.cjs","names":["module","exports"],"sources":["../src/targets.ts","../src/progress.ts","../src/prepare.ts","../src/gitignore.ts","../../node_modules/json5/dist/index.js","../src/embed-config.ts","../src/windows-icon.ts","../src/app-icon.ts","../src/windows-resource.ts","../src/linux-desktop.ts","../src/windows-code-signing.ts","../../node_modules/semver/internal/lrucache.js","../../node_modules/semver/internal/parse-options.js","../../node_modules/semver/internal/constants.js","../../node_modules/semver/internal/debug.js","../../node_modules/semver/internal/re.js","../../node_modules/semver/internal/identifiers.js","../../node_modules/semver/classes/semver.js","../../node_modules/semver/functions/compare.js","../../node_modules/semver/functions/eq.js","../../node_modules/semver/functions/neq.js","../../node_modules/semver/functions/gt.js","../../node_modules/semver/functions/gte.js","../../node_modules/semver/functions/lt.js","../../node_modules/semver/functions/lte.js","../../node_modules/semver/functions/cmp.js","../../node_modules/semver/classes/comparator.js","../../node_modules/semver/classes/range.js","../src/node-project.ts","../src/build.ts","../src/vite-options.ts","../src/vite-assets.ts","../src/build-sequence.ts","../src/vite-internals.ts"],"sourcesContent":["// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/**\n * Public muon target platform identifier.\n */\nexport type MuonTarget =\n | \"linux-amd64\"\n | \"linux-armhf\"\n | \"linux-arm64\"\n | \"windows-i686\"\n | \"windows-amd64\";\n\n/**\n * Internal CEF target platform identifier.\n */\nexport type MuonCefTarget =\n | \"linux64\"\n | \"linuxarm\"\n | \"linuxarm64\"\n | \"windows32\"\n | \"windows64\";\n\n/**\n * muon target operating system family.\n */\nexport type MuonTargetOperatingSystem = \"linux\" | \"windows\";\n\n/**\n * Metadata for one supported muon target.\n */\nexport interface MuonTargetDescriptor {\n /**\n * Public target identifier accepted by muon CLI and Vite options.\n */\n id: MuonTarget;\n /**\n * Internal CEF target identifier used for CEF catalog and native builds.\n */\n cefTarget: MuonCefTarget;\n /**\n * Operating system family.\n */\n os: MuonTargetOperatingSystem;\n /**\n * Public architecture name used in package artifact names.\n */\n arch: \"amd64\" | \"armhf\" | \"arm64\" | \"i686\";\n /**\n * Fixed dist directory path for generated app distributions.\n */\n distributionDirectoryName: string;\n /**\n * muon-core executable file name for this target.\n */\n runtimeExecutableName: string;\n /**\n * Runtime executable file names other than {@link runtimeExecutableName}.\n *\n * @remarks Every entry must also be present in {@link runtimeFiles}. Generated\n * distributions normalize these files to executable mode.\n */\n runtimeAuxiliaryExecutableNames: readonly string[];\n /**\n * muon-launcher executable file name for this target.\n */\n launcherExecutableName: string;\n /**\n * Optional privileged runtime helper executable file name.\n */\n runtimeHelperExecutableName?: string;\n /**\n * Launcher file suffix for app launcher executables.\n */\n launcherExtension: string;\n /**\n * Required runtime files copied into generated app distributions.\n */\n runtimeFiles: readonly string[];\n /**\n * Optional runtime files copied when they exist.\n */\n optionalRuntimeFilePatterns?: readonly RegExp[];\n}\n\n/**\n * Supported public muon targets in deterministic build order.\n */\nexport const allMuonTargets = [\n \"linux-amd64\",\n \"linux-armhf\",\n \"linux-arm64\",\n \"windows-i686\",\n \"windows-amd64\",\n] as const satisfies readonly MuonTarget[];\n\nconst targetDescriptors = {\n \"linux-amd64\": {\n id: \"linux-amd64\",\n cefTarget: \"linux64\",\n os: \"linux\",\n arch: \"amd64\",\n distributionDirectoryName: \"dist-muon/linux-amd64\",\n runtimeExecutableName: \"muon-core\",\n runtimeAuxiliaryExecutableNames: [\"muon-executor-supervisor\"],\n launcherExecutableName: \"muon-launcher\",\n runtimeHelperExecutableName: \"muon-runtime-helper\",\n launcherExtension: \"\",\n runtimeFiles: [\n \"muon-core\",\n \"muon-executor-supervisor\",\n \"libmuon-ui.so\",\n \"libcardio.so\",\n ],\n },\n \"linux-armhf\": {\n id: \"linux-armhf\",\n cefTarget: \"linuxarm\",\n os: \"linux\",\n arch: \"armhf\",\n distributionDirectoryName: \"dist-muon/linux-armhf\",\n runtimeExecutableName: \"muon-core\",\n runtimeAuxiliaryExecutableNames: [\"muon-executor-supervisor\"],\n launcherExecutableName: \"muon-launcher\",\n runtimeHelperExecutableName: \"muon-runtime-helper\",\n launcherExtension: \"\",\n runtimeFiles: [\n \"muon-core\",\n \"muon-executor-supervisor\",\n \"libmuon-ui.so\",\n \"libcardio.so\",\n ],\n },\n \"linux-arm64\": {\n id: \"linux-arm64\",\n cefTarget: \"linuxarm64\",\n os: \"linux\",\n arch: \"arm64\",\n distributionDirectoryName: \"dist-muon/linux-arm64\",\n runtimeExecutableName: \"muon-core\",\n runtimeAuxiliaryExecutableNames: [\"muon-executor-supervisor\"],\n launcherExecutableName: \"muon-launcher\",\n runtimeHelperExecutableName: \"muon-runtime-helper\",\n launcherExtension: \"\",\n runtimeFiles: [\n \"muon-core\",\n \"muon-executor-supervisor\",\n \"libmuon-ui.so\",\n \"libcardio.so\",\n ],\n },\n \"windows-i686\": {\n id: \"windows-i686\",\n cefTarget: \"windows32\",\n os: \"windows\",\n arch: \"i686\",\n distributionDirectoryName: \"dist-muon/windows-i686\",\n runtimeExecutableName: \"muon-core.exe\",\n runtimeAuxiliaryExecutableNames: [],\n launcherExecutableName: \"muon-launcher.exe\",\n launcherExtension: \".exe\",\n runtimeFiles: [\"muon-core.exe\", \"libmuon-ui.dll\", \"libcardio.dll\"],\n optionalRuntimeFilePatterns: [\n /^libgcc_s_.*-1\\.dll$/,\n /^libstdc\\+\\+-6\\.dll$/,\n /^libwinpthread-1\\.dll$/,\n ],\n },\n \"windows-amd64\": {\n id: \"windows-amd64\",\n cefTarget: \"windows64\",\n os: \"windows\",\n arch: \"amd64\",\n distributionDirectoryName: \"dist-muon/windows-amd64\",\n runtimeExecutableName: \"muon-core.exe\",\n runtimeAuxiliaryExecutableNames: [],\n launcherExecutableName: \"muon-launcher.exe\",\n launcherExtension: \".exe\",\n runtimeFiles: [\"muon-core.exe\", \"libmuon-ui.dll\", \"libcardio.dll\"],\n optionalRuntimeFilePatterns: [\n /^libgcc_s_.*-1\\.dll$/,\n /^libstdc\\+\\+-6\\.dll$/,\n /^libwinpthread-1\\.dll$/,\n ],\n },\n} as const satisfies Record<MuonTarget, MuonTargetDescriptor>;\n\nconst targetByCefTarget = Object.fromEntries(\n allMuonTargets.map((target) => [targetDescriptors[target].cefTarget, target]),\n) as Record<MuonCefTarget, MuonTarget>;\n\n/**\n * Returns metadata for a public muon target.\n *\n * @param target Public muon target.\n * @returns Target descriptor.\n */\nexport const getMuonTargetDescriptor = (\n target: MuonTarget,\n): MuonTargetDescriptor => targetDescriptors[target];\n\n/**\n * Returns the runtime app identifier embedded for one target distribution.\n *\n * @param appId Base sanitized application identifier.\n * @param target Public muon target.\n * @returns Target runtime application identifier.\n *\n * @remarks Windows targets append their public architecture name so 32-bit and\n * 64-bit packages do not share runtime state or installer identities.\n */\nexport const getMuonTargetRuntimeAppId = (\n appId: string,\n target: MuonTarget,\n): string => {\n const descriptor = getMuonTargetDescriptor(target);\n return descriptor.os === \"windows\" ? `${appId}.${descriptor.arch}` : appId;\n};\n\n/**\n * Normalizes a user supplied public muon target.\n *\n * @param target Target value supplied by the user.\n * @param label Error label used in diagnostics.\n * @returns Public muon target.\n */\nexport const normalizeMuonTarget = (\n target: string,\n label = \"muon target\",\n): MuonTarget => {\n const normalized = target.trim().toLowerCase();\n if (allMuonTargets.includes(normalized as MuonTarget)) {\n return normalized as MuonTarget;\n }\n throw new Error(`Unsupported ${label}: ${target}`);\n};\n\n/**\n * Resolves a Node platform and architecture pair to a public muon target.\n *\n * @param platform Node platform.\n * @param architecture Node architecture.\n * @returns Public muon target.\n */\nexport const getDefaultMuonTarget = (\n platform: NodeJS.Platform,\n architecture: NodeJS.Architecture,\n): MuonTarget => {\n if (platform === \"win32\") {\n if (architecture === \"ia32\") {\n return \"windows-i686\";\n }\n if (architecture === \"x64\") {\n return \"windows-amd64\";\n }\n }\n if (platform === \"linux\") {\n if (architecture === \"x64\") {\n return \"linux-amd64\";\n }\n if (architecture === \"arm\") {\n return \"linux-armhf\";\n }\n if (architecture === \"arm64\") {\n return \"linux-arm64\";\n }\n }\n throw new Error(\n `Unsupported muon target: platform=${platform}, arch=${architecture}`,\n );\n};\n\n/**\n * Resolves an internal CEF target to a public muon target.\n *\n * @param cefTarget Internal CEF target.\n * @returns Public muon target.\n */\nexport const getMuonTargetForCefTarget = (\n cefTarget: MuonCefTarget,\n): MuonTarget => targetByCefTarget[cefTarget];\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/**\n * Progress event used by internal muon build, pack, and prepare operations.\n *\n * @internal\n */\nexport interface MuonProgressEvent {\n /**\n * Stable phase identifier.\n *\n * @internal\n */\n phase: string;\n\n /**\n * Human-readable single-line status.\n *\n * @internal\n */\n status: string;\n\n /**\n * Current progress value.\n *\n * @internal\n */\n current?: number;\n\n /**\n * Total progress value.\n *\n * @internal\n */\n total?: number;\n\n /**\n * True when current and total form bounded progress.\n *\n * @internal\n */\n determinate?: boolean;\n}\n\n/**\n * Receives internal muon progress events.\n *\n * @internal\n */\nexport type MuonProgressCallback = (event: MuonProgressEvent) => void;\n\n/**\n * Renders internal muon progress events to stderr.\n *\n * @internal\n */\nexport interface MuonProgressRenderer {\n /**\n * Render a progress event.\n *\n * @internal\n */\n report(event: MuonProgressEvent): void;\n\n /**\n * Complete the active status line.\n *\n * @internal\n */\n flush(): void;\n}\n\nconst spinnerFrames = [\"-\", \"\\\\\", \"|\", \"/\"] as const;\nconst spinnerIntervalMilliseconds = 200;\nconst terminalLineStart = \"\\r\";\nconst terminalClearLine = \"\\x1b[K\";\n\nconst clampProgressValue = (value: number, total: number): number =>\n Math.max(0, Math.min(value, total));\n\nconst formatProgressEvent = (event: MuonProgressEvent): string => {\n const status = event.status.trimEnd();\n const current = event.current ?? 0;\n const total = event.total ?? 0;\n if (event.determinate === true && total > 0) {\n const percentage = Math.floor(\n (clampProgressValue(current, total) / total) * 100,\n );\n return `${status} ${percentage}%`;\n }\n if (event.phase === \"installing\" && current > 0) {\n return `${status} ${Math.trunc(current)} files`;\n }\n return status;\n};\n\ninterface ActiveProgressLine {\n key: string;\n text: string;\n}\n\nconst getProgressLineKey = (event: MuonProgressEvent): string =>\n `${event.phase}\\0${event.status.trimEnd()}`;\n\nconst createSpinnerProgressRenderer = (): MuonProgressRenderer => {\n let activeLine: ActiveProgressLine | undefined = undefined;\n let frameIndex = 0;\n let timer: NodeJS.Timeout | undefined = undefined;\n\n const writeRaw = (chunk: string): void => {\n process.stderr.write(chunk);\n };\n\n const stopTimer = (): void => {\n if (timer !== undefined) {\n clearInterval(timer);\n timer = undefined;\n }\n };\n\n const renderLine = (): void => {\n if (activeLine === undefined) {\n return;\n }\n const frame = spinnerFrames[frameIndex] ?? spinnerFrames[0];\n writeRaw(\n `${terminalLineStart}${frame} ${activeLine.text}${terminalClearLine}`,\n );\n frameIndex = (frameIndex + 1) % spinnerFrames.length;\n };\n\n const ensureTimer = (): void => {\n if (timer === undefined) {\n timer = setInterval(renderLine, spinnerIntervalMilliseconds);\n timer.unref();\n }\n };\n\n const finishLine = (): void => {\n if (activeLine === undefined) {\n return;\n }\n stopTimer();\n const text = activeLine.text;\n activeLine = undefined;\n frameIndex = 0;\n writeRaw(`${terminalLineStart}${text}${terminalClearLine}\\n`);\n };\n\n return {\n report: (event): void => {\n const nextLine = {\n key: getProgressLineKey(event),\n text: formatProgressEvent(event),\n };\n if (activeLine === undefined) {\n activeLine = nextLine;\n renderLine();\n ensureTimer();\n return;\n }\n if (activeLine.key !== nextLine.key) {\n finishLine();\n activeLine = nextLine;\n renderLine();\n } else {\n activeLine = nextLine;\n }\n ensureTimer();\n },\n flush: finishLine,\n };\n};\n\n/**\n * Creates a stderr progress renderer for the current terminal mode.\n *\n * @internal\n */\nexport const createMuonProgressRenderer = (): MuonProgressRenderer =>\n createSpinnerProgressRenderer();\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn } from \"node:child_process\";\nimport { constants } from \"node:fs\";\nimport { access } from \"node:fs/promises\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, join } from \"node:path\";\nimport {\n getDefaultMuonTarget,\n normalizeMuonTarget,\n type MuonTarget,\n} from \"./targets.js\";\nimport {\n createMuonProgressRenderer,\n type MuonProgressEvent,\n} from \"./progress.js\";\nimport type { MuonNodeRuntimeRequirement } from \"./node-project.js\";\n\n/**\n * Options used to invoke the native muon builder helper.\n */\nexport interface MuonPrepareOptions {\n /**\n * Directory containing muon-core runtime files.\n */\n muonPath: string;\n\n /**\n * Directory containing CEF files, or a CEF archive root with Release/Resources.\n */\n cefPath: string | undefined;\n\n /**\n * Directory where the executable runtime is staged.\n */\n stageDir: string | undefined;\n\n /**\n * Public target runtime platform such as linux-amd64 or windows-amd64.\n */\n target: string | undefined;\n\n /**\n * Cache directory passed to muon-builder.\n */\n cacheDir: string | undefined;\n\n /**\n * Node runtime requirement used to select or validate a sidecar runtime.\n *\n * @remarks This is `undefined` when the application has no Node project.\n */\n nodeRuntimeRequirement: MuonNodeRuntimeRequirement | undefined;\n\n /**\n * Rebuild an existing prepared runtime.\n */\n force: boolean;\n\n /**\n * Suppress progress messages from the native builder process.\n */\n quiet: boolean;\n\n /**\n * Explicit native muon-builder executable path.\n */\n prepareExecutablePath: string | undefined;\n\n /**\n * Environment used for the child process.\n */\n environment: NodeJS.ProcessEnv;\n\n /**\n * Working directory used for the child process.\n */\n cwd: string | undefined;\n}\n\n/**\n * Options used to update Windows PE resources through the native muon helper.\n */\nexport interface MuonPrepareResourceUpdateOptions {\n /**\n * Input PE executable path.\n */\n inputPath: string;\n\n /**\n * Engraver update JSON path.\n */\n updatesJsonPath: string;\n\n /**\n * Output PE executable path.\n *\n * @remarks This must be different from `inputPath`.\n */\n outputPath: string;\n\n /**\n * Suppress progress messages from the native builder process.\n */\n quiet: boolean;\n\n /**\n * Explicit native muon-builder executable path.\n */\n prepareExecutablePath: string | undefined;\n\n /**\n * Environment used for the child process.\n */\n environment: NodeJS.ProcessEnv;\n\n /**\n * Working directory used for the child process.\n */\n cwd: string | undefined;\n}\n\n/**\n * Result returned by native muon-builder.\n */\nexport interface MuonPrepareResult {\n /**\n * Directory containing the staged muon runtime.\n */\n stagePath?: string;\n\n /**\n * Directory containing muon-core files used as the staging source.\n */\n muonPath: string;\n\n /**\n * Directory or cached archive containing CEF files used as the staging source.\n */\n cefPath: string;\n\n /**\n * True when an existing prepared runtime was reused.\n */\n cacheHit: boolean;\n}\n\n/**\n * Returns the default muon prepare target for a Node platform and architecture.\n *\n * @param platform Node platform.\n * @param architecture Node architecture.\n * @returns muon prepare target name.\n */\nexport const getDefaultMuonPrepareTarget = (\n platform: NodeJS.Platform,\n architecture: NodeJS.Architecture,\n): MuonTarget => {\n try {\n return getDefaultMuonTarget(platform, architecture);\n } catch {\n throw new Error(\n `Unsupported muon prepare target: platform=${platform}, arch=${architecture}`,\n );\n }\n};\n\nconst getBuilderExecutableName = (platform: NodeJS.Platform): string =>\n platform === \"win32\" ? \"muon-builder.exe\" : \"muon-builder\";\n\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\nconst canExecute = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst resolveMuonBuilderExecutable = async (\n options: Pick<MuonPrepareOptions, \"prepareExecutablePath\" | \"environment\">,\n): Promise<string> => {\n const explicit =\n options.prepareExecutablePath ?? options.environment.MUON_BUILDER_PATH;\n if (explicit !== undefined && explicit !== \"\") {\n return explicit;\n }\n const executableName = getBuilderExecutableName(process.platform);\n const target = getDefaultMuonPrepareTarget(process.platform, process.arch);\n const candidates = [\n join(moduleDirectory, \"native\", target, executableName),\n join(moduleDirectory, \"..\", \"dist\", \"native\", target, executableName),\n ];\n for (const candidate of candidates) {\n if (await canExecute(candidate)) {\n return candidate;\n }\n }\n return candidates[0] ?? executableName;\n};\n\nconst createMuonPrepareArguments = (options: MuonPrepareOptions): string[] => {\n const args = [\"runtime\", \"--muon-path\", options.muonPath, \"--json\"];\n if (!options.quiet) {\n args.push(\"--progress-json\");\n }\n if (options.cefPath !== undefined) {\n args.push(\"--cef-path\", options.cefPath);\n }\n if (options.stageDir !== undefined) {\n args.push(\"--stage-dir\", options.stageDir);\n }\n if (options.target !== undefined) {\n args.push(\n \"--target\",\n normalizeMuonTarget(options.target, \"muon prepare target\"),\n );\n }\n if (options.cacheDir !== undefined) {\n args.push(\"--cache-dir\", options.cacheDir);\n }\n if (options.nodeRuntimeRequirement !== undefined) {\n args.push(\n \"--node-runtime-requirement\",\n JSON.stringify(options.nodeRuntimeRequirement),\n );\n }\n if (options.force) {\n args.push(\"--force\");\n }\n if (options.quiet) {\n args.push(\"--quiet\");\n }\n return args;\n};\n\ninterface MuonPrepareStderrForwarder {\n write(chunk: string): void;\n flush(): void;\n}\n\nconst createPlainStderrForwarder = (): MuonPrepareStderrForwarder => ({\n write: (chunk): void => {\n process.stderr.write(chunk);\n },\n flush: (): void => {},\n});\n\nconst parseProgressJsonLine = (line: string): MuonProgressEvent | undefined => {\n const trimmed = line.trim();\n if (!trimmed.startsWith(\"{\")) {\n return undefined;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed);\n } catch {\n return undefined;\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const event = parsed as Record<string, unknown>;\n if (typeof event.phase !== \"string\" || typeof event.status !== \"string\") {\n return undefined;\n }\n const current =\n typeof event.current === \"number\" && Number.isFinite(event.current)\n ? event.current\n : undefined;\n const total =\n typeof event.total === \"number\" && Number.isFinite(event.total)\n ? event.total\n : undefined;\n const determinate =\n typeof event.determinate === \"boolean\" ? event.determinate : undefined;\n return {\n phase: event.phase,\n status: event.status,\n ...(current === undefined ? {} : { current }),\n ...(total === undefined ? {} : { total }),\n ...(determinate === undefined ? {} : { determinate }),\n };\n};\n\nconst createProgressJsonStderrForwarder = (): MuonPrepareStderrForwarder => {\n let pending = \"\";\n const renderer = createMuonProgressRenderer();\n\n const writeLine = (line: string): void => {\n const event = parseProgressJsonLine(line);\n if (event !== undefined) {\n renderer.report(event);\n }\n };\n\n return {\n write: (chunk): void => {\n pending += chunk;\n for (;;) {\n const newlineIndex = pending.indexOf(\"\\n\");\n if (newlineIndex < 0) {\n break;\n }\n const line = pending.slice(0, newlineIndex + 1);\n pending = pending.slice(newlineIndex + 1);\n writeLine(line);\n }\n },\n flush: (): void => {\n if (pending.length > 0) {\n const line = pending;\n pending = \"\";\n writeLine(line);\n }\n renderer.flush();\n },\n };\n};\n\nconst runMuonPrepareCommand = async (\n options: Pick<MuonPrepareOptions, \"prepareExecutablePath\" | \"environment\"> & {\n args: readonly string[];\n cwd: string | undefined;\n quiet: boolean;\n parseProgressJson: boolean;\n },\n): Promise<string> => {\n const executable = await resolveMuonBuilderExecutable(options);\n const child = spawn(executable, [...options.args], {\n cwd: options.cwd,\n env: options.environment,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n let stdout = \"\";\n let stderr = \"\";\n child.stdout.setEncoding(\"utf8\");\n child.stderr.setEncoding(\"utf8\");\n const stderrForwarder = options.quiet\n ? undefined\n : options.parseProgressJson\n ? createProgressJsonStderrForwarder()\n : createPlainStderrForwarder();\n child.stdout.on(\"data\", (chunk: string) => {\n stdout += chunk;\n });\n child.stderr.on(\"data\", (chunk: string) => {\n stderr += chunk;\n stderrForwarder?.write(chunk);\n });\n const exitCode = await (async (): Promise<number> => {\n try {\n return await new Promise<number>((resolvePromise, reject) => {\n child.on(\"error\", reject);\n child.on(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n } finally {\n stderrForwarder?.flush();\n }\n })();\n if (exitCode !== 0) {\n throw new Error(\n `muon-builder failed with exit code ${exitCode}.\\n${stderr.trim()}`,\n );\n }\n return stdout;\n};\n\n/**\n * Invokes the native muon-builder executable and returns the prepared runtime.\n *\n * @param options Native prepare invocation options.\n * @returns Prepared runtime location.\n */\nexport const runMuonPrepare = async (\n options: MuonPrepareOptions,\n): Promise<MuonPrepareResult> => {\n const args = createMuonPrepareArguments(options);\n const stdout = await runMuonPrepareCommand({\n prepareExecutablePath: options.prepareExecutablePath,\n environment: options.environment,\n cwd: options.cwd,\n quiet: options.quiet,\n parseProgressJson: !options.quiet,\n args,\n });\n const result = JSON.parse(stdout) as Partial<MuonPrepareResult>;\n if (\n (result.stagePath !== undefined && typeof result.stagePath !== \"string\") ||\n typeof result.muonPath !== \"string\" ||\n typeof result.cefPath !== \"string\" ||\n typeof result.cacheHit !== \"boolean\"\n ) {\n throw new Error(`muon-builder returned invalid JSON: ${stdout}`);\n }\n return {\n ...(result.stagePath === undefined ? {} : { stagePath: result.stagePath }),\n muonPath: result.muonPath,\n cefPath: result.cefPath,\n cacheHit: result.cacheHit,\n };\n};\n\n/**\n * Invokes the native muon-builder executable to write Windows PE resources.\n *\n * @param options Resource update invocation options.\n */\nexport const runMuonPrepareResourceUpdate = async (\n options: MuonPrepareResourceUpdateOptions,\n): Promise<void> => {\n await runMuonPrepareCommand({\n prepareExecutablePath: options.prepareExecutablePath,\n environment: options.environment,\n cwd: options.cwd,\n quiet: options.quiet,\n parseProgressJson: false,\n args: [\n \"resource\",\n \"--input\",\n options.inputPath,\n \"--updates-json\",\n options.updatesJsonPath,\n \"--output\",\n options.outputPath,\n ...(options.quiet ? [\"--quiet\"] : []),\n ],\n });\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nconst muonGitignoreEntries = [\".muon/\", \"dist-muon/\", \"artifacts/\"] as const;\n\ntype MuonGitignoreEntry = (typeof muonGitignoreEntries)[number];\n\nconst muonGitignoreEntryAliases: Record<MuonGitignoreEntry, readonly string[]> =\n {\n \".muon/\": [\".muon/\", \"/.muon/\", \".muon\", \"/.muon\"],\n \"dist-muon/\": [\n \"dist-muon/\",\n \"/dist-muon/\",\n \"dist-muon\",\n \"/dist-muon\",\n \"dist-muon/*\",\n \"/dist-muon/*\",\n ],\n \"artifacts/\": [\"artifacts/\", \"/artifacts/\", \"artifacts\", \"/artifacts\"],\n };\n\n/**\n * Result of ensuring muon generated directories are ignored by Git.\n */\nexport interface MuonGitignoreResult {\n /**\n * Path of the .gitignore file that was checked or updated.\n */\n gitignorePath: string;\n\n /**\n * True when the file was created or appended.\n */\n changed: boolean;\n}\n\nconst isMissingFileError = (error: unknown): boolean =>\n error instanceof Error && (error as NodeJS.ErrnoException).code === \"ENOENT\";\n\nconst hasMuonGitignoreEntry = (\n content: string,\n entry: MuonGitignoreEntry,\n): boolean =>\n content\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .some((line) => muonGitignoreEntryAliases[entry].includes(line));\n\n/**\n * Adds muon generated directories to a project .gitignore file.\n *\n * @param root Project root containing the .gitignore file.\n * @returns Gitignore update result.\n */\nexport const ensureMuonGitignoreEntry = async (\n root: string,\n): Promise<MuonGitignoreResult> => {\n const gitignorePath = join(root, \".gitignore\");\n let content = \"\";\n try {\n content = await readFile(gitignorePath, \"utf8\");\n } catch (error) {\n if (!isMissingFileError(error)) {\n throw error;\n }\n }\n\n const missingEntries = muonGitignoreEntries.filter(\n (entry) => !hasMuonGitignoreEntry(content, entry),\n );\n if (missingEntries.length === 0) {\n return {\n gitignorePath,\n changed: false,\n };\n }\n\n const separator = content.length > 0 && !content.endsWith(\"\\n\") ? \"\\n\" : \"\";\n await writeFile(\n gitignorePath,\n `${content}${separator}${missingEntries.join(\"\\n\")}\\n`,\n );\n return {\n gitignorePath,\n changed: true,\n };\n};\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.JSON5 = factory());\n}(this, (function () { 'use strict';\n\n\tfunction createCommonjsModule(fn, module) {\n\t\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n\t}\n\n\tvar _global = createCommonjsModule(function (module) {\n\t// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\n\tvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n\t ? window : typeof self != 'undefined' && self.Math == Math ? self\n\t // eslint-disable-next-line no-new-func\n\t : Function('return this')();\n\tif (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef\n\t});\n\n\tvar _core = createCommonjsModule(function (module) {\n\tvar core = module.exports = { version: '2.6.5' };\n\tif (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef\n\t});\n\tvar _core_1 = _core.version;\n\n\tvar _isObject = function (it) {\n\t return typeof it === 'object' ? it !== null : typeof it === 'function';\n\t};\n\n\tvar _anObject = function (it) {\n\t if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }\n\t return it;\n\t};\n\n\tvar _fails = function (exec) {\n\t try {\n\t return !!exec();\n\t } catch (e) {\n\t return true;\n\t }\n\t};\n\n\t// Thank's IE8 for his funny defineProperty\n\tvar _descriptors = !_fails(function () {\n\t return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n\t});\n\n\tvar document = _global.document;\n\t// typeof document.createElement is 'object' in old IE\n\tvar is = _isObject(document) && _isObject(document.createElement);\n\tvar _domCreate = function (it) {\n\t return is ? document.createElement(it) : {};\n\t};\n\n\tvar _ie8DomDefine = !_descriptors && !_fails(function () {\n\t return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;\n\t});\n\n\t// 7.1.1 ToPrimitive(input [, PreferredType])\n\n\t// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n\t// and the second argument - flag - preferred type is a string\n\tvar _toPrimitive = function (it, S) {\n\t if (!_isObject(it)) { return it; }\n\t var fn, val;\n\t if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }\n\t if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }\n\t if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }\n\t throw TypeError(\"Can't convert object to primitive value\");\n\t};\n\n\tvar dP = Object.defineProperty;\n\n\tvar f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n\t _anObject(O);\n\t P = _toPrimitive(P, true);\n\t _anObject(Attributes);\n\t if (_ie8DomDefine) { try {\n\t return dP(O, P, Attributes);\n\t } catch (e) { /* empty */ } }\n\t if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }\n\t if ('value' in Attributes) { O[P] = Attributes.value; }\n\t return O;\n\t};\n\n\tvar _objectDp = {\n\t\tf: f\n\t};\n\n\tvar _propertyDesc = function (bitmap, value) {\n\t return {\n\t enumerable: !(bitmap & 1),\n\t configurable: !(bitmap & 2),\n\t writable: !(bitmap & 4),\n\t value: value\n\t };\n\t};\n\n\tvar _hide = _descriptors ? function (object, key, value) {\n\t return _objectDp.f(object, key, _propertyDesc(1, value));\n\t} : function (object, key, value) {\n\t object[key] = value;\n\t return object;\n\t};\n\n\tvar hasOwnProperty = {}.hasOwnProperty;\n\tvar _has = function (it, key) {\n\t return hasOwnProperty.call(it, key);\n\t};\n\n\tvar id = 0;\n\tvar px = Math.random();\n\tvar _uid = function (key) {\n\t return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n\t};\n\n\tvar _library = false;\n\n\tvar _shared = createCommonjsModule(function (module) {\n\tvar SHARED = '__core-js_shared__';\n\tvar store = _global[SHARED] || (_global[SHARED] = {});\n\n\t(module.exports = function (key, value) {\n\t return store[key] || (store[key] = value !== undefined ? value : {});\n\t})('versions', []).push({\n\t version: _core.version,\n\t mode: _library ? 'pure' : 'global',\n\t copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n\t});\n\t});\n\n\tvar _functionToString = _shared('native-function-to-string', Function.toString);\n\n\tvar _redefine = createCommonjsModule(function (module) {\n\tvar SRC = _uid('src');\n\n\tvar TO_STRING = 'toString';\n\tvar TPL = ('' + _functionToString).split(TO_STRING);\n\n\t_core.inspectSource = function (it) {\n\t return _functionToString.call(it);\n\t};\n\n\t(module.exports = function (O, key, val, safe) {\n\t var isFunction = typeof val == 'function';\n\t if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }\n\t if (O[key] === val) { return; }\n\t if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }\n\t if (O === _global) {\n\t O[key] = val;\n\t } else if (!safe) {\n\t delete O[key];\n\t _hide(O, key, val);\n\t } else if (O[key]) {\n\t O[key] = val;\n\t } else {\n\t _hide(O, key, val);\n\t }\n\t// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n\t})(Function.prototype, TO_STRING, function toString() {\n\t return typeof this == 'function' && this[SRC] || _functionToString.call(this);\n\t});\n\t});\n\n\tvar _aFunction = function (it) {\n\t if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }\n\t return it;\n\t};\n\n\t// optional / simple context binding\n\n\tvar _ctx = function (fn, that, length) {\n\t _aFunction(fn);\n\t if (that === undefined) { return fn; }\n\t switch (length) {\n\t case 1: return function (a) {\n\t return fn.call(that, a);\n\t };\n\t case 2: return function (a, b) {\n\t return fn.call(that, a, b);\n\t };\n\t case 3: return function (a, b, c) {\n\t return fn.call(that, a, b, c);\n\t };\n\t }\n\t return function (/* ...args */) {\n\t return fn.apply(that, arguments);\n\t };\n\t};\n\n\tvar PROTOTYPE = 'prototype';\n\n\tvar $export = function (type, name, source) {\n\t var IS_FORCED = type & $export.F;\n\t var IS_GLOBAL = type & $export.G;\n\t var IS_STATIC = type & $export.S;\n\t var IS_PROTO = type & $export.P;\n\t var IS_BIND = type & $export.B;\n\t var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];\n\t var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});\n\t var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n\t var key, own, out, exp;\n\t if (IS_GLOBAL) { source = name; }\n\t for (key in source) {\n\t // contains in native\n\t own = !IS_FORCED && target && target[key] !== undefined;\n\t // export native or passed\n\t out = (own ? target : source)[key];\n\t // bind timers to global for call from export context\n\t exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;\n\t // extend global\n\t if (target) { _redefine(target, key, out, type & $export.U); }\n\t // export\n\t if (exports[key] != out) { _hide(exports, key, exp); }\n\t if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }\n\t }\n\t};\n\t_global.core = _core;\n\t// type bitmap\n\t$export.F = 1; // forced\n\t$export.G = 2; // global\n\t$export.S = 4; // static\n\t$export.P = 8; // proto\n\t$export.B = 16; // bind\n\t$export.W = 32; // wrap\n\t$export.U = 64; // safe\n\t$export.R = 128; // real proto method for `library`\n\tvar _export = $export;\n\n\t// 7.1.4 ToInteger\n\tvar ceil = Math.ceil;\n\tvar floor = Math.floor;\n\tvar _toInteger = function (it) {\n\t return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n\t};\n\n\t// 7.2.1 RequireObjectCoercible(argument)\n\tvar _defined = function (it) {\n\t if (it == undefined) { throw TypeError(\"Can't call method on \" + it); }\n\t return it;\n\t};\n\n\t// true -> String#at\n\t// false -> String#codePointAt\n\tvar _stringAt = function (TO_STRING) {\n\t return function (that, pos) {\n\t var s = String(_defined(that));\n\t var i = _toInteger(pos);\n\t var l = s.length;\n\t var a, b;\n\t if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }\n\t a = s.charCodeAt(i);\n\t return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n\t ? TO_STRING ? s.charAt(i) : a\n\t : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n\t };\n\t};\n\n\tvar $at = _stringAt(false);\n\t_export(_export.P, 'String', {\n\t // 21.1.3.3 String.prototype.codePointAt(pos)\n\t codePointAt: function codePointAt(pos) {\n\t return $at(this, pos);\n\t }\n\t});\n\n\tvar codePointAt = _core.String.codePointAt;\n\n\tvar max = Math.max;\n\tvar min = Math.min;\n\tvar _toAbsoluteIndex = function (index, length) {\n\t index = _toInteger(index);\n\t return index < 0 ? max(index + length, 0) : min(index, length);\n\t};\n\n\tvar fromCharCode = String.fromCharCode;\n\tvar $fromCodePoint = String.fromCodePoint;\n\n\t// length should be 1, old FF problem\n\t_export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {\n\t // 21.1.2.2 String.fromCodePoint(...codePoints)\n\t fromCodePoint: function fromCodePoint(x) {\n\t var arguments$1 = arguments;\n\t // eslint-disable-line no-unused-vars\n\t var res = [];\n\t var aLen = arguments.length;\n\t var i = 0;\n\t var code;\n\t while (aLen > i) {\n\t code = +arguments$1[i++];\n\t if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }\n\t res.push(code < 0x10000\n\t ? fromCharCode(code)\n\t : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)\n\t );\n\t } return res.join('');\n\t }\n\t});\n\n\tvar fromCodePoint = _core.String.fromCodePoint;\n\n\t// This is a generated file. Do not edit.\n\tvar Space_Separator = /[\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/;\n\tvar ID_Start = /[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u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10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312E\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FEA\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-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uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2]|\\uD804[\\uDC03-\\uDC37\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCA0-\\uDCDF\\uDCFF\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE83\\uDE86-\\uDE89\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879][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-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]/;\n\tvar ID_Continue = /[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u0860-\\u086A\\u08A0-\\u08B4\\u08B6-\\u08BD\\u08D4-\\u08E1\\u08E3-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u09FC\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-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D00-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D54-\\u0D57\\u0D5F-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1C80-\\u1C88\\u1CD0-\\u1CD2\\u1CD4-\\u1CF9\\u1D00-\\u1DF9\\u1DFB-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312E\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FEA\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C5\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA8FD\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\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\\uDC00-\\uDC08\\uDC0A-\\uDC36\\uDC38-\\uDC40\\uDC50-\\uDC59\\uDC72-\\uDC8F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD50-\\uDD59]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE60-\\uDE69\\uDED0-\\uDEED\\uDEF0-\\uDEF4\\uDF00-\\uDF36\\uDF40-\\uDF43\\uDF50-\\uDF59\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50-\\uDF7E\\uDF8F-\\uDF9F\\uDFE0\\uDFE1]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00-\\uDD1E\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99\\uDC9D\\uDC9E]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-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pace_Separator: Space_Separator,\n\t\tID_Start: ID_Start,\n\t\tID_Continue: ID_Continue\n\t};\n\n\tvar util = {\n\t isSpaceSeparator: function isSpaceSeparator (c) {\n\t return typeof c === 'string' && unicode.Space_Separator.test(c)\n\t },\n\n\t isIdStartChar: function isIdStartChar (c) {\n\t return typeof c === 'string' && (\n\t (c >= 'a' && c <= 'z') ||\n\t (c >= 'A' && c <= 'Z') ||\n\t (c === '$') || (c === '_') ||\n\t unicode.ID_Start.test(c)\n\t )\n\t },\n\n\t isIdContinueChar: function isIdContinueChar (c) {\n\t return typeof c === 'string' && (\n\t (c >= 'a' && c <= 'z') ||\n\t (c >= 'A' && c <= 'Z') ||\n\t (c >= '0' && c <= '9') ||\n\t (c === '$') || (c === '_') ||\n\t (c === '\\u200C') || (c === '\\u200D') ||\n\t unicode.ID_Continue.test(c)\n\t )\n\t },\n\n\t isDigit: function isDigit (c) {\n\t return typeof c === 'string' && /[0-9]/.test(c)\n\t },\n\n\t isHexDigit: function isHexDigit (c) {\n\t return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)\n\t },\n\t};\n\n\tvar source;\n\tvar parseState;\n\tvar stack;\n\tvar pos;\n\tvar line;\n\tvar column;\n\tvar token;\n\tvar key;\n\tvar root;\n\n\tvar parse = function parse (text, reviver) {\n\t source = String(text);\n\t parseState = 'start';\n\t stack = [];\n\t pos = 0;\n\t line = 1;\n\t column = 0;\n\t token = undefined;\n\t key = undefined;\n\t root = undefined;\n\n\t do {\n\t token = lex();\n\n\t // This code is unreachable.\n\t // if (!parseStates[parseState]) {\n\t // throw invalidParseState()\n\t // }\n\n\t parseStates[parseState]();\n\t } while (token.type !== 'eof')\n\n\t if (typeof reviver === 'function') {\n\t return internalize({'': root}, '', reviver)\n\t }\n\n\t return root\n\t};\n\n\tfunction internalize (holder, name, reviver) {\n\t var value = holder[name];\n\t if (value != null && typeof value === 'object') {\n\t if (Array.isArray(value)) {\n\t for (var i = 0; i < value.length; i++) {\n\t var key = String(i);\n\t var replacement = internalize(value, key, reviver);\n\t if (replacement === undefined) {\n\t delete value[key];\n\t } else {\n\t Object.defineProperty(value, key, {\n\t value: replacement,\n\t writable: true,\n\t enumerable: true,\n\t configurable: true,\n\t });\n\t }\n\t }\n\t } else {\n\t for (var key$1 in value) {\n\t var replacement$1 = internalize(value, key$1, reviver);\n\t if (replacement$1 === undefined) {\n\t delete value[key$1];\n\t } else {\n\t Object.defineProperty(value, key$1, {\n\t value: replacement$1,\n\t writable: true,\n\t enumerable: true,\n\t configurable: true,\n\t });\n\t }\n\t }\n\t }\n\t }\n\n\t return reviver.call(holder, name, value)\n\t}\n\n\tvar lexState;\n\tvar buffer;\n\tvar doubleQuote;\n\tvar sign;\n\tvar c;\n\n\tfunction lex () {\n\t lexState = 'default';\n\t buffer = '';\n\t doubleQuote = false;\n\t sign = 1;\n\n\t for (;;) {\n\t c = peek();\n\n\t // This code is unreachable.\n\t // if (!lexStates[lexState]) {\n\t // throw invalidLexState(lexState)\n\t // }\n\n\t var token = lexStates[lexState]();\n\t if (token) {\n\t return token\n\t }\n\t }\n\t}\n\n\tfunction peek () {\n\t if (source[pos]) {\n\t return String.fromCodePoint(source.codePointAt(pos))\n\t }\n\t}\n\n\tfunction read () {\n\t var c = peek();\n\n\t if (c === '\\n') {\n\t line++;\n\t column = 0;\n\t } else if (c) {\n\t column += c.length;\n\t } else {\n\t column++;\n\t }\n\n\t if (c) {\n\t pos += c.length;\n\t }\n\n\t return c\n\t}\n\n\tvar lexStates = {\n\t default: function default$1 () {\n\t switch (c) {\n\t case '\\t':\n\t case '\\v':\n\t case '\\f':\n\t case ' ':\n\t case '\\u00A0':\n\t case '\\uFEFF':\n\t case '\\n':\n\t case '\\r':\n\t case '\\u2028':\n\t case '\\u2029':\n\t read();\n\t return\n\n\t case '/':\n\t read();\n\t lexState = 'comment';\n\t return\n\n\t case undefined:\n\t read();\n\t return newToken('eof')\n\t }\n\n\t if (util.isSpaceSeparator(c)) {\n\t read();\n\t return\n\t }\n\n\t // This code is unreachable.\n\t // if (!lexStates[parseState]) {\n\t // throw invalidLexState(parseState)\n\t // }\n\n\t return lexStates[parseState]()\n\t },\n\n\t comment: function comment () {\n\t switch (c) {\n\t case '*':\n\t read();\n\t lexState = 'multiLineComment';\n\t return\n\n\t case '/':\n\t read();\n\t lexState = 'singleLineComment';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t multiLineComment: function multiLineComment () {\n\t switch (c) {\n\t case '*':\n\t read();\n\t lexState = 'multiLineCommentAsterisk';\n\t return\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t },\n\n\t multiLineCommentAsterisk: function multiLineCommentAsterisk () {\n\t switch (c) {\n\t case '*':\n\t read();\n\t return\n\n\t case '/':\n\t read();\n\t lexState = 'default';\n\t return\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t lexState = 'multiLineComment';\n\t },\n\n\t singleLineComment: function singleLineComment () {\n\t switch (c) {\n\t case '\\n':\n\t case '\\r':\n\t case '\\u2028':\n\t case '\\u2029':\n\t read();\n\t lexState = 'default';\n\t return\n\n\t case undefined:\n\t read();\n\t return newToken('eof')\n\t }\n\n\t read();\n\t },\n\n\t value: function value () {\n\t switch (c) {\n\t case '{':\n\t case '[':\n\t return newToken('punctuator', read())\n\n\t case 'n':\n\t read();\n\t literal('ull');\n\t return newToken('null', null)\n\n\t case 't':\n\t read();\n\t literal('rue');\n\t return newToken('boolean', true)\n\n\t case 'f':\n\t read();\n\t literal('alse');\n\t return newToken('boolean', false)\n\n\t case '-':\n\t case '+':\n\t if (read() === '-') {\n\t sign = -1;\n\t }\n\n\t lexState = 'sign';\n\t return\n\n\t case '.':\n\t buffer = read();\n\t lexState = 'decimalPointLeading';\n\t return\n\n\t case '0':\n\t buffer = read();\n\t lexState = 'zero';\n\t return\n\n\t case '1':\n\t case '2':\n\t case '3':\n\t case '4':\n\t case '5':\n\t case '6':\n\t case '7':\n\t case '8':\n\t case '9':\n\t buffer = read();\n\t lexState = 'decimalInteger';\n\t return\n\n\t case 'I':\n\t read();\n\t literal('nfinity');\n\t return newToken('numeric', Infinity)\n\n\t case 'N':\n\t read();\n\t literal('aN');\n\t return newToken('numeric', NaN)\n\n\t case '\"':\n\t case \"'\":\n\t doubleQuote = (read() === '\"');\n\t buffer = '';\n\t lexState = 'string';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t identifierNameStartEscape: function identifierNameStartEscape () {\n\t if (c !== 'u') {\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t var u = unicodeEscape();\n\t switch (u) {\n\t case '$':\n\t case '_':\n\t break\n\n\t default:\n\t if (!util.isIdStartChar(u)) {\n\t throw invalidIdentifier()\n\t }\n\n\t break\n\t }\n\n\t buffer += u;\n\t lexState = 'identifierName';\n\t },\n\n\t identifierName: function identifierName () {\n\t switch (c) {\n\t case '$':\n\t case '_':\n\t case '\\u200C':\n\t case '\\u200D':\n\t buffer += read();\n\t return\n\n\t case '\\\\':\n\t read();\n\t lexState = 'identifierNameEscape';\n\t return\n\t }\n\n\t if (util.isIdContinueChar(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('identifier', buffer)\n\t },\n\n\t identifierNameEscape: function identifierNameEscape () {\n\t if (c !== 'u') {\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t var u = unicodeEscape();\n\t switch (u) {\n\t case '$':\n\t case '_':\n\t case '\\u200C':\n\t case '\\u200D':\n\t break\n\n\t default:\n\t if (!util.isIdContinueChar(u)) {\n\t throw invalidIdentifier()\n\t }\n\n\t break\n\t }\n\n\t buffer += u;\n\t lexState = 'identifierName';\n\t },\n\n\t sign: function sign$1 () {\n\t switch (c) {\n\t case '.':\n\t buffer = read();\n\t lexState = 'decimalPointLeading';\n\t return\n\n\t case '0':\n\t buffer = read();\n\t lexState = 'zero';\n\t return\n\n\t case '1':\n\t case '2':\n\t case '3':\n\t case '4':\n\t case '5':\n\t case '6':\n\t case '7':\n\t case '8':\n\t case '9':\n\t buffer = read();\n\t lexState = 'decimalInteger';\n\t return\n\n\t case 'I':\n\t read();\n\t literal('nfinity');\n\t return newToken('numeric', sign * Infinity)\n\n\t case 'N':\n\t read();\n\t literal('aN');\n\t return newToken('numeric', NaN)\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t zero: function zero () {\n\t switch (c) {\n\t case '.':\n\t buffer += read();\n\t lexState = 'decimalPoint';\n\t return\n\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\n\t case 'x':\n\t case 'X':\n\t buffer += read();\n\t lexState = 'hexadecimal';\n\t return\n\t }\n\n\t return newToken('numeric', sign * 0)\n\t },\n\n\t decimalInteger: function decimalInteger () {\n\t switch (c) {\n\t case '.':\n\t buffer += read();\n\t lexState = 'decimalPoint';\n\t return\n\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t decimalPointLeading: function decimalPointLeading () {\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalFraction';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t decimalPoint: function decimalPoint () {\n\t switch (c) {\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalFraction';\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t decimalFraction: function decimalFraction () {\n\t switch (c) {\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t decimalExponent: function decimalExponent () {\n\t switch (c) {\n\t case '+':\n\t case '-':\n\t buffer += read();\n\t lexState = 'decimalExponentSign';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalExponentInteger';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t decimalExponentSign: function decimalExponentSign () {\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalExponentInteger';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t decimalExponentInteger: function decimalExponentInteger () {\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t hexadecimal: function hexadecimal () {\n\t if (util.isHexDigit(c)) {\n\t buffer += read();\n\t lexState = 'hexadecimalInteger';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t hexadecimalInteger: function hexadecimalInteger () {\n\t if (util.isHexDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t string: function string () {\n\t switch (c) {\n\t case '\\\\':\n\t read();\n\t buffer += escape();\n\t return\n\n\t case '\"':\n\t if (doubleQuote) {\n\t read();\n\t return newToken('string', buffer)\n\t }\n\n\t buffer += read();\n\t return\n\n\t case \"'\":\n\t if (!doubleQuote) {\n\t read();\n\t return newToken('string', buffer)\n\t }\n\n\t buffer += read();\n\t return\n\n\t case '\\n':\n\t case '\\r':\n\t throw invalidChar(read())\n\n\t case '\\u2028':\n\t case '\\u2029':\n\t separatorChar(c);\n\t break\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\t },\n\n\t start: function start () {\n\t switch (c) {\n\t case '{':\n\t case '[':\n\t return newToken('punctuator', read())\n\n\t // This code is unreachable since the default lexState handles eof.\n\t // case undefined:\n\t // return newToken('eof')\n\t }\n\n\t lexState = 'value';\n\t },\n\n\t beforePropertyName: function beforePropertyName () {\n\t switch (c) {\n\t case '$':\n\t case '_':\n\t buffer = read();\n\t lexState = 'identifierName';\n\t return\n\n\t case '\\\\':\n\t read();\n\t lexState = 'identifierNameStartEscape';\n\t return\n\n\t case '}':\n\t return newToken('punctuator', read())\n\n\t case '\"':\n\t case \"'\":\n\t doubleQuote = (read() === '\"');\n\t lexState = 'string';\n\t return\n\t }\n\n\t if (util.isIdStartChar(c)) {\n\t buffer += read();\n\t lexState = 'identifierName';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t afterPropertyName: function afterPropertyName () {\n\t if (c === ':') {\n\t return newToken('punctuator', read())\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t beforePropertyValue: function beforePropertyValue () {\n\t lexState = 'value';\n\t },\n\n\t afterPropertyValue: function afterPropertyValue () {\n\t switch (c) {\n\t case ',':\n\t case '}':\n\t return newToken('punctuator', read())\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t beforeArrayValue: function beforeArrayValue () {\n\t if (c === ']') {\n\t return newToken('punctuator', read())\n\t }\n\n\t lexState = 'value';\n\t },\n\n\t afterArrayValue: function afterArrayValue () {\n\t switch (c) {\n\t case ',':\n\t case ']':\n\t return newToken('punctuator', read())\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t end: function end () {\n\t // This code is unreachable since it's handled by the default lexState.\n\t // if (c === undefined) {\n\t // read()\n\t // return newToken('eof')\n\t // }\n\n\t throw invalidChar(read())\n\t },\n\t};\n\n\tfunction newToken (type, value) {\n\t return {\n\t type: type,\n\t value: value,\n\t line: line,\n\t column: column,\n\t }\n\t}\n\n\tfunction literal (s) {\n\t for (var i = 0, list = s; i < list.length; i += 1) {\n\t var c = list[i];\n\n\t var p = peek();\n\n\t if (p !== c) {\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t }\n\t}\n\n\tfunction escape () {\n\t var c = peek();\n\t switch (c) {\n\t case 'b':\n\t read();\n\t return '\\b'\n\n\t case 'f':\n\t read();\n\t return '\\f'\n\n\t case 'n':\n\t read();\n\t return '\\n'\n\n\t case 'r':\n\t read();\n\t return '\\r'\n\n\t case 't':\n\t read();\n\t return '\\t'\n\n\t case 'v':\n\t read();\n\t return '\\v'\n\n\t case '0':\n\t read();\n\t if (util.isDigit(peek())) {\n\t throw invalidChar(read())\n\t }\n\n\t return '\\0'\n\n\t case 'x':\n\t read();\n\t return hexEscape()\n\n\t case 'u':\n\t read();\n\t return unicodeEscape()\n\n\t case '\\n':\n\t case '\\u2028':\n\t case '\\u2029':\n\t read();\n\t return ''\n\n\t case '\\r':\n\t read();\n\t if (peek() === '\\n') {\n\t read();\n\t }\n\n\t return ''\n\n\t case '1':\n\t case '2':\n\t case '3':\n\t case '4':\n\t case '5':\n\t case '6':\n\t case '7':\n\t case '8':\n\t case '9':\n\t throw invalidChar(read())\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t return read()\n\t}\n\n\tfunction hexEscape () {\n\t var buffer = '';\n\t var c = peek();\n\n\t if (!util.isHexDigit(c)) {\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\n\t c = peek();\n\t if (!util.isHexDigit(c)) {\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\n\t return String.fromCodePoint(parseInt(buffer, 16))\n\t}\n\n\tfunction unicodeEscape () {\n\t var buffer = '';\n\t var count = 4;\n\n\t while (count-- > 0) {\n\t var c = peek();\n\t if (!util.isHexDigit(c)) {\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\t }\n\n\t return String.fromCodePoint(parseInt(buffer, 16))\n\t}\n\n\tvar parseStates = {\n\t start: function start () {\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t push();\n\t },\n\n\t beforePropertyName: function beforePropertyName () {\n\t switch (token.type) {\n\t case 'identifier':\n\t case 'string':\n\t key = token.value;\n\t parseState = 'afterPropertyName';\n\t return\n\n\t case 'punctuator':\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.value !== '}') {\n\t // throw invalidToken()\n\t // }\n\n\t pop();\n\t return\n\n\t case 'eof':\n\t throw invalidEOF()\n\t }\n\n\t // This code is unreachable since it's handled by the lexState.\n\t // throw invalidToken()\n\t },\n\n\t afterPropertyName: function afterPropertyName () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'punctuator' || token.value !== ':') {\n\t // throw invalidToken()\n\t // }\n\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t parseState = 'beforePropertyValue';\n\t },\n\n\t beforePropertyValue: function beforePropertyValue () {\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t push();\n\t },\n\n\t beforeArrayValue: function beforeArrayValue () {\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t if (token.type === 'punctuator' && token.value === ']') {\n\t pop();\n\t return\n\t }\n\n\t push();\n\t },\n\n\t afterPropertyValue: function afterPropertyValue () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'punctuator') {\n\t // throw invalidToken()\n\t // }\n\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t switch (token.value) {\n\t case ',':\n\t parseState = 'beforePropertyName';\n\t return\n\n\t case '}':\n\t pop();\n\t }\n\n\t // This code is unreachable since it's handled by the lexState.\n\t // throw invalidToken()\n\t },\n\n\t afterArrayValue: function afterArrayValue () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'punctuator') {\n\t // throw invalidToken()\n\t // }\n\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t switch (token.value) {\n\t case ',':\n\t parseState = 'beforeArrayValue';\n\t return\n\n\t case ']':\n\t pop();\n\t }\n\n\t // This code is unreachable since it's handled by the lexState.\n\t // throw invalidToken()\n\t },\n\n\t end: function end () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'eof') {\n\t // throw invalidToken()\n\t // }\n\t },\n\t};\n\n\tfunction push () {\n\t var value;\n\n\t switch (token.type) {\n\t case 'punctuator':\n\t switch (token.value) {\n\t case '{':\n\t value = {};\n\t break\n\n\t case '[':\n\t value = [];\n\t break\n\t }\n\n\t break\n\n\t case 'null':\n\t case 'boolean':\n\t case 'numeric':\n\t case 'string':\n\t value = token.value;\n\t break\n\n\t // This code is unreachable.\n\t // default:\n\t // throw invalidToken()\n\t }\n\n\t if (root === undefined) {\n\t root = value;\n\t } else {\n\t var parent = stack[stack.length - 1];\n\t if (Array.isArray(parent)) {\n\t parent.push(value);\n\t } else {\n\t Object.defineProperty(parent, key, {\n\t value: value,\n\t writable: true,\n\t enumerable: true,\n\t configurable: true,\n\t });\n\t }\n\t }\n\n\t if (value !== null && typeof value === 'object') {\n\t stack.push(value);\n\n\t if (Array.isArray(value)) {\n\t parseState = 'beforeArrayValue';\n\t } else {\n\t parseState = 'beforePropertyName';\n\t }\n\t } else {\n\t var current = stack[stack.length - 1];\n\t if (current == null) {\n\t parseState = 'end';\n\t } else if (Array.isArray(current)) {\n\t parseState = 'afterArrayValue';\n\t } else {\n\t parseState = 'afterPropertyValue';\n\t }\n\t }\n\t}\n\n\tfunction pop () {\n\t stack.pop();\n\n\t var current = stack[stack.length - 1];\n\t if (current == null) {\n\t parseState = 'end';\n\t } else if (Array.isArray(current)) {\n\t parseState = 'afterArrayValue';\n\t } else {\n\t parseState = 'afterPropertyValue';\n\t }\n\t}\n\n\t// This code is unreachable.\n\t// function invalidParseState () {\n\t// return new Error(`JSON5: invalid parse state '${parseState}'`)\n\t// }\n\n\t// This code is unreachable.\n\t// function invalidLexState (state) {\n\t// return new Error(`JSON5: invalid lex state '${state}'`)\n\t// }\n\n\tfunction invalidChar (c) {\n\t if (c === undefined) {\n\t return syntaxError((\"JSON5: invalid end of input at \" + line + \":\" + column))\n\t }\n\n\t return syntaxError((\"JSON5: invalid character '\" + (formatChar(c)) + \"' at \" + line + \":\" + column))\n\t}\n\n\tfunction invalidEOF () {\n\t return syntaxError((\"JSON5: invalid end of input at \" + line + \":\" + column))\n\t}\n\n\t// This code is unreachable.\n\t// function invalidToken () {\n\t// if (token.type === 'eof') {\n\t// return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)\n\t// }\n\n\t// const c = String.fromCodePoint(token.value.codePointAt(0))\n\t// return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)\n\t// }\n\n\tfunction invalidIdentifier () {\n\t column -= 5;\n\t return syntaxError((\"JSON5: invalid identifier character at \" + line + \":\" + column))\n\t}\n\n\tfunction separatorChar (c) {\n\t console.warn((\"JSON5: '\" + (formatChar(c)) + \"' in strings is not valid ECMAScript; consider escaping\"));\n\t}\n\n\tfunction formatChar (c) {\n\t var replacements = {\n\t \"'\": \"\\\\'\",\n\t '\"': '\\\\\"',\n\t '\\\\': '\\\\\\\\',\n\t '\\b': '\\\\b',\n\t '\\f': '\\\\f',\n\t '\\n': '\\\\n',\n\t '\\r': '\\\\r',\n\t '\\t': '\\\\t',\n\t '\\v': '\\\\v',\n\t '\\0': '\\\\0',\n\t '\\u2028': '\\\\u2028',\n\t '\\u2029': '\\\\u2029',\n\t };\n\n\t if (replacements[c]) {\n\t return replacements[c]\n\t }\n\n\t if (c < ' ') {\n\t var hexString = c.charCodeAt(0).toString(16);\n\t return '\\\\x' + ('00' + hexString).substring(hexString.length)\n\t }\n\n\t return c\n\t}\n\n\tfunction syntaxError (message) {\n\t var err = new SyntaxError(message);\n\t err.lineNumber = line;\n\t err.columnNumber = column;\n\t return err\n\t}\n\n\tvar stringify = function stringify (value, replacer, space) {\n\t var stack = [];\n\t var indent = '';\n\t var propertyList;\n\t var replacerFunc;\n\t var gap = '';\n\t var quote;\n\n\t if (\n\t replacer != null &&\n\t typeof replacer === 'object' &&\n\t !Array.isArray(replacer)\n\t ) {\n\t space = replacer.space;\n\t quote = replacer.quote;\n\t replacer = replacer.replacer;\n\t }\n\n\t if (typeof replacer === 'function') {\n\t replacerFunc = replacer;\n\t } else if (Array.isArray(replacer)) {\n\t propertyList = [];\n\t for (var i = 0, list = replacer; i < list.length; i += 1) {\n\t var v = list[i];\n\n\t var item = (void 0);\n\n\t if (typeof v === 'string') {\n\t item = v;\n\t } else if (\n\t typeof v === 'number' ||\n\t v instanceof String ||\n\t v instanceof Number\n\t ) {\n\t item = String(v);\n\t }\n\n\t if (item !== undefined && propertyList.indexOf(item) < 0) {\n\t propertyList.push(item);\n\t }\n\t }\n\t }\n\n\t if (space instanceof Number) {\n\t space = Number(space);\n\t } else if (space instanceof String) {\n\t space = String(space);\n\t }\n\n\t if (typeof space === 'number') {\n\t if (space > 0) {\n\t space = Math.min(10, Math.floor(space));\n\t gap = ' '.substr(0, space);\n\t }\n\t } else if (typeof space === 'string') {\n\t gap = space.substr(0, 10);\n\t }\n\n\t return serializeProperty('', {'': value})\n\n\t function serializeProperty (key, holder) {\n\t var value = holder[key];\n\t if (value != null) {\n\t if (typeof value.toJSON5 === 'function') {\n\t value = value.toJSON5(key);\n\t } else if (typeof value.toJSON === 'function') {\n\t value = value.toJSON(key);\n\t }\n\t }\n\n\t if (replacerFunc) {\n\t value = replacerFunc.call(holder, key, value);\n\t }\n\n\t if (value instanceof Number) {\n\t value = Number(value);\n\t } else if (value instanceof String) {\n\t value = String(value);\n\t } else if (value instanceof Boolean) {\n\t value = value.valueOf();\n\t }\n\n\t switch (value) {\n\t case null: return 'null'\n\t case true: return 'true'\n\t case false: return 'false'\n\t }\n\n\t if (typeof value === 'string') {\n\t return quoteString(value, false)\n\t }\n\n\t if (typeof value === 'number') {\n\t return String(value)\n\t }\n\n\t if (typeof value === 'object') {\n\t return Array.isArray(value) ? serializeArray(value) : serializeObject(value)\n\t }\n\n\t return undefined\n\t }\n\n\t function quoteString (value) {\n\t var quotes = {\n\t \"'\": 0.1,\n\t '\"': 0.2,\n\t };\n\n\t var replacements = {\n\t \"'\": \"\\\\'\",\n\t '\"': '\\\\\"',\n\t '\\\\': '\\\\\\\\',\n\t '\\b': '\\\\b',\n\t '\\f': '\\\\f',\n\t '\\n': '\\\\n',\n\t '\\r': '\\\\r',\n\t '\\t': '\\\\t',\n\t '\\v': '\\\\v',\n\t '\\0': '\\\\0',\n\t '\\u2028': '\\\\u2028',\n\t '\\u2029': '\\\\u2029',\n\t };\n\n\t var product = '';\n\n\t for (var i = 0; i < value.length; i++) {\n\t var c = value[i];\n\t switch (c) {\n\t case \"'\":\n\t case '\"':\n\t quotes[c]++;\n\t product += c;\n\t continue\n\n\t case '\\0':\n\t if (util.isDigit(value[i + 1])) {\n\t product += '\\\\x00';\n\t continue\n\t }\n\t }\n\n\t if (replacements[c]) {\n\t product += replacements[c];\n\t continue\n\t }\n\n\t if (c < ' ') {\n\t var hexString = c.charCodeAt(0).toString(16);\n\t product += '\\\\x' + ('00' + hexString).substring(hexString.length);\n\t continue\n\t }\n\n\t product += c;\n\t }\n\n\t var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });\n\n\t product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);\n\n\t return quoteChar + product + quoteChar\n\t }\n\n\t function serializeObject (value) {\n\t if (stack.indexOf(value) >= 0) {\n\t throw TypeError('Converting circular structure to JSON5')\n\t }\n\n\t stack.push(value);\n\n\t var stepback = indent;\n\t indent = indent + gap;\n\n\t var keys = propertyList || Object.keys(value);\n\t var partial = [];\n\t for (var i = 0, list = keys; i < list.length; i += 1) {\n\t var key = list[i];\n\n\t var propertyString = serializeProperty(key, value);\n\t if (propertyString !== undefined) {\n\t var member = serializeKey(key) + ':';\n\t if (gap !== '') {\n\t member += ' ';\n\t }\n\t member += propertyString;\n\t partial.push(member);\n\t }\n\t }\n\n\t var final;\n\t if (partial.length === 0) {\n\t final = '{}';\n\t } else {\n\t var properties;\n\t if (gap === '') {\n\t properties = partial.join(',');\n\t final = '{' + properties + '}';\n\t } else {\n\t var separator = ',\\n' + indent;\n\t properties = partial.join(separator);\n\t final = '{\\n' + indent + properties + ',\\n' + stepback + '}';\n\t }\n\t }\n\n\t stack.pop();\n\t indent = stepback;\n\t return final\n\t }\n\n\t function serializeKey (key) {\n\t if (key.length === 0) {\n\t return quoteString(key, true)\n\t }\n\n\t var firstChar = String.fromCodePoint(key.codePointAt(0));\n\t if (!util.isIdStartChar(firstChar)) {\n\t return quoteString(key, true)\n\t }\n\n\t for (var i = firstChar.length; i < key.length; i++) {\n\t if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {\n\t return quoteString(key, true)\n\t }\n\t }\n\n\t return key\n\t }\n\n\t function serializeArray (value) {\n\t if (stack.indexOf(value) >= 0) {\n\t throw TypeError('Converting circular structure to JSON5')\n\t }\n\n\t stack.push(value);\n\n\t var stepback = indent;\n\t indent = indent + gap;\n\n\t var partial = [];\n\t for (var i = 0; i < value.length; i++) {\n\t var propertyString = serializeProperty(String(i), value);\n\t partial.push((propertyString !== undefined) ? propertyString : 'null');\n\t }\n\n\t var final;\n\t if (partial.length === 0) {\n\t final = '[]';\n\t } else {\n\t if (gap === '') {\n\t var properties = partial.join(',');\n\t final = '[' + properties + ']';\n\t } else {\n\t var separator = ',\\n' + indent;\n\t var properties$1 = partial.join(separator);\n\t final = '[\\n' + indent + properties$1 + ',\\n' + stepback + ']';\n\t }\n\t }\n\n\t stack.pop();\n\t indent = stepback;\n\t return final\n\t }\n\t};\n\n\tvar JSON5 = {\n\t parse: parse,\n\t stringify: stringify,\n\t};\n\n\tvar lib = JSON5;\n\n\tvar es5 = lib;\n\n\treturn es5;\n\n})));\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { access, cp, readFile, stat, writeFile } from \"node:fs/promises\";\nimport { randomBytes } from \"node:crypto\";\nimport { basename, dirname, join } from \"node:path\";\n\nimport { parse } from \"json5\";\n\n/**\n * Fixed byte size reserved in muon-core for an embedded muon.json payload.\n */\nexport const muonEmbeddedConfigSlotSize = 64 * 1024;\n\n/**\n * Fixed byte sequence used to locate an unembedded config slot.\n */\nconst muonEmbeddedConfigEmptySlotMarker = Buffer.from([\n 0x6d, 0x75, 0x6f, 0x6e, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x3a, 0x65, 0x6d, 0x62,\n 0x65, 0x64, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x3a, 0x73, 0x6c, 0x6f,\n 0x74, 0x3a, 0x76, 0x31, 0x00, 0x5d,\n]);\n\nconst muonEmbeddedConfigPayloadCapacity = muonEmbeddedConfigSlotSize;\nconst muonLauncherEmbeddedConfigSlotSize = 64 * 1024;\nconst muonLauncherEmbeddedConfigEmptySlotMarker = Buffer.from([\n 0x6d, 0x75, 0x6f, 0x6e, 0x2d, 0x6c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x65, 0x72,\n 0x3a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,\n 0x3a, 0x76, 0x31, 0x00, 0x5d,\n]);\nconst muonLauncherEmbeddedConfigPayloadCapacity =\n muonLauncherEmbeddedConfigSlotSize;\n\nconst tlvNullTag = 0;\nconst tlvFalseTag = 1;\nconst tlvTrueTag = 2;\nconst tlvUintTag = 3;\nconst tlvStringTag = 4;\nconst tlvBinaryTag = 5;\nconst tlvArrayTag = 6;\nconst tlvObjectTag = 7;\n\n/**\n * Result returned by a muon executable config embedding operation.\n */\nexport interface EmbedMuonConfigResult {\n /** Input executable path. For launcher embedding this is the launcher path. */\n readonly corePath: string;\n /** Written executable path. */\n readonly outputPath: string;\n /** Byte offset of the fixed embedded config slot. */\n readonly slotOffset: number;\n /** Encoded TLV payload size in bytes. */\n readonly payloadSize: number;\n /** Whether an existing embedded payload was replaced. Always false. */\n readonly replaced: boolean;\n}\n\n/**\n * Options for embedding a config into a single muon-core executable.\n */\nexport interface EmbedMuonConfigCoreOptions {\n /** muon-core executable path to patch. */\n readonly corePath: string;\n /** muon.json, muon.json5, or muon.jsonc input path. */\n readonly configPath: string;\n /** Optional output executable path. When omitted, corePath is updated. */\n readonly outputPath: string | undefined;\n}\n\n/**\n * Options for embedding a config into a single muon-launcher executable.\n */\nexport interface EmbedMuonConfigLauncherOptions {\n /** muon-launcher executable path to patch. */\n readonly launcherPath: string;\n /** muon.json, muon.json5, or muon.jsonc input path. */\n readonly configPath: string;\n /** Optional output executable path. When omitted, launcherPath is updated. */\n readonly outputPath: string | undefined;\n}\n\n/**\n * Options for embedding a config into a runtime directory.\n */\nexport interface EmbedMuonConfigRuntimeOptions {\n /** Runtime directory containing muon-core or muon-core.exe. */\n readonly runtimePath: string;\n /** muon.json, muon.json5, or muon.jsonc input path. */\n readonly configPath: string;\n /** Optional output runtime directory. When omitted, runtimePath is updated. */\n readonly outputRuntimePath: string | undefined;\n}\n\n/**\n * Unembedded config slot found in a muon-core executable.\n */\nexport interface MuonEmbeddedConfigSlot {\n /** Empty slot state. */\n readonly state: \"empty\";\n /** Byte offset of the slot. */\n readonly offset: number;\n /** Empty payload. */\n readonly payload: Buffer;\n /** Payload byte size. */\n readonly payloadSize: 0;\n}\n\n/**\n * Unembedded launcher config slot found in a muon-launcher executable.\n */\nexport interface MuonLauncherEmbeddedConfigSlot {\n /** Empty slot state. */\n readonly state: \"empty\";\n /** Byte offset of the slot. */\n readonly offset: number;\n /** Empty payload. */\n readonly payload: Buffer;\n /** Payload byte size. */\n readonly payloadSize: 0;\n}\n\nconst getEmbeddedConfigEmptySlotByte = (index: number): number => {\n if (index < muonEmbeddedConfigEmptySlotMarker.length) {\n return muonEmbeddedConfigEmptySlotMarker[index] ?? 0;\n }\n const value =\n 0xa5 ^\n Math.imul(index, 0x25) ^\n Math.imul(index >>> 8, 0x6d) ^\n Math.imul(index >>> 16, 0x3b) ^\n (Math.imul(index, 0x9e3779b1) >>> 24);\n return value & 0xff;\n};\n\nconst createEmptySlot = (): Buffer => {\n const slot = Buffer.allocUnsafe(muonEmbeddedConfigSlotSize);\n for (let index = 0; index < slot.length; index += 1) {\n slot[index] = getEmbeddedConfigEmptySlotByte(index);\n }\n return slot;\n};\n\nconst encodeVarUint = (value: bigint): Buffer => {\n const bytes: number[] = [];\n let remaining = value;\n do {\n let byte = Number(remaining & 0x7fn);\n remaining >>= 7n;\n if (remaining !== 0n) {\n byte |= 0x80;\n }\n bytes.push(byte);\n } while (remaining !== 0n);\n return Buffer.from(bytes);\n};\n\nconst encodeRawString = (value: string): Buffer => {\n const bytes = Buffer.from(value, \"utf8\");\n return Buffer.concat([encodeVarUint(BigInt(bytes.length)), bytes]);\n};\n\nconst encodeTaggedBytes = (tag: number, bytes: Uint8Array): Buffer =>\n Buffer.concat([\n Buffer.from([tag]),\n encodeVarUint(BigInt(bytes.length)),\n Buffer.from(bytes),\n ]);\n\nconst isJsonObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isPath = (\n path: readonly string[],\n first: string,\n second: string,\n): boolean => path.length === 2 && path[0] === first && path[1] === second;\n\nconst isPluginSignaturePath = (path: readonly string[]): boolean =>\n path.length === 3 &&\n path[0] === \"plugin\" &&\n path[1] === \"plugins\" &&\n path[2] === \"signature\";\n\nconst isPluginSaltPath = (path: readonly string[]): boolean =>\n path.length === 3 &&\n path[0] === \"plugin\" &&\n path[1] === \"plugins\" &&\n path[2] === \"salt\";\n\nconst isHexString = (value: string): boolean =>\n value.length % 2 === 0 && /^[0-9a-fA-F]*$/.test(value);\n\nconst decodeHexString = (value: string): Buffer => {\n const bytes = Buffer.alloc(value.length / 2);\n for (let index = 0; index < value.length; index += 2) {\n bytes[index / 2] = Number.parseInt(value.slice(index, index + 2), 16);\n }\n return bytes;\n};\n\nconst encodeKnownBinaryString = (\n path: readonly string[],\n value: string,\n): Buffer | undefined => {\n if (isPath(path, \"asset\", \"signature\")) {\n return value.length === 64 && isHexString(value)\n ? decodeHexString(value)\n : undefined;\n }\n if (isPath(path, \"asset\", \"salt\")) {\n return isHexString(value) ? decodeHexString(value) : undefined;\n }\n if (isPluginSignaturePath(path)) {\n return value.length === 64 && isHexString(value)\n ? decodeHexString(value)\n : undefined;\n }\n if (isPluginSaltPath(path)) {\n return isHexString(value) ? decodeHexString(value) : undefined;\n }\n if (isPath(path, \"browser\", \"backgroundColor\")) {\n const hex = value.startsWith(\"#\") ? value.slice(1) : value;\n return hex.length === 6 && isHexString(hex)\n ? decodeHexString(hex)\n : undefined;\n }\n return undefined;\n};\n\nconst encodeTlvValue = (value: unknown, path: readonly string[]): Buffer => {\n if (value === null) {\n return Buffer.from([tlvNullTag]);\n }\n if (typeof value === \"boolean\") {\n return Buffer.from([value ? tlvTrueTag : tlvFalseTag]);\n }\n if (typeof value === \"number\") {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new Error(\"muon embedded config supports only unsigned integers.\");\n }\n return Buffer.concat([\n Buffer.from([tlvUintTag]),\n encodeVarUint(BigInt(value)),\n ]);\n }\n if (typeof value === \"string\") {\n const binaryValue = encodeKnownBinaryString(path, value);\n if (binaryValue !== undefined) {\n return encodeTaggedBytes(tlvBinaryTag, binaryValue);\n }\n return encodeTaggedBytes(tlvStringTag, Buffer.from(value, \"utf8\"));\n }\n if (Array.isArray(value)) {\n return Buffer.concat([\n Buffer.from([tlvArrayTag]),\n encodeVarUint(BigInt(value.length)),\n ...value.map((entry) => encodeTlvValue(entry, path)),\n ]);\n }\n if (isJsonObject(value)) {\n const entries = Object.entries(value);\n return Buffer.concat([\n Buffer.from([tlvObjectTag]),\n encodeVarUint(BigInt(entries.length)),\n ...entries.flatMap(([key, entry]) => [\n encodeRawString(key),\n encodeTlvValue(entry, [...path, key]),\n ]),\n ]);\n }\n throw new Error(\"muon embedded config contains an unsupported value.\");\n};\n\n/**\n * Encodes a parsed muon config object as the embedded TLV payload.\n *\n * @param config Parsed muon config value.\n * @returns Encoded TLV payload bytes.\n */\nexport const encodeMuonConfigTlv = (config: unknown): Buffer =>\n encodeTlvValue(config, []);\n\n/**\n * Creates an empty or payload-filled fixed embedded config slot.\n *\n * @param payload Optional encoded TLV payload bytes.\n * @returns Fixed-size slot image.\n */\nexport const createMuonEmbeddedConfigSlot = (\n payload: Uint8Array | undefined = undefined,\n): Buffer => {\n if (\n payload !== undefined &&\n payload.length > muonEmbeddedConfigPayloadCapacity\n ) {\n throw new Error(\n `Encoded muon config exceeds the embedded slot capacity: ${payload.length} > ${muonEmbeddedConfigPayloadCapacity}`,\n );\n }\n\n if (payload === undefined) {\n return createEmptySlot();\n }\n\n const slot = randomBytes(muonEmbeddedConfigSlotSize);\n Buffer.from(payload).copy(slot, 0);\n return slot;\n};\n\n/**\n * Creates an empty or payload-filled fixed muon-launcher embedded config slot.\n *\n * @param payload Optional encoded TLV payload bytes.\n * @returns Fixed-size slot image.\n */\nexport const createMuonLauncherEmbeddedConfigSlot = (\n payload: Uint8Array | undefined = undefined,\n): Buffer => {\n if (\n payload !== undefined &&\n payload.length > muonLauncherEmbeddedConfigPayloadCapacity\n ) {\n throw new Error(\n `Encoded muon config exceeds the embedded launcher slot capacity: ${payload.length} > ${muonLauncherEmbeddedConfigPayloadCapacity}`,\n );\n }\n\n if (payload === undefined) {\n const slot = Buffer.alloc(muonLauncherEmbeddedConfigSlotSize, 0);\n muonLauncherEmbeddedConfigEmptySlotMarker.copy(slot, 0);\n return slot;\n }\n\n const slot = randomBytes(muonLauncherEmbeddedConfigSlotSize);\n Buffer.from(payload).copy(slot, 0);\n return slot;\n};\n\nconst isEmptySlotAt = (content: Buffer, offset: number): boolean => {\n for (let index = 0; index < muonEmbeddedConfigSlotSize; index += 1) {\n if (content[offset + index] !== getEmbeddedConfigEmptySlotByte(index)) {\n return false;\n }\n }\n return true;\n};\n\nconst inspectUnembeddedSlotAt = (\n content: Buffer,\n offset: number,\n): MuonEmbeddedConfigSlot | undefined => {\n if (offset < 0 || offset + muonEmbeddedConfigSlotSize > content.length) {\n return undefined;\n }\n if (isEmptySlotAt(content, offset)) {\n return {\n state: \"empty\",\n offset,\n payload: Buffer.alloc(0),\n payloadSize: 0,\n };\n }\n return undefined;\n};\n\nconst collectSlotCandidates = (content: Buffer): MuonEmbeddedConfigSlot[] => {\n const candidates = new Map<number, MuonEmbeddedConfigSlot>();\n for (\n let offset = content.indexOf(muonEmbeddedConfigEmptySlotMarker);\n offset >= 0;\n offset = content.indexOf(muonEmbeddedConfigEmptySlotMarker, offset + 1)\n ) {\n const slot = inspectUnembeddedSlotAt(content, offset);\n if (slot !== undefined) {\n candidates.set(slot.offset, slot);\n }\n }\n return [...candidates.values()].sort(\n (left, right) => left.offset - right.offset,\n );\n};\n\nconst isEmptyLauncherSlotAt = (content: Buffer, offset: number): boolean => {\n if (\n offset < 0 ||\n offset + muonLauncherEmbeddedConfigSlotSize > content.length\n ) {\n return false;\n }\n if (\n !content\n .subarray(\n offset,\n offset + muonLauncherEmbeddedConfigEmptySlotMarker.length,\n )\n .equals(muonLauncherEmbeddedConfigEmptySlotMarker)\n ) {\n return false;\n }\n for (\n let index = muonLauncherEmbeddedConfigEmptySlotMarker.length;\n index < muonLauncherEmbeddedConfigSlotSize;\n index += 1\n ) {\n if (content[offset + index] !== 0) {\n return false;\n }\n }\n return true;\n};\n\nconst inspectUnembeddedLauncherSlotAt = (\n content: Buffer,\n offset: number,\n): MuonLauncherEmbeddedConfigSlot | undefined => {\n if (!isEmptyLauncherSlotAt(content, offset)) {\n return undefined;\n }\n return {\n state: \"empty\",\n offset,\n payload: Buffer.alloc(0),\n payloadSize: 0,\n };\n};\n\nconst collectLauncherSlotCandidates = (\n content: Buffer,\n): MuonLauncherEmbeddedConfigSlot[] => {\n const candidates = new Map<number, MuonLauncherEmbeddedConfigSlot>();\n for (\n let offset = content.indexOf(muonLauncherEmbeddedConfigEmptySlotMarker);\n offset >= 0;\n offset = content.indexOf(\n muonLauncherEmbeddedConfigEmptySlotMarker,\n offset + 1,\n )\n ) {\n const slot = inspectUnembeddedLauncherSlotAt(content, offset);\n if (slot !== undefined) {\n candidates.set(slot.offset, slot);\n }\n }\n return [...candidates.values()].sort(\n (left, right) => left.offset - right.offset,\n );\n};\n\n/**\n * Finds the fixed unembedded config slot in a muon-core executable image.\n *\n * @param content muon-core executable bytes.\n * @returns The single detected unembedded config slot.\n */\nexport const findMuonEmbeddedConfigSlot = (\n content: Uint8Array,\n): MuonEmbeddedConfigSlot => {\n const buffer = Buffer.isBuffer(content) ? content : Buffer.from(content);\n const candidates = collectSlotCandidates(buffer);\n if (candidates.length !== 1) {\n throw new Error(\n `Expected exactly one unembedded muon config slot, found ${candidates.length}.`,\n );\n }\n const [candidate] = candidates;\n if (candidate === undefined) {\n throw new Error(\"Embedded muon config slot was not found.\");\n }\n return candidate;\n};\n\n/**\n * Finds the fixed unembedded config slot in a muon-launcher executable image.\n *\n * @param content muon-launcher executable bytes.\n * @returns The single detected unembedded launcher config slot.\n */\nexport const findMuonLauncherEmbeddedConfigSlot = (\n content: Uint8Array,\n): MuonLauncherEmbeddedConfigSlot => {\n const buffer = Buffer.isBuffer(content) ? content : Buffer.from(content);\n const candidates = collectLauncherSlotCandidates(buffer);\n if (candidates.length !== 1) {\n throw new Error(\n `Expected exactly one unembedded muon-launcher config slot, found ${candidates.length}.`,\n );\n }\n const [candidate] = candidates;\n if (candidate === undefined) {\n throw new Error(\"Embedded muon-launcher config slot was not found.\");\n }\n return candidate;\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n const stats = await stat(path);\n return stats.isFile();\n } catch {\n return false;\n }\n};\n\nconst resolveMuonConfigInputPath = async (\n configPath: string,\n): Promise<string> => {\n if (basename(configPath) === \"muon.json\") {\n const directory = dirname(configPath);\n for (const fileName of [\"muon.json5\", \"muon.jsonc\", \"muon.json\"]) {\n const candidate = join(directory, fileName);\n if (await fileExists(candidate)) {\n return candidate;\n }\n }\n }\n if (!(await fileExists(configPath))) {\n throw new Error(`muon config does not exist: ${configPath}`);\n }\n return configPath;\n};\n\nconst readMuonConfigInput = async (configPath: string): Promise<unknown> => {\n const resolvedPath = await resolveMuonConfigInputPath(configPath);\n return parse(await readFile(resolvedPath, \"utf8\"));\n};\n\nconst isSignedPeExecutable = (content: Buffer): boolean => {\n if (content.length < 0x40 || content[0] !== 0x4d || content[1] !== 0x5a) {\n return false;\n }\n const peOffset = content.readUInt32LE(0x3c);\n if (\n peOffset + 0x18 >= content.length ||\n content.toString(\"ascii\", peOffset, peOffset + 4) !== \"PE\\u0000\\u0000\"\n ) {\n return false;\n }\n\n const optionalHeaderOffset = peOffset + 0x18;\n const optionalHeaderSize = content.readUInt16LE(peOffset + 0x14);\n const optionalHeaderEnd = optionalHeaderOffset + optionalHeaderSize;\n if (optionalHeaderEnd > content.length) {\n return false;\n }\n\n const magic = content.readUInt16LE(optionalHeaderOffset);\n const dataDirectoryOffset =\n magic === 0x20b ? optionalHeaderOffset + 112 : optionalHeaderOffset + 96;\n const certificateEntryOffset = dataDirectoryOffset + 4 * 8;\n if (certificateEntryOffset + 8 > optionalHeaderEnd) {\n return false;\n }\n const certificateSize = content.readUInt32LE(certificateEntryOffset + 4);\n return certificateSize !== 0;\n};\n\n/**\n * Embeds a muon config into a single muon-core executable.\n *\n * @param options Core executable embedding options.\n * @returns Embedding result metadata.\n */\nexport const embedMuonConfigInCoreFile = async ({\n corePath,\n configPath,\n outputPath,\n}: EmbedMuonConfigCoreOptions): Promise<EmbedMuonConfigResult> => {\n const config = await readMuonConfigInput(configPath);\n const payload = encodeMuonConfigTlv(config);\n const embeddedSlot = createMuonEmbeddedConfigSlot(payload);\n const coreContent = await readFile(corePath);\n if (isSignedPeExecutable(coreContent)) {\n throw new Error(\"Cannot embed muon config into a signed PE executable.\");\n }\n\n const slot = findMuonEmbeddedConfigSlot(coreContent);\n const patchedContent = Buffer.from(coreContent);\n embeddedSlot.copy(patchedContent, slot.offset);\n const resolvedOutputPath = outputPath ?? corePath;\n await writeFile(resolvedOutputPath, patchedContent);\n\n return {\n corePath,\n outputPath: resolvedOutputPath,\n slotOffset: slot.offset,\n payloadSize: payload.length,\n replaced: false,\n };\n};\n\n/**\n * Embeds a muon config into a single muon-launcher executable.\n *\n * @param options Launcher executable embedding options.\n * @returns Embedding result metadata.\n */\nexport const embedMuonConfigInLauncherFile = async ({\n launcherPath,\n configPath,\n outputPath,\n}: EmbedMuonConfigLauncherOptions): Promise<EmbedMuonConfigResult> => {\n const config = await readMuonConfigInput(configPath);\n const payload = encodeMuonConfigTlv(config);\n const embeddedSlot = createMuonLauncherEmbeddedConfigSlot(payload);\n const launcherContent = await readFile(launcherPath);\n if (isSignedPeExecutable(launcherContent)) {\n throw new Error(\n \"Cannot embed muon config into a signed muon-launcher PE executable.\",\n );\n }\n\n const slot = findMuonLauncherEmbeddedConfigSlot(launcherContent);\n const patchedContent = Buffer.from(launcherContent);\n embeddedSlot.copy(patchedContent, slot.offset);\n const resolvedOutputPath = outputPath ?? launcherPath;\n await writeFile(resolvedOutputPath, patchedContent);\n\n return {\n corePath: launcherPath,\n outputPath: resolvedOutputPath,\n slotOffset: slot.offset,\n payloadSize: payload.length,\n replaced: false,\n };\n};\n\nconst resolveRuntimeCorePath = async (runtimePath: string): Promise<string> => {\n const candidates = [\n join(runtimePath, \"muon-core\"),\n join(runtimePath, \"muon-core.exe\"),\n ];\n const existing: string[] = [];\n for (const candidate of candidates) {\n try {\n await access(candidate);\n existing.push(candidate);\n } catch {\n // Missing candidates are ignored until the final count check.\n }\n }\n if (existing.length !== 1) {\n throw new Error(\n `Expected exactly one muon-core executable in runtime path, found ${existing.length}.`,\n );\n }\n const [corePath] = existing;\n if (corePath === undefined) {\n throw new Error(\"muon-core executable was not found.\");\n }\n return corePath;\n};\n\n/**\n * Embeds a muon config into a runtime directory containing muon-core.\n *\n * @param options Runtime directory embedding options.\n * @returns Embedding result metadata.\n */\nexport const embedMuonConfigInRuntime = async ({\n runtimePath,\n configPath,\n outputRuntimePath,\n}: EmbedMuonConfigRuntimeOptions): Promise<EmbedMuonConfigResult> => {\n const targetRuntimePath = outputRuntimePath ?? runtimePath;\n if (outputRuntimePath !== undefined) {\n await cp(runtimePath, outputRuntimePath, {\n recursive: true,\n force: true,\n });\n }\n return embedMuonConfigInCoreFile({\n corePath: await resolveRuntimeCorePath(targetRuntimePath),\n configPath,\n outputPath: undefined,\n });\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nimport sharp from \"sharp\";\n\nconst normalizedIconSize = 256;\nconst windowsIconDibSizes = [16, 24, 32, 48, 64, 128] as const;\nconst pngSignature = Buffer.from([\n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,\n]);\n\ninterface RawIconImage {\n data: Buffer;\n width: number;\n height: number;\n}\n\ninterface WindowsIconImage {\n data: Buffer;\n size: number;\n bitCount: number;\n}\n\n/**\n * Creates a normalized square PNG icon image.\n *\n * @param pngData Source PNG bytes.\n * @param source Diagnostic source label used in errors.\n * @param label User-facing diagnostic label.\n * @returns PNG bytes normalized to the muon base icon size.\n * @remarks Non-square images are fitted into transparent padding without\n * stretching. The normalized PNG is the source for all platform-specific icon\n * derivatives.\n */\nexport const createNormalizedIconPngData = async (\n pngData: Buffer,\n source: string,\n label: string,\n): Promise<Buffer> => {\n await assertPngData(pngData, source, label);\n try {\n return await sharp(pngData)\n .resize(normalizedIconSize, normalizedIconSize, {\n fit: \"contain\",\n background: { r: 0, g: 0, b: 0, alpha: 0 },\n })\n .ensureAlpha()\n .png()\n .toBuffer();\n } catch {\n throw new Error(`${label} must be a valid PNG: ${source}`);\n }\n};\n\n/**\n * Creates a normalized square PNG icon image for Windows resources.\n *\n * @param pngData Source PNG bytes.\n * @param source Diagnostic source label used in errors.\n * @returns PNG bytes normalized to the muon base icon size.\n */\nexport const createNormalizedMuonIconPngData = async (\n pngData: Buffer,\n source: string,\n): Promise<Buffer> =>\n await createNormalizedIconPngData(pngData, source, \"Windows resource icon\");\n\n/**\n * Creates a Windows ICO file from PNG bytes.\n *\n * @param pngData Source PNG bytes.\n * @param source Diagnostic source label used in errors.\n * @returns ICO file bytes containing 16, 24, 32, 48, 64, 128, and 256 pixel images.\n * @remarks The 256px entry is PNG-compressed. Smaller entries are 32-bit DIB\n * images, matching the common Windows ICO layout recommended by Microsoft.\n */\nexport const createWindowsIconBufferFromPngData = async (\n pngData: Buffer,\n source: string,\n): Promise<Buffer> => {\n const normalizedPng = await createNormalizedMuonIconPngData(pngData, source);\n const images: WindowsIconImage[] = [];\n for (const size of windowsIconDibSizes) {\n const rawImage = await resizePngToRawRgba(normalizedPng, size, source);\n images.push({\n data: createDibIconImage(rawImage),\n size,\n bitCount: 32,\n });\n }\n images.push({\n data: normalizedPng,\n size: normalizedIconSize,\n bitCount: 32,\n });\n return createIco(images);\n};\n\n/**\n * Creates a Windows ICO file from a PNG file.\n *\n * @param sourcePath Source PNG file path.\n * @param outputPath Output ICO file path.\n * @returns Promise resolved when the ICO file has been written.\n */\nexport const createWindowsIconFromPngFile = async (\n sourcePath: string,\n outputPath: string,\n): Promise<void> => {\n const icon = await createWindowsIconBufferFromPngData(\n await readFile(sourcePath),\n sourcePath,\n );\n await mkdir(dirname(outputPath), { recursive: true });\n await writeFile(outputPath, icon);\n};\n\nconst assertPngData = async (\n data: Buffer,\n source: string,\n label: string,\n): Promise<void> => {\n if (data.length === 0) {\n throw new Error(`${label} PNG must not be empty: ${source}`);\n }\n if (!data.subarray(0, pngSignature.length).equals(pngSignature)) {\n throw new Error(`${label} must be a valid PNG: ${source}`);\n }\n try {\n const metadata = await sharp(data).metadata();\n if (metadata.format !== \"png\") {\n throw new Error();\n }\n } catch {\n throw new Error(`${label} must be a valid PNG: ${source}`);\n }\n};\n\nconst resizePngToRawRgba = async (\n pngData: Buffer,\n size: number,\n source: string,\n): Promise<RawIconImage> => {\n try {\n const { data, info } = await sharp(pngData)\n .resize(size, size, {\n fit: \"fill\",\n kernel: \"lanczos3\",\n })\n .ensureAlpha()\n .raw()\n .toBuffer({ resolveWithObject: true });\n if (info.width !== size || info.height !== size || info.channels !== 4) {\n throw new Error();\n }\n return {\n data,\n width: info.width,\n height: info.height,\n };\n } catch {\n throw new Error(`Failed to resize Windows resource icon PNG: ${source}`);\n }\n};\n\nconst createDibIconImage = (image: RawIconImage): Buffer => {\n const pixelBytes = image.width * image.height * 4;\n const maskStride = Math.ceil(image.width / 32) * 4;\n const maskBytes = maskStride * image.height;\n const output = Buffer.alloc(40 + pixelBytes + maskBytes);\n output.writeUInt32LE(40, 0);\n output.writeInt32LE(image.width, 4);\n output.writeInt32LE(image.height * 2, 8);\n output.writeUInt16LE(1, 12);\n output.writeUInt16LE(32, 14);\n output.writeUInt32LE(0, 16);\n output.writeUInt32LE(pixelBytes + maskBytes, 20);\n output.writeInt32LE(0, 24);\n output.writeInt32LE(0, 28);\n output.writeUInt32LE(0, 32);\n output.writeUInt32LE(0, 36);\n\n for (let y = 0; y < image.height; y += 1) {\n const sourceY = image.height - 1 - y;\n for (let x = 0; x < image.width; x += 1) {\n const sourceOffset = (sourceY * image.width + x) * 4;\n const outputOffset = 40 + (y * image.width + x) * 4;\n output[outputOffset] = image.data[sourceOffset + 2]!;\n output[outputOffset + 1] = image.data[sourceOffset + 1]!;\n output[outputOffset + 2] = image.data[sourceOffset]!;\n output[outputOffset + 3] = image.data[sourceOffset + 3]!;\n }\n }\n return output;\n};\n\nconst createIco = (images: readonly WindowsIconImage[]): Buffer => {\n const directorySize = 6 + images.length * 16;\n let imageOffset = directorySize;\n const header = Buffer.alloc(directorySize);\n header.writeUInt16LE(0, 0);\n header.writeUInt16LE(1, 2);\n header.writeUInt16LE(images.length, 4);\n\n const imageData: Buffer[] = [];\n images.forEach((image, index) => {\n const entryOffset = 6 + index * 16;\n header[entryOffset] = image.size === 256 ? 0 : image.size;\n header[entryOffset + 1] = image.size === 256 ? 0 : image.size;\n header[entryOffset + 2] = 0;\n header[entryOffset + 3] = 0;\n header.writeUInt16LE(1, entryOffset + 4);\n header.writeUInt16LE(image.bitCount, entryOffset + 6);\n header.writeUInt32LE(image.data.length, entryOffset + 8);\n header.writeUInt32LE(imageOffset, entryOffset + 12);\n imageOffset += image.data.length;\n imageData.push(image.data);\n });\n\n return Buffer.concat([header, ...imageData]);\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport { access, readFile } from \"node:fs/promises\";\nimport { extname, isAbsolute, resolve } from \"node:path\";\n\nimport { createNormalizedIconPngData } from \"./windows-icon.js\";\n\ntype JsonObject = Record<string, unknown>;\n\n/**\n * ZIP entry used for the generated static application icon asset.\n */\nexport const appIconAssetEntryName = \"main/.muon/app-icon.png\";\n\n/**\n * Runtime asset URL injected as the generated initial title bar icon.\n */\nexport const appIconAssetUrl = \"asset://main/.muon/app-icon.png\";\n\n/**\n * Source for a unified static application icon path.\n */\nexport interface MuonAppIconSource {\n /** Raw icon path as supplied by the source. */\n iconPath: string;\n /** Directory that relative icon paths are resolved from. */\n directory: string;\n}\n\n/**\n * Creates a static application icon source from API or CLI options.\n */\nexport const createAppIconOptionsSource = (\n iconPath: unknown,\n directory: string,\n label: string = \"iconPath\",\n): MuonAppIconSource | undefined => {\n if (iconPath === undefined) {\n return undefined;\n }\n if (typeof iconPath !== \"string\") {\n throw new Error(`${label} must be a string when present.`);\n }\n if (iconPath.trim() === \"\") {\n return undefined;\n }\n return {\n iconPath: iconPath.trim(),\n directory,\n };\n};\n\n/**\n * Reads the top-level `iconPath` from a muon config object.\n */\nexport const readConfigAppIconSource = (\n config: JsonObject,\n directory: string,\n label: string,\n): MuonAppIconSource | undefined => {\n const value = config.iconPath;\n if (value === undefined) {\n return undefined;\n }\n if (typeof value !== \"string\") {\n throw new Error(`${label} iconPath must be a string when present.`);\n }\n return createAppIconOptionsSource(value, directory);\n};\n\n/**\n * Reads the top-level `iconPath` from project metadata.\n */\nexport const readProjectAppIconSource = (\n projectJson: JsonObject,\n directory: string,\n): MuonAppIconSource | undefined => {\n const value = projectJson.iconPath;\n return typeof value === \"string\"\n ? createAppIconOptionsSource(value, directory)\n : undefined;\n};\n\n/**\n * Resolves and validates the first available static application icon source.\n */\nexport const resolveMuonAppIconPath = async (\n sources: readonly MuonAppIconSource[],\n): Promise<string | undefined> => {\n for (const source of sources) {\n const iconPath = resolveResourcePath(source.directory, source.iconPath);\n await assertMuonAppIconPath(iconPath);\n return iconPath;\n }\n return undefined;\n};\n\nconst assertMuonAppIconPath = async (iconPath: string): Promise<void> => {\n if (extname(iconPath).toLowerCase() !== \".png\") {\n throw new Error(`muon app icon must be a .png file: ${iconPath}`);\n }\n if (!(await fileExists(iconPath))) {\n throw new Error(`muon app icon does not exist: ${iconPath}`);\n }\n await createNormalizedIconPngData(\n await readFile(iconPath),\n iconPath,\n \"muon app icon\",\n );\n};\n\nconst resolveResourcePath = (directory: string, value: string): string =>\n isAbsolute(value) ? value : resolve(directory, value);\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport {\n access,\n chmod,\n copyFile,\n mkdtemp,\n readFile,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, extname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\n\nimport { runMuonPrepareResourceUpdate } from \"./prepare.js\";\nimport type { MuonWindowsResourceOptions } from \"./vite.js\";\nimport {\n createNormalizedMuonIconPngData,\n createWindowsIconFromPngFile,\n} from \"./windows-icon.js\";\nimport {\n createAppIconOptionsSource,\n readConfigAppIconSource,\n readProjectAppIconSource,\n resolveMuonAppIconPath,\n type MuonAppIconSource,\n} from \"./app-icon.js\";\n\nexport type { MuonWindowsResourceOptions } from \"./vite.js\";\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst defaultLanguage = 1033;\nconst defaultCodePage = 1200;\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\ntype JsonObject = Record<string, unknown>;\n\ninterface WindowsResourceSource {\n options: MuonWindowsResourceOptions;\n directory: string;\n}\n\ninterface WindowsResourceDefaults {\n productName: string;\n fileDescription: string;\n companyName: string;\n version: string;\n copyright: string | undefined;\n}\n\ninterface ResolveWindowsResourceInput {\n root: string;\n packageDirectory: string;\n packageJson: JsonObject;\n muonConfig: JsonObject;\n muonConfigDirectory: string;\n options: MuonWindowsResourceOptions | undefined;\n appIconPath: string | undefined;\n defaults: WindowsResourceDefaults;\n}\n\n/**\n * Resolved Windows resource metadata used by build and pack outputs.\n */\nexport interface ResolvedMuonWindowsResource {\n /** Resolved `.png` icon file path. */\n iconPath: string;\n /** Product name. */\n productName: string;\n /** File description. */\n fileDescription: string;\n /** Company name. */\n companyName: string;\n /** Original version string. */\n version: string;\n /** Four-part fixed version string. */\n fixedVersion: string;\n /** Legal copyright, if supplied. */\n copyright: string | undefined;\n /** Windows resource language identifier. */\n language: number;\n /** Windows version resource code page. */\n codePage: number;\n}\n\n/**\n * muon config file content and directory used for resource option resolution.\n */\nexport interface MuonWindowsResourceConfigSource {\n /** Parsed muon config object. */\n config: JsonObject;\n /** Directory that relative config paths are resolved from. */\n directory: string;\n}\n\n/**\n * Reads the muon config file using the same default file names as muon build.\n */\nexport const readMuonConfigForWindowsResource = async (\n root: string,\n configPath: string | undefined,\n): Promise<MuonWindowsResourceConfigSource> => {\n const resolvedConfigPath = await resolveConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n config: {},\n directory: root,\n };\n }\n return {\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n directory: dirname(resolvedConfigPath),\n };\n};\n\n/**\n * Merges Windows resource options while preserving field-level fallback.\n */\nexport const mergeMuonWindowsResourceOptions = (\n primary: MuonWindowsResourceOptions | undefined,\n fallback: MuonWindowsResourceOptions | undefined,\n): MuonWindowsResourceOptions | undefined => {\n if (primary === undefined) {\n return fallback;\n }\n if (fallback === undefined) {\n return primary;\n }\n\n const merged: MuonWindowsResourceOptions = { ...fallback };\n if (primary.iconPath !== undefined) {\n merged.iconPath = primary.iconPath;\n }\n if (primary.productName !== undefined) {\n merged.productName = primary.productName;\n }\n if (primary.fileDescription !== undefined) {\n merged.fileDescription = primary.fileDescription;\n }\n if (primary.companyName !== undefined) {\n merged.companyName = primary.companyName;\n }\n if (primary.version !== undefined) {\n merged.version = primary.version;\n }\n if (primary.copyright !== undefined) {\n merged.copyright = primary.copyright;\n }\n if (primary.language !== undefined) {\n merged.language = primary.language;\n }\n if (primary.codePage !== undefined) {\n merged.codePage = primary.codePage;\n }\n return merged;\n};\n\n/**\n * Resolves Windows resource metadata from options, config files, and package metadata.\n */\nexport const resolveMuonWindowsResource = async (\n input: ResolveWindowsResourceInput,\n): Promise<ResolvedMuonWindowsResource> => {\n const projectJson = await readProjectJson(input.root);\n const windowsSources = [\n createOptionsSource(input.options, input.root, \"windowsResource\"),\n readConfigWindowsResourceSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n readConfigWindowsResourceSource(projectJson, input.root, \"project.json\"),\n ].filter((source): source is WindowsResourceSource => source !== undefined);\n const sources = [\n ...windowsSources,\n createProjectSource(projectJson, input.root),\n createPackageSource(input.packageJson, input.root),\n ].filter((source): source is WindowsResourceSource => source !== undefined);\n const appIconSources = [\n createAppIconOptionsSource(input.appIconPath, input.root),\n readConfigAppIconSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n readProjectAppIconSource(projectJson, input.root),\n ].filter((source): source is MuonAppIconSource => source !== undefined);\n\n const productName = resolveStringField(\n sources,\n \"productName\",\n input.defaults.productName,\n );\n const fileDescription = resolveStringField(\n sources,\n \"fileDescription\",\n input.defaults.fileDescription,\n );\n const companyName = resolveStringField(\n sources,\n \"companyName\",\n input.defaults.companyName,\n );\n const version = resolveStringField(\n sources,\n \"version\",\n input.defaults.version,\n );\n const copyright = resolveOptionalStringField(\n sources,\n \"copyright\",\n input.defaults.copyright,\n );\n const language = resolveNumericField(sources, \"language\", defaultLanguage);\n const codePage = resolveNumericField(sources, \"codePage\", defaultCodePage);\n const fixedVersion = normalizeWindowsVersion(version);\n const iconPath = await resolveWindowsIconPath(\n windowsSources,\n appIconSources,\n await resolveDefaultWindowsIcon(input.packageDirectory),\n );\n\n return {\n iconPath,\n productName,\n fileDescription,\n companyName,\n version,\n fixedVersion,\n copyright,\n language,\n codePage,\n };\n};\n\n/**\n * Removes build-only Windows resource settings from runtime config.\n */\nexport const stripBuildOnlyWindowsResourceConfig = (\n sourceConfig: JsonObject,\n): JsonObject => {\n const sourceWindows = sourceConfig.windows;\n if (!isJsonObject(sourceWindows)) {\n return sourceConfig;\n }\n\n const windowsConfig: JsonObject = {};\n for (const [key, value] of Object.entries(sourceWindows)) {\n if (key !== \"resource\") {\n windowsConfig[key] = value;\n }\n }\n\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"windows\") {\n output[key] = value;\n }\n }\n if (Object.keys(windowsConfig).length > 0) {\n output.windows = windowsConfig;\n }\n return output;\n};\n\n/**\n * Returns true when the file has a Windows PE header.\n */\nexport const isWindowsPeExecutable = async (path: string): Promise<boolean> => {\n const content = await readFile(path);\n if (content.length < 0x40 || content.toString(\"ascii\", 0, 2) !== \"MZ\") {\n return false;\n }\n const peOffset = content.readUInt32LE(0x3c);\n return (\n peOffset + 4 <= content.length &&\n content.toString(\"ascii\", peOffset, peOffset + 4) === \"PE\\0\\0\"\n );\n};\n\n/**\n * Applies resolved resource metadata to a Windows PE executable in place.\n */\nexport const updateWindowsPeResources = async (input: {\n executablePath: string;\n resource: ResolvedMuonWindowsResource;\n environment: NodeJS.ProcessEnv;\n cwd: string;\n}): Promise<boolean> => {\n return await updateWindowsPeResourceFile(input, createEngraverUpdate);\n};\n\n/**\n * Applies only resolved icon metadata to a Windows PE executable in place.\n */\nexport const updateWindowsPeIconResource = async (input: {\n executablePath: string;\n resource: ResolvedMuonWindowsResource;\n environment: NodeJS.ProcessEnv;\n cwd: string;\n}): Promise<boolean> => {\n return await updateWindowsPeResourceFile(input, createEngraverIconUpdate);\n};\n\nconst updateWindowsPeResourceFile = async (\n input: {\n executablePath: string;\n resource: ResolvedMuonWindowsResource;\n environment: NodeJS.ProcessEnv;\n cwd: string;\n },\n createUpdate: (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n ) => JsonObject,\n): Promise<boolean> => {\n if (!(await isWindowsPeExecutable(input.executablePath))) {\n return false;\n }\n\n const mode = (await stat(input.executablePath)).mode & 0o777;\n const tempDirectory = await mkdtemp(join(tmpdir(), \"muon-windows-resource-\"));\n const updatesJsonPath = join(tempDirectory, \"updates.json\");\n const outputPath = join(tempDirectory, \"output.exe\");\n const iconPath = join(tempDirectory, \"icon.ico\");\n try {\n await createWindowsIconFromPngFile(input.resource.iconPath, iconPath);\n await writeFile(\n updatesJsonPath,\n `${JSON.stringify(createUpdate(input.resource, iconPath), null, 2)}\\n`,\n );\n await runMuonPrepareResourceUpdate({\n inputPath: input.executablePath,\n updatesJsonPath,\n outputPath,\n quiet: true,\n prepareExecutablePath: undefined,\n environment: input.environment,\n cwd: input.cwd,\n });\n await copyFile(outputPath, input.executablePath);\n await chmod(input.executablePath, mode === 0 ? 0o755 : mode);\n return true;\n } finally {\n await rm(tempDirectory, { recursive: true, force: true });\n }\n};\n\nconst createEngraverUpdate = (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n): JsonObject => {\n const strings: JsonObject = {\n CompanyName: resource.companyName,\n FileDescription: resource.fileDescription,\n FileVersion: resource.version,\n ProductName: resource.productName,\n ProductVersion: resource.version,\n };\n if (resource.copyright !== undefined) {\n strings.LegalCopyright = resource.copyright;\n }\n\n return {\n version: {\n language: resource.language,\n codePage: resource.codePage,\n fixed: {\n fileVersion: resource.fixedVersion,\n productVersion: resource.fixedVersion,\n fileOS: \"windows32\",\n fileType: \"app\",\n },\n strings,\n },\n icons: createEngraverIcons(resource, iconPath),\n };\n};\n\nconst createEngraverIconUpdate = (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n): JsonObject => ({\n icons: createEngraverIcons(resource, iconPath),\n});\n\nconst createEngraverIcons = (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n): JsonObject[] => [\n {\n id: 1,\n language: resource.language,\n path: iconPath,\n },\n];\n\nconst resolveConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n return undefined;\n};\n\nconst readProjectJson = async (root: string): Promise<JsonObject> => {\n const projectJsonPath = join(root, \"project.json\");\n if (!(await fileExists(projectJsonPath))) {\n return {};\n }\n return await readJsonObjectFile(projectJsonPath, \"project.json\");\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n const parsed = parse(await readFile(filePath, \"utf8\"));\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n return parsed;\n};\n\nconst createOptionsSource = (\n options: MuonWindowsResourceOptions | undefined,\n directory: string,\n label: string,\n): WindowsResourceSource | undefined => {\n if (options === undefined) {\n return undefined;\n }\n return {\n options: validateWindowsResourceOptions(options, label),\n directory,\n };\n};\n\nconst readConfigWindowsResourceSource = (\n config: JsonObject,\n directory: string,\n label: string,\n): WindowsResourceSource | undefined => {\n const windows = config.windows;\n if (windows === undefined) {\n return undefined;\n }\n if (!isJsonObject(windows)) {\n throw new Error(`${label} windows must be an object when present.`);\n }\n const resource = windows.resource;\n if (resource === undefined) {\n return undefined;\n }\n return createOptionsSource(\n validateWindowsResourceOptions(resource, `${label} windows.resource`),\n directory,\n `${label} windows.resource`,\n );\n};\n\nconst createProjectSource = (\n projectJson: JsonObject,\n directory: string,\n): WindowsResourceSource | undefined => {\n const topLevel: MuonWindowsResourceOptions = {};\n copyStringField(projectJson, \"productName\", topLevel, \"productName\");\n copyStringField(projectJson, \"name\", topLevel, \"productName\");\n copyStringField(projectJson, \"fileDescription\", topLevel, \"fileDescription\");\n copyStringField(projectJson, \"description\", topLevel, \"fileDescription\");\n copyStringField(projectJson, \"companyName\", topLevel, \"companyName\");\n copyStringField(projectJson, \"version\", topLevel, \"version\");\n copyStringField(projectJson, \"copyright\", topLevel, \"copyright\");\n const author = stringifyAuthor(projectJson.author);\n if (author !== undefined && topLevel.companyName === undefined) {\n topLevel.companyName = author;\n }\n\n const configSource = readConfigWindowsResourceSource(\n projectJson,\n directory,\n \"project.json\",\n );\n const options = mergeMuonWindowsResourceOptions(\n configSource?.options,\n topLevel,\n );\n if (options === undefined || Object.keys(options).length === 0) {\n return undefined;\n }\n return {\n options,\n directory,\n };\n};\n\nconst createPackageSource = (\n packageJson: JsonObject,\n directory: string,\n): WindowsResourceSource | undefined => {\n const options: MuonWindowsResourceOptions = {};\n copyStringField(packageJson, \"name\", options, \"productName\");\n copyStringField(packageJson, \"description\", options, \"fileDescription\");\n copyStringField(packageJson, \"version\", options, \"version\");\n copyStringField(packageJson, \"copyright\", options, \"copyright\");\n const author = stringifyAuthor(packageJson.author);\n if (author !== undefined) {\n options.companyName = author;\n }\n return Object.keys(options).length === 0\n ? undefined\n : {\n options,\n directory,\n };\n};\n\nconst copyStringField = (\n source: JsonObject,\n sourceKey: string,\n target: MuonWindowsResourceOptions,\n targetKey: keyof Pick<\n MuonWindowsResourceOptions,\n \"productName\" | \"fileDescription\" | \"companyName\" | \"version\" | \"copyright\"\n >,\n): void => {\n const value = source[sourceKey];\n if (typeof value === \"string\" && value.trim() !== \"\") {\n target[targetKey] = value.trim();\n }\n};\n\nconst validateWindowsResourceOptions = (\n value: unknown,\n label: string,\n): MuonWindowsResourceOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`${label} must be an object.`);\n }\n\n const output: MuonWindowsResourceOptions = {};\n copyOptionalStringResourceField(value, \"iconPath\", output);\n copyOptionalStringResourceField(value, \"productName\", output);\n copyOptionalStringResourceField(value, \"fileDescription\", output);\n copyOptionalStringResourceField(value, \"companyName\", output);\n copyOptionalStringResourceField(value, \"version\", output);\n copyOptionalStringResourceField(value, \"copyright\", output);\n copyOptionalNumberResourceField(value, \"language\", output, label);\n copyOptionalNumberResourceField(value, \"codePage\", output, label);\n return output;\n};\n\nconst copyOptionalStringResourceField = (\n source: JsonObject,\n key: keyof Pick<\n MuonWindowsResourceOptions,\n | \"iconPath\"\n | \"productName\"\n | \"fileDescription\"\n | \"companyName\"\n | \"version\"\n | \"copyright\"\n >,\n target: MuonWindowsResourceOptions,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (typeof value !== \"string\") {\n throw new Error(`${key} must be a string when present.`);\n }\n if (value.trim() !== \"\") {\n target[key] = value.trim();\n }\n};\n\nconst copyOptionalNumberResourceField = (\n source: JsonObject,\n key: keyof Pick<MuonWindowsResourceOptions, \"language\" | \"codePage\">,\n target: MuonWindowsResourceOptions,\n label: string,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (\n typeof value !== \"number\" ||\n !Number.isInteger(value) ||\n value < 0 ||\n value > 0xffff\n ) {\n throw new Error(`${label} ${key} must be an integer from 0 to 65535.`);\n }\n target[key] = value;\n};\n\nconst resolveStringField = (\n sources: readonly WindowsResourceSource[],\n field: keyof Pick<\n MuonWindowsResourceOptions,\n \"productName\" | \"fileDescription\" | \"companyName\" | \"version\"\n >,\n fallback: string,\n): string => {\n return resolveOptionalStringField(sources, field, fallback) ?? fallback;\n};\n\nconst resolveOptionalStringField = (\n sources: readonly WindowsResourceSource[],\n field: keyof Pick<\n MuonWindowsResourceOptions,\n \"productName\" | \"fileDescription\" | \"companyName\" | \"version\" | \"copyright\"\n >,\n fallback: string | undefined,\n): string | undefined => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined && value.trim() !== \"\") {\n return value.trim();\n }\n }\n return fallback;\n};\n\nconst resolveNumericField = (\n sources: readonly WindowsResourceSource[],\n field: keyof Pick<MuonWindowsResourceOptions, \"language\" | \"codePage\">,\n fallback: number,\n): number => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined) {\n return value;\n }\n }\n return fallback;\n};\n\nconst resolveWindowsIconPath = async (\n windowsSources: readonly WindowsResourceSource[],\n appIconSources: readonly MuonAppIconSource[],\n defaultIconPath: string,\n): Promise<string> => {\n for (const source of windowsSources) {\n const value = source.options.iconPath;\n if (value !== undefined && value.trim() !== \"\") {\n const iconPath = resolveResourcePath(source.directory, value);\n await assertIconPath(iconPath);\n return iconPath;\n }\n }\n const appIconPath = await resolveMuonAppIconPath(appIconSources);\n if (appIconPath !== undefined) {\n return appIconPath;\n }\n await assertIconPath(defaultIconPath);\n return defaultIconPath;\n};\n\nconst assertIconPath = async (iconPath: string): Promise<void> => {\n if (extname(iconPath).toLowerCase() !== \".png\") {\n throw new Error(`Windows resource icon must be a .png file: ${iconPath}`);\n }\n if (!(await fileExists(iconPath))) {\n throw new Error(`Windows resource icon does not exist: ${iconPath}`);\n }\n await createNormalizedMuonIconPngData(await readFile(iconPath), iconPath);\n};\n\nconst resolveDefaultWindowsIcon = async (\n packageDirectory: string,\n): Promise<string> => {\n const sourceIconPath = join(\n moduleDirectory,\n \"..\",\n \"..\",\n \"images\",\n \"muon-256.png\",\n );\n const candidates = [\n join(resolve(packageDirectory), \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"..\", \"dist\", \"native\", \"muon-256.png\"),\n sourceIconPath,\n ];\n for (const candidate of candidates) {\n if (await fileExists(candidate)) {\n return candidate;\n }\n }\n return sourceIconPath;\n};\n\nconst resolveResourcePath = (directory: string, path: string): string => {\n return isAbsolute(path) ? path : resolve(directory, path);\n};\n\nconst normalizeWindowsVersion = (version: string): string => {\n const normalized = version.trim();\n const match = /^(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?(?:\\.(\\d+))?(?:$|[-+])/.exec(\n normalized,\n );\n if (match === null) {\n throw new Error(\n `Windows resource version must start with numeric parts: ${version}`,\n );\n }\n const values = [match[1], match[2], match[3], match[4]].map((value) =>\n value === undefined ? 0 : Number.parseInt(value, 10),\n );\n for (const value of values) {\n if (!Number.isInteger(value) || value < 0 || value > 0xffff) {\n throw new Error(\n `Windows resource version part must be from 0 to 65535: ${version}`,\n );\n }\n }\n return values.join(\".\");\n};\n\nconst stringifyAuthor = (value: unknown): string | undefined => {\n if (typeof value === \"string\" && value.trim() !== \"\") {\n return value.trim();\n }\n if (!isJsonObject(value) || typeof value.name !== \"string\") {\n return undefined;\n }\n const name = value.name.trim();\n if (name === \"\") {\n return undefined;\n }\n return value.email === undefined || typeof value.email !== \"string\"\n ? name\n : `${name} <${value.email}>`;\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport { access, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname, extname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\n\nimport type { MuonLinuxDesktopOptions } from \"./vite.js\";\nimport { createNormalizedIconPngData } from \"./windows-icon.js\";\nimport {\n createAppIconOptionsSource,\n readConfigAppIconSource,\n readProjectAppIconSource,\n resolveMuonAppIconPath,\n type MuonAppIconSource,\n} from \"./app-icon.js\";\n\nexport type { MuonLinuxDesktopOptions } from \"./vite.js\";\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst defaultIconFileName = \"muon-desktop-icon.png\";\nconst defaultDesktopConfigFileName = \"muon-desktop.json\";\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\ntype JsonObject = Record<string, unknown>;\n\ninterface LinuxDesktopSource {\n options: MuonLinuxDesktopOptions;\n directory: string;\n}\n\ninterface LinuxDesktopDefaults {\n desktopId: string;\n name: string;\n comment: string;\n categories: readonly string[];\n startupNotify: boolean;\n}\n\ninterface ResolveLinuxDesktopInput {\n root: string;\n packageDirectory: string;\n muonConfig: JsonObject;\n muonConfigDirectory: string;\n options: MuonLinuxDesktopOptions | undefined;\n appIconPath: string | undefined;\n defaults: LinuxDesktopDefaults;\n}\n\n/**\n * Resolved Linux desktop integration metadata used by build and pack outputs.\n */\nexport interface ResolvedMuonLinuxDesktop {\n /** Desktop file identifier without the `.desktop` suffix. */\n desktopId: string;\n /** Application display name. */\n name: string;\n /** Application description used as a desktop entry comment. */\n comment: string;\n /** Desktop menu categories. */\n categories: readonly string[];\n /** Whether desktop startup notification is requested. */\n startupNotify: boolean;\n /** Resolved PNG icon file path. */\n iconPath: string;\n /** File name written into target distributions for the normalized icon. */\n iconFileName: string;\n /** File name written into target distributions for launcher desktop metadata. */\n configFileName: string;\n}\n\n/**\n * muon config file content and directory used for Linux desktop option\n * resolution.\n */\nexport interface MuonLinuxDesktopConfigSource {\n /** Parsed muon config object. */\n config: JsonObject;\n /** Directory that relative config paths are resolved from. */\n directory: string;\n}\n\n/**\n * Reads the muon config file using the same default file names as muon build.\n */\nexport const readMuonConfigForLinuxDesktop = async (\n root: string,\n configPath: string | undefined,\n): Promise<MuonLinuxDesktopConfigSource> => {\n const resolvedConfigPath = await resolveConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n config: {},\n directory: root,\n };\n }\n return {\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n directory: dirname(resolvedConfigPath),\n };\n};\n\n/**\n * Merges Linux desktop options while preserving field-level fallback.\n */\nexport const mergeMuonLinuxDesktopOptions = (\n primary: MuonLinuxDesktopOptions | undefined,\n fallback: MuonLinuxDesktopOptions | undefined,\n): MuonLinuxDesktopOptions | undefined => {\n if (primary === undefined) {\n return fallback;\n }\n if (fallback === undefined) {\n return primary;\n }\n\n const merged: MuonLinuxDesktopOptions = { ...fallback };\n if (primary.desktopId !== undefined) {\n merged.desktopId = primary.desktopId;\n }\n if (primary.name !== undefined) {\n merged.name = primary.name;\n }\n if (primary.comment !== undefined) {\n merged.comment = primary.comment;\n }\n if (primary.iconPath !== undefined) {\n merged.iconPath = primary.iconPath;\n }\n if (primary.categories !== undefined) {\n merged.categories = primary.categories;\n }\n if (primary.startupNotify !== undefined) {\n merged.startupNotify = primary.startupNotify;\n }\n return merged;\n};\n\n/**\n * Resolves Linux desktop integration metadata from options, config files, and\n * package metadata.\n */\nexport const resolveMuonLinuxDesktop = async (\n input: ResolveLinuxDesktopInput,\n): Promise<ResolvedMuonLinuxDesktop> => {\n const projectJson = await readProjectJson(input.root);\n const sources = [\n createOptionsSource(input.options, input.root, \"linuxDesktop\"),\n readConfigLinuxDesktopSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n ].filter((source): source is LinuxDesktopSource => source !== undefined);\n const appIconSources = [\n createAppIconOptionsSource(input.appIconPath, input.root),\n readConfigAppIconSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n readProjectAppIconSource(projectJson, input.root),\n ].filter((source): source is MuonAppIconSource => source !== undefined);\n\n const desktopId = sanitizeDesktopId(\n resolveStringField(sources, \"desktopId\", input.defaults.desktopId),\n );\n const name = resolveStringField(sources, \"name\", input.defaults.name);\n const comment = resolveStringField(\n sources,\n \"comment\",\n input.defaults.comment,\n );\n const categories = resolveCategories(sources, input.defaults.categories);\n const startupNotify = resolveBooleanField(\n sources,\n \"startupNotify\",\n input.defaults.startupNotify,\n );\n const iconPath = await resolveLinuxIconPath(\n sources,\n appIconSources,\n await resolveDefaultLinuxDesktopIcon(input.packageDirectory),\n );\n\n return {\n desktopId,\n name,\n comment,\n categories,\n startupNotify,\n iconPath,\n iconFileName: defaultIconFileName,\n configFileName: defaultDesktopConfigFileName,\n };\n};\n\n/**\n * Removes build-only Linux desktop settings from runtime config.\n */\nexport const stripBuildOnlyLinuxDesktopConfig = (\n sourceConfig: JsonObject,\n): JsonObject => {\n const sourceLinux = sourceConfig.linux;\n if (!isJsonObject(sourceLinux)) {\n return sourceConfig;\n }\n\n const linuxConfig: JsonObject = {};\n for (const [key, value] of Object.entries(sourceLinux)) {\n if (key !== \"desktop\") {\n linuxConfig[key] = value;\n }\n }\n\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"linux\") {\n output[key] = value;\n }\n }\n if (Object.keys(linuxConfig).length > 0) {\n output.linux = linuxConfig;\n }\n return output;\n};\n\n/**\n * Writes normalized Linux desktop sidecar files into a target distribution.\n */\nexport const writeLinuxDesktopDistributionFiles = async (\n outputPath: string,\n desktop: ResolvedMuonLinuxDesktop,\n): Promise<void> => {\n const iconData = await createNormalizedIconPngData(\n await readFile(desktop.iconPath),\n desktop.iconPath,\n \"Linux desktop icon\",\n );\n await writeFile(join(outputPath, desktop.iconFileName), iconData);\n await writeFile(\n join(outputPath, desktop.configFileName),\n `${JSON.stringify(\n {\n desktopId: desktop.desktopId,\n name: desktop.name,\n comment: desktop.comment,\n categories: desktop.categories,\n startupNotify: desktop.startupNotify,\n iconFileName: desktop.iconFileName,\n },\n undefined,\n 2,\n )}\\n`,\n );\n};\n\n/**\n * Creates a Desktop Entry file.\n */\nexport const createLinuxDesktopEntry = (input: {\n desktop: ResolvedMuonLinuxDesktop;\n exec: string;\n tryExec: string;\n icon: string;\n}): string => {\n const lines = [\n \"[Desktop Entry]\",\n \"Type=Application\",\n `Name=${escapeDesktopString(input.desktop.name)}`,\n ];\n if (input.desktop.comment.length > 0) {\n lines.push(`Comment=${escapeDesktopString(input.desktop.comment)}`);\n }\n lines.push(`Exec=${input.exec}`);\n lines.push(`TryExec=${input.tryExec}`);\n lines.push(`Icon=${escapeDesktopString(input.icon)}`);\n lines.push(`Terminal=false`);\n if (input.desktop.categories.length > 0) {\n lines.push(`Categories=${input.desktop.categories.join(\";\")};`);\n }\n lines.push(`StartupNotify=${input.desktop.startupNotify ? \"true\" : \"false\"}`);\n lines.push(`StartupWMClass=${escapeDesktopString(input.desktop.desktopId)}`);\n lines.push(\"X-muon-Managed=true\");\n lines.push(\"\");\n return lines.join(\"\\n\");\n};\n\n/**\n * Quotes one Desktop Entry Exec argument.\n */\nexport const quoteDesktopExecArgument = (value: string): string => {\n let escaped = '\"';\n for (const character of value) {\n if (\n character === '\"' ||\n character === \"\\\\\" ||\n character === \"$\" ||\n character === \"`\"\n ) {\n escaped += \"\\\\\";\n }\n escaped += character;\n }\n return `${escaped}\"`;\n};\n\nconst resolveConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n return undefined;\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n const parsed = parse(await readFile(filePath, \"utf8\"));\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n return parsed;\n};\n\nconst readProjectJson = async (root: string): Promise<JsonObject> => {\n const projectJsonPath = join(root, \"project.json\");\n if (!(await fileExists(projectJsonPath))) {\n return {};\n }\n return await readJsonObjectFile(projectJsonPath, \"project.json\");\n};\n\nconst createOptionsSource = (\n options: MuonLinuxDesktopOptions | undefined,\n directory: string,\n label: string,\n): LinuxDesktopSource | undefined => {\n if (options === undefined) {\n return undefined;\n }\n return {\n options: validateLinuxDesktopOptions(options, label),\n directory,\n };\n};\n\nconst readConfigLinuxDesktopSource = (\n config: JsonObject,\n directory: string,\n label: string,\n): LinuxDesktopSource | undefined => {\n const linux = config.linux;\n if (linux === undefined) {\n return undefined;\n }\n if (!isJsonObject(linux)) {\n throw new Error(`${label} linux must be an object when present.`);\n }\n const desktop = linux.desktop;\n if (desktop === undefined) {\n return undefined;\n }\n return createOptionsSource(\n validateLinuxDesktopOptions(desktop, `${label} linux.desktop`),\n directory,\n `${label} linux.desktop`,\n );\n};\n\nconst validateLinuxDesktopOptions = (\n value: unknown,\n label: string,\n): MuonLinuxDesktopOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`${label} must be an object.`);\n }\n\n const output: MuonLinuxDesktopOptions = {};\n copyOptionalStringDesktopField(value, \"desktopId\", output);\n copyOptionalStringDesktopField(value, \"name\", output);\n copyOptionalStringDesktopField(value, \"comment\", output);\n copyOptionalStringDesktopField(value, \"iconPath\", output);\n copyOptionalCategoriesField(value, output, label);\n copyOptionalBooleanDesktopField(value, \"startupNotify\", output, label);\n return output;\n};\n\nconst copyOptionalStringDesktopField = (\n source: JsonObject,\n key: keyof Pick<\n MuonLinuxDesktopOptions,\n \"desktopId\" | \"name\" | \"comment\" | \"iconPath\"\n >,\n target: MuonLinuxDesktopOptions,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (typeof value !== \"string\") {\n throw new Error(`${key} must be a string when present.`);\n }\n if (value.trim() !== \"\") {\n target[key] = value.trim();\n }\n};\n\nconst copyOptionalCategoriesField = (\n source: JsonObject,\n target: MuonLinuxDesktopOptions,\n label: string,\n): void => {\n const value = source.categories;\n if (value === undefined) {\n return;\n }\n if (\n !Array.isArray(value) ||\n !value.every(\n (entry) =>\n typeof entry === \"string\" &&\n entry.trim() !== \"\" &&\n !entry.includes(\";\") &&\n !entry.includes(\"\\n\") &&\n !entry.includes(\"\\r\"),\n )\n ) {\n throw new Error(\n `${label} categories must be a string array without semicolons when present.`,\n );\n }\n target.categories = value.map((entry) => entry.trim());\n};\n\nconst copyOptionalBooleanDesktopField = (\n source: JsonObject,\n key: keyof Pick<MuonLinuxDesktopOptions, \"startupNotify\">,\n target: MuonLinuxDesktopOptions,\n label: string,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (typeof value !== \"boolean\") {\n throw new Error(`${label} ${key} must be a boolean when present.`);\n }\n target[key] = value;\n};\n\nconst resolveStringField = (\n sources: readonly LinuxDesktopSource[],\n field: keyof Pick<MuonLinuxDesktopOptions, \"desktopId\" | \"name\" | \"comment\">,\n fallback: string,\n): string => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined && value.trim() !== \"\") {\n return value.trim();\n }\n }\n return fallback;\n};\n\nconst resolveCategories = (\n sources: readonly LinuxDesktopSource[],\n fallback: readonly string[],\n): readonly string[] => {\n for (const source of sources) {\n if (source.options.categories !== undefined) {\n return source.options.categories;\n }\n }\n return fallback;\n};\n\nconst resolveBooleanField = (\n sources: readonly LinuxDesktopSource[],\n field: keyof Pick<MuonLinuxDesktopOptions, \"startupNotify\">,\n fallback: boolean,\n): boolean => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined) {\n return value;\n }\n }\n return fallback;\n};\n\nconst resolveLinuxIconPath = async (\n sources: readonly LinuxDesktopSource[],\n appIconSources: readonly MuonAppIconSource[],\n defaultIconPath: string | undefined,\n): Promise<string> => {\n for (const source of sources) {\n const value = source.options.iconPath;\n if (value !== undefined && value.trim() !== \"\") {\n const iconPath = resolveResourcePath(source.directory, value);\n await assertIconPath(iconPath, true);\n return iconPath;\n }\n }\n const appIconPath = await resolveMuonAppIconPath(appIconSources);\n if (appIconPath !== undefined) {\n return appIconPath;\n }\n if (defaultIconPath !== undefined && (await fileExists(defaultIconPath))) {\n await assertIconPath(defaultIconPath, false);\n return defaultIconPath;\n }\n throw new Error(\"Linux desktop icon does not exist.\");\n};\n\nconst assertIconPath = async (\n iconPath: string,\n required: boolean,\n): Promise<void> => {\n if (extname(iconPath).toLowerCase() !== \".png\") {\n throw new Error(`Linux desktop icon must be a .png file: ${iconPath}`);\n }\n if (required && !(await fileExists(iconPath))) {\n throw new Error(`Linux desktop icon does not exist: ${iconPath}`);\n }\n if (await fileExists(iconPath)) {\n await createNormalizedIconPngData(\n await readFile(iconPath),\n iconPath,\n \"Linux desktop icon\",\n );\n }\n};\n\nconst resolveDefaultLinuxDesktopIcon = async (\n packageDirectory: string,\n): Promise<string | undefined> => {\n const candidates = [\n join(resolve(packageDirectory), \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"..\", \"dist\", \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"..\", \"..\", \"images\", \"muon-256.png\"),\n ];\n for (const candidate of candidates) {\n if (await fileExists(candidate)) {\n return candidate;\n }\n }\n return undefined;\n};\n\nconst sanitizeDesktopId = (value: string): string => {\n const sanitized = value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^[.-]+/g, \"\")\n .replace(/[.-]+$/g, \"\");\n return sanitized.length > 0 ? sanitized : \"muon-app\";\n};\n\nconst escapeDesktopString = (value: string): string =>\n value\n .replaceAll(\"\\\\\", \"\\\\\\\\\")\n .replaceAll(\"\\n\", \"\\\\n\")\n .replaceAll(\"\\r\", \"\\\\r\")\n .replaceAll(\"\\t\", \"\\\\t\");\n\nconst resolveResourcePath = (directory: string, path: string): string => {\n return isAbsolute(path) ? path : resolve(directory, path);\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn } from \"node:child_process\";\n\ntype JsonObject = Record<string, unknown>;\n\n/**\n * Windows executable artifact kind accepted by code signing options.\n */\nexport type MuonWindowsCodeSigningTarget =\n | \"runtime\"\n | \"launcher\"\n | \"nsisInstaller\"\n | \"nsisUninstaller\";\n\n/**\n * External Windows code signing command options.\n */\nexport interface MuonWindowsCodeSigningOptions {\n /**\n * Executable or script used to sign one file.\n */\n command: string;\n /**\n * Arguments passed to the signing command.\n *\n * @remarks `{path}` is required and is replaced with the executable path.\n * `{target}` and `{kind}` are also replaced when present.\n */\n args: readonly string[];\n /**\n * Artifact kinds to sign.\n *\n * @defaultValue Signs all supported Windows artifact kinds.\n */\n targets?: readonly MuonWindowsCodeSigningTarget[];\n}\n\n/**\n * Resolved Windows code signing command.\n */\nexport interface ResolvedMuonWindowsCodeSigning {\n /** Executable or script used to sign one file. */\n command: string;\n /** Arguments passed to the signing command. */\n args: readonly string[];\n /** Artifact kinds to sign. */\n targets: readonly MuonWindowsCodeSigningTarget[];\n}\n\ninterface WindowsCodeSigningExecution {\n /** Resolved signing command. */\n codeSigning: ResolvedMuonWindowsCodeSigning | undefined;\n /** Artifact kind being signed. */\n kind: MuonWindowsCodeSigningTarget;\n /** Public muon target identifier. */\n target: string;\n /** Executable path being signed. */\n path: string;\n /** Child process working directory. */\n cwd: string;\n /** Child process environment. */\n environment: NodeJS.ProcessEnv;\n}\n\nconst placeholderPath = \"{path}\";\nconst placeholderTarget = \"{target}\";\nconst placeholderKind = \"{kind}\";\n\nconst allWindowsCodeSigningTargets = [\n \"runtime\",\n \"launcher\",\n \"nsisInstaller\",\n \"nsisUninstaller\",\n] as const satisfies readonly MuonWindowsCodeSigningTarget[];\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isStringArray = (value: unknown): value is readonly string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst isWindowsCodeSigningTarget = (\n value: string,\n): value is MuonWindowsCodeSigningTarget =>\n allWindowsCodeSigningTargets.includes(value as MuonWindowsCodeSigningTarget);\n\nconst readWindowsCodeSigningTargets = (\n value: unknown,\n label: string,\n): readonly MuonWindowsCodeSigningTarget[] => {\n if (value === undefined) {\n return allWindowsCodeSigningTargets;\n }\n if (!isStringArray(value)) {\n throw new Error(`${label}.targets must be an array of strings.`);\n }\n if (value.length === 0) {\n throw new Error(`${label}.targets must not be empty.`);\n }\n const targets: MuonWindowsCodeSigningTarget[] = [];\n for (const target of value) {\n if (!isWindowsCodeSigningTarget(target)) {\n throw new Error(`Unsupported ${label}.targets entry: ${target}`);\n }\n if (!targets.includes(target)) {\n targets.push(target);\n }\n }\n return targets;\n};\n\n/**\n * Validates Windows code signing options.\n */\nexport const validateMuonWindowsCodeSigningOptions = (\n value: unknown,\n label: string,\n): MuonWindowsCodeSigningOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`${label} must be an object.`);\n }\n if (typeof value.command !== \"string\" || value.command.trim() === \"\") {\n throw new Error(`${label}.command must be a non-empty string.`);\n }\n if (!isStringArray(value.args)) {\n throw new Error(`${label}.args must be an array of strings.`);\n }\n if (!value.args.some((arg) => arg.includes(placeholderPath))) {\n throw new Error(`${label}.args must contain ${placeholderPath}.`);\n }\n\n return {\n command: value.command.trim(),\n args: value.args,\n targets: readWindowsCodeSigningTargets(value.targets, label),\n };\n};\n\n/**\n * Returns true when a value is valid Windows code signing options.\n */\nexport const isMuonWindowsCodeSigningOptions = (\n value: unknown,\n): value is MuonWindowsCodeSigningOptions => {\n try {\n validateMuonWindowsCodeSigningOptions(value, \"windowsCodeSigning\");\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Resolves Windows code signing options from API options and muon config.\n */\nexport const resolveMuonWindowsCodeSigning = (input: {\n muonConfig: JsonObject;\n options: false | MuonWindowsCodeSigningOptions | undefined;\n}): ResolvedMuonWindowsCodeSigning | undefined => {\n if (input.options === false) {\n return undefined;\n }\n if (input.options !== undefined) {\n return validateMuonWindowsCodeSigningOptions(\n input.options,\n \"windowsCodeSigning\",\n ) as ResolvedMuonWindowsCodeSigning;\n }\n\n const windows = input.muonConfig.windows;\n if (windows === undefined) {\n return undefined;\n }\n if (!isJsonObject(windows)) {\n throw new Error(\"muon.json windows must be an object when present.\");\n }\n const codeSigning = windows.codeSigning;\n if (codeSigning === undefined) {\n return undefined;\n }\n return validateMuonWindowsCodeSigningOptions(\n codeSigning,\n \"muon.json windows.codeSigning\",\n ) as ResolvedMuonWindowsCodeSigning;\n};\n\n/**\n * Removes build-only Windows code signing settings from runtime config.\n */\nexport const stripBuildOnlyWindowsCodeSigningConfig = (\n sourceConfig: JsonObject,\n): JsonObject => {\n const sourceWindows = sourceConfig.windows;\n if (!isJsonObject(sourceWindows)) {\n return sourceConfig;\n }\n\n const windowsConfig: JsonObject = {};\n for (const [key, value] of Object.entries(sourceWindows)) {\n if (key !== \"codeSigning\") {\n windowsConfig[key] = value;\n }\n }\n\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"windows\") {\n output[key] = value;\n }\n }\n if (Object.keys(windowsConfig).length > 0) {\n output.windows = windowsConfig;\n }\n return output;\n};\n\n/**\n * Applies supported placeholders to signing command arguments.\n */\nexport const createWindowsCodeSigningArgs = (input: {\n args: readonly string[];\n kind: MuonWindowsCodeSigningTarget;\n target: string;\n path: string;\n}): string[] =>\n input.args.map((arg) =>\n arg\n .replaceAll(placeholderPath, input.path)\n .replaceAll(placeholderTarget, input.target)\n .replaceAll(placeholderKind, input.kind),\n );\n\n/**\n * Returns true when a resolved signing command includes an artifact kind.\n */\nexport const includesWindowsCodeSigningTarget = (\n codeSigning: ResolvedMuonWindowsCodeSigning | undefined,\n kind: MuonWindowsCodeSigningTarget,\n): codeSigning is ResolvedMuonWindowsCodeSigning =>\n codeSigning !== undefined && codeSigning.targets.includes(kind);\n\n/**\n * Runs the configured Windows code signing command for one executable.\n */\nexport const signWindowsExecutable = async (\n input: WindowsCodeSigningExecution,\n): Promise<void> => {\n if (!includesWindowsCodeSigningTarget(input.codeSigning, input.kind)) {\n return;\n }\n const args = createWindowsCodeSigningArgs({\n args: input.codeSigning.args,\n kind: input.kind,\n target: input.target,\n path: input.path,\n });\n const child = spawn(input.codeSigning.command, args, {\n cwd: input.cwd,\n env: input.environment,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n let stderr = \"\";\n child.stderr.setEncoding(\"utf8\");\n child.stderr.on(\"data\", (chunk: string) => {\n stderr += chunk;\n });\n const exitCode = await new Promise<number>((resolvePromise, reject) => {\n child.once(\"error\", reject);\n child.once(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n if (exitCode !== 0) {\n throw new Error(\n `${input.codeSigning.command} failed while signing ${input.kind} ${input.path} with exit code ${exitCode}: ${stderr.trim()}`,\n );\n }\n};\n","'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport {\n copyFile,\n cp,\n mkdir,\n readFile,\n realpath,\n rm,\n stat,\n} from \"node:fs/promises\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n} from \"node:path\";\n\nimport SemverRange from \"semver/classes/range.js\";\n\ndeclare const __MUON_NODE_SUPPORTED_ENGINE_RANGE__: string;\n\ntype JsonObject = Record<string, unknown>;\n\nconst stagedNodeProjectDirectoryName = \"node-project\";\nconst nodeBridgeFileName = \"node-bridge.mjs\";\nconst supportedNodeRange = __MUON_NODE_SUPPORTED_ENGINE_RANGE__;\n\n/**\n * Node runtime constraint passed from the JavaScript build layer to a native\n * launcher or runtime preparer.\n */\nexport interface MuonNodeRuntimeRequirement {\n /** Whether the application must fail when no matching Node runtime exists. */\n readonly required: boolean;\n /** Whether `package.json` explicitly contains `engines.node`. */\n readonly engineRangeSpecified: boolean;\n /** Original `package.json` `engines.node` text, or `*` when omitted. */\n readonly engineRange: string;\n /**\n * Normalized comparator sets accepted by both the project and muon bridge.\n *\n * @remarks The outer array is an OR expression and each inner array is an\n * AND expression. An empty inner array represents a wildcard set.\n */\n readonly comparatorSets: readonly (readonly string[])[];\n}\n\n/**\n * Node project selected by the `node.project` muon configuration.\n */\nexport interface ResolvedMuonNodeProject {\n /** Absolute source directory copied into a muon runtime. */\n readonly sourcePath: string;\n /** Whether `package.json` explicitly contains `engines.node`. */\n readonly engineRangeSpecified: boolean;\n /** Original `package.json` `engines.node` text, or `*` when omitted. */\n readonly engineRange: string;\n /**\n * Normalized comparator sets accepted by both the project and muon bridge.\n */\n readonly comparatorSets: readonly (readonly string[])[];\n}\n\nconst normalizeComparatorSet = (\n comparators: SemverRange[\"set\"][number],\n): string[] =>\n comparators\n .map((comparator) => comparator.value)\n .filter((comparator) => comparator !== \"\");\n\nconst comparatorSetsIntersect = (\n left: readonly string[],\n right: readonly string[],\n): boolean =>\n new SemverRange(left.join(\" \")).intersects(new SemverRange(right.join(\" \")));\n\nconst intersectNodeEngineRanges = (\n projectRange: SemverRange,\n): readonly (readonly string[])[] => {\n const bridgeRange = new SemverRange(supportedNodeRange);\n const comparatorSets: string[][] = [];\n for (const bridgeComparators of bridgeRange.set) {\n const bridgeSet = normalizeComparatorSet(bridgeComparators);\n for (const projectComparators of projectRange.set) {\n const projectSet = normalizeComparatorSet(projectComparators);\n if (comparatorSetsIntersect(bridgeSet, projectSet)) {\n comparatorSets.push([...bridgeSet, ...projectSet]);\n }\n }\n }\n return comparatorSets;\n};\n\nconst readNodeEngineRequirement = async (\n packageJsonPath: string,\n): Promise<\n Pick<\n ResolvedMuonNodeProject,\n \"engineRangeSpecified\" | \"engineRange\" | \"comparatorSets\"\n >\n> => {\n let source: string;\n try {\n source = await readFile(packageJsonPath, \"utf8\");\n } catch (error) {\n throw new Error(\n `muon Node project package.json could not be read: ${packageJsonPath}: ${getErrorMessage(error)}`,\n );\n }\n\n let packageJson: unknown;\n try {\n packageJson = JSON.parse(source) as unknown;\n } catch (error) {\n throw new Error(\n `muon Node project package.json could not be parsed: ${packageJsonPath}: ${getErrorMessage(error)}`,\n );\n }\n if (!isJsonObject(packageJson)) {\n throw new Error(\n `muon Node project package.json must contain an object: ${packageJsonPath}`,\n );\n }\n\n const enginesValue = packageJson.engines;\n if (enginesValue !== undefined && !isJsonObject(enginesValue)) {\n throw new Error(\"package.json engines must be an object\");\n }\n const nodeValue = enginesValue?.node;\n if (\n nodeValue !== undefined &&\n (typeof nodeValue !== \"string\" || nodeValue.trim().length === 0)\n ) {\n throw new Error(\"package.json engines.node must be a non-empty string\");\n }\n\n const engineRange = nodeValue ?? \"*\";\n let projectRange: SemverRange;\n try {\n projectRange = new SemverRange(engineRange);\n } catch {\n throw new Error(\n `package.json engines.node is not a valid range: ${engineRange}`,\n );\n }\n const comparatorSets = intersectNodeEngineRanges(projectRange);\n if (comparatorSets.length === 0) {\n throw new Error(\n \"package.json engines.node does not overlap the muon Node bridge range\",\n );\n }\n return {\n engineRangeSpecified: nodeValue !== undefined,\n engineRange,\n comparatorSets,\n };\n};\n\n/**\n * Creates the native runtime constraint for a resolved Node project.\n *\n * @param project Resolved Node project, or `undefined` when Node is disabled.\n * @param required Whether absence of a matching runtime is fatal.\n * @returns The launcher/runtime requirement, or `undefined` for a non-Node app.\n */\nexport const createMuonNodeRuntimeRequirement = (\n project: ResolvedMuonNodeProject | undefined,\n required: boolean,\n): MuonNodeRuntimeRequirement | undefined =>\n project === undefined\n ? undefined\n : {\n required,\n engineRangeSpecified: project.engineRangeSpecified,\n engineRange: project.engineRange,\n comparatorSets: project.comparatorSets,\n };\n\n/**\n * Resolves and validates an optional Node project from muon configuration.\n *\n * @param config Parsed muon configuration object.\n * @param configDirectory Directory used to resolve a relative `node.project`.\n * @returns The resolved project, or `undefined` when Node hosting is not enabled.\n */\nexport const resolveMuonNodeProject = async (\n config: Readonly<JsonObject> | undefined,\n configDirectory: string,\n): Promise<ResolvedMuonNodeProject | undefined> => {\n const node = config?.node;\n if (node === undefined) {\n return undefined;\n }\n if (!isJsonObject(node)) {\n throw new Error(\"muon.json node must be an object\");\n }\n\n const project = node.project;\n if (project === undefined) {\n throw new Error(\"muon.json node.project is required when node is present\");\n }\n if (typeof project !== \"string\") {\n throw new Error(\"muon.json node.project must be a string\");\n }\n if (project.trim().length === 0) {\n throw new Error(\"muon.json node.project must not be empty\");\n }\n\n const configuredSourcePath = resolve(configDirectory, project);\n if (!(await isDirectory(configuredSourcePath))) {\n throw new Error(\n `muon Node project directory does not exist: ${configuredSourcePath}`,\n );\n }\n const sourcePath = await realpath(configuredSourcePath);\n const packageJsonPath = join(sourcePath, \"package.json\");\n if (!(await isFile(packageJsonPath))) {\n throw new Error(\n `muon Node project package.json does not exist: ${packageJsonPath}`,\n );\n }\n\n return {\n sourcePath,\n ...(await readNodeEngineRequirement(packageJsonPath)),\n };\n};\n\n/**\n * Rewrites a resolved Node project to its packaged runtime location.\n *\n * @param config Source muon configuration.\n * @param project Resolved Node project, when enabled.\n * @returns Configuration suitable for embedding in a built distribution.\n */\nexport const createPackagedMuonNodeConfig = (\n config: Readonly<JsonObject>,\n project: ResolvedMuonNodeProject | undefined,\n): JsonObject => {\n if (project === undefined) {\n return { ...config };\n }\n\n const node = config.node;\n if (!isJsonObject(node)) {\n throw new Error(\"muon.json node must be an object\");\n }\n return {\n ...config,\n node: {\n ...node,\n project: `./${stagedNodeProjectDirectoryName}`,\n },\n };\n};\n\n/**\n * Verifies that staging cannot remove or recursively copy the Node source.\n *\n * @param project Resolved Node project, when enabled.\n * @param runtimeDirectory Runtime directory replaced or used for staging.\n * @returns A promise that resolves when the paths are disjoint.\n */\nexport const assertMuonNodeProjectStagingIsSafe = (\n project: ResolvedMuonNodeProject | undefined,\n runtimeDirectory: string,\n): Promise<void> =>\n assertMuonNodeProjectPathIsDisjoint(\n project,\n runtimeDirectory,\n \"runtime directory\",\n );\n\n/**\n * Verifies that a Node project cannot be exposed through the app asset source.\n *\n * @param project Resolved Node project, when enabled.\n * @param assetSourcePath Directory or ZIP path used as application assets.\n * @returns A promise that resolves when the paths are disjoint.\n */\nexport const assertMuonNodeProjectAssetSourceIsSafe = (\n project: ResolvedMuonNodeProject | undefined,\n assetSourcePath: string,\n): Promise<void> =>\n assertMuonNodeProjectPathIsDisjoint(project, assetSourcePath, \"asset source\");\n\n/**\n * Verifies that a Vite build cannot delete or expose a Node project.\n *\n * @param project Resolved Node project, when enabled.\n * @param outputDirectory Vite output directory emptied before a build.\n * @param publicDirectory Vite public directory copied into build output, or an\n * empty string when public files are disabled.\n * @returns A promise that resolves when the Node project is disjoint from both\n * Vite paths.\n */\nexport const assertMuonNodeProjectViteBuildIsSafe = async (\n project: ResolvedMuonNodeProject | undefined,\n outputDirectory: string,\n publicDirectory: string,\n): Promise<void> => {\n await assertMuonNodeProjectPathIsDisjoint(\n project,\n outputDirectory,\n \"Vite output directory\",\n );\n await assertMuonNodeProjectVitePublicDirectoryIsSafe(\n project,\n publicDirectory,\n );\n};\n\n/**\n * Verifies that Vite cannot expose a Node project through its public directory.\n *\n * @param project Resolved Node project, when enabled.\n * @param publicDirectory Vite public directory copied into served or built\n * assets, or an empty string when public files are disabled.\n * @returns A promise that resolves when the Node project and public directory\n * are disjoint.\n */\nexport const assertMuonNodeProjectVitePublicDirectoryIsSafe = async (\n project: ResolvedMuonNodeProject | undefined,\n publicDirectory: string,\n): Promise<void> => {\n if (publicDirectory !== \"\") {\n await assertMuonNodeProjectPathIsDisjoint(\n project,\n publicDirectory,\n \"Vite public directory\",\n );\n }\n};\n\n/**\n * Verifies that pack cleanup cannot remove a configured Node project.\n *\n * @param project Resolved Node project, when enabled.\n * @param cleanupDirectory Directory recursively removed by muon pack.\n * @returns A promise that resolves when the paths are disjoint.\n */\nexport const assertMuonNodeProjectPackCleanupIsSafe = (\n project: ResolvedMuonNodeProject | undefined,\n cleanupDirectory: string,\n): Promise<void> =>\n assertMuonNodeProjectPathIsDisjoint(\n project,\n cleanupDirectory,\n \"pack cleanup directory\",\n );\n\n/**\n * Stages a resolved Node project beside a muon runtime executable.\n *\n * @param project Resolved Node project, or `undefined` to remove stale staging.\n * @param runtimeDirectory Runtime directory that receives `node-project/`.\n * @returns Absolute staged project path, or `undefined` when Node is disabled.\n *\n * @remarks Symbolic links are dereferenced so portable ZIP and tar packaging\n * retains linked dependencies as ordinary files and directories.\n */\nexport const stageMuonNodeProject = async (\n project: ResolvedMuonNodeProject | undefined,\n runtimeDirectory: string,\n): Promise<string | undefined> => {\n const destinationPath = resolve(\n runtimeDirectory,\n stagedNodeProjectDirectoryName,\n );\n if (project === undefined) {\n await rm(destinationPath, { recursive: true, force: true });\n return undefined;\n }\n\n await assertMuonNodeProjectStagingIsSafe(project, runtimeDirectory);\n await mkdir(runtimeDirectory, { recursive: true });\n await assertMuonNodeProjectStagingIsSafe(project, runtimeDirectory);\n await rm(destinationPath, { recursive: true, force: true });\n await cp(project.sourcePath, destinationPath, {\n dereference: true,\n preserveTimestamps: true,\n recursive: true,\n });\n return destinationPath;\n};\n\n/**\n * Copies the native Node host plugin and JavaScript bridge into a build output.\n *\n * @param sourceRuntimeDirectory Packaged runtime source for one target.\n * @param outputRuntimeDirectory App distribution runtime directory.\n * @param platform Target operating system.\n */\nexport const stageMuonNodeHostArtifacts = async (\n sourceRuntimeDirectory: string,\n outputRuntimeDirectory: string,\n platform: \"linux\" | \"windows\",\n): Promise<void> => {\n const pluginFileName = platform === \"windows\" ? \"node.dll\" : \"node.so\";\n const sourcePluginDirectory = join(sourceRuntimeDirectory, \"plugins\");\n const outputPluginDirectory = join(outputRuntimeDirectory, \"plugins\");\n const sourcePluginPath = join(sourcePluginDirectory, pluginFileName);\n const sourceBridgePath = join(sourcePluginDirectory, nodeBridgeFileName);\n\n await assertFile(sourcePluginPath, `muon Node plugin for ${platform}`);\n await assertFile(sourceBridgePath, \"muon Node bridge\");\n await mkdir(outputPluginDirectory, { recursive: true });\n await copyFile(sourcePluginPath, join(outputPluginDirectory, pluginFileName));\n await copyFile(\n sourceBridgePath,\n join(outputPluginDirectory, nodeBridgeFileName),\n );\n};\n\n/**\n * Validates that a prepared development runtime contains the Node host files.\n *\n * @param runtimeDirectory Prepared runtime directory.\n * @param platform Runtime operating system.\n */\nexport const assertMuonNodeHostArtifacts = async (\n runtimeDirectory: string,\n platform: NodeJS.Platform,\n): Promise<void> => {\n const pluginFileName = platform === \"win32\" ? \"node.dll\" : \"node.so\";\n const pluginDirectory = join(runtimeDirectory, \"plugins\");\n await assertFile(join(pluginDirectory, pluginFileName), \"muon Node plugin\");\n await assertFile(\n join(pluginDirectory, nodeBridgeFileName),\n \"muon Node bridge\",\n );\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isSameOrInsidePath = (parentPath: string, path: string): boolean => {\n const relativePath = relative(parentPath, path);\n return (\n relativePath === \"\" ||\n (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath))\n );\n};\n\nconst isMissingPathError = (error: unknown): boolean => {\n const code = (error as NodeJS.ErrnoException).code;\n return code === \"ENOENT\" || code === \"ENOTDIR\";\n};\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\n// Output paths often do not exist yet. Resolve their closest existing\n// ancestor so symlink aliases cannot bypass overlap checks, then append the\n// still-missing path segments without touching the filesystem.\nconst resolveCanonicalPotentialPath = async (path: string): Promise<string> => {\n let ancestorPath = resolve(path);\n const missingSegments: string[] = [];\n\n for (;;) {\n try {\n const canonicalAncestorPath = await realpath(ancestorPath);\n return resolve(canonicalAncestorPath, ...missingSegments.reverse());\n } catch (error) {\n if (!isMissingPathError(error)) {\n throw error;\n }\n const parentPath = dirname(ancestorPath);\n if (parentPath === ancestorPath) {\n throw error;\n }\n missingSegments.push(basename(ancestorPath));\n ancestorPath = parentPath;\n }\n }\n};\n\nconst assertMuonNodeProjectPathIsDisjoint = async (\n project: ResolvedMuonNodeProject | undefined,\n comparedPath: string,\n comparedPathLabel: string,\n): Promise<void> => {\n if (project === undefined) {\n return;\n }\n const [sourcePath, canonicalComparedPath] = await Promise.all([\n resolveCanonicalPotentialPath(project.sourcePath),\n resolveCanonicalPotentialPath(comparedPath),\n ]);\n if (\n isSameOrInsidePath(sourcePath, canonicalComparedPath) ||\n isSameOrInsidePath(canonicalComparedPath, sourcePath)\n ) {\n throw new Error(\n `muon Node project and ${comparedPathLabel} must not overlap: ${sourcePath}, ${canonicalComparedPath}`,\n );\n }\n};\n\nconst isDirectory = async (path: string): Promise<boolean> => {\n try {\n return (await stat(path)).isDirectory();\n } catch {\n return false;\n }\n};\n\nconst isFile = async (path: string): Promise<boolean> => {\n try {\n return (await stat(path)).isFile();\n } catch {\n return false;\n }\n};\n\nconst assertFile = async (path: string, label: string): Promise<void> => {\n if (!(await isFile(path))) {\n throw new Error(`${label} file does not exist: ${path}`);\n }\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants, type Stats } from \"node:fs\";\nimport {\n access,\n chmod,\n copyFile,\n mkdir,\n mkdtemp,\n readFile,\n readdir,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { createHash, randomBytes } from \"node:crypto\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport { tmpdir } from \"node:os\";\nimport { fileURLToPath } from \"node:url\";\nimport AdmZip from \"adm-zip\";\nimport { parse } from \"json5\";\nimport {\n embedMuonConfigInLauncherFile,\n embedMuonConfigInRuntime,\n} from \"./embed-config.js\";\nimport { getDefaultMuonPrepareTarget } from \"./prepare.js\";\nimport {\n allMuonTargets,\n getMuonTargetDescriptor,\n getMuonTargetRuntimeAppId,\n normalizeMuonTarget,\n type MuonTarget,\n type MuonTargetDescriptor,\n} from \"./targets.js\";\nimport {\n resolveMuonWindowsResource,\n stripBuildOnlyWindowsResourceConfig,\n updateWindowsPeIconResource,\n updateWindowsPeResources,\n type MuonWindowsResourceOptions,\n type ResolvedMuonWindowsResource,\n} from \"./windows-resource.js\";\nimport {\n resolveMuonLinuxDesktop,\n stripBuildOnlyLinuxDesktopConfig,\n writeLinuxDesktopDistributionFiles,\n type MuonLinuxDesktopOptions,\n type ResolvedMuonLinuxDesktop,\n} from \"./linux-desktop.js\";\nimport {\n resolveMuonWindowsCodeSigning,\n signWindowsExecutable,\n stripBuildOnlyWindowsCodeSigningConfig,\n type MuonWindowsCodeSigningOptions,\n type ResolvedMuonWindowsCodeSigning,\n} from \"./windows-code-signing.js\";\nimport { appIconAssetEntryName, appIconAssetUrl } from \"./app-icon.js\";\nimport type { MuonRuntimePluginConfig } from \"./capability.js\";\nimport type { MuonProgressCallback } from \"./progress.js\";\nimport {\n assertMuonNodeProjectAssetSourceIsSafe,\n assertMuonNodeProjectStagingIsSafe,\n createPackagedMuonNodeConfig,\n createMuonNodeRuntimeRequirement,\n resolveMuonNodeProject,\n stageMuonNodeHostArtifacts,\n stageMuonNodeProject,\n type MuonNodeRuntimeRequirement,\n type ResolvedMuonNodeProject,\n} from \"./node-project.js\";\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst appConfigSourcePath = \"./assets.zip\";\nconst defaultAppName = \"muon-app\";\nconst defaultAppId = \"muon-app\";\nconst muonLicenseFileName = \"CREDITS.md\";\nconst directoryMode = 0o755;\nconst executableMode = 0o755;\nconst assetSaltByteLength = 16;\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\ntype JsonObject = Record<string, unknown>;\n\ntype AssetInput = {\n sourcePath: string;\n prefix: string;\n};\n\ntype BuildConfig = {\n config: JsonObject;\n directory: string;\n};\n\ninterface InternalMuonBuildOptions extends MuonBuildOptions {\n browserProfilePathOverride: string | undefined;\n environment?: NodeJS.ProcessEnv;\n progress?: MuonProgressCallback;\n}\n\ntype ZipEntry = {\n name: string;\n data: Buffer;\n};\n\ntype DistributionFile = {\n sourcePath: string;\n fileName: string;\n};\n\n/**\n * Public muon runtime target used by CLI, Vite options, and package layout.\n */\nexport type MuonBuildTarget = MuonTarget;\n\n/**\n * Options for creating redistributable muon app directories.\n */\nexport interface MuonBuildOptions {\n /**\n * Project root containing package.json, muon.json, and app assets.\n */\n root?: string;\n /**\n * Directory containing package runtime/ and native/ folders.\n *\n * @remarks This defaults to the installed muon package dist directory.\n */\n packageDirectory?: string;\n /**\n * Public target identifiers to build.\n */\n targets?: readonly string[];\n /**\n * Build every supported target from the installed package.\n *\n * @remarks Defaults to true when targets is omitted. Set false to build only\n * the host target.\n */\n allTargets?: boolean;\n /**\n * File name used for the app launcher.\n *\n * @remarks The .exe suffix is added automatically for Windows targets.\n */\n appName?: string;\n /**\n * Stable base application identifier used for runtime app identity.\n *\n * @remarks Windows target distributions embed `<appId>.<arch>` as their\n * runtime app identifier. Linux targets embed this value unchanged.\n */\n appId?: string;\n /**\n * Parent directory that receives dist-muon/linux-amd64/ style outputs.\n */\n outputRoot?: string;\n /**\n * Directory or ZIP file used as app assets.\n */\n assetSourcePath?: string;\n /**\n * Optional ZIP entry prefix used for the asset source.\n */\n assetPrefix?: string;\n /**\n * Default browser start page embedded when muon config omits one.\n */\n browserStartPage?: string;\n /**\n * muon config path to embed.\n */\n configPath?: string;\n /**\n * Static application icon PNG file path.\n *\n * @remarks This icon is used as the shared source for Windows PE/NSIS,\n * Linux desktop entries, and the generated initial title bar icon asset.\n * Platform-specific icon paths override it for their target.\n */\n iconPath?: string;\n /**\n * Additional project files copied next to the generated app launcher.\n *\n * @remarks When omitted, `package.json` `files` is used as a candidate list.\n * Only regular files are copied. Asset input paths, `node_modules`, `.git`,\n * and generated target output directories are excluded.\n */\n distributionFiles?: readonly string[];\n /**\n * Windows PE and NSIS resource metadata.\n *\n * @defaultValue Uses `muon.json` `windows.resource`, `project.json`,\n * `package.json`, then muon defaults.\n */\n windowsResource?: MuonWindowsResourceOptions;\n /**\n * Windows code signing command for generated executable artifacts.\n *\n * @remarks Set false to disable `muon.json` `windows.codeSigning`.\n * The command is supplied by the application project or CI environment.\n */\n windowsCodeSigning?: false | MuonWindowsCodeSigningOptions;\n /**\n * Linux desktop entry metadata.\n *\n * @defaultValue Uses `muon.json` `linux.desktop`, package metadata, then\n * muon defaults.\n */\n linuxDesktop?: MuonLinuxDesktopOptions;\n /**\n * Asset salt override for deterministic tests.\n *\n * @remarks Production builds should omit this option.\n */\n assetSalt?: Uint8Array;\n /**\n * Runtime plugin configuration supplied by a bundler integration.\n *\n * @internal\n */\n runtimePluginConfig?: MuonRuntimePluginConfig;\n /**\n * Include a privileged Linux runtime helper in generated distributions.\n *\n * @internal\n */\n includeRuntimeHelper?: boolean;\n}\n\n/**\n * Asset metadata generated for a target distribution.\n */\nexport interface MuonBuildAssetResult {\n /**\n * Path of the generated assets.zip.\n */\n path: string;\n /**\n * 64-character lowercase hexadecimal SHA-256 digest of the generated asset\n * archive bytes followed by the decoded salt bytes.\n */\n signature: string;\n /**\n * Hex-encoded salt embedded into muon.json.\n */\n salt: string;\n /**\n * Number of files written to the ZIP archive.\n */\n entryCount: number;\n}\n\n/**\n * Result for one generated target distribution.\n */\nexport interface MuonBuildTargetResult {\n /**\n * Public target identifier used by the muon npm package.\n */\n target: MuonBuildTarget;\n /**\n * Fixed output directory path for the target.\n */\n distributionDirectoryName: string;\n /**\n * Absolute path of the generated target directory.\n */\n outputPath: string;\n /**\n * Absolute path of the app launcher copied from muon-launcher.\n */\n launcherPath: string;\n /**\n * Absolute path of the privileged runtime helper when included.\n */\n runtimeHelperPath?: string;\n /**\n * Generated asset archive metadata.\n */\n asset: MuonBuildAssetResult;\n /**\n * Application identifier embedded into this target distribution.\n *\n * @remarks Windows targets append the target architecture to the base\n * `appId`; Linux targets use the base `appId` unchanged.\n */\n runtimeAppId: string;\n /**\n * Config object embedded into muon-core.\n *\n * @remarks Launcher-only generated settings are intentionally excluded.\n */\n embeddedConfig: JsonObject;\n /**\n * Linux desktop integration metadata when the target is Linux.\n */\n linuxDesktop?: ResolvedMuonLinuxDesktop;\n}\n\n/**\n * Result of a muon app build.\n */\nexport interface MuonBuildResult {\n /**\n * Absolute project root used for the build.\n */\n root: string;\n /**\n * Sanitized app launcher base name.\n */\n appName: string;\n /**\n * Stable base application identifier used to derive target runtime identity.\n *\n * @remarks See each target's `runtimeAppId` for the identifier embedded into\n * that target distribution.\n */\n appId: string;\n /**\n * Generated target distributions.\n */\n targets: MuonBuildTargetResult[];\n}\n\n/**\n * Returns the host target used by muon build when no explicit target is passed.\n */\nexport const getDefaultMuonBuildTarget = (): MuonBuildTarget => {\n return getDefaultMuonPrepareTarget(process.platform, process.arch);\n};\n\n/**\n * Normalizes a user-facing public target identifier.\n */\nexport const normalizeMuonBuildTarget = (target: string): MuonBuildTarget => {\n return normalizeMuonTarget(target, \"muon build target\");\n};\n\n/**\n * Builds CEF-free muon app distribution directories for one or more targets.\n */\nexport const buildMuonApp = async (\n options: MuonBuildOptions = {},\n): Promise<MuonBuildResult> => {\n const internalOptions = options as InternalMuonBuildOptions;\n const browserProfilePathOverride = internalOptions.browserProfilePathOverride;\n const environment = internalOptions.environment ?? process.env;\n const progress = internalOptions.progress;\n const root = resolve(options.root ?? process.cwd());\n const packageDirectory = resolvePackageDirectory(options.packageDirectory);\n const targets = resolveBuildTargets(options);\n const outputRoot = resolve(root, options.outputRoot ?? \".\");\n const packageJson = await readPackageJson(root);\n const appName = resolveAppName(packageJson, options.appName);\n const appId = resolveAppId(packageJson, options.appId);\n const buildConfig = await readBuildConfig(root, options.configPath);\n const nodeProject = await resolveMuonNodeProject(\n buildConfig.config,\n buildConfig.directory,\n );\n const runtimePluginConfig = options.runtimePluginConfig ?? {\n mode: \"simple\",\n };\n const nodeRuntimeRequirement = createMuonNodeRuntimeRequirement(\n nodeProject,\n true,\n );\n for (const target of targets) {\n await assertMuonNodeProjectStagingIsSafe(\n nodeProject,\n join(\n outputRoot,\n getMuonTargetDescriptor(target).distributionDirectoryName,\n ),\n );\n }\n const sourceConfig = createPackagedMuonNodeConfig(\n applyRuntimePluginConfig(buildConfig.config, runtimePluginConfig),\n nodeProject,\n );\n assertNoUserInitialTitleBarIcon(sourceConfig);\n assertNoUserNodeRuntime(sourceConfig);\n const resolvedBuildConfig: BuildConfig = {\n ...buildConfig,\n config: sourceConfig,\n };\n const assetInput = resolveAssetInput(\n root,\n options.assetSourcePath,\n options.assetPrefix,\n resolvedBuildConfig,\n );\n await assertMuonNodeProjectAssetSourceIsSafe(\n nodeProject,\n assetInput.sourcePath,\n );\n const windowsResource = await resolveMuonWindowsResource({\n root,\n packageDirectory,\n packageJson,\n muonConfig: sourceConfig,\n muonConfigDirectory: buildConfig.directory,\n options: options.windowsResource,\n appIconPath: options.iconPath,\n defaults: {\n productName: appName,\n fileDescription: appName,\n companyName: \"Unknown\",\n version: \"0.0.0\",\n copyright: undefined,\n },\n });\n const windowsCodeSigning = resolveMuonWindowsCodeSigning({\n muonConfig: sourceConfig,\n options: options.windowsCodeSigning,\n });\n const linuxDesktop = await resolveMuonLinuxDesktop({\n root,\n packageDirectory,\n muonConfig: sourceConfig,\n muonConfigDirectory: buildConfig.directory,\n options: options.linuxDesktop,\n appIconPath: options.iconPath,\n defaults: {\n desktopId: appId,\n name: resolveLinuxDesktopDefaultName(packageJson, appName),\n comment: resolvePackageDescription(packageJson),\n categories: [\"Utility\"],\n startupNotify: true,\n },\n });\n const salt = Buffer.from(\n options.assetSalt ?? randomBytes(assetSaltByteLength),\n );\n const distributionFiles = await resolveDistributionFiles({\n root,\n packageJson,\n configuredFiles: options.distributionFiles,\n assetSourcePath: assetInput.sourcePath,\n outputPaths: targets.map((target) =>\n join(\n outputRoot,\n getMuonTargetDescriptor(target).distributionDirectoryName,\n ),\n ),\n });\n\n const results: MuonBuildTargetResult[] = [];\n\n for (let index = 0; index < targets.length; index += 1) {\n const target = targets[index] as MuonBuildTarget;\n progress?.({\n phase: \"build\",\n status: `Building muon target ${target} (${index + 1}/${targets.length})`,\n });\n const result = await buildMuonTarget({\n packageDirectory,\n root,\n outputRoot,\n appName,\n appId,\n target,\n assetInput,\n sourceConfig,\n windowsResource,\n windowsCodeSigning,\n linuxDesktop,\n distributionFiles,\n nodeProject,\n nodeRuntimeRequirement,\n salt,\n environment,\n browserStartPage: options.browserStartPage,\n browserProfilePathOverride,\n includeRuntimeHelper: options.includeRuntimeHelper === true,\n progress,\n });\n results.push(result);\n progress?.({\n phase: \"build\",\n status: `Built ${result.outputPath}`,\n });\n }\n\n return {\n root,\n appName,\n appId,\n targets: results,\n };\n};\n\nconst resolvePackageDirectory = (\n packageDirectory: string | undefined,\n): string => {\n if (packageDirectory !== undefined) {\n return resolve(packageDirectory);\n }\n\n return moduleDirectory;\n};\n\nconst resolveBuildTargets = (options: MuonBuildOptions): MuonBuildTarget[] => {\n if (options.allTargets === true) {\n return [...allMuonTargets];\n }\n\n if (options.targets !== undefined && options.targets.length > 0) {\n return [\n ...new Set(\n options.targets.map((target) => normalizeMuonBuildTarget(target)),\n ),\n ];\n }\n\n if (options.allTargets !== false) {\n return [...allMuonTargets];\n }\n\n return [getDefaultMuonBuildTarget()];\n};\n\nconst resolveAssetInput = (\n root: string,\n assetSourcePath: string | undefined,\n assetPrefix: string | undefined,\n buildConfig: BuildConfig,\n): AssetInput => {\n const configuredAssetSourcePath =\n assetSourcePath === undefined\n ? readConfigAssetSourcePath(buildConfig.config)\n : undefined;\n const sourcePath =\n assetSourcePath !== undefined\n ? resolve(root, assetSourcePath)\n : configuredAssetSourcePath !== undefined\n ? resolve(buildConfig.directory, configuredAssetSourcePath)\n : resolve(root, \"assets\");\n return {\n sourcePath,\n prefix: normalizeZipPrefix(assetPrefix ?? \"\"),\n };\n};\n\nconst readStringArray = (value: unknown, label: string): readonly string[] => {\n if (\n Array.isArray(value) &&\n value.every((entry) => typeof entry === \"string\")\n ) {\n return value;\n }\n throw new Error(`${label} must be an array of strings.`);\n};\n\nconst readDistributionFileCandidates = (\n packageJson: JsonObject,\n configuredFiles: readonly string[] | undefined,\n): readonly string[] => {\n if (configuredFiles !== undefined) {\n return readStringArray(configuredFiles, \"muon distributionFiles\");\n }\n if (packageJson.files === undefined) {\n return [];\n }\n return readStringArray(packageJson.files, \"package.json files\");\n};\n\nconst isSameOrInsidePath = (parentPath: string, path: string): boolean => {\n const relativePath = relative(parentPath, path);\n return (\n relativePath === \"\" ||\n (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath))\n );\n};\n\nconst isExcludedDistributionFilePath = (\n path: string,\n excludedPaths: readonly string[],\n): boolean =>\n excludedPaths.some((excludedPath) => isSameOrInsidePath(excludedPath, path));\n\nconst resolveDistributionFiles = async (input: {\n root: string;\n packageJson: JsonObject;\n configuredFiles: readonly string[] | undefined;\n assetSourcePath: string;\n outputPaths: readonly string[];\n}): Promise<DistributionFile[]> => {\n const candidates = readDistributionFileCandidates(\n input.packageJson,\n input.configuredFiles,\n );\n const excludedPaths = [\n resolve(input.root, \"node_modules\"),\n resolve(input.root, \".git\"),\n input.assetSourcePath,\n ...input.outputPaths,\n ];\n const destinationNames = new Set<string>();\n const files: DistributionFile[] = [];\n\n for (const candidate of candidates) {\n if (candidate.trim() === \"\") {\n throw new Error(\"muon distribution file path must not be empty.\");\n }\n if (isAbsolute(candidate)) {\n throw new Error(\n `muon distribution file path must be relative: ${candidate}`,\n );\n }\n\n const sourcePath = resolve(input.root, candidate);\n if (!isSameOrInsidePath(input.root, sourcePath)) {\n throw new Error(\n `muon distribution file path must stay inside the project root: ${candidate}`,\n );\n }\n if (isExcludedDistributionFilePath(sourcePath, excludedPaths)) {\n continue;\n }\n\n const stats = await statOrUndefined(sourcePath);\n if (stats === undefined) {\n throw new Error(`muon distribution file does not exist: ${candidate}`);\n }\n if (!stats.isFile()) {\n throw new Error(\n `muon distribution file must be a regular file: ${candidate}`,\n );\n }\n\n const fileName = basename(sourcePath);\n if (destinationNames.has(fileName)) {\n throw new Error(\n `Duplicate muon distribution file destination: ${fileName}`,\n );\n }\n destinationNames.add(fileName);\n files.push({ sourcePath, fileName });\n }\n\n return files;\n};\n\nconst normalizeZipPrefix = (prefix: string): string => {\n const normalized = prefix\n .replaceAll(\"\\\\\", \"/\")\n .split(\"/\")\n .filter((part) => part.length > 0)\n .join(\"/\");\n\n return normalized.length > 0 ? `${normalized}/` : \"\";\n};\n\nconst readPackageJson = async (root: string): Promise<JsonObject> => {\n const packageJsonPath = join(root, \"package.json\");\n if (!(await fileExists(packageJsonPath))) {\n return {};\n }\n return await readJsonObjectFile(packageJsonPath, \"package.json\");\n};\n\nconst resolvePackageName = (packageJson: JsonObject): string => {\n return typeof packageJson.name === \"string\"\n ? packageJson.name\n : defaultAppName;\n};\n\nconst resolveAppName = (\n packageJson: JsonObject,\n appName: string | undefined,\n): string => {\n if (appName !== undefined) {\n return sanitizeAppName(appName);\n }\n\n const packageName = resolvePackageName(packageJson);\n const unscopedName = packageName.startsWith(\"@\")\n ? packageName.slice(packageName.indexOf(\"/\") + 1)\n : packageName;\n\n return sanitizeAppName(unscopedName);\n};\n\nconst sanitizeAppName = (name: string): string => {\n const sanitized = name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^[.-]+/g, \"\")\n .replace(/[.-]+$/g, \"\");\n\n return sanitized.length > 0 ? sanitized : defaultAppName;\n};\n\nconst resolveAppId = (\n packageJson: JsonObject,\n appId: string | undefined,\n): string => {\n if (appId !== undefined) {\n return sanitizeAppId(appId);\n }\n return sanitizeAppId(resolvePackageName(packageJson));\n};\n\nconst sanitizeAppId = (value: string): string => {\n const unscoped = value.startsWith(\"@\") ? value.slice(1) : value;\n const sanitized = unscoped\n .trim()\n .toLowerCase()\n .replace(\"/\", \".\")\n .replace(/[^a-z0-9._-]+/g, \".\")\n .replace(/^[.]+/g, \"\")\n .replace(/[.]+$/g, \"\");\n return sanitized.length > 0 ? sanitized : defaultAppId;\n};\n\nconst resolveLinuxDesktopDefaultName = (\n packageJson: JsonObject,\n appName: string,\n): string =>\n typeof packageJson.name === \"string\" && packageJson.name.trim() !== \"\"\n ? packageJson.name.trim()\n : appName;\n\nconst resolvePackageDescription = (packageJson: JsonObject): string =>\n typeof packageJson.description === \"string\"\n ? packageJson.description.trim()\n : \"\";\n\nconst readBuildConfig = async (\n root: string,\n configPath: string | undefined,\n): Promise<BuildConfig> => {\n const resolvedConfigPath = await resolveConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n config: {},\n directory: root,\n };\n }\n\n return {\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n directory: dirname(resolvedConfigPath),\n };\n};\n\n/**\n * Resolves the Node project selected by a build-oriented muon configuration.\n *\n * @param root Project root used to locate a default or relative config path.\n * @param configPath Explicit muon config path, or `undefined` to use the\n * default config lookup.\n * @returns The resolved Node project, or `undefined` when Node hosting is not\n * enabled.\n */\nexport const resolveMuonNodeProjectForBuildConfig = async (\n root: string,\n configPath: string | undefined,\n): Promise<ResolvedMuonNodeProject | undefined> => {\n const buildConfig = await readBuildConfig(root, configPath);\n return await resolveMuonNodeProject(\n buildConfig.config,\n buildConfig.directory,\n );\n};\n\nconst applyRuntimePluginConfig = (\n sourceConfig: JsonObject,\n runtimePluginConfig: MuonRuntimePluginConfig | undefined,\n): JsonObject => {\n if (runtimePluginConfig === undefined) {\n return sourceConfig;\n }\n\n const sourcePlugin = sourceConfig.plugin;\n if (sourcePlugin !== undefined && !isJsonObject(sourcePlugin)) {\n throw new Error(\n \"muon.json plugin must be an object when runtime plugin config is applied.\",\n );\n }\n const plugin: JsonObject = sourcePlugin ?? {};\n\n return {\n ...sourceConfig,\n plugin: {\n ...plugin,\n ...runtimePluginConfig,\n },\n };\n};\n\nconst readConfigAssetSourcePath = (\n sourceConfig: JsonObject,\n): string | undefined => {\n const sourceAsset = sourceConfig.asset;\n if (sourceAsset === undefined) {\n return undefined;\n }\n if (!isJsonObject(sourceAsset)) {\n throw new Error(\"muon.json asset must be an object when present.\");\n }\n\n const sourceAssetPath = sourceAsset.sourcePath;\n if (sourceAssetPath === undefined) {\n return undefined;\n }\n if (typeof sourceAssetPath !== \"string\") {\n throw new Error(\n \"muon.json asset.sourcePath must be a string when present.\",\n );\n }\n\n return sourceAssetPath;\n};\n\nconst resolveConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n\n return undefined;\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n let content: string;\n try {\n content = await readFile(filePath, \"utf8\");\n } catch (error) {\n throw new Error(\n `${label} could not be read: ${filePath}: ${getErrorMessage(error)}`,\n );\n }\n\n let parsed: unknown;\n try {\n parsed = parse(content);\n } catch (error) {\n throw new Error(\n `${label} could not be parsed: ${filePath}: ${getErrorMessage(error)}`,\n );\n }\n\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n\n return parsed;\n};\n\nconst buildMuonTarget = async (input: {\n packageDirectory: string;\n root: string;\n outputRoot: string;\n appName: string;\n appId: string;\n target: MuonBuildTarget;\n assetInput: AssetInput;\n sourceConfig: JsonObject;\n windowsResource: ResolvedMuonWindowsResource;\n windowsCodeSigning: ResolvedMuonWindowsCodeSigning | undefined;\n linuxDesktop: ResolvedMuonLinuxDesktop;\n distributionFiles: readonly DistributionFile[];\n nodeProject: ResolvedMuonNodeProject | undefined;\n nodeRuntimeRequirement: MuonNodeRuntimeRequirement | undefined;\n salt: Buffer;\n environment: NodeJS.ProcessEnv;\n browserStartPage: string | undefined;\n browserProfilePathOverride: string | undefined;\n includeRuntimeHelper: boolean;\n progress: MuonProgressCallback | undefined;\n}): Promise<MuonBuildTargetResult> => {\n const descriptor = getMuonTargetDescriptor(input.target);\n const sourceRuntimePath = join(\n input.packageDirectory,\n \"runtime\",\n input.target,\n );\n const sourceLauncherPath = join(\n input.packageDirectory,\n \"native\",\n input.target,\n descriptor.launcherExecutableName,\n );\n const sourceRuntimeHelperPath =\n input.includeRuntimeHelper &&\n descriptor.runtimeHelperExecutableName !== undefined\n ? join(\n input.packageDirectory,\n \"native\",\n input.target,\n descriptor.runtimeHelperExecutableName,\n )\n : undefined;\n const outputPath = join(\n input.outputRoot,\n descriptor.distributionDirectoryName,\n );\n const launcherPath = join(\n outputPath,\n getLauncherFileName(input.appName, descriptor),\n );\n const runtimeHelperPath =\n sourceRuntimeHelperPath === undefined ||\n descriptor.runtimeHelperExecutableName === undefined\n ? undefined\n : join(outputPath, descriptor.runtimeHelperExecutableName);\n const assetZipPath = join(outputPath, \"assets.zip\");\n const runtimeAppId = getMuonTargetRuntimeAppId(input.appId, input.target);\n const appIconPath =\n descriptor.os === \"windows\"\n ? input.windowsResource.iconPath\n : input.linuxDesktop.iconPath;\n\n await verifyTargetInputs({\n sourceRuntimePath,\n sourceLauncherPath,\n sourceRuntimeHelperPath,\n descriptor,\n target: input.target,\n });\n\n await rm(outputPath, { recursive: true, force: true });\n await mkdir(outputPath, { recursive: true, mode: directoryMode });\n await copyRuntimeFiles(sourceRuntimePath, outputPath, descriptor);\n for (const executableName of [\n descriptor.runtimeExecutableName,\n ...descriptor.runtimeAuxiliaryExecutableNames,\n ]) {\n await chmod(join(outputPath, executableName), executableMode);\n }\n await copyFile(sourceLauncherPath, launcherPath);\n await chmod(launcherPath, executableMode);\n if (\n sourceRuntimeHelperPath !== undefined &&\n runtimeHelperPath !== undefined\n ) {\n await copyFile(sourceRuntimeHelperPath, runtimeHelperPath);\n await chmod(runtimeHelperPath, executableMode);\n }\n if (input.nodeProject !== undefined) {\n await stageMuonNodeHostArtifacts(\n sourceRuntimePath,\n outputPath,\n descriptor.os,\n );\n await stageMuonNodeProject(input.nodeProject, outputPath);\n }\n await copyDistributionFiles(input.distributionFiles, outputPath);\n\n input.progress?.({\n phase: \"build\",\n status: \"Creating assets.zip\",\n });\n const asset = await writeAssetArchive(\n input.assetInput,\n assetZipPath,\n input.salt,\n [{ name: appIconAssetEntryName, data: await readFile(appIconPath) }],\n );\n const embeddedConfig = createEmbeddedConfig(\n input.sourceConfig,\n asset,\n runtimeAppId,\n input.linuxDesktop.desktopId,\n appIconAssetUrl,\n input.browserStartPage,\n input.browserProfilePathOverride,\n );\n const launcherEmbeddedConfig = createLauncherEmbeddedConfig(\n embeddedConfig,\n input.nodeRuntimeRequirement,\n );\n\n input.progress?.({\n phase: \"build\",\n status: \"Embedding config\",\n });\n await withTemporaryConfig(embeddedConfig, async (configPath) => {\n await embedMuonConfigInRuntime({\n runtimePath: outputPath,\n configPath,\n outputRuntimePath: undefined,\n });\n });\n await withTemporaryConfig(launcherEmbeddedConfig, async (configPath) => {\n await embedMuonConfigInLauncherFile({\n launcherPath: launcherPath,\n configPath,\n outputPath: undefined,\n });\n if (runtimeHelperPath !== undefined) {\n await embedMuonConfigInLauncherFile({\n launcherPath: runtimeHelperPath,\n configPath,\n outputPath: undefined,\n });\n }\n });\n\n if (descriptor.os === \"windows\") {\n input.progress?.({\n phase: \"build\",\n status: \"Updating Windows resources\",\n });\n await updateWindowsPeIconResource({\n executablePath: join(outputPath, descriptor.runtimeExecutableName),\n resource: input.windowsResource,\n environment: input.environment,\n cwd: input.root,\n });\n await updateWindowsPeResources({\n executablePath: launcherPath,\n resource: input.windowsResource,\n environment: input.environment,\n cwd: input.root,\n });\n if (input.windowsCodeSigning !== undefined) {\n input.progress?.({\n phase: \"build\",\n status: \"Signing Windows executables\",\n });\n }\n await signWindowsExecutable({\n codeSigning: input.windowsCodeSigning,\n kind: \"runtime\",\n target: input.target,\n path: join(outputPath, descriptor.runtimeExecutableName),\n cwd: input.root,\n environment: input.environment,\n });\n await signWindowsExecutable({\n codeSigning: input.windowsCodeSigning,\n kind: \"launcher\",\n target: input.target,\n path: launcherPath,\n cwd: input.root,\n environment: input.environment,\n });\n } else if (descriptor.os === \"linux\") {\n input.progress?.({\n phase: \"build\",\n status: \"Writing Linux desktop files\",\n });\n await writeLinuxDesktopDistributionFiles(outputPath, input.linuxDesktop);\n }\n\n return {\n target: input.target,\n distributionDirectoryName: descriptor.distributionDirectoryName,\n outputPath,\n launcherPath,\n ...(runtimeHelperPath === undefined ? {} : { runtimeHelperPath }),\n asset,\n runtimeAppId,\n embeddedConfig,\n ...(descriptor.os === \"linux\" ? { linuxDesktop: input.linuxDesktop } : {}),\n };\n};\n\nconst verifyTargetInputs = async (input: {\n sourceRuntimePath: string;\n sourceLauncherPath: string;\n sourceRuntimeHelperPath: string | undefined;\n descriptor: MuonTargetDescriptor;\n target: MuonBuildTarget;\n}): Promise<void> => {\n await assertDirectory(\n input.sourceRuntimePath,\n `muon runtime for ${input.target}`,\n );\n await assertFile(\n input.sourceLauncherPath,\n `muon launcher for ${input.target}`,\n );\n if (input.sourceRuntimeHelperPath !== undefined) {\n await assertFile(\n input.sourceRuntimeHelperPath,\n `muon runtime helper for ${input.target}`,\n );\n }\n for (const fileName of input.descriptor.runtimeFiles) {\n await assertFile(\n join(input.sourceRuntimePath, fileName),\n `muon runtime file ${fileName} for ${input.target}`,\n );\n }\n await assertFile(\n join(input.sourceRuntimePath, muonLicenseFileName),\n `muon license file for ${input.target}`,\n );\n};\n\nconst getLauncherFileName = (\n appName: string,\n descriptor: MuonTargetDescriptor,\n): string => {\n if (\n descriptor.launcherExtension.length > 0 &&\n !appName.endsWith(descriptor.launcherExtension)\n ) {\n return `${appName}${descriptor.launcherExtension}`;\n }\n\n return appName;\n};\n\nconst copyRuntimeFiles = async (\n sourceRuntimePath: string,\n outputPath: string,\n descriptor: MuonTargetDescriptor,\n): Promise<void> => {\n for (const fileName of descriptor.runtimeFiles) {\n await copyFile(\n join(sourceRuntimePath, fileName),\n join(outputPath, fileName),\n );\n }\n if (descriptor.optionalRuntimeFilePatterns !== undefined) {\n const fileNames = await readdir(sourceRuntimePath);\n for (const fileName of fileNames) {\n if (\n descriptor.optionalRuntimeFilePatterns.some((pattern) =>\n pattern.test(fileName),\n )\n ) {\n await copyFile(\n join(sourceRuntimePath, fileName),\n join(outputPath, fileName),\n );\n }\n }\n }\n await copyFile(\n join(sourceRuntimePath, muonLicenseFileName),\n join(outputPath, muonLicenseFileName),\n );\n};\n\nconst copyDistributionFiles = async (\n files: readonly DistributionFile[],\n outputPath: string,\n): Promise<void> => {\n for (const file of files) {\n const destinationPath = join(outputPath, file.fileName);\n if ((await statOrUndefined(destinationPath)) !== undefined) {\n throw new Error(\n `muon distribution file destination already exists: ${file.fileName}`,\n );\n }\n await copyFile(file.sourcePath, destinationPath);\n }\n};\n\nconst writeAssetArchive = async (\n input: AssetInput,\n outputPath: string,\n salt: Buffer,\n extraEntries: readonly ZipEntry[],\n): Promise<MuonBuildAssetResult> => {\n const sourceStats = await statOrUndefined(input.sourcePath);\n if (sourceStats === undefined) {\n throw new Error(`muon asset source does not exist: ${input.sourcePath}`);\n }\n\n const archive = sourceStats.isDirectory()\n ? await createAssetArchiveFromDirectory(input, extraEntries)\n : sourceStats.isFile()\n ? await createAssetArchiveFromZipFile(input.sourcePath, extraEntries)\n : undefined;\n if (archive === undefined) {\n throw new Error(\n `muon asset source is not a directory or file: ${input.sourcePath}`,\n );\n }\n await writeFile(outputPath, archive);\n\n const signature = createHash(\"sha256\")\n .update(archive)\n .update(salt)\n .digest(\"hex\");\n return {\n path: outputPath,\n signature,\n salt: salt.toString(\"hex\"),\n entryCount: sourceStats.isDirectory()\n ? readZipEntryCount(archive, outputPath)\n : readZipEntryCount(archive, input.sourcePath),\n };\n};\n\nconst createAssetArchiveFromDirectory = async (\n input: AssetInput,\n extraEntries: readonly ZipEntry[],\n): Promise<Buffer> => {\n const entries = await collectZipEntries(input.sourcePath, input.prefix);\n if (entries.length === 0) {\n throw new Error(`muon asset source has no files: ${input.sourcePath}`);\n }\n\n return createZipArchive(appendZipEntries(entries, extraEntries));\n};\n\nconst createAssetArchiveFromZipFile = async (\n sourcePath: string,\n extraEntries: readonly ZipEntry[],\n): Promise<Buffer> => {\n const zip = new AdmZip(await readFile(sourcePath));\n for (const entry of extraEntries) {\n assertSafeZipEntryName(entry.name);\n if (zip.getEntry(entry.name) !== null) {\n throw new Error(\n `muon app icon asset entry already exists: ${entry.name}`,\n );\n }\n zip.addFile(entry.name, entry.data);\n }\n return zip.toBuffer();\n};\n\nconst appendZipEntries = (\n entries: readonly ZipEntry[],\n extraEntries: readonly ZipEntry[],\n): ZipEntry[] => {\n const output = [...entries];\n const names = new Set(entries.map((entry) => entry.name));\n for (const entry of extraEntries) {\n assertSafeZipEntryName(entry.name);\n if (names.has(entry.name)) {\n throw new Error(\n `muon app icon asset entry already exists: ${entry.name}`,\n );\n }\n names.add(entry.name);\n output.push(entry);\n }\n return output;\n};\n\nconst readZipEntryCount = (archive: Buffer, sourcePath: string): number => {\n const endSignature = 0x06054b50;\n const lastPossibleOffset = archive.length - 22;\n const firstPossibleOffset = Math.max(0, lastPossibleOffset - 0xffff);\n\n for (\n let offset = lastPossibleOffset;\n offset >= firstPossibleOffset;\n offset -= 1\n ) {\n if (archive.readUInt32LE(offset) === endSignature) {\n return archive.readUInt16LE(offset + 10);\n }\n }\n\n throw new Error(`muon asset ZIP could not be read: ${sourcePath}`);\n};\n\nconst collectZipEntries = async (\n sourcePath: string,\n prefix: string,\n): Promise<ZipEntry[]> => {\n const entries: ZipEntry[] = [];\n\n const walk = async (directoryPath: string): Promise<void> => {\n const dirents = await readdir(directoryPath, { withFileTypes: true });\n dirents.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const dirent of dirents) {\n const childPath = join(directoryPath, dirent.name);\n if (dirent.isDirectory()) {\n await walk(childPath);\n } else if (dirent.isFile()) {\n const relativePath = relative(sourcePath, childPath)\n .split(sep)\n .join(\"/\");\n const name = `${prefix}${relativePath}`;\n assertSafeZipEntryName(name);\n entries.push({\n name,\n data: await readFile(childPath),\n });\n }\n }\n };\n\n await walk(sourcePath);\n return entries;\n};\n\nconst assertSafeZipEntryName = (name: string): void => {\n if (\n name.length === 0 ||\n name.startsWith(\"/\") ||\n name.includes(\"..\") ||\n name.includes(\"\\\\\")\n ) {\n throw new Error(`Unsafe ZIP entry name: ${name}`);\n }\n};\n\nconst createZipArchive = (entries: readonly ZipEntry[]): Buffer => {\n const zip = new AdmZip();\n for (const entry of entries) {\n zip.addFile(entry.name, entry.data);\n }\n\n return zip.toBuffer();\n};\n\nconst createEmbeddedConfig = (\n sourceConfig: JsonObject,\n asset: MuonBuildAssetResult,\n appId: string,\n desktopId: string,\n initialTitleBarIcon: string,\n browserStartPage: string | undefined,\n browserProfilePathOverride: string | undefined,\n): JsonObject => {\n const sourceAsset = sourceConfig.asset;\n if (sourceAsset !== undefined && !isJsonObject(sourceAsset)) {\n throw new Error(\"muon.json asset must be an object when present.\");\n }\n const sourceLauncher = sourceConfig.launcher;\n if (sourceLauncher !== undefined && !isJsonObject(sourceLauncher)) {\n throw new Error(\"muon.json launcher must be an object when present.\");\n }\n\n const runtimeConfig = stripBuildOnlyAppIconConfig(\n stripBuildOnlyLinuxDesktopConfig(\n stripBuildOnlyWindowsCodeSigningConfig(\n stripBuildOnlyWindowsResourceConfig(sourceConfig),\n ),\n ),\n );\n const sourceBrowser = runtimeConfig.browser;\n if (sourceBrowser !== undefined && !isJsonObject(sourceBrowser)) {\n throw new Error(\"muon.json browser must be an object when present.\");\n }\n\n const browserConfig: JsonObject = {\n ...(sourceBrowser ?? {}),\n initialTitleBarIcon,\n };\n if (browserStartPage !== undefined && browserConfig.startPage === undefined) {\n browserConfig.startPage = browserStartPage;\n }\n if (browserProfilePathOverride !== undefined) {\n browserConfig.profilePath = browserProfilePathOverride;\n }\n\n return {\n ...runtimeConfig,\n browser: browserConfig,\n asset: {\n ...(sourceAsset ?? {}),\n sourcePath: appConfigSourcePath,\n signature: asset.signature,\n salt: asset.salt,\n },\n launcher: {\n ...(sourceLauncher ?? {}),\n appId,\n desktopId,\n },\n };\n};\n\nconst createLauncherEmbeddedConfig = (\n embeddedConfig: JsonObject,\n nodeRuntimeRequirement: MuonNodeRuntimeRequirement | undefined,\n): JsonObject => {\n if (nodeRuntimeRequirement === undefined) {\n return embeddedConfig;\n }\n const launcher = embeddedConfig.launcher;\n if (!isJsonObject(launcher)) {\n throw new Error(\"generated muon launcher config must be an object\");\n }\n return {\n ...embeddedConfig,\n launcher: {\n ...launcher,\n nodeRuntime: nodeRuntimeRequirement,\n },\n };\n};\n\nconst assertNoUserInitialTitleBarIcon = (sourceConfig: JsonObject): void => {\n const sourceBrowser = sourceConfig.browser;\n if (sourceBrowser === undefined) {\n return;\n }\n if (!isJsonObject(sourceBrowser)) {\n throw new Error(\"muon.json browser must be an object when present.\");\n }\n if (sourceBrowser.initialTitleBarIcon !== undefined) {\n throw new Error(\n \"muon.json browser.initialTitleBarIcon is generated by muon build; use top-level iconPath instead.\",\n );\n }\n};\n\nconst assertNoUserNodeRuntime = (sourceConfig: JsonObject): void => {\n const sourceLauncher = sourceConfig.launcher;\n if (sourceLauncher === undefined) {\n return;\n }\n if (!isJsonObject(sourceLauncher)) {\n throw new Error(\"muon.json launcher must be an object when present.\");\n }\n if (sourceLauncher.nodeRuntime !== undefined) {\n throw new Error(\n \"muon.json launcher.nodeRuntime is generated by muon build.\",\n );\n }\n};\n\nconst stripBuildOnlyAppIconConfig = (sourceConfig: JsonObject): JsonObject => {\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"iconPath\") {\n output[key] = value;\n }\n }\n return output;\n};\n\nconst withTemporaryConfig = async (\n config: JsonObject,\n callback: (configPath: string) => Promise<void>,\n): Promise<void> => {\n const tempDirectory = await mkdtemp(join(tmpdir(), \"muon-build-config-\"));\n const configPath = join(tempDirectory, \"muon.json\");\n try {\n await writeFile(configPath, `${JSON.stringify(config, undefined, 2)}\\n`);\n await callback(configPath);\n } finally {\n await rm(tempDirectory, { recursive: true, force: true });\n }\n};\n\nconst assertDirectory = async (path: string, label: string): Promise<void> => {\n const stats = await statOrUndefined(path);\n if (stats === undefined || !stats.isDirectory()) {\n throw new Error(`${label} directory does not exist: ${path}`);\n }\n};\n\nconst assertFile = async (path: string, label: string): Promise<void> => {\n const stats = await statOrUndefined(path);\n if (stats === undefined || !stats.isFile()) {\n throw new Error(`${label} file does not exist: ${path}`);\n }\n};\n\nconst statOrUndefined = async (path: string): Promise<Stats | undefined> => {\n try {\n return await stat(path);\n } catch {\n return undefined;\n }\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject => {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n};\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport type { ResolvedConfig } from \"vite\";\n\nimport type { MuonRuntimePluginConfig } from \"./capability.js\";\nimport type { MuonVitePluginOptions } from \"./vite.js\";\nimport { isMuonWindowsCodeSigningOptions } from \"./windows-code-signing.js\";\n\n/**\n * Metadata symbol used to recover `muon()` plugin options from `vite.config.*`.\n */\nexport const muonVitePluginOptionsSymbol = Symbol.for(\n \"muon.vite.plugin.options\",\n);\n\nconst muonVitePluginRuntimeStateSymbol = Symbol.for(\n \"muon.vite.plugin.runtimeState\",\n);\n\ninterface MuonVitePluginWithOptions {\n [muonVitePluginOptionsSymbol]: MuonVitePluginOptions;\n}\n\n/**\n * Internal state exposed by a resolved muon Vite plugin instance.\n */\nexport interface MuonVitePluginRuntimeState {\n /**\n * Returns the Vite config resolved for this plugin instance.\n */\n getResolvedConfig: () => ResolvedConfig | undefined;\n\n /**\n * Returns the runtime plugin config generated by this plugin instance.\n */\n getRuntimePluginConfig: () => MuonRuntimePluginConfig | undefined;\n}\n\ninterface MuonVitePluginWithRuntimeState {\n [muonVitePluginRuntimeStateSymbol]: MuonVitePluginRuntimeState;\n}\n\nconst isRecord = (value: unknown): value is Record<string | symbol, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isStringArray = (value: unknown): value is readonly string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst isStringRecord = (value: unknown): value is Record<string, string> =>\n isRecord(value) &&\n Object.entries(value).every(\n ([entryKey, entryValue]) =>\n entryKey.length > 0 &&\n !entryKey.includes(\"\\0\") &&\n typeof entryValue === \"string\" &&\n !entryValue.includes(\"\\0\"),\n );\n\nconst isWindowsResourceOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.iconPath === undefined || typeof value.iconPath === \"string\") &&\n (value.productName === undefined ||\n typeof value.productName === \"string\") &&\n (value.fileDescription === undefined ||\n typeof value.fileDescription === \"string\") &&\n (value.companyName === undefined ||\n typeof value.companyName === \"string\") &&\n (value.version === undefined || typeof value.version === \"string\") &&\n (value.copyright === undefined || typeof value.copyright === \"string\") &&\n (value.language === undefined ||\n (typeof value.language === \"number\" &&\n Number.isInteger(value.language))) &&\n (value.codePage === undefined ||\n (typeof value.codePage === \"number\" && Number.isInteger(value.codePage)))\n );\n};\n\nconst isLinuxDesktopOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.desktopId === undefined || typeof value.desktopId === \"string\") &&\n (value.name === undefined || typeof value.name === \"string\") &&\n (value.comment === undefined || typeof value.comment === \"string\") &&\n (value.iconPath === undefined || typeof value.iconPath === \"string\") &&\n (value.categories === undefined || isStringArray(value.categories)) &&\n (value.startupNotify === undefined ||\n typeof value.startupNotify === \"boolean\")\n );\n};\n\nconst isMuonViteBuildOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.targets === undefined || isStringArray(value.targets)) &&\n (value.allTargets === undefined || typeof value.allTargets === \"boolean\") &&\n (value.appName === undefined || typeof value.appName === \"string\") &&\n (value.appId === undefined || typeof value.appId === \"string\") &&\n (value.outputRoot === undefined || typeof value.outputRoot === \"string\") &&\n (value.configPath === undefined || typeof value.configPath === \"string\") &&\n (value.iconPath === undefined || typeof value.iconPath === \"string\") &&\n (value.distributionFiles === undefined ||\n isStringArray(value.distributionFiles)) &&\n (value.windowsResource === undefined ||\n isWindowsResourceOptions(value.windowsResource)) &&\n (value.windowsCodeSigning === undefined ||\n value.windowsCodeSigning === false ||\n isMuonWindowsCodeSigningOptions(value.windowsCodeSigning)) &&\n (value.linuxDesktop === undefined ||\n isLinuxDesktopOptions(value.linuxDesktop)) &&\n (value.packageDirectory === undefined ||\n typeof value.packageDirectory === \"string\") &&\n (value.assetSalt === undefined || value.assetSalt instanceof Uint8Array)\n );\n};\n\nconst isMuonVitePluginAccessImportOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.sources === undefined || isStringArray(value.sources)) &&\n (value.packages === undefined || isStringArray(value.packages)) &&\n (value.allow === undefined || isStringArray(value.allow))\n );\n};\n\nconst isMuonVitePluginAccessEntryOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n typeof value.name === \"string\" &&\n (value.signature === undefined || typeof value.signature === \"string\") &&\n (value.salt === undefined || typeof value.salt === \"string\") &&\n (value.config === undefined || isStringRecord(value.config)) &&\n (value.allow === undefined || isStringArray(value.allow)) &&\n (value.imports === undefined ||\n (Array.isArray(value.imports) &&\n value.imports.every(isMuonVitePluginAccessImportOptions)))\n );\n};\n\nconst isMuonVitePluginAccessOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.path === undefined || typeof value.path === \"string\") &&\n (value.mode === undefined ||\n value.mode === \"simple\" ||\n value.mode === \"validate\") &&\n (value.pages === undefined || isStringArray(value.pages)) &&\n (value.plugins === undefined ||\n (Array.isArray(value.plugins) &&\n value.plugins.every(isMuonVitePluginAccessEntryOptions)))\n );\n};\n\nconst isMuonViteDevOptions = (value: unknown): boolean =>\n isRecord(value) &&\n (value.config === undefined || isStringRecord(value.config));\n\nconst isMuonVitePluginOptions = (\n value: unknown,\n): value is MuonVitePluginOptions => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.muonPath === undefined || typeof value.muonPath === \"string\") &&\n (value.cefPath === undefined || typeof value.cefPath === \"string\") &&\n (value.stagePath === undefined || typeof value.stagePath === \"string\") &&\n (value.open === undefined || typeof value.open === \"boolean\") &&\n (value.enableDebugger === undefined ||\n typeof value.enableDebugger === \"boolean\") &&\n (value.allowInsecureLocalhost === undefined ||\n typeof value.allowInsecureLocalhost === \"boolean\") &&\n (value.exitWithServer === undefined ||\n typeof value.exitWithServer === \"boolean\") &&\n (value.dev === undefined || isMuonViteDevOptions(value.dev)) &&\n (value.pluginAccess === undefined ||\n value.pluginAccess === false ||\n isMuonVitePluginAccessOptions(value.pluginAccess)) &&\n (value.build === undefined ||\n typeof value.build === \"boolean\" ||\n isMuonViteBuildOptions(value.build))\n );\n};\n\n/**\n * Attaches raw muon Vite plugin options to a plugin instance.\n *\n * @param plugin Plugin object.\n * @param options Raw plugin options.\n * @returns Plugin object with internal muon metadata.\n */\nexport const attachMuonVitePluginOptions = <TPlugin extends object>(\n plugin: TPlugin,\n options: MuonVitePluginOptions,\n): TPlugin & MuonVitePluginWithOptions => {\n Object.defineProperty(plugin, muonVitePluginOptionsSymbol, {\n configurable: false,\n enumerable: false,\n value: { ...options },\n writable: false,\n });\n\n return plugin as TPlugin & MuonVitePluginWithOptions;\n};\n\n/**\n * Attaches internal runtime state to a plugin instance.\n *\n * @param plugin Plugin object.\n * @param runtimeState Runtime state accessor.\n * @returns Plugin object with internal muon runtime metadata.\n */\nexport const attachMuonVitePluginRuntimeState = <TPlugin extends object>(\n plugin: TPlugin,\n runtimeState: MuonVitePluginRuntimeState,\n): TPlugin & MuonVitePluginWithRuntimeState => {\n Object.defineProperty(plugin, muonVitePluginRuntimeStateSymbol, {\n configurable: false,\n enumerable: false,\n value: runtimeState,\n writable: false,\n });\n\n return plugin as TPlugin & MuonVitePluginWithRuntimeState;\n};\n\n/**\n * Reads raw muon Vite plugin options from a plugin instance.\n *\n * @param plugin Candidate plugin object.\n * @returns Attached muon options, if present.\n */\nexport const getMuonVitePluginOptions = (\n plugin: unknown,\n): MuonVitePluginOptions | undefined => {\n if (!isRecord(plugin)) {\n return undefined;\n }\n\n const options = plugin[muonVitePluginOptionsSymbol];\n return isMuonVitePluginOptions(options) ? options : undefined;\n};\n\n/**\n * Reads internal runtime state from a muon Vite plugin instance.\n *\n * @param plugin Candidate plugin object.\n * @returns Runtime state accessor, if present.\n */\nexport const getMuonVitePluginRuntimeState = (\n plugin: unknown,\n): MuonVitePluginRuntimeState | undefined => {\n if (!isRecord(plugin)) {\n return undefined;\n }\n\n const runtimeState = plugin[muonVitePluginRuntimeStateSymbol];\n return isRecord(runtimeState) &&\n typeof runtimeState.getResolvedConfig === \"function\" &&\n typeof runtimeState.getRuntimePluginConfig === \"function\"\n ? (runtimeState as unknown as MuonVitePluginRuntimeState)\n : undefined;\n};\n\n/**\n * Resolves nested Vite plugin option values into a flat list.\n *\n * @param pluginOptions Raw `plugins` field from a Vite config.\n * @returns Flat plugin object list.\n */\nexport const flattenVitePluginOptions = async (\n pluginOptions: unknown,\n): Promise<unknown[]> => {\n const resolvedValue = await pluginOptions;\n if (resolvedValue === null || resolvedValue === undefined || !resolvedValue) {\n return [];\n }\n\n if (Array.isArray(resolvedValue)) {\n const nested = await Promise.all(\n resolvedValue.map((entry) => flattenVitePluginOptions(entry)),\n );\n return nested.flat();\n }\n\n return [resolvedValue];\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/**\n * Asset layout derived from Vite's resolved base URL for packaged muon apps.\n */\nexport interface MuonVitePackagedAssetOptions {\n /** ZIP entry prefix used for copied Vite build output. */\n assetPrefix: string;\n /** Generated browser start page when Vite base needs a packaged path. */\n browserStartPage: string | undefined;\n}\n\n/**\n * Returns the package-local asset base path represented by a Vite base URL.\n */\nexport const resolveVitePackagedAssetBasePath = (\n base: string,\n): string | undefined => {\n const normalizedBase = base.trim();\n if (\n normalizedBase === \"\" ||\n normalizedBase === \"/\" ||\n normalizedBase === \"./\" ||\n normalizedBase.startsWith(\"//\") ||\n /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(normalizedBase) ||\n !normalizedBase.startsWith(\"/\")\n ) {\n return undefined;\n }\n\n const normalizedPath = normalizedBase.split(/[?#]/, 1)[0] ?? \"\";\n const segments = normalizedPath\n .split(\"/\")\n .filter((segment) => segment.length > 0);\n return segments.length > 0 ? segments.join(\"/\") : undefined;\n};\n\n/**\n * Creates muon asset options for packaging Vite build output.\n */\nexport const createVitePackagedAssetOptions = (\n base: string,\n): MuonVitePackagedAssetOptions => {\n const packagedAssetBasePath = resolveVitePackagedAssetBasePath(base);\n const assetPrefix =\n packagedAssetBasePath === undefined\n ? \"main\"\n : `main/${packagedAssetBasePath}`;\n return {\n assetPrefix,\n browserStartPage:\n packagedAssetBasePath === undefined\n ? undefined\n : `asset://${assetPrefix}/index.html`,\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { isAbsolute, resolve } from \"node:path\";\n\nimport type { InlineConfig, ResolvedConfig } from \"vite\";\n\nimport {\n buildMuonApp,\n resolveMuonNodeProjectForBuildConfig,\n type MuonBuildOptions,\n type MuonBuildResult,\n} from \"./build.js\";\nimport {\n flattenVitePluginOptions,\n getMuonVitePluginOptions,\n} from \"./vite-options.js\";\nimport type { MuonViteBuildOptions, MuonVitePluginOptions } from \"./vite.js\";\nimport { createVitePackagedAssetOptions } from \"./vite-assets.js\";\nimport { mergeMuonWindowsResourceOptions } from \"./windows-resource.js\";\nimport { mergeMuonLinuxDesktopOptions } from \"./linux-desktop.js\";\nimport type { MuonProgressCallback } from \"./progress.js\";\nimport { assertMuonNodeProjectViteBuildIsSafe } from \"./node-project.js\";\n\n/**\n * Environment variable used to prevent the Vite plugin build hook from running\n * when a CLI command owns the muon build sequence.\n */\nexport const muonBuildSequenceSuppressViteBuildEnvironmentKey =\n \"MUON_SUPPRESS_VITE_MUON_BUILD\";\n\n/**\n * Resolved project metadata used by the CLI build sequence.\n */\nexport interface MuonBuildSequenceProject {\n /** Project root used for muon config and package metadata. */\n root: string;\n /** Root passed to Vite when the sequence must run `vite build`. */\n viteBuildRoot: string;\n /** Vite base URL used by the resolved Vite build. */\n viteBase: string | undefined;\n /** Absolute Vite output directory used as muon app assets. */\n viteOutputDirectory: string | undefined;\n /** Absolute Vite public directory copied into output, when enabled. */\n vitePublicDirectory: string | undefined;\n /** muon Vite plugin options if the project config contains the plugin. */\n pluginOptions: MuonVitePluginOptions | undefined;\n /** Whether the resolved Vite config contains server proxy entries. */\n viteServerProxyConfigured: boolean;\n}\n\n/**\n * Options for running the CLI-oriented muon build sequence.\n */\nexport interface MuonBuildSequenceOptions extends MuonBuildOptions {\n /** Target default used only when no muon Vite plugin defines build options. */\n defaultAllTargets?: boolean;\n}\n\ninterface InternalMuonBuildSequenceOptions extends MuonBuildSequenceOptions {\n environment?: NodeJS.ProcessEnv;\n progress?: MuonProgressCallback;\n}\n\ninterface InternalMuonBuildOptions extends MuonBuildOptions {\n environment?: NodeJS.ProcessEnv;\n progress?: MuonProgressCallback;\n}\n\nconst isMissingVitePackageError = (error: unknown): boolean => {\n const candidate = error as { code?: unknown; message?: unknown };\n return (\n candidate.code === \"ERR_MODULE_NOT_FOUND\" &&\n typeof candidate.message === \"string\" &&\n candidate.message.includes(\"vite\")\n );\n};\n\nconst resolveViteOutputDirectory = (config: ResolvedConfig): string => {\n return isAbsolute(config.build.outDir)\n ? config.build.outDir\n : resolve(config.root, config.build.outDir);\n};\n\nconst hasViteServerProxyConfiguration = (proxy: unknown): boolean =>\n typeof proxy === \"object\" && proxy !== null && Object.keys(proxy).length > 0;\n\nconst withSuppressedMuonViteBuild = async <T>(\n action: () => Promise<T>,\n): Promise<T> => {\n const previous =\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey];\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey] = \"1\";\n try {\n return await action();\n } finally {\n if (previous === undefined) {\n delete process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey];\n } else {\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey] = previous;\n }\n }\n};\n\nconst findMuonVitePluginOptions = async (\n plugins: unknown,\n): Promise<MuonVitePluginOptions | undefined> => {\n const flattenedPlugins = await flattenVitePluginOptions(plugins);\n const muonPlugins = flattenedPlugins\n .map((plugin) => getMuonVitePluginOptions(plugin))\n .filter(\n (pluginOptions): pluginOptions is MuonVitePluginOptions =>\n pluginOptions !== undefined,\n );\n\n if (muonPlugins.length > 1) {\n throw new Error(\n \"Multiple muon() plugin definitions were found in vite.config.*.\",\n );\n }\n\n return muonPlugins[0];\n};\n\n/**\n * Loads Vite configuration only far enough to discover whether a muon plugin\n * controls the build sequence.\n */\nexport const loadMuonBuildSequenceProject = async (\n cwd: string,\n): Promise<MuonBuildSequenceProject> => {\n const resolvedCwd = resolve(cwd);\n let vite: typeof import(\"vite\");\n try {\n vite = await import(\"vite\");\n } catch (error) {\n if (isMissingVitePackageError(error)) {\n return {\n root: resolvedCwd,\n viteBuildRoot: resolvedCwd,\n viteBase: undefined,\n viteOutputDirectory: undefined,\n vitePublicDirectory: undefined,\n pluginOptions: undefined,\n viteServerProxyConfigured: false,\n };\n }\n throw error;\n }\n\n const resolvedConfig = await withSuppressedMuonViteBuild(\n async () =>\n await vite.resolveConfig(\n { root: resolvedCwd, logLevel: \"silent\" } satisfies InlineConfig,\n \"build\",\n \"production\",\n \"production\",\n ),\n );\n const pluginOptions = await findMuonVitePluginOptions(resolvedConfig.plugins);\n if (pluginOptions === undefined) {\n return {\n root: resolvedCwd,\n viteBuildRoot: resolvedCwd,\n viteBase: undefined,\n viteOutputDirectory: undefined,\n vitePublicDirectory: undefined,\n pluginOptions: undefined,\n viteServerProxyConfigured: hasViteServerProxyConfiguration(\n resolvedConfig.server.proxy,\n ),\n };\n }\n\n return {\n root: resolvedConfig.root,\n viteBuildRoot: resolvedCwd,\n viteBase: resolvedConfig.base,\n viteOutputDirectory: resolveViteOutputDirectory(resolvedConfig),\n vitePublicDirectory:\n resolvedConfig.publicDir === \"\" ? undefined : resolvedConfig.publicDir,\n pluginOptions,\n viteServerProxyConfigured: hasViteServerProxyConfiguration(\n resolvedConfig.server.proxy,\n ),\n };\n};\n\n/**\n * Returns muon build options from a muon Vite plugin declaration.\n */\nexport const resolveMuonViteBuildOptions = (\n pluginOptions: MuonVitePluginOptions | undefined,\n): MuonViteBuildOptions => {\n if (pluginOptions?.build === false) {\n throw new Error(\"muon build is disabled by muon({ build: false }).\");\n }\n return typeof pluginOptions?.build === \"object\" ? pluginOptions.build : {};\n};\n\nconst runViteBuild = async (root: string): Promise<void> => {\n const vite = await import(\"vite\");\n await withSuppressedMuonViteBuild(async () => {\n await vite.build({ root, logLevel: \"silent\" } satisfies InlineConfig);\n });\n};\n\nconst hasExplicitTargets = (options: MuonBuildSequenceOptions): boolean =>\n options.targets !== undefined && options.targets.length > 0;\n\nconst copyDefinedBuildOptions = (\n output: MuonBuildOptions,\n input: MuonBuildSequenceOptions,\n usesViteAssets: boolean,\n): void => {\n if (input.assetSourcePath !== undefined) {\n if (usesViteAssets) {\n throw new Error(\n \"--assets cannot be used when a muon() Vite plugin provides the build sequence.\",\n );\n }\n output.assetSourcePath = input.assetSourcePath;\n }\n if (input.assetPrefix !== undefined) {\n output.assetPrefix = input.assetPrefix;\n }\n if (input.targets !== undefined && input.targets.length > 0) {\n output.targets = input.targets;\n if (input.allTargets === undefined) {\n output.allTargets = false;\n }\n }\n if (input.allTargets !== undefined) {\n output.allTargets = input.allTargets;\n }\n if (input.appName !== undefined) {\n output.appName = input.appName;\n }\n if (input.appId !== undefined) {\n output.appId = input.appId;\n }\n if (input.outputRoot !== undefined) {\n output.outputRoot = input.outputRoot;\n }\n if (input.configPath !== undefined) {\n output.configPath = input.configPath;\n }\n if (input.iconPath !== undefined) {\n output.iconPath = input.iconPath;\n }\n if (input.distributionFiles !== undefined) {\n output.distributionFiles = input.distributionFiles;\n }\n if (input.windowsResource !== undefined) {\n const windowsResource = mergeMuonWindowsResourceOptions(\n input.windowsResource,\n output.windowsResource,\n );\n if (windowsResource !== undefined) {\n output.windowsResource = windowsResource;\n }\n }\n if (input.windowsCodeSigning !== undefined) {\n output.windowsCodeSigning = input.windowsCodeSigning;\n }\n if (input.linuxDesktop !== undefined) {\n const linuxDesktop = mergeMuonLinuxDesktopOptions(\n input.linuxDesktop,\n output.linuxDesktop,\n );\n if (linuxDesktop !== undefined) {\n output.linuxDesktop = linuxDesktop;\n }\n }\n if (input.packageDirectory !== undefined) {\n output.packageDirectory = input.packageDirectory;\n }\n if (input.assetSalt !== undefined) {\n output.assetSalt = input.assetSalt;\n }\n if (input.includeRuntimeHelper !== undefined) {\n output.includeRuntimeHelper = input.includeRuntimeHelper;\n }\n};\n\n/**\n * Runs the project build sequence used by `muon build` and `muon pack`.\n */\nexport const runMuonBuildSequence = async (\n options: MuonBuildSequenceOptions = {},\n loadedProject?: MuonBuildSequenceProject,\n): Promise<MuonBuildResult> => {\n const internalOptions = options as InternalMuonBuildSequenceOptions;\n const progress = internalOptions.progress;\n const project =\n loadedProject ??\n (await loadMuonBuildSequenceProject(options.root ?? process.cwd()));\n const pluginBuildOptions = resolveMuonViteBuildOptions(project.pluginOptions);\n const usesViteAssets = project.pluginOptions !== undefined;\n const buildOptions: MuonBuildOptions = {\n root: project.root,\n };\n\n if (usesViteAssets) {\n if (project.viteOutputDirectory === undefined) {\n throw new Error(\"Vite output directory could not be resolved.\");\n }\n Object.assign(buildOptions, pluginBuildOptions);\n const effectiveConfigPath =\n options.configPath ?? pluginBuildOptions.configPath;\n const nodeProject = await resolveMuonNodeProjectForBuildConfig(\n project.root,\n effectiveConfigPath,\n );\n await assertMuonNodeProjectViteBuildIsSafe(\n nodeProject,\n project.viteOutputDirectory,\n project.vitePublicDirectory ?? \"\",\n );\n const packagedAssetOptions = createVitePackagedAssetOptions(\n project.viteBase ?? \"/\",\n );\n buildOptions.assetSourcePath = project.viteOutputDirectory;\n buildOptions.assetPrefix = packagedAssetOptions.assetPrefix;\n if (packagedAssetOptions.browserStartPage !== undefined) {\n buildOptions.browserStartPage = packagedAssetOptions.browserStartPage;\n }\n progress?.({\n phase: \"build\",\n status: \"Running Vite build\",\n });\n await runViteBuild(project.viteBuildRoot);\n } else if (\n options.defaultAllTargets !== undefined &&\n options.allTargets === undefined &&\n !hasExplicitTargets(options)\n ) {\n buildOptions.allTargets = options.defaultAllTargets;\n }\n\n copyDefinedBuildOptions(buildOptions, options, usesViteAssets);\n if (internalOptions.environment !== undefined) {\n (buildOptions as InternalMuonBuildOptions).environment =\n internalOptions.environment;\n }\n if (progress !== undefined) {\n (buildOptions as InternalMuonBuildOptions).progress = progress;\n }\n return await buildMuonApp(buildOptions);\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn, type ChildProcess } from \"node:child_process\";\nimport { constants, writeFileSync } from \"node:fs\";\nimport { access, mkdtemp, readFile, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, isAbsolute, join, resolve, win32 } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\nimport type { ViteDevServer } from \"vite\";\n\nimport { ensureMuonGitignoreEntry } from \"./gitignore.js\";\nimport { getDefaultMuonPrepareTarget, runMuonPrepare } from \"./prepare.js\";\nimport type { MuonRuntimePluginConfig } from \"./capability.js\";\nimport type { MuonVitePluginOptions } from \"./vite.js\";\nimport {\n assertMuonNodeHostArtifacts,\n assertMuonNodeProjectStagingIsSafe,\n createMuonNodeRuntimeRequirement,\n resolveMuonNodeProject,\n stageMuonNodeProject,\n} from \"./node-project.js\";\n\nexport interface MuonLaunchScriptOptions {\n muonExecutablePath: string;\n projectConfigPath: string | undefined;\n overrideConfigPath: string;\n platform: NodeJS.Platform;\n}\n\ninterface MuonViteSessionOptions {\n server: ViteDevServer;\n pluginOptions: MuonVitePluginOptions;\n refreshRuntimePluginConfig: () => Promise<MuonRuntimePluginConfig>;\n platform: NodeJS.Platform;\n architecture: NodeJS.Architecture;\n environment: NodeJS.ProcessEnv;\n}\n\ninterface MuonRuntimePaths {\n temporaryDirectory: string;\n overrideConfigPath: string;\n}\n\ninterface MuonProjectConfigResolution {\n path: string | undefined;\n config: Record<string, unknown> | undefined;\n}\n\ninterface MuonOverrideConfig {\n config?: Record<string, string>;\n node?: {\n project: string;\n };\n cdp?: {\n enable: true;\n };\n browser: {\n startPage: string;\n titleBarType?: \"native\" | \"muon\";\n initialTitleBarVisibility?: boolean;\n keybind?: {\n devtools: \"f12\";\n recycle: \"ctrl+f12\";\n };\n };\n plugin: MuonRuntimePluginConfig & {\n pages: string[];\n };\n network: {\n allow: string[];\n };\n}\n\n/**\n * Options for resolving a muon runtime directory used by the Vite plugin.\n */\nexport interface MuonRuntimePathOptions {\n /**\n * Vite project root used to resolve explicit relative paths.\n */\n root: string;\n\n /**\n * Public muon runtime target such as linux-amd64 or windows-amd64.\n */\n target: string;\n\n /**\n * Explicit custom muon-core runtime path.\n */\n muonPath: string | undefined;\n\n /**\n * Directory containing the packaged muon JavaScript files.\n *\n * @remarks This is injectable for tests. Production code uses the module directory.\n */\n packageDirectory?: string;\n}\n\nconst resolveFromRoot = (root: string, path: string): string =>\n isAbsolute(path) ? path : resolve(root, path);\n\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\nconst defaultProjectConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst muonRecycleExitCode = 88;\n\n/**\n * Resolves the muon-core runtime directory used by the Vite plugin.\n *\n * @param options Runtime path resolution inputs.\n * @returns Absolute or package-relative runtime directory path.\n */\nexport const resolveMuonRuntimePath = ({\n root,\n target,\n muonPath,\n packageDirectory = moduleDirectory,\n}: MuonRuntimePathOptions): string =>\n muonPath === undefined\n ? join(packageDirectory, \"runtime\", target)\n : resolveFromRoot(root, muonPath);\n\nexport const getMuonExecutablePath = (\n runtimePath: string,\n platform: NodeJS.Platform,\n): string =>\n join(runtimePath, platform === \"win32\" ? \"muon-core.exe\" : \"muon-core\");\n\nconst quotePosix = (value: string): string =>\n `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n\nconst getPlatformDirectoryName = (\n path: string,\n platform: NodeJS.Platform,\n): string => (platform === \"win32\" ? win32.dirname(path) : dirname(path));\n\nconst getOptionalPosixValue = (value: string | undefined): string =>\n value === undefined ? \"''\" : quotePosix(value);\n\nconst createPosixMuonLaunchScript = ({\n muonExecutablePath,\n projectConfigPath,\n overrideConfigPath,\n}: MuonLaunchScriptOptions): string => `#!/usr/bin/env bash\nset -euo pipefail\nMUON_RECYCLE_EXIT_CODE=${muonRecycleExitCode}\nMUON_EXECUTABLE=${quotePosix(muonExecutablePath)}\nMUON_EXECUTABLE_DIRECTORY=${quotePosix(getPlatformDirectoryName(muonExecutablePath, \"linux\"))}\nMUON_PROJECT_CONFIG=${getOptionalPosixValue(projectConfigPath)}\nMUON_OVERRIDE_CONFIG=${quotePosix(overrideConfigPath)}\n\nMUON_CONFIG_ARGS=()\nif [[ -n \"$MUON_PROJECT_CONFIG\" ]]; then\n if [[ ! -f \"$MUON_PROJECT_CONFIG\" ]]; then\n echo \"muon startup failed: project config does not exist: $MUON_PROJECT_CONFIG\" >&2\n exit 1\n fi\n MUON_CONFIG_ARGS+=(\"-c\" \"$MUON_PROJECT_CONFIG\")\nfi\n\nif [[ ! -x \"$MUON_EXECUTABLE\" ]]; then\n echo \"muon startup failed: executable does not exist or is not executable: $MUON_EXECUTABLE\" >&2\n exit 1\nfi\n\nif [[ ! -f \"$MUON_OVERRIDE_CONFIG\" ]]; then\n echo \"muon startup failed: generated override config does not exist: $MUON_OVERRIDE_CONFIG\" >&2\n exit 1\nfi\nMUON_CONFIG_ARGS+=(\"-c\" \"$MUON_OVERRIDE_CONFIG\")\n\ncd \"$MUON_EXECUTABLE_DIRECTORY\"\nwhile true; do\n set +e\n \"$MUON_EXECUTABLE\" \"\\${MUON_CONFIG_ARGS[@]}\"\n MUON_EXIT_CODE=$?\n set -e\n if [[ \"$MUON_EXIT_CODE\" -ne \"$MUON_RECYCLE_EXIT_CODE\" ]]; then\n exit \"$MUON_EXIT_CODE\"\n fi\ndone\n`;\n\nconst escapeWindowsCmdValue = (value: string): string =>\n value.replaceAll(\"%\", \"%%\").replaceAll(\"\\r\", \"\").replaceAll(\"\\n\", \"\");\n\nconst getOptionalWindowsCmdValue = (value: string | undefined): string =>\n value === undefined ? \"\" : escapeWindowsCmdValue(value);\n\nconst createWindowsMuonLaunchScript = ({\n muonExecutablePath,\n projectConfigPath,\n overrideConfigPath,\n}: MuonLaunchScriptOptions): string => `@echo off\nsetlocal\nset \"MUON_RECYCLE_EXIT_CODE=${muonRecycleExitCode}\"\nset \"MUON_EXECUTABLE=${escapeWindowsCmdValue(muonExecutablePath)}\"\nset \"MUON_EXECUTABLE_DIRECTORY=${escapeWindowsCmdValue(getPlatformDirectoryName(muonExecutablePath, \"win32\"))}\"\nset \"MUON_PROJECT_CONFIG=${getOptionalWindowsCmdValue(projectConfigPath)}\"\nset \"MUON_OVERRIDE_CONFIG=${escapeWindowsCmdValue(overrideConfigPath)}\"\n\nif not exist \"%MUON_EXECUTABLE%\" (\n echo muon startup failed: executable does not exist: %MUON_EXECUTABLE% 1>&2\n exit /b 1\n)\n\nif not exist \"%MUON_OVERRIDE_CONFIG%\" (\n echo muon startup failed: generated override config does not exist: %MUON_OVERRIDE_CONFIG% 1>&2\n exit /b 1\n)\n\npushd \"%MUON_EXECUTABLE_DIRECTORY%\"\n:muon_recycle_loop\nif defined MUON_PROJECT_CONFIG (\n if not exist \"%MUON_PROJECT_CONFIG%\" (\n echo muon startup failed: project config does not exist: %MUON_PROJECT_CONFIG% 1>&2\n popd\n exit /b 1\n )\n \"%MUON_EXECUTABLE%\" -c \"%MUON_PROJECT_CONFIG%\" -c \"%MUON_OVERRIDE_CONFIG%\"\n) else (\n \"%MUON_EXECUTABLE%\" -c \"%MUON_OVERRIDE_CONFIG%\"\n)\nset \"MUON_EXIT_CODE=%ERRORLEVEL%\"\nif \"%MUON_EXIT_CODE%\"==\"%MUON_RECYCLE_EXIT_CODE%\" goto muon_recycle_loop\npopd\nexit /b %MUON_EXIT_CODE%\n`;\n\nexport const createMuonLaunchScript = (\n options: MuonLaunchScriptOptions,\n): string =>\n options.platform === \"win32\"\n ? createWindowsMuonLaunchScript(options)\n : createPosixMuonLaunchScript(options);\n\nconst getBaseUrl = (server: ViteDevServer): string | undefined =>\n server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0];\n\nconst getWebSocketOrigin = (startUrl: string): string => {\n const url = new URL(startUrl);\n if (url.protocol === \"https:\") {\n url.protocol = \"wss:\";\n } else if (url.protocol === \"http:\") {\n url.protocol = \"ws:\";\n }\n return url.origin;\n};\n\nconst createMuonOverrideConfig = (\n startUrl: string,\n enableDebugger: boolean,\n config: Readonly<Record<string, string>> | undefined,\n runtimePluginConfig: MuonRuntimePluginConfig,\n nodeProjectPath: string | undefined,\n): MuonOverrideConfig => {\n const origin = new URL(startUrl).origin;\n return {\n ...(config === undefined ? {} : { config: { ...config } }),\n ...(nodeProjectPath === undefined\n ? {}\n : {\n node: {\n project: nodeProjectPath,\n },\n }),\n ...(enableDebugger\n ? {\n cdp: {\n enable: true,\n },\n }\n : {}),\n browser: {\n startPage: startUrl,\n ...(enableDebugger\n ? {\n keybind: {\n devtools: \"f12\",\n recycle: \"ctrl+f12\",\n },\n }\n : {}),\n },\n plugin: {\n ...runtimePluginConfig,\n pages: [`${origin}/**`],\n },\n network: {\n allow: [`${origin}/**`, `${getWebSocketOrigin(startUrl)}/**`],\n },\n };\n};\n\nconst writeMuonOverrideConfig = (\n server: ViteDevServer,\n overrideConfigPath: string,\n pluginOptions: MuonVitePluginOptions,\n runtimePluginConfig: MuonRuntimePluginConfig,\n nodeProjectPath: string | undefined,\n): boolean => {\n const startUrl = getBaseUrl(server);\n if (startUrl === undefined) {\n server.config.logger.warn(\"muon Vite plugin could not resolve a Vite URL.\");\n return false;\n }\n writeFileSync(\n overrideConfigPath,\n `${JSON.stringify(\n createMuonOverrideConfig(\n startUrl,\n pluginOptions.enableDebugger !== false,\n pluginOptions.dev?.config,\n runtimePluginConfig,\n nodeProjectPath,\n ),\n null,\n 2,\n )}\\n`,\n );\n return true;\n};\n\nconst createRuntimePaths = async (): Promise<MuonRuntimePaths> => {\n const temporaryDirectory = await mkdtemp(join(tmpdir(), \"muon-vite-\"));\n return {\n temporaryDirectory,\n overrideConfigPath: join(temporaryDirectory, \"muon.vite.json\"),\n };\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst resolveProjectConfig = async (\n server: ViteDevServer,\n): Promise<MuonProjectConfigResolution> => {\n for (const fileName of defaultProjectConfigFileNames) {\n const candidatePath = join(server.config.root, fileName);\n if (!(await fileExists(candidatePath))) {\n continue;\n }\n\n try {\n const parsed = parse(await readFile(candidatePath, \"utf8\"));\n if (!isJsonObject(parsed)) {\n throw new Error(\"muon config root must be an object\");\n }\n return {\n path: candidatePath,\n config: parsed,\n };\n } catch (error) {\n server.config.logger.warn(\n `muon project config will be ignored because it could not be read or parsed: ${candidatePath}: ${getErrorMessage(error)}`,\n );\n return {\n path: undefined,\n config: undefined,\n };\n }\n }\n\n server.config.logger.warn(\n `muon project config was not found in ${server.config.root}; launching with generated Vite config only.`,\n );\n return {\n path: undefined,\n config: undefined,\n };\n};\n\nconst createMuonConfigArguments = (\n projectConfigPath: string | undefined,\n overrideConfigPath: string,\n): string[] => [\n ...(projectConfigPath === undefined ? [] : [\"-c\", projectConfigPath]),\n \"-c\",\n overrideConfigPath,\n];\n\nconst waitForMuonProcess = async (\n muonExecutablePath: string,\n configArguments: readonly string[],\n allowInsecureLocalhost: boolean,\n environment: NodeJS.ProcessEnv,\n setCurrentChild: (child: ChildProcess | undefined) => void,\n): Promise<number> => {\n const child = spawn(\n muonExecutablePath,\n [\n ...configArguments,\n ...(allowInsecureLocalhost ? [\"--allow-insecure-localhost\"] : []),\n ],\n {\n cwd: dirname(muonExecutablePath),\n env: environment,\n stdio: \"ignore\",\n windowsHide: false,\n },\n );\n setCurrentChild(child);\n try {\n return await new Promise<number>((resolvePromise, reject) => {\n child.once(\"error\", reject);\n child.once(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n } finally {\n setCurrentChild(undefined);\n }\n};\n\nexport const startMuonViteBrowserBridge = async ({\n server,\n pluginOptions,\n refreshRuntimePluginConfig,\n platform,\n architecture,\n environment,\n}: MuonViteSessionOptions): Promise<void> => {\n await ensureMuonGitignoreEntry(server.config.root);\n\n if (pluginOptions.open === false || server.httpServer === null) {\n return;\n }\n\n const target = getDefaultMuonPrepareTarget(platform, architecture);\n const muonPath = resolveMuonRuntimePath({\n root: server.config.root,\n target,\n muonPath: pluginOptions.muonPath,\n });\n const cefPath =\n pluginOptions.cefPath === undefined\n ? undefined\n : resolveFromRoot(server.config.root, pluginOptions.cefPath);\n const stagePath =\n pluginOptions.stagePath === undefined\n ? resolve(server.config.root, \".muon\", target)\n : resolveFromRoot(server.config.root, pluginOptions.stagePath);\n const paths = await createRuntimePaths();\n\n let currentChild: ChildProcess | undefined = undefined;\n let closing = false;\n let serverCloseRequested = false;\n let supervisorPromise: Promise<void> | undefined = undefined;\n\n const setCurrentChild = (child: ChildProcess | undefined): void => {\n currentChild = child;\n };\n\n const closeServerAfterMuonExit = (): void => {\n if (\n closing ||\n serverCloseRequested ||\n pluginOptions.exitWithServer === false\n ) {\n return;\n }\n serverCloseRequested = true;\n void server.close().catch((error: unknown) => {\n server.config.logger.warn(\n `muon could not close the Vite server after muon exited: ${getErrorMessage(error)}`,\n );\n });\n };\n\n const runSupervisor = async (): Promise<void> => {\n let exitCode = muonRecycleExitCode;\n while (!closing && exitCode === muonRecycleExitCode) {\n try {\n const projectConfig = await resolveProjectConfig(server);\n const nodeProject = await resolveMuonNodeProject(\n projectConfig.config,\n projectConfig.path === undefined\n ? server.config.root\n : dirname(projectConfig.path),\n );\n await assertMuonNodeProjectStagingIsSafe(nodeProject, stagePath);\n const runtimePluginConfig = await refreshRuntimePluginConfig();\n const preparedRuntime = await runMuonPrepare({\n muonPath,\n cefPath,\n stageDir: stagePath,\n target,\n cacheDir: environment.MUON_CACHE_DIR,\n nodeRuntimeRequirement: createMuonNodeRuntimeRequirement(\n nodeProject,\n true,\n ),\n force: false,\n quiet: false,\n prepareExecutablePath: undefined,\n environment,\n cwd: server.config.root,\n });\n if (preparedRuntime.stagePath === undefined) {\n throw new Error(\"muon-builder did not return a staged runtime path.\");\n }\n const nodeProjectPath = await stageMuonNodeProject(\n nodeProject,\n preparedRuntime.stagePath,\n );\n if (nodeProjectPath !== undefined) {\n await assertMuonNodeHostArtifacts(\n preparedRuntime.stagePath,\n platform,\n );\n }\n const configWritten = writeMuonOverrideConfig(\n server,\n paths.overrideConfigPath,\n pluginOptions,\n runtimePluginConfig,\n nodeProjectPath,\n );\n if (!configWritten || closing) {\n return;\n }\n exitCode = await waitForMuonProcess(\n getMuonExecutablePath(preparedRuntime.stagePath, platform),\n createMuonConfigArguments(\n projectConfig.path,\n paths.overrideConfigPath,\n ),\n pluginOptions.allowInsecureLocalhost === true,\n environment,\n setCurrentChild,\n );\n if (!closing && exitCode !== muonRecycleExitCode) {\n closeServerAfterMuonExit();\n }\n } catch (error) {\n if (!closing) {\n server.config.logger.warn(\n `muon startup failed: ${getErrorMessage(error)}`,\n );\n }\n return;\n }\n }\n };\n\n let cleanupPromise: Promise<void> | undefined = undefined;\n const cleanup = async (): Promise<void> => {\n if (cleanupPromise !== undefined) {\n return cleanupPromise;\n }\n cleanupPromise = (async () => {\n closing = true;\n currentChild?.kill();\n await supervisorPromise;\n await rm(paths.temporaryDirectory, { recursive: true, force: true });\n })();\n return cleanupPromise;\n };\n\n const originalClose = server.close.bind(server);\n server.close = async (): Promise<void> => {\n try {\n await originalClose();\n } finally {\n await cleanup();\n }\n };\n server.httpServer.once(\"close\", () => {\n void cleanup();\n });\n server.httpServer.once(\"listening\", () => {\n supervisorPromise = runSupervisor();\n });\n};\n"],"x_google_ignoreList":[4,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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aACA,IACF;IACA,OAAO;IACP,OAAO;IACP,uBAAuB,KAAA;IACvB;IACA,KAAK,OAAO,OAAO;GACrB,CAAC;GACD,IAAI,gBAAgB,cAAc,KAAA,GAChC,MAAM,IAAI,MAAM,oDAAoD;GAEtE,MAAM,kBAAkB,MAAM,qBAC5B,aACA,gBAAgB,SAClB;GACA,IAAI,oBAAoB,KAAA,GACtB,MAAM,4BACJ,gBAAgB,WAChB,QACF;GASF,IAAI,CAPkB,wBACpB,QACA,MAAM,oBACN,eACA,qBACA,eAEG,KAAiB,SACpB;GAEF,WAAW,MAAM,mBACf,sBAAsB,gBAAgB,WAAW,QAAQ,GACzD,0BACE,cAAc,MACd,MAAM,kBACR,GACA,cAAc,2BAA2B,MACzC,aACA,eACF;GACA,IAAI,CAAC,WAAW,aAAa,qBAC3B,yBAAyB;EAE7B,SAAS,OAAO;GACd,IAAI,CAAC,SACH,OAAO,OAAO,OAAO,KACnB,wBAAwB,gBAAgB,KAAK,GAC/C;GAEF;EACF;CAEJ;CAEA,IAAI,iBAA4C,KAAA;CAChD,MAAM,UAAU,YAA2B;EACzC,IAAI,mBAAmB,KAAA,GACrB,OAAO;EAET,kBAAkB,YAAY;GAC5B,UAAU;GACV,cAAc,KAAK;GACnB,MAAM;GACN,OAAA,GAAA,iBAAA,IAAS,MAAM,oBAAoB;IAAE,WAAW;IAAM,OAAO;GAAK,CAAC;EACrE,GAAG;EACH,OAAO;CACT;CAEA,MAAM,gBAAgB,OAAO,MAAM,KAAK,MAAM;CAC9C,OAAO,QAAQ,YAA2B;EACxC,IAAI;GACF,MAAM,cAAc;EACtB,UAAU;GACR,MAAM,QAAQ;EAChB;CACF;CACA,OAAO,WAAW,KAAK,eAAe;EACpC,QAAa;CACf,CAAC;CACD,OAAO,WAAW,KAAK,mBAAmB;EACxC,oBAAoB,cAAc;CACpC,CAAC;AACH"}
1
+ {"version":3,"file":"vite-internals-Dk85Y_D_.cjs","names":["module","exports"],"sources":["../src/targets.ts","../src/progress.ts","../src/prepare.ts","../src/gitignore.ts","../../node_modules/json5/dist/index.js","../src/embed-config.ts","../src/windows-icon.ts","../src/app-icon.ts","../src/windows-resource.ts","../src/linux-desktop.ts","../src/windows-code-signing.ts","../../node_modules/semver/internal/lrucache.js","../../node_modules/semver/internal/parse-options.js","../../node_modules/semver/internal/constants.js","../../node_modules/semver/internal/debug.js","../../node_modules/semver/internal/re.js","../../node_modules/semver/internal/identifiers.js","../../node_modules/semver/classes/semver.js","../../node_modules/semver/functions/compare.js","../../node_modules/semver/functions/eq.js","../../node_modules/semver/functions/neq.js","../../node_modules/semver/functions/gt.js","../../node_modules/semver/functions/gte.js","../../node_modules/semver/functions/lt.js","../../node_modules/semver/functions/lte.js","../../node_modules/semver/functions/cmp.js","../../node_modules/semver/classes/comparator.js","../../node_modules/semver/classes/range.js","../src/node-project.ts","../src/build.ts","../src/vite-options.ts","../src/vite-assets.ts","../src/build-sequence.ts","../src/vite-internals.ts"],"sourcesContent":["// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/**\n * Public muon target platform identifier.\n */\nexport type MuonTarget =\n | \"linux-amd64\"\n | \"linux-armhf\"\n | \"linux-arm64\"\n | \"windows-i686\"\n | \"windows-amd64\";\n\n/**\n * Internal CEF target platform identifier.\n */\nexport type MuonCefTarget =\n | \"linux64\"\n | \"linuxarm\"\n | \"linuxarm64\"\n | \"windows32\"\n | \"windows64\";\n\n/**\n * muon target operating system family.\n */\nexport type MuonTargetOperatingSystem = \"linux\" | \"windows\";\n\n/**\n * Metadata for one supported muon target.\n */\nexport interface MuonTargetDescriptor {\n /**\n * Public target identifier accepted by muon CLI and Vite options.\n */\n id: MuonTarget;\n /**\n * Internal CEF target identifier used for CEF catalog and native builds.\n */\n cefTarget: MuonCefTarget;\n /**\n * Operating system family.\n */\n os: MuonTargetOperatingSystem;\n /**\n * Public architecture name used in package artifact names.\n */\n arch: \"amd64\" | \"armhf\" | \"arm64\" | \"i686\";\n /**\n * Fixed dist directory path for generated app distributions.\n */\n distributionDirectoryName: string;\n /**\n * muon-core executable file name for this target.\n */\n runtimeExecutableName: string;\n /**\n * Runtime executable file names other than {@link runtimeExecutableName}.\n *\n * @remarks Every entry must also be present in {@link runtimeFiles}. Generated\n * distributions normalize these files to executable mode.\n */\n runtimeAuxiliaryExecutableNames: readonly string[];\n /**\n * muon-launcher executable file name for this target.\n */\n launcherExecutableName: string;\n /**\n * Optional privileged runtime helper executable file name.\n */\n runtimeHelperExecutableName?: string;\n /**\n * Launcher file suffix for app launcher executables.\n */\n launcherExtension: string;\n /**\n * Required runtime files copied into generated app distributions.\n */\n runtimeFiles: readonly string[];\n /**\n * Optional runtime files copied when they exist.\n */\n optionalRuntimeFilePatterns?: readonly RegExp[];\n}\n\n/**\n * Supported public muon targets in deterministic build order.\n */\nexport const allMuonTargets = [\n \"linux-amd64\",\n \"linux-armhf\",\n \"linux-arm64\",\n \"windows-i686\",\n \"windows-amd64\",\n] as const satisfies readonly MuonTarget[];\n\nconst targetDescriptors = {\n \"linux-amd64\": {\n id: \"linux-amd64\",\n cefTarget: \"linux64\",\n os: \"linux\",\n arch: \"amd64\",\n distributionDirectoryName: \"dist-muon/linux-amd64\",\n runtimeExecutableName: \"muon-core\",\n runtimeAuxiliaryExecutableNames: [\"muon-executor-supervisor\"],\n launcherExecutableName: \"muon-launcher\",\n runtimeHelperExecutableName: \"muon-runtime-helper\",\n launcherExtension: \"\",\n runtimeFiles: [\n \"muon-core\",\n \"muon-executor-supervisor\",\n \"libmuon-ui.so\",\n \"libcardio.so\",\n ],\n },\n \"linux-armhf\": {\n id: \"linux-armhf\",\n cefTarget: \"linuxarm\",\n os: \"linux\",\n arch: \"armhf\",\n distributionDirectoryName: \"dist-muon/linux-armhf\",\n runtimeExecutableName: \"muon-core\",\n runtimeAuxiliaryExecutableNames: [\"muon-executor-supervisor\"],\n launcherExecutableName: \"muon-launcher\",\n runtimeHelperExecutableName: \"muon-runtime-helper\",\n launcherExtension: \"\",\n runtimeFiles: [\n \"muon-core\",\n \"muon-executor-supervisor\",\n \"libmuon-ui.so\",\n \"libcardio.so\",\n ],\n },\n \"linux-arm64\": {\n id: \"linux-arm64\",\n cefTarget: \"linuxarm64\",\n os: \"linux\",\n arch: \"arm64\",\n distributionDirectoryName: \"dist-muon/linux-arm64\",\n runtimeExecutableName: \"muon-core\",\n runtimeAuxiliaryExecutableNames: [\"muon-executor-supervisor\"],\n launcherExecutableName: \"muon-launcher\",\n runtimeHelperExecutableName: \"muon-runtime-helper\",\n launcherExtension: \"\",\n runtimeFiles: [\n \"muon-core\",\n \"muon-executor-supervisor\",\n \"libmuon-ui.so\",\n \"libcardio.so\",\n ],\n },\n \"windows-i686\": {\n id: \"windows-i686\",\n cefTarget: \"windows32\",\n os: \"windows\",\n arch: \"i686\",\n distributionDirectoryName: \"dist-muon/windows-i686\",\n runtimeExecutableName: \"muon-core.exe\",\n runtimeAuxiliaryExecutableNames: [],\n launcherExecutableName: \"muon-launcher.exe\",\n launcherExtension: \".exe\",\n runtimeFiles: [\"muon-core.exe\", \"libmuon-ui.dll\", \"libcardio.dll\"],\n optionalRuntimeFilePatterns: [\n /^libgcc_s_.*-1\\.dll$/,\n /^libstdc\\+\\+-6\\.dll$/,\n /^libwinpthread-1\\.dll$/,\n ],\n },\n \"windows-amd64\": {\n id: \"windows-amd64\",\n cefTarget: \"windows64\",\n os: \"windows\",\n arch: \"amd64\",\n distributionDirectoryName: \"dist-muon/windows-amd64\",\n runtimeExecutableName: \"muon-core.exe\",\n runtimeAuxiliaryExecutableNames: [],\n launcherExecutableName: \"muon-launcher.exe\",\n launcherExtension: \".exe\",\n runtimeFiles: [\"muon-core.exe\", \"libmuon-ui.dll\", \"libcardio.dll\"],\n optionalRuntimeFilePatterns: [\n /^libgcc_s_.*-1\\.dll$/,\n /^libstdc\\+\\+-6\\.dll$/,\n /^libwinpthread-1\\.dll$/,\n ],\n },\n} as const satisfies Record<MuonTarget, MuonTargetDescriptor>;\n\nconst targetByCefTarget = Object.fromEntries(\n allMuonTargets.map((target) => [targetDescriptors[target].cefTarget, target]),\n) as Record<MuonCefTarget, MuonTarget>;\n\n/**\n * Returns metadata for a public muon target.\n *\n * @param target Public muon target.\n * @returns Target descriptor.\n */\nexport const getMuonTargetDescriptor = (\n target: MuonTarget,\n): MuonTargetDescriptor => targetDescriptors[target];\n\n/**\n * Returns the runtime app identifier embedded for one target distribution.\n *\n * @param appId Base sanitized application identifier.\n * @param target Public muon target.\n * @returns Target runtime application identifier.\n *\n * @remarks Windows targets append their public architecture name so 32-bit and\n * 64-bit packages do not share runtime state or installer identities.\n */\nexport const getMuonTargetRuntimeAppId = (\n appId: string,\n target: MuonTarget,\n): string => {\n const descriptor = getMuonTargetDescriptor(target);\n return descriptor.os === \"windows\" ? `${appId}.${descriptor.arch}` : appId;\n};\n\n/**\n * Normalizes a user supplied public muon target.\n *\n * @param target Target value supplied by the user.\n * @param label Error label used in diagnostics.\n * @returns Public muon target.\n */\nexport const normalizeMuonTarget = (\n target: string,\n label = \"muon target\",\n): MuonTarget => {\n const normalized = target.trim().toLowerCase();\n if (allMuonTargets.includes(normalized as MuonTarget)) {\n return normalized as MuonTarget;\n }\n throw new Error(`Unsupported ${label}: ${target}`);\n};\n\n/**\n * Resolves a Node platform and architecture pair to a public muon target.\n *\n * @param platform Node platform.\n * @param architecture Node architecture.\n * @returns Public muon target.\n */\nexport const getDefaultMuonTarget = (\n platform: NodeJS.Platform,\n architecture: NodeJS.Architecture,\n): MuonTarget => {\n if (platform === \"win32\") {\n if (architecture === \"ia32\") {\n return \"windows-i686\";\n }\n if (architecture === \"x64\") {\n return \"windows-amd64\";\n }\n }\n if (platform === \"linux\") {\n if (architecture === \"x64\") {\n return \"linux-amd64\";\n }\n if (architecture === \"arm\") {\n return \"linux-armhf\";\n }\n if (architecture === \"arm64\") {\n return \"linux-arm64\";\n }\n }\n throw new Error(\n `Unsupported muon target: platform=${platform}, arch=${architecture}`,\n );\n};\n\n/**\n * Resolves an internal CEF target to a public muon target.\n *\n * @param cefTarget Internal CEF target.\n * @returns Public muon target.\n */\nexport const getMuonTargetForCefTarget = (\n cefTarget: MuonCefTarget,\n): MuonTarget => targetByCefTarget[cefTarget];\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/**\n * Progress event used by internal muon build, pack, and prepare operations.\n *\n * @internal\n */\nexport interface MuonProgressEvent {\n /**\n * Stable phase identifier.\n *\n * @internal\n */\n phase: string;\n\n /**\n * Human-readable single-line status.\n *\n * @internal\n */\n status: string;\n\n /**\n * Current progress value.\n *\n * @internal\n */\n current?: number;\n\n /**\n * Total progress value.\n *\n * @internal\n */\n total?: number;\n\n /**\n * True when current and total form bounded progress.\n *\n * @internal\n */\n determinate?: boolean;\n}\n\n/**\n * Receives internal muon progress events.\n *\n * @internal\n */\nexport type MuonProgressCallback = (event: MuonProgressEvent) => void;\n\n/**\n * Renders internal muon progress events to stderr.\n *\n * @internal\n */\nexport interface MuonProgressRenderer {\n /**\n * Render a progress event.\n *\n * @internal\n */\n report(event: MuonProgressEvent): void;\n\n /**\n * Complete the active status line.\n *\n * @internal\n */\n flush(): void;\n}\n\nconst spinnerFrames = [\"-\", \"\\\\\", \"|\", \"/\"] as const;\nconst spinnerIntervalMilliseconds = 200;\nconst terminalLineStart = \"\\r\";\nconst terminalClearLine = \"\\x1b[K\";\n\nconst clampProgressValue = (value: number, total: number): number =>\n Math.max(0, Math.min(value, total));\n\nconst formatProgressEvent = (event: MuonProgressEvent): string => {\n const status = event.status.trimEnd();\n const current = event.current ?? 0;\n const total = event.total ?? 0;\n if (event.determinate === true && total > 0) {\n const percentage = Math.floor(\n (clampProgressValue(current, total) / total) * 100,\n );\n return `${status} ${percentage}%`;\n }\n if (event.phase === \"installing\" && current > 0) {\n return `${status} ${Math.trunc(current)} files`;\n }\n return status;\n};\n\ninterface ActiveProgressLine {\n key: string;\n text: string;\n}\n\nconst getProgressLineKey = (event: MuonProgressEvent): string =>\n `${event.phase}\\0${event.status.trimEnd()}`;\n\nconst createSpinnerProgressRenderer = (): MuonProgressRenderer => {\n let activeLine: ActiveProgressLine | undefined = undefined;\n let frameIndex = 0;\n let timer: NodeJS.Timeout | undefined = undefined;\n\n const writeRaw = (chunk: string): void => {\n process.stderr.write(chunk);\n };\n\n const stopTimer = (): void => {\n if (timer !== undefined) {\n clearInterval(timer);\n timer = undefined;\n }\n };\n\n const renderLine = (): void => {\n if (activeLine === undefined) {\n return;\n }\n const frame = spinnerFrames[frameIndex] ?? spinnerFrames[0];\n writeRaw(\n `${terminalLineStart}${frame} ${activeLine.text}${terminalClearLine}`,\n );\n frameIndex = (frameIndex + 1) % spinnerFrames.length;\n };\n\n const ensureTimer = (): void => {\n if (timer === undefined) {\n timer = setInterval(renderLine, spinnerIntervalMilliseconds);\n timer.unref();\n }\n };\n\n const finishLine = (): void => {\n if (activeLine === undefined) {\n return;\n }\n stopTimer();\n const text = activeLine.text;\n activeLine = undefined;\n frameIndex = 0;\n writeRaw(`${terminalLineStart}${text}${terminalClearLine}\\n`);\n };\n\n return {\n report: (event): void => {\n const nextLine = {\n key: getProgressLineKey(event),\n text: formatProgressEvent(event),\n };\n if (activeLine === undefined) {\n activeLine = nextLine;\n renderLine();\n ensureTimer();\n return;\n }\n if (activeLine.key !== nextLine.key) {\n finishLine();\n activeLine = nextLine;\n renderLine();\n } else {\n activeLine = nextLine;\n }\n ensureTimer();\n },\n flush: finishLine,\n };\n};\n\n/**\n * Creates a stderr progress renderer for the current terminal mode.\n *\n * @internal\n */\nexport const createMuonProgressRenderer = (): MuonProgressRenderer =>\n createSpinnerProgressRenderer();\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn } from \"node:child_process\";\nimport { constants } from \"node:fs\";\nimport { access } from \"node:fs/promises\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, join } from \"node:path\";\nimport {\n getDefaultMuonTarget,\n normalizeMuonTarget,\n type MuonTarget,\n} from \"./targets.js\";\nimport {\n createMuonProgressRenderer,\n type MuonProgressEvent,\n} from \"./progress.js\";\nimport type { MuonNodeRuntimeRequirement } from \"./node-project.js\";\n\n/**\n * Options used to invoke the native muon builder helper.\n */\nexport interface MuonPrepareOptions {\n /**\n * Directory containing muon-core runtime files.\n */\n muonPath: string;\n\n /**\n * Directory containing CEF files, or a CEF archive root with Release/Resources.\n */\n cefPath: string | undefined;\n\n /**\n * Directory where the executable runtime is staged.\n */\n stageDir: string | undefined;\n\n /**\n * Public target runtime platform such as linux-amd64 or windows-amd64.\n */\n target: string | undefined;\n\n /**\n * Cache directory passed to muon-builder.\n */\n cacheDir: string | undefined;\n\n /**\n * Node runtime requirement used to select or validate a sidecar runtime.\n *\n * @remarks This is `undefined` when the application has no Node project.\n */\n nodeRuntimeRequirement: MuonNodeRuntimeRequirement | undefined;\n\n /**\n * Rebuild an existing prepared runtime.\n */\n force: boolean;\n\n /**\n * Suppress progress messages from the native builder process.\n */\n quiet: boolean;\n\n /**\n * Explicit native muon-builder executable path.\n */\n prepareExecutablePath: string | undefined;\n\n /**\n * Environment used for the child process.\n */\n environment: NodeJS.ProcessEnv;\n\n /**\n * Working directory used for the child process.\n */\n cwd: string | undefined;\n}\n\n/**\n * Options used to update Windows PE resources through the native muon helper.\n */\nexport interface MuonPrepareResourceUpdateOptions {\n /**\n * Input PE executable path.\n */\n inputPath: string;\n\n /**\n * Engraver update JSON path.\n */\n updatesJsonPath: string;\n\n /**\n * Output PE executable path.\n *\n * @remarks This must be different from `inputPath`.\n */\n outputPath: string;\n\n /**\n * Suppress progress messages from the native builder process.\n */\n quiet: boolean;\n\n /**\n * Explicit native muon-builder executable path.\n */\n prepareExecutablePath: string | undefined;\n\n /**\n * Environment used for the child process.\n */\n environment: NodeJS.ProcessEnv;\n\n /**\n * Working directory used for the child process.\n */\n cwd: string | undefined;\n}\n\n/**\n * Result returned by native muon-builder.\n */\nexport interface MuonPrepareResult {\n /**\n * Directory containing the staged muon runtime.\n */\n stagePath?: string;\n\n /**\n * Directory containing muon-core files used as the staging source.\n */\n muonPath: string;\n\n /**\n * Directory or cached archive containing CEF files used as the staging source.\n */\n cefPath: string;\n\n /**\n * True when an existing prepared runtime was reused.\n */\n cacheHit: boolean;\n}\n\n/**\n * Returns the default muon prepare target for a Node platform and architecture.\n *\n * @param platform Node platform.\n * @param architecture Node architecture.\n * @returns muon prepare target name.\n */\nexport const getDefaultMuonPrepareTarget = (\n platform: NodeJS.Platform,\n architecture: NodeJS.Architecture,\n): MuonTarget => {\n try {\n return getDefaultMuonTarget(platform, architecture);\n } catch {\n throw new Error(\n `Unsupported muon prepare target: platform=${platform}, arch=${architecture}`,\n );\n }\n};\n\nconst getBuilderExecutableName = (platform: NodeJS.Platform): string =>\n platform === \"win32\" ? \"muon-builder.exe\" : \"muon-builder\";\n\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\nconst canExecute = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst resolveMuonBuilderExecutable = async (\n options: Pick<MuonPrepareOptions, \"prepareExecutablePath\" | \"environment\">,\n): Promise<string> => {\n const explicit =\n options.prepareExecutablePath ?? options.environment.MUON_BUILDER_PATH;\n if (explicit !== undefined && explicit !== \"\") {\n return explicit;\n }\n const executableName = getBuilderExecutableName(process.platform);\n const target = getDefaultMuonPrepareTarget(process.platform, process.arch);\n const candidates = [\n join(moduleDirectory, \"native\", target, executableName),\n join(moduleDirectory, \"..\", \"dist\", \"native\", target, executableName),\n ];\n for (const candidate of candidates) {\n if (await canExecute(candidate)) {\n return candidate;\n }\n }\n return candidates[0] ?? executableName;\n};\n\nconst createMuonPrepareArguments = (options: MuonPrepareOptions): string[] => {\n const args = [\"runtime\", \"--muon-path\", options.muonPath, \"--json\"];\n if (!options.quiet) {\n args.push(\"--progress-json\");\n }\n if (options.cefPath !== undefined) {\n args.push(\"--cef-path\", options.cefPath);\n }\n if (options.stageDir !== undefined) {\n args.push(\"--stage-dir\", options.stageDir);\n }\n if (options.target !== undefined) {\n args.push(\n \"--target\",\n normalizeMuonTarget(options.target, \"muon prepare target\"),\n );\n }\n if (options.cacheDir !== undefined) {\n args.push(\"--cache-dir\", options.cacheDir);\n }\n if (options.nodeRuntimeRequirement !== undefined) {\n args.push(\n \"--node-runtime-requirement\",\n JSON.stringify(options.nodeRuntimeRequirement),\n );\n }\n if (options.force) {\n args.push(\"--force\");\n }\n if (options.quiet) {\n args.push(\"--quiet\");\n }\n return args;\n};\n\ninterface MuonPrepareStderrForwarder {\n write(chunk: string): void;\n flush(): void;\n}\n\nconst createPlainStderrForwarder = (): MuonPrepareStderrForwarder => ({\n write: (chunk): void => {\n process.stderr.write(chunk);\n },\n flush: (): void => {},\n});\n\nconst parseProgressJsonLine = (line: string): MuonProgressEvent | undefined => {\n const trimmed = line.trim();\n if (!trimmed.startsWith(\"{\")) {\n return undefined;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed);\n } catch {\n return undefined;\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const event = parsed as Record<string, unknown>;\n if (typeof event.phase !== \"string\" || typeof event.status !== \"string\") {\n return undefined;\n }\n const current =\n typeof event.current === \"number\" && Number.isFinite(event.current)\n ? event.current\n : undefined;\n const total =\n typeof event.total === \"number\" && Number.isFinite(event.total)\n ? event.total\n : undefined;\n const determinate =\n typeof event.determinate === \"boolean\" ? event.determinate : undefined;\n return {\n phase: event.phase,\n status: event.status,\n ...(current === undefined ? {} : { current }),\n ...(total === undefined ? {} : { total }),\n ...(determinate === undefined ? {} : { determinate }),\n };\n};\n\nconst createProgressJsonStderrForwarder = (): MuonPrepareStderrForwarder => {\n let pending = \"\";\n const renderer = createMuonProgressRenderer();\n\n const writeLine = (line: string): void => {\n const event = parseProgressJsonLine(line);\n if (event !== undefined) {\n renderer.report(event);\n }\n };\n\n return {\n write: (chunk): void => {\n pending += chunk;\n for (;;) {\n const newlineIndex = pending.indexOf(\"\\n\");\n if (newlineIndex < 0) {\n break;\n }\n const line = pending.slice(0, newlineIndex + 1);\n pending = pending.slice(newlineIndex + 1);\n writeLine(line);\n }\n },\n flush: (): void => {\n if (pending.length > 0) {\n const line = pending;\n pending = \"\";\n writeLine(line);\n }\n renderer.flush();\n },\n };\n};\n\nconst runMuonPrepareCommand = async (\n options: Pick<MuonPrepareOptions, \"prepareExecutablePath\" | \"environment\"> & {\n args: readonly string[];\n cwd: string | undefined;\n quiet: boolean;\n parseProgressJson: boolean;\n },\n): Promise<string> => {\n const executable = await resolveMuonBuilderExecutable(options);\n const child = spawn(executable, [...options.args], {\n cwd: options.cwd,\n env: options.environment,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n let stdout = \"\";\n let stderr = \"\";\n child.stdout.setEncoding(\"utf8\");\n child.stderr.setEncoding(\"utf8\");\n const stderrForwarder = options.quiet\n ? undefined\n : options.parseProgressJson\n ? createProgressJsonStderrForwarder()\n : createPlainStderrForwarder();\n child.stdout.on(\"data\", (chunk: string) => {\n stdout += chunk;\n });\n child.stderr.on(\"data\", (chunk: string) => {\n stderr += chunk;\n stderrForwarder?.write(chunk);\n });\n const exitCode = await (async (): Promise<number> => {\n try {\n return await new Promise<number>((resolvePromise, reject) => {\n child.on(\"error\", reject);\n child.on(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n } finally {\n stderrForwarder?.flush();\n }\n })();\n if (exitCode !== 0) {\n throw new Error(\n `muon-builder failed with exit code ${exitCode}.\\n${stderr.trim()}`,\n );\n }\n return stdout;\n};\n\n/**\n * Invokes the native muon-builder executable and returns the prepared runtime.\n *\n * @param options Native prepare invocation options.\n * @returns Prepared runtime location.\n */\nexport const runMuonPrepare = async (\n options: MuonPrepareOptions,\n): Promise<MuonPrepareResult> => {\n const args = createMuonPrepareArguments(options);\n const stdout = await runMuonPrepareCommand({\n prepareExecutablePath: options.prepareExecutablePath,\n environment: options.environment,\n cwd: options.cwd,\n quiet: options.quiet,\n parseProgressJson: !options.quiet,\n args,\n });\n const result = JSON.parse(stdout) as Partial<MuonPrepareResult>;\n if (\n (result.stagePath !== undefined && typeof result.stagePath !== \"string\") ||\n typeof result.muonPath !== \"string\" ||\n typeof result.cefPath !== \"string\" ||\n typeof result.cacheHit !== \"boolean\"\n ) {\n throw new Error(`muon-builder returned invalid JSON: ${stdout}`);\n }\n return {\n ...(result.stagePath === undefined ? {} : { stagePath: result.stagePath }),\n muonPath: result.muonPath,\n cefPath: result.cefPath,\n cacheHit: result.cacheHit,\n };\n};\n\n/**\n * Invokes the native muon-builder executable to write Windows PE resources.\n *\n * @param options Resource update invocation options.\n */\nexport const runMuonPrepareResourceUpdate = async (\n options: MuonPrepareResourceUpdateOptions,\n): Promise<void> => {\n await runMuonPrepareCommand({\n prepareExecutablePath: options.prepareExecutablePath,\n environment: options.environment,\n cwd: options.cwd,\n quiet: options.quiet,\n parseProgressJson: false,\n args: [\n \"resource\",\n \"--input\",\n options.inputPath,\n \"--updates-json\",\n options.updatesJsonPath,\n \"--output\",\n options.outputPath,\n ...(options.quiet ? [\"--quiet\"] : []),\n ],\n });\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nconst muonGitignoreEntries = [\".muon/\", \"dist-muon/\", \"artifacts/\"] as const;\n\ntype MuonGitignoreEntry = (typeof muonGitignoreEntries)[number];\n\nconst muonGitignoreEntryAliases: Record<MuonGitignoreEntry, readonly string[]> =\n {\n \".muon/\": [\".muon/\", \"/.muon/\", \".muon\", \"/.muon\"],\n \"dist-muon/\": [\n \"dist-muon/\",\n \"/dist-muon/\",\n \"dist-muon\",\n \"/dist-muon\",\n \"dist-muon/*\",\n \"/dist-muon/*\",\n ],\n \"artifacts/\": [\"artifacts/\", \"/artifacts/\", \"artifacts\", \"/artifacts\"],\n };\n\n/**\n * Result of ensuring muon generated directories are ignored by Git.\n */\nexport interface MuonGitignoreResult {\n /**\n * Path of the .gitignore file that was checked or updated.\n */\n gitignorePath: string;\n\n /**\n * True when the file was created or appended.\n */\n changed: boolean;\n}\n\nconst isMissingFileError = (error: unknown): boolean =>\n error instanceof Error && (error as NodeJS.ErrnoException).code === \"ENOENT\";\n\nconst hasMuonGitignoreEntry = (\n content: string,\n entry: MuonGitignoreEntry,\n): boolean =>\n content\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .some((line) => muonGitignoreEntryAliases[entry].includes(line));\n\n/**\n * Adds muon generated directories to a project .gitignore file.\n *\n * @param root Project root containing the .gitignore file.\n * @returns Gitignore update result.\n */\nexport const ensureMuonGitignoreEntry = async (\n root: string,\n): Promise<MuonGitignoreResult> => {\n const gitignorePath = join(root, \".gitignore\");\n let content = \"\";\n try {\n content = await readFile(gitignorePath, \"utf8\");\n } catch (error) {\n if (!isMissingFileError(error)) {\n throw error;\n }\n }\n\n const missingEntries = muonGitignoreEntries.filter(\n (entry) => !hasMuonGitignoreEntry(content, entry),\n );\n if (missingEntries.length === 0) {\n return {\n gitignorePath,\n changed: false,\n };\n }\n\n const separator = content.length > 0 && !content.endsWith(\"\\n\") ? \"\\n\" : \"\";\n await writeFile(\n gitignorePath,\n `${content}${separator}${missingEntries.join(\"\\n\")}\\n`,\n );\n return {\n gitignorePath,\n changed: true,\n };\n};\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.JSON5 = factory());\n}(this, (function () { 'use strict';\n\n\tfunction createCommonjsModule(fn, module) {\n\t\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n\t}\n\n\tvar _global = createCommonjsModule(function (module) {\n\t// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\n\tvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n\t ? window : typeof self != 'undefined' && self.Math == Math ? self\n\t // eslint-disable-next-line no-new-func\n\t : Function('return this')();\n\tif (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef\n\t});\n\n\tvar _core = createCommonjsModule(function (module) {\n\tvar core = module.exports = { version: '2.6.5' };\n\tif (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef\n\t});\n\tvar _core_1 = _core.version;\n\n\tvar _isObject = function (it) {\n\t return typeof it === 'object' ? it !== null : typeof it === 'function';\n\t};\n\n\tvar _anObject = function (it) {\n\t if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }\n\t return it;\n\t};\n\n\tvar _fails = function (exec) {\n\t try {\n\t return !!exec();\n\t } catch (e) {\n\t return true;\n\t }\n\t};\n\n\t// Thank's IE8 for his funny defineProperty\n\tvar _descriptors = !_fails(function () {\n\t return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n\t});\n\n\tvar document = _global.document;\n\t// typeof document.createElement is 'object' in old IE\n\tvar is = _isObject(document) && _isObject(document.createElement);\n\tvar _domCreate = function (it) {\n\t return is ? document.createElement(it) : {};\n\t};\n\n\tvar _ie8DomDefine = !_descriptors && !_fails(function () {\n\t return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;\n\t});\n\n\t// 7.1.1 ToPrimitive(input [, PreferredType])\n\n\t// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n\t// and the second argument - flag - preferred type is a string\n\tvar _toPrimitive = function (it, S) {\n\t if (!_isObject(it)) { return it; }\n\t var fn, val;\n\t if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }\n\t if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }\n\t if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }\n\t throw TypeError(\"Can't convert object to primitive value\");\n\t};\n\n\tvar dP = Object.defineProperty;\n\n\tvar f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n\t _anObject(O);\n\t P = _toPrimitive(P, true);\n\t _anObject(Attributes);\n\t if (_ie8DomDefine) { try {\n\t return dP(O, P, Attributes);\n\t } catch (e) { /* empty */ } }\n\t if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }\n\t if ('value' in Attributes) { O[P] = Attributes.value; }\n\t return O;\n\t};\n\n\tvar _objectDp = {\n\t\tf: f\n\t};\n\n\tvar _propertyDesc = function (bitmap, value) {\n\t return {\n\t enumerable: !(bitmap & 1),\n\t configurable: !(bitmap & 2),\n\t writable: !(bitmap & 4),\n\t value: value\n\t };\n\t};\n\n\tvar _hide = _descriptors ? function (object, key, value) {\n\t return _objectDp.f(object, key, _propertyDesc(1, value));\n\t} : function (object, key, value) {\n\t object[key] = value;\n\t return object;\n\t};\n\n\tvar hasOwnProperty = {}.hasOwnProperty;\n\tvar _has = function (it, key) {\n\t return hasOwnProperty.call(it, key);\n\t};\n\n\tvar id = 0;\n\tvar px = Math.random();\n\tvar _uid = function (key) {\n\t return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n\t};\n\n\tvar _library = false;\n\n\tvar _shared = createCommonjsModule(function (module) {\n\tvar SHARED = '__core-js_shared__';\n\tvar store = _global[SHARED] || (_global[SHARED] = {});\n\n\t(module.exports = function (key, value) {\n\t return store[key] || (store[key] = value !== undefined ? value : {});\n\t})('versions', []).push({\n\t version: _core.version,\n\t mode: _library ? 'pure' : 'global',\n\t copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n\t});\n\t});\n\n\tvar _functionToString = _shared('native-function-to-string', Function.toString);\n\n\tvar _redefine = createCommonjsModule(function (module) {\n\tvar SRC = _uid('src');\n\n\tvar TO_STRING = 'toString';\n\tvar TPL = ('' + _functionToString).split(TO_STRING);\n\n\t_core.inspectSource = function (it) {\n\t return _functionToString.call(it);\n\t};\n\n\t(module.exports = function (O, key, val, safe) {\n\t var isFunction = typeof val == 'function';\n\t if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }\n\t if (O[key] === val) { return; }\n\t if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }\n\t if (O === _global) {\n\t O[key] = val;\n\t } else if (!safe) {\n\t delete O[key];\n\t _hide(O, key, val);\n\t } else if (O[key]) {\n\t O[key] = val;\n\t } else {\n\t _hide(O, key, val);\n\t }\n\t// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n\t})(Function.prototype, TO_STRING, function toString() {\n\t return typeof this == 'function' && this[SRC] || _functionToString.call(this);\n\t});\n\t});\n\n\tvar _aFunction = function (it) {\n\t if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }\n\t return it;\n\t};\n\n\t// optional / simple context binding\n\n\tvar _ctx = function (fn, that, length) {\n\t _aFunction(fn);\n\t if (that === undefined) { return fn; }\n\t switch (length) {\n\t case 1: return function (a) {\n\t return fn.call(that, a);\n\t };\n\t case 2: return function (a, b) {\n\t return fn.call(that, a, b);\n\t };\n\t case 3: return function (a, b, c) {\n\t return fn.call(that, a, b, c);\n\t };\n\t }\n\t return function (/* ...args */) {\n\t return fn.apply(that, arguments);\n\t };\n\t};\n\n\tvar PROTOTYPE = 'prototype';\n\n\tvar $export = function (type, name, source) {\n\t var IS_FORCED = type & $export.F;\n\t var IS_GLOBAL = type & $export.G;\n\t var IS_STATIC = type & $export.S;\n\t var IS_PROTO = type & $export.P;\n\t var IS_BIND = type & $export.B;\n\t var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];\n\t var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});\n\t var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n\t var key, own, out, exp;\n\t if (IS_GLOBAL) { source = name; }\n\t for (key in source) {\n\t // contains in native\n\t own = !IS_FORCED && target && target[key] !== undefined;\n\t // export native or passed\n\t out = (own ? target : source)[key];\n\t // bind timers to global for call from export context\n\t exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;\n\t // extend global\n\t if (target) { _redefine(target, key, out, type & $export.U); }\n\t // export\n\t if (exports[key] != out) { _hide(exports, key, exp); }\n\t if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }\n\t }\n\t};\n\t_global.core = _core;\n\t// type bitmap\n\t$export.F = 1; // forced\n\t$export.G = 2; // global\n\t$export.S = 4; // static\n\t$export.P = 8; // proto\n\t$export.B = 16; // bind\n\t$export.W = 32; // wrap\n\t$export.U = 64; // safe\n\t$export.R = 128; // real proto method for `library`\n\tvar _export = $export;\n\n\t// 7.1.4 ToInteger\n\tvar ceil = Math.ceil;\n\tvar floor = Math.floor;\n\tvar _toInteger = function (it) {\n\t return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n\t};\n\n\t// 7.2.1 RequireObjectCoercible(argument)\n\tvar _defined = function (it) {\n\t if (it == undefined) { throw TypeError(\"Can't call method on \" + it); }\n\t return it;\n\t};\n\n\t// true -> String#at\n\t// false -> String#codePointAt\n\tvar _stringAt = function (TO_STRING) {\n\t return function (that, pos) {\n\t var s = String(_defined(that));\n\t var i = _toInteger(pos);\n\t var l = s.length;\n\t var a, b;\n\t if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }\n\t a = s.charCodeAt(i);\n\t return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n\t ? TO_STRING ? s.charAt(i) : a\n\t : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n\t };\n\t};\n\n\tvar $at = _stringAt(false);\n\t_export(_export.P, 'String', {\n\t // 21.1.3.3 String.prototype.codePointAt(pos)\n\t codePointAt: function codePointAt(pos) {\n\t return $at(this, pos);\n\t }\n\t});\n\n\tvar codePointAt = _core.String.codePointAt;\n\n\tvar max = Math.max;\n\tvar min = Math.min;\n\tvar _toAbsoluteIndex = function (index, length) {\n\t index = _toInteger(index);\n\t return index < 0 ? max(index + length, 0) : min(index, length);\n\t};\n\n\tvar fromCharCode = String.fromCharCode;\n\tvar $fromCodePoint = String.fromCodePoint;\n\n\t// length should be 1, old FF problem\n\t_export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {\n\t // 21.1.2.2 String.fromCodePoint(...codePoints)\n\t fromCodePoint: function fromCodePoint(x) {\n\t var arguments$1 = arguments;\n\t // eslint-disable-line no-unused-vars\n\t var res = [];\n\t var aLen = arguments.length;\n\t var i = 0;\n\t var code;\n\t while (aLen > i) {\n\t code = +arguments$1[i++];\n\t if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }\n\t res.push(code < 0x10000\n\t ? fromCharCode(code)\n\t : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)\n\t );\n\t } return res.join('');\n\t }\n\t});\n\n\tvar fromCodePoint = _core.String.fromCodePoint;\n\n\t// This is a generated file. Do not edit.\n\tvar Space_Separator = /[\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/;\n\tvar ID_Start = /[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312E\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FEA\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFF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C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCA0-\\uDCDF\\uDCFF\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE83\\uDE86-\\uDE89\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00-\\uDD1E\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE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u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u0860-\\u086A\\u08A0-\\u08B4\\u08B6-\\u08BD\\u08D4-\\u08E1\\u08E3-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u09FC\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0AF9-\\u0AFF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\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\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1C80-\\u1C88\\u1CD0-\\u1CD2\\u1CD4-\\u1CF9\\u1D00-\\u1DF9\\u1DFB-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312E\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FEA\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C5\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA8FD\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\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-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEEA\\uDEF0-\\uDEF9\\uDF00-\\uDF03\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3C-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF50\\uDF57\\uDF5D-\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74]|\\uD805[\\uDC00-\\uDC4A\\uDC50-\\uDC59\\uDC80-\\uDCC5\\uDCC7\\uDCD0-\\uDCD9\\uDD80-\\uDDB5\\uDDB8-\\uDDC0\\uDDD8-\\uDDDD\\uDE00-\\uDE40\\uDE44\\uDE50-\\uDE59\\uDE80-\\uDEB7\\uDEC0-\\uDEC9\\uDF00-\\uDF19\\uDF1D-\\uDF2B\\uDF30-\\uDF39]|\\uD806[\\uDCA0-\\uDCE9\\uDCFF\\uDE00-\\uDE3E\\uDE47\\uDE50-\\uDE83\\uDE86-\\uDE99\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC36\\uDC38-\\uDC40\\uDC50-\\uDC59\\uDC72-\\uDC8F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD50-\\uDD59]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE60-\\uDE69\\uDED0-\\uDEED\\uDEF0-\\uDEF4\\uDF00-\\uD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\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]|\\uDB40[\\uDD00-\\uDDEF]/;\n\n\tvar unicode = {\n\t\tSpace_Separator: Space_Separator,\n\t\tID_Start: ID_Start,\n\t\tID_Continue: ID_Continue\n\t};\n\n\tvar util = {\n\t isSpaceSeparator: function isSpaceSeparator (c) {\n\t return typeof c === 'string' && unicode.Space_Separator.test(c)\n\t },\n\n\t isIdStartChar: function isIdStartChar (c) {\n\t return typeof c === 'string' && (\n\t (c >= 'a' && c <= 'z') ||\n\t (c >= 'A' && c <= 'Z') ||\n\t (c === '$') || (c === '_') ||\n\t unicode.ID_Start.test(c)\n\t )\n\t },\n\n\t isIdContinueChar: function isIdContinueChar (c) {\n\t return typeof c === 'string' && (\n\t (c >= 'a' && c <= 'z') ||\n\t (c >= 'A' && c <= 'Z') ||\n\t (c >= '0' && c <= '9') ||\n\t (c === '$') || (c === '_') ||\n\t (c === '\\u200C') || (c === '\\u200D') ||\n\t unicode.ID_Continue.test(c)\n\t )\n\t },\n\n\t isDigit: function isDigit (c) {\n\t return typeof c === 'string' && /[0-9]/.test(c)\n\t },\n\n\t isHexDigit: function isHexDigit (c) {\n\t return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)\n\t },\n\t};\n\n\tvar source;\n\tvar parseState;\n\tvar stack;\n\tvar pos;\n\tvar line;\n\tvar column;\n\tvar token;\n\tvar key;\n\tvar root;\n\n\tvar parse = function parse (text, reviver) {\n\t source = String(text);\n\t parseState = 'start';\n\t stack = [];\n\t pos = 0;\n\t line = 1;\n\t column = 0;\n\t token = undefined;\n\t key = undefined;\n\t root = undefined;\n\n\t do {\n\t token = lex();\n\n\t // This code is unreachable.\n\t // if (!parseStates[parseState]) {\n\t // throw invalidParseState()\n\t // }\n\n\t parseStates[parseState]();\n\t } while (token.type !== 'eof')\n\n\t if (typeof reviver === 'function') {\n\t return internalize({'': root}, '', reviver)\n\t }\n\n\t return root\n\t};\n\n\tfunction internalize (holder, name, reviver) {\n\t var value = holder[name];\n\t if (value != null && typeof value === 'object') {\n\t if (Array.isArray(value)) {\n\t for (var i = 0; i < value.length; i++) {\n\t var key = String(i);\n\t var replacement = internalize(value, key, reviver);\n\t if (replacement === undefined) {\n\t delete value[key];\n\t } else {\n\t Object.defineProperty(value, key, {\n\t value: replacement,\n\t writable: true,\n\t enumerable: true,\n\t configurable: true,\n\t });\n\t }\n\t }\n\t } else {\n\t for (var key$1 in value) {\n\t var replacement$1 = internalize(value, key$1, reviver);\n\t if (replacement$1 === undefined) {\n\t delete value[key$1];\n\t } else {\n\t Object.defineProperty(value, key$1, {\n\t value: replacement$1,\n\t writable: true,\n\t enumerable: true,\n\t configurable: true,\n\t });\n\t }\n\t }\n\t }\n\t }\n\n\t return reviver.call(holder, name, value)\n\t}\n\n\tvar lexState;\n\tvar buffer;\n\tvar doubleQuote;\n\tvar sign;\n\tvar c;\n\n\tfunction lex () {\n\t lexState = 'default';\n\t buffer = '';\n\t doubleQuote = false;\n\t sign = 1;\n\n\t for (;;) {\n\t c = peek();\n\n\t // This code is unreachable.\n\t // if (!lexStates[lexState]) {\n\t // throw invalidLexState(lexState)\n\t // }\n\n\t var token = lexStates[lexState]();\n\t if (token) {\n\t return token\n\t }\n\t }\n\t}\n\n\tfunction peek () {\n\t if (source[pos]) {\n\t return String.fromCodePoint(source.codePointAt(pos))\n\t }\n\t}\n\n\tfunction read () {\n\t var c = peek();\n\n\t if (c === '\\n') {\n\t line++;\n\t column = 0;\n\t } else if (c) {\n\t column += c.length;\n\t } else {\n\t column++;\n\t }\n\n\t if (c) {\n\t pos += c.length;\n\t }\n\n\t return c\n\t}\n\n\tvar lexStates = {\n\t default: function default$1 () {\n\t switch (c) {\n\t case '\\t':\n\t case '\\v':\n\t case '\\f':\n\t case ' ':\n\t case '\\u00A0':\n\t case '\\uFEFF':\n\t case '\\n':\n\t case '\\r':\n\t case '\\u2028':\n\t case '\\u2029':\n\t read();\n\t return\n\n\t case '/':\n\t read();\n\t lexState = 'comment';\n\t return\n\n\t case undefined:\n\t read();\n\t return newToken('eof')\n\t }\n\n\t if (util.isSpaceSeparator(c)) {\n\t read();\n\t return\n\t }\n\n\t // This code is unreachable.\n\t // if (!lexStates[parseState]) {\n\t // throw invalidLexState(parseState)\n\t // }\n\n\t return lexStates[parseState]()\n\t },\n\n\t comment: function comment () {\n\t switch (c) {\n\t case '*':\n\t read();\n\t lexState = 'multiLineComment';\n\t return\n\n\t case '/':\n\t read();\n\t lexState = 'singleLineComment';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t multiLineComment: function multiLineComment () {\n\t switch (c) {\n\t case '*':\n\t read();\n\t lexState = 'multiLineCommentAsterisk';\n\t return\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t },\n\n\t multiLineCommentAsterisk: function multiLineCommentAsterisk () {\n\t switch (c) {\n\t case '*':\n\t read();\n\t return\n\n\t case '/':\n\t read();\n\t lexState = 'default';\n\t return\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t lexState = 'multiLineComment';\n\t },\n\n\t singleLineComment: function singleLineComment () {\n\t switch (c) {\n\t case '\\n':\n\t case '\\r':\n\t case '\\u2028':\n\t case '\\u2029':\n\t read();\n\t lexState = 'default';\n\t return\n\n\t case undefined:\n\t read();\n\t return newToken('eof')\n\t }\n\n\t read();\n\t },\n\n\t value: function value () {\n\t switch (c) {\n\t case '{':\n\t case '[':\n\t return newToken('punctuator', read())\n\n\t case 'n':\n\t read();\n\t literal('ull');\n\t return newToken('null', null)\n\n\t case 't':\n\t read();\n\t literal('rue');\n\t return newToken('boolean', true)\n\n\t case 'f':\n\t read();\n\t literal('alse');\n\t return newToken('boolean', false)\n\n\t case '-':\n\t case '+':\n\t if (read() === '-') {\n\t sign = -1;\n\t }\n\n\t lexState = 'sign';\n\t return\n\n\t case '.':\n\t buffer = read();\n\t lexState = 'decimalPointLeading';\n\t return\n\n\t case '0':\n\t buffer = read();\n\t lexState = 'zero';\n\t return\n\n\t case '1':\n\t case '2':\n\t case '3':\n\t case '4':\n\t case '5':\n\t case '6':\n\t case '7':\n\t case '8':\n\t case '9':\n\t buffer = read();\n\t lexState = 'decimalInteger';\n\t return\n\n\t case 'I':\n\t read();\n\t literal('nfinity');\n\t return newToken('numeric', Infinity)\n\n\t case 'N':\n\t read();\n\t literal('aN');\n\t return newToken('numeric', NaN)\n\n\t case '\"':\n\t case \"'\":\n\t doubleQuote = (read() === '\"');\n\t buffer = '';\n\t lexState = 'string';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t identifierNameStartEscape: function identifierNameStartEscape () {\n\t if (c !== 'u') {\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t var u = unicodeEscape();\n\t switch (u) {\n\t case '$':\n\t case '_':\n\t break\n\n\t default:\n\t if (!util.isIdStartChar(u)) {\n\t throw invalidIdentifier()\n\t }\n\n\t break\n\t }\n\n\t buffer += u;\n\t lexState = 'identifierName';\n\t },\n\n\t identifierName: function identifierName () {\n\t switch (c) {\n\t case '$':\n\t case '_':\n\t case '\\u200C':\n\t case '\\u200D':\n\t buffer += read();\n\t return\n\n\t case '\\\\':\n\t read();\n\t lexState = 'identifierNameEscape';\n\t return\n\t }\n\n\t if (util.isIdContinueChar(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('identifier', buffer)\n\t },\n\n\t identifierNameEscape: function identifierNameEscape () {\n\t if (c !== 'u') {\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t var u = unicodeEscape();\n\t switch (u) {\n\t case '$':\n\t case '_':\n\t case '\\u200C':\n\t case '\\u200D':\n\t break\n\n\t default:\n\t if (!util.isIdContinueChar(u)) {\n\t throw invalidIdentifier()\n\t }\n\n\t break\n\t }\n\n\t buffer += u;\n\t lexState = 'identifierName';\n\t },\n\n\t sign: function sign$1 () {\n\t switch (c) {\n\t case '.':\n\t buffer = read();\n\t lexState = 'decimalPointLeading';\n\t return\n\n\t case '0':\n\t buffer = read();\n\t lexState = 'zero';\n\t return\n\n\t case '1':\n\t case '2':\n\t case '3':\n\t case '4':\n\t case '5':\n\t case '6':\n\t case '7':\n\t case '8':\n\t case '9':\n\t buffer = read();\n\t lexState = 'decimalInteger';\n\t return\n\n\t case 'I':\n\t read();\n\t literal('nfinity');\n\t return newToken('numeric', sign * Infinity)\n\n\t case 'N':\n\t read();\n\t literal('aN');\n\t return newToken('numeric', NaN)\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t zero: function zero () {\n\t switch (c) {\n\t case '.':\n\t buffer += read();\n\t lexState = 'decimalPoint';\n\t return\n\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\n\t case 'x':\n\t case 'X':\n\t buffer += read();\n\t lexState = 'hexadecimal';\n\t return\n\t }\n\n\t return newToken('numeric', sign * 0)\n\t },\n\n\t decimalInteger: function decimalInteger () {\n\t switch (c) {\n\t case '.':\n\t buffer += read();\n\t lexState = 'decimalPoint';\n\t return\n\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t decimalPointLeading: function decimalPointLeading () {\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalFraction';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t decimalPoint: function decimalPoint () {\n\t switch (c) {\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalFraction';\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t decimalFraction: function decimalFraction () {\n\t switch (c) {\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t decimalExponent: function decimalExponent () {\n\t switch (c) {\n\t case '+':\n\t case '-':\n\t buffer += read();\n\t lexState = 'decimalExponentSign';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalExponentInteger';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t decimalExponentSign: function decimalExponentSign () {\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalExponentInteger';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t decimalExponentInteger: function decimalExponentInteger () {\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t hexadecimal: function hexadecimal () {\n\t if (util.isHexDigit(c)) {\n\t buffer += read();\n\t lexState = 'hexadecimalInteger';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t hexadecimalInteger: function hexadecimalInteger () {\n\t if (util.isHexDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t string: function string () {\n\t switch (c) {\n\t case '\\\\':\n\t read();\n\t buffer += escape();\n\t return\n\n\t case '\"':\n\t if (doubleQuote) {\n\t read();\n\t return newToken('string', buffer)\n\t }\n\n\t buffer += read();\n\t return\n\n\t case \"'\":\n\t if (!doubleQuote) {\n\t read();\n\t return newToken('string', buffer)\n\t }\n\n\t buffer += read();\n\t return\n\n\t case '\\n':\n\t case '\\r':\n\t throw invalidChar(read())\n\n\t case '\\u2028':\n\t case '\\u2029':\n\t separatorChar(c);\n\t break\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\t },\n\n\t start: function start () {\n\t switch (c) {\n\t case '{':\n\t case '[':\n\t return newToken('punctuator', read())\n\n\t // This code is unreachable since the default lexState handles eof.\n\t // case undefined:\n\t // return newToken('eof')\n\t }\n\n\t lexState = 'value';\n\t },\n\n\t beforePropertyName: function beforePropertyName () {\n\t switch (c) {\n\t case '$':\n\t case '_':\n\t buffer = read();\n\t lexState = 'identifierName';\n\t return\n\n\t case '\\\\':\n\t read();\n\t lexState = 'identifierNameStartEscape';\n\t return\n\n\t case '}':\n\t return newToken('punctuator', read())\n\n\t case '\"':\n\t case \"'\":\n\t doubleQuote = (read() === '\"');\n\t lexState = 'string';\n\t return\n\t }\n\n\t if (util.isIdStartChar(c)) {\n\t buffer += read();\n\t lexState = 'identifierName';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t afterPropertyName: function afterPropertyName () {\n\t if (c === ':') {\n\t return newToken('punctuator', read())\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t beforePropertyValue: function beforePropertyValue () {\n\t lexState = 'value';\n\t },\n\n\t afterPropertyValue: function afterPropertyValue () {\n\t switch (c) {\n\t case ',':\n\t case '}':\n\t return newToken('punctuator', read())\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t beforeArrayValue: function beforeArrayValue () {\n\t if (c === ']') {\n\t return newToken('punctuator', read())\n\t }\n\n\t lexState = 'value';\n\t },\n\n\t afterArrayValue: function afterArrayValue () {\n\t switch (c) {\n\t case ',':\n\t case ']':\n\t return newToken('punctuator', read())\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t end: function end () {\n\t // This code is unreachable since it's handled by the default lexState.\n\t // if (c === undefined) {\n\t // read()\n\t // return newToken('eof')\n\t // }\n\n\t throw invalidChar(read())\n\t },\n\t};\n\n\tfunction newToken (type, value) {\n\t return {\n\t type: type,\n\t value: value,\n\t line: line,\n\t column: column,\n\t }\n\t}\n\n\tfunction literal (s) {\n\t for (var i = 0, list = s; i < list.length; i += 1) {\n\t var c = list[i];\n\n\t var p = peek();\n\n\t if (p !== c) {\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t }\n\t}\n\n\tfunction escape () {\n\t var c = peek();\n\t switch (c) {\n\t case 'b':\n\t read();\n\t return '\\b'\n\n\t case 'f':\n\t read();\n\t return '\\f'\n\n\t case 'n':\n\t read();\n\t return '\\n'\n\n\t case 'r':\n\t read();\n\t return '\\r'\n\n\t case 't':\n\t read();\n\t return '\\t'\n\n\t case 'v':\n\t read();\n\t return '\\v'\n\n\t case '0':\n\t read();\n\t if (util.isDigit(peek())) {\n\t throw invalidChar(read())\n\t }\n\n\t return '\\0'\n\n\t case 'x':\n\t read();\n\t return hexEscape()\n\n\t case 'u':\n\t read();\n\t return unicodeEscape()\n\n\t case '\\n':\n\t case '\\u2028':\n\t case '\\u2029':\n\t read();\n\t return ''\n\n\t case '\\r':\n\t read();\n\t if (peek() === '\\n') {\n\t read();\n\t }\n\n\t return ''\n\n\t case '1':\n\t case '2':\n\t case '3':\n\t case '4':\n\t case '5':\n\t case '6':\n\t case '7':\n\t case '8':\n\t case '9':\n\t throw invalidChar(read())\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t return read()\n\t}\n\n\tfunction hexEscape () {\n\t var buffer = '';\n\t var c = peek();\n\n\t if (!util.isHexDigit(c)) {\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\n\t c = peek();\n\t if (!util.isHexDigit(c)) {\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\n\t return String.fromCodePoint(parseInt(buffer, 16))\n\t}\n\n\tfunction unicodeEscape () {\n\t var buffer = '';\n\t var count = 4;\n\n\t while (count-- > 0) {\n\t var c = peek();\n\t if (!util.isHexDigit(c)) {\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\t }\n\n\t return String.fromCodePoint(parseInt(buffer, 16))\n\t}\n\n\tvar parseStates = {\n\t start: function start () {\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t push();\n\t },\n\n\t beforePropertyName: function beforePropertyName () {\n\t switch (token.type) {\n\t case 'identifier':\n\t case 'string':\n\t key = token.value;\n\t parseState = 'afterPropertyName';\n\t return\n\n\t case 'punctuator':\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.value !== '}') {\n\t // throw invalidToken()\n\t // }\n\n\t pop();\n\t return\n\n\t case 'eof':\n\t throw invalidEOF()\n\t }\n\n\t // This code is unreachable since it's handled by the lexState.\n\t // throw invalidToken()\n\t },\n\n\t afterPropertyName: function afterPropertyName () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'punctuator' || token.value !== ':') {\n\t // throw invalidToken()\n\t // }\n\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t parseState = 'beforePropertyValue';\n\t },\n\n\t beforePropertyValue: function beforePropertyValue () {\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t push();\n\t },\n\n\t beforeArrayValue: function beforeArrayValue () {\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t if (token.type === 'punctuator' && token.value === ']') {\n\t pop();\n\t return\n\t }\n\n\t push();\n\t },\n\n\t afterPropertyValue: function afterPropertyValue () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'punctuator') {\n\t // throw invalidToken()\n\t // }\n\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t switch (token.value) {\n\t case ',':\n\t parseState = 'beforePropertyName';\n\t return\n\n\t case '}':\n\t pop();\n\t }\n\n\t // This code is unreachable since it's handled by the lexState.\n\t // throw invalidToken()\n\t },\n\n\t afterArrayValue: function afterArrayValue () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'punctuator') {\n\t // throw invalidToken()\n\t // }\n\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t switch (token.value) {\n\t case ',':\n\t parseState = 'beforeArrayValue';\n\t return\n\n\t case ']':\n\t pop();\n\t }\n\n\t // This code is unreachable since it's handled by the lexState.\n\t // throw invalidToken()\n\t },\n\n\t end: function end () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'eof') {\n\t // throw invalidToken()\n\t // }\n\t },\n\t};\n\n\tfunction push () {\n\t var value;\n\n\t switch (token.type) {\n\t case 'punctuator':\n\t switch (token.value) {\n\t case '{':\n\t value = {};\n\t break\n\n\t case '[':\n\t value = [];\n\t break\n\t }\n\n\t break\n\n\t case 'null':\n\t case 'boolean':\n\t case 'numeric':\n\t case 'string':\n\t value = token.value;\n\t break\n\n\t // This code is unreachable.\n\t // default:\n\t // throw invalidToken()\n\t }\n\n\t if (root === undefined) {\n\t root = value;\n\t } else {\n\t var parent = stack[stack.length - 1];\n\t if (Array.isArray(parent)) {\n\t parent.push(value);\n\t } else {\n\t Object.defineProperty(parent, key, {\n\t value: value,\n\t writable: true,\n\t enumerable: true,\n\t configurable: true,\n\t });\n\t }\n\t }\n\n\t if (value !== null && typeof value === 'object') {\n\t stack.push(value);\n\n\t if (Array.isArray(value)) {\n\t parseState = 'beforeArrayValue';\n\t } else {\n\t parseState = 'beforePropertyName';\n\t }\n\t } else {\n\t var current = stack[stack.length - 1];\n\t if (current == null) {\n\t parseState = 'end';\n\t } else if (Array.isArray(current)) {\n\t parseState = 'afterArrayValue';\n\t } else {\n\t parseState = 'afterPropertyValue';\n\t }\n\t }\n\t}\n\n\tfunction pop () {\n\t stack.pop();\n\n\t var current = stack[stack.length - 1];\n\t if (current == null) {\n\t parseState = 'end';\n\t } else if (Array.isArray(current)) {\n\t parseState = 'afterArrayValue';\n\t } else {\n\t parseState = 'afterPropertyValue';\n\t }\n\t}\n\n\t// This code is unreachable.\n\t// function invalidParseState () {\n\t// return new Error(`JSON5: invalid parse state '${parseState}'`)\n\t// }\n\n\t// This code is unreachable.\n\t// function invalidLexState (state) {\n\t// return new Error(`JSON5: invalid lex state '${state}'`)\n\t// }\n\n\tfunction invalidChar (c) {\n\t if (c === undefined) {\n\t return syntaxError((\"JSON5: invalid end of input at \" + line + \":\" + column))\n\t }\n\n\t return syntaxError((\"JSON5: invalid character '\" + (formatChar(c)) + \"' at \" + line + \":\" + column))\n\t}\n\n\tfunction invalidEOF () {\n\t return syntaxError((\"JSON5: invalid end of input at \" + line + \":\" + column))\n\t}\n\n\t// This code is unreachable.\n\t// function invalidToken () {\n\t// if (token.type === 'eof') {\n\t// return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)\n\t// }\n\n\t// const c = String.fromCodePoint(token.value.codePointAt(0))\n\t// return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)\n\t// }\n\n\tfunction invalidIdentifier () {\n\t column -= 5;\n\t return syntaxError((\"JSON5: invalid identifier character at \" + line + \":\" + column))\n\t}\n\n\tfunction separatorChar (c) {\n\t console.warn((\"JSON5: '\" + (formatChar(c)) + \"' in strings is not valid ECMAScript; consider escaping\"));\n\t}\n\n\tfunction formatChar (c) {\n\t var replacements = {\n\t \"'\": \"\\\\'\",\n\t '\"': '\\\\\"',\n\t '\\\\': '\\\\\\\\',\n\t '\\b': '\\\\b',\n\t '\\f': '\\\\f',\n\t '\\n': '\\\\n',\n\t '\\r': '\\\\r',\n\t '\\t': '\\\\t',\n\t '\\v': '\\\\v',\n\t '\\0': '\\\\0',\n\t '\\u2028': '\\\\u2028',\n\t '\\u2029': '\\\\u2029',\n\t };\n\n\t if (replacements[c]) {\n\t return replacements[c]\n\t }\n\n\t if (c < ' ') {\n\t var hexString = c.charCodeAt(0).toString(16);\n\t return '\\\\x' + ('00' + hexString).substring(hexString.length)\n\t }\n\n\t return c\n\t}\n\n\tfunction syntaxError (message) {\n\t var err = new SyntaxError(message);\n\t err.lineNumber = line;\n\t err.columnNumber = column;\n\t return err\n\t}\n\n\tvar stringify = function stringify (value, replacer, space) {\n\t var stack = [];\n\t var indent = '';\n\t var propertyList;\n\t var replacerFunc;\n\t var gap = '';\n\t var quote;\n\n\t if (\n\t replacer != null &&\n\t typeof replacer === 'object' &&\n\t !Array.isArray(replacer)\n\t ) {\n\t space = replacer.space;\n\t quote = replacer.quote;\n\t replacer = replacer.replacer;\n\t }\n\n\t if (typeof replacer === 'function') {\n\t replacerFunc = replacer;\n\t } else if (Array.isArray(replacer)) {\n\t propertyList = [];\n\t for (var i = 0, list = replacer; i < list.length; i += 1) {\n\t var v = list[i];\n\n\t var item = (void 0);\n\n\t if (typeof v === 'string') {\n\t item = v;\n\t } else if (\n\t typeof v === 'number' ||\n\t v instanceof String ||\n\t v instanceof Number\n\t ) {\n\t item = String(v);\n\t }\n\n\t if (item !== undefined && propertyList.indexOf(item) < 0) {\n\t propertyList.push(item);\n\t }\n\t }\n\t }\n\n\t if (space instanceof Number) {\n\t space = Number(space);\n\t } else if (space instanceof String) {\n\t space = String(space);\n\t }\n\n\t if (typeof space === 'number') {\n\t if (space > 0) {\n\t space = Math.min(10, Math.floor(space));\n\t gap = ' '.substr(0, space);\n\t }\n\t } else if (typeof space === 'string') {\n\t gap = space.substr(0, 10);\n\t }\n\n\t return serializeProperty('', {'': value})\n\n\t function serializeProperty (key, holder) {\n\t var value = holder[key];\n\t if (value != null) {\n\t if (typeof value.toJSON5 === 'function') {\n\t value = value.toJSON5(key);\n\t } else if (typeof value.toJSON === 'function') {\n\t value = value.toJSON(key);\n\t }\n\t }\n\n\t if (replacerFunc) {\n\t value = replacerFunc.call(holder, key, value);\n\t }\n\n\t if (value instanceof Number) {\n\t value = Number(value);\n\t } else if (value instanceof String) {\n\t value = String(value);\n\t } else if (value instanceof Boolean) {\n\t value = value.valueOf();\n\t }\n\n\t switch (value) {\n\t case null: return 'null'\n\t case true: return 'true'\n\t case false: return 'false'\n\t }\n\n\t if (typeof value === 'string') {\n\t return quoteString(value, false)\n\t }\n\n\t if (typeof value === 'number') {\n\t return String(value)\n\t }\n\n\t if (typeof value === 'object') {\n\t return Array.isArray(value) ? serializeArray(value) : serializeObject(value)\n\t }\n\n\t return undefined\n\t }\n\n\t function quoteString (value) {\n\t var quotes = {\n\t \"'\": 0.1,\n\t '\"': 0.2,\n\t };\n\n\t var replacements = {\n\t \"'\": \"\\\\'\",\n\t '\"': '\\\\\"',\n\t '\\\\': '\\\\\\\\',\n\t '\\b': '\\\\b',\n\t '\\f': '\\\\f',\n\t '\\n': '\\\\n',\n\t '\\r': '\\\\r',\n\t '\\t': '\\\\t',\n\t '\\v': '\\\\v',\n\t '\\0': '\\\\0',\n\t '\\u2028': '\\\\u2028',\n\t '\\u2029': '\\\\u2029',\n\t };\n\n\t var product = '';\n\n\t for (var i = 0; i < value.length; i++) {\n\t var c = value[i];\n\t switch (c) {\n\t case \"'\":\n\t case '\"':\n\t quotes[c]++;\n\t product += c;\n\t continue\n\n\t case '\\0':\n\t if (util.isDigit(value[i + 1])) {\n\t product += '\\\\x00';\n\t continue\n\t }\n\t }\n\n\t if (replacements[c]) {\n\t product += replacements[c];\n\t continue\n\t }\n\n\t if (c < ' ') {\n\t var hexString = c.charCodeAt(0).toString(16);\n\t product += '\\\\x' + ('00' + hexString).substring(hexString.length);\n\t continue\n\t }\n\n\t product += c;\n\t }\n\n\t var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });\n\n\t product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);\n\n\t return quoteChar + product + quoteChar\n\t }\n\n\t function serializeObject (value) {\n\t if (stack.indexOf(value) >= 0) {\n\t throw TypeError('Converting circular structure to JSON5')\n\t }\n\n\t stack.push(value);\n\n\t var stepback = indent;\n\t indent = indent + gap;\n\n\t var keys = propertyList || Object.keys(value);\n\t var partial = [];\n\t for (var i = 0, list = keys; i < list.length; i += 1) {\n\t var key = list[i];\n\n\t var propertyString = serializeProperty(key, value);\n\t if (propertyString !== undefined) {\n\t var member = serializeKey(key) + ':';\n\t if (gap !== '') {\n\t member += ' ';\n\t }\n\t member += propertyString;\n\t partial.push(member);\n\t }\n\t }\n\n\t var final;\n\t if (partial.length === 0) {\n\t final = '{}';\n\t } else {\n\t var properties;\n\t if (gap === '') {\n\t properties = partial.join(',');\n\t final = '{' + properties + '}';\n\t } else {\n\t var separator = ',\\n' + indent;\n\t properties = partial.join(separator);\n\t final = '{\\n' + indent + properties + ',\\n' + stepback + '}';\n\t }\n\t }\n\n\t stack.pop();\n\t indent = stepback;\n\t return final\n\t }\n\n\t function serializeKey (key) {\n\t if (key.length === 0) {\n\t return quoteString(key, true)\n\t }\n\n\t var firstChar = String.fromCodePoint(key.codePointAt(0));\n\t if (!util.isIdStartChar(firstChar)) {\n\t return quoteString(key, true)\n\t }\n\n\t for (var i = firstChar.length; i < key.length; i++) {\n\t if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {\n\t return quoteString(key, true)\n\t }\n\t }\n\n\t return key\n\t }\n\n\t function serializeArray (value) {\n\t if (stack.indexOf(value) >= 0) {\n\t throw TypeError('Converting circular structure to JSON5')\n\t }\n\n\t stack.push(value);\n\n\t var stepback = indent;\n\t indent = indent + gap;\n\n\t var partial = [];\n\t for (var i = 0; i < value.length; i++) {\n\t var propertyString = serializeProperty(String(i), value);\n\t partial.push((propertyString !== undefined) ? propertyString : 'null');\n\t }\n\n\t var final;\n\t if (partial.length === 0) {\n\t final = '[]';\n\t } else {\n\t if (gap === '') {\n\t var properties = partial.join(',');\n\t final = '[' + properties + ']';\n\t } else {\n\t var separator = ',\\n' + indent;\n\t var properties$1 = partial.join(separator);\n\t final = '[\\n' + indent + properties$1 + ',\\n' + stepback + ']';\n\t }\n\t }\n\n\t stack.pop();\n\t indent = stepback;\n\t return final\n\t }\n\t};\n\n\tvar JSON5 = {\n\t parse: parse,\n\t stringify: stringify,\n\t};\n\n\tvar lib = JSON5;\n\n\tvar es5 = lib;\n\n\treturn es5;\n\n})));\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { access, cp, readFile, stat, writeFile } from \"node:fs/promises\";\nimport { randomBytes } from \"node:crypto\";\nimport { basename, dirname, join } from \"node:path\";\n\nimport { parse } from \"json5\";\n\n/**\n * Fixed byte size reserved in muon-core for an embedded muon.json payload.\n */\nexport const muonEmbeddedConfigSlotSize = 64 * 1024;\n\n/**\n * Fixed byte sequence used to locate an unembedded config slot.\n */\nconst muonEmbeddedConfigEmptySlotMarker = Buffer.from([\n 0x6d, 0x75, 0x6f, 0x6e, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x3a, 0x65, 0x6d, 0x62,\n 0x65, 0x64, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x3a, 0x73, 0x6c, 0x6f,\n 0x74, 0x3a, 0x76, 0x31, 0x00, 0x5d,\n]);\n\nconst muonEmbeddedConfigPayloadCapacity = muonEmbeddedConfigSlotSize;\nconst muonLauncherEmbeddedConfigSlotSize = 64 * 1024;\nconst muonLauncherEmbeddedConfigEmptySlotMarker = Buffer.from([\n 0x6d, 0x75, 0x6f, 0x6e, 0x2d, 0x6c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x65, 0x72,\n 0x3a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,\n 0x3a, 0x76, 0x31, 0x00, 0x5d,\n]);\nconst muonLauncherEmbeddedConfigPayloadCapacity =\n muonLauncherEmbeddedConfigSlotSize;\n\nconst tlvNullTag = 0;\nconst tlvFalseTag = 1;\nconst tlvTrueTag = 2;\nconst tlvUintTag = 3;\nconst tlvStringTag = 4;\nconst tlvBinaryTag = 5;\nconst tlvArrayTag = 6;\nconst tlvObjectTag = 7;\n\n/**\n * Result returned by a muon executable config embedding operation.\n */\nexport interface EmbedMuonConfigResult {\n /** Input executable path. For launcher embedding this is the launcher path. */\n readonly corePath: string;\n /** Written executable path. */\n readonly outputPath: string;\n /** Byte offset of the fixed embedded config slot. */\n readonly slotOffset: number;\n /** Encoded TLV payload size in bytes. */\n readonly payloadSize: number;\n /** Whether an existing embedded payload was replaced. Always false. */\n readonly replaced: boolean;\n}\n\n/**\n * Options for embedding a config into a single muon-core executable.\n */\nexport interface EmbedMuonConfigCoreOptions {\n /** muon-core executable path to patch. */\n readonly corePath: string;\n /** muon.json, muon.json5, or muon.jsonc input path. */\n readonly configPath: string;\n /** Optional output executable path. When omitted, corePath is updated. */\n readonly outputPath: string | undefined;\n}\n\n/**\n * Options for embedding a config into a single muon-launcher executable.\n */\nexport interface EmbedMuonConfigLauncherOptions {\n /** muon-launcher executable path to patch. */\n readonly launcherPath: string;\n /** muon.json, muon.json5, or muon.jsonc input path. */\n readonly configPath: string;\n /** Optional output executable path. When omitted, launcherPath is updated. */\n readonly outputPath: string | undefined;\n}\n\n/**\n * Options for embedding a config into a runtime directory.\n */\nexport interface EmbedMuonConfigRuntimeOptions {\n /** Runtime directory containing muon-core or muon-core.exe. */\n readonly runtimePath: string;\n /** muon.json, muon.json5, or muon.jsonc input path. */\n readonly configPath: string;\n /** Optional output runtime directory. When omitted, runtimePath is updated. */\n readonly outputRuntimePath: string | undefined;\n}\n\n/**\n * Unembedded config slot found in a muon-core executable.\n */\nexport interface MuonEmbeddedConfigSlot {\n /** Empty slot state. */\n readonly state: \"empty\";\n /** Byte offset of the slot. */\n readonly offset: number;\n /** Empty payload. */\n readonly payload: Buffer;\n /** Payload byte size. */\n readonly payloadSize: 0;\n}\n\n/**\n * Unembedded launcher config slot found in a muon-launcher executable.\n */\nexport interface MuonLauncherEmbeddedConfigSlot {\n /** Empty slot state. */\n readonly state: \"empty\";\n /** Byte offset of the slot. */\n readonly offset: number;\n /** Empty payload. */\n readonly payload: Buffer;\n /** Payload byte size. */\n readonly payloadSize: 0;\n}\n\nconst getEmbeddedConfigEmptySlotByte = (index: number): number => {\n if (index < muonEmbeddedConfigEmptySlotMarker.length) {\n return muonEmbeddedConfigEmptySlotMarker[index] ?? 0;\n }\n const value =\n 0xa5 ^\n Math.imul(index, 0x25) ^\n Math.imul(index >>> 8, 0x6d) ^\n Math.imul(index >>> 16, 0x3b) ^\n (Math.imul(index, 0x9e3779b1) >>> 24);\n return value & 0xff;\n};\n\nconst createEmptySlot = (): Buffer => {\n const slot = Buffer.allocUnsafe(muonEmbeddedConfigSlotSize);\n for (let index = 0; index < slot.length; index += 1) {\n slot[index] = getEmbeddedConfigEmptySlotByte(index);\n }\n return slot;\n};\n\nconst encodeVarUint = (value: bigint): Buffer => {\n const bytes: number[] = [];\n let remaining = value;\n do {\n let byte = Number(remaining & 0x7fn);\n remaining >>= 7n;\n if (remaining !== 0n) {\n byte |= 0x80;\n }\n bytes.push(byte);\n } while (remaining !== 0n);\n return Buffer.from(bytes);\n};\n\nconst encodeRawString = (value: string): Buffer => {\n const bytes = Buffer.from(value, \"utf8\");\n return Buffer.concat([encodeVarUint(BigInt(bytes.length)), bytes]);\n};\n\nconst encodeTaggedBytes = (tag: number, bytes: Uint8Array): Buffer =>\n Buffer.concat([\n Buffer.from([tag]),\n encodeVarUint(BigInt(bytes.length)),\n Buffer.from(bytes),\n ]);\n\nconst isJsonObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isPath = (\n path: readonly string[],\n first: string,\n second: string,\n): boolean => path.length === 2 && path[0] === first && path[1] === second;\n\nconst isPluginSignaturePath = (path: readonly string[]): boolean =>\n path.length === 3 &&\n path[0] === \"plugin\" &&\n path[1] === \"plugins\" &&\n path[2] === \"signature\";\n\nconst isPluginSaltPath = (path: readonly string[]): boolean =>\n path.length === 3 &&\n path[0] === \"plugin\" &&\n path[1] === \"plugins\" &&\n path[2] === \"salt\";\n\nconst isHexString = (value: string): boolean =>\n value.length % 2 === 0 && /^[0-9a-fA-F]*$/.test(value);\n\nconst decodeHexString = (value: string): Buffer => {\n const bytes = Buffer.alloc(value.length / 2);\n for (let index = 0; index < value.length; index += 2) {\n bytes[index / 2] = Number.parseInt(value.slice(index, index + 2), 16);\n }\n return bytes;\n};\n\nconst encodeKnownBinaryString = (\n path: readonly string[],\n value: string,\n): Buffer | undefined => {\n if (isPath(path, \"asset\", \"signature\")) {\n return value.length === 64 && isHexString(value)\n ? decodeHexString(value)\n : undefined;\n }\n if (isPath(path, \"asset\", \"salt\")) {\n return isHexString(value) ? decodeHexString(value) : undefined;\n }\n if (isPluginSignaturePath(path)) {\n return value.length === 64 && isHexString(value)\n ? decodeHexString(value)\n : undefined;\n }\n if (isPluginSaltPath(path)) {\n return isHexString(value) ? decodeHexString(value) : undefined;\n }\n if (isPath(path, \"browser\", \"backgroundColor\")) {\n const hex = value.startsWith(\"#\") ? value.slice(1) : value;\n return hex.length === 6 && isHexString(hex)\n ? decodeHexString(hex)\n : undefined;\n }\n return undefined;\n};\n\nconst encodeTlvValue = (value: unknown, path: readonly string[]): Buffer => {\n if (value === null) {\n return Buffer.from([tlvNullTag]);\n }\n if (typeof value === \"boolean\") {\n return Buffer.from([value ? tlvTrueTag : tlvFalseTag]);\n }\n if (typeof value === \"number\") {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new Error(\"muon embedded config supports only unsigned integers.\");\n }\n return Buffer.concat([\n Buffer.from([tlvUintTag]),\n encodeVarUint(BigInt(value)),\n ]);\n }\n if (typeof value === \"string\") {\n const binaryValue = encodeKnownBinaryString(path, value);\n if (binaryValue !== undefined) {\n return encodeTaggedBytes(tlvBinaryTag, binaryValue);\n }\n return encodeTaggedBytes(tlvStringTag, Buffer.from(value, \"utf8\"));\n }\n if (Array.isArray(value)) {\n return Buffer.concat([\n Buffer.from([tlvArrayTag]),\n encodeVarUint(BigInt(value.length)),\n ...value.map((entry) => encodeTlvValue(entry, path)),\n ]);\n }\n if (isJsonObject(value)) {\n const entries = Object.entries(value);\n return Buffer.concat([\n Buffer.from([tlvObjectTag]),\n encodeVarUint(BigInt(entries.length)),\n ...entries.flatMap(([key, entry]) => [\n encodeRawString(key),\n encodeTlvValue(entry, [...path, key]),\n ]),\n ]);\n }\n throw new Error(\"muon embedded config contains an unsupported value.\");\n};\n\n/**\n * Encodes a parsed muon config object as the embedded TLV payload.\n *\n * @param config Parsed muon config value.\n * @returns Encoded TLV payload bytes.\n */\nexport const encodeMuonConfigTlv = (config: unknown): Buffer =>\n encodeTlvValue(config, []);\n\n/**\n * Creates an empty or payload-filled fixed embedded config slot.\n *\n * @param payload Optional encoded TLV payload bytes.\n * @returns Fixed-size slot image.\n */\nexport const createMuonEmbeddedConfigSlot = (\n payload: Uint8Array | undefined = undefined,\n): Buffer => {\n if (\n payload !== undefined &&\n payload.length > muonEmbeddedConfigPayloadCapacity\n ) {\n throw new Error(\n `Encoded muon config exceeds the embedded slot capacity: ${payload.length} > ${muonEmbeddedConfigPayloadCapacity}`,\n );\n }\n\n if (payload === undefined) {\n return createEmptySlot();\n }\n\n const slot = randomBytes(muonEmbeddedConfigSlotSize);\n Buffer.from(payload).copy(slot, 0);\n return slot;\n};\n\n/**\n * Creates an empty or payload-filled fixed muon-launcher embedded config slot.\n *\n * @param payload Optional encoded TLV payload bytes.\n * @returns Fixed-size slot image.\n */\nexport const createMuonLauncherEmbeddedConfigSlot = (\n payload: Uint8Array | undefined = undefined,\n): Buffer => {\n if (\n payload !== undefined &&\n payload.length > muonLauncherEmbeddedConfigPayloadCapacity\n ) {\n throw new Error(\n `Encoded muon config exceeds the embedded launcher slot capacity: ${payload.length} > ${muonLauncherEmbeddedConfigPayloadCapacity}`,\n );\n }\n\n if (payload === undefined) {\n const slot = Buffer.alloc(muonLauncherEmbeddedConfigSlotSize, 0);\n muonLauncherEmbeddedConfigEmptySlotMarker.copy(slot, 0);\n return slot;\n }\n\n const slot = randomBytes(muonLauncherEmbeddedConfigSlotSize);\n Buffer.from(payload).copy(slot, 0);\n return slot;\n};\n\nconst isEmptySlotAt = (content: Buffer, offset: number): boolean => {\n for (let index = 0; index < muonEmbeddedConfigSlotSize; index += 1) {\n if (content[offset + index] !== getEmbeddedConfigEmptySlotByte(index)) {\n return false;\n }\n }\n return true;\n};\n\nconst inspectUnembeddedSlotAt = (\n content: Buffer,\n offset: number,\n): MuonEmbeddedConfigSlot | undefined => {\n if (offset < 0 || offset + muonEmbeddedConfigSlotSize > content.length) {\n return undefined;\n }\n if (isEmptySlotAt(content, offset)) {\n return {\n state: \"empty\",\n offset,\n payload: Buffer.alloc(0),\n payloadSize: 0,\n };\n }\n return undefined;\n};\n\nconst collectSlotCandidates = (content: Buffer): MuonEmbeddedConfigSlot[] => {\n const candidates = new Map<number, MuonEmbeddedConfigSlot>();\n for (\n let offset = content.indexOf(muonEmbeddedConfigEmptySlotMarker);\n offset >= 0;\n offset = content.indexOf(muonEmbeddedConfigEmptySlotMarker, offset + 1)\n ) {\n const slot = inspectUnembeddedSlotAt(content, offset);\n if (slot !== undefined) {\n candidates.set(slot.offset, slot);\n }\n }\n return [...candidates.values()].sort(\n (left, right) => left.offset - right.offset,\n );\n};\n\nconst isEmptyLauncherSlotAt = (content: Buffer, offset: number): boolean => {\n if (\n offset < 0 ||\n offset + muonLauncherEmbeddedConfigSlotSize > content.length\n ) {\n return false;\n }\n if (\n !content\n .subarray(\n offset,\n offset + muonLauncherEmbeddedConfigEmptySlotMarker.length,\n )\n .equals(muonLauncherEmbeddedConfigEmptySlotMarker)\n ) {\n return false;\n }\n for (\n let index = muonLauncherEmbeddedConfigEmptySlotMarker.length;\n index < muonLauncherEmbeddedConfigSlotSize;\n index += 1\n ) {\n if (content[offset + index] !== 0) {\n return false;\n }\n }\n return true;\n};\n\nconst inspectUnembeddedLauncherSlotAt = (\n content: Buffer,\n offset: number,\n): MuonLauncherEmbeddedConfigSlot | undefined => {\n if (!isEmptyLauncherSlotAt(content, offset)) {\n return undefined;\n }\n return {\n state: \"empty\",\n offset,\n payload: Buffer.alloc(0),\n payloadSize: 0,\n };\n};\n\nconst collectLauncherSlotCandidates = (\n content: Buffer,\n): MuonLauncherEmbeddedConfigSlot[] => {\n const candidates = new Map<number, MuonLauncherEmbeddedConfigSlot>();\n for (\n let offset = content.indexOf(muonLauncherEmbeddedConfigEmptySlotMarker);\n offset >= 0;\n offset = content.indexOf(\n muonLauncherEmbeddedConfigEmptySlotMarker,\n offset + 1,\n )\n ) {\n const slot = inspectUnembeddedLauncherSlotAt(content, offset);\n if (slot !== undefined) {\n candidates.set(slot.offset, slot);\n }\n }\n return [...candidates.values()].sort(\n (left, right) => left.offset - right.offset,\n );\n};\n\n/**\n * Finds the fixed unembedded config slot in a muon-core executable image.\n *\n * @param content muon-core executable bytes.\n * @returns The single detected unembedded config slot.\n */\nexport const findMuonEmbeddedConfigSlot = (\n content: Uint8Array,\n): MuonEmbeddedConfigSlot => {\n const buffer = Buffer.isBuffer(content) ? content : Buffer.from(content);\n const candidates = collectSlotCandidates(buffer);\n if (candidates.length !== 1) {\n throw new Error(\n `Expected exactly one unembedded muon config slot, found ${candidates.length}.`,\n );\n }\n const [candidate] = candidates;\n if (candidate === undefined) {\n throw new Error(\"Embedded muon config slot was not found.\");\n }\n return candidate;\n};\n\n/**\n * Finds the fixed unembedded config slot in a muon-launcher executable image.\n *\n * @param content muon-launcher executable bytes.\n * @returns The single detected unembedded launcher config slot.\n */\nexport const findMuonLauncherEmbeddedConfigSlot = (\n content: Uint8Array,\n): MuonLauncherEmbeddedConfigSlot => {\n const buffer = Buffer.isBuffer(content) ? content : Buffer.from(content);\n const candidates = collectLauncherSlotCandidates(buffer);\n if (candidates.length !== 1) {\n throw new Error(\n `Expected exactly one unembedded muon-launcher config slot, found ${candidates.length}.`,\n );\n }\n const [candidate] = candidates;\n if (candidate === undefined) {\n throw new Error(\"Embedded muon-launcher config slot was not found.\");\n }\n return candidate;\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n const stats = await stat(path);\n return stats.isFile();\n } catch {\n return false;\n }\n};\n\nconst resolveMuonConfigInputPath = async (\n configPath: string,\n): Promise<string> => {\n if (basename(configPath) === \"muon.json\") {\n const directory = dirname(configPath);\n for (const fileName of [\"muon.json5\", \"muon.jsonc\", \"muon.json\"]) {\n const candidate = join(directory, fileName);\n if (await fileExists(candidate)) {\n return candidate;\n }\n }\n }\n if (!(await fileExists(configPath))) {\n throw new Error(`muon config does not exist: ${configPath}`);\n }\n return configPath;\n};\n\nconst readMuonConfigInput = async (configPath: string): Promise<unknown> => {\n const resolvedPath = await resolveMuonConfigInputPath(configPath);\n return parse(await readFile(resolvedPath, \"utf8\"));\n};\n\nconst isSignedPeExecutable = (content: Buffer): boolean => {\n if (content.length < 0x40 || content[0] !== 0x4d || content[1] !== 0x5a) {\n return false;\n }\n const peOffset = content.readUInt32LE(0x3c);\n if (\n peOffset + 0x18 >= content.length ||\n content.toString(\"ascii\", peOffset, peOffset + 4) !== \"PE\\u0000\\u0000\"\n ) {\n return false;\n }\n\n const optionalHeaderOffset = peOffset + 0x18;\n const optionalHeaderSize = content.readUInt16LE(peOffset + 0x14);\n const optionalHeaderEnd = optionalHeaderOffset + optionalHeaderSize;\n if (optionalHeaderEnd > content.length) {\n return false;\n }\n\n const magic = content.readUInt16LE(optionalHeaderOffset);\n const dataDirectoryOffset =\n magic === 0x20b ? optionalHeaderOffset + 112 : optionalHeaderOffset + 96;\n const certificateEntryOffset = dataDirectoryOffset + 4 * 8;\n if (certificateEntryOffset + 8 > optionalHeaderEnd) {\n return false;\n }\n const certificateSize = content.readUInt32LE(certificateEntryOffset + 4);\n return certificateSize !== 0;\n};\n\n/**\n * Embeds a muon config into a single muon-core executable.\n *\n * @param options Core executable embedding options.\n * @returns Embedding result metadata.\n */\nexport const embedMuonConfigInCoreFile = async ({\n corePath,\n configPath,\n outputPath,\n}: EmbedMuonConfigCoreOptions): Promise<EmbedMuonConfigResult> => {\n const config = await readMuonConfigInput(configPath);\n const payload = encodeMuonConfigTlv(config);\n const embeddedSlot = createMuonEmbeddedConfigSlot(payload);\n const coreContent = await readFile(corePath);\n if (isSignedPeExecutable(coreContent)) {\n throw new Error(\"Cannot embed muon config into a signed PE executable.\");\n }\n\n const slot = findMuonEmbeddedConfigSlot(coreContent);\n const patchedContent = Buffer.from(coreContent);\n embeddedSlot.copy(patchedContent, slot.offset);\n const resolvedOutputPath = outputPath ?? corePath;\n await writeFile(resolvedOutputPath, patchedContent);\n\n return {\n corePath,\n outputPath: resolvedOutputPath,\n slotOffset: slot.offset,\n payloadSize: payload.length,\n replaced: false,\n };\n};\n\n/**\n * Embeds a muon config into a single muon-launcher executable.\n *\n * @param options Launcher executable embedding options.\n * @returns Embedding result metadata.\n */\nexport const embedMuonConfigInLauncherFile = async ({\n launcherPath,\n configPath,\n outputPath,\n}: EmbedMuonConfigLauncherOptions): Promise<EmbedMuonConfigResult> => {\n const config = await readMuonConfigInput(configPath);\n const payload = encodeMuonConfigTlv(config);\n const embeddedSlot = createMuonLauncherEmbeddedConfigSlot(payload);\n const launcherContent = await readFile(launcherPath);\n if (isSignedPeExecutable(launcherContent)) {\n throw new Error(\n \"Cannot embed muon config into a signed muon-launcher PE executable.\",\n );\n }\n\n const slot = findMuonLauncherEmbeddedConfigSlot(launcherContent);\n const patchedContent = Buffer.from(launcherContent);\n embeddedSlot.copy(patchedContent, slot.offset);\n const resolvedOutputPath = outputPath ?? launcherPath;\n await writeFile(resolvedOutputPath, patchedContent);\n\n return {\n corePath: launcherPath,\n outputPath: resolvedOutputPath,\n slotOffset: slot.offset,\n payloadSize: payload.length,\n replaced: false,\n };\n};\n\nconst resolveRuntimeCorePath = async (runtimePath: string): Promise<string> => {\n const candidates = [\n join(runtimePath, \"muon-core\"),\n join(runtimePath, \"muon-core.exe\"),\n ];\n const existing: string[] = [];\n for (const candidate of candidates) {\n try {\n await access(candidate);\n existing.push(candidate);\n } catch {\n // Missing candidates are ignored until the final count check.\n }\n }\n if (existing.length !== 1) {\n throw new Error(\n `Expected exactly one muon-core executable in runtime path, found ${existing.length}.`,\n );\n }\n const [corePath] = existing;\n if (corePath === undefined) {\n throw new Error(\"muon-core executable was not found.\");\n }\n return corePath;\n};\n\n/**\n * Embeds a muon config into a runtime directory containing muon-core.\n *\n * @param options Runtime directory embedding options.\n * @returns Embedding result metadata.\n */\nexport const embedMuonConfigInRuntime = async ({\n runtimePath,\n configPath,\n outputRuntimePath,\n}: EmbedMuonConfigRuntimeOptions): Promise<EmbedMuonConfigResult> => {\n const targetRuntimePath = outputRuntimePath ?? runtimePath;\n if (outputRuntimePath !== undefined) {\n await cp(runtimePath, outputRuntimePath, {\n recursive: true,\n force: true,\n });\n }\n return embedMuonConfigInCoreFile({\n corePath: await resolveRuntimeCorePath(targetRuntimePath),\n configPath,\n outputPath: undefined,\n });\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nimport sharp from \"sharp\";\n\nconst normalizedIconSize = 256;\nconst windowsIconDibSizes = [16, 24, 32, 48, 64, 128] as const;\nconst pngSignature = Buffer.from([\n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,\n]);\n\ninterface RawIconImage {\n data: Buffer;\n width: number;\n height: number;\n}\n\ninterface WindowsIconImage {\n data: Buffer;\n size: number;\n bitCount: number;\n}\n\n/**\n * Creates a normalized square PNG icon image.\n *\n * @param pngData Source PNG bytes.\n * @param source Diagnostic source label used in errors.\n * @param label User-facing diagnostic label.\n * @returns PNG bytes normalized to the muon base icon size.\n * @remarks Non-square images are fitted into transparent padding without\n * stretching. The normalized PNG is the source for all platform-specific icon\n * derivatives.\n */\nexport const createNormalizedIconPngData = async (\n pngData: Buffer,\n source: string,\n label: string,\n): Promise<Buffer> => {\n await assertPngData(pngData, source, label);\n try {\n return await sharp(pngData)\n .resize(normalizedIconSize, normalizedIconSize, {\n fit: \"contain\",\n background: { r: 0, g: 0, b: 0, alpha: 0 },\n })\n .ensureAlpha()\n .png()\n .toBuffer();\n } catch {\n throw new Error(`${label} must be a valid PNG: ${source}`);\n }\n};\n\n/**\n * Creates a normalized square PNG icon image for Windows resources.\n *\n * @param pngData Source PNG bytes.\n * @param source Diagnostic source label used in errors.\n * @returns PNG bytes normalized to the muon base icon size.\n */\nexport const createNormalizedMuonIconPngData = async (\n pngData: Buffer,\n source: string,\n): Promise<Buffer> =>\n await createNormalizedIconPngData(pngData, source, \"Windows resource icon\");\n\n/**\n * Creates a Windows ICO file from PNG bytes.\n *\n * @param pngData Source PNG bytes.\n * @param source Diagnostic source label used in errors.\n * @returns ICO file bytes containing 16, 24, 32, 48, 64, 128, and 256 pixel images.\n * @remarks The 256px entry is PNG-compressed. Smaller entries are 32-bit DIB\n * images, matching the common Windows ICO layout recommended by Microsoft.\n */\nexport const createWindowsIconBufferFromPngData = async (\n pngData: Buffer,\n source: string,\n): Promise<Buffer> => {\n const normalizedPng = await createNormalizedMuonIconPngData(pngData, source);\n const images: WindowsIconImage[] = [];\n for (const size of windowsIconDibSizes) {\n const rawImage = await resizePngToRawRgba(normalizedPng, size, source);\n images.push({\n data: createDibIconImage(rawImage),\n size,\n bitCount: 32,\n });\n }\n images.push({\n data: normalizedPng,\n size: normalizedIconSize,\n bitCount: 32,\n });\n return createIco(images);\n};\n\n/**\n * Creates a Windows ICO file from a PNG file.\n *\n * @param sourcePath Source PNG file path.\n * @param outputPath Output ICO file path.\n * @returns Promise resolved when the ICO file has been written.\n */\nexport const createWindowsIconFromPngFile = async (\n sourcePath: string,\n outputPath: string,\n): Promise<void> => {\n const icon = await createWindowsIconBufferFromPngData(\n await readFile(sourcePath),\n sourcePath,\n );\n await mkdir(dirname(outputPath), { recursive: true });\n await writeFile(outputPath, icon);\n};\n\nconst assertPngData = async (\n data: Buffer,\n source: string,\n label: string,\n): Promise<void> => {\n if (data.length === 0) {\n throw new Error(`${label} PNG must not be empty: ${source}`);\n }\n if (!data.subarray(0, pngSignature.length).equals(pngSignature)) {\n throw new Error(`${label} must be a valid PNG: ${source}`);\n }\n try {\n const metadata = await sharp(data).metadata();\n if (metadata.format !== \"png\") {\n throw new Error();\n }\n } catch {\n throw new Error(`${label} must be a valid PNG: ${source}`);\n }\n};\n\nconst resizePngToRawRgba = async (\n pngData: Buffer,\n size: number,\n source: string,\n): Promise<RawIconImage> => {\n try {\n const { data, info } = await sharp(pngData)\n .resize(size, size, {\n fit: \"fill\",\n kernel: \"lanczos3\",\n })\n .ensureAlpha()\n .raw()\n .toBuffer({ resolveWithObject: true });\n if (info.width !== size || info.height !== size || info.channels !== 4) {\n throw new Error();\n }\n return {\n data,\n width: info.width,\n height: info.height,\n };\n } catch {\n throw new Error(`Failed to resize Windows resource icon PNG: ${source}`);\n }\n};\n\nconst createDibIconImage = (image: RawIconImage): Buffer => {\n const pixelBytes = image.width * image.height * 4;\n const maskStride = Math.ceil(image.width / 32) * 4;\n const maskBytes = maskStride * image.height;\n const output = Buffer.alloc(40 + pixelBytes + maskBytes);\n output.writeUInt32LE(40, 0);\n output.writeInt32LE(image.width, 4);\n output.writeInt32LE(image.height * 2, 8);\n output.writeUInt16LE(1, 12);\n output.writeUInt16LE(32, 14);\n output.writeUInt32LE(0, 16);\n output.writeUInt32LE(pixelBytes + maskBytes, 20);\n output.writeInt32LE(0, 24);\n output.writeInt32LE(0, 28);\n output.writeUInt32LE(0, 32);\n output.writeUInt32LE(0, 36);\n\n for (let y = 0; y < image.height; y += 1) {\n const sourceY = image.height - 1 - y;\n for (let x = 0; x < image.width; x += 1) {\n const sourceOffset = (sourceY * image.width + x) * 4;\n const outputOffset = 40 + (y * image.width + x) * 4;\n output[outputOffset] = image.data[sourceOffset + 2]!;\n output[outputOffset + 1] = image.data[sourceOffset + 1]!;\n output[outputOffset + 2] = image.data[sourceOffset]!;\n output[outputOffset + 3] = image.data[sourceOffset + 3]!;\n }\n }\n return output;\n};\n\nconst createIco = (images: readonly WindowsIconImage[]): Buffer => {\n const directorySize = 6 + images.length * 16;\n let imageOffset = directorySize;\n const header = Buffer.alloc(directorySize);\n header.writeUInt16LE(0, 0);\n header.writeUInt16LE(1, 2);\n header.writeUInt16LE(images.length, 4);\n\n const imageData: Buffer[] = [];\n images.forEach((image, index) => {\n const entryOffset = 6 + index * 16;\n header[entryOffset] = image.size === 256 ? 0 : image.size;\n header[entryOffset + 1] = image.size === 256 ? 0 : image.size;\n header[entryOffset + 2] = 0;\n header[entryOffset + 3] = 0;\n header.writeUInt16LE(1, entryOffset + 4);\n header.writeUInt16LE(image.bitCount, entryOffset + 6);\n header.writeUInt32LE(image.data.length, entryOffset + 8);\n header.writeUInt32LE(imageOffset, entryOffset + 12);\n imageOffset += image.data.length;\n imageData.push(image.data);\n });\n\n return Buffer.concat([header, ...imageData]);\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport { access, readFile } from \"node:fs/promises\";\nimport { extname, isAbsolute, resolve } from \"node:path\";\n\nimport { createNormalizedIconPngData } from \"./windows-icon.js\";\n\ntype JsonObject = Record<string, unknown>;\n\n/**\n * ZIP entry used for the generated static application icon asset.\n */\nexport const appIconAssetEntryName = \"main/.muon/app-icon.png\";\n\n/**\n * Runtime asset URL injected as the generated initial title bar icon.\n */\nexport const appIconAssetUrl = \"asset://main/.muon/app-icon.png\";\n\n/**\n * Source for a unified static application icon path.\n */\nexport interface MuonAppIconSource {\n /** Raw icon path as supplied by the source. */\n iconPath: string;\n /** Directory that relative icon paths are resolved from. */\n directory: string;\n}\n\n/**\n * Creates a static application icon source from API or CLI options.\n */\nexport const createAppIconOptionsSource = (\n iconPath: unknown,\n directory: string,\n label: string = \"iconPath\",\n): MuonAppIconSource | undefined => {\n if (iconPath === undefined) {\n return undefined;\n }\n if (typeof iconPath !== \"string\") {\n throw new Error(`${label} must be a string when present.`);\n }\n if (iconPath.trim() === \"\") {\n return undefined;\n }\n return {\n iconPath: iconPath.trim(),\n directory,\n };\n};\n\n/**\n * Reads the top-level `iconPath` from a muon config object.\n */\nexport const readConfigAppIconSource = (\n config: JsonObject,\n directory: string,\n label: string,\n): MuonAppIconSource | undefined => {\n const value = config.iconPath;\n if (value === undefined) {\n return undefined;\n }\n if (typeof value !== \"string\") {\n throw new Error(`${label} iconPath must be a string when present.`);\n }\n return createAppIconOptionsSource(value, directory);\n};\n\n/**\n * Reads the top-level `iconPath` from project metadata.\n */\nexport const readProjectAppIconSource = (\n projectJson: JsonObject,\n directory: string,\n): MuonAppIconSource | undefined => {\n const value = projectJson.iconPath;\n return typeof value === \"string\"\n ? createAppIconOptionsSource(value, directory)\n : undefined;\n};\n\n/**\n * Resolves and validates the first available static application icon source.\n */\nexport const resolveMuonAppIconPath = async (\n sources: readonly MuonAppIconSource[],\n): Promise<string | undefined> => {\n for (const source of sources) {\n const iconPath = resolveResourcePath(source.directory, source.iconPath);\n await assertMuonAppIconPath(iconPath);\n return iconPath;\n }\n return undefined;\n};\n\nconst assertMuonAppIconPath = async (iconPath: string): Promise<void> => {\n if (extname(iconPath).toLowerCase() !== \".png\") {\n throw new Error(`muon app icon must be a .png file: ${iconPath}`);\n }\n if (!(await fileExists(iconPath))) {\n throw new Error(`muon app icon does not exist: ${iconPath}`);\n }\n await createNormalizedIconPngData(\n await readFile(iconPath),\n iconPath,\n \"muon app icon\",\n );\n};\n\nconst resolveResourcePath = (directory: string, value: string): string =>\n isAbsolute(value) ? value : resolve(directory, value);\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport {\n access,\n chmod,\n copyFile,\n mkdtemp,\n readFile,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, extname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\n\nimport { runMuonPrepareResourceUpdate } from \"./prepare.js\";\nimport type { MuonWindowsResourceOptions } from \"./vite.js\";\nimport {\n createNormalizedMuonIconPngData,\n createWindowsIconFromPngFile,\n} from \"./windows-icon.js\";\nimport {\n createAppIconOptionsSource,\n readConfigAppIconSource,\n readProjectAppIconSource,\n resolveMuonAppIconPath,\n type MuonAppIconSource,\n} from \"./app-icon.js\";\n\nexport type { MuonWindowsResourceOptions } from \"./vite.js\";\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst defaultLanguage = 1033;\nconst defaultCodePage = 1200;\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\ntype JsonObject = Record<string, unknown>;\n\ninterface WindowsResourceSource {\n options: MuonWindowsResourceOptions;\n directory: string;\n}\n\ninterface WindowsResourceDefaults {\n productName: string;\n fileDescription: string;\n companyName: string;\n version: string;\n copyright: string | undefined;\n}\n\ninterface ResolveWindowsResourceInput {\n root: string;\n packageDirectory: string;\n packageJson: JsonObject;\n muonConfig: JsonObject;\n muonConfigDirectory: string;\n options: MuonWindowsResourceOptions | undefined;\n appIconPath: string | undefined;\n defaults: WindowsResourceDefaults;\n}\n\n/**\n * Resolved Windows resource metadata used by build and pack outputs.\n */\nexport interface ResolvedMuonWindowsResource {\n /** Resolved `.png` icon file path. */\n iconPath: string;\n /** Product name. */\n productName: string;\n /** File description. */\n fileDescription: string;\n /** Company name. */\n companyName: string;\n /** Original version string. */\n version: string;\n /** Four-part fixed version string. */\n fixedVersion: string;\n /** Legal copyright, if supplied. */\n copyright: string | undefined;\n /** Windows resource language identifier. */\n language: number;\n /** Windows version resource code page. */\n codePage: number;\n}\n\n/**\n * muon config file content and directory used for resource option resolution.\n */\nexport interface MuonWindowsResourceConfigSource {\n /** Parsed muon config object. */\n config: JsonObject;\n /** Directory that relative config paths are resolved from. */\n directory: string;\n}\n\n/**\n * Reads the muon config file using the same default file names as muon build.\n */\nexport const readMuonConfigForWindowsResource = async (\n root: string,\n configPath: string | undefined,\n): Promise<MuonWindowsResourceConfigSource> => {\n const resolvedConfigPath = await resolveConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n config: {},\n directory: root,\n };\n }\n return {\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n directory: dirname(resolvedConfigPath),\n };\n};\n\n/**\n * Merges Windows resource options while preserving field-level fallback.\n */\nexport const mergeMuonWindowsResourceOptions = (\n primary: MuonWindowsResourceOptions | undefined,\n fallback: MuonWindowsResourceOptions | undefined,\n): MuonWindowsResourceOptions | undefined => {\n if (primary === undefined) {\n return fallback;\n }\n if (fallback === undefined) {\n return primary;\n }\n\n const merged: MuonWindowsResourceOptions = { ...fallback };\n if (primary.iconPath !== undefined) {\n merged.iconPath = primary.iconPath;\n }\n if (primary.productName !== undefined) {\n merged.productName = primary.productName;\n }\n if (primary.fileDescription !== undefined) {\n merged.fileDescription = primary.fileDescription;\n }\n if (primary.companyName !== undefined) {\n merged.companyName = primary.companyName;\n }\n if (primary.version !== undefined) {\n merged.version = primary.version;\n }\n if (primary.copyright !== undefined) {\n merged.copyright = primary.copyright;\n }\n if (primary.language !== undefined) {\n merged.language = primary.language;\n }\n if (primary.codePage !== undefined) {\n merged.codePage = primary.codePage;\n }\n return merged;\n};\n\n/**\n * Resolves Windows resource metadata from options, config files, and package metadata.\n */\nexport const resolveMuonWindowsResource = async (\n input: ResolveWindowsResourceInput,\n): Promise<ResolvedMuonWindowsResource> => {\n const projectJson = await readProjectJson(input.root);\n const windowsSources = [\n createOptionsSource(input.options, input.root, \"windowsResource\"),\n readConfigWindowsResourceSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n readConfigWindowsResourceSource(projectJson, input.root, \"project.json\"),\n ].filter((source): source is WindowsResourceSource => source !== undefined);\n const sources = [\n ...windowsSources,\n createProjectSource(projectJson, input.root),\n createPackageSource(input.packageJson, input.root),\n ].filter((source): source is WindowsResourceSource => source !== undefined);\n const appIconSources = [\n createAppIconOptionsSource(input.appIconPath, input.root),\n readConfigAppIconSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n readProjectAppIconSource(projectJson, input.root),\n ].filter((source): source is MuonAppIconSource => source !== undefined);\n\n const productName = resolveStringField(\n sources,\n \"productName\",\n input.defaults.productName,\n );\n const fileDescription = resolveStringField(\n sources,\n \"fileDescription\",\n input.defaults.fileDescription,\n );\n const companyName = resolveStringField(\n sources,\n \"companyName\",\n input.defaults.companyName,\n );\n const version = resolveStringField(\n sources,\n \"version\",\n input.defaults.version,\n );\n const copyright = resolveOptionalStringField(\n sources,\n \"copyright\",\n input.defaults.copyright,\n );\n const language = resolveNumericField(sources, \"language\", defaultLanguage);\n const codePage = resolveNumericField(sources, \"codePage\", defaultCodePage);\n const fixedVersion = normalizeWindowsVersion(version);\n const iconPath = await resolveWindowsIconPath(\n windowsSources,\n appIconSources,\n await resolveDefaultWindowsIcon(input.packageDirectory),\n );\n\n return {\n iconPath,\n productName,\n fileDescription,\n companyName,\n version,\n fixedVersion,\n copyright,\n language,\n codePage,\n };\n};\n\n/**\n * Removes build-only Windows resource settings from runtime config.\n */\nexport const stripBuildOnlyWindowsResourceConfig = (\n sourceConfig: JsonObject,\n): JsonObject => {\n const sourceWindows = sourceConfig.windows;\n if (!isJsonObject(sourceWindows)) {\n return sourceConfig;\n }\n\n const windowsConfig: JsonObject = {};\n for (const [key, value] of Object.entries(sourceWindows)) {\n if (key !== \"resource\") {\n windowsConfig[key] = value;\n }\n }\n\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"windows\") {\n output[key] = value;\n }\n }\n if (Object.keys(windowsConfig).length > 0) {\n output.windows = windowsConfig;\n }\n return output;\n};\n\n/**\n * Returns true when the file has a Windows PE header.\n */\nexport const isWindowsPeExecutable = async (path: string): Promise<boolean> => {\n const content = await readFile(path);\n if (content.length < 0x40 || content.toString(\"ascii\", 0, 2) !== \"MZ\") {\n return false;\n }\n const peOffset = content.readUInt32LE(0x3c);\n return (\n peOffset + 4 <= content.length &&\n content.toString(\"ascii\", peOffset, peOffset + 4) === \"PE\\0\\0\"\n );\n};\n\n/**\n * Applies resolved resource metadata to a Windows PE executable in place.\n */\nexport const updateWindowsPeResources = async (input: {\n executablePath: string;\n resource: ResolvedMuonWindowsResource;\n environment: NodeJS.ProcessEnv;\n cwd: string;\n}): Promise<boolean> => {\n return await updateWindowsPeResourceFile(input, createEngraverUpdate);\n};\n\n/**\n * Applies only resolved icon metadata to a Windows PE executable in place.\n */\nexport const updateWindowsPeIconResource = async (input: {\n executablePath: string;\n resource: ResolvedMuonWindowsResource;\n environment: NodeJS.ProcessEnv;\n cwd: string;\n}): Promise<boolean> => {\n return await updateWindowsPeResourceFile(input, createEngraverIconUpdate);\n};\n\nconst updateWindowsPeResourceFile = async (\n input: {\n executablePath: string;\n resource: ResolvedMuonWindowsResource;\n environment: NodeJS.ProcessEnv;\n cwd: string;\n },\n createUpdate: (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n ) => JsonObject,\n): Promise<boolean> => {\n if (!(await isWindowsPeExecutable(input.executablePath))) {\n return false;\n }\n\n const mode = (await stat(input.executablePath)).mode & 0o777;\n const tempDirectory = await mkdtemp(join(tmpdir(), \"muon-windows-resource-\"));\n const updatesJsonPath = join(tempDirectory, \"updates.json\");\n const outputPath = join(tempDirectory, \"output.exe\");\n const iconPath = join(tempDirectory, \"icon.ico\");\n try {\n await createWindowsIconFromPngFile(input.resource.iconPath, iconPath);\n await writeFile(\n updatesJsonPath,\n `${JSON.stringify(createUpdate(input.resource, iconPath), null, 2)}\\n`,\n );\n await runMuonPrepareResourceUpdate({\n inputPath: input.executablePath,\n updatesJsonPath,\n outputPath,\n quiet: true,\n prepareExecutablePath: undefined,\n environment: input.environment,\n cwd: input.cwd,\n });\n await copyFile(outputPath, input.executablePath);\n await chmod(input.executablePath, mode === 0 ? 0o755 : mode);\n return true;\n } finally {\n await rm(tempDirectory, { recursive: true, force: true });\n }\n};\n\nconst createEngraverUpdate = (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n): JsonObject => {\n const strings: JsonObject = {\n CompanyName: resource.companyName,\n FileDescription: resource.fileDescription,\n FileVersion: resource.version,\n ProductName: resource.productName,\n ProductVersion: resource.version,\n };\n if (resource.copyright !== undefined) {\n strings.LegalCopyright = resource.copyright;\n }\n\n return {\n version: {\n language: resource.language,\n codePage: resource.codePage,\n fixed: {\n fileVersion: resource.fixedVersion,\n productVersion: resource.fixedVersion,\n fileOS: \"windows32\",\n fileType: \"app\",\n },\n strings,\n },\n icons: createEngraverIcons(resource, iconPath),\n };\n};\n\nconst createEngraverIconUpdate = (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n): JsonObject => ({\n icons: createEngraverIcons(resource, iconPath),\n});\n\nconst createEngraverIcons = (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n): JsonObject[] => [\n {\n id: 1,\n language: resource.language,\n path: iconPath,\n },\n];\n\nconst resolveConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n return undefined;\n};\n\nconst readProjectJson = async (root: string): Promise<JsonObject> => {\n const projectJsonPath = join(root, \"project.json\");\n if (!(await fileExists(projectJsonPath))) {\n return {};\n }\n return await readJsonObjectFile(projectJsonPath, \"project.json\");\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n const parsed = parse(await readFile(filePath, \"utf8\"));\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n return parsed;\n};\n\nconst createOptionsSource = (\n options: MuonWindowsResourceOptions | undefined,\n directory: string,\n label: string,\n): WindowsResourceSource | undefined => {\n if (options === undefined) {\n return undefined;\n }\n return {\n options: validateWindowsResourceOptions(options, label),\n directory,\n };\n};\n\nconst readConfigWindowsResourceSource = (\n config: JsonObject,\n directory: string,\n label: string,\n): WindowsResourceSource | undefined => {\n const windows = config.windows;\n if (windows === undefined) {\n return undefined;\n }\n if (!isJsonObject(windows)) {\n throw new Error(`${label} windows must be an object when present.`);\n }\n const resource = windows.resource;\n if (resource === undefined) {\n return undefined;\n }\n return createOptionsSource(\n validateWindowsResourceOptions(resource, `${label} windows.resource`),\n directory,\n `${label} windows.resource`,\n );\n};\n\nconst createProjectSource = (\n projectJson: JsonObject,\n directory: string,\n): WindowsResourceSource | undefined => {\n const topLevel: MuonWindowsResourceOptions = {};\n copyStringField(projectJson, \"productName\", topLevel, \"productName\");\n copyStringField(projectJson, \"name\", topLevel, \"productName\");\n copyStringField(projectJson, \"fileDescription\", topLevel, \"fileDescription\");\n copyStringField(projectJson, \"description\", topLevel, \"fileDescription\");\n copyStringField(projectJson, \"companyName\", topLevel, \"companyName\");\n copyStringField(projectJson, \"version\", topLevel, \"version\");\n copyStringField(projectJson, \"copyright\", topLevel, \"copyright\");\n const author = stringifyAuthor(projectJson.author);\n if (author !== undefined && topLevel.companyName === undefined) {\n topLevel.companyName = author;\n }\n\n const configSource = readConfigWindowsResourceSource(\n projectJson,\n directory,\n \"project.json\",\n );\n const options = mergeMuonWindowsResourceOptions(\n configSource?.options,\n topLevel,\n );\n if (options === undefined || Object.keys(options).length === 0) {\n return undefined;\n }\n return {\n options,\n directory,\n };\n};\n\nconst createPackageSource = (\n packageJson: JsonObject,\n directory: string,\n): WindowsResourceSource | undefined => {\n const options: MuonWindowsResourceOptions = {};\n copyStringField(packageJson, \"name\", options, \"productName\");\n copyStringField(packageJson, \"description\", options, \"fileDescription\");\n copyStringField(packageJson, \"version\", options, \"version\");\n copyStringField(packageJson, \"copyright\", options, \"copyright\");\n const author = stringifyAuthor(packageJson.author);\n if (author !== undefined) {\n options.companyName = author;\n }\n return Object.keys(options).length === 0\n ? undefined\n : {\n options,\n directory,\n };\n};\n\nconst copyStringField = (\n source: JsonObject,\n sourceKey: string,\n target: MuonWindowsResourceOptions,\n targetKey: keyof Pick<\n MuonWindowsResourceOptions,\n \"productName\" | \"fileDescription\" | \"companyName\" | \"version\" | \"copyright\"\n >,\n): void => {\n const value = source[sourceKey];\n if (typeof value === \"string\" && value.trim() !== \"\") {\n target[targetKey] = value.trim();\n }\n};\n\nconst validateWindowsResourceOptions = (\n value: unknown,\n label: string,\n): MuonWindowsResourceOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`${label} must be an object.`);\n }\n\n const output: MuonWindowsResourceOptions = {};\n copyOptionalStringResourceField(value, \"iconPath\", output);\n copyOptionalStringResourceField(value, \"productName\", output);\n copyOptionalStringResourceField(value, \"fileDescription\", output);\n copyOptionalStringResourceField(value, \"companyName\", output);\n copyOptionalStringResourceField(value, \"version\", output);\n copyOptionalStringResourceField(value, \"copyright\", output);\n copyOptionalNumberResourceField(value, \"language\", output, label);\n copyOptionalNumberResourceField(value, \"codePage\", output, label);\n return output;\n};\n\nconst copyOptionalStringResourceField = (\n source: JsonObject,\n key: keyof Pick<\n MuonWindowsResourceOptions,\n | \"iconPath\"\n | \"productName\"\n | \"fileDescription\"\n | \"companyName\"\n | \"version\"\n | \"copyright\"\n >,\n target: MuonWindowsResourceOptions,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (typeof value !== \"string\") {\n throw new Error(`${key} must be a string when present.`);\n }\n if (value.trim() !== \"\") {\n target[key] = value.trim();\n }\n};\n\nconst copyOptionalNumberResourceField = (\n source: JsonObject,\n key: keyof Pick<MuonWindowsResourceOptions, \"language\" | \"codePage\">,\n target: MuonWindowsResourceOptions,\n label: string,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (\n typeof value !== \"number\" ||\n !Number.isInteger(value) ||\n value < 0 ||\n value > 0xffff\n ) {\n throw new Error(`${label} ${key} must be an integer from 0 to 65535.`);\n }\n target[key] = value;\n};\n\nconst resolveStringField = (\n sources: readonly WindowsResourceSource[],\n field: keyof Pick<\n MuonWindowsResourceOptions,\n \"productName\" | \"fileDescription\" | \"companyName\" | \"version\"\n >,\n fallback: string,\n): string => {\n return resolveOptionalStringField(sources, field, fallback) ?? fallback;\n};\n\nconst resolveOptionalStringField = (\n sources: readonly WindowsResourceSource[],\n field: keyof Pick<\n MuonWindowsResourceOptions,\n \"productName\" | \"fileDescription\" | \"companyName\" | \"version\" | \"copyright\"\n >,\n fallback: string | undefined,\n): string | undefined => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined && value.trim() !== \"\") {\n return value.trim();\n }\n }\n return fallback;\n};\n\nconst resolveNumericField = (\n sources: readonly WindowsResourceSource[],\n field: keyof Pick<MuonWindowsResourceOptions, \"language\" | \"codePage\">,\n fallback: number,\n): number => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined) {\n return value;\n }\n }\n return fallback;\n};\n\nconst resolveWindowsIconPath = async (\n windowsSources: readonly WindowsResourceSource[],\n appIconSources: readonly MuonAppIconSource[],\n defaultIconPath: string,\n): Promise<string> => {\n for (const source of windowsSources) {\n const value = source.options.iconPath;\n if (value !== undefined && value.trim() !== \"\") {\n const iconPath = resolveResourcePath(source.directory, value);\n await assertIconPath(iconPath);\n return iconPath;\n }\n }\n const appIconPath = await resolveMuonAppIconPath(appIconSources);\n if (appIconPath !== undefined) {\n return appIconPath;\n }\n await assertIconPath(defaultIconPath);\n return defaultIconPath;\n};\n\nconst assertIconPath = async (iconPath: string): Promise<void> => {\n if (extname(iconPath).toLowerCase() !== \".png\") {\n throw new Error(`Windows resource icon must be a .png file: ${iconPath}`);\n }\n if (!(await fileExists(iconPath))) {\n throw new Error(`Windows resource icon does not exist: ${iconPath}`);\n }\n await createNormalizedMuonIconPngData(await readFile(iconPath), iconPath);\n};\n\nconst resolveDefaultWindowsIcon = async (\n packageDirectory: string,\n): Promise<string> => {\n const sourceIconPath = join(\n moduleDirectory,\n \"..\",\n \"..\",\n \"images\",\n \"muon-256.png\",\n );\n const candidates = [\n join(resolve(packageDirectory), \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"..\", \"dist\", \"native\", \"muon-256.png\"),\n sourceIconPath,\n ];\n for (const candidate of candidates) {\n if (await fileExists(candidate)) {\n return candidate;\n }\n }\n return sourceIconPath;\n};\n\nconst resolveResourcePath = (directory: string, path: string): string => {\n return isAbsolute(path) ? path : resolve(directory, path);\n};\n\nconst normalizeWindowsVersion = (version: string): string => {\n const normalized = version.trim();\n const match = /^(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?(?:\\.(\\d+))?(?:$|[-+])/.exec(\n normalized,\n );\n if (match === null) {\n throw new Error(\n `Windows resource version must start with numeric parts: ${version}`,\n );\n }\n const values = [match[1], match[2], match[3], match[4]].map((value) =>\n value === undefined ? 0 : Number.parseInt(value, 10),\n );\n for (const value of values) {\n if (!Number.isInteger(value) || value < 0 || value > 0xffff) {\n throw new Error(\n `Windows resource version part must be from 0 to 65535: ${version}`,\n );\n }\n }\n return values.join(\".\");\n};\n\nconst stringifyAuthor = (value: unknown): string | undefined => {\n if (typeof value === \"string\" && value.trim() !== \"\") {\n return value.trim();\n }\n if (!isJsonObject(value) || typeof value.name !== \"string\") {\n return undefined;\n }\n const name = value.name.trim();\n if (name === \"\") {\n return undefined;\n }\n return value.email === undefined || typeof value.email !== \"string\"\n ? name\n : `${name} <${value.email}>`;\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport { access, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname, extname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\n\nimport type { MuonLinuxDesktopOptions } from \"./vite.js\";\nimport { createNormalizedIconPngData } from \"./windows-icon.js\";\nimport {\n createAppIconOptionsSource,\n readConfigAppIconSource,\n readProjectAppIconSource,\n resolveMuonAppIconPath,\n type MuonAppIconSource,\n} from \"./app-icon.js\";\n\nexport type { MuonLinuxDesktopOptions } from \"./vite.js\";\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst defaultIconFileName = \"muon-desktop-icon.png\";\nconst defaultDesktopConfigFileName = \"muon-desktop.json\";\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\ntype JsonObject = Record<string, unknown>;\n\ninterface LinuxDesktopSource {\n options: MuonLinuxDesktopOptions;\n directory: string;\n}\n\ninterface LinuxDesktopDefaults {\n desktopId: string;\n name: string;\n comment: string;\n categories: readonly string[];\n startupNotify: boolean;\n}\n\ninterface ResolveLinuxDesktopInput {\n root: string;\n packageDirectory: string;\n muonConfig: JsonObject;\n muonConfigDirectory: string;\n options: MuonLinuxDesktopOptions | undefined;\n appIconPath: string | undefined;\n defaults: LinuxDesktopDefaults;\n}\n\n/**\n * Resolved Linux desktop integration metadata used by build and pack outputs.\n */\nexport interface ResolvedMuonLinuxDesktop {\n /** Desktop file identifier without the `.desktop` suffix. */\n desktopId: string;\n /** Application display name. */\n name: string;\n /** Application description used as a desktop entry comment. */\n comment: string;\n /** Desktop menu categories. */\n categories: readonly string[];\n /** Whether desktop startup notification is requested. */\n startupNotify: boolean;\n /** Resolved PNG icon file path. */\n iconPath: string;\n /** File name written into target distributions for the normalized icon. */\n iconFileName: string;\n /** File name written into target distributions for launcher desktop metadata. */\n configFileName: string;\n}\n\n/**\n * muon config file content and directory used for Linux desktop option\n * resolution.\n */\nexport interface MuonLinuxDesktopConfigSource {\n /** Parsed muon config object. */\n config: JsonObject;\n /** Directory that relative config paths are resolved from. */\n directory: string;\n}\n\n/**\n * Reads the muon config file using the same default file names as muon build.\n */\nexport const readMuonConfigForLinuxDesktop = async (\n root: string,\n configPath: string | undefined,\n): Promise<MuonLinuxDesktopConfigSource> => {\n const resolvedConfigPath = await resolveConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n config: {},\n directory: root,\n };\n }\n return {\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n directory: dirname(resolvedConfigPath),\n };\n};\n\n/**\n * Merges Linux desktop options while preserving field-level fallback.\n */\nexport const mergeMuonLinuxDesktopOptions = (\n primary: MuonLinuxDesktopOptions | undefined,\n fallback: MuonLinuxDesktopOptions | undefined,\n): MuonLinuxDesktopOptions | undefined => {\n if (primary === undefined) {\n return fallback;\n }\n if (fallback === undefined) {\n return primary;\n }\n\n const merged: MuonLinuxDesktopOptions = { ...fallback };\n if (primary.desktopId !== undefined) {\n merged.desktopId = primary.desktopId;\n }\n if (primary.name !== undefined) {\n merged.name = primary.name;\n }\n if (primary.comment !== undefined) {\n merged.comment = primary.comment;\n }\n if (primary.iconPath !== undefined) {\n merged.iconPath = primary.iconPath;\n }\n if (primary.categories !== undefined) {\n merged.categories = primary.categories;\n }\n if (primary.startupNotify !== undefined) {\n merged.startupNotify = primary.startupNotify;\n }\n return merged;\n};\n\n/**\n * Resolves Linux desktop integration metadata from options, config files, and\n * package metadata.\n */\nexport const resolveMuonLinuxDesktop = async (\n input: ResolveLinuxDesktopInput,\n): Promise<ResolvedMuonLinuxDesktop> => {\n const projectJson = await readProjectJson(input.root);\n const sources = [\n createOptionsSource(input.options, input.root, \"linuxDesktop\"),\n readConfigLinuxDesktopSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n ].filter((source): source is LinuxDesktopSource => source !== undefined);\n const appIconSources = [\n createAppIconOptionsSource(input.appIconPath, input.root),\n readConfigAppIconSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n readProjectAppIconSource(projectJson, input.root),\n ].filter((source): source is MuonAppIconSource => source !== undefined);\n\n const desktopId = sanitizeDesktopId(\n resolveStringField(sources, \"desktopId\", input.defaults.desktopId),\n );\n const name = resolveStringField(sources, \"name\", input.defaults.name);\n const comment = resolveStringField(\n sources,\n \"comment\",\n input.defaults.comment,\n );\n const categories = resolveCategories(sources, input.defaults.categories);\n const startupNotify = resolveBooleanField(\n sources,\n \"startupNotify\",\n input.defaults.startupNotify,\n );\n const iconPath = await resolveLinuxIconPath(\n sources,\n appIconSources,\n await resolveDefaultLinuxDesktopIcon(input.packageDirectory),\n );\n\n return {\n desktopId,\n name,\n comment,\n categories,\n startupNotify,\n iconPath,\n iconFileName: defaultIconFileName,\n configFileName: defaultDesktopConfigFileName,\n };\n};\n\n/**\n * Removes build-only Linux desktop settings from runtime config.\n */\nexport const stripBuildOnlyLinuxDesktopConfig = (\n sourceConfig: JsonObject,\n): JsonObject => {\n const sourceLinux = sourceConfig.linux;\n if (!isJsonObject(sourceLinux)) {\n return sourceConfig;\n }\n\n const linuxConfig: JsonObject = {};\n for (const [key, value] of Object.entries(sourceLinux)) {\n if (key !== \"desktop\") {\n linuxConfig[key] = value;\n }\n }\n\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"linux\") {\n output[key] = value;\n }\n }\n if (Object.keys(linuxConfig).length > 0) {\n output.linux = linuxConfig;\n }\n return output;\n};\n\n/**\n * Writes normalized Linux desktop sidecar files into a target distribution.\n */\nexport const writeLinuxDesktopDistributionFiles = async (\n outputPath: string,\n desktop: ResolvedMuonLinuxDesktop,\n): Promise<void> => {\n const iconData = await createNormalizedIconPngData(\n await readFile(desktop.iconPath),\n desktop.iconPath,\n \"Linux desktop icon\",\n );\n await writeFile(join(outputPath, desktop.iconFileName), iconData);\n await writeFile(\n join(outputPath, desktop.configFileName),\n `${JSON.stringify(\n {\n desktopId: desktop.desktopId,\n name: desktop.name,\n comment: desktop.comment,\n categories: desktop.categories,\n startupNotify: desktop.startupNotify,\n iconFileName: desktop.iconFileName,\n },\n undefined,\n 2,\n )}\\n`,\n );\n};\n\n/**\n * Creates a Desktop Entry file.\n */\nexport const createLinuxDesktopEntry = (input: {\n desktop: ResolvedMuonLinuxDesktop;\n exec: string;\n tryExec: string;\n icon: string;\n}): string => {\n const lines = [\n \"[Desktop Entry]\",\n \"Type=Application\",\n `Name=${escapeDesktopString(input.desktop.name)}`,\n ];\n if (input.desktop.comment.length > 0) {\n lines.push(`Comment=${escapeDesktopString(input.desktop.comment)}`);\n }\n lines.push(`Exec=${input.exec}`);\n lines.push(`TryExec=${input.tryExec}`);\n lines.push(`Icon=${escapeDesktopString(input.icon)}`);\n lines.push(`Terminal=false`);\n if (input.desktop.categories.length > 0) {\n lines.push(`Categories=${input.desktop.categories.join(\";\")};`);\n }\n lines.push(`StartupNotify=${input.desktop.startupNotify ? \"true\" : \"false\"}`);\n lines.push(`StartupWMClass=${escapeDesktopString(input.desktop.desktopId)}`);\n lines.push(\"X-muon-Managed=true\");\n lines.push(\"\");\n return lines.join(\"\\n\");\n};\n\n/**\n * Quotes one Desktop Entry Exec argument.\n */\nexport const quoteDesktopExecArgument = (value: string): string => {\n let escaped = '\"';\n for (const character of value) {\n if (\n character === '\"' ||\n character === \"\\\\\" ||\n character === \"$\" ||\n character === \"`\"\n ) {\n escaped += \"\\\\\";\n }\n escaped += character;\n }\n return `${escaped}\"`;\n};\n\nconst resolveConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n return undefined;\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n const parsed = parse(await readFile(filePath, \"utf8\"));\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n return parsed;\n};\n\nconst readProjectJson = async (root: string): Promise<JsonObject> => {\n const projectJsonPath = join(root, \"project.json\");\n if (!(await fileExists(projectJsonPath))) {\n return {};\n }\n return await readJsonObjectFile(projectJsonPath, \"project.json\");\n};\n\nconst createOptionsSource = (\n options: MuonLinuxDesktopOptions | undefined,\n directory: string,\n label: string,\n): LinuxDesktopSource | undefined => {\n if (options === undefined) {\n return undefined;\n }\n return {\n options: validateLinuxDesktopOptions(options, label),\n directory,\n };\n};\n\nconst readConfigLinuxDesktopSource = (\n config: JsonObject,\n directory: string,\n label: string,\n): LinuxDesktopSource | undefined => {\n const linux = config.linux;\n if (linux === undefined) {\n return undefined;\n }\n if (!isJsonObject(linux)) {\n throw new Error(`${label} linux must be an object when present.`);\n }\n const desktop = linux.desktop;\n if (desktop === undefined) {\n return undefined;\n }\n return createOptionsSource(\n validateLinuxDesktopOptions(desktop, `${label} linux.desktop`),\n directory,\n `${label} linux.desktop`,\n );\n};\n\nconst validateLinuxDesktopOptions = (\n value: unknown,\n label: string,\n): MuonLinuxDesktopOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`${label} must be an object.`);\n }\n\n const output: MuonLinuxDesktopOptions = {};\n copyOptionalStringDesktopField(value, \"desktopId\", output);\n copyOptionalStringDesktopField(value, \"name\", output);\n copyOptionalStringDesktopField(value, \"comment\", output);\n copyOptionalStringDesktopField(value, \"iconPath\", output);\n copyOptionalCategoriesField(value, output, label);\n copyOptionalBooleanDesktopField(value, \"startupNotify\", output, label);\n return output;\n};\n\nconst copyOptionalStringDesktopField = (\n source: JsonObject,\n key: keyof Pick<\n MuonLinuxDesktopOptions,\n \"desktopId\" | \"name\" | \"comment\" | \"iconPath\"\n >,\n target: MuonLinuxDesktopOptions,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (typeof value !== \"string\") {\n throw new Error(`${key} must be a string when present.`);\n }\n if (value.trim() !== \"\") {\n target[key] = value.trim();\n }\n};\n\nconst copyOptionalCategoriesField = (\n source: JsonObject,\n target: MuonLinuxDesktopOptions,\n label: string,\n): void => {\n const value = source.categories;\n if (value === undefined) {\n return;\n }\n if (\n !Array.isArray(value) ||\n !value.every(\n (entry) =>\n typeof entry === \"string\" &&\n entry.trim() !== \"\" &&\n !entry.includes(\";\") &&\n !entry.includes(\"\\n\") &&\n !entry.includes(\"\\r\"),\n )\n ) {\n throw new Error(\n `${label} categories must be a string array without semicolons when present.`,\n );\n }\n target.categories = value.map((entry) => entry.trim());\n};\n\nconst copyOptionalBooleanDesktopField = (\n source: JsonObject,\n key: keyof Pick<MuonLinuxDesktopOptions, \"startupNotify\">,\n target: MuonLinuxDesktopOptions,\n label: string,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (typeof value !== \"boolean\") {\n throw new Error(`${label} ${key} must be a boolean when present.`);\n }\n target[key] = value;\n};\n\nconst resolveStringField = (\n sources: readonly LinuxDesktopSource[],\n field: keyof Pick<MuonLinuxDesktopOptions, \"desktopId\" | \"name\" | \"comment\">,\n fallback: string,\n): string => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined && value.trim() !== \"\") {\n return value.trim();\n }\n }\n return fallback;\n};\n\nconst resolveCategories = (\n sources: readonly LinuxDesktopSource[],\n fallback: readonly string[],\n): readonly string[] => {\n for (const source of sources) {\n if (source.options.categories !== undefined) {\n return source.options.categories;\n }\n }\n return fallback;\n};\n\nconst resolveBooleanField = (\n sources: readonly LinuxDesktopSource[],\n field: keyof Pick<MuonLinuxDesktopOptions, \"startupNotify\">,\n fallback: boolean,\n): boolean => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined) {\n return value;\n }\n }\n return fallback;\n};\n\nconst resolveLinuxIconPath = async (\n sources: readonly LinuxDesktopSource[],\n appIconSources: readonly MuonAppIconSource[],\n defaultIconPath: string | undefined,\n): Promise<string> => {\n for (const source of sources) {\n const value = source.options.iconPath;\n if (value !== undefined && value.trim() !== \"\") {\n const iconPath = resolveResourcePath(source.directory, value);\n await assertIconPath(iconPath, true);\n return iconPath;\n }\n }\n const appIconPath = await resolveMuonAppIconPath(appIconSources);\n if (appIconPath !== undefined) {\n return appIconPath;\n }\n if (defaultIconPath !== undefined && (await fileExists(defaultIconPath))) {\n await assertIconPath(defaultIconPath, false);\n return defaultIconPath;\n }\n throw new Error(\"Linux desktop icon does not exist.\");\n};\n\nconst assertIconPath = async (\n iconPath: string,\n required: boolean,\n): Promise<void> => {\n if (extname(iconPath).toLowerCase() !== \".png\") {\n throw new Error(`Linux desktop icon must be a .png file: ${iconPath}`);\n }\n if (required && !(await fileExists(iconPath))) {\n throw new Error(`Linux desktop icon does not exist: ${iconPath}`);\n }\n if (await fileExists(iconPath)) {\n await createNormalizedIconPngData(\n await readFile(iconPath),\n iconPath,\n \"Linux desktop icon\",\n );\n }\n};\n\nconst resolveDefaultLinuxDesktopIcon = async (\n packageDirectory: string,\n): Promise<string | undefined> => {\n const candidates = [\n join(resolve(packageDirectory), \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"..\", \"dist\", \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"..\", \"..\", \"images\", \"muon-256.png\"),\n ];\n for (const candidate of candidates) {\n if (await fileExists(candidate)) {\n return candidate;\n }\n }\n return undefined;\n};\n\nconst sanitizeDesktopId = (value: string): string => {\n const sanitized = value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^[.-]+/g, \"\")\n .replace(/[.-]+$/g, \"\");\n return sanitized.length > 0 ? sanitized : \"muon-app\";\n};\n\nconst escapeDesktopString = (value: string): string =>\n value\n .replaceAll(\"\\\\\", \"\\\\\\\\\")\n .replaceAll(\"\\n\", \"\\\\n\")\n .replaceAll(\"\\r\", \"\\\\r\")\n .replaceAll(\"\\t\", \"\\\\t\");\n\nconst resolveResourcePath = (directory: string, path: string): string => {\n return isAbsolute(path) ? path : resolve(directory, path);\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn } from \"node:child_process\";\n\ntype JsonObject = Record<string, unknown>;\n\n/**\n * Windows executable artifact kind accepted by code signing options.\n */\nexport type MuonWindowsCodeSigningTarget =\n | \"runtime\"\n | \"launcher\"\n | \"nsisInstaller\"\n | \"nsisUninstaller\";\n\n/**\n * External Windows code signing command options.\n */\nexport interface MuonWindowsCodeSigningOptions {\n /**\n * Executable or script used to sign one file.\n */\n command: string;\n /**\n * Arguments passed to the signing command.\n *\n * @remarks `{path}` is required and is replaced with the executable path.\n * `{target}` and `{kind}` are also replaced when present.\n */\n args: readonly string[];\n /**\n * Artifact kinds to sign.\n *\n * @defaultValue Signs all supported Windows artifact kinds.\n */\n targets?: readonly MuonWindowsCodeSigningTarget[];\n}\n\n/**\n * Resolved Windows code signing command.\n */\nexport interface ResolvedMuonWindowsCodeSigning {\n /** Executable or script used to sign one file. */\n command: string;\n /** Arguments passed to the signing command. */\n args: readonly string[];\n /** Artifact kinds to sign. */\n targets: readonly MuonWindowsCodeSigningTarget[];\n}\n\ninterface WindowsCodeSigningExecution {\n /** Resolved signing command. */\n codeSigning: ResolvedMuonWindowsCodeSigning | undefined;\n /** Artifact kind being signed. */\n kind: MuonWindowsCodeSigningTarget;\n /** Public muon target identifier. */\n target: string;\n /** Executable path being signed. */\n path: string;\n /** Child process working directory. */\n cwd: string;\n /** Child process environment. */\n environment: NodeJS.ProcessEnv;\n}\n\nconst placeholderPath = \"{path}\";\nconst placeholderTarget = \"{target}\";\nconst placeholderKind = \"{kind}\";\n\nconst allWindowsCodeSigningTargets = [\n \"runtime\",\n \"launcher\",\n \"nsisInstaller\",\n \"nsisUninstaller\",\n] as const satisfies readonly MuonWindowsCodeSigningTarget[];\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isStringArray = (value: unknown): value is readonly string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst isWindowsCodeSigningTarget = (\n value: string,\n): value is MuonWindowsCodeSigningTarget =>\n allWindowsCodeSigningTargets.includes(value as MuonWindowsCodeSigningTarget);\n\nconst readWindowsCodeSigningTargets = (\n value: unknown,\n label: string,\n): readonly MuonWindowsCodeSigningTarget[] => {\n if (value === undefined) {\n return allWindowsCodeSigningTargets;\n }\n if (!isStringArray(value)) {\n throw new Error(`${label}.targets must be an array of strings.`);\n }\n if (value.length === 0) {\n throw new Error(`${label}.targets must not be empty.`);\n }\n const targets: MuonWindowsCodeSigningTarget[] = [];\n for (const target of value) {\n if (!isWindowsCodeSigningTarget(target)) {\n throw new Error(`Unsupported ${label}.targets entry: ${target}`);\n }\n if (!targets.includes(target)) {\n targets.push(target);\n }\n }\n return targets;\n};\n\n/**\n * Validates Windows code signing options.\n */\nexport const validateMuonWindowsCodeSigningOptions = (\n value: unknown,\n label: string,\n): MuonWindowsCodeSigningOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`${label} must be an object.`);\n }\n if (typeof value.command !== \"string\" || value.command.trim() === \"\") {\n throw new Error(`${label}.command must be a non-empty string.`);\n }\n if (!isStringArray(value.args)) {\n throw new Error(`${label}.args must be an array of strings.`);\n }\n if (!value.args.some((arg) => arg.includes(placeholderPath))) {\n throw new Error(`${label}.args must contain ${placeholderPath}.`);\n }\n\n return {\n command: value.command.trim(),\n args: value.args,\n targets: readWindowsCodeSigningTargets(value.targets, label),\n };\n};\n\n/**\n * Returns true when a value is valid Windows code signing options.\n */\nexport const isMuonWindowsCodeSigningOptions = (\n value: unknown,\n): value is MuonWindowsCodeSigningOptions => {\n try {\n validateMuonWindowsCodeSigningOptions(value, \"windowsCodeSigning\");\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Resolves Windows code signing options from API options and muon config.\n */\nexport const resolveMuonWindowsCodeSigning = (input: {\n muonConfig: JsonObject;\n options: false | MuonWindowsCodeSigningOptions | undefined;\n}): ResolvedMuonWindowsCodeSigning | undefined => {\n if (input.options === false) {\n return undefined;\n }\n if (input.options !== undefined) {\n return validateMuonWindowsCodeSigningOptions(\n input.options,\n \"windowsCodeSigning\",\n ) as ResolvedMuonWindowsCodeSigning;\n }\n\n const windows = input.muonConfig.windows;\n if (windows === undefined) {\n return undefined;\n }\n if (!isJsonObject(windows)) {\n throw new Error(\"muon.json windows must be an object when present.\");\n }\n const codeSigning = windows.codeSigning;\n if (codeSigning === undefined) {\n return undefined;\n }\n return validateMuonWindowsCodeSigningOptions(\n codeSigning,\n \"muon.json windows.codeSigning\",\n ) as ResolvedMuonWindowsCodeSigning;\n};\n\n/**\n * Removes build-only Windows code signing settings from runtime config.\n */\nexport const stripBuildOnlyWindowsCodeSigningConfig = (\n sourceConfig: JsonObject,\n): JsonObject => {\n const sourceWindows = sourceConfig.windows;\n if (!isJsonObject(sourceWindows)) {\n return sourceConfig;\n }\n\n const windowsConfig: JsonObject = {};\n for (const [key, value] of Object.entries(sourceWindows)) {\n if (key !== \"codeSigning\") {\n windowsConfig[key] = value;\n }\n }\n\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"windows\") {\n output[key] = value;\n }\n }\n if (Object.keys(windowsConfig).length > 0) {\n output.windows = windowsConfig;\n }\n return output;\n};\n\n/**\n * Applies supported placeholders to signing command arguments.\n */\nexport const createWindowsCodeSigningArgs = (input: {\n args: readonly string[];\n kind: MuonWindowsCodeSigningTarget;\n target: string;\n path: string;\n}): string[] =>\n input.args.map((arg) =>\n arg\n .replaceAll(placeholderPath, input.path)\n .replaceAll(placeholderTarget, input.target)\n .replaceAll(placeholderKind, input.kind),\n );\n\n/**\n * Returns true when a resolved signing command includes an artifact kind.\n */\nexport const includesWindowsCodeSigningTarget = (\n codeSigning: ResolvedMuonWindowsCodeSigning | undefined,\n kind: MuonWindowsCodeSigningTarget,\n): codeSigning is ResolvedMuonWindowsCodeSigning =>\n codeSigning !== undefined && codeSigning.targets.includes(kind);\n\n/**\n * Runs the configured Windows code signing command for one executable.\n */\nexport const signWindowsExecutable = async (\n input: WindowsCodeSigningExecution,\n): Promise<void> => {\n if (!includesWindowsCodeSigningTarget(input.codeSigning, input.kind)) {\n return;\n }\n const args = createWindowsCodeSigningArgs({\n args: input.codeSigning.args,\n kind: input.kind,\n target: input.target,\n path: input.path,\n });\n const child = spawn(input.codeSigning.command, args, {\n cwd: input.cwd,\n env: input.environment,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n let stderr = \"\";\n child.stderr.setEncoding(\"utf8\");\n child.stderr.on(\"data\", (chunk: string) => {\n stderr += chunk;\n });\n const exitCode = await new Promise<number>((resolvePromise, reject) => {\n child.once(\"error\", reject);\n child.once(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n if (exitCode !== 0) {\n throw new Error(\n `${input.codeSigning.command} failed while signing ${input.kind} ${input.path} with exit code ${exitCode}: ${stderr.trim()}`,\n );\n }\n};\n","'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport {\n copyFile,\n cp,\n mkdir,\n readFile,\n realpath,\n rm,\n stat,\n} from \"node:fs/promises\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n} from \"node:path\";\n\nimport SemverRange from \"semver/classes/range.js\";\n\ndeclare const __MUON_NODE_SUPPORTED_ENGINE_RANGE__: string;\n\ntype JsonObject = Record<string, unknown>;\n\nconst stagedNodeProjectDirectoryName = \"node-project\";\nconst nodeBridgeFileName = \"node-bridge.mjs\";\nconst supportedNodeRange = __MUON_NODE_SUPPORTED_ENGINE_RANGE__;\n\n/**\n * Node runtime constraint passed from the JavaScript build layer to a native\n * launcher or runtime preparer.\n */\nexport interface MuonNodeRuntimeRequirement {\n /** Whether the application must fail when no matching Node runtime exists. */\n readonly required: boolean;\n /** Whether `package.json` explicitly contains `engines.node`. */\n readonly engineRangeSpecified: boolean;\n /** Original `package.json` `engines.node` text, or `*` when omitted. */\n readonly engineRange: string;\n /**\n * Normalized comparator sets accepted by both the project and muon bridge.\n *\n * @remarks The outer array is an OR expression and each inner array is an\n * AND expression. An empty inner array represents a wildcard set.\n */\n readonly comparatorSets: readonly (readonly string[])[];\n}\n\n/**\n * Node project selected by the `node.project` muon configuration.\n */\nexport interface ResolvedMuonNodeProject {\n /** Absolute source directory copied into a muon runtime. */\n readonly sourcePath: string;\n /** Whether `package.json` explicitly contains `engines.node`. */\n readonly engineRangeSpecified: boolean;\n /** Original `package.json` `engines.node` text, or `*` when omitted. */\n readonly engineRange: string;\n /**\n * Normalized comparator sets accepted by both the project and muon bridge.\n */\n readonly comparatorSets: readonly (readonly string[])[];\n}\n\nconst normalizeComparatorSet = (\n comparators: SemverRange[\"set\"][number],\n): string[] =>\n comparators\n .map((comparator) => comparator.value)\n .filter((comparator) => comparator !== \"\");\n\nconst comparatorSetsIntersect = (\n left: readonly string[],\n right: readonly string[],\n): boolean =>\n new SemverRange(left.join(\" \")).intersects(new SemverRange(right.join(\" \")));\n\nconst intersectNodeEngineRanges = (\n projectRange: SemverRange,\n): readonly (readonly string[])[] => {\n const bridgeRange = new SemverRange(supportedNodeRange);\n const comparatorSets: string[][] = [];\n for (const bridgeComparators of bridgeRange.set) {\n const bridgeSet = normalizeComparatorSet(bridgeComparators);\n for (const projectComparators of projectRange.set) {\n const projectSet = normalizeComparatorSet(projectComparators);\n if (comparatorSetsIntersect(bridgeSet, projectSet)) {\n comparatorSets.push([...bridgeSet, ...projectSet]);\n }\n }\n }\n return comparatorSets;\n};\n\nconst readNodeEngineRequirement = async (\n packageJsonPath: string,\n): Promise<\n Pick<\n ResolvedMuonNodeProject,\n \"engineRangeSpecified\" | \"engineRange\" | \"comparatorSets\"\n >\n> => {\n let source: string;\n try {\n source = await readFile(packageJsonPath, \"utf8\");\n } catch (error) {\n throw new Error(\n `muon Node project package.json could not be read: ${packageJsonPath}: ${getErrorMessage(error)}`,\n );\n }\n\n let packageJson: unknown;\n try {\n packageJson = JSON.parse(source) as unknown;\n } catch (error) {\n throw new Error(\n `muon Node project package.json could not be parsed: ${packageJsonPath}: ${getErrorMessage(error)}`,\n );\n }\n if (!isJsonObject(packageJson)) {\n throw new Error(\n `muon Node project package.json must contain an object: ${packageJsonPath}`,\n );\n }\n\n const enginesValue = packageJson.engines;\n if (enginesValue !== undefined && !isJsonObject(enginesValue)) {\n throw new Error(\"package.json engines must be an object\");\n }\n const nodeValue = enginesValue?.node;\n if (\n nodeValue !== undefined &&\n (typeof nodeValue !== \"string\" || nodeValue.trim().length === 0)\n ) {\n throw new Error(\"package.json engines.node must be a non-empty string\");\n }\n\n const engineRange = nodeValue ?? \"*\";\n let projectRange: SemverRange;\n try {\n projectRange = new SemverRange(engineRange);\n } catch {\n throw new Error(\n `package.json engines.node is not a valid range: ${engineRange}`,\n );\n }\n const comparatorSets = intersectNodeEngineRanges(projectRange);\n if (comparatorSets.length === 0) {\n throw new Error(\n \"package.json engines.node does not overlap the muon Node bridge range\",\n );\n }\n return {\n engineRangeSpecified: nodeValue !== undefined,\n engineRange,\n comparatorSets,\n };\n};\n\n/**\n * Creates the native runtime constraint for a resolved Node project.\n *\n * @param project Resolved Node project, or `undefined` when Node is disabled.\n * @param required Whether absence of a matching runtime is fatal.\n * @returns The launcher/runtime requirement, or `undefined` for a non-Node app.\n */\nexport const createMuonNodeRuntimeRequirement = (\n project: ResolvedMuonNodeProject | undefined,\n required: boolean,\n): MuonNodeRuntimeRequirement | undefined =>\n project === undefined\n ? undefined\n : {\n required,\n engineRangeSpecified: project.engineRangeSpecified,\n engineRange: project.engineRange,\n comparatorSets: project.comparatorSets,\n };\n\n/**\n * Resolves and validates an optional Node project from muon configuration.\n *\n * @param config Parsed muon configuration object.\n * @param configDirectory Directory used to resolve a relative `node.project`.\n * @returns The resolved project, or `undefined` when Node hosting is not enabled.\n */\nexport const resolveMuonNodeProject = async (\n config: Readonly<JsonObject> | undefined,\n configDirectory: string,\n): Promise<ResolvedMuonNodeProject | undefined> => {\n const node = config?.node;\n if (node === undefined) {\n return undefined;\n }\n if (!isJsonObject(node)) {\n throw new Error(\"muon.json node must be an object\");\n }\n\n const project = node.project;\n if (project === undefined) {\n throw new Error(\"muon.json node.project is required when node is present\");\n }\n if (typeof project !== \"string\") {\n throw new Error(\"muon.json node.project must be a string\");\n }\n if (project.trim().length === 0) {\n throw new Error(\"muon.json node.project must not be empty\");\n }\n\n const configuredSourcePath = resolve(configDirectory, project);\n if (!(await isDirectory(configuredSourcePath))) {\n throw new Error(\n `muon Node project directory does not exist: ${configuredSourcePath}`,\n );\n }\n const sourcePath = await realpath(configuredSourcePath);\n const packageJsonPath = join(sourcePath, \"package.json\");\n if (!(await isFile(packageJsonPath))) {\n throw new Error(\n `muon Node project package.json does not exist: ${packageJsonPath}`,\n );\n }\n\n return {\n sourcePath,\n ...(await readNodeEngineRequirement(packageJsonPath)),\n };\n};\n\n/**\n * Rewrites a resolved Node project to its packaged runtime location.\n *\n * @param config Source muon configuration.\n * @param project Resolved Node project, when enabled.\n * @returns Configuration suitable for embedding in a built distribution.\n */\nexport const createPackagedMuonNodeConfig = (\n config: Readonly<JsonObject>,\n project: ResolvedMuonNodeProject | undefined,\n): JsonObject => {\n if (project === undefined) {\n return { ...config };\n }\n\n const node = config.node;\n if (!isJsonObject(node)) {\n throw new Error(\"muon.json node must be an object\");\n }\n return {\n ...config,\n node: {\n ...node,\n project: `./${stagedNodeProjectDirectoryName}`,\n },\n };\n};\n\n/**\n * Verifies that staging cannot remove or recursively copy the Node source.\n *\n * @param project Resolved Node project, when enabled.\n * @param runtimeDirectory Runtime directory replaced or used for staging.\n * @returns A promise that resolves when the paths are disjoint.\n */\nexport const assertMuonNodeProjectStagingIsSafe = (\n project: ResolvedMuonNodeProject | undefined,\n runtimeDirectory: string,\n): Promise<void> =>\n assertMuonNodeProjectPathIsDisjoint(\n project,\n runtimeDirectory,\n \"runtime directory\",\n );\n\n/**\n * Verifies that a Node project cannot be exposed through the app asset source.\n *\n * @param project Resolved Node project, when enabled.\n * @param assetSourcePath Directory or ZIP path used as application assets.\n * @returns A promise that resolves when the paths are disjoint.\n */\nexport const assertMuonNodeProjectAssetSourceIsSafe = (\n project: ResolvedMuonNodeProject | undefined,\n assetSourcePath: string,\n): Promise<void> =>\n assertMuonNodeProjectPathIsDisjoint(project, assetSourcePath, \"asset source\");\n\n/**\n * Verifies that a Vite build cannot delete or expose a Node project.\n *\n * @param project Resolved Node project, when enabled.\n * @param outputDirectory Vite output directory emptied before a build.\n * @param publicDirectory Vite public directory copied into build output, or an\n * empty string when public files are disabled.\n * @returns A promise that resolves when the Node project is disjoint from both\n * Vite paths.\n */\nexport const assertMuonNodeProjectViteBuildIsSafe = async (\n project: ResolvedMuonNodeProject | undefined,\n outputDirectory: string,\n publicDirectory: string,\n): Promise<void> => {\n await assertMuonNodeProjectPathIsDisjoint(\n project,\n outputDirectory,\n \"Vite output directory\",\n );\n await assertMuonNodeProjectVitePublicDirectoryIsSafe(\n project,\n publicDirectory,\n );\n};\n\n/**\n * Verifies that Vite cannot expose a Node project through its public directory.\n *\n * @param project Resolved Node project, when enabled.\n * @param publicDirectory Vite public directory copied into served or built\n * assets, or an empty string when public files are disabled.\n * @returns A promise that resolves when the Node project and public directory\n * are disjoint.\n */\nexport const assertMuonNodeProjectVitePublicDirectoryIsSafe = async (\n project: ResolvedMuonNodeProject | undefined,\n publicDirectory: string,\n): Promise<void> => {\n if (publicDirectory !== \"\") {\n await assertMuonNodeProjectPathIsDisjoint(\n project,\n publicDirectory,\n \"Vite public directory\",\n );\n }\n};\n\n/**\n * Verifies that pack cleanup cannot remove a configured Node project.\n *\n * @param project Resolved Node project, when enabled.\n * @param cleanupDirectory Directory recursively removed by muon pack.\n * @returns A promise that resolves when the paths are disjoint.\n */\nexport const assertMuonNodeProjectPackCleanupIsSafe = (\n project: ResolvedMuonNodeProject | undefined,\n cleanupDirectory: string,\n): Promise<void> =>\n assertMuonNodeProjectPathIsDisjoint(\n project,\n cleanupDirectory,\n \"pack cleanup directory\",\n );\n\n/**\n * Stages a resolved Node project beside a muon runtime executable.\n *\n * @param project Resolved Node project, or `undefined` to remove stale staging.\n * @param runtimeDirectory Runtime directory that receives `node-project/`.\n * @returns Absolute staged project path, or `undefined` when Node is disabled.\n *\n * @remarks Symbolic links are dereferenced so portable ZIP and tar packaging\n * retains linked dependencies as ordinary files and directories.\n */\nexport const stageMuonNodeProject = async (\n project: ResolvedMuonNodeProject | undefined,\n runtimeDirectory: string,\n): Promise<string | undefined> => {\n const destinationPath = resolve(\n runtimeDirectory,\n stagedNodeProjectDirectoryName,\n );\n if (project === undefined) {\n await rm(destinationPath, { recursive: true, force: true });\n return undefined;\n }\n\n await assertMuonNodeProjectStagingIsSafe(project, runtimeDirectory);\n await mkdir(runtimeDirectory, { recursive: true });\n await assertMuonNodeProjectStagingIsSafe(project, runtimeDirectory);\n await rm(destinationPath, { recursive: true, force: true });\n await cp(project.sourcePath, destinationPath, {\n dereference: true,\n preserveTimestamps: true,\n recursive: true,\n });\n return destinationPath;\n};\n\n/**\n * Copies the native Node host plugin and JavaScript bridge into a build output.\n *\n * @param sourceRuntimeDirectory Packaged runtime source for one target.\n * @param outputRuntimeDirectory App distribution runtime directory.\n * @param platform Target operating system.\n */\nexport const stageMuonNodeHostArtifacts = async (\n sourceRuntimeDirectory: string,\n outputRuntimeDirectory: string,\n platform: \"linux\" | \"windows\",\n): Promise<void> => {\n const pluginFileName = platform === \"windows\" ? \"node.dll\" : \"node.so\";\n const sourcePluginDirectory = join(sourceRuntimeDirectory, \"plugins\");\n const outputPluginDirectory = join(outputRuntimeDirectory, \"plugins\");\n const sourcePluginPath = join(sourcePluginDirectory, pluginFileName);\n const sourceBridgePath = join(sourcePluginDirectory, nodeBridgeFileName);\n\n await assertFile(sourcePluginPath, `muon Node plugin for ${platform}`);\n await assertFile(sourceBridgePath, \"muon Node bridge\");\n await mkdir(outputPluginDirectory, { recursive: true });\n await copyFile(sourcePluginPath, join(outputPluginDirectory, pluginFileName));\n await copyFile(\n sourceBridgePath,\n join(outputPluginDirectory, nodeBridgeFileName),\n );\n};\n\n/**\n * Validates that a prepared development runtime contains the Node host files.\n *\n * @param runtimeDirectory Prepared runtime directory.\n * @param platform Runtime operating system.\n */\nexport const assertMuonNodeHostArtifacts = async (\n runtimeDirectory: string,\n platform: NodeJS.Platform,\n): Promise<void> => {\n const pluginFileName = platform === \"win32\" ? \"node.dll\" : \"node.so\";\n const pluginDirectory = join(runtimeDirectory, \"plugins\");\n await assertFile(join(pluginDirectory, pluginFileName), \"muon Node plugin\");\n await assertFile(\n join(pluginDirectory, nodeBridgeFileName),\n \"muon Node bridge\",\n );\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isSameOrInsidePath = (parentPath: string, path: string): boolean => {\n const relativePath = relative(parentPath, path);\n return (\n relativePath === \"\" ||\n (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath))\n );\n};\n\nconst isMissingPathError = (error: unknown): boolean => {\n const code = (error as NodeJS.ErrnoException).code;\n return code === \"ENOENT\" || code === \"ENOTDIR\";\n};\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\n// Output paths often do not exist yet. Resolve their closest existing\n// ancestor so symlink aliases cannot bypass overlap checks, then append the\n// still-missing path segments without touching the filesystem.\nconst resolveCanonicalPotentialPath = async (path: string): Promise<string> => {\n let ancestorPath = resolve(path);\n const missingSegments: string[] = [];\n\n for (;;) {\n try {\n const canonicalAncestorPath = await realpath(ancestorPath);\n return resolve(canonicalAncestorPath, ...missingSegments.reverse());\n } catch (error) {\n if (!isMissingPathError(error)) {\n throw error;\n }\n const parentPath = dirname(ancestorPath);\n if (parentPath === ancestorPath) {\n throw error;\n }\n missingSegments.push(basename(ancestorPath));\n ancestorPath = parentPath;\n }\n }\n};\n\nconst assertMuonNodeProjectPathIsDisjoint = async (\n project: ResolvedMuonNodeProject | undefined,\n comparedPath: string,\n comparedPathLabel: string,\n): Promise<void> => {\n if (project === undefined) {\n return;\n }\n const [sourcePath, canonicalComparedPath] = await Promise.all([\n resolveCanonicalPotentialPath(project.sourcePath),\n resolveCanonicalPotentialPath(comparedPath),\n ]);\n if (\n isSameOrInsidePath(sourcePath, canonicalComparedPath) ||\n isSameOrInsidePath(canonicalComparedPath, sourcePath)\n ) {\n throw new Error(\n `muon Node project and ${comparedPathLabel} must not overlap: ${sourcePath}, ${canonicalComparedPath}`,\n );\n }\n};\n\nconst isDirectory = async (path: string): Promise<boolean> => {\n try {\n return (await stat(path)).isDirectory();\n } catch {\n return false;\n }\n};\n\nconst isFile = async (path: string): Promise<boolean> => {\n try {\n return (await stat(path)).isFile();\n } catch {\n return false;\n }\n};\n\nconst assertFile = async (path: string, label: string): Promise<void> => {\n if (!(await isFile(path))) {\n throw new Error(`${label} file does not exist: ${path}`);\n }\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants, type Stats } from \"node:fs\";\nimport {\n access,\n chmod,\n copyFile,\n mkdir,\n mkdtemp,\n readFile,\n readdir,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { createHash, randomBytes } from \"node:crypto\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport { tmpdir } from \"node:os\";\nimport { fileURLToPath } from \"node:url\";\nimport AdmZip from \"adm-zip\";\nimport { parse } from \"json5\";\nimport {\n embedMuonConfigInLauncherFile,\n embedMuonConfigInRuntime,\n} from \"./embed-config.js\";\nimport { getDefaultMuonPrepareTarget } from \"./prepare.js\";\nimport {\n allMuonTargets,\n getMuonTargetDescriptor,\n getMuonTargetRuntimeAppId,\n normalizeMuonTarget,\n type MuonTarget,\n type MuonTargetDescriptor,\n} from \"./targets.js\";\nimport {\n resolveMuonWindowsResource,\n stripBuildOnlyWindowsResourceConfig,\n updateWindowsPeIconResource,\n updateWindowsPeResources,\n type MuonWindowsResourceOptions,\n type ResolvedMuonWindowsResource,\n} from \"./windows-resource.js\";\nimport {\n resolveMuonLinuxDesktop,\n stripBuildOnlyLinuxDesktopConfig,\n writeLinuxDesktopDistributionFiles,\n type MuonLinuxDesktopOptions,\n type ResolvedMuonLinuxDesktop,\n} from \"./linux-desktop.js\";\nimport {\n resolveMuonWindowsCodeSigning,\n signWindowsExecutable,\n stripBuildOnlyWindowsCodeSigningConfig,\n type MuonWindowsCodeSigningOptions,\n type ResolvedMuonWindowsCodeSigning,\n} from \"./windows-code-signing.js\";\nimport { appIconAssetEntryName, appIconAssetUrl } from \"./app-icon.js\";\nimport type { MuonRuntimePluginConfig } from \"./capability.js\";\nimport type { MuonProgressCallback } from \"./progress.js\";\nimport {\n assertMuonNodeProjectAssetSourceIsSafe,\n assertMuonNodeProjectStagingIsSafe,\n createPackagedMuonNodeConfig,\n createMuonNodeRuntimeRequirement,\n resolveMuonNodeProject,\n stageMuonNodeHostArtifacts,\n stageMuonNodeProject,\n type MuonNodeRuntimeRequirement,\n type ResolvedMuonNodeProject,\n} from \"./node-project.js\";\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst appConfigSourcePath = \"./assets.zip\";\nconst defaultAppName = \"muon-app\";\nconst defaultAppId = \"muon-app\";\nconst muonLicenseFileName = \"CREDITS.md\";\nconst directoryMode = 0o755;\nconst executableMode = 0o755;\nconst assetSaltByteLength = 16;\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\ntype JsonObject = Record<string, unknown>;\n\ntype AssetInput = {\n sourcePath: string;\n prefix: string;\n};\n\ntype BuildConfig = {\n config: JsonObject;\n directory: string;\n};\n\ninterface InternalMuonBuildOptions extends MuonBuildOptions {\n browserProfilePathOverride: string | undefined;\n environment?: NodeJS.ProcessEnv;\n progress?: MuonProgressCallback;\n}\n\ntype ZipEntry = {\n name: string;\n data: Buffer;\n};\n\ntype DistributionFile = {\n sourcePath: string;\n fileName: string;\n};\n\n/**\n * Public muon runtime target used by CLI, Vite options, and package layout.\n */\nexport type MuonBuildTarget = MuonTarget;\n\n/**\n * Options for creating redistributable muon app directories.\n */\nexport interface MuonBuildOptions {\n /**\n * Project root containing package.json, muon.json, and app assets.\n */\n root?: string;\n /**\n * Directory containing package runtime/ and native/ folders.\n *\n * @remarks This defaults to the installed muon package dist directory.\n */\n packageDirectory?: string;\n /**\n * Public target identifiers to build.\n */\n targets?: readonly string[];\n /**\n * Build every supported target from the installed package.\n *\n * @remarks Defaults to true when targets is omitted. Set false to build only\n * the host target.\n */\n allTargets?: boolean;\n /**\n * File name used for the app launcher.\n *\n * @remarks The .exe suffix is added automatically for Windows targets.\n */\n appName?: string;\n /**\n * Stable base application identifier used for runtime app identity.\n *\n * @remarks Windows target distributions embed `<appId>.<arch>` as their\n * runtime app identifier. Linux targets embed this value unchanged.\n */\n appId?: string;\n /**\n * Parent directory that receives dist-muon/linux-amd64/ style outputs.\n */\n outputRoot?: string;\n /**\n * Directory or ZIP file used as app assets.\n */\n assetSourcePath?: string;\n /**\n * Optional ZIP entry prefix used for the asset source.\n */\n assetPrefix?: string;\n /**\n * Default browser start page embedded when muon config omits one.\n */\n browserStartPage?: string;\n /**\n * muon config path to embed.\n */\n configPath?: string;\n /**\n * Static application icon PNG file path.\n *\n * @remarks This icon is used as the shared source for Windows PE/NSIS,\n * Linux desktop entries, and the generated initial title bar icon asset.\n * Platform-specific icon paths override it for their target.\n */\n iconPath?: string;\n /**\n * Additional project files copied next to the generated app launcher.\n *\n * @remarks When omitted, `package.json` `files` is used as a candidate list.\n * Only regular files are copied. Asset input paths, `node_modules`, `.git`,\n * and generated target output directories are excluded.\n */\n distributionFiles?: readonly string[];\n /**\n * Windows PE and NSIS resource metadata.\n *\n * @defaultValue Uses `muon.json` `windows.resource`, `project.json`,\n * `package.json`, then muon defaults.\n */\n windowsResource?: MuonWindowsResourceOptions;\n /**\n * Windows code signing command for generated executable artifacts.\n *\n * @remarks Set false to disable `muon.json` `windows.codeSigning`.\n * The command is supplied by the application project or CI environment.\n */\n windowsCodeSigning?: false | MuonWindowsCodeSigningOptions;\n /**\n * Linux desktop entry metadata.\n *\n * @defaultValue Uses `muon.json` `linux.desktop`, package metadata, then\n * muon defaults.\n */\n linuxDesktop?: MuonLinuxDesktopOptions;\n /**\n * Asset salt override for deterministic tests.\n *\n * @remarks Production builds should omit this option.\n */\n assetSalt?: Uint8Array;\n /**\n * Runtime plugin configuration supplied by a bundler integration.\n *\n * @internal\n */\n runtimePluginConfig?: MuonRuntimePluginConfig;\n /**\n * Include a privileged Linux runtime helper in generated distributions.\n *\n * @internal\n */\n includeRuntimeHelper?: boolean;\n}\n\n/**\n * Asset metadata generated for a target distribution.\n */\nexport interface MuonBuildAssetResult {\n /**\n * Path of the generated assets.zip.\n */\n path: string;\n /**\n * 64-character lowercase hexadecimal SHA-256 digest of the generated asset\n * archive bytes followed by the decoded salt bytes.\n */\n signature: string;\n /**\n * Hex-encoded salt embedded into muon.json.\n */\n salt: string;\n /**\n * Number of files written to the ZIP archive.\n */\n entryCount: number;\n}\n\n/**\n * Result for one generated target distribution.\n */\nexport interface MuonBuildTargetResult {\n /**\n * Public target identifier used by the muon npm package.\n */\n target: MuonBuildTarget;\n /**\n * Fixed output directory path for the target.\n */\n distributionDirectoryName: string;\n /**\n * Absolute path of the generated target directory.\n */\n outputPath: string;\n /**\n * Absolute path of the app launcher copied from muon-launcher.\n */\n launcherPath: string;\n /**\n * Absolute path of the privileged runtime helper when included.\n */\n runtimeHelperPath?: string;\n /**\n * Generated asset archive metadata.\n */\n asset: MuonBuildAssetResult;\n /**\n * Application identifier embedded into this target distribution.\n *\n * @remarks Windows targets append the target architecture to the base\n * `appId`; Linux targets use the base `appId` unchanged.\n */\n runtimeAppId: string;\n /**\n * Config object embedded into muon-core.\n *\n * @remarks Launcher-only generated settings are intentionally excluded.\n */\n embeddedConfig: JsonObject;\n /**\n * Linux desktop integration metadata when the target is Linux.\n */\n linuxDesktop?: ResolvedMuonLinuxDesktop;\n}\n\n/**\n * Result of a muon app build.\n */\nexport interface MuonBuildResult {\n /**\n * Absolute project root used for the build.\n */\n root: string;\n /**\n * Sanitized app launcher base name.\n */\n appName: string;\n /**\n * Stable base application identifier used to derive target runtime identity.\n *\n * @remarks See each target's `runtimeAppId` for the identifier embedded into\n * that target distribution.\n */\n appId: string;\n /**\n * Generated target distributions.\n */\n targets: MuonBuildTargetResult[];\n}\n\n/**\n * Returns the host target used by muon build when no explicit target is passed.\n */\nexport const getDefaultMuonBuildTarget = (): MuonBuildTarget => {\n return getDefaultMuonPrepareTarget(process.platform, process.arch);\n};\n\n/**\n * Normalizes a user-facing public target identifier.\n */\nexport const normalizeMuonBuildTarget = (target: string): MuonBuildTarget => {\n return normalizeMuonTarget(target, \"muon build target\");\n};\n\n/**\n * Builds CEF-free muon app distribution directories for one or more targets.\n */\nexport const buildMuonApp = async (\n options: MuonBuildOptions = {},\n): Promise<MuonBuildResult> => {\n const internalOptions = options as InternalMuonBuildOptions;\n const browserProfilePathOverride = internalOptions.browserProfilePathOverride;\n const environment = internalOptions.environment ?? process.env;\n const progress = internalOptions.progress;\n const root = resolve(options.root ?? process.cwd());\n const packageDirectory = resolvePackageDirectory(options.packageDirectory);\n const targets = resolveBuildTargets(options);\n const outputRoot = resolve(root, options.outputRoot ?? \".\");\n const packageJson = await readPackageJson(root);\n const appName = resolveAppName(packageJson, options.appName);\n const appId = resolveAppId(packageJson, options.appId);\n const buildConfig = await readBuildConfig(root, options.configPath);\n const nodeProject = await resolveMuonNodeProject(\n buildConfig.config,\n buildConfig.directory,\n );\n const runtimePluginConfig = options.runtimePluginConfig ?? {\n mode: \"simple\",\n };\n const nodeRuntimeRequirement = createMuonNodeRuntimeRequirement(\n nodeProject,\n true,\n );\n for (const target of targets) {\n await assertMuonNodeProjectStagingIsSafe(\n nodeProject,\n join(\n outputRoot,\n getMuonTargetDescriptor(target).distributionDirectoryName,\n ),\n );\n }\n const sourceConfig = createPackagedMuonNodeConfig(\n applyRuntimePluginConfig(buildConfig.config, runtimePluginConfig),\n nodeProject,\n );\n assertNoUserInitialTitleBarIcon(sourceConfig);\n assertNoUserNodeRuntime(sourceConfig);\n const resolvedBuildConfig: BuildConfig = {\n ...buildConfig,\n config: sourceConfig,\n };\n const assetInput = resolveAssetInput(\n root,\n options.assetSourcePath,\n options.assetPrefix,\n resolvedBuildConfig,\n );\n await assertMuonNodeProjectAssetSourceIsSafe(\n nodeProject,\n assetInput.sourcePath,\n );\n const windowsResource = await resolveMuonWindowsResource({\n root,\n packageDirectory,\n packageJson,\n muonConfig: sourceConfig,\n muonConfigDirectory: buildConfig.directory,\n options: options.windowsResource,\n appIconPath: options.iconPath,\n defaults: {\n productName: appName,\n fileDescription: appName,\n companyName: \"Unknown\",\n version: \"0.0.0\",\n copyright: undefined,\n },\n });\n const windowsCodeSigning = resolveMuonWindowsCodeSigning({\n muonConfig: sourceConfig,\n options: options.windowsCodeSigning,\n });\n const linuxDesktop = await resolveMuonLinuxDesktop({\n root,\n packageDirectory,\n muonConfig: sourceConfig,\n muonConfigDirectory: buildConfig.directory,\n options: options.linuxDesktop,\n appIconPath: options.iconPath,\n defaults: {\n desktopId: appId,\n name: resolveLinuxDesktopDefaultName(packageJson, appName),\n comment: resolvePackageDescription(packageJson),\n categories: [\"Utility\"],\n startupNotify: true,\n },\n });\n const salt = Buffer.from(\n options.assetSalt ?? randomBytes(assetSaltByteLength),\n );\n const distributionFiles = await resolveDistributionFiles({\n root,\n packageJson,\n configuredFiles: options.distributionFiles,\n assetSourcePath: assetInput.sourcePath,\n outputPaths: targets.map((target) =>\n join(\n outputRoot,\n getMuonTargetDescriptor(target).distributionDirectoryName,\n ),\n ),\n });\n\n const results: MuonBuildTargetResult[] = [];\n\n for (let index = 0; index < targets.length; index += 1) {\n const target = targets[index] as MuonBuildTarget;\n progress?.({\n phase: \"build\",\n status: `Building muon target ${target} (${index + 1}/${targets.length})`,\n });\n const result = await buildMuonTarget({\n packageDirectory,\n root,\n outputRoot,\n appName,\n appId,\n target,\n assetInput,\n sourceConfig,\n windowsResource,\n windowsCodeSigning,\n linuxDesktop,\n distributionFiles,\n nodeProject,\n nodeRuntimeRequirement,\n salt,\n environment,\n browserStartPage: options.browserStartPage,\n browserProfilePathOverride,\n includeRuntimeHelper: options.includeRuntimeHelper === true,\n progress,\n });\n results.push(result);\n progress?.({\n phase: \"build\",\n status: `Built ${result.outputPath}`,\n });\n }\n\n return {\n root,\n appName,\n appId,\n targets: results,\n };\n};\n\nconst resolvePackageDirectory = (\n packageDirectory: string | undefined,\n): string => {\n if (packageDirectory !== undefined) {\n return resolve(packageDirectory);\n }\n\n return moduleDirectory;\n};\n\nconst resolveBuildTargets = (options: MuonBuildOptions): MuonBuildTarget[] => {\n if (options.allTargets === true) {\n return [...allMuonTargets];\n }\n\n if (options.targets !== undefined && options.targets.length > 0) {\n return [\n ...new Set(\n options.targets.map((target) => normalizeMuonBuildTarget(target)),\n ),\n ];\n }\n\n if (options.allTargets !== false) {\n return [...allMuonTargets];\n }\n\n return [getDefaultMuonBuildTarget()];\n};\n\nconst resolveAssetInput = (\n root: string,\n assetSourcePath: string | undefined,\n assetPrefix: string | undefined,\n buildConfig: BuildConfig,\n): AssetInput => {\n const configuredAssetSourcePath =\n assetSourcePath === undefined\n ? readConfigAssetSourcePath(buildConfig.config)\n : undefined;\n const sourcePath =\n assetSourcePath !== undefined\n ? resolve(root, assetSourcePath)\n : configuredAssetSourcePath !== undefined\n ? resolve(buildConfig.directory, configuredAssetSourcePath)\n : resolve(root, \"assets\");\n return {\n sourcePath,\n prefix: normalizeZipPrefix(assetPrefix ?? \"\"),\n };\n};\n\nconst readStringArray = (value: unknown, label: string): readonly string[] => {\n if (\n Array.isArray(value) &&\n value.every((entry) => typeof entry === \"string\")\n ) {\n return value;\n }\n throw new Error(`${label} must be an array of strings.`);\n};\n\nconst readDistributionFileCandidates = (\n packageJson: JsonObject,\n configuredFiles: readonly string[] | undefined,\n): readonly string[] => {\n if (configuredFiles !== undefined) {\n return readStringArray(configuredFiles, \"muon distributionFiles\");\n }\n if (packageJson.files === undefined) {\n return [];\n }\n return readStringArray(packageJson.files, \"package.json files\");\n};\n\nconst isSameOrInsidePath = (parentPath: string, path: string): boolean => {\n const relativePath = relative(parentPath, path);\n return (\n relativePath === \"\" ||\n (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath))\n );\n};\n\nconst isExcludedDistributionFilePath = (\n path: string,\n excludedPaths: readonly string[],\n): boolean =>\n excludedPaths.some((excludedPath) => isSameOrInsidePath(excludedPath, path));\n\nconst resolveDistributionFiles = async (input: {\n root: string;\n packageJson: JsonObject;\n configuredFiles: readonly string[] | undefined;\n assetSourcePath: string;\n outputPaths: readonly string[];\n}): Promise<DistributionFile[]> => {\n const candidates = readDistributionFileCandidates(\n input.packageJson,\n input.configuredFiles,\n );\n const excludedPaths = [\n resolve(input.root, \"node_modules\"),\n resolve(input.root, \".git\"),\n input.assetSourcePath,\n ...input.outputPaths,\n ];\n const destinationNames = new Set<string>();\n const files: DistributionFile[] = [];\n\n for (const candidate of candidates) {\n if (candidate.trim() === \"\") {\n throw new Error(\"muon distribution file path must not be empty.\");\n }\n if (isAbsolute(candidate)) {\n throw new Error(\n `muon distribution file path must be relative: ${candidate}`,\n );\n }\n\n const sourcePath = resolve(input.root, candidate);\n if (!isSameOrInsidePath(input.root, sourcePath)) {\n throw new Error(\n `muon distribution file path must stay inside the project root: ${candidate}`,\n );\n }\n if (isExcludedDistributionFilePath(sourcePath, excludedPaths)) {\n continue;\n }\n\n const stats = await statOrUndefined(sourcePath);\n if (stats === undefined) {\n throw new Error(`muon distribution file does not exist: ${candidate}`);\n }\n if (!stats.isFile()) {\n throw new Error(\n `muon distribution file must be a regular file: ${candidate}`,\n );\n }\n\n const fileName = basename(sourcePath);\n if (destinationNames.has(fileName)) {\n throw new Error(\n `Duplicate muon distribution file destination: ${fileName}`,\n );\n }\n destinationNames.add(fileName);\n files.push({ sourcePath, fileName });\n }\n\n return files;\n};\n\nconst normalizeZipPrefix = (prefix: string): string => {\n const normalized = prefix\n .replaceAll(\"\\\\\", \"/\")\n .split(\"/\")\n .filter((part) => part.length > 0)\n .join(\"/\");\n\n return normalized.length > 0 ? `${normalized}/` : \"\";\n};\n\nconst readPackageJson = async (root: string): Promise<JsonObject> => {\n const packageJsonPath = join(root, \"package.json\");\n if (!(await fileExists(packageJsonPath))) {\n return {};\n }\n return await readJsonObjectFile(packageJsonPath, \"package.json\");\n};\n\nconst resolvePackageName = (packageJson: JsonObject): string => {\n return typeof packageJson.name === \"string\"\n ? packageJson.name\n : defaultAppName;\n};\n\nconst resolveAppName = (\n packageJson: JsonObject,\n appName: string | undefined,\n): string => {\n if (appName !== undefined) {\n return sanitizeAppName(appName);\n }\n\n const packageName = resolvePackageName(packageJson);\n const unscopedName = packageName.startsWith(\"@\")\n ? packageName.slice(packageName.indexOf(\"/\") + 1)\n : packageName;\n\n return sanitizeAppName(unscopedName);\n};\n\nconst sanitizeAppName = (name: string): string => {\n const sanitized = name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^[.-]+/g, \"\")\n .replace(/[.-]+$/g, \"\");\n\n return sanitized.length > 0 ? sanitized : defaultAppName;\n};\n\nconst resolveAppId = (\n packageJson: JsonObject,\n appId: string | undefined,\n): string => {\n if (appId !== undefined) {\n return sanitizeAppId(appId);\n }\n return sanitizeAppId(resolvePackageName(packageJson));\n};\n\nconst sanitizeAppId = (value: string): string => {\n const unscoped = value.startsWith(\"@\") ? value.slice(1) : value;\n const sanitized = unscoped\n .trim()\n .toLowerCase()\n .replace(\"/\", \".\")\n .replace(/[^a-z0-9._-]+/g, \".\")\n .replace(/^[.]+/g, \"\")\n .replace(/[.]+$/g, \"\");\n return sanitized.length > 0 ? sanitized : defaultAppId;\n};\n\nconst resolveLinuxDesktopDefaultName = (\n packageJson: JsonObject,\n appName: string,\n): string =>\n typeof packageJson.name === \"string\" && packageJson.name.trim() !== \"\"\n ? packageJson.name.trim()\n : appName;\n\nconst resolvePackageDescription = (packageJson: JsonObject): string =>\n typeof packageJson.description === \"string\"\n ? packageJson.description.trim()\n : \"\";\n\nconst readBuildConfig = async (\n root: string,\n configPath: string | undefined,\n): Promise<BuildConfig> => {\n const resolvedConfigPath = await resolveConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n config: {},\n directory: root,\n };\n }\n\n return {\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n directory: dirname(resolvedConfigPath),\n };\n};\n\n/**\n * Resolves the Node project selected by a build-oriented muon configuration.\n *\n * @param root Project root used to locate a default or relative config path.\n * @param configPath Explicit muon config path, or `undefined` to use the\n * default config lookup.\n * @returns The resolved Node project, or `undefined` when Node hosting is not\n * enabled.\n */\nexport const resolveMuonNodeProjectForBuildConfig = async (\n root: string,\n configPath: string | undefined,\n): Promise<ResolvedMuonNodeProject | undefined> => {\n const buildConfig = await readBuildConfig(root, configPath);\n return await resolveMuonNodeProject(\n buildConfig.config,\n buildConfig.directory,\n );\n};\n\nconst applyRuntimePluginConfig = (\n sourceConfig: JsonObject,\n runtimePluginConfig: MuonRuntimePluginConfig | undefined,\n): JsonObject => {\n if (runtimePluginConfig === undefined) {\n return sourceConfig;\n }\n\n const sourcePlugin = sourceConfig.plugin;\n if (sourcePlugin !== undefined && !isJsonObject(sourcePlugin)) {\n throw new Error(\n \"muon.json plugin must be an object when runtime plugin config is applied.\",\n );\n }\n const plugin: JsonObject = sourcePlugin ?? {};\n\n return {\n ...sourceConfig,\n plugin: {\n ...plugin,\n ...runtimePluginConfig,\n },\n };\n};\n\nconst readConfigAssetSourcePath = (\n sourceConfig: JsonObject,\n): string | undefined => {\n const sourceAsset = sourceConfig.asset;\n if (sourceAsset === undefined) {\n return undefined;\n }\n if (!isJsonObject(sourceAsset)) {\n throw new Error(\"muon.json asset must be an object when present.\");\n }\n\n const sourceAssetPath = sourceAsset.sourcePath;\n if (sourceAssetPath === undefined) {\n return undefined;\n }\n if (typeof sourceAssetPath !== \"string\") {\n throw new Error(\n \"muon.json asset.sourcePath must be a string when present.\",\n );\n }\n\n return sourceAssetPath;\n};\n\nconst resolveConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n\n return undefined;\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n let content: string;\n try {\n content = await readFile(filePath, \"utf8\");\n } catch (error) {\n throw new Error(\n `${label} could not be read: ${filePath}: ${getErrorMessage(error)}`,\n );\n }\n\n let parsed: unknown;\n try {\n parsed = parse(content);\n } catch (error) {\n throw new Error(\n `${label} could not be parsed: ${filePath}: ${getErrorMessage(error)}`,\n );\n }\n\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n\n return parsed;\n};\n\nconst buildMuonTarget = async (input: {\n packageDirectory: string;\n root: string;\n outputRoot: string;\n appName: string;\n appId: string;\n target: MuonBuildTarget;\n assetInput: AssetInput;\n sourceConfig: JsonObject;\n windowsResource: ResolvedMuonWindowsResource;\n windowsCodeSigning: ResolvedMuonWindowsCodeSigning | undefined;\n linuxDesktop: ResolvedMuonLinuxDesktop;\n distributionFiles: readonly DistributionFile[];\n nodeProject: ResolvedMuonNodeProject | undefined;\n nodeRuntimeRequirement: MuonNodeRuntimeRequirement | undefined;\n salt: Buffer;\n environment: NodeJS.ProcessEnv;\n browserStartPage: string | undefined;\n browserProfilePathOverride: string | undefined;\n includeRuntimeHelper: boolean;\n progress: MuonProgressCallback | undefined;\n}): Promise<MuonBuildTargetResult> => {\n const descriptor = getMuonTargetDescriptor(input.target);\n const sourceRuntimePath = join(\n input.packageDirectory,\n \"runtime\",\n input.target,\n );\n const sourceLauncherPath = join(\n input.packageDirectory,\n \"native\",\n input.target,\n descriptor.launcherExecutableName,\n );\n const sourceRuntimeHelperPath =\n input.includeRuntimeHelper &&\n descriptor.runtimeHelperExecutableName !== undefined\n ? join(\n input.packageDirectory,\n \"native\",\n input.target,\n descriptor.runtimeHelperExecutableName,\n )\n : undefined;\n const outputPath = join(\n input.outputRoot,\n descriptor.distributionDirectoryName,\n );\n const launcherPath = join(\n outputPath,\n getLauncherFileName(input.appName, descriptor),\n );\n const runtimeHelperPath =\n sourceRuntimeHelperPath === undefined ||\n descriptor.runtimeHelperExecutableName === undefined\n ? undefined\n : join(outputPath, descriptor.runtimeHelperExecutableName);\n const assetZipPath = join(outputPath, \"assets.zip\");\n const runtimeAppId = getMuonTargetRuntimeAppId(input.appId, input.target);\n const appIconPath =\n descriptor.os === \"windows\"\n ? input.windowsResource.iconPath\n : input.linuxDesktop.iconPath;\n\n await verifyTargetInputs({\n sourceRuntimePath,\n sourceLauncherPath,\n sourceRuntimeHelperPath,\n descriptor,\n target: input.target,\n });\n\n await rm(outputPath, { recursive: true, force: true });\n await mkdir(outputPath, { recursive: true, mode: directoryMode });\n await copyRuntimeFiles(sourceRuntimePath, outputPath, descriptor);\n for (const executableName of [\n descriptor.runtimeExecutableName,\n ...descriptor.runtimeAuxiliaryExecutableNames,\n ]) {\n await chmod(join(outputPath, executableName), executableMode);\n }\n await copyFile(sourceLauncherPath, launcherPath);\n await chmod(launcherPath, executableMode);\n if (\n sourceRuntimeHelperPath !== undefined &&\n runtimeHelperPath !== undefined\n ) {\n await copyFile(sourceRuntimeHelperPath, runtimeHelperPath);\n await chmod(runtimeHelperPath, executableMode);\n }\n if (input.nodeProject !== undefined) {\n await stageMuonNodeHostArtifacts(\n sourceRuntimePath,\n outputPath,\n descriptor.os,\n );\n await stageMuonNodeProject(input.nodeProject, outputPath);\n }\n await copyDistributionFiles(input.distributionFiles, outputPath);\n\n input.progress?.({\n phase: \"build\",\n status: \"Creating assets.zip\",\n });\n const asset = await writeAssetArchive(\n input.assetInput,\n assetZipPath,\n input.salt,\n [{ name: appIconAssetEntryName, data: await readFile(appIconPath) }],\n );\n const embeddedConfig = createEmbeddedConfig(\n input.sourceConfig,\n asset,\n runtimeAppId,\n input.linuxDesktop.desktopId,\n appIconAssetUrl,\n input.browserStartPage,\n input.browserProfilePathOverride,\n );\n const launcherEmbeddedConfig = createLauncherEmbeddedConfig(\n embeddedConfig,\n input.nodeRuntimeRequirement,\n );\n\n input.progress?.({\n phase: \"build\",\n status: \"Embedding config\",\n });\n await withTemporaryConfig(embeddedConfig, async (configPath) => {\n await embedMuonConfigInRuntime({\n runtimePath: outputPath,\n configPath,\n outputRuntimePath: undefined,\n });\n });\n await withTemporaryConfig(launcherEmbeddedConfig, async (configPath) => {\n await embedMuonConfigInLauncherFile({\n launcherPath: launcherPath,\n configPath,\n outputPath: undefined,\n });\n if (runtimeHelperPath !== undefined) {\n await embedMuonConfigInLauncherFile({\n launcherPath: runtimeHelperPath,\n configPath,\n outputPath: undefined,\n });\n }\n });\n\n if (descriptor.os === \"windows\") {\n input.progress?.({\n phase: \"build\",\n status: \"Updating Windows resources\",\n });\n await updateWindowsPeIconResource({\n executablePath: join(outputPath, descriptor.runtimeExecutableName),\n resource: input.windowsResource,\n environment: input.environment,\n cwd: input.root,\n });\n await updateWindowsPeResources({\n executablePath: launcherPath,\n resource: input.windowsResource,\n environment: input.environment,\n cwd: input.root,\n });\n if (input.windowsCodeSigning !== undefined) {\n input.progress?.({\n phase: \"build\",\n status: \"Signing Windows executables\",\n });\n }\n await signWindowsExecutable({\n codeSigning: input.windowsCodeSigning,\n kind: \"runtime\",\n target: input.target,\n path: join(outputPath, descriptor.runtimeExecutableName),\n cwd: input.root,\n environment: input.environment,\n });\n await signWindowsExecutable({\n codeSigning: input.windowsCodeSigning,\n kind: \"launcher\",\n target: input.target,\n path: launcherPath,\n cwd: input.root,\n environment: input.environment,\n });\n } else if (descriptor.os === \"linux\") {\n input.progress?.({\n phase: \"build\",\n status: \"Writing Linux desktop files\",\n });\n await writeLinuxDesktopDistributionFiles(outputPath, input.linuxDesktop);\n }\n\n return {\n target: input.target,\n distributionDirectoryName: descriptor.distributionDirectoryName,\n outputPath,\n launcherPath,\n ...(runtimeHelperPath === undefined ? {} : { runtimeHelperPath }),\n asset,\n runtimeAppId,\n embeddedConfig,\n ...(descriptor.os === \"linux\" ? { linuxDesktop: input.linuxDesktop } : {}),\n };\n};\n\nconst verifyTargetInputs = async (input: {\n sourceRuntimePath: string;\n sourceLauncherPath: string;\n sourceRuntimeHelperPath: string | undefined;\n descriptor: MuonTargetDescriptor;\n target: MuonBuildTarget;\n}): Promise<void> => {\n await assertDirectory(\n input.sourceRuntimePath,\n `muon runtime for ${input.target}`,\n );\n await assertFile(\n input.sourceLauncherPath,\n `muon launcher for ${input.target}`,\n );\n if (input.sourceRuntimeHelperPath !== undefined) {\n await assertFile(\n input.sourceRuntimeHelperPath,\n `muon runtime helper for ${input.target}`,\n );\n }\n for (const fileName of input.descriptor.runtimeFiles) {\n await assertFile(\n join(input.sourceRuntimePath, fileName),\n `muon runtime file ${fileName} for ${input.target}`,\n );\n }\n await assertFile(\n join(input.sourceRuntimePath, muonLicenseFileName),\n `muon license file for ${input.target}`,\n );\n};\n\nconst getLauncherFileName = (\n appName: string,\n descriptor: MuonTargetDescriptor,\n): string => {\n if (\n descriptor.launcherExtension.length > 0 &&\n !appName.endsWith(descriptor.launcherExtension)\n ) {\n return `${appName}${descriptor.launcherExtension}`;\n }\n\n return appName;\n};\n\nconst copyRuntimeFiles = async (\n sourceRuntimePath: string,\n outputPath: string,\n descriptor: MuonTargetDescriptor,\n): Promise<void> => {\n for (const fileName of descriptor.runtimeFiles) {\n await copyFile(\n join(sourceRuntimePath, fileName),\n join(outputPath, fileName),\n );\n }\n if (descriptor.optionalRuntimeFilePatterns !== undefined) {\n const fileNames = await readdir(sourceRuntimePath);\n for (const fileName of fileNames) {\n if (\n descriptor.optionalRuntimeFilePatterns.some((pattern) =>\n pattern.test(fileName),\n )\n ) {\n await copyFile(\n join(sourceRuntimePath, fileName),\n join(outputPath, fileName),\n );\n }\n }\n }\n await copyFile(\n join(sourceRuntimePath, muonLicenseFileName),\n join(outputPath, muonLicenseFileName),\n );\n};\n\nconst copyDistributionFiles = async (\n files: readonly DistributionFile[],\n outputPath: string,\n): Promise<void> => {\n for (const file of files) {\n const destinationPath = join(outputPath, file.fileName);\n if ((await statOrUndefined(destinationPath)) !== undefined) {\n throw new Error(\n `muon distribution file destination already exists: ${file.fileName}`,\n );\n }\n await copyFile(file.sourcePath, destinationPath);\n }\n};\n\nconst writeAssetArchive = async (\n input: AssetInput,\n outputPath: string,\n salt: Buffer,\n extraEntries: readonly ZipEntry[],\n): Promise<MuonBuildAssetResult> => {\n const sourceStats = await statOrUndefined(input.sourcePath);\n if (sourceStats === undefined) {\n throw new Error(`muon asset source does not exist: ${input.sourcePath}`);\n }\n\n const archive = sourceStats.isDirectory()\n ? await createAssetArchiveFromDirectory(input, extraEntries)\n : sourceStats.isFile()\n ? await createAssetArchiveFromZipFile(input.sourcePath, extraEntries)\n : undefined;\n if (archive === undefined) {\n throw new Error(\n `muon asset source is not a directory or file: ${input.sourcePath}`,\n );\n }\n await writeFile(outputPath, archive);\n\n const signature = createHash(\"sha256\")\n .update(archive)\n .update(salt)\n .digest(\"hex\");\n return {\n path: outputPath,\n signature,\n salt: salt.toString(\"hex\"),\n entryCount: sourceStats.isDirectory()\n ? readZipEntryCount(archive, outputPath)\n : readZipEntryCount(archive, input.sourcePath),\n };\n};\n\nconst createAssetArchiveFromDirectory = async (\n input: AssetInput,\n extraEntries: readonly ZipEntry[],\n): Promise<Buffer> => {\n const entries = await collectZipEntries(input.sourcePath, input.prefix);\n if (entries.length === 0) {\n throw new Error(`muon asset source has no files: ${input.sourcePath}`);\n }\n\n return createZipArchive(appendZipEntries(entries, extraEntries));\n};\n\nconst createAssetArchiveFromZipFile = async (\n sourcePath: string,\n extraEntries: readonly ZipEntry[],\n): Promise<Buffer> => {\n const zip = new AdmZip(await readFile(sourcePath));\n for (const entry of extraEntries) {\n assertSafeZipEntryName(entry.name);\n if (zip.getEntry(entry.name) !== null) {\n throw new Error(\n `muon app icon asset entry already exists: ${entry.name}`,\n );\n }\n zip.addFile(entry.name, entry.data);\n }\n return zip.toBuffer();\n};\n\nconst appendZipEntries = (\n entries: readonly ZipEntry[],\n extraEntries: readonly ZipEntry[],\n): ZipEntry[] => {\n const output = [...entries];\n const names = new Set(entries.map((entry) => entry.name));\n for (const entry of extraEntries) {\n assertSafeZipEntryName(entry.name);\n if (names.has(entry.name)) {\n throw new Error(\n `muon app icon asset entry already exists: ${entry.name}`,\n );\n }\n names.add(entry.name);\n output.push(entry);\n }\n return output;\n};\n\nconst readZipEntryCount = (archive: Buffer, sourcePath: string): number => {\n const endSignature = 0x06054b50;\n const lastPossibleOffset = archive.length - 22;\n const firstPossibleOffset = Math.max(0, lastPossibleOffset - 0xffff);\n\n for (\n let offset = lastPossibleOffset;\n offset >= firstPossibleOffset;\n offset -= 1\n ) {\n if (archive.readUInt32LE(offset) === endSignature) {\n return archive.readUInt16LE(offset + 10);\n }\n }\n\n throw new Error(`muon asset ZIP could not be read: ${sourcePath}`);\n};\n\nconst collectZipEntries = async (\n sourcePath: string,\n prefix: string,\n): Promise<ZipEntry[]> => {\n const entries: ZipEntry[] = [];\n\n const walk = async (directoryPath: string): Promise<void> => {\n const dirents = await readdir(directoryPath, { withFileTypes: true });\n dirents.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const dirent of dirents) {\n const childPath = join(directoryPath, dirent.name);\n if (dirent.isDirectory()) {\n await walk(childPath);\n } else if (dirent.isFile()) {\n const relativePath = relative(sourcePath, childPath)\n .split(sep)\n .join(\"/\");\n const name = `${prefix}${relativePath}`;\n assertSafeZipEntryName(name);\n entries.push({\n name,\n data: await readFile(childPath),\n });\n }\n }\n };\n\n await walk(sourcePath);\n return entries;\n};\n\nconst assertSafeZipEntryName = (name: string): void => {\n if (\n name.length === 0 ||\n name.startsWith(\"/\") ||\n name.includes(\"..\") ||\n name.includes(\"\\\\\")\n ) {\n throw new Error(`Unsafe ZIP entry name: ${name}`);\n }\n};\n\nconst createZipArchive = (entries: readonly ZipEntry[]): Buffer => {\n const zip = new AdmZip();\n for (const entry of entries) {\n zip.addFile(entry.name, entry.data);\n }\n\n return zip.toBuffer();\n};\n\nconst createEmbeddedConfig = (\n sourceConfig: JsonObject,\n asset: MuonBuildAssetResult,\n appId: string,\n desktopId: string,\n initialTitleBarIcon: string,\n browserStartPage: string | undefined,\n browserProfilePathOverride: string | undefined,\n): JsonObject => {\n const sourceAsset = sourceConfig.asset;\n if (sourceAsset !== undefined && !isJsonObject(sourceAsset)) {\n throw new Error(\"muon.json asset must be an object when present.\");\n }\n const sourceLauncher = sourceConfig.launcher;\n if (sourceLauncher !== undefined && !isJsonObject(sourceLauncher)) {\n throw new Error(\"muon.json launcher must be an object when present.\");\n }\n\n const runtimeConfig = stripBuildOnlyAppIconConfig(\n stripBuildOnlyLinuxDesktopConfig(\n stripBuildOnlyWindowsCodeSigningConfig(\n stripBuildOnlyWindowsResourceConfig(sourceConfig),\n ),\n ),\n );\n const sourceBrowser = runtimeConfig.browser;\n if (sourceBrowser !== undefined && !isJsonObject(sourceBrowser)) {\n throw new Error(\"muon.json browser must be an object when present.\");\n }\n\n const browserConfig: JsonObject = {\n ...(sourceBrowser ?? {}),\n initialTitleBarIcon,\n };\n if (browserStartPage !== undefined && browserConfig.startPage === undefined) {\n browserConfig.startPage = browserStartPage;\n }\n if (browserProfilePathOverride !== undefined) {\n browserConfig.profilePath = browserProfilePathOverride;\n }\n\n return {\n ...runtimeConfig,\n browser: browserConfig,\n asset: {\n ...(sourceAsset ?? {}),\n sourcePath: appConfigSourcePath,\n signature: asset.signature,\n salt: asset.salt,\n },\n launcher: {\n ...(sourceLauncher ?? {}),\n appId,\n desktopId,\n },\n };\n};\n\nconst createLauncherEmbeddedConfig = (\n embeddedConfig: JsonObject,\n nodeRuntimeRequirement: MuonNodeRuntimeRequirement | undefined,\n): JsonObject => {\n if (nodeRuntimeRequirement === undefined) {\n return embeddedConfig;\n }\n const launcher = embeddedConfig.launcher;\n if (!isJsonObject(launcher)) {\n throw new Error(\"generated muon launcher config must be an object\");\n }\n return {\n ...embeddedConfig,\n launcher: {\n ...launcher,\n nodeRuntime: nodeRuntimeRequirement,\n },\n };\n};\n\nconst assertNoUserInitialTitleBarIcon = (sourceConfig: JsonObject): void => {\n const sourceBrowser = sourceConfig.browser;\n if (sourceBrowser === undefined) {\n return;\n }\n if (!isJsonObject(sourceBrowser)) {\n throw new Error(\"muon.json browser must be an object when present.\");\n }\n if (sourceBrowser.initialTitleBarIcon !== undefined) {\n throw new Error(\n \"muon.json browser.initialTitleBarIcon is generated by muon build; use top-level iconPath instead.\",\n );\n }\n};\n\nconst assertNoUserNodeRuntime = (sourceConfig: JsonObject): void => {\n const sourceLauncher = sourceConfig.launcher;\n if (sourceLauncher === undefined) {\n return;\n }\n if (!isJsonObject(sourceLauncher)) {\n throw new Error(\"muon.json launcher must be an object when present.\");\n }\n if (sourceLauncher.nodeRuntime !== undefined) {\n throw new Error(\n \"muon.json launcher.nodeRuntime is generated by muon build.\",\n );\n }\n};\n\nconst stripBuildOnlyAppIconConfig = (sourceConfig: JsonObject): JsonObject => {\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"iconPath\") {\n output[key] = value;\n }\n }\n return output;\n};\n\nconst withTemporaryConfig = async (\n config: JsonObject,\n callback: (configPath: string) => Promise<void>,\n): Promise<void> => {\n const tempDirectory = await mkdtemp(join(tmpdir(), \"muon-build-config-\"));\n const configPath = join(tempDirectory, \"muon.json\");\n try {\n await writeFile(configPath, `${JSON.stringify(config, undefined, 2)}\\n`);\n await callback(configPath);\n } finally {\n await rm(tempDirectory, { recursive: true, force: true });\n }\n};\n\nconst assertDirectory = async (path: string, label: string): Promise<void> => {\n const stats = await statOrUndefined(path);\n if (stats === undefined || !stats.isDirectory()) {\n throw new Error(`${label} directory does not exist: ${path}`);\n }\n};\n\nconst assertFile = async (path: string, label: string): Promise<void> => {\n const stats = await statOrUndefined(path);\n if (stats === undefined || !stats.isFile()) {\n throw new Error(`${label} file does not exist: ${path}`);\n }\n};\n\nconst statOrUndefined = async (path: string): Promise<Stats | undefined> => {\n try {\n return await stat(path);\n } catch {\n return undefined;\n }\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject => {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n};\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport type { ResolvedConfig } from \"vite\";\n\nimport type { MuonRuntimePluginConfig } from \"./capability.js\";\nimport type { MuonVitePluginOptions } from \"./vite.js\";\nimport { isMuonWindowsCodeSigningOptions } from \"./windows-code-signing.js\";\n\n/**\n * Metadata symbol used to recover `muon()` plugin options from `vite.config.*`.\n */\nexport const muonVitePluginOptionsSymbol = Symbol.for(\n \"muon.vite.plugin.options\",\n);\n\nconst muonVitePluginRuntimeStateSymbol = Symbol.for(\n \"muon.vite.plugin.runtimeState\",\n);\n\ninterface MuonVitePluginWithOptions {\n [muonVitePluginOptionsSymbol]: MuonVitePluginOptions;\n}\n\n/**\n * Internal state exposed by a resolved muon Vite plugin instance.\n */\nexport interface MuonVitePluginRuntimeState {\n /**\n * Returns the Vite config resolved for this plugin instance.\n */\n getResolvedConfig: () => ResolvedConfig | undefined;\n\n /**\n * Returns the runtime plugin config generated by this plugin instance.\n */\n getRuntimePluginConfig: () => MuonRuntimePluginConfig | undefined;\n}\n\ninterface MuonVitePluginWithRuntimeState {\n [muonVitePluginRuntimeStateSymbol]: MuonVitePluginRuntimeState;\n}\n\nconst isRecord = (value: unknown): value is Record<string | symbol, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isStringArray = (value: unknown): value is readonly string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst isStringRecord = (value: unknown): value is Record<string, string> =>\n isRecord(value) &&\n Object.entries(value).every(\n ([entryKey, entryValue]) =>\n entryKey.length > 0 &&\n !entryKey.includes(\"\\0\") &&\n typeof entryValue === \"string\" &&\n !entryValue.includes(\"\\0\"),\n );\n\nconst isWindowsResourceOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.iconPath === undefined || typeof value.iconPath === \"string\") &&\n (value.productName === undefined ||\n typeof value.productName === \"string\") &&\n (value.fileDescription === undefined ||\n typeof value.fileDescription === \"string\") &&\n (value.companyName === undefined ||\n typeof value.companyName === \"string\") &&\n (value.version === undefined || typeof value.version === \"string\") &&\n (value.copyright === undefined || typeof value.copyright === \"string\") &&\n (value.language === undefined ||\n (typeof value.language === \"number\" &&\n Number.isInteger(value.language))) &&\n (value.codePage === undefined ||\n (typeof value.codePage === \"number\" && Number.isInteger(value.codePage)))\n );\n};\n\nconst isLinuxDesktopOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.desktopId === undefined || typeof value.desktopId === \"string\") &&\n (value.name === undefined || typeof value.name === \"string\") &&\n (value.comment === undefined || typeof value.comment === \"string\") &&\n (value.iconPath === undefined || typeof value.iconPath === \"string\") &&\n (value.categories === undefined || isStringArray(value.categories)) &&\n (value.startupNotify === undefined ||\n typeof value.startupNotify === \"boolean\")\n );\n};\n\nconst isMuonViteBuildOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.targets === undefined || isStringArray(value.targets)) &&\n (value.allTargets === undefined || typeof value.allTargets === \"boolean\") &&\n (value.appName === undefined || typeof value.appName === \"string\") &&\n (value.appId === undefined || typeof value.appId === \"string\") &&\n (value.outputRoot === undefined || typeof value.outputRoot === \"string\") &&\n (value.configPath === undefined || typeof value.configPath === \"string\") &&\n (value.iconPath === undefined || typeof value.iconPath === \"string\") &&\n (value.distributionFiles === undefined ||\n isStringArray(value.distributionFiles)) &&\n (value.windowsResource === undefined ||\n isWindowsResourceOptions(value.windowsResource)) &&\n (value.windowsCodeSigning === undefined ||\n value.windowsCodeSigning === false ||\n isMuonWindowsCodeSigningOptions(value.windowsCodeSigning)) &&\n (value.linuxDesktop === undefined ||\n isLinuxDesktopOptions(value.linuxDesktop)) &&\n (value.packageDirectory === undefined ||\n typeof value.packageDirectory === \"string\") &&\n (value.assetSalt === undefined || value.assetSalt instanceof Uint8Array)\n );\n};\n\nconst isMuonVitePluginAccessImportOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.sources === undefined || isStringArray(value.sources)) &&\n (value.packages === undefined || isStringArray(value.packages)) &&\n (value.allow === undefined || isStringArray(value.allow))\n );\n};\n\nconst isMuonVitePluginAccessEntryOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n typeof value.name === \"string\" &&\n (value.signature === undefined || typeof value.signature === \"string\") &&\n (value.salt === undefined || typeof value.salt === \"string\") &&\n (value.config === undefined || isStringRecord(value.config)) &&\n (value.allow === undefined || isStringArray(value.allow)) &&\n (value.imports === undefined ||\n (Array.isArray(value.imports) &&\n value.imports.every(isMuonVitePluginAccessImportOptions)))\n );\n};\n\nconst isMuonVitePluginAccessOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.path === undefined || typeof value.path === \"string\") &&\n (value.mode === undefined ||\n value.mode === \"simple\" ||\n value.mode === \"validate\") &&\n (value.pages === undefined || isStringArray(value.pages)) &&\n (value.plugins === undefined ||\n (Array.isArray(value.plugins) &&\n value.plugins.every(isMuonVitePluginAccessEntryOptions)))\n );\n};\n\nconst isMuonViteDevOptions = (value: unknown): boolean =>\n isRecord(value) &&\n (value.config === undefined || isStringRecord(value.config));\n\nconst isMuonVitePluginOptions = (\n value: unknown,\n): value is MuonVitePluginOptions => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.muonPath === undefined || typeof value.muonPath === \"string\") &&\n (value.cefPath === undefined || typeof value.cefPath === \"string\") &&\n (value.stagePath === undefined || typeof value.stagePath === \"string\") &&\n (value.open === undefined || typeof value.open === \"boolean\") &&\n (value.enableDebugger === undefined ||\n typeof value.enableDebugger === \"boolean\") &&\n (value.allowInsecureLocalhost === undefined ||\n typeof value.allowInsecureLocalhost === \"boolean\") &&\n (value.exitWithServer === undefined ||\n typeof value.exitWithServer === \"boolean\") &&\n (value.dev === undefined || isMuonViteDevOptions(value.dev)) &&\n (value.pluginAccess === undefined ||\n value.pluginAccess === false ||\n isMuonVitePluginAccessOptions(value.pluginAccess)) &&\n (value.build === undefined ||\n typeof value.build === \"boolean\" ||\n isMuonViteBuildOptions(value.build))\n );\n};\n\n/**\n * Attaches raw muon Vite plugin options to a plugin instance.\n *\n * @param plugin Plugin object.\n * @param options Raw plugin options.\n * @returns Plugin object with internal muon metadata.\n */\nexport const attachMuonVitePluginOptions = <TPlugin extends object>(\n plugin: TPlugin,\n options: MuonVitePluginOptions,\n): TPlugin & MuonVitePluginWithOptions => {\n Object.defineProperty(plugin, muonVitePluginOptionsSymbol, {\n configurable: false,\n enumerable: false,\n value: { ...options },\n writable: false,\n });\n\n return plugin as TPlugin & MuonVitePluginWithOptions;\n};\n\n/**\n * Attaches internal runtime state to a plugin instance.\n *\n * @param plugin Plugin object.\n * @param runtimeState Runtime state accessor.\n * @returns Plugin object with internal muon runtime metadata.\n */\nexport const attachMuonVitePluginRuntimeState = <TPlugin extends object>(\n plugin: TPlugin,\n runtimeState: MuonVitePluginRuntimeState,\n): TPlugin & MuonVitePluginWithRuntimeState => {\n Object.defineProperty(plugin, muonVitePluginRuntimeStateSymbol, {\n configurable: false,\n enumerable: false,\n value: runtimeState,\n writable: false,\n });\n\n return plugin as TPlugin & MuonVitePluginWithRuntimeState;\n};\n\n/**\n * Reads raw muon Vite plugin options from a plugin instance.\n *\n * @param plugin Candidate plugin object.\n * @returns Attached muon options, if present.\n */\nexport const getMuonVitePluginOptions = (\n plugin: unknown,\n): MuonVitePluginOptions | undefined => {\n if (!isRecord(plugin)) {\n return undefined;\n }\n\n const options = plugin[muonVitePluginOptionsSymbol];\n return isMuonVitePluginOptions(options) ? options : undefined;\n};\n\n/**\n * Reads internal runtime state from a muon Vite plugin instance.\n *\n * @param plugin Candidate plugin object.\n * @returns Runtime state accessor, if present.\n */\nexport const getMuonVitePluginRuntimeState = (\n plugin: unknown,\n): MuonVitePluginRuntimeState | undefined => {\n if (!isRecord(plugin)) {\n return undefined;\n }\n\n const runtimeState = plugin[muonVitePluginRuntimeStateSymbol];\n return isRecord(runtimeState) &&\n typeof runtimeState.getResolvedConfig === \"function\" &&\n typeof runtimeState.getRuntimePluginConfig === \"function\"\n ? (runtimeState as unknown as MuonVitePluginRuntimeState)\n : undefined;\n};\n\n/**\n * Resolves nested Vite plugin option values into a flat list.\n *\n * @param pluginOptions Raw `plugins` field from a Vite config.\n * @returns Flat plugin object list.\n */\nexport const flattenVitePluginOptions = async (\n pluginOptions: unknown,\n): Promise<unknown[]> => {\n const resolvedValue = await pluginOptions;\n if (resolvedValue === null || resolvedValue === undefined || !resolvedValue) {\n return [];\n }\n\n if (Array.isArray(resolvedValue)) {\n const nested = await Promise.all(\n resolvedValue.map((entry) => flattenVitePluginOptions(entry)),\n );\n return nested.flat();\n }\n\n return [resolvedValue];\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/**\n * Asset layout derived from Vite's resolved base URL for packaged muon apps.\n */\nexport interface MuonVitePackagedAssetOptions {\n /** ZIP entry prefix used for copied Vite build output. */\n assetPrefix: string;\n /** Generated browser start page when Vite base needs a packaged path. */\n browserStartPage: string | undefined;\n}\n\n/**\n * Returns the package-local asset base path represented by a Vite base URL.\n */\nexport const resolveVitePackagedAssetBasePath = (\n base: string,\n): string | undefined => {\n const normalizedBase = base.trim();\n if (\n normalizedBase === \"\" ||\n normalizedBase === \"/\" ||\n normalizedBase === \"./\" ||\n normalizedBase.startsWith(\"//\") ||\n /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(normalizedBase) ||\n !normalizedBase.startsWith(\"/\")\n ) {\n return undefined;\n }\n\n const normalizedPath = normalizedBase.split(/[?#]/, 1)[0] ?? \"\";\n const segments = normalizedPath\n .split(\"/\")\n .filter((segment) => segment.length > 0);\n return segments.length > 0 ? segments.join(\"/\") : undefined;\n};\n\n/**\n * Creates muon asset options for packaging Vite build output.\n */\nexport const createVitePackagedAssetOptions = (\n base: string,\n): MuonVitePackagedAssetOptions => {\n const packagedAssetBasePath = resolveVitePackagedAssetBasePath(base);\n const assetPrefix =\n packagedAssetBasePath === undefined\n ? \"main\"\n : `main/${packagedAssetBasePath}`;\n return {\n assetPrefix,\n browserStartPage:\n packagedAssetBasePath === undefined\n ? undefined\n : `asset://${assetPrefix}/index.html`,\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { isAbsolute, resolve } from \"node:path\";\n\nimport type { InlineConfig, ResolvedConfig } from \"vite\";\n\nimport {\n buildMuonApp,\n resolveMuonNodeProjectForBuildConfig,\n type MuonBuildOptions,\n type MuonBuildResult,\n} from \"./build.js\";\nimport {\n flattenVitePluginOptions,\n getMuonVitePluginOptions,\n} from \"./vite-options.js\";\nimport type { MuonViteBuildOptions, MuonVitePluginOptions } from \"./vite.js\";\nimport { createVitePackagedAssetOptions } from \"./vite-assets.js\";\nimport { mergeMuonWindowsResourceOptions } from \"./windows-resource.js\";\nimport { mergeMuonLinuxDesktopOptions } from \"./linux-desktop.js\";\nimport type { MuonProgressCallback } from \"./progress.js\";\nimport { assertMuonNodeProjectViteBuildIsSafe } from \"./node-project.js\";\n\n/**\n * Environment variable used to prevent the Vite plugin build hook from running\n * when a CLI command owns the muon build sequence.\n */\nexport const muonBuildSequenceSuppressViteBuildEnvironmentKey =\n \"MUON_SUPPRESS_VITE_MUON_BUILD\";\n\n/**\n * Resolved project metadata used by the CLI build sequence.\n */\nexport interface MuonBuildSequenceProject {\n /** Project root used for muon config and package metadata. */\n root: string;\n /** Root passed to Vite when the sequence must run `vite build`. */\n viteBuildRoot: string;\n /** Vite base URL used by the resolved Vite build. */\n viteBase: string | undefined;\n /** Absolute Vite output directory used as muon app assets. */\n viteOutputDirectory: string | undefined;\n /** Absolute Vite public directory copied into output, when enabled. */\n vitePublicDirectory: string | undefined;\n /** muon Vite plugin options if the project config contains the plugin. */\n pluginOptions: MuonVitePluginOptions | undefined;\n /** Whether the resolved Vite config contains server proxy entries. */\n viteServerProxyConfigured: boolean;\n}\n\n/**\n * Options for running the CLI-oriented muon build sequence.\n */\nexport interface MuonBuildSequenceOptions extends MuonBuildOptions {\n /** Target default used only when no muon Vite plugin defines build options. */\n defaultAllTargets?: boolean;\n}\n\ninterface InternalMuonBuildSequenceOptions extends MuonBuildSequenceOptions {\n environment?: NodeJS.ProcessEnv;\n progress?: MuonProgressCallback;\n}\n\ninterface InternalMuonBuildOptions extends MuonBuildOptions {\n environment?: NodeJS.ProcessEnv;\n progress?: MuonProgressCallback;\n}\n\nconst isMissingVitePackageError = (error: unknown): boolean => {\n const candidate = error as { code?: unknown; message?: unknown };\n return (\n candidate.code === \"ERR_MODULE_NOT_FOUND\" &&\n typeof candidate.message === \"string\" &&\n candidate.message.includes(\"vite\")\n );\n};\n\nconst resolveViteOutputDirectory = (config: ResolvedConfig): string => {\n return isAbsolute(config.build.outDir)\n ? config.build.outDir\n : resolve(config.root, config.build.outDir);\n};\n\nconst hasViteServerProxyConfiguration = (proxy: unknown): boolean =>\n typeof proxy === \"object\" && proxy !== null && Object.keys(proxy).length > 0;\n\nconst withSuppressedMuonViteBuild = async <T>(\n action: () => Promise<T>,\n): Promise<T> => {\n const previous =\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey];\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey] = \"1\";\n try {\n return await action();\n } finally {\n if (previous === undefined) {\n delete process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey];\n } else {\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey] = previous;\n }\n }\n};\n\nconst findMuonVitePluginOptions = async (\n plugins: unknown,\n): Promise<MuonVitePluginOptions | undefined> => {\n const flattenedPlugins = await flattenVitePluginOptions(plugins);\n const muonPlugins = flattenedPlugins\n .map((plugin) => getMuonVitePluginOptions(plugin))\n .filter(\n (pluginOptions): pluginOptions is MuonVitePluginOptions =>\n pluginOptions !== undefined,\n );\n\n if (muonPlugins.length > 1) {\n throw new Error(\n \"Multiple muon() plugin definitions were found in vite.config.*.\",\n );\n }\n\n return muonPlugins[0];\n};\n\n/**\n * Loads Vite configuration only far enough to discover whether a muon plugin\n * controls the build sequence.\n */\nexport const loadMuonBuildSequenceProject = async (\n cwd: string,\n): Promise<MuonBuildSequenceProject> => {\n const resolvedCwd = resolve(cwd);\n let vite: typeof import(\"vite\");\n try {\n vite = await import(\"vite\");\n } catch (error) {\n if (isMissingVitePackageError(error)) {\n return {\n root: resolvedCwd,\n viteBuildRoot: resolvedCwd,\n viteBase: undefined,\n viteOutputDirectory: undefined,\n vitePublicDirectory: undefined,\n pluginOptions: undefined,\n viteServerProxyConfigured: false,\n };\n }\n throw error;\n }\n\n const resolvedConfig = await withSuppressedMuonViteBuild(\n async () =>\n await vite.resolveConfig(\n { root: resolvedCwd, logLevel: \"silent\" } satisfies InlineConfig,\n \"build\",\n \"production\",\n \"production\",\n ),\n );\n const pluginOptions = await findMuonVitePluginOptions(resolvedConfig.plugins);\n if (pluginOptions === undefined) {\n return {\n root: resolvedCwd,\n viteBuildRoot: resolvedCwd,\n viteBase: undefined,\n viteOutputDirectory: undefined,\n vitePublicDirectory: undefined,\n pluginOptions: undefined,\n viteServerProxyConfigured: hasViteServerProxyConfiguration(\n resolvedConfig.server.proxy,\n ),\n };\n }\n\n return {\n root: resolvedConfig.root,\n viteBuildRoot: resolvedCwd,\n viteBase: resolvedConfig.base,\n viteOutputDirectory: resolveViteOutputDirectory(resolvedConfig),\n vitePublicDirectory:\n resolvedConfig.publicDir === \"\" ? undefined : resolvedConfig.publicDir,\n pluginOptions,\n viteServerProxyConfigured: hasViteServerProxyConfiguration(\n resolvedConfig.server.proxy,\n ),\n };\n};\n\n/**\n * Returns muon build options from a muon Vite plugin declaration.\n */\nexport const resolveMuonViteBuildOptions = (\n pluginOptions: MuonVitePluginOptions | undefined,\n): MuonViteBuildOptions => {\n if (pluginOptions?.build === false) {\n throw new Error(\"muon build is disabled by muon({ build: false }).\");\n }\n return typeof pluginOptions?.build === \"object\" ? pluginOptions.build : {};\n};\n\nconst runViteBuild = async (root: string): Promise<void> => {\n const vite = await import(\"vite\");\n await withSuppressedMuonViteBuild(async () => {\n await vite.build({ root, logLevel: \"silent\" } satisfies InlineConfig);\n });\n};\n\nconst hasExplicitTargets = (options: MuonBuildSequenceOptions): boolean =>\n options.targets !== undefined && options.targets.length > 0;\n\nconst copyDefinedBuildOptions = (\n output: MuonBuildOptions,\n input: MuonBuildSequenceOptions,\n usesViteAssets: boolean,\n): void => {\n if (input.assetSourcePath !== undefined) {\n if (usesViteAssets) {\n throw new Error(\n \"--assets cannot be used when a muon() Vite plugin provides the build sequence.\",\n );\n }\n output.assetSourcePath = input.assetSourcePath;\n }\n if (input.assetPrefix !== undefined) {\n output.assetPrefix = input.assetPrefix;\n }\n if (input.targets !== undefined && input.targets.length > 0) {\n output.targets = input.targets;\n if (input.allTargets === undefined) {\n output.allTargets = false;\n }\n }\n if (input.allTargets !== undefined) {\n output.allTargets = input.allTargets;\n }\n if (input.appName !== undefined) {\n output.appName = input.appName;\n }\n if (input.appId !== undefined) {\n output.appId = input.appId;\n }\n if (input.outputRoot !== undefined) {\n output.outputRoot = input.outputRoot;\n }\n if (input.configPath !== undefined) {\n output.configPath = input.configPath;\n }\n if (input.iconPath !== undefined) {\n output.iconPath = input.iconPath;\n }\n if (input.distributionFiles !== undefined) {\n output.distributionFiles = input.distributionFiles;\n }\n if (input.windowsResource !== undefined) {\n const windowsResource = mergeMuonWindowsResourceOptions(\n input.windowsResource,\n output.windowsResource,\n );\n if (windowsResource !== undefined) {\n output.windowsResource = windowsResource;\n }\n }\n if (input.windowsCodeSigning !== undefined) {\n output.windowsCodeSigning = input.windowsCodeSigning;\n }\n if (input.linuxDesktop !== undefined) {\n const linuxDesktop = mergeMuonLinuxDesktopOptions(\n input.linuxDesktop,\n output.linuxDesktop,\n );\n if (linuxDesktop !== undefined) {\n output.linuxDesktop = linuxDesktop;\n }\n }\n if (input.packageDirectory !== undefined) {\n output.packageDirectory = input.packageDirectory;\n }\n if (input.assetSalt !== undefined) {\n output.assetSalt = input.assetSalt;\n }\n if (input.includeRuntimeHelper !== undefined) {\n output.includeRuntimeHelper = input.includeRuntimeHelper;\n }\n};\n\n/**\n * Runs the project build sequence used by `muon build` and `muon pack`.\n */\nexport const runMuonBuildSequence = async (\n options: MuonBuildSequenceOptions = {},\n loadedProject?: MuonBuildSequenceProject,\n): Promise<MuonBuildResult> => {\n const internalOptions = options as InternalMuonBuildSequenceOptions;\n const progress = internalOptions.progress;\n const project =\n loadedProject ??\n (await loadMuonBuildSequenceProject(options.root ?? process.cwd()));\n const pluginBuildOptions = resolveMuonViteBuildOptions(project.pluginOptions);\n const usesViteAssets = project.pluginOptions !== undefined;\n const buildOptions: MuonBuildOptions = {\n root: project.root,\n };\n\n if (usesViteAssets) {\n if (project.viteOutputDirectory === undefined) {\n throw new Error(\"Vite output directory could not be resolved.\");\n }\n Object.assign(buildOptions, pluginBuildOptions);\n const effectiveConfigPath =\n options.configPath ?? pluginBuildOptions.configPath;\n const nodeProject = await resolveMuonNodeProjectForBuildConfig(\n project.root,\n effectiveConfigPath,\n );\n await assertMuonNodeProjectViteBuildIsSafe(\n nodeProject,\n project.viteOutputDirectory,\n project.vitePublicDirectory ?? \"\",\n );\n const packagedAssetOptions = createVitePackagedAssetOptions(\n project.viteBase ?? \"/\",\n );\n buildOptions.assetSourcePath = project.viteOutputDirectory;\n buildOptions.assetPrefix = packagedAssetOptions.assetPrefix;\n if (packagedAssetOptions.browserStartPage !== undefined) {\n buildOptions.browserStartPage = packagedAssetOptions.browserStartPage;\n }\n progress?.({\n phase: \"build\",\n status: \"Running Vite build\",\n });\n await runViteBuild(project.viteBuildRoot);\n } else if (\n options.defaultAllTargets !== undefined &&\n options.allTargets === undefined &&\n !hasExplicitTargets(options)\n ) {\n buildOptions.allTargets = options.defaultAllTargets;\n }\n\n copyDefinedBuildOptions(buildOptions, options, usesViteAssets);\n if (internalOptions.environment !== undefined) {\n (buildOptions as InternalMuonBuildOptions).environment =\n internalOptions.environment;\n }\n if (progress !== undefined) {\n (buildOptions as InternalMuonBuildOptions).progress = progress;\n }\n return await buildMuonApp(buildOptions);\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn, type ChildProcess } from \"node:child_process\";\nimport { constants, writeFileSync } from \"node:fs\";\nimport { access, mkdtemp, readFile, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, isAbsolute, join, resolve, win32 } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\nimport type { ViteDevServer } from \"vite\";\n\nimport { ensureMuonGitignoreEntry } from \"./gitignore.js\";\nimport { getDefaultMuonPrepareTarget, runMuonPrepare } from \"./prepare.js\";\nimport type { MuonRuntimePluginConfig } from \"./capability.js\";\nimport type { MuonVitePluginOptions } from \"./vite.js\";\nimport {\n assertMuonNodeHostArtifacts,\n assertMuonNodeProjectStagingIsSafe,\n createMuonNodeRuntimeRequirement,\n resolveMuonNodeProject,\n stageMuonNodeProject,\n} from \"./node-project.js\";\n\nexport interface MuonLaunchScriptOptions {\n muonExecutablePath: string;\n projectConfigPath: string | undefined;\n overrideConfigPath: string;\n platform: NodeJS.Platform;\n}\n\ninterface MuonViteSessionOptions {\n server: ViteDevServer;\n pluginOptions: MuonVitePluginOptions;\n refreshRuntimePluginConfig: () => Promise<MuonRuntimePluginConfig>;\n platform: NodeJS.Platform;\n architecture: NodeJS.Architecture;\n environment: NodeJS.ProcessEnv;\n}\n\ninterface MuonRuntimePaths {\n temporaryDirectory: string;\n overrideConfigPath: string;\n}\n\ninterface MuonProjectConfigResolution {\n path: string | undefined;\n config: Record<string, unknown> | undefined;\n}\n\ninterface MuonOverrideConfig {\n config?: Record<string, string>;\n node?: {\n project: string;\n };\n cdp?: {\n enable: true;\n };\n browser: {\n startPage: string;\n titleBarType?: \"native\" | \"muon\";\n initialTitleBarVisibility?: boolean;\n keybind?: {\n devtools: \"f12\";\n recycle: \"ctrl+f12\";\n };\n };\n plugin: MuonRuntimePluginConfig & {\n pages: string[];\n };\n network: {\n allow: string[];\n localAccess?: {\n allowInsecureLocalhost: boolean;\n };\n };\n}\n\n/**\n * Options for resolving a muon runtime directory used by the Vite plugin.\n */\nexport interface MuonRuntimePathOptions {\n /**\n * Vite project root used to resolve explicit relative paths.\n */\n root: string;\n\n /**\n * Public muon runtime target such as linux-amd64 or windows-amd64.\n */\n target: string;\n\n /**\n * Explicit custom muon-core runtime path.\n */\n muonPath: string | undefined;\n\n /**\n * Directory containing the packaged muon JavaScript files.\n *\n * @remarks This is injectable for tests. Production code uses the module directory.\n */\n packageDirectory?: string;\n}\n\nconst resolveFromRoot = (root: string, path: string): string =>\n isAbsolute(path) ? path : resolve(root, path);\n\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\nconst defaultProjectConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst muonRecycleExitCode = 88;\n\n/**\n * Resolves the muon-core runtime directory used by the Vite plugin.\n *\n * @param options Runtime path resolution inputs.\n * @returns Absolute or package-relative runtime directory path.\n */\nexport const resolveMuonRuntimePath = ({\n root,\n target,\n muonPath,\n packageDirectory = moduleDirectory,\n}: MuonRuntimePathOptions): string =>\n muonPath === undefined\n ? join(packageDirectory, \"runtime\", target)\n : resolveFromRoot(root, muonPath);\n\nexport const getMuonExecutablePath = (\n runtimePath: string,\n platform: NodeJS.Platform,\n): string =>\n join(runtimePath, platform === \"win32\" ? \"muon-core.exe\" : \"muon-core\");\n\nconst quotePosix = (value: string): string =>\n `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n\nconst getPlatformDirectoryName = (\n path: string,\n platform: NodeJS.Platform,\n): string => (platform === \"win32\" ? win32.dirname(path) : dirname(path));\n\nconst getOptionalPosixValue = (value: string | undefined): string =>\n value === undefined ? \"''\" : quotePosix(value);\n\nconst createPosixMuonLaunchScript = ({\n muonExecutablePath,\n projectConfigPath,\n overrideConfigPath,\n}: MuonLaunchScriptOptions): string => `#!/usr/bin/env bash\nset -euo pipefail\nMUON_RECYCLE_EXIT_CODE=${muonRecycleExitCode}\nMUON_EXECUTABLE=${quotePosix(muonExecutablePath)}\nMUON_EXECUTABLE_DIRECTORY=${quotePosix(getPlatformDirectoryName(muonExecutablePath, \"linux\"))}\nMUON_PROJECT_CONFIG=${getOptionalPosixValue(projectConfigPath)}\nMUON_OVERRIDE_CONFIG=${quotePosix(overrideConfigPath)}\n\nMUON_CONFIG_ARGS=()\nif [[ -n \"$MUON_PROJECT_CONFIG\" ]]; then\n if [[ ! -f \"$MUON_PROJECT_CONFIG\" ]]; then\n echo \"muon startup failed: project config does not exist: $MUON_PROJECT_CONFIG\" >&2\n exit 1\n fi\n MUON_CONFIG_ARGS+=(\"-c\" \"$MUON_PROJECT_CONFIG\")\nfi\n\nif [[ ! -x \"$MUON_EXECUTABLE\" ]]; then\n echo \"muon startup failed: executable does not exist or is not executable: $MUON_EXECUTABLE\" >&2\n exit 1\nfi\n\nif [[ ! -f \"$MUON_OVERRIDE_CONFIG\" ]]; then\n echo \"muon startup failed: generated override config does not exist: $MUON_OVERRIDE_CONFIG\" >&2\n exit 1\nfi\nMUON_CONFIG_ARGS+=(\"-c\" \"$MUON_OVERRIDE_CONFIG\")\n\ncd \"$MUON_EXECUTABLE_DIRECTORY\"\nwhile true; do\n set +e\n \"$MUON_EXECUTABLE\" \"\\${MUON_CONFIG_ARGS[@]}\"\n MUON_EXIT_CODE=$?\n set -e\n if [[ \"$MUON_EXIT_CODE\" -ne \"$MUON_RECYCLE_EXIT_CODE\" ]]; then\n exit \"$MUON_EXIT_CODE\"\n fi\ndone\n`;\n\nconst escapeWindowsCmdValue = (value: string): string =>\n value.replaceAll(\"%\", \"%%\").replaceAll(\"\\r\", \"\").replaceAll(\"\\n\", \"\");\n\nconst getOptionalWindowsCmdValue = (value: string | undefined): string =>\n value === undefined ? \"\" : escapeWindowsCmdValue(value);\n\nconst createWindowsMuonLaunchScript = ({\n muonExecutablePath,\n projectConfigPath,\n overrideConfigPath,\n}: MuonLaunchScriptOptions): string => `@echo off\nsetlocal\nset \"MUON_RECYCLE_EXIT_CODE=${muonRecycleExitCode}\"\nset \"MUON_EXECUTABLE=${escapeWindowsCmdValue(muonExecutablePath)}\"\nset \"MUON_EXECUTABLE_DIRECTORY=${escapeWindowsCmdValue(getPlatformDirectoryName(muonExecutablePath, \"win32\"))}\"\nset \"MUON_PROJECT_CONFIG=${getOptionalWindowsCmdValue(projectConfigPath)}\"\nset \"MUON_OVERRIDE_CONFIG=${escapeWindowsCmdValue(overrideConfigPath)}\"\n\nif not exist \"%MUON_EXECUTABLE%\" (\n echo muon startup failed: executable does not exist: %MUON_EXECUTABLE% 1>&2\n exit /b 1\n)\n\nif not exist \"%MUON_OVERRIDE_CONFIG%\" (\n echo muon startup failed: generated override config does not exist: %MUON_OVERRIDE_CONFIG% 1>&2\n exit /b 1\n)\n\npushd \"%MUON_EXECUTABLE_DIRECTORY%\"\n:muon_recycle_loop\nif defined MUON_PROJECT_CONFIG (\n if not exist \"%MUON_PROJECT_CONFIG%\" (\n echo muon startup failed: project config does not exist: %MUON_PROJECT_CONFIG% 1>&2\n popd\n exit /b 1\n )\n \"%MUON_EXECUTABLE%\" -c \"%MUON_PROJECT_CONFIG%\" -c \"%MUON_OVERRIDE_CONFIG%\"\n) else (\n \"%MUON_EXECUTABLE%\" -c \"%MUON_OVERRIDE_CONFIG%\"\n)\nset \"MUON_EXIT_CODE=%ERRORLEVEL%\"\nif \"%MUON_EXIT_CODE%\"==\"%MUON_RECYCLE_EXIT_CODE%\" goto muon_recycle_loop\npopd\nexit /b %MUON_EXIT_CODE%\n`;\n\nexport const createMuonLaunchScript = (\n options: MuonLaunchScriptOptions,\n): string =>\n options.platform === \"win32\"\n ? createWindowsMuonLaunchScript(options)\n : createPosixMuonLaunchScript(options);\n\nconst getBaseUrl = (server: ViteDevServer): string | undefined =>\n server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0];\n\nconst getWebSocketOrigin = (startUrl: string): string => {\n const url = new URL(startUrl);\n if (url.protocol === \"https:\") {\n url.protocol = \"wss:\";\n } else if (url.protocol === \"http:\") {\n url.protocol = \"ws:\";\n }\n return url.origin;\n};\n\nconst createMuonOverrideConfig = (\n startUrl: string,\n enableDebugger: boolean,\n allowInsecureLocalhost: boolean | undefined,\n config: Readonly<Record<string, string>> | undefined,\n runtimePluginConfig: MuonRuntimePluginConfig,\n nodeProjectPath: string | undefined,\n): MuonOverrideConfig => {\n const origin = new URL(startUrl).origin;\n return {\n ...(config === undefined ? {} : { config: { ...config } }),\n ...(nodeProjectPath === undefined\n ? {}\n : {\n node: {\n project: nodeProjectPath,\n },\n }),\n ...(enableDebugger\n ? {\n cdp: {\n enable: true,\n },\n }\n : {}),\n browser: {\n startPage: startUrl,\n ...(enableDebugger\n ? {\n keybind: {\n devtools: \"f12\",\n recycle: \"ctrl+f12\",\n },\n }\n : {}),\n },\n plugin: {\n ...runtimePluginConfig,\n pages: [`${origin}/**`],\n },\n network: {\n allow: [`${origin}/**`, `${getWebSocketOrigin(startUrl)}/**`],\n ...(allowInsecureLocalhost === undefined\n ? {}\n : {\n localAccess: {\n allowInsecureLocalhost,\n },\n }),\n },\n };\n};\n\nconst writeMuonOverrideConfig = (\n server: ViteDevServer,\n overrideConfigPath: string,\n pluginOptions: MuonVitePluginOptions,\n runtimePluginConfig: MuonRuntimePluginConfig,\n nodeProjectPath: string | undefined,\n): boolean => {\n const startUrl = getBaseUrl(server);\n if (startUrl === undefined) {\n server.config.logger.warn(\"muon Vite plugin could not resolve a Vite URL.\");\n return false;\n }\n writeFileSync(\n overrideConfigPath,\n `${JSON.stringify(\n createMuonOverrideConfig(\n startUrl,\n pluginOptions.enableDebugger !== false,\n pluginOptions.allowInsecureLocalhost,\n pluginOptions.dev?.config,\n runtimePluginConfig,\n nodeProjectPath,\n ),\n null,\n 2,\n )}\\n`,\n );\n return true;\n};\n\nconst createRuntimePaths = async (): Promise<MuonRuntimePaths> => {\n const temporaryDirectory = await mkdtemp(join(tmpdir(), \"muon-vite-\"));\n return {\n temporaryDirectory,\n overrideConfigPath: join(temporaryDirectory, \"muon.vite.json\"),\n };\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst resolveProjectConfig = async (\n server: ViteDevServer,\n): Promise<MuonProjectConfigResolution> => {\n for (const fileName of defaultProjectConfigFileNames) {\n const candidatePath = join(server.config.root, fileName);\n if (!(await fileExists(candidatePath))) {\n continue;\n }\n\n try {\n const parsed = parse(await readFile(candidatePath, \"utf8\"));\n if (!isJsonObject(parsed)) {\n throw new Error(\"muon config root must be an object\");\n }\n return {\n path: candidatePath,\n config: parsed,\n };\n } catch (error) {\n server.config.logger.warn(\n `muon project config will be ignored because it could not be read or parsed: ${candidatePath}: ${getErrorMessage(error)}`,\n );\n return {\n path: undefined,\n config: undefined,\n };\n }\n }\n\n server.config.logger.warn(\n `muon project config was not found in ${server.config.root}; launching with generated Vite config only.`,\n );\n return {\n path: undefined,\n config: undefined,\n };\n};\n\nconst createMuonConfigArguments = (\n projectConfigPath: string | undefined,\n overrideConfigPath: string,\n): string[] => [\n ...(projectConfigPath === undefined ? [] : [\"-c\", projectConfigPath]),\n \"-c\",\n overrideConfigPath,\n];\n\nconst waitForMuonProcess = async (\n muonExecutablePath: string,\n configArguments: readonly string[],\n environment: NodeJS.ProcessEnv,\n setCurrentChild: (child: ChildProcess | undefined) => void,\n): Promise<number> => {\n const child = spawn(muonExecutablePath, [...configArguments], {\n cwd: dirname(muonExecutablePath),\n env: environment,\n stdio: \"ignore\",\n windowsHide: false,\n });\n setCurrentChild(child);\n try {\n return await new Promise<number>((resolvePromise, reject) => {\n child.once(\"error\", reject);\n child.once(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n } finally {\n setCurrentChild(undefined);\n }\n};\n\nexport const startMuonViteBrowserBridge = async ({\n server,\n pluginOptions,\n refreshRuntimePluginConfig,\n platform,\n architecture,\n environment,\n}: MuonViteSessionOptions): Promise<void> => {\n await ensureMuonGitignoreEntry(server.config.root);\n\n if (pluginOptions.open === false || server.httpServer === null) {\n return;\n }\n\n const target = getDefaultMuonPrepareTarget(platform, architecture);\n const muonPath = resolveMuonRuntimePath({\n root: server.config.root,\n target,\n muonPath: pluginOptions.muonPath,\n });\n const cefPath =\n pluginOptions.cefPath === undefined\n ? undefined\n : resolveFromRoot(server.config.root, pluginOptions.cefPath);\n const stagePath =\n pluginOptions.stagePath === undefined\n ? resolve(server.config.root, \".muon\", target)\n : resolveFromRoot(server.config.root, pluginOptions.stagePath);\n const paths = await createRuntimePaths();\n\n let currentChild: ChildProcess | undefined = undefined;\n let closing = false;\n let serverCloseRequested = false;\n let supervisorPromise: Promise<void> | undefined = undefined;\n\n const setCurrentChild = (child: ChildProcess | undefined): void => {\n currentChild = child;\n };\n\n const closeServerAfterMuonExit = (): void => {\n if (\n closing ||\n serverCloseRequested ||\n pluginOptions.exitWithServer === false\n ) {\n return;\n }\n serverCloseRequested = true;\n void server.close().catch((error: unknown) => {\n server.config.logger.warn(\n `muon could not close the Vite server after muon exited: ${getErrorMessage(error)}`,\n );\n });\n };\n\n const runSupervisor = async (): Promise<void> => {\n let exitCode = muonRecycleExitCode;\n while (!closing && exitCode === muonRecycleExitCode) {\n try {\n const projectConfig = await resolveProjectConfig(server);\n const nodeProject = await resolveMuonNodeProject(\n projectConfig.config,\n projectConfig.path === undefined\n ? server.config.root\n : dirname(projectConfig.path),\n );\n await assertMuonNodeProjectStagingIsSafe(nodeProject, stagePath);\n const runtimePluginConfig = await refreshRuntimePluginConfig();\n const preparedRuntime = await runMuonPrepare({\n muonPath,\n cefPath,\n stageDir: stagePath,\n target,\n cacheDir: environment.MUON_CACHE_DIR,\n nodeRuntimeRequirement: createMuonNodeRuntimeRequirement(\n nodeProject,\n true,\n ),\n force: false,\n quiet: false,\n prepareExecutablePath: undefined,\n environment,\n cwd: server.config.root,\n });\n if (preparedRuntime.stagePath === undefined) {\n throw new Error(\"muon-builder did not return a staged runtime path.\");\n }\n const nodeProjectPath = await stageMuonNodeProject(\n nodeProject,\n preparedRuntime.stagePath,\n );\n if (nodeProjectPath !== undefined) {\n await assertMuonNodeHostArtifacts(\n preparedRuntime.stagePath,\n platform,\n );\n }\n const configWritten = writeMuonOverrideConfig(\n server,\n paths.overrideConfigPath,\n pluginOptions,\n runtimePluginConfig,\n nodeProjectPath,\n );\n if (!configWritten || closing) {\n return;\n }\n exitCode = await waitForMuonProcess(\n getMuonExecutablePath(preparedRuntime.stagePath, platform),\n createMuonConfigArguments(\n projectConfig.path,\n paths.overrideConfigPath,\n ),\n environment,\n setCurrentChild,\n );\n if (!closing && exitCode !== muonRecycleExitCode) {\n closeServerAfterMuonExit();\n }\n } catch (error) {\n if (!closing) {\n server.config.logger.warn(\n `muon startup failed: ${getErrorMessage(error)}`,\n );\n }\n return;\n }\n }\n };\n\n let cleanupPromise: Promise<void> | undefined = undefined;\n const cleanup = async (): Promise<void> => {\n if (cleanupPromise !== undefined) {\n return cleanupPromise;\n }\n cleanupPromise = (async () => {\n closing = true;\n currentChild?.kill();\n await supervisorPromise;\n await rm(paths.temporaryDirectory, { recursive: true, force: true });\n })();\n return cleanupPromise;\n };\n\n const originalClose = server.close.bind(server);\n server.close = async (): Promise<void> => {\n try {\n await originalClose();\n } finally {\n await cleanup();\n }\n };\n server.httpServer.once(\"close\", () => {\n void cleanup();\n });\n server.httpServer.once(\"listening\", () => {\n supervisorPromise = runSupervisor();\n });\n};\n"],"x_google_ignoreList":[4,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,IAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;AACF;AAEA,IAAM,oBAAoB;CACxB,eAAe;EACb,IAAI;EACJ,WAAW;EACX,IAAI;EACJ,MAAM;EACN,2BAA2B;EAC3B,uBAAuB;EACvB,iCAAiC,CAAC,0BAA0B;EAC5D,wBAAwB;EACxB,6BAA6B;EAC7B,mBAAmB;EACnB,cAAc;GACZ;GACA;GACA;GACA;EACF;CACF;CACA,eAAe;EACb,IAAI;EACJ,WAAW;EACX,IAAI;EACJ,MAAM;EACN,2BAA2B;EAC3B,uBAAuB;EACvB,iCAAiC,CAAC,0BAA0B;EAC5D,wBAAwB;EACxB,6BAA6B;EAC7B,mBAAmB;EACnB,cAAc;GACZ;GACA;GACA;GACA;EACF;CACF;CACA,eAAe;EACb,IAAI;EAC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