/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

import package_settings_default from "./global/js/package-settings.js";
import { Canary } from "./components/_Canary/Canary.js";
import pconsole_default from "./global/js/utils/pconsole.js";
import React from "react";
import { themes } from "@carbon/themes";

//#region src/settings.js
/**
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const carbon = {
	get themes() {
		return themes;
	},
	prefix: "cds"
};
const componentDeprecatedWarning = (name, details) => `Carbon for IBM Products (WARNING): Component "${name}" is deprecated. ${details}`;
package_settings_default.logDeprecated = (component, name) => {
	if (component?.deprecated) {
		const { level, details } = component.deprecated;
		(pconsole_default?.[level] ?? pconsole_default.error)(componentDeprecatedWarning(name || component.displayName, details));
	}
};
package_settings_default.checkComponentEnabled = (component, name) => {
	if (component.render) {
		const forward = React.forwardRef((props, ref) => {
			package_settings_default.logDeprecated(component, name);
			return (forward.render = package_settings_default.isComponentEnabled(name) || !package_settings_default.isComponentPublic(name) ? component.render : Canary.bind(void 0, { componentName: name }))(props, ref);
		});
		return Object.assign({}, component, { displayName: component.displayName }, forward);
	} else {
		let render = (props) => {
			package_settings_default.logDeprecated(component, name);
			return (render = package_settings_default.isComponentEnabled(name) || !package_settings_default.isComponentPublic(name) ? component : Canary.bind(void 0, { componentName: name }))(props);
		};
		return Object.assign((props) => render(props), component, { displayName: component.displayName });
	}
};
const pkg = package_settings_default;

//#endregion
export { carbon, pkg };