import * as safelinkify from 'safelinkify';
import Hexo from 'hexo';
import EventEmitter from 'events';
import through2 from 'through2';
import fs from 'fs-extra';
import * as stream from 'stream';
import * as gulp from 'gulp';
import debuglib from 'debug';
import Bluebird from 'bluebird';
import * as cryptolib from 'crypto';
import cryptolib__default from 'crypto';
import nunjucks from 'nunjucks';
import fs$1 from 'fs';

var archive_dir = "archives";
var author = "Dimas Lanjaka";
var browsersync = {
	logLevel: "warn",
	ghostMode: {
		scroll: true
	},
	instanceName: "uniqueString"
};
var categories = {
	lowercase: false,
	assign: null,
	mapper: null
};
var category_dir = "categories";
var code_dir = "downloads/code";
var date_format = "YYYY-MM-DD";
var default_category = "uncategorized";
var default_layout = "post";
var deploy = {
	type: "git",
	repo: "",
	branch: "gh-pages",
	username: "",
	email: "",
	message: "{{ now('YYYY-MM-DD HH:mm:ss') }}",
	deployDir: "D:/Repositories/static-blog-generator/packages/sbg-utility/.deploy_git",
	github: {
		submodule: [
		]
	}
};
var description = "Static Blog Generator Demo";
var exclude = null;
var external_link = {
	enable: true,
	field: "site",
	safelink: {
		enable: true,
		exclude: [
			"my-custom-domain.com",
			"**/exclude/**",
			"**/node_modules/**",
			"**/vendor/**",
			"**/tmp/**",
			"**/dist/**"
		],
		redirect: [
			"https://www.webmanajemen.com/page/safelink.html?url=",
			"https://www.webmanajemen.com/page/redirector.html?url="
		],
		type: "base64",
		password: "unique-password"
	},
	exclude: [
		"webmanajemen.com",
		"web-manajemen.blogspot.com",
		"dimaslanjaka.github.io"
	]
};
var filename_case = 0;
var future = true;
var generator = {
	cache: true,
	verbose: false
};
var highlight = {
	enable: true,
	line_number: true,
	auto_detect: false,
	tab_replace: "  ",
	wrap: false,
	hljs: false
};
var i18n_dir = ":lang";
var ignore = null;
var include = null;
var index_generator = {
	path: "",
	per_page: 10,
	order_by: "-date"
};
var keywords = null;
var language = "en";
var markdown = {
	preset: "default",
	render: {
		html: true,
		xhtmlOut: false,
		langPrefix: "language-",
		breaks: true,
		linkify: true,
		typographer: true,
		quotes: "“”‘’"
	},
	enable_rules: null,
	disable_rules: null,
	plugins: null,
	anchors: {
		level: 2,
		collisionSuffix: "",
		permalink: false,
		permalinkClass: "header-anchor",
		permalinkSide: "left",
		permalinkSymbol: "¶",
		"case": 0,
		separator: "-"
	}
};
var meta_generator = true;
var new_post_name = ":title.md";
var pagination_dir = "page";
var per_page = 10;
var permalink = ":title.html";
var permalink_defaults = null;
var post_asset_folder = false;
var post_dir = "src-posts";
var pretty_urls = {
	trailing_index: true,
	trailing_html: true
};
var prismjs = {
	enable: false
};
var public_dir = "public";
var relative_link = false;
var render_drafts = false;
var root = "/static-blog-generator/";
var sitemap = {
	path: [
		"sitemap.xml",
		"sitemap.txt"
	],
	rel: true,
	tags: true,
	categories: true
};
var skip_render = null;
var source_dir = "source";
var tag_dir = "tags";
var tags = {
	lowercase: false,
	assign: null,
	mapper: null
};
var theme = "butterfly";
var time_format = "HH:mm:ss";
var timezone = "Asia/Jakarta";
var title = "Static Blog Generator Demo";
var titlecase = false;
var updated_option = "mtime";
var url = "http://www.webmanajemen.com/static-blog-generator";
var _config = {
	archive_dir: archive_dir,
	author: author,
	browsersync: browsersync,
	categories: categories,
	category_dir: category_dir,
	code_dir: code_dir,
	date_format: date_format,
	default_category: default_category,
	default_layout: default_layout,
	deploy: deploy,
	description: description,
	exclude: exclude,
	external_link: external_link,
	filename_case: filename_case,
	future: future,
	generator: generator,
	highlight: highlight,
	i18n_dir: i18n_dir,
	ignore: ignore,
	include: include,
	index_generator: index_generator,
	keywords: keywords,
	language: language,
	markdown: markdown,
	meta_generator: meta_generator,
	new_post_name: new_post_name,
	pagination_dir: pagination_dir,
	per_page: per_page,
	permalink: permalink,
	permalink_defaults: permalink_defaults,
	post_asset_folder: post_asset_folder,
	post_dir: post_dir,
	pretty_urls: pretty_urls,
	prismjs: prismjs,
	public_dir: public_dir,
	relative_link: relative_link,
	render_drafts: render_drafts,
	root: root,
	sitemap: sitemap,
	skip_render: skip_render,
	source_dir: source_dir,
	tag_dir: tag_dir,
	tags: tags,
	theme: theme,
	time_format: time_format,
	timezone: timezone,
	title: title,
	titlecase: titlecase,
	updated_option: updated_option,
	url: url
};

declare const ___config_json_archive_dir: typeof archive_dir;
declare const ___config_json_author: typeof author;
declare const ___config_json_browsersync: typeof browsersync;
declare const ___config_json_categories: typeof categories;
declare const ___config_json_category_dir: typeof category_dir;
declare const ___config_json_code_dir: typeof code_dir;
declare const ___config_json_date_format: typeof date_format;
declare const ___config_json_default_category: typeof default_category;
declare const ___config_json_default_layout: typeof default_layout;
declare const ___config_json_deploy: typeof deploy;
declare const ___config_json_description: typeof description;
declare const ___config_json_exclude: typeof exclude;
declare const ___config_json_external_link: typeof external_link;
declare const ___config_json_filename_case: typeof filename_case;
declare const ___config_json_future: typeof future;
declare const ___config_json_generator: typeof generator;
declare const ___config_json_highlight: typeof highlight;
declare const ___config_json_i18n_dir: typeof i18n_dir;
declare const ___config_json_ignore: typeof ignore;
declare const ___config_json_include: typeof include;
declare const ___config_json_index_generator: typeof index_generator;
declare const ___config_json_keywords: typeof keywords;
declare const ___config_json_language: typeof language;
declare const ___config_json_markdown: typeof markdown;
declare const ___config_json_meta_generator: typeof meta_generator;
declare const ___config_json_new_post_name: typeof new_post_name;
declare const ___config_json_pagination_dir: typeof pagination_dir;
declare const ___config_json_per_page: typeof per_page;
declare const ___config_json_permalink: typeof permalink;
declare const ___config_json_permalink_defaults: typeof permalink_defaults;
declare const ___config_json_post_asset_folder: typeof post_asset_folder;
declare const ___config_json_post_dir: typeof post_dir;
declare const ___config_json_pretty_urls: typeof pretty_urls;
declare const ___config_json_prismjs: typeof prismjs;
declare const ___config_json_public_dir: typeof public_dir;
declare const ___config_json_relative_link: typeof relative_link;
declare const ___config_json_render_drafts: typeof render_drafts;
declare const ___config_json_root: typeof root;
declare const ___config_json_sitemap: typeof sitemap;
declare const ___config_json_skip_render: typeof skip_render;
declare const ___config_json_source_dir: typeof source_dir;
declare const ___config_json_tag_dir: typeof tag_dir;
declare const ___config_json_tags: typeof tags;
declare const ___config_json_theme: typeof theme;
declare const ___config_json_time_format: typeof time_format;
declare const ___config_json_timezone: typeof timezone;
declare const ___config_json_title: typeof title;
declare const ___config_json_titlecase: typeof titlecase;
declare const ___config_json_updated_option: typeof updated_option;
declare const ___config_json_url: typeof url;
declare namespace ___config_json {
  export { ___config_json_archive_dir as archive_dir, ___config_json_author as author, ___config_json_browsersync as browsersync, ___config_json_categories as categories, ___config_json_category_dir as category_dir, ___config_json_code_dir as code_dir, ___config_json_date_format as date_format, _config as default, ___config_json_default_category as default_category, ___config_json_default_layout as default_layout, ___config_json_deploy as deploy, ___config_json_description as description, ___config_json_exclude as exclude, ___config_json_external_link as external_link, ___config_json_filename_case as filename_case, ___config_json_future as future, ___config_json_generator as generator, ___config_json_highlight as highlight, ___config_json_i18n_dir as i18n_dir, ___config_json_ignore as ignore, ___config_json_include as include, ___config_json_index_generator as index_generator, ___config_json_keywords as keywords, ___config_json_language as language, ___config_json_markdown as markdown, ___config_json_meta_generator as meta_generator, ___config_json_new_post_name as new_post_name, ___config_json_pagination_dir as pagination_dir, ___config_json_per_page as per_page, ___config_json_permalink as permalink, ___config_json_permalink_defaults as permalink_defaults, ___config_json_post_asset_folder as post_asset_folder, ___config_json_post_dir as post_dir, ___config_json_pretty_urls as pretty_urls, ___config_json_prismjs as prismjs, ___config_json_public_dir as public_dir, ___config_json_relative_link as relative_link, ___config_json_render_drafts as render_drafts, ___config_json_root as root, ___config_json_sitemap as sitemap, ___config_json_skip_render as skip_render, ___config_json_source_dir as source_dir, ___config_json_tag_dir as tag_dir, ___config_json_tags as tags, ___config_json_theme as theme, ___config_json_time_format as time_format, ___config_json_timezone as timezone, ___config_json_title as title, ___config_json_titlecase as titlecase, ___config_json_updated_option as updated_option, ___config_json_url as url };
}

