1function O(){function W(e){var s,c,f,d,L;const n=((c=(s=e==null?void 0:e.acf)==null?void 0:s.short_description)==null?void 0:c.trim())||"";if(n)return n;const t=((d=(f=e==null?void 0:e.excerpt)==null?void 0:f.raw)==null?void 0:d.trim())||"";return t||(((L=e==null?void 0:e.excerpt)==null?void 0:L.rendered)||"").replace(/<[^>]+>/g,"").trim()}function V(){const e=document.querySelector(".resource-library-page__content");e&&e.scrollIntoView({behavior:"smooth",block:"start"})}const T=document.querySelector(".filters__form"),g=document.querySelector(".jb-pagination__previous"),m=document.querySelector(".jb-pagination__next"),h=document.querySelector(".pagination-v2 ul"),b=document.querySelector(".pagination-v2"),U=document.querySelector(".order"),r=document.querySelector(".filters__form .search"),$=document.querySelector(".listing");let D=0,o=1,i=1;const j=document.querySelector(".resource-library-grid__wrapper");j&&(o=parseInt(j.getAttribute("data-current-page"))||1,i=parseInt(j.getAttribute("data-total-pages"))||1);let y=[],x=[],w=[];const q=document.querySelectorAll('input[name="category"]'),P=document.querySelectorAll('input[name="types"]'),A=document.querySelectorAll('input[name="audience"]');r&&r.addEventListener("input",function(){this.value.trim()===""&&(o=1,N(""))});function C(e){return Array.from(e).filter(n=>n.checked).map(n=>n.value)}function Q(){const e=window.location.pathname.replace(/\/page\/\d+\/?$/,"/");return e.endsWith("/")?e:`${e}/`}function X(e){const n=parseInt(e.get("paged"),10);if(!Number.isNaN(n)&&n>0)return n;const t=window.location.pathname.match(/\/page\/(\d+)\/?$/);return t?parseInt(t[1],10):1}function F(e=o){const n=new URLSearchParams;x.length>0&&n.set("type",x.join(",")),w.length>0&&n.set("audience",w.join(",")),y.length>0&&n.set("category",y.join(","));const t=((r==null?void 0:r.value)||"").trim();t&&n.set("search",t),e>1&&n.set("paged",e);const a=Q(),s=n.toString();return s?`${a}?${s}`:a}function E(){window.history.replaceState({},"",F())}function z(){var L;if(!h)return;h.querySelectorAll(".jb-pagination__page-number, .jb-pagination__ellipsis").forEach(l=>{const p=l.closest("li");p&&p.remove()});const e=(L=h.querySelector(".jb-pagination__next"))==null?void 0:L.closest("li"),n=(l,p=!1,k=!0)=>{const S=document.createElement("li");S.className="py-3 pl-0 before:!hidden";const u=document.createElement("a");u.href=F(l),u.textContent=String(l),u.className="jb-pagination__page-number bg-white text-black px-5.25 py-4 text-base no-underline",k&&u.classList.add("border-r","border-gray-light"),p?u.classList.add("font-bold"):u.classList.add("text-black","transition-all","hover:bg-primary","hover:border-primary","hover:text-white"),S.appendChild(u),e?h.insertBefore(S,e):h.appendChild(S)},t=()=>{const l=document.createElement("li");l.className="py-3 pl-0 before:!hidden";const p=document.createElement("span");p.className="jb-pagination__ellipsis bg-white text-black px-5.25 py-4 text-base border-r border-gray-light",p.setAttribute("aria-hidden","true"),p.textContent="â¦",l.appendChild(p),e?h.insertBefore(l,e):h.appendChild(l)},a=2,s=Math.max(1,Math.min(o-1,i-(a-1))),c=Math.min(i,s+(a-1));n(1,o===1,i>1),s>2&&t();
1const f=Math.max(2,s),d=Math.min(i-1,c);for(let l=f;l<=d;l++)n(l,l===o,l!==i);c<i-1&&t(),i>1&&n(i,o===i,!1)}function M(e,n,t){const a=document.querySelector(".resource-listing__header-display-result");if(!(!a||!b))if(e===0)a.style.visibility="hidden",b.style.display="none";else{a.style.visibility="visible",b.style.display=e<=n?"none":"flex";const s=e===1?"result":"results",c=e===1?`1 ${s}`:`${e} ${s}`;a.innerHTML=`<p style="color: #ffffff; padding-bottom:10px">${c}</p>`}}function R(e){if($.innerHTML="",!Array.isArray(e)||e.length===0){M(0,12),$.innerHTML='<p class="resource-listing__no-results" style="color: #ffffff;">0 result</p>';return}const n=e.map(t=>{var k,S,u,H;const a=(t==null?void 0:t.link)||"#",s=(t==null?void 0:t.target)==="_blank"?' target="_blank" rel="noopener"':"",c=((k=t==null?void 0:t.category_names)==null?void 0:k[0])||"",f=((S=t==null?void 0:t.title)==null?void 0:S.rendered)||"",d=W(t),L=d.length>0,l=((u=t==null?void 0:t.acf)==null?void 0:u.icon)||"link",p=((H=t==null?void 0:t.acf)==null?void 0:H.link_name)||"View";return` 2 <a href="${a}" class="group transition-all col-span-1 md:grid-cols-1 xl:col-span-3"${s}> 3 <div class="p-7.5 rounded bg-white h-full"> 4 <p class="bg-primary inline-block rounded-[4px] px-2 py-0.5 text-[12px] font-bold text-white"> 5 ${c} 6 </p> 7 <h3 class="text-heading_6 lg:py-4.5 group-hover:text-primary py-3 transition-all"> 8 ${f} 9 </h3> 10 ${L?` 11 <p class="lg:pb-4.5 pb-3 text-sm"> 12 ${d} 13 </p> 14 `:""} 15 <p class="text-m flex items-center gap-3 font-bold text-black"> 16 <i class="fa-sharp fa-regular fa-${l} text-gray border-white group-hover:bg-primary group-hover:border-primary flex h-8 w-8 items-center justify-center rounded-full border bg-transparent transition-all group-hover:text-white"></i> 17 ${p} 18 </p> 19 </div> 20 </a> 21 `}).join("");$.insertAdjacentHTML("beforeend",n)}function v(){z(),g&&(g.disabled=o===1),m&&(m.disabled=o===i),b&&(b.style.display=i<=1?"none":"flex");const e=g==null?void 0:g.parentElement,n=m==null?void 0:m.parentElement;e&&(e.style.opacity=o===1?"0":"1",e.style.visibility=o===1?"hidden":"visible",e.style.pointerEvents=o===1?"none":"all",e.classList.toggle("hidden",o===1)),n&&(n.style.opacity=o===i?"0":"1",n.style.visibility=o===i?"hidden":"visible",n.style.pointerEvents=o===i?"none":"all",n.classList.toggle("hidden",o===i))}function _(e){const n=`${window.location.origin}/wp-json/wp/v2/resource`,t=12,a=new URLSearchParams({page:o,per_page:t,_fields:"id,link,title,excerpt,acf,category_names,target"});D===0?(a.append("orderby","date"),a.append("order","desc")):(a.append("orderby","title"),a.append("order","asc")),x.length>0&&a.append("resource_type",x.join(",")),w.length>0&&a.append("resource_audience",w.join(",")),y.length>0&&a.append("resource_category",y.join(",")),e&&a.append("search",e),fetch(`${n}?${a.toString()}`).then(async s=>{if(!s.ok){if(s.status===400)return o=1,E(),_((r==null?void 0:r.value.trim())||"");const d=await s.json().catch(()=>({}));throw new Error((d==null?void 0:d.message)||`Request failed with ${s.status}`)}i=parseInt(s.headers.get("X-WP-TotalPages"),10)||1;const c=parseInt(s.headers.get("X-WP-Total"),10)||0,f=await s.json();R(f),v(),M(c,t),E(),V()}).catch(s=>{console.error("Error fetching resource listings:",s),R([]),v(),M(0,12)})}function N(e=""){x=C(P),w=C(A),y=C(q),o=1,E(),_(e)}g&&g.addEventListener("click",e=>{e.preventDefault(),o>1&&(o--,E(),_((r==null?void 0:r.value.trim())||""))}),m&&m.addEventListener("click",e=>{e.preventDefault(),o<i&&(o++,E(),_((r==null?void 0:r.value.trim())||""))}),b&&b.addEventListener("click",e=>{const n=e.target.closest(".jb-pagination__page-number");if(n){e.preventDefault();const t=parseInt(n.textContent,10);!Number.isNaN(t)&&t!==o&&(o=t,E(),_((r==null?void 0:r.value.trim())||""))}}),T&&T.addEventListener("submit",function(e){e.preventDefault();const n=((r==null?void 0:r.value)||"").trim();N(n)}),[P,A,q].forEach(e=>{e.forEach(n=>{n.addEventListener("change",function(){N((r==null?void 0:r.value.trim())||"")})})}),U&&U.addEventListener("change",function(){D=parseInt(this.value,10)||0,o=1,_((r==null?void 0:r.value.trim())||"")});function B(){const e=new URLSearchParams(window.location.search);x=e.get("type")?e.get("type").split(","):[],w=e.get("audience")?e.get("audience").split(","):[],y=e.get("
21category")?e.get("category").split(","):[],o=X(e),P.forEach(t=>t.checked=x.includes(t.value)),A.forEach(t=>t.checked=w.includes(t.value)),q.forEach(t=>t.checked=y.includes(t.value));const n=e.get("search")||"";r&&(r.value=n),_(n)}B()}O();export{O as default};
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.