const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
const require_join_paths = require('../node_modules/.pnpm/@stryke_path@0.26.4/node_modules/@stryke/path/dist/join-paths.cjs');
const require_helpers_docs_helper = require('../helpers/docs-helper.cjs');
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
let __alloy_js_core = require("@alloy-js/core");
let __alloy_js_markdown = require("@alloy-js/markdown");
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
let __powerlines_plugin_alloy_markdown_components_markdown_file = require("@powerlines/plugin-alloy/markdown/components/markdown-file");
let __powerlines_plugin_alloy_markdown_components_markdown_table = require("@powerlines/plugin-alloy/markdown/components/markdown-table");

//#region src/components/docs.tsx
/**
* Generates the environment configuration markdown documentation for the Powerlines project.
*/
function EnvDocsFile(props) {
	const { levelOffset = 0, reflection, ...rest } = props;
	const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
	return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_markdown_components_markdown_file.MarkdownFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({ get path() {
		return require_join_paths.joinPaths(require_helpers_docs_helper.getDocsOutputPath(context), "env.md");
	} }, rest, { get children() {
		return [
			(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Heading, {
				level: 1 + levelOffset,
				children: "Environment Configuration"
			}),
			__alloy_js_core.code`Below is a list of environment variables used by the`,
			(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
				get when() {
					return !!context.packageJson.name;
				},
				get children() {
					return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Link, {
						get href() {
							return `https://www.npmjs.com/package/${context.packageJson.name}`;
						},
						get title() {
							return context.packageJson.name;
						}
					});
				}
			}),
			__alloy_js_core.code`package. These values can be updated in the \`.env\` file in the root of the project.`,
			(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
			(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Heading, {
				level: 2 + levelOffset,
				children: "Environment Variables"
			}),
			__alloy_js_core.code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,
			(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
			(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_markdown_components_markdown_table.MarkdownTable, { get data() {
				return reflection?.getProperties().filter((property) => property.getNameAsString() !== "__STORM_INJECTED__").sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
					return {
						name: reflectionProperty.getNameAsString().trim(),
						description: (reflectionProperty.getDescription() ?? "").trim(),
						type: (0, __powerlines_deepkit_vendor_type.stringifyType)(reflectionProperty.getType()).trim().replaceAll(" | ", ", or "),
						defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
						required: reflectionProperty.isValueRequired() ? "" : "✔"
					};
				}) ?? [];
			} })
		];
	} }));
}

//#endregion
exports.EnvDocsFile = EnvDocsFile;