declare const mappedConfig: typeof ___config_json;
type importConfig = typeof mappedConfig;
/**
 * get default configuration
 * @returns
 */
declare function getDefaultConfig(): importConfig;
/**
 * get default _config.yml
 * @returns
 */
declare function getDefaultConfigYaml(): string;

declare const defaultConfig_d_getDefaultConfig: typeof getDefaultConfig;
declare const defaultConfig_d_getDefaultConfigYaml: typeof getDefaultConfigYaml;
type defaultConfig_d_importConfig = importConfig;
declare namespace defaultConfig_d {
  export { defaultConfig_d_getDefaultConfig as getDefaultConfig, defaultConfig_d_getDefaultConfigYaml as getDefaultConfigYaml, type defaultConfig_d_importConfig as importConfig };
}

type HexoConfig = Hexo['config'];
interface ProjConf extends HexoConfig {
    [key: string]: any;
    /**
     * Source posts
     */
    post_dir: string;
    /**
     * deployment directory (can be absolute path)
     * @example
     * \<project\>/.deploy_git
     * ```yaml
     * deploy_dir: .deploy_git
     * ```
     * at somewhere on your pc
     * ```yaml
     * deploy_dir: '/usr/home/site/my username'
     * ```
     */
    deploy_dir: string;
    /**
     * Project CWD
     */
    cwd: string;
    /**
     * Deployment options
     */
    deploy: HexoConfig['deploy'] & importConfig['deploy'] & ReturnType<typeof deployConfig> & {
        /**
         * copy to subfolder of site
         * @example
         * deployment location at \<project\>/.deploy_git/docs
         * ```yaml
         * deploy_dir: .deploy_git
         * deploy:
         *  folder: docs
         * ```
         */
        folder?: string;
    };
    external_link: HexoConfig['external_link'] & importConfig['external_link'] & boolean & {
        safelink?: safelinkify.SafelinkOptions;
    };
    /**
     * global ignore
     */
    exclude: string[];
    generator: {
        [key: string]: any;
        cache: boolean;
        verbose: boolean;
    };
    /**
     * Tags mapper
     */
    tags?: LabelMapper;
    /**
     * Categories mapper
     */
    categories?: LabelMapper;
}
interface LabelMapper {
    /**
     * turn label to lower case
     */
    lowercase: boolean;
    /**
     * add old label with new label
     */
    assign: Record<string, string> | undefined | null;
    /**
     * replace old label with new label
     */
    mapper: Record<string, string> | undefined | null;
}
/**
 * find `_config.yml`
 * @param fileYML path to file `_config.yml` or working directory
 */
declare function fetchConfig(fileYML?: string): void;
/**
 * Config setter
 * * useful for jest
 * @param obj
 */
declare function setConfig(obj: Record<string, any> | ProjConf): ProjConf;
/**
 * Config getter
 * * useful for jest
 * @returns
 */
declare function getConfig(): ProjConf;
/**
 * get deployment config
 * @returns
 */
declare function deployConfig(): {
    deployDir: string;
};
/**
 * common ignore files
 * @example
 * const config = getConfig();
 * const excludes = Array.isArray(config.exclude) ? config.exclude : [];
 * excludes.push(...commonIgnore);
 */
declare const commonIgnore: string[];
/**
 * array of config.exclude, config.ignore
 */
declare const projectIgnores: any[];

type _config_d_HexoConfig = HexoConfig;
type _config_d_LabelMapper = LabelMapper;
type _config_d_ProjConf = ProjConf;
declare const _config_d_commonIgnore: typeof commonIgnore;
declare const _config_d_deployConfig: typeof deployConfig;
declare const _config_d_fetchConfig: typeof fetchConfig;
declare const _config_d_getConfig: typeof getConfig;
declare const _config_d_projectIgnores: typeof projectIgnores;
declare const _config_d_setConfig: typeof setConfig;
declare namespace _config_d {
  export { type _config_d_HexoConfig as HexoConfig, type _config_d_LabelMapper as LabelMapper, type _config_d_ProjConf as ProjConf, _config_d_commonIgnore as commonIgnore, _config_d_deployConfig as deployConfig, _config_d_fetchConfig as fetchConfig, _config_d_getConfig as getConfig, _config_d_projectIgnores as projectIgnores, _config_d_setConfig as setConfig };
}

interface createConfigEvents {
    add: (obj: Record<string, any>) => void;
    delete: (changedCount: number) => void;
    update: () => void;
}
declare interface createConfig<T extends Record<string, any>> {
    on<U extends keyof createConfigEvents>(event: U, listener: createConfigEvents[U]): this;
    emit<U extends keyof createConfigEvents>(event: U, ...args: Parameters<createConfigEvents[U]>): boolean;
    get<U extends Record<string, any>>(): T & U;
}
/**
 * Create/Update config wrapper
 */
declare class createConfig<T extends Record<string, any>> extends EventEmitter {
    cname: string;
    /**
     * Create/Update config wrapper
     * @param name config name
     * @param value initial config value
     */
    constructor(name: string, value: Record<string, any>);
    /**
     * update config
     * @param value new values should be merged with old values using shallow object merge
     */
    update(value: Record<string, any>): void;
}

type configWrapper_d_createConfig<T extends Record<string, any>> = createConfig<T>;
declare const configWrapper_d_createConfig: typeof createConfig;
declare namespace configWrapper_d {
  export { configWrapper_d_createConfig as createConfig };
}

