import { h as d, s as v, ay as i, z as b, a as E, aa as p, bE as w, a9 as M, aG as A, aI as T, aP as C, aJ as N, ax as g, bF as H, bG as O } from "./index-BxjwuJ6T.js";
import { w as _ } from "./AssetItem-CFsdMEwW.js";
function P(h, m, u = !1, f = !1, t = !1, R = !1) {
  var n = h, e = "";
  if (u) {
    var l = (
      /** @type {Element} */
      h
    );
    d && (n = v(i(l)));
  }
  b(() => {
    var r = (
      /** @type {Effect} */
      p
    );
    if (e === (e = m() ?? "")) {
      d && E();
      return;
    }
    if (u && !d) {
      r.nodes = null, l.innerHTML = /** @type {string} */
      e, e !== "" && _(
        /** @type {TemplateNode} */
        i(l),
        /** @type {TemplateNode} */
        l.lastChild
      );
      return;
    }
    if (r.nodes !== null && (w(
      r.nodes.start,
      /** @type {TemplateNode} */
      r.nodes.end
    ), r.nodes = null), e !== "") {
      if (d) {
        M.data;
        for (var a = E(), c = a; a !== null && (a.nodeType !== A || /** @type {Comment} */
        a.data !== ""); )
          c = a, a = T(a);
        if (a === null)
          throw C(), N;
        _(M, c), n = v(a);
        return;
      }
      var y = f ? H : t ? O : void 0, o = (
        /** @type {HTMLTemplateElement | SVGElement | MathMLElement} */
        g(f ? "svg" : t ? "math" : "template", y)
      );
      o.innerHTML = /** @type {any} */
      e;
      var s = f || t ? o : (
        /** @type {HTMLTemplateElement} */
        o.content
      );
      if (_(
        /** @type {TemplateNode} */
        i(s),
        /** @type {TemplateNode} */
        s.lastChild
      ), f || t)
        for (; i(s); )
          n.before(
            /** @type {TemplateNode} */
            i(s)
          );
      else
        n.before(s);
    }
  });
}
export {
  P as h
};
//# sourceMappingURL=html-DarouBbC.js.map
