`);function P({title:r,options:t,defualtValueIndex:s,onChange:e}){const{getInputLabelProps:A,getInputProps:p,getTagProps:v,getListboxProps:x,getOptionProps:g,groupedOptions:m,value:C,focused:y,setAnchorEl:E}=M({id:"customized-hook-demo",multiple:!0,options:t,getOptionLabel:l=>l.title});return o.useEffect(()=>{e(C)},[C]),u.jsx(n,{children:u.jsxs(su,{children:[u.jsx(nu,{...A(),children:u.jsx(k,{varinat:"body1",children:r})}),u.jsxs(lu,{style:{width:"275px",minHeight:"56px"},ref:E,className:y?"focused":"",children:[C.map((l,d)=>u.jsx(k,{variant:"body2",children:u.jsx(iu,{label:l==null?void 0:l.title,...v({index:d})})},l.id+d)),u.jsx("input",{...p()})]}),m.length>0?u.jsx(ou,{style:{position:"inherit",width:"275px"},...x(),children:m.map((l,d)=>u.jsx("li",{...g({option:l,index:d}),children:u.jsxs(n,{container:!0,children:[u.jsx(k,{variant:"body2",children:l.title}),u.jsx(eu,{fontSize:"small"})]})},l.id+d))}):null]})})}P.propTypes={title:h.string,defualtValueIndex:h.any,options:h.any,onChange:h.any};function du(r){let t;switch(r){case"شهرستان":t="CityOperator";break;case"مرغدار":t="Poultry";break;case"دامپزشک":t="VetFarm";break;case"راننده":t="Driver";break;case"کشتارگاه":t="KillHouse";break;case"پشتیبانی امور دام":t="LiveStockSupport";break;case"مالی":t="ProvinceFinancial";break;case"ادمین کل":t="SuperAdmin";break;case"پخش کننده":t="Dispenser";break}return t}const cu=48,pu=8,hu={PaperProps:{style:{maxHeight:cu*4.5+pu,width:250}}},xu=["شهرستان","دامپزشک","راننده","مرغدار","کشتارگاه","مالی"];function gu(r,t,s){return{fontWeight:t.indexOf(r)===-1?s.typography.fontWeightRegular:s.typography.fontWeightMedium}}const Cu=()=>{const[r,t]=o.useState([]),{provinceUsers:s}=B(a=>a.provinceSlice);o.useEffect(()=>{t(s.map(a=>{const i=a.profile.fullname?a.profile.fullname:`${a.profile.firstName}${a.profile.lastName}`;return{id:a.profile.key,title:`${i}`}}))},[]);const e=V({initialValues:{description:"",linkText:"",heading:"",link:"",usersList:[]},validationSchema:U({description:j().required("لطفا پیغام خود را بنویسید!").typeError("لطفا فیلد را پر کنید!"),heading:j().required("لطفا عنوان پیغام خود را بنویسید!").typeError("لطفا فیلد را پر کنید!"),link:j().typeError("لطفا فیلد را پر کنید!"),linkText:j().typeError("لطفا فیلد را پر کنید!")})});o.useEffect(()=>{e.validateForm()},[]);const A=W(),[p,v]=o.useState([]),x=D(),[g]=o.useContext(H),[m,C]=o.useState([]),[y,E]=o.useState([]),l=(a,i)=>{E(a.map(F=>uu(F.data_url))),C(a)},d=a=>{const{target:{value:i}}=a;v(typeof i=="string"?i.split(","):i)};return u.jsx(u.Fragment,{children:u.jsx(n,{justifyContent:"center",children:u.jsxs(n,{container:!0,justifyContent:"center",xs:12,sm:12,md:8,lg:8,gap:c.SMALL,direction:"column",children:[u.jsx(n,{children:u.jsx(b,{fullWidth:!0,id:"heading",label:"عنوان",variant:"outlined",value:e.values.heading,error:e.touched.heading?!!e.errors.heading:null,onChange:e.handleChange,onBlur:e.handleBlur,helperText:e.touched.heading&&e.errors.heading?e.errors.heading:null})}),u.jsx(n,{justifyContent:"center",children:u.jsx(b,{fullWidth:!0,id:"description",label:"توضیحات",multiline:!0,rows:5,variant:"outlined",sx:{width:"100%",height:"100%"},value:e.values.description,error:e.touched.description?!!e.errors.description:null,onChange:e.handleChange,onBlur:e.handleBlur,helperText:e.touched.description&&e.errors.description?e.errors.description:null})}),u.jsx(n,{children:u.jsxs(S,{fullWidth:!0,children:[u.jsx(z,{children:"ارسال پیام بر اساس نقش"}),u.jsx(_,{id:"demo-multiple-chip",multiple:!0,value:p,onChange:d,input:u.jsx(O,{label:"ارسال پیام بر اساس نقش",id:"select-multiple-chip"}),renderValue:a=>u.jsx(w,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:a.map(i=>u.jsx(T,{label:i},i))}),MenuProps:hu,children:xu.map(a=>u.jsx(G,{value:a,label:a,style:gu(a,p,A),children:a},a))})]})}),u.jsx(n,{children:u.jsx(S,{fullWidth:!