"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),n=require("semantic-ui-react"),x=require("react"),l=require("@devgateway/wp-react-lib"),g=require("react-intl"),j=require("./SearchControl.js"),f=require("./LangSwitcher.js"),p=require("react-router"),h=(s,r)=>s?s.substr(s.indexOf("/wp")+3).startsWith("/"+r)?s.substr(s.indexOf("/wp")+3):"/"+r+s.substr(s.indexOf("/wp")+3):"",M=s=>{const{settings:r,withIcons:u,active:d,menu:o,onSetSelected:a,selected:i,locale:m}=s;return o.items.filter(t=>t.url!="#wpm-languages").map(t=>e.jsxs(n.Menu.Item,{className:`divided ${t.child_items?"has-child-items":""} ${i&&i.ID==t.ID?"selected":""}  ${d==t.slug?"active":""}`,children:[!t.child_items&&e.jsx("a",{onClick:c=>a(t),href:h(t.url,m),children:t.title}),t.child_items&&e.jsx(n.Popup,{position:"top center",className:"floating child",positionFixed:!0,hoverable:!0,trigger:e.jsx("span",{children:t.title}),children:t.child_items.map(c=>e.jsxs(n.Menu.Item,{children:[c.icon&&e.jsx("img",{className:"child icon",src:c.icon.url}),e.jsxs("span",{children:[" ",e.jsx("a",{onClick:w=>a(t),href:h(c.url,m),children:c.title})]})]}))})]}))},I=({intl:{locale:s},settings:r})=>{const[u,d]=x.useState(),{slug:o}=p.useParams(),a=({media:i})=>i?e.jsx(n.Image,{src:i.guid.rendered}):e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"});return e.jsx(l.MenuProvider,{slug:"main",locale:s,children:e.jsxs(n.Menu,{className:"header floating branding",text:!0,children:[e.jsx(n.Menu.Item,{className:"logo",children:e.jsxs("a",{href:`/${s}`,children:[r.site_logo!=0&&e.jsx(l.MediaProvider,{id:r.site_logo,children:e.jsx(l.MediaConsumer,{children:e.jsx(a,{})})}),!window.isCustomizedPreview&&r.site_logo==0&&e.jsx("img",{className:"brand logo",size:"large",src:"/dc-logo_01.png"})]})}),e.jsx(n.Menu.Item,{className:"divider",children:e.jsx("div",{})}),e.jsx(n.Menu.Item,{className:"site name",fitted:!0,href:"/",children:r.name}),e.jsx(n.Menu.Item,{className:"pages",children:e.jsx(l.MenuConsumer,{children:e.jsx(M,{settings:r,active:o,selected:u,onSetSelected:d,locale:s})})}),e.jsx(n.Menu.Item,{className:"lang switcher",children:e.jsx(l.MenuConsumer,{children:e.jsx(f.default,{locale:s})})}),e.jsx(n.Menu.Item,{fitted:!0,children:e.jsx(j.default,{})})]})})},v=g.injectIntl(I);exports.default=v;
