Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../chunk-BN4qSVkS.cjs");
const require_components_typography_renderTypography = require("../components/typography/renderTypography.cjs");
let react = require("react");
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
//#region src/utils/NextLink.tsx
function NextLink({ href, text, children, id, target: targetProp, typography }) {
	const NextLinkRef = (0, react.useRef)(null);
	const [ready, setReady] = (0, react.useState)(false);
	const isExternal = href.startsWith("http");
	const target = targetProp ? targetProp : isExternal ? "_blank" : void 0;
	(0, react.useEffect)(() => {
		(async () => {
			try {
				NextLinkRef.current = (await import("next/link.js")).default;
			} catch {}
			setReady(true);
		})();
	});
	const InternalNextLink = NextLinkRef.current;
	let content = children;
	if (text) content = typography ? require_components_typography_renderTypography.renderTypography(typography.type, {
		size: typography.size,
		color: typography.color,
		children: text
	}) : text;
	if (!ready || !InternalNextLink) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("a", {
		href,
		target,
		id,
		children: content
	});
	return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(InternalNextLink, {
		href,
		target,
		id,
		children: content
	});
}
//#endregion
exports.NextLink = NextLink;
