import colors from "picocolors";
import { ConfigInput, Platform, RequiredDeep } from "@hot-updater/plugin-core";
import * as p from "@clack/prompts";

//#region src/banner.d.ts
declare const link: (url: string) => string;
declare const banner: (version?: string) => string;
declare const printBanner: (version?: string) => void;
//#endregion
//#region src/ConfigBuilder.d.ts
type BuildType = "bare" | "rock" | "expo";
type ImportInfo = {
  pkg: string;
  named?: string[];
  defaultOrNamespace?: string;
  sideEffect?: boolean;
};
type ProviderConfig = {
  imports: ImportInfo[];
  configString: string;
};
interface IConfigBuilder {
  /** Sets the build type ('bare' or 'rock' or 'expo') and adds necessary build imports. */
  setBuildType(buildType: BuildType): this;
  /** Sets the storage configuration and adds its required imports. */
  setStorage(storageConfig: ProviderConfig): this;
  /** Sets the database configuration and adds its required imports. */
  setDatabase(databaseConfig: ProviderConfig): this;
  /** Sets the intermediate code block to be placed between imports and defineConfig. */
  setIntermediateCode(code: string): this;
  /** Assembles and returns the final configuration string. */
  getResult(): string;
}
declare class ConfigBuilder implements IConfigBuilder {
  private buildType;
  private storageInfo;
  private databaseInfo;
  private intermediateCode;
  private collectedImports;
  constructor();
  addImport(info: ImportInfo): this;
  private addImports;
  private generateImportStatements;
  private generateBuildConfigString;
  setBuildType(buildType: BuildType): this;
  setStorage(storageConfig: ProviderConfig): this;
  setDatabase(databaseConfig: ProviderConfig): this;
  setIntermediateCode(code: string): this;
  getResult(): string;
}
//#endregion
//#region src/copyDirToTmp.d.ts
declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
  tmpDir: string;
  removeTmpDir: () => Promise<void>;
}>;
//#endregion
//#region src/createTarBr.d.ts
declare const createTarBrTargetFiles: ({
  outfile,
  targetFiles
}: {
  targetFiles: {
    path: string;
    name: string;
  }[];
  outfile: string;
}) => Promise<string>;
declare const createTarBr: ({
  outfile,
  targetDir,
  excludeExts
}: {
  targetDir: string;
  outfile: string;
  excludeExts?: string[];
}) => Promise<string>;
//#endregion
//#region src/createTarGz.d.ts
declare const createTarGzTargetFiles: ({
  outfile,
  targetFiles
}: {
  targetFiles: {
    path: string;
    name: string;
  }[];
  outfile: string;
}) => Promise<string>;
declare const createTarGz: ({
  outfile,
  targetDir,
  excludeExts
}: {
  targetDir: string;
  outfile: string;
  excludeExts?: string[];
}) => Promise<string>;
//#endregion
//#region src/createZip.d.ts
declare const createZipTargetFiles: ({
  outfile,
  targetFiles
}: {
  targetFiles: {
    path: string;
    name: string;
  }[];
  outfile: string;
}) => Promise<string>;
declare const createZip: ({
  outfile,
  targetDir,
  excludeExts
}: {
  targetDir: string;
  outfile: string;
  excludeExts?: string[];
}) => Promise<string>;
//#endregion
//#region src/crypto.d.ts
declare const encryptJson: (jsonData: Record<string, any>, secretKey: string) => string;
declare const decryptJson: <T>(encryptedData: string, secretKey: string) => T;
//#endregion
//#region src/cwd.d.ts
declare const getCwd: () => string;
//#endregion
//#region src/getAndroidSdkPath.d.ts
declare function getAndroidSdkPath(): string;
//#endregion
//#region src/loadConfig.d.ts
type HotUpdaterConfigOptions = {
  platform: Platform;
  channel: string;
} | null;
type ConfigResponse = RequiredDeep<ConfigInput>;
declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
declare const loadConfigSync: (options: HotUpdaterConfigOptions) => ConfigResponse;
//#endregion
//#region src/log.d.ts
declare const log: {
  normal: (message: string | number | null | undefined) => void;
  success: (message: string | number | null | undefined) => void;
  info: (message: string | number | null | undefined) => void;
  error: (message: string | number | null | undefined) => void;
  warn: (message: string | number | null | undefined) => void;
  debug: (message: string | number | null | undefined) => void;
};
//#endregion
//#region src/makeEnv.d.ts
type EnvVarValue = string | {
  comment: string;
  value: string;
};
declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: string) => Promise<string>;
//#endregion
//#region src/transformEnv.d.ts
declare const transformEnv: <T extends Record<string, string>>(filename: string, env: T) => string;
//#endregion
//#region src/transformTemplate.d.ts
type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
/**
 * Replaces placeholders in the format %%key%% in a template string with values from the values object.
 * Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
 *
 * @example
 * const str = "Hello %%name%%, you are %%age%% years old."
 * const result = transformTemplate(str, { name: "John", age: "20" })
 * // Result: "Hello John, you are 20 years old."
 */
declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
//#endregion
export { BuildType, ConfigBuilder, ConfigResponse, HotUpdaterConfigOptions, IConfigBuilder, ImportInfo, ProviderConfig, banner, colors, copyDirToTmp, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, encryptJson, getAndroidSdkPath, getCwd, link, loadConfig, loadConfigSync, log, makeEnv, p, printBanner, transformEnv, transformTemplate };