type index_d$2_HexoConfig = HexoConfig;
type index_d$2_LabelMapper = LabelMapper;
type index_d$2_ProjConf = ProjConf;
declare const index_d$2_commonIgnore: typeof commonIgnore;
type index_d$2_createConfig<T extends Record<string, any>> = createConfig<T>;
declare const index_d$2_createConfig: typeof createConfig;
declare const index_d$2_deployConfig: typeof deployConfig;
declare const index_d$2_fetchConfig: typeof fetchConfig;
declare const index_d$2_getConfig: typeof getConfig;
declare const index_d$2_getDefaultConfig: typeof getDefaultConfig;
declare const index_d$2_getDefaultConfigYaml: typeof getDefaultConfigYaml;
type index_d$2_importConfig = importConfig;
declare const index_d$2_projectIgnores: typeof projectIgnores;
declare const index_d$2_setConfig: typeof setConfig;
declare namespace index_d$2 {
  export { type index_d$2_HexoConfig as HexoConfig, type index_d$2_LabelMapper as LabelMapper, type index_d$2_ProjConf as ProjConf, index_d$2_commonIgnore as commonIgnore, index_d$2_createConfig as createConfig, defaultConfig_d as defaults, index_d$2_deployConfig as deployConfig, index_d$2_fetchConfig as fetchConfig, index_d$2_getConfig as getConfig, index_d$2_getDefaultConfig as getDefaultConfig, index_d$2_getDefaultConfigYaml as getDefaultConfigYaml, type index_d$2_importConfig as importConfig, _config_d as main, index_d$2_projectIgnores as projectIgnores, index_d$2_setConfig as setConfig, configWrapper_d as wrapper };
}

/**
 * convert type to be writeable
 * * https://stackoverflow.com/a/43001581
 */
type Writeable<T> = {
    -readonly [P in keyof T]: T[P];
};
/**
 * convert type to be writeable recursively
 * * https://stackoverflow.com/a/43001581
 */
type DeepWriteable<T> = {
    -readonly [P in keyof T]: DeepWriteable<T[P]>;
};
/**
 * null | undefined | type
 */
type Nullable<T> = T | null | undefined;

type globals_d_DeepWriteable<T> = DeepWriteable<T>;
type globals_d_Nullable<T> = Nullable<T>;
type globals_d_Writeable<T> = Writeable<T>;
declare namespace globals_d {
  export type { globals_d_DeepWriteable as DeepWriteable, globals_d_Nullable as Nullable, globals_d_Writeable as Writeable };
}

/**
 * pick random items from array
 * @param items
 * @returns
 */
declare function array_random<T extends any[]>(items: T): T[number];
/**
 * unique array
 * * array of string,number
 * * array of object by object key
 * @param arr
 * @param field key name (for array of object)
 * @returns
 *
 * @example
 * arrayOfObjUniq({p:'x',n:'x'},{p:'23',n:'x'},{p:'x',n:'5g'}, 'p'); // [{p:'x',n:'x'},{p:'23',n:'x'}]
 *
 * @link https://stackoverflow.com/a/67322087/6404439
 */
declare function array_unique<T extends any[]>(arr: T, field?: string): T;
/**
 * Remove empties from array
 * @param arr
 * @returns
 */
declare function array_remove_empty<T extends any[]>(arr: T): any[];
/**
 * unique array of object by object key
 * @param arr
 * @param field key name
 * @returns
 * @see {@link https://stackoverflow.com/a/67322087/6404439}
 * @example
 * const arrobj = [{p:'x',n:'x'},{p:'23',n:'x'},{p:'x',n:'5g'}],
 * arrayOfObjUniq(arrobj, 'p'); // [{p:'x',n:'x'},{p:'23',n:'x'}]
 */
declare function arrayOfObjUniq<T extends any[]>(arr: T, field: string): T;
/**
 * array shuffler
 * @param items
 * @returns
 */
declare function array_shuffle<T extends any[]>(items: T): T;
/**
 * generate random number
 * @see {@link https://stackoverflow.com/a/65638217/6404439}
 * @param n
 * @returns
 */
declare const rand: (n: number) => number;
/**
 * fast shuffle array using swap method
 * @see {@link https://stackoverflow.com/a/65638217/6404439}
 * @param t
 */
declare function array_shuffle_swap<T extends any[]>(t: T): void;
/**
 * flattern array
 * @param arr
 * @returns
 */
declare function array_flatten<T extends any[], N extends number = 1>(arr: T, depth?: N): FlatArray<T, N>[];

/**
 * Chainable function runner.
 *
 * @param schedule - An array of function objects, each containing a callback and optional `opt` properties for before and after functions.
 * @example
 * ```ts
 * chain([
 *   {
 *     callback: () => 'stream process eg: gulp',
 *     opt: {
 *       before: () => 'run before callback called',
 *       after: () => 'run after callback called'
 *     }
 *   },
 *   {
 *     callback: () => 'promise process'
 *   },
 *   {
 *     callback: () => 'synchronous function'
 *   }
 * ]);
 * ```
 */
declare function chain(schedule: {
    /**
     * Function to call inside chains.
     */
    callback: (...args: any[]) => any;
    opt?: {
        /**
         * Function to run before the callback is called.
         */
        before?: (...args: any[]) => any;
        /**
         * Function to run after the callback is called.
         */
        after?: (...args: any[]) => any;
    };
}[]): Promise<void>;

/**
 * convert hours,min,sec to milliseconds
 * @param hrs
 * @param min
 * @param sec
 * @returns
 */
declare const toMilliseconds: (hrs: number, min: number, sec: number) => number;

/**
 * Creates a debug logger with the specified name.
 *
 * @param name - The name of the debug logger. This will be used as a prefix for log messages.
 * @returns A debug logger function that can be used to log messages.
 */
declare function debug(name: string): debuglib.Debugger;
/**
 * Creates a debug logger with the default name `sbg`.
 *
 * This function allows for an optional subname to further specify the debug logger.
 *
 * @param subname - An optional suffix to append to the default logger name.
 * @returns A debug logger function with the name `sbg` or `sbg-{subname}` if provided.
 */
declare function sbgDebug(subname?: string): debuglib.Debugger;

declare const isWindows: boolean;
interface trueCasePathNewCallbackOpt {
    /** return as unix style path */
    unix?: boolean;
}
declare const trueCasePathSync: (filePath: string, basePath?: string | trueCasePathNewCallbackOpt, cbOpt?: trueCasePathNewCallbackOpt) => string;
declare const trueCasePath: (filePath: string, basePath?: string | trueCasePathNewCallbackOpt, cbOpt?: trueCasePathNewCallbackOpt) => string;

/**
 * copy file/folder recursively
 * @param src
 * @param dest
 * @param options
 * @returns
 */
declare function copyPath(src: string, dest: string, options?: fs.CopyOptions): Promise<void>;

/**
 * delete folder/file async
 * @param path path of file/folder
 * @param throws enable throwable
 * @returns
 */
declare function del(path: string, throws?: boolean): Bluebird<void | Error>;

interface emptyDirOpt {
    ignore: (string | RegExp)[];
}
/**
 * empty dir with filters
 * @param dir
 * @param param1
 */
declare function emptyDir(dir: string, { ignore }: emptyDirOpt): void;

declare function getAppRootDir(): string;

/**
 * function to encode file data to base64 encoded string
 * @param file path file
 * @returns
 */
declare function image_base64_encode(file: string): string;

declare function fixDriveLetter(filePath: string): string;
/**
 * UNIX join path with true-case-path
 * @description normalize path and make drive letter uppercase
 * @param str
 * @returns Unix Style Path
 */
declare function normalizePath(...str: string[]): string;
/**
 * UNIX join path with true-case-path
 * @description normalize path and make drive letter uppercase
 * @param str
 * @returns Unix Style Path
 */
declare function normalizePathUnix(...str: string[]): string;
/**
 * remove base path
 * @param target path to remove
 * @param toRemove cwd
 */
