import { getSSRMismatchWarning as e } from "../utils/audit-logs.js";
import { getEnv as t } from "../services/global.utils.js";
import { LogService as n } from "../services/log.service.js";
import { render as r } from "lit";
//#region src/internal/controllers/type-ssr.controller.ts
function i(e = { log: !0 }) {
	return (t) => t.addInitializer((t) => new a(t, e));
}
var a = class {
	constructor(i, a) {
		if (this.host = i, this.options = a, this.didSSR = !!this.host.shadowRoot, this.#e = !0, this.host.addController(this), this.didSSR) {
			let a = this.options, o = i.update;
			Object.defineProperty(i, "update", { value: function() {
				try {
					o.call(i);
				} catch {
					let o = i.renderRoot;
					o.innerHTML = o.innerHTML.split("<!--lit-part ")[0], r(i.render(), o, i.renderOptions), t() !== "production" && a.log && n.warn(e(i.localName));
				}
				return o;
			} });
		}
	}
	#e;
	hostUpdated() {
		this.didSSR && this.#e && (this.#e = !1, this.host.shadowRoot?.querySelectorAll("slot").forEach((e) => {
			e.dispatchEvent(new Event("slotchange", {
				bubbles: !0,
				composed: !1,
				cancelable: !1
			}));
		}), this.host._internals?.role && this.host.setAttribute("role", this.host._internals.role));
	}
};
//#endregion
export { a as TypeSSRController, i as typeSSR };

//# sourceMappingURL=type-ssr.controller.js.map