1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[181],{3992:function(e,s,t){t.d(s,{P:function(){return l}});var a=t(5893),n=t(2371),r=t(1046);let l=()=>{let[{breadcrumbs:e}]=(0,r.H)();return 1===e.items.length?null:(0,a.jsx)(n.Oo,{...e})}},181:function(e,s,t){t.r(s),t.d(s,{CustomPageSearch:function(){return u}});var a=t(5893),n=t(3992),r=t(7294),l=t(9332),c=t(2371),o=t(1046),i=t(1758),d=t(3466);let g=e=>{let{searchParams:s,onPageChange:t,onTotalChange:n}=e,l=new URLSearchParams(s),{data:o,error:g,isLoading:h}=(0,i.ZP)("/api/search?".concat(l.toString()),d.Q);return((0,r.useEffect)(()=>{var e;(null==o?void 0:null===(e=o.meta)||void 0===e?void 0:e.count)&&n(o.meta.count)},[o,n]),g)?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("p",{className:"text-p-lead",children:"There was a problem fetching search results, please try again later."})}):h||!o?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("p",{className:"text-p-lead",children:"Loading.."})}):(0,a.jsxs)(c.gC,{spacing:"16",children:[(0,a.jsx)("div",{children:(0,a.jsx)(c.B4,{noResultsMessage:"No results found",results:o.items})}),t&&o.meta.count>0&&(0,a.jsx)(c.tl,{dictionary:{back:"Back",first:"First",last:"Last",next:"Next",of:"of"},currentPage:Number(s.page),totalCount:o.meta.count,pageSize:10,onPageChange:e=>t(Number(e)),siblingCount:1})]})},h=()=>{let e=(0,l.useRouter)(),s=(0,l.usePathname)(),t=(0,l.useSearchParams)(),[{popularLinks:n}]=(0,o.H)(),[i,d]=(0,r.useState)(0),h=t.get("page")||"1",u=t.get("keyword")||"",x=t.get("sortBy"),p=t.get("type")||"all";return u&&x&&p?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("section",{title:"",children:(0,a.jsx)(c.W2,{className:"mb-24",children:(0,a.jsxs)(c.gC,{spacing:"8",children:[(0,a.jsx)("div",{className:"gap-5 lg:grid lg:grid-cols-12",children:(0,a.jsx)("div",{className:"lg:col-span-8 xl:col-span-6 xl:col-start-2",children:(0,a.jsxs)(c.gC,{spacing:"8",children:[(0,a.jsx)("h1",{className:"text-[--black-greys--grey_01]",children:"Search Results"}),(0,a.jsx)(c.f7,{hideType:!0,keyword:u,sortBy:x,type:p,onSearch:t=>{let{keyword:a,type:n,sortBy:r}=t;a&&n&&r&&e.push("".concat(s,"/?keyword=").concat(a,"&type=").concat(n,"&sortBy=").concat(r,"&page=1"))}}),u&&i>0&&(0,a.jsxs)("p",{className:"text-2xl",children:["Showing ",i," results for"," ",(0,a.jsx)("strong",{children:u})]})]})})}),(0,a.jsxs)("div",{className:"grid gap-5 md:grid-cols-12",children:[(0,a.jsx)("div",{className:"col-span-12 lg:col-span-8 xl:col-span-6 xl:col-start-2",children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g,{searchParams:{keyword:u,sortBy:x,type:p,page:h.toString()},onTotalChange:e=>d(e),onPageChange:t=>e.push("".concat(s,"/?keyword=").concat(u,"&type=").concat(p,"&sortBy=").concat(x,"&page=").concat(t))}),(0,a.jsx)("div",{style:{display:"none"},children:(0,a.jsx)(g,{searchParams:{keyword:u,sortBy:x,type:p,page:(Number(h)+1).toString()},onTotalChange:e=>d(e)})})]}):(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("p",{className:"text-p-lead",children:"Please enter a keyword to search."})})}),(0,a.jsx)("div",{className:"col-span-12 lg:col-span-3 lg:col-start-10 xl:col-start-9",children:(0,a.jsx)("div",{className:"lg:sticky lg:top-8",children:(0,a.jsx)(c.JQ,{linkHeading:"Popular Pages",links:n.map(e=>({children:e.title,href:e.url}))})})})]})]})})})}):null},u=e=>{let{...s}=e;return(0,a.jsxs)("div",{...s,children:[(0,a.jsx)(n.P,{}),(0,a.jsx)(h,{})]})}},3466:function(e,s,t){t.d(s,{Q:function(){return a}});let a=async e=>{let s=await fetch(e,{headers:{"Eirgrid-Content-Request":"Nextjs"}});if(!s.ok)throw Error("Failed to fetch from ".concat(e,": ").concat(s.statusText));return await s.json()}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.