declare function removeCwd(target: string, toRemove: string): string;
/**
 * UNIX join path with auto create dirname when not exists
 * @param path
 * @returns
 */
declare function joinSolve(...paths: string[]): string;

interface readDirDone {
    (err: Error | undefined | null, results?: string[]): any;
}
/**
 * read directory recursive callback
 * @param dir
 * @returns
 */
declare const readDir: (dir: fs.PathLike, done: readDirDone) => void;
/**
 * read directory recursive async
 * @param dir
 * @returns
 */
declare const readDirAsync: (dir: fs.PathLike) => Bluebird<string[]>;

/**
 * create writestream (auto create dirname)
 * @param dest
 * @param options
 * @returns
 */
declare function createWriteStream(dest: string, options?: Parameters<(typeof fs)['createWriteStream']>[1]): fs.WriteStream;

interface writefileOpt extends fs.MakeDirectoryOptions {
    append?: boolean | undefined | null;
    async?: boolean | undefined | null;
}
interface writefileResult {
    file: string;
    append: boolean;
}
type strORobj = string | Record<string, any>;
/**
 * sync write to file recursively (auto create dirname)
 * @param file
 * @param content
 */
declare function writefile(file: string, content: strORobj): writefileResult;
declare function writefile(file: string, content: strORobj, opt: {
    append: boolean;
    async: undefined | null;
}): writefileResult;
/**
 * async write to file recursively (auto create dirname)
 * @param file
 * @param content
 * @param opt
 */
declare function writefile(file: string, content: strORobj, opt: {
    async: true;
}): Promise<writefileResult>;
/**
 * async write to file recursively (auto create dirname)
 * @param file
 * @param content
 * @param opt
 */
declare function writefile(file: string, content: strORobj, opt: {
    async: true;
    append: boolean | undefined | null;
}): Promise<writefileResult>;
/**
 * sync write to file recursively (auto create dirname)
 * @param file
 * @param content
 * @param opt
 */
declare function writefile(file: string, content: strORobj, opt: {
    async?: false | undefined | null;
    append?: boolean;
}): writefileResult;

/**
 * is non-markdown file
 * @param path
 * @returns
 */
declare const isAsset: (path: any) => boolean;
/**
 * is markdown file
 * @param path
 * @returns
 */
declare const isMarkdown: (path: any) => boolean;

/**
 * MD5 file synchronously
 * @param path
 */
declare function md5FileSync(path?: string): string | undefined;
/**
 * PHP MD5 Equivalent
 * @param data
 */
declare function md5(data?: string): string | undefined;
/**
 * convert file to hash
 * @param alogarithm
 * @param path
 * @param encoding
 * @returns
 */
declare function file_to_hash(alogarithm: 'sha1' | 'sha256' | 'sha384' | 'sha512' | 'md5', path: fs.PathLike, encoding?: cryptolib.BinaryToTextEncoding): Promise<string>;
/**
 * convert data to hash (async)
 * @param alogarithm
 * @param data
 * @param encoding
 * @returns
 */
declare function data_to_hash(alogarithm: ("sha1" | "sha256" | "sha384" | "sha512" | "md5") | undefined, data: cryptolib__default.BinaryLike, encoding?: cryptolib.BinaryToTextEncoding): Promise<string>;
/**
 * convert data to hash (sync)
 * @param alogarithm
 * @param data
 * @param encoding
 * @returns
 */
declare function data_to_hash_sync(alogarithm: ("sha1" | "sha256" | "sha384" | "sha512" | "md5") | undefined, data: cryptolib__default.BinaryLike, encoding?: cryptolib.BinaryToTextEncoding): string;
/**
 * get hashes from folder
 * @param alogarithm
 * @param folder
 * @param options
 * @returns
 */
declare function folder_to_hash(alogarithm: 'sha1' | 'sha256' | 'sha384' | 'sha512' | 'md5', folder: string, options: {
    /**
     * override pattern to search files
     */
    pattern: string;
    /**
     * ignore files by patterns from search
     */
    ignored: string[];
    /**
     * encoding type
     */
    encoding: cryptolib__default.BinaryToTextEncoding;
}): Promise<{
    filesWithHash: Record<string, string>;
    hash: string;
}>;
/**
 * convert data to hash
 * @param alogarithm
 * @param url
 * @param encoding
 * @returns
 */
declare function url_to_hash(alogarithm: ("sha1" | "sha256" | "sha384" | "sha512" | "md5") | undefined, url: string, encoding?: cryptolib__default.BinaryToTextEncoding): Promise<unknown>;

/**
 * check development NODE_ENV
 * @returns
 */
declare function isdev(): boolean;

/**
 * Check if current runner is JEST
 * * source: {@link https://stackoverflow.com/a/52231746}
 * @returns
 */
declare function areWeTestingWithJest(): boolean;

declare global {
    interface JSON {
        /**
         * @see {@link https://stackoverflow.com/a/61962964/6404439}
         * @example
         * console.log(JSON.stringify({a:{a:{a:{a:[{a:{hello:"world"}}]}}}}))
         */
        stringifyWithCircularRefs: (obj: any, space?: number) => string;
    }
}
/**
 * transform any object to json. Suppress `TypeError: Converting circular structure to JSON`
 * @param data
 * @returns
 */
declare function jsonStringifyWithCircularRefs(data: any): string;
/**
 * parse json stringified with circular refs
 */
declare function jsonParseWithCircularRefs<T>(data: string): T;

/**
 * Parses a JSON string with support for circular references.
 * @param text - The JSON string to parse.
 * @param reviver - Optional function to transform the parsed values.
 * @returns The parsed object.
 */
declare const parse: (text: string, reviver?: (...args: any[]) => any) => any;
/**
 * Stringifies an object into JSON with support for circular references.
 * @param value - The object to stringify.
 * @param replacer - Optional function to transform the values before stringifying.
 * @param space - Optional number or string to use as a white space in the output.
 * @returns The JSON string representation of the object.
 */
declare const stringify: (value: any, replacer?: ((this: any, key: string, value: any) => any) | string[], space?: string | number) => string;
/**
 * Converts an object with circular references to JSON.
 * @param any - The object to convert.
 * @returns The JSON representation of the object.
 */
declare const toJSON: (any: any) => any;

/**
 * Parses a circular object from JSON.
 * @param any - The JSON string to parse.
 * @returns The parsed object.
 */
declare const fromJSON: (any: string) => any;

/**
 * @example
 * const console = Logger
 * Logger.log('hello world'); // should be written in <temp folder>/logs/[trace-name].log
 */
declare class Logger {
    static log(...args: any[]): void;
    static info(...args: any[]): void;
    static error(...args: any[]): void;
    private static tracer;
}

/**
 * search yarn root workspace folder
 * @param ctx option with property `base_dir`
 */
declare function findYarnRootWorkspace(ctx: {
    base_dir: string;
}): string | null;
/**
 * Resolves the path of a command binary from `node_modules/.bin`.
 *
 * This function searches for the specified command in various directories, including
 * the current working directory, the module directory, and optionally, user-defined
 * search directories. If the command is not found, it returns the original command name.
 *
 * @param commandName - The name of the command to resolve.
 * @param options - Optional parameters for command resolution.
 * @param options.searchDir - A custom directory or an array of directories to search for
 *   the command. If provided, these directories will be included in the search.
 * @returns The resolved command path if found; otherwise, returns the original command name.
 */
declare function resolveCommand(commandName: string, options?: {
    searchDir: string | string[];
}): string;
declare const cmd: typeof resolveCommand;

/**
 * no operations
 * @param _args
 * @returns
 */
declare function noop(..._args: any[]): void;

type Func = (...args: any[]) => any & CallableFunction;
interface FN extends Func {
    then: (...args: any[]) => any;
    catch: (...args: any[]) => any;
}

