'use client';'use strict';

var chunk4Z2AH27S_cjs = require('./chunk-4Z2AH27S.cjs');
var chunkY3NOL3WI_cjs = require('./chunk-Y3NOL3WI.cjs');
var chunk5XB54L7P_cjs = require('./chunk-5XB54L7P.cjs');
var css = require('@onbeam/styled-system/css');
var icons = require('@onbeam/icons');
var react = require('react');
var recipes = require('@onbeam/styled-system/recipes');
var jsxRuntime = require('react/jsx-runtime');

var N=chunk5XB54L7P_cjs.a(({as:d="header",linkComponent:l="a",title:s,homeHref:v="/",navItems:r,activePath:t,isNavigationItemActive:u,onRouteChange:p,children:h,className:g,...y},T)=>{let[x,S]=react.useState(t),a=recipes.topNav();react.useEffect(()=>{!r||r.findIndex(n=>n.href===t)===-1||S(t);},[t,r]);let k=e=>{if(!r||!p)return;let n=r.find(C=>C.href===e.target.value);n&&p(n);};return jsxRuntime.jsxs(d,{ref:T,className:css.cx(a.root,g),...y,children:[jsxRuntime.jsxs("div",{className:a.logo,children:[jsxRuntime.jsxs(l,{href:v,className:a.homeLink,children:[jsxRuntime.jsx(icons.BeamIcon,{height:28,width:28}),s&&jsxRuntime.jsx("span",{className:a.title,children:s})]}),r&&jsxRuntime.jsx(chunk4Z2AH27S_cjs.a,{width:90,className:a.select,"aria-label":"Navigation",onChange:k,value:x,children:r.map(({label:e,href:n})=>jsxRuntime.jsx("option",{value:n,children:e},n))})]}),r&&jsxRuntime.jsx("nav",{className:a.nav,children:jsxRuntime.jsx("ul",{className:a.navList,children:r.map(e=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx(chunkY3NOL3WI_cjs.a,{as:l,size:"sm",variant:u?.(e)?"primary":"secondary",href:e.href,target:e.isExternal?"_blank":"_self",rel:"noopener noreferrer",children:e.label})},e.href))})}),jsxRuntime.jsx("div",{className:a.childrenContainer,children:h})]})});N.displayName="TopNav";

exports.a = N;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-DGJNIU5S.cjs.map