sigma-ui
Version:
CLI for SIGMA-UI components.
1,503 lines (1,484 loc) • 842 kB
JavaScript
#!/usr/bin/env node
import {
__export
} from "./chunk-PZ5AY32C.js";
// src/index.ts
import process6 from "node:process";
import { Command as Command4 } from "commander";
// src/commands/add.ts
import { execSync } from "node:child_process";
import { existsSync as existsSync2, promises as fs3 } from "node:fs";
import process3 from "node:process";
import path4 from "pathe";
import { consola as consola3 } from "consola";
import { colors as colors2 } from "consola/utils";
import { Command } from "commander";
import ora from "ora";
import prompts from "prompts";
import { z as z2 } from "zod";
import { addDependency, addDevDependency, detectPackageManager } from "nypm";
// src/utils/transformers/index.ts
import { promises as fs } from "node:fs";
import { tmpdir } from "node:os";
import path from "pathe";
import { Project, ScriptKind } from "ts-morph";
// src/utils/transformers/transform-import.ts
var transformImport = async ({ sourceFile, config }) => {
const importDeclarations = sourceFile.getImportDeclarations();
for (const importDeclaration of importDeclarations) {
const moduleSpecifier = importDeclaration.getModuleSpecifierValue();
if (moduleSpecifier.startsWith("@ui/registry/")) {
if (config.aliases.components) {
importDeclaration.setModuleSpecifier(
moduleSpecifier.replace(/^@ui\/registry\/[^/]+\/ui/, config.aliases.components)
);
} else {
importDeclaration.setModuleSpecifier(
moduleSpecifier.replace(
/^@ui\/registry\/[^/]+/,
config.aliases.components
)
);
}
}
if (moduleSpecifier === "@ui/utils") {
const namedImports = importDeclaration.getNamedImports();
const cnImport = namedImports.find((i2) => i2.getName() === "cn");
if (cnImport) {
importDeclaration.setModuleSpecifier(
moduleSpecifier.replace(/^@ui\/utils/, config.aliases.utils)
);
}
}
}
return sourceFile;
};
// src/utils/transformers/index.ts
var transformers = [
transformImport
// transformTwPrefixes,
];
var project = new Project({
compilerOptions: {}
});
async function createTempSourceFile(filename) {
const dir = await fs.mkdtemp(path.join(tmpdir(), "sigma-ui-"));
return path.join(dir, filename);
}
async function transform(opts) {
const tempFile = await createTempSourceFile(opts.filename);
const sourceFile = project.createSourceFile(tempFile, opts.raw, {
scriptKind: ScriptKind.Unknown
});
for (const transformer of transformers) {
transformer({ sourceFile, ...opts });
}
return sourceFile?.getFullText();
}
// src/utils/get-config.ts
import { existsSync } from "node:fs";
import process2 from "node:process";
import path2 from "pathe";
import { loadConfig as c12LoadConfig } from "c12";
import { loadConfig } from "tsconfig-paths";
import consola from "consola";
import { colors } from "consola/utils";
// src/utils/resolve-import.ts
import { createMatchPath } from "tsconfig-paths";
function resolveImport(importPath, config) {
return createMatchPath(config.absoluteBaseUrl, config.paths)(
importPath,
void 0,
() => true,
[".ts", ".tsx", ".vue"]
);
}
// src/schemas/index.ts
import { z } from "zod";
var DEFAULT_TYPESCRIPT_CONFIG = "tsconfig.json";
var DEFAULT_TAILWIND_BASE_COLOR = "zinc";
var commonFields = {
styleSystem: z.string(),
baseColor: z.string().default(DEFAULT_TAILWIND_BASE_COLOR),
components: z.array(z.string()).optional(),
cwd: z.string(),
yes: z.boolean(),
path: z.string().optional()
};
var tailwindFields = {
config: z.string(),
prefix: z.string().optional()
};
var registryItemSchema = z.object({
name: z.string(),
dependencies: z.array(z.string()).optional(),
devDependencies: z.array(z.string()).optional(),
registryDependencies: z.array(z.string()).optional(),
files: z.array(z.string()),
type: z.enum(["components:ui", "components:component", "components:example"])
});
var registryIndexSchema = z.array(registryItemSchema);
var registryItemWithContentSchema = registryItemSchema.extend({
files: z.array(
z.object({
name: z.string(),
content: z.string()
})
)
});
var registryWithContentSchema = z.array(registryItemWithContentSchema);
var stylesSchema = z.array(
z.object({
name: z.string(),
label: z.string()
})
);
var registryBaseColorSchema = z.object({
inlineColors: z.object({
light: z.record(z.string(), z.string()),
dark: z.record(z.string(), z.string())
}),
cssVars: z.object({
light: z.record(z.string(), z.string()),
dark: z.record(z.string(), z.string())
}),
templates: z.object({
tailwind: z.object({
withVariables: z.string()
}),
css: z.object({
withVariables: z.string()
})
})
});
var rawConfigSchema = z.object({
$schema: z.string().optional(),
styleSystem: commonFields.styleSystem,
tsConfigPath: z.string().default(DEFAULT_TYPESCRIPT_CONFIG),
setupTailwind: z.boolean().default(false),
framework: z.string().default("vite"),
cssPath: z.string(),
baseColor: commonFields.baseColor,
tailwind: z.object({
config: tailwindFields.config,
prefix: tailwindFields.prefix
}),
aliases: z.object({
utils: z.string().default(""),
components: z.string()
}),
generatePreflight: z.boolean().optional().default(true)
});
var configSchema = rawConfigSchema.extend({
resolvedPaths: z.object({
tailwindConfig: z.string(),
tailwindCss: z.string(),
utils: z.string().optional(),
components: z.string()
})
});
var initOptionsSchema = z.object({
cwd: commonFields.cwd,
yes: commonFields.yes
});
var addOptionsSchema = z.object({
components: commonFields.components,
yes: commonFields.yes,
overwrite: z.boolean(),
cwd: commonFields.cwd,
all: z.boolean(),
path: commonFields.path
});
var configValidationSchema = z.object({
styleSystem: commonFields.styleSystem,
baseColor: commonFields.baseColor,
tailwind: z.object({
config: tailwindFields.config
})
});
var diffOptionsSchema = z.object({
component: z.string().optional(),
yes: commonFields.yes,
cwd: commonFields.cwd,
path: commonFields.path
});
// ../shared/consts/index.ts
var DEFAULT_COMPONENTS = "@/components/ui";
var DEFAULT_UTILS = "@/lib/utils";
var DEFAULT_TAILWIND_CONFIG = "tailwind.config.js";
var INIT_COMMAND = "npx sigma-ui init";
var CONFIG_FILE_PATH = "sigma-ui.config.json";
var TAILWIND_CSS_PATH = {
nuxt: "assets/css/tailwind.css",
vite: "src/assets/index.css",
laravel: "resources/css/app.css",
astro: "src/styles/globals.css"
};
// src/utils/get-config.ts
async function getConfig(cwd) {
const config = await getRawConfig(cwd);
if (!config) {
return null;
}
return await resolveConfigPaths(cwd, config);
}
async function handleConfigIsMissing() {
consola.warn(`Configuration is missing. Run ${colors.green(INIT_COMMAND)} command to create config file`);
process2.exit(1);
}
async function resolveConfigPaths(cwd, config) {
let tsConfig;
let tsConfigPath = path2.resolve(
cwd,
config.tsConfigPath
);
tsConfig = loadConfig(tsConfigPath);
if ("paths" in tsConfig && Object.keys(tsConfig.paths).length === 0) {
tsConfigPath = path2.resolve(cwd, "./tsconfig.app.json");
if (existsSync(tsConfigPath)) {
tsConfig = loadConfig(tsConfigPath);
}
}
if (tsConfig.resultType === "failed") {
throw new Error(
`Failed to load ${tsConfigPath}. ${tsConfig.message ?? ""}`.trim()
);
}
return configSchema.parse({
...config,
resolvedPaths: {
tailwindConfig: path2.resolve(cwd, config.tailwind.config),
tailwindCss: path2.resolve(cwd, config.cssPath),
utils: resolveImport(config.aliases.utils, tsConfig),
components: resolveImport(config.aliases.components, tsConfig)
}
});
}
async function getRawConfig(cwd) {
try {
const configResult = await c12LoadConfig({
name: "components",
configFile: CONFIG_FILE_PATH,
cwd
});
if (!configResult.config || Object.keys(configResult.config).length === 0) {
return null;
}
return rawConfigSchema.parse(configResult.config);
} catch (error) {
throw new Error(`Invalid configuration found in ${cwd}/${CONFIG_FILE_PATH}. ${error}`);
}
}
// src/utils/handle-error.ts
import { consola as consola2 } from "consola";
function handleError(error) {
if (typeof error === "string") {
consola2.error(error);
process.exit(1);
}
if (error instanceof Error) {
consola2.error(error.message);
process.exit(1);
}
consola2.error("Something went wrong. Please try again.");
process.exit(1);
}
// src/utils/registry/index.ts
import fs2 from "node:fs";
import path3 from "pathe";
// ../../apps/docs/src/lib/registry/colors.ts
var baseColors = [
{ name: "zinc", label: "Zinc" },
{ name: "gray", label: "Gray" },
{ name: "blue", label: "Blue" },
{ name: "rose", label: "Rose" },
{ name: "red", label: "Red" },
{ name: "orange", label: "Orange" },
{ name: "yellow", label: "Yellow" },
{ name: "green", label: "Green" },
{ name: "violet", label: "Violet" }
];
// src/utils/registry/index.ts
var REGISTRY_PATH = new URL("../__generated/registry-schemes/", import.meta.url);
var DIRS = {
STYLE_SYSTEM: "style-system",
COLORS: "colors"
};
var filePaths = {
index: () => `index.json`,
styles: () => `${DIRS.STYLE_SYSTEM}/index.json`,
baseColors: (baseColor) => `${DIRS.COLORS}/${baseColor}.json`,
selectedStyleComponent: (params) => `${DIRS.STYLE_SYSTEM}/${params.styleSystem}/${params.componentName}.json`
};
function getRegistryBaseColors() {
return baseColors;
}
async function getSchemeFileData(filePath) {
const filePathUrl = new URL(filePath, REGISTRY_PATH);
const fileData = await fs2.promises.readFile(filePathUrl, "utf8");
const jsonObject = JSON.parse(fileData);
return jsonObject;
}
async function getRegistryIndex() {
try {
const fileData = await getSchemeFileData(filePaths.index());
return registryIndexSchema.parse(fileData);
} catch (error) {
console.error("Error reading components data:", error);
throw new Error("Failed to load components from registry.");
}
}
async function getRegistryStyles() {
try {
const fileData = await getSchemeFileData(filePaths.styles());
return stylesSchema.parse(fileData);
} catch (error) {
console.error("Error reading styles data:", error);
throw new Error("Failed to load styles from registry.");
}
}
async function getRegistryBaseColor(baseColor) {
try {
const fileData = await getSchemeFileData(filePaths.baseColors(baseColor));
return registryBaseColorSchema.parse(fileData);
} catch (error) {
console.error("Error reading base color data:", error);
throw new Error("Failed to load base color from registry.");
}
}
async function fetchTree(styleSystem, tree) {
try {
const results = await Promise.all(
tree.map(async (component) => {
const fileData = await getSchemeFileData(filePaths.selectedStyleComponent({ styleSystem, componentName: component.name }));
return fileData;
})
);
return registryWithContentSchema.parse(results);
} catch (error) {
throw new Error(`Failed to load tree from registry. ${error}`);
}
}
async function resolveTree(index, names) {
const tree = [];
for (const name of names) {
const entry = index.find((entry2) => entry2.name === name);
if (!entry) {
continue;
}
tree.push(entry);
if (entry.registryDependencies) {
const dependencies = await resolveTree(index, entry.registryDependencies);
tree.push(...dependencies);
}
}
return tree.filter(
(component, index2, self) => self.findIndex((c2) => c2.name === component.name) === index2
);
}
function getItemTargetPath(config, item, override) {
if (override) {
return override;
}
if (item.type === "components:ui" && config.aliases.components) {
return config.resolvedPaths.components;
}
const [parent, type2] = item.type.split(":");
if (!(parent in config.resolvedPaths)) {
return null;
}
return path3.join(
config.resolvedPaths[parent] ?? "",
type2
);
}
// src/commands/add.ts
var ComponentInstallError = class extends Error {
constructor(message, component) {
super(message);
this.component = component;
this.name = "ComponentInstallError";
}
};
var add = new Command().name("add").description("add a component to your project").argument("[components...]", "the components to add").option("-y, --yes", "skip confirmation prompt.", true).option("-o, --overwrite", "overwrite existing files.", false).option(
"-c, --cwd <cwd>",
"the working directory. defaults to the current directory.",
process3.cwd()
).option("-a, --all", "add all available components", false).option("-p, --path <path>", "the path to add the component to.").action(async (components, opts) => {
try {
const spinner = ora("Fetching components...").start();
const options8 = parseOptions(components, opts);
const cwd = validateAndResolveCwd(options8.cwd);
const config = await getConfigOrExit(cwd);
try {
configValidationSchema.parse(config);
} catch (error) {
if (error instanceof z2.ZodError) {
consola3.error("Invalid configuration:", error.errors);
process3.exit(1);
}
throw error;
}
const registryIndex = await getRegistryIndex();
spinner.stop();
const selectedComponents = await getSelectedComponents(options8, registryIndex);
if (!selectedComponents?.length) {
consola3.warn("No components selected. Exiting.");
process3.exit(0);
}
const { payload, baseColor } = await getRegistryPayload(config, selectedComponents, registryIndex);
if (!payload.length) {
consola3.warn("Selected components not found. Exiting.");
process3.exit(0);
}
await confirmProceed(options8);
await processPayload(payload, options8, config, baseColor, cwd, selectedComponents);
consola3.success("Done.");
} catch (error) {
if (error instanceof ComponentInstallError) {
consola3.error(`Failed to install component ${error.component}: ${error.message}`);
}
handleError(error);
}
});
function parseOptions(components, opts) {
return addOptionsSchema.parse({
components,
...opts
});
}
function validateAndResolveCwd(cwd) {
const resolvedCwd = path4.resolve(cwd);
if (!existsSync2(resolvedCwd)) {
consola3.error(`The path ${resolvedCwd} does not exist. Try again.`);
process3.exit(1);
}
return resolvedCwd;
}
async function getConfigOrExit(cwd) {
const config = await getConfig(cwd);
if (!config) {
handleConfigIsMissing();
process3.exit(1);
}
return config;
}
async function getSelectedComponents(options8, registryIndex) {
if (options8.all) {
return registryIndex.map((entry) => entry.name);
}
if (options8.components && options8.components.length > 0) {
return options8.components;
}
const { components } = await prompts({
type: "multiselect",
name: "components",
message: "Which components would you like to add?",
hint: "[Space] - select | [A] - toggle all | [Enter] - submit.",
instructions: false,
choices: registryIndex.map((entry) => ({
title: entry.name,
value: entry.name,
selected: options8.all ? true : options8.components?.includes(entry.name)
}))
});
return components;
}
async function getRegistryPayload(config, selectedComponents, registryIndex) {
const tree = await resolveTree(registryIndex, selectedComponents);
const payload = await fetchTree(config.styleSystem, tree);
const baseColor = await getRegistryBaseColor(config.baseColor);
return { payload, baseColor };
}
async function confirmProceed(options8) {
if (!options8.yes) {
const { proceed } = await prompts({
type: "confirm",
name: "proceed",
message: "Ready to install components and dependencies. Proceed?",
initial: true
});
if (!proceed) {
process3.exit(0);
}
}
}
async function processPayload(payload, options8, config, baseColor, cwd, selectedComponents) {
const spinner = ora("Installing components...").start();
for (const item of payload) {
spinner.text = `Installing ${item.name}...`;
const targetDir = getItemTargetPath(
config,
item,
options8.path ? path4.resolve(cwd, options8.path) : void 0
);
if (!targetDir) {
continue;
}
await processItem(item, targetDir, options8, config, baseColor, cwd, selectedComponents, spinner);
}
spinner.succeed();
}
async function processItem(item, targetDir, options8, config, baseColor, cwd, selectedComponents, spinner) {
try {
if (!existsSync2(targetDir)) {
await fs3.mkdir(targetDir, { recursive: true });
}
const componentPath = path4.resolve(targetDir, item.name);
const existingComponent = item.files.filter(
(file) => existsSync2(path4.resolve(componentPath, file.name))
);
if (existingComponent.length && !options8.overwrite) {
if (selectedComponents.includes(item.name)) {
spinner.stop();
const { overwrite } = await prompts({
type: "confirm",
name: "overwrite",
message: `Component ${item.name} already exists. Would you like to overwrite?`,
initial: false
});
if (!overwrite) {
consola3.info(
`Skipped ${item.name}. To overwrite, run with the ${colors2.green(
"--overwrite"
)} flag.`
);
return;
}
spinner.start(`Installing ${item.name}...`);
} else {
return;
}
}
await installDependencies(item, cwd);
await writeComponentFiles(item, componentPath, config, baseColor);
} catch (error) {
throw new ComponentInstallError(
error instanceof Error ? error.message : "Unknown error",
item.name
);
}
}
async function installDependencies(item, cwd) {
const installTasks = [
item.dependencies?.length && { type: "dependencies", deps: item.dependencies, installer: addDependency },
item.devDependencies?.length && { type: "devDependencies", deps: item.devDependencies, installer: addDevDependency }
].filter(Boolean);
for (const task of installTasks) {
try {
consola3.info(`Attempting to install ${task.type} using nypm: ${task.deps.join(", ")}`);
await task.installer(task.deps, { cwd });
consola3.success(`Successfully installed ${task.type} using nypm.`);
} catch (error) {
consola3.warn(`nypm failed to install ${task.type}:`, error);
const isCorepackError = error instanceof Error && error.message?.includes("corepack");
if (isCorepackError) {
consola3.info(`Falling back to direct pnpm execution for ${task.type}...`);
const pm = await detectPackageManager(cwd);
let command = "";
const depsString = task.deps.join(" ");
const devFlag = task.type === "devDependencies" ? "-D " : "";
switch (pm?.name) {
case "npm":
command = `npm install ${devFlag}${depsString}`;
break;
case "yarn":
command = `yarn add ${devFlag}${depsString}`;
break;
case "bun":
command = `bun add ${devFlag}${depsString}`;
break;
case "pnpm":
default:
command = `pnpm add ${devFlag}${depsString}`;
break;
}
try {
consola3.info(`Running: ${command}`);
execSync(command, { cwd, stdio: "inherit" });
consola3.success(`Successfully installed ${task.type} using direct pnpm execution.`);
} catch (fallbackError) {
const errorMessage = fallbackError instanceof Error ? fallbackError.message : "Unknown error";
consola3.error(`Fallback pnpm execution failed for ${task.type}:`, errorMessage);
throw new ComponentInstallError(
`Failed to install ${task.type} (nypm and fallback failed): ${errorMessage}`,
item.name
);
}
} else {
const errorMessage = error instanceof Error ? error.message : "Unknown error";
throw new ComponentInstallError(
`Failed to install ${task.type} using nypm: ${errorMessage}`,
item.name
);
}
}
}
}
async function writeComponentFiles(item, componentDir, config, baseColor) {
if (!existsSync2(componentDir)) {
await fs3.mkdir(componentDir, { recursive: true });
}
const files = item.files.map((file) => ({
...file,
path: path4.resolve(componentDir, file.name)
}));
for (const file of files) {
const content = await transform({
filename: file.path,
raw: file.content,
config,
baseColor
});
const filePath = file.path;
await fs3.writeFile(filePath, content);
}
}
// src/commands/diff.ts
import { existsSync as existsSync3, promises as fs4 } from "node:fs";
import process4 from "node:process";
import path5 from "pathe";
import { consola as consola4 } from "consola";
import { colors as colors3 } from "consola/utils";
import { Command as Command2 } from "commander";
import { diffLines } from "diff";
var diff = new Command2().name("diff").description("check for updates against the registry").argument("[component]", "the component name").option("-y, --yes", "skip confirmation prompt.", false).option(
"-c, --cwd <cwd>",
"the working directory. defaults to the current directory.",
process4.cwd()
).action(async (name, opts) => {
try {
const options8 = parseOptions2(name, opts);
const cwd = validateAndResolveCwd2(options8.cwd);
const config = await getConfigOrExit2(cwd);
const registryIndex = await getRegistryIndex();
if (!options8.component) {
await handleAllComponentsDiff(config, registryIndex);
} else {
await handleSingleComponentDiff(options8.component, config, registryIndex);
}
} catch (error) {
handleError(error);
}
});
function parseOptions2(name, opts) {
return diffOptionsSchema.parse({
component: name,
...opts
});
}
function validateAndResolveCwd2(cwd) {
const resolvedCwd = path5.resolve(cwd);
if (!existsSync3(resolvedCwd)) {
consola4.error(`The path ${resolvedCwd} does not exist. Try again.`);
process4.exit(1);
}
return resolvedCwd;
}
async function getConfigOrExit2(cwd) {
const config = await getConfig(cwd);
if (!config) {
handleConfigIsMissing();
process4.exit(1);
}
return config;
}
async function handleAllComponentsDiff(config, registryIndex) {
const targetDir = config.resolvedPaths.components;
const projectComponents = findProjectComponents(registryIndex, targetDir);
const componentsWithUpdates = await checkForUpdates(projectComponents, config);
if (!componentsWithUpdates.length) {
consola4.info("No updates found.");
process4.exit(0);
}
displayAvailableUpdates(componentsWithUpdates);
process4.exit(0);
}
function findProjectComponents(registryIndex, targetDir) {
return registryIndex.filter((item) => {
return item.files.some((file) => {
const fullPath = path5.resolve(targetDir, item.name, file);
return existsSync3(fullPath);
});
});
}
async function handleSingleComponentDiff(componentName, config, registryIndex) {
const component = registryIndex.find((item) => item.name === componentName);
if (!component) {
consola4.error(`The component ${colors3.green(componentName)} does not exist.`);
process4.exit(1);
}
const changes = await diffComponent(component, config);
if (!changes.length) {
consola4.info(`No updates found for ${componentName}.`);
process4.exit(0);
}
displayComponentChanges(changes);
}
async function checkForUpdates(components, config) {
const componentsWithUpdates = [];
for (const component of components) {
const changes = await diffComponent(component, config);
if (changes.length) {
componentsWithUpdates.push({
name: component.name,
changes
});
}
}
return componentsWithUpdates;
}
function displayAvailableUpdates(componentsWithUpdates) {
consola4.info("The following components have updates available:");
for (const component of componentsWithUpdates) {
consola4.info(`- ${component.name}`);
for (const change of component.changes) {
consola4.info(` - ${change.filePath}`);
}
}
consola4.log("");
consola4.info(`Run ${colors3.green("diff <component>")} to see the changes.`);
}
function displayComponentChanges(changes) {
for (const change of changes) {
consola4.info(`- ${change.filePath}`);
printDiff(change.patch);
consola4.log("");
}
}
async function diffComponent(component, config) {
const payload = await fetchTree(config.styleSystem, [component]);
const baseColor = await getRegistryBaseColor(config.baseColor);
const changes = [];
for (const item of payload) {
const targetDir = await getItemTargetPath(config, item);
if (!targetDir) {
continue;
}
await processItemFiles(item, targetDir, config, baseColor, changes);
}
return changes;
}
async function processItemFiles(item, targetDir, config, baseColor, changes) {
for (const file of item.files) {
const filePath = path5.resolve(targetDir, item.name, file.name);
if (!existsSync3(filePath)) {
continue;
}
const fileContent = await fs4.readFile(filePath, "utf8");
const registryContent = await transform({
filename: file.name,
raw: file.content,
config,
baseColor
});
const patch = diffLines(fileContent, registryContent);
if (patch.length > 1) {
changes.push({
file: file.name,
filePath,
patch
});
}
}
}
function printDiff(diff3) {
diff3.forEach((part) => {
if (part) {
if (part.added) {
process4.stdout.write(colors3.green(part.value));
return;
}
if (part.removed) {
process4.stdout.write(colors3.red(part.value));
return;
}
process4.stdout.write(part.value);
}
});
}
// src/commands/init.ts
import { existsSync as existsSync5, promises as fs8 } from "node:fs";
import process5 from "node:process";
import path14 from "pathe";
import { Command as Command3 } from "commander";
import { template } from "lodash-es";
import ora2 from "ora";
import prompts2 from "prompts";
import { addDependency as addDependency2, addDevDependency as addDevDependency2, detectPackageManager as detectPackageManager2 } from "nypm";
import { consola as consola5 } from "consola";
import { colors as colors4 } from "consola/utils";
import { execSync as execSync2 } from "node:child_process";
// ../../node_modules/.pnpm/prettier@3.5.0/node_modules/prettier/index.mjs
import { createRequire as __prettierCreateRequire } from "module";
import { fileURLToPath as __prettierFileUrlToPath } from "url";
import { dirname as __prettierDirname } from "path";
import process22 from "process";
import os from "os";
import tty from "tty";
import path9 from "path";
import { fileURLToPath, pathToFileURL } from "url";
import path42 from "path";
import * as path32 from "path";
import fs5 from "fs/promises";
import path22 from "path";
import * as path6 from "path";
import path8 from "path";
import fs22 from "fs/promises";
import fs32 from "fs/promises";
import { pathToFileURL as pathToFileURL2 } from "url";
import fs42 from "fs/promises";
import path7 from "path";
import { pathToFileURL as pathToFileURL4 } from "url";
import assert3 from "assert";
import { statSync, realpathSync } from "fs";
import process32 from "process";
import { URL as URL2, fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL3 } from "url";
import path62 from "path";
import { builtinModules } from "module";
import { fileURLToPath as fileURLToPath3 } from "url";
import fs52 from "fs";
import path52 from "path";
import { fileURLToPath as fileURLToPath2 } from "url";
import v8 from "v8";
import assert2 from "assert";
import { format, inspect } from "util";
import { createRequire } from "module";
import path10 from "path";
import url from "url";
import fs6 from "fs";
import assert4 from "assert";
import assert5 from "assert";
import path12 from "path";
import { pathToFileURL as pathToFileURL5 } from "url";
import path11 from "path";
// ../../node_modules/.pnpm/prettier@3.5.0/node_modules/prettier/doc.mjs
var doc_exports = {};
__export(doc_exports, {
builders: () => builders,
default: () => public_default,
printer: () => printer,
utils: () => utils
});
var __defProp = Object.defineProperty;
var __export2 = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var public_exports = {};
__export2(public_exports, {
builders: () => builders,
printer: () => printer,
utils: () => utils
});
var DOC_TYPE_STRING = "string";
var DOC_TYPE_ARRAY = "array";
var DOC_TYPE_CURSOR = "cursor";
var DOC_TYPE_INDENT = "indent";
var DOC_TYPE_ALIGN = "align";
var DOC_TYPE_TRIM = "trim";
var DOC_TYPE_GROUP = "group";
var DOC_TYPE_FILL = "fill";
var DOC_TYPE_IF_BREAK = "if-break";
var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break";
var DOC_TYPE_LINE_SUFFIX = "line-suffix";
var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary";
var DOC_TYPE_LINE = "line";
var DOC_TYPE_LABEL = "label";
var DOC_TYPE_BREAK_PARENT = "break-parent";
var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
DOC_TYPE_CURSOR,
DOC_TYPE_INDENT,
DOC_TYPE_ALIGN,
DOC_TYPE_TRIM,
DOC_TYPE_GROUP,
DOC_TYPE_FILL,
DOC_TYPE_IF_BREAK,
DOC_TYPE_INDENT_IF_BREAK,
DOC_TYPE_LINE_SUFFIX,
DOC_TYPE_LINE_SUFFIX_BOUNDARY,
DOC_TYPE_LINE,
DOC_TYPE_LABEL,
DOC_TYPE_BREAK_PARENT
]);
var at = (isOptionalObject, object, index) => {
if (isOptionalObject && (object === void 0 || object === null)) {
return;
}
if (Array.isArray(object) || typeof object === "string") {
return object[index < 0 ? object.length + index : index];
}
return object.at(index);
};
var at_default = at;
function getDocType(doc) {
if (typeof doc === "string") {
return DOC_TYPE_STRING;
}
if (Array.isArray(doc)) {
return DOC_TYPE_ARRAY;
}
if (!doc) {
return;
}
const { type: type2 } = doc;
if (VALID_OBJECT_DOC_TYPES.has(type2)) {
return type2;
}
}
var get_doc_type_default = getDocType;
var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
function getDocErrorMessage(doc) {
const type2 = doc === null ? "null" : typeof doc;
if (type2 !== "string" && type2 !== "object") {
return `Unexpected doc '${type2}',
Expected it to be 'string' or 'object'.`;
}
if (get_doc_type_default(doc)) {
throw new Error("doc is valid.");
}
const objectType = Object.prototype.toString.call(doc);
if (objectType !== "[object Object]") {
return `Unexpected doc '${objectType}'.`;
}
const EXPECTED_TYPE_VALUES = disjunctionListFormat(
[...VALID_OBJECT_DOC_TYPES].map((type22) => `'${type22}'`)
);
return `Unexpected doc.type '${doc.type}'.
Expected it to be ${EXPECTED_TYPE_VALUES}.`;
}
var InvalidDocError = class extends Error {
name = "InvalidDocError";
constructor(doc) {
super(getDocErrorMessage(doc));
this.doc = doc;
}
};
var invalid_doc_error_default = InvalidDocError;
var traverseDocOnExitStackMarker = {};
function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
const docsStack = [doc];
while (docsStack.length > 0) {
const doc2 = docsStack.pop();
if (doc2 === traverseDocOnExitStackMarker) {
onExit(docsStack.pop());
continue;
}
if (onExit) {
docsStack.push(doc2, traverseDocOnExitStackMarker);
}
const docType = get_doc_type_default(doc2);
if (!docType) {
throw new invalid_doc_error_default(doc2);
}
if ((onEnter == null ? void 0 : onEnter(doc2)) === false) {
continue;
}
switch (docType) {
case DOC_TYPE_ARRAY:
case DOC_TYPE_FILL: {
const parts = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts;
for (let ic = parts.length, i2 = ic - 1; i2 >= 0; --i2) {
docsStack.push(parts[i2]);
}
break;
}
case DOC_TYPE_IF_BREAK:
docsStack.push(doc2.flatContents, doc2.breakContents);
break;
case DOC_TYPE_GROUP:
if (shouldTraverseConditionalGroups && doc2.expandedStates) {
for (let ic = doc2.expandedStates.length, i2 = ic - 1; i2 >= 0; --i2) {
docsStack.push(doc2.expandedStates[i2]);
}
} else {
docsStack.push(doc2.contents);
}
break;
case DOC_TYPE_ALIGN:
case DOC_TYPE_INDENT:
case DOC_TYPE_INDENT_IF_BREAK:
case DOC_TYPE_LABEL:
case DOC_TYPE_LINE_SUFFIX:
docsStack.push(doc2.contents);
break;
case DOC_TYPE_STRING:
case DOC_TYPE_CURSOR:
case DOC_TYPE_TRIM:
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
case DOC_TYPE_LINE:
case DOC_TYPE_BREAK_PARENT:
break;
default:
throw new invalid_doc_error_default(doc2);
}
}
}
var traverse_doc_default = traverseDoc;
function mapDoc(doc, cb) {
if (typeof doc === "string") {
return cb(doc);
}
const mapped = /* @__PURE__ */ new Map();
return rec(doc);
function rec(doc2) {
if (mapped.has(doc2)) {
return mapped.get(doc2);
}
const result = process23(doc2);
mapped.set(doc2, result);
return result;
}
function process23(doc2) {
switch (get_doc_type_default(doc2)) {
case DOC_TYPE_ARRAY:
return cb(doc2.map(rec));
case DOC_TYPE_FILL:
return cb({ ...doc2, parts: doc2.parts.map(rec) });
case DOC_TYPE_IF_BREAK:
return cb({
...doc2,
breakContents: rec(doc2.breakContents),
flatContents: rec(doc2.flatContents)
});
case DOC_TYPE_GROUP: {
let { expandedStates, contents } = doc2;
if (expandedStates) {
expandedStates = expandedStates.map(rec);
contents = expandedStates[0];
} else {
contents = rec(contents);
}
return cb({ ...doc2, contents, expandedStates });
}
case DOC_TYPE_ALIGN:
case DOC_TYPE_INDENT:
case DOC_TYPE_INDENT_IF_BREAK:
case DOC_TYPE_LABEL:
case DOC_TYPE_LINE_SUFFIX:
return cb({ ...doc2, contents: rec(doc2.contents) });
case DOC_TYPE_STRING:
case DOC_TYPE_CURSOR:
case DOC_TYPE_TRIM:
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
case DOC_TYPE_LINE:
case DOC_TYPE_BREAK_PARENT:
return cb(doc2);
default:
throw new invalid_doc_error_default(doc2);
}
}
}
function findInDoc(doc, fn, defaultValue) {
let result = defaultValue;
let shouldSkipFurtherProcessing = false;
function findInDocOnEnterFn(doc2) {
if (shouldSkipFurtherProcessing) {
return false;
}
const maybeResult = fn(doc2);
if (maybeResult !== void 0) {
shouldSkipFurtherProcessing = true;
result = maybeResult;
}
}
traverse_doc_default(doc, findInDocOnEnterFn);
return result;
}
function willBreakFn(doc) {
if (doc.type === DOC_TYPE_GROUP && doc.break) {
return true;
}
if (doc.type === DOC_TYPE_LINE && doc.hard) {
return true;
}
if (doc.type === DOC_TYPE_BREAK_PARENT) {
return true;
}
}
function willBreak(doc) {
return findInDoc(doc, willBreakFn, false);
}
function breakParentGroup(groupStack) {
if (groupStack.length > 0) {
const parentGroup = at_default(
/* isOptionalObject */
false,
groupStack,
-1
);
if (!parentGroup.expandedStates && !parentGroup.break) {
parentGroup.break = "propagated";
}
}
return null;
}
function propagateBreaks(doc) {
const alreadyVisitedSet = /* @__PURE__ */ new Set();
const groupStack = [];
function propagateBreaksOnEnterFn(doc2) {
if (doc2.type === DOC_TYPE_BREAK_PARENT) {
breakParentGroup(groupStack);
}
if (doc2.type === DOC_TYPE_GROUP) {
groupStack.push(doc2);
if (alreadyVisitedSet.has(doc2)) {
return false;
}
alreadyVisitedSet.add(doc2);
}
}
function propagateBreaksOnExitFn(doc2) {
if (doc2.type === DOC_TYPE_GROUP) {
const group2 = groupStack.pop();
if (group2.break) {
breakParentGroup(groupStack);
}
}
}
traverse_doc_default(
doc,
propagateBreaksOnEnterFn,
propagateBreaksOnExitFn,
/* shouldTraverseConditionalGroups */
true
);
}
function removeLinesFn(doc) {
if (doc.type === DOC_TYPE_LINE && !doc.hard) {
return doc.soft ? "" : " ";
}
if (doc.type === DOC_TYPE_IF_BREAK) {
return doc.flatContents;
}
return doc;
}
function removeLines(doc) {
return mapDoc(doc, removeLinesFn);
}
function stripTrailingHardlineFromParts(parts) {
parts = [...parts];
while (parts.length >= 2 && at_default(
/* isOptionalObject */
false,
parts,
-2
).type === DOC_TYPE_LINE && at_default(
/* isOptionalObject */
false,
parts,
-1
).type === DOC_TYPE_BREAK_PARENT) {
parts.length -= 2;
}
if (parts.length > 0) {
const lastPart = stripTrailingHardlineFromDoc(at_default(
/* isOptionalObject */
false,
parts,
-1
));
parts[parts.length - 1] = lastPart;
}
return parts;
}
function stripTrailingHardlineFromDoc(doc) {
switch (get_doc_type_default(doc)) {
case DOC_TYPE_INDENT:
case DOC_TYPE_INDENT_IF_BREAK:
case DOC_TYPE_GROUP:
case DOC_TYPE_LINE_SUFFIX:
case DOC_TYPE_LABEL: {
const contents = stripTrailingHardlineFromDoc(doc.contents);
return { ...doc, contents };
}
case DOC_TYPE_IF_BREAK:
return {
...doc,
breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
};
case DOC_TYPE_FILL:
return { ...doc, parts: stripTrailingHardlineFromParts(doc.parts) };
case DOC_TYPE_ARRAY:
return stripTrailingHardlineFromParts(doc);
case DOC_TYPE_STRING:
return doc.replace(/[\n\r]*$/u, "");
case DOC_TYPE_ALIGN:
case DOC_TYPE_CURSOR:
case DOC_TYPE_TRIM:
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
case DOC_TYPE_LINE:
case DOC_TYPE_BREAK_PARENT:
break;
default:
throw new invalid_doc_error_default(doc);
}
return doc;
}
function stripTrailingHardline(doc) {
return stripTrailingHardlineFromDoc(cleanDoc(doc));
}
function cleanDocFn(doc) {
switch (get_doc_type_default(doc)) {
case DOC_TYPE_FILL:
if (doc.parts.every((part) => part === "")) {
return "";
}
break;
case DOC_TYPE_GROUP:
if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
return "";
}
if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
return doc.contents;
}
break;
case DOC_TYPE_ALIGN:
case DOC_TYPE_INDENT:
case DOC_TYPE_INDENT_IF_BREAK:
case DOC_TYPE_LINE_SUFFIX:
if (!doc.contents) {
return "";
}
break;
case DOC_TYPE_IF_BREAK:
if (!doc.flatContents && !doc.breakContents) {
return "";
}
break;
case DOC_TYPE_ARRAY: {
const parts = [];
for (const part of doc) {
if (!part) {
continue;
}
const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
if (typeof currentPart === "string" && typeof at_default(
/* isOptionalObject */
false,
parts,
-1
) === "string") {
parts[parts.length - 1] += currentPart;
} else {
parts.push(currentPart);
}
parts.push(...restParts);
}
if (parts.length === 0) {
return "";
}
if (parts.length === 1) {
return parts[0];
}
return parts;
}
case DOC_TYPE_STRING:
case DOC_TYPE_CURSOR:
case DOC_TYPE_TRIM:
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
case DOC_TYPE_LINE:
case DOC_TYPE_LABEL:
case DOC_TYPE_BREAK_PARENT:
break;
default:
throw new invalid_doc_error_default(doc);
}
return doc;
}
function cleanDoc(doc) {
return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
}
function replaceEndOfLine(doc, replacement = literalline) {
return mapDoc(
doc,
(currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc
);
}
function canBreakFn(doc) {
if (doc.type === DOC_TYPE_LINE) {
return true;
}
}
function canBreak(doc) {
return findInDoc(doc, canBreakFn, false);
}
var noop = () => {
};
var assertDoc = true ? noop : function(doc) {
traverse_doc_default(doc, (doc2) => {
if (checked.has(doc2)) {
return false;
}
if (typeof doc2 !== "string") {
checked.add(doc2);
}
});
};
var assertDocArray = true ? noop : function(docs, optional = false) {
if (optional && !docs) {
return;
}
if (!Array.isArray(docs)) {
throw new TypeError("Unexpected doc array.");
}
for (const doc of docs) {
assertDoc(doc);
}
};
var assertDocFillParts = true ? noop : (
/**
* @param {Doc[]} parts
*/
function(parts) {
assertDocArray(parts);
if (parts.length > 1 && isEmptyDoc(at_default(
/* isOptionalObject */
false,
parts,
-1
))) {
parts = parts.slice(0, -1);
}
for (const [i2, doc] of parts.entries()) {
if (i2 % 2 === 1 && !isValidSeparator(doc)) {
const type2 = get_doc_type_default(doc);
throw new Error(
`Unexpected non-line-break doc at ${i2}. Doc type is ${type2}.`
);
}
}
}
);
function indent(contents) {
assertDoc(contents);
return { type: DOC_TYPE_INDENT, contents };
}
function align(widthOrString, contents) {
assertDoc(contents);
return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
}
function group(contents, opts = {}) {
assertDoc(contents);
assertDocArray(
opts.expandedStates,
/* optional */
true
);
return {
type: DOC_TYPE_GROUP,
id: opts.id,
contents,
break: Boolean(opts.shouldBreak),
expandedStates: opts.expandedStates
};
}
function dedentToRoot(contents) {
return align(Number.NEGATIVE_INFINITY, contents);
}
function markAsRoot(contents) {
return align({ type: "root" }, contents);
}
function dedent(contents) {
return align(-1, contents);
}
function conditionalGroup(states, opts) {
return group(states[0], { ...opts, expandedStates: states });
}
function fill(parts) {
assertDocFillParts(parts);
return { type: DOC_TYPE_FILL, parts };
}
function ifBreak(breakContents, flatContents = "", opts = {}) {
assertDoc(breakContents);
if (flatContents !== "") {
assertDoc(flatContents);
}
return {
type: DOC_TYPE_IF_BREAK,
breakContents,
flatContents,
groupId: opts.groupId
};
}
function indentIfBreak(contents, opts) {
assertDoc(contents);
return {
type: DOC_TYPE_INDENT_IF_BREAK,
contents,
groupId: opts.groupId,
negate: opts.negate
};
}
function lineSuffix(contents) {
assertDoc(contents);
return { type: DOC_TYPE_LINE_SUFFIX, contents };
}
var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
var breakParent = { type: DOC_TYPE_BREAK_PARENT };
var trim = { type: DOC_TYPE_TRIM };
var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
var literallineWithoutBreakParent = {
type: DOC_TYPE_LINE,
hard: true,
literal: true
};
var line = { type: DOC_TYPE_LINE };
var softline = { type: DOC_TYPE_LINE, soft: true };
var hardline = [hardlineWithoutBreakParent, breakParent];
var literalline = [literallineWithoutBreakParent, breakParent];
var cursor = { type: DOC_TYPE_CURSOR };
function join(separator, docs) {
assertDoc(separator);
assertDocArray(docs);
const parts = [];
for (let i2 = 0; i2 < docs.length; i2++) {
if (i2 !== 0) {
parts.push(separator);
}
parts.push(docs[i2]);
}
return parts;
}
function addAlignmentToDoc(doc, size, tabWidth) {
assertDoc(doc);
let aligned = doc;
if (size > 0) {
for (let i2 = 0; i2 < Math.floor(size / tabWidth); ++i2) {
aligned = indent(aligned);
}
aligned = align(size % tabWidth, aligned);
aligned = align(Number.NEGATIVE_INFINITY, aligned);
}
return aligned;
}
function label(label2, contents) {
assertDoc(contents);
return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
}
var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
if (isOptionalObject && (original === void 0 || original === null)) {
return;
}
if (original.replaceAll) {
return original.replaceAll(pattern, replacement);
}
if (pattern.global) {
return original.replace(pattern, replacement);
}
return original.split(pattern).join(replacement);
};
var string_replace_all_default = stringReplaceAll;
function convertEndOfLineToChars(value) {
switch (value) {
case "cr":
return "\r";
case "crlf":
return "\r\n";
default:
return "\n";
}
}
var emoji_regex_default = () => {
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\u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u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA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