declare function envNunjucks(loader?: nunjucks.ILoader | nunjucks.ILoader[] | null | undefined, opts?: nunjucks.ConfigureOptions | undefined): nunjucks.Environment;

/**
 * sort alphabetically object by key
 * @param obj
 * @returns
 */
declare function orderKeys<T extends Record<string, any>>(obj: Record<string, any>): T;
/**
 * get object property by key, supress typescript error
 * @param item
 * @param key
 * @returns
 */
declare function getObjectProperty(item: Record<string, any>, key: string): any;

interface PersistentCacheOpt {
    /**
     * folder cache
     * @description The base directory where `persistent-cache` will save its caches.
     *
     * Defaults to the main modules directory
     */
    base: string;
    /**
     * cache instance name
     * @description The name of the cache. Determines the name of the created folder where the data is stored, which is just `base + name`.
     *
     * Defaults to `cache`
     */
    name: string;
    /**
     * expired in milliseconds
     * @description The amount of milliseconds a cache entry should be valid for. If not set, cache entries are not invalidated (stay until deleted).
     *
     * Defaults to `undefined` (infinite)
     */
    duration: number;
    /**
     * Whether the cache should use memory caching or not (mirrors all cache data in the ram,
     * saving disk I/O and increasing performance).
     *
     * Defaults to `true`
     */
    memory: boolean;
    /**
     * Whether the cache should be persistent, aka if it should write its data to the disk
     * for later use or not. Set this to `false` to create a memory-only cache.
     *
     * Defaults to `true`
     */
    persist: boolean;
}
declare class persistentCache implements PersistentCacheOpt {
    base: string;
    name: string;
    duration: number;
    memory: boolean;
    persist: boolean;
    memoryCache: Record<string, any>;
    constructor(options?: Partial<PersistentCacheOpt>);
    /**
     * add cache deferred callback
     * @param key
     * @param data
     * @param cb
     * @returns
     */
    put(key: string, data: any, cb: {
        (e: Error | NodeJS.ErrnoException): any;
        (e: Error | NodeJS.ErrnoException, ...args: any[]): any;
    } | null | undefined): any;
    /**
     * add cache sync
     * @param key
     * @param data
     * @returns boolean=success, any=error
     */
    putSync(key: string, data: any): any | boolean;
    setSync: (key: string, data: any) => any | boolean;
    /**
     * add cache async
     * @param key
     * @param data
     * @returns
     */
    set(key: string, data: any): Promise<unknown>;
    /**
     * get cache by key synchronously
     * @param name
     * @param fallback
     * @returns
     */
    getSync<T>(name: string, fallback?: T): T;
    get<T>(name: string, fallback?: T): Promise<T>;
    get<T>(name: string, fallback?: (e: Error | undefined | null, entry?: T) => any): void;
    /**
     * delete cache
     * @param name cache key
     * @param cb
     */
    deleteEntry(name: string, cb: fs.NoParamCallback): void;
    /**
     * delete cache sync
     * @param name cache key
     * @returns
     */
    deleteEntrySync(name: string): void;
    getCacheDir(): string;
    /**
     * remove current cache directory
     * @param cb
     * @returns
     */
    unlink(cb: {
        (e: Error, ...args: any[]): any;
        (e: Error, ...args: any[]): any;
    }): void;
    private transformFileNameToKey;
    /**
     * get all cache keys
     * @param cb
     * @returns
     */
    keys(cb: (e: Error | null, ...args: any[]) => any): any;
    /**
     * get cache keys sync
     * @returns
     */
    keysSync(): string[];
    /**
     * get all values
     * @returns
     */
    valuesSync(): unknown[];
    buildFilePath(name: string): string;
    buildCacheEntry(data: any): {
        cacheUntil: number | undefined;
        data: any;
    };
}
type safeCbParam = null | undefined | {
    (e: Error, ...args: any[]): any;
    (...args: any[]): any;
};
/**
 * safe callback
 * @param cb
 * @returns
 */
declare function safeCb(cb: safeCbParam): (...args: any[]) => any;

/**
 * async delayed
 * @param ms milliseconds
 */
declare const delay: (ms: number) => Promise<unknown>;

/**
 * easy typescript synchronous function type
 */
type CallableFunctions = (...args: any[]) => any;
/**
 * easy typescript asynchronous function type
 */
type CallablePromiseFunctions = (...args: any[]) => Promise<any>;
/**
 * easy typescript function type
 */
type CallableMixFunctions = CallableFunctions | CallablePromiseFunctions;
/**
 * make any function or value to be promise
 * @param func
 * @param options
 * @returns
 */
declare const promisify: typeof Bluebird.promisify;

/** SCHEDULER JOB **/
/*** Postpone executing functions ***/
/**
 * Bind functions to exit handler
 * @param key
 * @param fn
 */
declare function bindProcessExit(key: string, fn: (...args: any[]) => any): void;
/**
 * @example
 * ```js
 * bindProcessExit("scheduler_on_exit", function () {
 *    _log.info("executing scheduled functions");
 *    scheduler.executeAll();
 * });
 * ```
 * or
 * ```js
 * scheduler.register();
 * ```
 */
declare class scheduler {
    static verbose: boolean;
    constructor();
    private static registered;
    /**
     * Register scheduler to process system
     */
    static register(): void;
    /**
     * Add function with key to list
     * @param key existing key (duplicate) will be overwritten
     * @param value
     */
    static add(key: string, value: () => any): void;
    private static postponeCounter;
    /**
     * Add function to postpone, the functions will be executed every 5 items added
     */
    static postpone(key: string, value: () => any): void;
    /**
     * Execute functon in key and delete
     * @param key
     */
    static execute(key: string, deleteAfter?: boolean): void;
    /**
     * Execute all function lists
     */
    static executeAll(): Promise<void>;
}

/**
 * parse version string
 */
declare class semver {
    result: {
        [s: string]: any;
    } | ArrayLike<any>;
    /**
     * @param opt
     * @returns
     */
    constructor(opt: string | {
        version: string;
    });
    toString(): string;
}
/**
 * increment version range
 * @param opt
 * @param by
 */
declare function semverIncrement(opt: {
    version: string;
} | string, by: string | number): semver;

declare function createDuplexStream(): fs$1.WriteStream;

/**
 * escape regex string
 * @param string
 * @returns
 */
declare function escapeRegex(string: string, method?: '1' | '2'): string | undefined;
/**
 * capitalize string first letter of each word which mixed with symbols
 * @param str
 * @param moreSymbols add more symbols, default []
 * @returns
 */
declare function capitalize(str: string, moreSymbols?: ConcatArray<string>): string;
declare const capitalizer: typeof capitalize;
/**
 * Stream to string
 * @param stream
 * @returns
 */
declare function streamToString(stream: NodeJS.ReadableStream): Promise<unknown>;
/**
 * Buffer to string
 * @param array
 * @returns
 */
declare function bufferToString(array: Buffer): string;
/**
 * Replace path unix-style
 * @param source
 * @param toReplace
 * @param replacement
 * @returns
 */
declare function replacePath(source: string, toReplace: string, replacement?: string): Promise<string>;
/**
 * slugify string
 * @param str
 * @param ext
 * @returns
 */
declare function slugify(str: string, ext?: string): string;
/**
 * check variable is valid http(s) url string
 * @param string string url to validate
 * @returns
 */
declare function isValidHttpUrl(string: string | URL): boolean;

/**
 * generate random id
 * @param n
 * @param prefix
 * @returns
 */
declare const makeid: (n?: number, prefix?: string) => string;

