1import{a as H}from"/build/_shared/chunk-CCXUG7EA.js";import{b as F}from"/build/_shared/chunk-GLNX7PBK.js";import{O as S,Q as M,U as P,la as K,ma as N,sa as k,t as _}from"/build/_shared/chunk-FES3B5QL.js";import{g as A}from"/build/_shared/chunk-XC7SPKRF.js";import{a as v}from"/build/_shared/chunk-G3QUQOKW.js";import{a as T}from"/build/_shared/chunk-F3RAJA4O.js";import{e as f}from"/build/_shared/chunk-O3BUCIVF.js";var g=f(T());var O=f(T()),R=({containerRef:o,focusedOptionIndex:i,inputRefs:a,list:s,setFocusedOptionIndex:r})=>{let u=e=>{var y,p,b,m;if((y=o.current)!=null&&y.contains(document.activeElement)){if(e.ctrlKey&&e.altKey&&e.key==="Enter"&&(e.preventDefault(),r(0),a.current[0]&&((p=a.current[0])==null||p.focus())),e.key==="ArrowDown"){e.preventDefault();let t=(i+1)%s.length;r(t),a.current[t]&&((b=a.current[t])==null||b.focus())}if(e.key==="ArrowUp"){e.preventDefault();let t=(i-1)%s.length;r(t),a.current[t]&&((m=a.current[t])==null||m.focus())}}};return(0,O.useEffect)(()=>{let e=o.current;return e&&e.addEventListener("keydown",u),()=>{e&&e.removeEventListener("keydown",u)}},[i,a,o]),{focusedOptionIndex:i,setFocusedOptionIndex:r}};var B="/build/_assets/styles-S4VOITB7.css";var E=f(v()),z=()=>[{rel:"stylesheet",href:B}];function W({categoryList:o,onSelectionChange:i,title:a,totalCount:s}){let[r,u]=(0,g.useState)(o||[]),[e,y]=(0,g.useState)(null),p=(0,g.useRef)(null),b=(0,g.useRef)([]);R({inputRefs:b,list:r,focusedOptionIndex:e,setFocusedOptionIndex:y,containerRef:p}),(0,g.useEffect)(()=>{i==null||i(r)},[r,i]);let m=(t,d)=>{let c=t.type==="keydown"&&t.key==="Enter";if(t.type==="change"||c){let C=[...o];u(()=>(C.length>0&&(C[d].applied=t.target.checked||c),C)),y(d)}};return(0,E.jsx)(k,{"aria-live":"polite",className:"category-checkbox-group","data-testid":"swiftly-check-filter",role:"group",tabIndex:0,ref:p,children:o==null?void 0:o.map((t,d)=>(0,E.jsx)(M,{"aria-label":t.name,checked:t.applied,"aria-checked":t.applied,role:"checkbox",ref:c=>b.current[d]=c,className:F("filter-checkbox",t.applied&&"checked"),label:(0,E.jsx)("p",{className:"label-text filter-checkbox-label",children:(0,E.jsx)("span",{title:t.name,children:t.name})}),styles:{body:{alignItems:"center"}},onChange:c=>{m(c,d)},onKeyDown:c=>{m(c,d)},tabIndex:d===e?0:-1},t.name))})}var j=W;var $=j;var l=f(T());var L="/build/_assets/styles-BRLPYHAE.css";var h=f(v()),Q=()=>[{rel:"stylesheet",href:L}];function Y({categoryList:o,hideShowMore:i=!1,onSelectionChange:a,title:s}){var D;let[r,u]=(0,l.useState)(o||[]),[e,y]=(0,l.useState)(!1),p=5,b=(0,l.useRef)(null),m=(0,l.useRef)([]),[t,d]=(0,l.useState)(null);R({inputRefs:m,list:r,focusedOptionIndex:t,setFocusedOptionIndex:d,containerRef:b}),(0,l.useEffect)(()=>{a==null||a(r)},[r,a]);let c=(0,l.useMemo)(()=>i||e?r:r==null?void 0:r.slice(0,p),[i,e,r]),C=(n,w)=>{let I=n.type==="click";if(n.type==="change"||I){let G=[...r].map(q=>({...q,applied:!1}));u(()=>(G.length>0&&(G[w].applied=n.target.checked||I),G)),d(w)}};return(0,h.jsxs)(k,{className:"category-radio-container","data-testid":"swiftly-radio-filter",children:[(0,h.jsx)(K,{"aria-live":"polite",classNames:{root:"category-radio-group"},label:s,ref:b,styles:{root:{display:"flex",flexDirection:"column",rowGap:16}},role:"radiogroup",tabIndex:0,value:(D=c.find(n=>n.applied))==null?void 0:D.id,"data-testid":"category-radio-group",children:c.map((n,w)=>(0,h.jsx)(N,{className:"category-button","data-testid":"category-button",role:"radio",ref:I=>m.current[w]=I,checked:n.applied,"aria-checked":n.applied,label:(0,h.jsx)(S,{c:n.applied?"accents-accent.2":void 0,className:"category-button-text",variant:"text","data-testid":"category-button-text",children:n==null?void 0:n.name}),value:n.id,name:n.id,onClick:I=>{C(I,w)},tabIndex:w===t?0:-1},n.id))}),o&&(o==null?void 0:o.length)>p&&!i&&(0,h.jsx)(P,{"aria-label":e?`Show less button. Select to show less ${s} options`:`Show more button. Select to show more ${s} options`,p:0,variant:"transparent",radius:"xs",justify:"start",onClick:()=>y(!e),children:(0,h.jsx)(S,{c:"accents-primary.2",className:"expand-text",children:e?"Show less":"Show more"})})]})}var U=Y;var V=U;var Z="/build/_assets/styles-UOJTUSIE.css";var x=f(v()),Re=()=>[{rel:"stylesheet",href:Z},...Q(),...z()],te=({group:o,hideDropDownIcon:i=!1})=>{let a=A(`(max-width: ${H.TABLET})`);return(0,x.jsx)(k,{className:F("filter-by-category-container",a&&"tablet"),w:"100%",children:o.map(({categoryList:s,multiSelect:r,onSelectionChange:u,title:e,totalCount:y},p)=>(0,x.jsxs)(_,{"aria-label":`Filter by ${e}. Press Control + Option + Enter to Filter by ${e}.`,role:"region",w:"100%",children:[e&&(0,x.jsx)(S,{className:"swiftlyCategoryPicker__selector--title",component:"span","data-testid":"category-picker-title",children:e}),(0,x.jsxs)(k,{w:"100%","data-testid":"category-picker-container",children:[!r&&(0,x.jsx)(V,{categoryList:s,hideShowMore:!0,title:e,onSelectionChange:u}),r&&(0,x.jsx)($,{categoryList:s,title:e||"",totalCount:y,onSelectionChange:u})]})]},p))})},Ge=te;export{Re as a,Ge as b};
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.