/**
 * Copyright IBM Corp. 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.
 */

//#region src/globals/decorators/carbon-element.ts
const legacyCustomElement = (tagName, clazz) => {
	try {
		customElements.define(tagName, clazz);
	} catch {
		console.warn(`Attempting to re-define ${tagName}`);
	}
	return clazz;
};
const standardCustomElement = (tagName, descriptor) => {
	const { kind, elements } = descriptor;
	return {
		kind,
		elements,
		finisher(clazz) {
			try {
				customElements.define(tagName, clazz);
			} catch {
				console.warn(`Attempting to re-define ${tagName}`);
			}
		}
	};
};
/**
* Class decorator factory that defines the decorated class as a custom element.
*
* ```js
* @customElement('my-element')
* class MyElement extends LitElement {
*   render() {
*     return html``;
*   }
* }
* ```
*
* @category Decorator
* @param tagName The tag name of the custom element to define.
*/
const carbonElement = (tagName) => (classOrDescriptor) => typeof classOrDescriptor === "function" ? legacyCustomElement(tagName, classOrDescriptor) : standardCustomElement(tagName, classOrDescriptor);
//#endregion
export { carbonElement };

//# sourceMappingURL=carbon-element.js.map