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