import { jsx as R } from "react/jsx-runtime"; import d, { useRef as m, useEffect as E } from "react"; import { D as g } from "./chunks/constants-CRZ9QfxV.js"; const l = /* @__PURE__ */ new Map(); function b(e, t) { const n = `${e}:${t}`; return l.has(n) || l.set( n, import( /* webpackIgnore: true */ /* @vite-ignore */ t ).catch((s) => { throw l.delete(n), s; }) ), l.get(n); } function y({ componentName: e, tagName: t, defaultRemoteUrl: n, normalizeProps: s }) { return function(i) { const p = m(null), o = m(null), a = m(null); return a.current = s ? s(i) : i, E(() => { let A = !0; return b(e, n).then(() => { if (!A || !p.current) return; const u = document.createElement(t); u.componentProps = a.current, p.current.appendChild(u), o.current = u; }).catch((u) => { console.error( `[uikit/remote/ui] Failed to load ${e}:`, u ); }), () => { A = !1, o.current && (o.current.remove(), o.current = null); }; }, [e, n, t]), E(() => { o.current && (o.current.componentProps = a.current); }), /* @__PURE__ */ R( "span", { ref: p, style: { display: "contents" } } ); }; } const S = Symbol.for("uikit.remote.app-header.slot"); function c(e) { function t() { return null; } return t[S] = e, t; } const H = c("brandSection"), C = c("logo"), P = c("brand"), x = c("title"), B = c("description"), L = c("bi"); function f(e) { var t; if (!(e == null || typeof e == "boolean")) { if (typeof e == "string" || typeof e == "number") return String(e); if (Array.isArray(e)) return e.map(f).filter(Boolean).join(""); if (d.isValidElement(e)) return f((t = e.props) == null ? void 0 : t.children); } } function T(e) { const t = { showBi: !1 }; function n(s) { d.Children.forEach(s, (r) => { var p, o; if (!d.isValidElement(r)) return; const i = (p = r.type) == null ? void 0 : p[S]; i === "logo" ? (t.logoSrc = r.props.src, t.logoAlt = r.props.alt) : i === "title" ? t.title = f(r.props.children) : i === "description" ? t.description = f(r.props.children) : i === "bi" && (t.showBi = !0, t.biLogoSrc = r.props.logoSrc || r.props.src, t.biLogoAlt = r.props.alt, t.biText = r.props.text), (o = r.props) != null && o.children && n(r.props.children); }); } return n(e), t; } const h = y({ componentName: "AppHeader", tagName: "uikit-app-header", defaultRemoteUrl: g.AppHeader, normalizeProps: ({ children: e, ...t }) => e == null ? t : { ...t, ...T(e) } }); function w(e) { return /* @__PURE__ */ R(h, { ...e }); } const k = Object.assign(w, { BrandSection: H, Logo: C, Brand: P, Title: x, Description: B, Bi: L }); export { k as AppHeader };