import{a9 as a,h as n,bs as d}from"./index-Csef3-wA.js";const A={CATEGORIES:"categories",SUCCESS:"success"},s={SET_STEP:"feedback/SET_STEP",GO_BACK:"feedback/GO_BACK",SET_REVIEWS:"feedback/SET_REVIEWS",OPEN_SUBMIT_MODAL:"feedback/OPEN_SUBMIT_MODAL",CLOSE_SUBMIT_MODAL:"feedback/CLOSE_SUBMIT_MODAL",GO_TO_CATEGORIES:"feedback/GO_TO_CATEGORIES",SET_DATA:"feedback/SET_DATA",CLEAR_DATA:"feedback/CLEAR_DATA"},o={setStep:a(s.SET_STEP),goBack:a(s.GO_BACK),setReviews:a(s.SET_REVIEWS),openSubmitModal:a(s.OPEN_SUBMIT_MODAL),closeSubmitModal:a(s.CLOSE_SUBMIT_MODAL),goToCategories:a(s.GO_TO_CATEGORIES),setData:a(s.SET_DATA),clearData:a(s.CLEAR_DATA)};function c(){return(e,t)=>{const{reviews:S,category:E,subcategory:_}=t().feedback;if(_){const i={...S,[E.id]:{...S[E.id]}};return delete i[E.id][_.id],Object.keys(i[E.id]).length===0&&delete i[E.id],e(o.setReviews(i))}const T={...S};delete T[E.id],e(o.setReviews(T))}}function l(e,t,S){return(E,_)=>{const{reviews:T}=_().feedback;if(!e.rating&&!e.comment&&e.value===void 0)return E(c());if(S)return E(o.setReviews({...T,[t]:{...T[t],[S]:e}}));E(o.setReviews({...T,[t]:e}))}}const f={...o,addReview:l,deleteReview:c},O={reviews:{},step:A.CATEGORIES,submitModalOpen:!1,color:"",forceMobileClass:"",ratingsDisabled:!1,commentsDisabled:!1},C=n({[s.SET_STEP]:(e,t)=>({...e,step:t.payload}),[s.SET_REVIEWS]:(e,t)=>({...e,reviews:t.payload}),[s.GO_BACK]:e=>({...e,step:A.CATEGORIES}),[s.OPEN_SUBMIT_MODAL]:e=>({...e,submitModalOpen:!0}),[s.CLOSE_SUBMIT_MODAL]:e=>({...e,submitModalOpen:!1}),[s.GO_TO_CATEGORIES]:e=>({...e,step:A.CATEGORIES}),[s.SET_DATA]:(e,t)=>({...e,...t.payload}),[s.CLEAR_DATA]:e=>({...O,...d(e,["color","forceMobileClass"])})},O);export{f as a,C as f,A as s};