type lib_CallableFunctions = CallableFunctions;
type lib_CallableMixFunctions = CallableMixFunctions;
type lib_CallablePromiseFunctions = CallablePromiseFunctions;
type lib_FN = FN;
type lib_Func = Func;
type lib_Logger = Logger;
declare const lib_Logger: typeof Logger;
type lib_PersistentCacheOpt = PersistentCacheOpt;
declare const lib_areWeTestingWithJest: typeof areWeTestingWithJest;
declare const lib_arrayOfObjUniq: typeof arrayOfObjUniq;
declare const lib_array_flatten: typeof array_flatten;
declare const lib_array_random: typeof array_random;
declare const lib_array_remove_empty: typeof array_remove_empty;
declare const lib_array_shuffle: typeof array_shuffle;
declare const lib_array_shuffle_swap: typeof array_shuffle_swap;
declare const lib_array_unique: typeof array_unique;
declare const lib_bindProcessExit: typeof bindProcessExit;
declare const lib_bufferToString: typeof bufferToString;
declare const lib_capitalize: typeof capitalize;
declare const lib_capitalizer: typeof capitalizer;
declare const lib_chain: typeof chain;
declare const lib_cmd: typeof cmd;
declare const lib_copyPath: typeof copyPath;
declare const lib_createDuplexStream: typeof createDuplexStream;
declare const lib_createWriteStream: typeof createWriteStream;
declare const lib_data_to_hash: typeof data_to_hash;
declare const lib_data_to_hash_sync: typeof data_to_hash_sync;
declare const lib_debug: typeof debug;
declare const lib_del: typeof del;
declare const lib_delay: typeof delay;
declare const lib_emptyDir: typeof emptyDir;
declare const lib_envNunjucks: typeof envNunjucks;
declare const lib_escapeRegex: typeof escapeRegex;
declare const lib_file_to_hash: typeof file_to_hash;
declare const lib_findYarnRootWorkspace: typeof findYarnRootWorkspace;
declare const lib_fixDriveLetter: typeof fixDriveLetter;
declare const lib_folder_to_hash: typeof folder_to_hash;
declare const lib_fromJSON: typeof fromJSON;
declare const lib_getAppRootDir: typeof getAppRootDir;
declare const lib_getObjectProperty: typeof getObjectProperty;
declare const lib_image_base64_encode: typeof image_base64_encode;
declare const lib_isAsset: typeof isAsset;
declare const lib_isMarkdown: typeof isMarkdown;
declare const lib_isValidHttpUrl: typeof isValidHttpUrl;
declare const lib_isWindows: typeof isWindows;
declare const lib_isdev: typeof isdev;
declare const lib_joinSolve: typeof joinSolve;
declare const lib_jsonParseWithCircularRefs: typeof jsonParseWithCircularRefs;
declare const lib_jsonStringifyWithCircularRefs: typeof jsonStringifyWithCircularRefs;
declare const lib_makeid: typeof makeid;
declare const lib_md5: typeof md5;
declare const lib_md5FileSync: typeof md5FileSync;
declare const lib_noop: typeof noop;
declare const lib_normalizePath: typeof normalizePath;
declare const lib_normalizePathUnix: typeof normalizePathUnix;
declare const lib_orderKeys: typeof orderKeys;
declare const lib_parse: typeof parse;
type lib_persistentCache = persistentCache;
declare const lib_persistentCache: typeof persistentCache;
declare const lib_promisify: typeof promisify;
declare const lib_rand: typeof rand;
declare const lib_readDir: typeof readDir;
declare const lib_readDirAsync: typeof readDirAsync;
type lib_readDirDone = readDirDone;
declare const lib_removeCwd: typeof removeCwd;
declare const lib_replacePath: typeof replacePath;
declare const lib_resolveCommand: typeof resolveCommand;
declare const lib_safeCb: typeof safeCb;
declare const lib_sbgDebug: typeof sbgDebug;
type lib_scheduler = scheduler;
declare const lib_scheduler: typeof scheduler;
type lib_semver = semver;
declare const lib_semver: typeof semver;
declare const lib_semverIncrement: typeof semverIncrement;
declare const lib_slugify: typeof slugify;
type lib_strORobj = strORobj;
declare const lib_streamToString: typeof streamToString;
declare const lib_stringify: typeof stringify;
declare const lib_toJSON: typeof toJSON;
declare const lib_toMilliseconds: typeof toMilliseconds;
declare const lib_trueCasePath: typeof trueCasePath;
declare const lib_trueCasePathSync: typeof trueCasePathSync;
declare const lib_url_to_hash: typeof url_to_hash;
declare const lib_writefile: typeof writefile;
type lib_writefileOpt = writefileOpt;
type lib_writefileResult = writefileResult;
declare namespace lib {
  export { type lib_CallableFunctions as CallableFunctions, type lib_CallableMixFunctions as CallableMixFunctions, type lib_CallablePromiseFunctions as CallablePromiseFunctions, type lib_FN as FN, type lib_Func as Func, lib_Logger as Logger, type lib_PersistentCacheOpt as PersistentCacheOpt, lib_areWeTestingWithJest as areWeTestingWithJest, lib_arrayOfObjUniq as arrayOfObjUniq, lib_array_flatten as array_flatten, lib_array_random as array_random, lib_array_remove_empty as array_remove_empty, lib_array_shuffle as array_shuffle, lib_array_shuffle_swap as array_shuffle_swap, lib_array_unique as array_unique, lib_bindProcessExit as bindProcessExit, lib_bufferToString as bufferToString, lib_capitalize as capitalize, lib_capitalizer as capitalizer, lib_chain as chain, lib_cmd as cmd, lib_copyPath as copyPath, lib_createDuplexStream as createDuplexStream, lib_createWriteStream as createWriteStream, lib_data_to_hash as data_to_hash, lib_data_to_hash_sync as data_to_hash_sync, lib_debug as debug, lib_del as del, lib_delay as delay, lib_emptyDir as emptyDir, lib_envNunjucks as envNunjucks, lib_escapeRegex as escapeRegex, lib_file_to_hash as file_to_hash, lib_findYarnRootWorkspace as findYarnRootWorkspace, lib_fixDriveLetter as fixDriveLetter, lib_folder_to_hash as folder_to_hash, lib_fromJSON as fromJSON, lib_getAppRootDir as getAppRootDir, lib_getObjectProperty as getObjectProperty, lib_image_base64_encode as image_base64_encode, lib_isAsset as isAsset, lib_isMarkdown as isMarkdown, lib_isValidHttpUrl as isValidHttpUrl, lib_isWindows as isWindows, lib_isdev as isdev, normalizePath as joinPath, lib_joinSolve as joinSolve, lib_jsonParseWithCircularRefs as jsonParseWithCircularRefs, lib_jsonStringifyWithCircularRefs as jsonStringifyWithCircularRefs, lib_makeid as makeid, lib_md5 as md5, lib_md5FileSync as md5FileSync, lib_noop as noop, lib_normalizePath as normalizePath, lib_normalizePathUnix as normalizePathUnix, lib_orderKeys as orderKeys, lib_parse as parse, normalizePath as pathJoin, lib_persistentCache as persistentCache, lib_promisify as promisify, lib_rand as rand, lib_readDir as readDir, lib_readDirAsync as readDirAsync, type lib_readDirDone as readDirDone, lib_removeCwd as removeCwd, lib_replacePath as replacePath, lib_resolveCommand as resolveCommand, lib_safeCb as safeCb, lib_sbgDebug as sbgDebug, lib_scheduler as scheduler, lib_semver as semver, lib_semverIncrement as semverIncrement, lib_slugify as slugify, type lib_strORobj as strORobj, lib_streamToString as streamToString, lib_stringify as stringify, lib_toJSON as toJSON, lib_toMilliseconds as toMilliseconds, lib_trueCasePath as trueCasePath, lib_trueCasePathSync as trueCasePathSync, lib_url_to_hash as url_to_hash, lib_writefile as writefile, type lib_writefileOpt as writefileOpt, type lib_writefileResult as writefileResult };
}

