function o(a){const n=new Map,r=[];return a.linkset?.length?(a.linkset[0].item.forEach(e=>{const t=e.hierarchy.join("|");n.set(t,{...e,id:t,_children:[],_hasSubmenu:!1})}),a.linkset[0].item.forEach(e=>{const t=e.hierarchy.join("|"),i=n.get(t);if(e.hierarchy.length===1)r.push(i);else{const c=e.hierarchy.slice(0,-1).join("|"),s=n.get(c);s&&(s._children.push(i),s._hasSubmenu=!0)}}),r):[]}const h=()=>{const a={pageTitle:window.drupalSettings?.canvasData?.v0?.pageTitle||"",breadcrumbs:window.drupalSettings?.canvasData?.v0?.breadcrumbs||[]};return window.parent.postMessage({type:"_canvas_useswr_data_fetch",id:"getPageData()",data:a}),a},u=()=>{const a={branding:window.drupalSettings?.canvasData?.v0?.branding||{homeUrl:"",siteName:"",siteSlogan:""},baseUrl:window.drupalSettings?.canvasData?.v0?.baseUrl||"/"};return window.parent.postMessage({type:"_canvas_useswr_data_fetch",id:"getSiteData()",data:a}),a};export{h as getPageData,u as getSiteData,o as sortMenu};
