function h(a){const n=new Map,s=[];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)s.push(i);else{const c=e.hierarchy.slice(0,-1).join("|"),r=n.get(c);r&&(r._children.push(i),r._hasSubmenu=!0)}}),s):[]}const u=()=>{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},d=()=>{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{u as getPageData,d as getSiteData,h as sortMenu};