type index_d$1_CallableFunctions = CallableFunctions;
type index_d$1_CallableMixFunctions = CallableMixFunctions;
type index_d$1_CallablePromiseFunctions = CallablePromiseFunctions;
type index_d$1_FN = FN;
type index_d$1_Func = Func;
type index_d$1_Logger = Logger;
declare const index_d$1_Logger: typeof Logger;
type index_d$1_PersistentCacheOpt = PersistentCacheOpt;
declare const index_d$1_areWeTestingWithJest: typeof areWeTestingWithJest;
declare const index_d$1_arrayOfObjUniq: typeof arrayOfObjUniq;
declare const index_d$1_array_flatten: typeof array_flatten;
declare const index_d$1_array_random: typeof array_random;
declare const index_d$1_array_remove_empty: typeof array_remove_empty;
declare const index_d$1_array_shuffle: typeof array_shuffle;
declare const index_d$1_array_shuffle_swap: typeof array_shuffle_swap;
declare const index_d$1_array_unique: typeof array_unique;
declare const index_d$1_bindProcessExit: typeof bindProcessExit;
declare const index_d$1_bufferToString: typeof bufferToString;
declare const index_d$1_capitalize: typeof capitalize;
declare const index_d$1_capitalizer: typeof capitalizer;
declare const index_d$1_chain: typeof chain;
declare const index_d$1_cmd: typeof cmd;
declare const index_d$1_copyPath: typeof copyPath;
declare const index_d$1_createDuplexStream: typeof createDuplexStream;
declare const index_d$1_createWriteStream: typeof createWriteStream;
declare const index_d$1_data_to_hash: typeof data_to_hash;
declare const index_d$1_data_to_hash_sync: typeof data_to_hash_sync;
declare const index_d$1_debug: typeof debug;
declare const index_d$1_del: typeof del;
declare const index_d$1_delay: typeof delay;
declare const index_d$1_emptyDir: typeof emptyDir;
declare const index_d$1_envNunjucks: typeof envNunjucks;
declare const index_d$1_escapeRegex: typeof escapeRegex;
declare const index_d$1_file_to_hash: typeof file_to_hash;
declare const index_d$1_findYarnRootWorkspace: typeof findYarnRootWorkspace;
declare const index_d$1_fixDriveLetter: typeof fixDriveLetter;
declare const index_d$1_folder_to_hash: typeof folder_to_hash;
declare const index_d$1_fromJSON: typeof fromJSON;
declare const index_d$1_getAppRootDir: typeof getAppRootDir;
declare const index_d$1_getObjectProperty: typeof getObjectProperty;
declare const index_d$1_image_base64_encode: typeof image_base64_encode;
declare const index_d$1_isAsset: typeof isAsset;
declare const index_d$1_isMarkdown: typeof isMarkdown;
declare const index_d$1_isValidHttpUrl: typeof isValidHttpUrl;
declare const index_d$1_isWindows: typeof isWindows;
declare const index_d$1_isdev: typeof isdev;
declare const index_d$1_joinSolve: typeof joinSolve;
declare const index_d$1_jsonParseWithCircularRefs: typeof jsonParseWithCircularRefs;
declare const index_d$1_jsonStringifyWithCircularRefs: typeof jsonStringifyWithCircularRefs;
declare const index_d$1_makeid: typeof makeid;
declare const index_d$1_md5: typeof md5;
declare const index_d$1_md5FileSync: typeof md5FileSync;
declare const index_d$1_noop: typeof noop;
declare const index_d$1_normalizePath: typeof normalizePath;
declare const index_d$1_normalizePathUnix: typeof normalizePathUnix;
declare const index_d$1_orderKeys: typeof orderKeys;
declare const index_d$1_parse: typeof parse;
type index_d$1_persistentCache = persistentCache;
declare const index_d$1_persistentCache: typeof persistentCache;
declare const index_d$1_promisify: typeof promisify;
declare const index_d$1_rand: typeof rand;
declare const index_d$1_readDir: typeof readDir;
declare const index_d$1_readDirAsync: typeof readDirAsync;
type index_d$1_readDirDone = readDirDone;
declare const index_d$1_removeCwd: typeof removeCwd;
declare const index_d$1_replacePath: typeof replacePath;
declare const index_d$1_resolveCommand: typeof resolveCommand;
declare const index_d$1_safeCb: typeof safeCb;
declare const index_d$1_sbgDebug: typeof sbgDebug;
type index_d$1_scheduler = scheduler;
declare const index_d$1_scheduler: typeof scheduler;
type index_d$1_semver = semver;
declare const index_d$1_semver: typeof semver;
declare const index_d$1_semverIncrement: typeof semverIncrement;
declare const index_d$1_slugify: typeof slugify;
type index_d$1_strORobj = strORobj;
declare const index_d$1_streamToString: typeof streamToString;
declare const index_d$1_stringify: typeof stringify;
declare const index_d$1_toJSON: typeof toJSON;
declare const index_d$1_toMilliseconds: typeof toMilliseconds;
declare const index_d$1_trueCasePath: typeof trueCasePath;
declare const index_d$1_trueCasePathSync: typeof trueCasePathSync;
declare const index_d$1_url_to_hash: typeof url_to_hash;
declare const index_d$1_writefile: typeof writefile;
type index_d$1_writefileOpt = writefileOpt;
type index_d$1_writefileResult = writefileResult;
declare namespace index_d$1 {
  export { type index_d$1_CallableFunctions as CallableFunctions, type index_d$1_CallableMixFunctions as CallableMixFunctions, type index_d$1_CallablePromiseFunctions as CallablePromiseFunctions, type index_d$1_FN as FN, type index_d$1_Func as Func, index_d$1_Logger as Logger, type index_d$1_PersistentCacheOpt as PersistentCacheOpt, index_d$1_areWeTestingWithJest as areWeTestingWithJest, index_d$1_arrayOfObjUniq as arrayOfObjUniq, index_d$1_array_flatten as array_flatten, index_d$1_array_random as array_random, index_d$1_array_remove_empty as array_remove_empty, index_d$1_array_shuffle as array_shuffle, index_d$1_array_shuffle_swap as array_shuffle_swap, index_d$1_array_unique as array_unique, index_d$1_bindProcessExit as bindProcessExit, index_d$1_bufferToString as bufferToString, index_d$1_capitalize as capitalize, index_d$1_capitalizer as capitalizer, index_d$1_chain as chain, index_d$1_cmd as cmd, index_d$1_copyPath as copyPath, index_d$1_createDuplexStream as createDuplexStream, index_d$1_createWriteStream as createWriteStream, index_d$1_data_to_hash as data_to_hash, index_d$1_data_to_hash_sync as data_to_hash_sync, index_d$1_debug as debug, lib as default, index_d$1_del as del, index_d$1_delay as delay, index_d$1_emptyDir as emptyDir, index_d$1_envNunjucks as envNunjucks, index_d$1_escapeRegex as escapeRegex, index_d$1_file_to_hash as file_to_hash, index_d$1_findYarnRootWorkspace as findYarnRootWorkspace, index_d$1_fixDriveLetter as fixDriveLetter, index_d$1_folder_to_hash as folder_to_hash, index_d$1_fromJSON as fromJSON, index_d$1_getAppRootDir as getAppRootDir, index_d$1_getObjectProperty as getObjectProperty, index_d$1_image_base64_encode as image_base64_encode, index_d$1_isAsset as isAsset, index_d$1_isMarkdown as isMarkdown, index_d$1_isValidHttpUrl as isValidHttpUrl, index_d$1_isWindows as isWindows, index_d$1_isdev as isdev, normalizePath as joinPath, index_d$1_joinSolve as joinSolve, index_d$1_jsonParseWithCircularRefs as jsonParseWithCircularRefs, index_d$1_jsonStringifyWithCircularRefs as jsonStringifyWithCircularRefs, index_d$1_makeid as makeid, index_d$1_md5 as md5, index_d$1_md5FileSync as md5FileSync, index_d$1_noop as noop, index_d$1_normalizePath as normalizePath, index_d$1_normalizePathUnix as normalizePathUnix, index_d$1_orderKeys as orderKeys, index_d$1_parse as parse, normalizePath as pathJoin, index_d$1_persistentCache as persistentCache, index_d$1_promisify as promisify, index_d$1_rand as rand, index_d$1_readDir as readDir, index_d$1_readDirAsync as readDirAsync, type index_d$1_readDirDone as readDirDone, index_d$1_removeCwd as removeCwd, index_d$1_replacePath as replacePath, index_d$1_resolveCommand as resolveCommand, index_d$1_safeCb as safeCb, index_d$1_sbgDebug as sbgDebug, index_d$1_scheduler as scheduler, index_d$1_semver as semver, index_d$1_semverIncrement as semverIncrement, index_d$1_slugify as slugify, type index_d$1_strORobj as strORobj, index_d$1_streamToString as streamToString, index_d$1_stringify as stringify, index_d$1_toJSON as toJSON, index_d$1_toMilliseconds as toMilliseconds, index_d$1_trueCasePath as trueCasePath, index_d$1_trueCasePathSync as trueCasePathSync, index_d$1_url_to_hash as url_to_hash, index_d$1_writefile as writefile, type index_d$1_writefileOpt as writefileOpt, type index_d$1_writefileResult as writefileResult };
}

