1import{R as f,r as m}from"./index-D44nil-y.js";import{j as a,a as c}from"./jsx-runtime-BgPN2v8p.js";import"./main-zYebbhZP.js";const N=({stateGroup:t,isExpanded:l,onToggle:o})=>{const s=m.useCallback(()=>{o(t.stateName)},[t.stateName,o]),e=m.useCallback(i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),s())},[s]);return c("div",{className:"border-b first:border-t border-[#E0E0E0] last:border-b-0",children:[c("button",{type:"button",className:"w-full text-left p-4 flex items-center justify-between",onClick:s,onKeyDown:e,"aria-expanded":l,"aria-controls":`state-content-${t.stateName.replace(/\s+/g,"-").toLowerCase()}`,id:`state-header-${t.stateName.replace(/\s+/g,"-").toLowerCase()}`,children:[a("div",{className:"flex flex-col items-start",children:a("h3",{className:"text-lg font-bold text-gray-900 font-open-sans",children:t.stateName})}),a("div",{className:"flex-shrink-0 ml-4 w-6 h-6 flex items-center justify-center","aria-hidden":"true",children:l?a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:a("path",{d:"M6 13.4854V11.4854H18V13.4854H6Z",fill:"#202A44"})}):a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:a("path",{d:"M11 13.4854H5V11.4854H11V5.48535H13V11.4854H19V13.4854H13V19.4854H11V13.4854Z",fill:"#202A44"})})})]}),l&&a("div",{id:`state-content-${t.stateName.replace(/\s+/g,"-").toLowerCase()}`,"aria-labelledby":`state-header-${t.stateName.replace(/\s+/g,"-").toLowerCase()}`,className:"px-4 pb-4",children:t.branches.length>0?a("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:t.branches.map(i=>a("div",{className:"text-sm",children:a("a",{href:i.url,className:"underline hover:no-underline",title:`Visit ${i.name} branch page`,children:i.name})},i.id))}):c("div",{className:"text-sm",children:["No branches available in ",t.stateName]})})]})},u=({title:t,states:l,className:o=""})=>{const[s,e]=m.useState(new Set),i=m.useCallback(r=>{e(d=>{const n=new Set(d);return n.has(r)?n.delete(r):n.add(r),n})},[]),p=f.useMemo(()=>!l||l.length===0?[]:l.map(r=>({...r,branches:[...r.branches].sort((d,n)=>{const h=d.name.toLowerCase().startsWith("cjd"),g=n.name.toLowerCase().startsWith("cjd");return h&&!g?-1:!h&&g?1:d.name.localeCompare(n.name)})})),[l]);return!l||l.length===0?a("div",{className:"find-a-branch-empty text-gray-500 text-center py-8",role:"status",children:"No branch locations available."}):c("section",{className:`find-a-branch bg-white ${o}`,"aria-label":"Find branch locations by state",children:[t&&a("div",{className:"mb-6 sm:mb-8",children:a("h2",{className:"h2",children:t})}),a("div",{className:"find-a-branch-container",children:p.map(r=>a(N,{stateGroup:r,isExpanded:s.has(r.stateName),onToggle:i},r.stateName))}),a("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:s.size===0?"All state sections are collapsed":`${s.size} state ${s.size===1?"section is":"sections are"} expanded`})]})},w=f.memo(u),b=({findABranchData:t})=>{if(!(t!=null&&t.states)||t.states.length===0)return null;const l=t.states.filter(s=>s&&typeof s.stateName=="string"&&s.stateName.trim()!==""&&Array.isArray(s.branches)&&s.branches.length>0&&s.branches.some(e=>e&&typeof e.id=="string"&&e.id.trim()!==""&&typeof e.name=="string"&&e.name.trim()!==""&&typeof e.url=="string"&&e.url.trim()!==""));if(l.length===0)return null;const o=l.map(s=>({...s,branches:s.branches.filter(e=>e&&typeof e.id=="string"&&e.id.trim()!==""&&typeof e.name=="string"&&e.name.trim()!==""&&typeof e.url=="string"&&e.url.trim()!==""),branchCount:s.branches.filter(e=>e&&typeof e.id=="string"&&e.id.trim()!==""&&typeof e.name=="string"&&e.name.trim()!==""&&typeof e.url=="string"&&e.url.trim()!=="").length}));return a(w,{title:t.title||"Find a Branch",states:o,className:t.className||""})};export{b 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.