52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
import { jsx as a } from "react/jsx-runtime";
|
|
import { useRef as i, useEffect as l } from "react";
|
|
const f = "https://uikit.d.aiengines.ir/GBadge.js";
|
|
let n = null;
|
|
function m() {
|
|
return n || (n = import(
|
|
/* webpackIgnore: true */
|
|
/* @vite-ignore */
|
|
f
|
|
).catch((e) => {
|
|
throw n = null, e;
|
|
})), n;
|
|
}
|
|
function p(e) {
|
|
if (typeof e == "string" || typeof e == "number")
|
|
return e;
|
|
e != null && console.warn(
|
|
"[uikit/remote/ui] GBadge only accepts text/number children across the remote boundary."
|
|
);
|
|
}
|
|
const R = ({ children: e, ...s }) => {
|
|
const o = i(null), t = i(null), u = i(null);
|
|
return u.current = {
|
|
...s,
|
|
children: p(e)
|
|
}, l(() => {
|
|
let c = !0;
|
|
return m().then(() => {
|
|
if (!c || !o.current) return;
|
|
const r = document.createElement("uikit-g-badge");
|
|
r.componentProps = u.current, o.current.appendChild(r), t.current = r;
|
|
}).catch((r) => {
|
|
console.error("[uikit/remote/ui] Failed to load GBadge:", r);
|
|
}), () => {
|
|
c = !1, t.current && (t.current.remove(), t.current = null);
|
|
};
|
|
}, []), l(() => {
|
|
t.current && (t.current.componentProps = u.current);
|
|
}), /* @__PURE__ */ a(
|
|
"span",
|
|
{
|
|
ref: o,
|
|
style: {
|
|
display: "contents"
|
|
}
|
|
}
|
|
);
|
|
};
|
|
export {
|
|
R as GBadge
|
|
};
|