"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../_virtual/_rolldown/runtime.js');
const require_primordials_array = require('../primordials/array.js');
const require_themes_themes = require('../themes/themes.js');
const require_themes_context = require('../themes/context.js');
const require_themes_resolve = require('../themes/resolve.js');
let src_external_yoctocolors_cjs = require("../external/yoctocolors-cjs");
src_external_yoctocolors_cjs = require_runtime.__toESM(src_external_yoctocolors_cjs);

//#region src/links/create.ts
/**
* @file Themed hyperlink utilities for terminal output. Provides colored
*   hyperlinks using theme configuration.
*/
/**
* Create a themed hyperlink for terminal output. The link text is colored using
* the theme's link color.
*
* Note: Most terminals support ANSI color codes but not clickable links. This
* function colors the text but does not create clickable hyperlinks. For
* clickable links, use a library like 'terminal-link' separately.
*
* @example
*   ;```ts
*   import { link } from '@socketsecurity/lib/links/create'
*
*   // Use current theme
*   console.log(link('Documentation', 'https://socket.dev'))
*
*   // Override theme
*   console.log(
*     link('API Docs', 'https://api.socket.dev', {
*       theme: 'coana',
*     }),
*   )
*
*   // Show URL as fallback
*   console.log(
*     link('GitHub', 'https://github.com', {
*       fallback: true,
*     }),
*   )
*   // Output: "GitHub (https://github.com)"
*   ```
*
* @param text - Link text to display.
* @param url - URL (included in fallback mode)
* @param options - Link configuration options.
*
* @returns Colored link text
*/
function link(text, url, options) {
	const opts = {
		__proto__: null,
		fallback: false,
		...options
	};
	const theme = typeof opts.theme === "string" ? require_themes_themes.THEMES[opts.theme] : opts.theme ?? require_themes_context.getTheme();
	const linkColor = require_themes_resolve.resolveColor(theme.colors.link, theme.colors);
	const colors = src_external_yoctocolors_cjs.default;
	let colored;
	if (typeof linkColor === "string" && linkColor !== "inherit") {
		const colorMethod = colors[linkColor];
		colored = colorMethod ? colorMethod(text) : colors.cyan(text);
	} else if (require_primordials_array.ArrayIsArray(linkColor)) colored = colors.cyan(text);
	else colored = colors.cyan(text);
	return opts.fallback ? `${colored} (${url})` : colored;
}
/**
* Create multiple themed links from an array of link specifications.
*
* @example
*   ;```ts
*   import { links } from '@socketsecurity/lib/links/create'
*
*   const formatted = links([
*     ['Documentation', 'https://socket.dev'],
*     ['API Reference', 'https://api.socket.dev'],
*     ['GitHub', 'https://github.com/SocketDev'],
*   ])
*
*   formatted.forEach(link => console.log(link))
*   ```
*
* @param links - Array of [text, url] pairs.
* @param options - Link configuration options.
*
* @returns Array of colored link texts
*/
function links(linkSpecs, options) {
	return linkSpecs.map(([text, url]) => link(text, url, options));
}

//#endregion
exports.link = link;
exports.links = links;