/**
 * calculate sha1sum of file
 * @param file
 * @returns
 */
declare function getShaFile(file: string): string | null;
type gulpCachedOpt = Partial<PersistentCacheOpt> & {
    prefix?: string;
    /**
     * dest folder
     * * required cwd option
     * * ~cannot match different extension
     */
    dest?: string;
    /**
     * cwd source
     * * required dest option
     * * ~cannot match different extension
     */
    cwd?: string;
    /**
     * verbose
     */
    verbose?: boolean;
    /**
     * delete after process.exit
     */
    deleteOnExit?: boolean;
};
declare function gulpCached(options: gulpCachedOpt & {
    dest?: string;
    cwd?: string;
}): ReturnType<typeof through2.obj>;

declare const customPath: {
    join: (...str: string[]) => string;
    dirname: (str: string) => string;
    toUnix: (str: string) => string;
};
declare const gulpDomPath: {
    join: (...str: string[]) => string;
    dirname: (str: string) => string;
    toUnix: (str: string) => string;
};
/**
 * Callback/Mutator
 * * this: jsdom
 * * path: current file.path
 */
type GulpDomCallback = (/** jsdom bind */ this: Document, /** current file path */ path: string) => any;
/**
 * gulp-dom
 * @param mutator callback
 * @returns
 * @example
 * const gulp = require('gulp');
    gulp.task('html', function() {
        return gulp.src('./src/index.html')
            .pipe(gulpDom(function(){
                return this.querySelectorAll('body')[0].setAttribute('data-version', '1.0');
            }))
            .pipe(gulp.dest('./public/'));
    });
 */
declare function gulpDom(mutator: GulpDomCallback): stream.Transform;

/**
 * customized gulp options
 */
type gulpOpt = Parameters<(typeof gulp)['src']>[1] & {
    cwd?: string;
    ignore?: string[];
};

declare function gulpDebug(filename?: string): stream.Transform;
/**
 * log all files
 * @returns
 */
declare function gulpLog(logname?: string): stream.Transform;

type index_d_GulpDomCallback = GulpDomCallback;
declare const index_d_customPath: typeof customPath;
declare const index_d_getShaFile: typeof getShaFile;
declare const index_d_gulpCached: typeof gulpCached;
type index_d_gulpCachedOpt = gulpCachedOpt;
declare const index_d_gulpDebug: typeof gulpDebug;
declare const index_d_gulpDom: typeof gulpDom;
declare const index_d_gulpDomPath: typeof gulpDomPath;
declare const index_d_gulpLog: typeof gulpLog;
type index_d_gulpOpt = gulpOpt;
declare namespace index_d {
  export { type index_d_GulpDomCallback as GulpDomCallback, index_d_customPath as customPath, index_d_getShaFile as getShaFile, index_d_gulpCached as gulpCached, type index_d_gulpCachedOpt as gulpCachedOpt, index_d_gulpDebug as gulpDebug, index_d_gulpDom as gulpDom, index_d_gulpDomPath as gulpDomPath, index_d_gulpLog as gulpLog, type index_d_gulpOpt as gulpOpt };
}

type cb = (arg0: Error | null, arg1?: string[]) => void;
interface Opt {
    isProgress?: boolean;
    isLog?: boolean;
    /**
     * keep query url ?key=value
     */
    keepQuery?: boolean;
    /**
     * Crawl internal links [n] times
     * * **WARNING** dont put `Infinite`
     * * only works with async
     */
    deep?: number | null;
}
declare class SiteMapCrawlerCore {
    static start(links: string[], core_opt: Opt, isCounting: boolean, callback: cb): void;
    static filterLink(parent: string, href: string): string | null;
}
declare const sitemapCrawler: (link: string | string[], opts?: Opt, callback?: cb) => void;
/**
 * Sitemap Crawler Asynchronous
 * @param link
 * @param opts
 * @returns
 */
declare function sitemapCrawlerAsync(link: string | string[], opts?: Opt): Bluebird<Record<string, string[]>>;

export { type CallableFunctions, type CallableMixFunctions, type CallablePromiseFunctions, type FN, type Func, type GulpDomCallback, type HexoConfig, type LabelMapper, Logger, type Opt, type PersistentCacheOpt, type ProjConf, SiteMapCrawlerCore as SiteMapCrawler, SiteMapCrawlerCore, areWeTestingWithJest, arrayOfObjUniq, array_flatten, array_random, array_remove_empty, array_shuffle, array_shuffle_swap, array_unique, bindProcessExit, bufferToString, capitalize, capitalizer, chain, cmd, commonIgnore, index_d$2 as config, copyPath, createConfig, createDuplexStream, createWriteStream, customPath, data_to_hash, data_to_hash_sync, debug, defaultConfig_d as defaults, del, delay, deployConfig, emptyDir, envNunjucks, escapeRegex, fetchConfig, file_to_hash, findYarnRootWorkspace, fixDriveLetter, folder_to_hash, fromJSON, getAppRootDir, getConfig, getDefaultConfig, getDefaultConfigYaml, getObjectProperty, getShaFile, globals_d as globals, gulpCached, type gulpCachedOpt, gulpDebug, gulpDom, gulpDomPath, gulpLog, type gulpOpt, index_d as gutils, image_base64_encode, type importConfig, isAsset, isMarkdown, isValidHttpUrl, isWindows, isdev, normalizePath as joinPath, joinSolve, jsonParseWithCircularRefs, jsonStringifyWithCircularRefs, _config_d as main, makeid, md5, md5FileSync, noop, normalizePath, normalizePathUnix, orderKeys, parse, normalizePath as pathJoin, persistentCache, projectIgnores, promisify, rand, readDir, readDirAsync, type readDirDone, removeCwd, replacePath, resolveCommand, safeCb, sbgDebug, scheduler, semver, semverIncrement, setConfig, sitemapCrawler, sitemapCrawlerAsync, slugify, type strORobj, streamToString, stringify, toJSON, toMilliseconds, trueCasePath, trueCasePathSync, url_to_hash, index_d$1 as utils, configWrapper_d as wrapper, writefile, type writefileOpt, type writefileResult };
