import { getDuplicatePackageGlobalVersionWarning as e } from "../utils/audit-logs.js";
import { deepMerge as t } from "../utils/objects.js";
import { getEnv as n, getHostDetails as r } from "./global.utils.js";
//#region src/internal/services/global.service.ts
function i() {
	return globalThis.CustomElementRegistry && "initialize" in CustomElementRegistry.prototype ? new CustomElementRegistry() : globalThis.customElements;
}
var a = class {
	constructor() {
		globalThis.NVE_ELEMENTS ??= {
			debug: (e = console.log) => e(`%cElements\n%c${JSON.stringify(globalThis.NVE_ELEMENTS.state, null, 2)}`, "color: #69b027", "color: inherit"),
			state: {
				bundle: !1,
				env: n(),
				...r(),
				versions: [],
				scopedRegistry: {},
				elementRegistry: {},
				i18nRegistry: {},
				audit: {}
			}
		}, globalThis.NVE_ELEMENTS.state.versions = Array.from(new Set([...globalThis.NVE_ELEMENTS.state.versions, "2.0.2"])), globalThis.NVE_ELEMENTS.state.scopedRegistry ??= {}, globalThis.NVE_ELEMENTS.state.scopedRegistry["2.0.2"] = i(), globalThis.NVE_ELEMENTS.state.versions.length > 1 && globalThis.NVE_ELEMENTS.state.env !== "production" && console.warn(e(), `\n\n${JSON.stringify(globalThis.NVE_ELEMENTS.state.versions, null, 2)}`);
	}
	get state() {
		return globalThis.NVE_ELEMENTS.state;
	}
	dispatch(e, n) {
		globalThis.NVE_ELEMENTS.state = t(globalThis.NVE_ELEMENTS.state, n), globalThis?.document?.dispatchEvent(new CustomEvent(e, { detail: globalThis.NVE_ELEMENTS.state }));
	}
}, o = new a();
//#endregion
export { a as GlobalState, o as GlobalStateService };

//# sourceMappingURL=global.service.js.map