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 u=()=>{const a={pageTitle:window.drupalSettings?.canvasData?.v0?.pageTitle||"",breadcrumbs:window.drupalSettings?.canvasData?.v0?.breadcrumbs||[],mainEntity:window.drupalSettings?.canvasData?.v0?.mainEntity||null};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||"/",themeAssets:window.drupalSettings?.canvasData?.v0?.themeAssets||{logo:{url:""},favicon:{url:"",mimeType:""}}};return window.parent.postMessage({type:"_canvas_useswr_data_fetch",id:"getSiteData()",data:a}),a};export{u as getPageData,d as getSiteData,o as sortMenu};
