import { mergeUrls } from "@scalar/helpers/url/merge-urls";
import { replaceVariables } from "@scalar/helpers/regex/replace-variables";
//#region src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.ts
/**
* Processes a server URL by replacing variables with their default values and merging with the path
*/
var processServerUrl = (server, path) => {
	if (!server?.url) return path;
	const serverUrl = server.url;
	if (server.variables) return mergeUrls(replaceVariables(serverUrl, Object.entries(server.variables).reduce((defaults, [variableName, variableConfig]) => {
		if (variableConfig.default !== void 0) defaults[variableName] = variableConfig.default;
		return defaults;
	}, {})), path);
	return mergeUrls(serverUrl, path);
};
//#endregion
export { processServerUrl };

//# sourceMappingURL=process-server-url.js.map