import{v as S}from"./chunk-HMS3LRP2.js";import{A as n,B as w,e as u,f,v as p,x as h}from"./chunk-QYQ7WNYU.js";import{a as s,b as c}from"./chunk-HC2G7LSI.js";var i=function(e){return e.VOICE="VOICE",e.INTERNET="INTERNET",e.TV="TV",e}(i||{}),b="SUSPENDED";var l=f({source:"Customer Profile Search",events:{setCustomerProfileKeyword:u(),toggleCustomerProfileShowGroup:u()}});var P=e=>r=>(r||"").toLowerCase().includes((e||"").toLowerCase()),C=e=>{let r=P(e.keyword);return function(o){let d=r(o.name),E=Object.keys(e.showGroups).filter(t=>e.showGroups[t]),a=o.subscribers.filter(t=>E.indexOf(t.group)>-1),m=d?a:a.filter(t=>r(t.title)||r(t.subtitle));return[c(s({},o),{subscribers:m}),m.length>0]}},T=(e=[],r)=>e.map(C(r)).filter(([,o])=>o).map(([o])=>o),G={keyword:"",showGroups:{[i.TV]:!1,[i.VOICE]:!0,[i.INTERNET]:!1}},F=h({name:"customerProfileSearch",reducer:w(G,n(l.setCustomerProfileKeyword,(e,{keyword:r})=>c(s({},e),{keyword:r})),n(l.toggleCustomerProfileShowGroup,(e,{group:r})=>c(s({},e),{showGroups:c(s({},e.showGroups),{[r]:!e.showGroups[r]})}))),extraSelectors:({selectCustomerProfileSearchState:e})=>({selectFilteredB2cProfileData:p(S,e,(r,o)=>T(r&&r.profiles,o))})});export{i as a,b,l as c,F as d};