import{m as o,t as x,p as u,n as c,v as a,aI as J,aJ as Q,w as W,L as Z,Z as V,k as X,u as Y,h as ee,b as te,r as I,bu as ne,ag as l,ab as d,ac as h,al as b,bI as L,af as M,bx as ie,by as se,f as oe,j as t,ai as y,P as O,ch as re,ak as ce}from"./index-6o6UQuBv.js";import{S as P,O as ae}from"./termList-B8l_Q4qO.js";import{u as de}from"./useTermList-BBmeiOJ8.js";import{S as le}from"./arrow-right-CTzig5tB.js";const pe=o.div.withConfig({componentId:"sc-4616b6b1-0"})(["border:1px solid ",";border-radius:var(--spacing-6);width:100%;height:55px;margin-bottom:30px;> label{width:100%;height:100%;display:flex;justify-content:center;align-items:center;cursor:pointer;}"],x.gray),he=o.p.withConfig({componentId:"sc-4616b6b1-1"})(["margin-left:8px;justify-content:center;align-items:center;",";",";> span{","}> button{margin-right:6px;}","{display:flex;",";> span{margin-left:3px;}> button{margin-right:20px;}}"],u.bold,c(12),u.medium,a.SM,c(16)),me=o.ul.withConfig({componentId:"sc-4616b6b1-2"})(["margin-bottom:38px;","{margin-bottom:56px;}"],a.SM),ge=o.li.withConfig({componentId:"sc-4616b6b1-3"})(["border-bottom:1px solid ",";margin-bottom:60px;&:last-child{margin-bottom:0px;border-bottom:1px solid ",";}"],x.gray,x.gray),xe=o.div.withConfig({componentId:"sc-4616b6b1-4"})(["margin-bottom:40px;","{margin-bottom:68px;}"],a.SM),be=o.p.withConfig({componentId:"sc-4616b6b1-5"})(["",";border-radius:var(--spacing-6);",";text-align:center;margin-bottom:21px;background-color:",";height:55px;",";","{",";}"],u.semiBold,c(14),x.lightGray,W,a.SM,c(16)),Ce=o.ul.withConfig({componentId:"sc-4616b6b1-6"})([""]),fe=o.li.withConfig({componentId:"sc-4616b6b1-7"})(["&:not(last-child){margin-bottom:12px;}"]),ue=o.div.withConfig({componentId:"sc-4616b6b1-8"})(["display:flex;justify-content:space-between;align-items:center;> label{display:flex;align-items:center;cursor:pointer;}"]),ke=o.div.withConfig({componentId:"sc-4616b6b1-9"})(["display:flex;justify-content:space-between;align-items:center;padding-bottom:12px;border-bottom:2px solid ",";> label{display:flex;align-items:center;cursor:pointer;}","{padding-bottom:13px;}"],x.black,a.SM);o.img.withConfig({componentId:"sc-4616b6b1-10"})(["width:16px;height:16px;","{width:20px;height:20px;}"],a.SM);const Te=o.p.withConfig({componentId:"sc-4616b6b1-11"})(["",";margin-left:6px;> span{",";margin-right:5px;color:",";}","{",";}"],c(14),u.bold,x.primary,a.SM,c(14)),Ie=o(Z).withConfig({componentId:"sc-4616b6b1-12"})(["display:flex;align-items:center;",";color:#838383;> span{margin-right:5px;}> img{width:9px;height:9px;}","{",";text-decoration:underline;text-underline-offset:2px;> span{margin-right:6px;}> img{width:12px;height:12px;}}"],c(12),a.SM,c(12)),ye=o.div.withConfig({componentId:"sc-4616b6b1-13"})(["overflow:auto;",";padding:10px 0 15px;> div{max-height:247px;",";span{display:inline;",";line-height:18px;}p{",";line-height:18px;}*{font:revert;}}","{padding:20px 0;> div{max-height:193px;}}"],J,Q,c(14),c(14),a.SM),je=o(V).withConfig({componentId:"sc-4616b6b1-14"})(["width:100%;",";","{",";}"],c(14),a.SM,c(16)),s={AllCheckContainer:pe,AllCheckText:he,TermList:me,TermItem:ge,OptInContainer:xe,OptInTitle:be,OptInList:Ce,OptInListItem:fe,CheckOptInContainer:ue,CheckTermContainer:ke,TermTitle:Te,ContentAllLink:Ie,TermContentContainer:ye,NextButton:je},Le=()=>{const{t:r}=X(),N=Y(),[m]=ee(),{openDialog:B}=te(),U=m.get("accessToken")??void 0,_=m.get("provider")??void 0,R=m.get("code")??void 0,D=m.get("expiry")??void 0,E=m.get("refreshToken")??void 0,G=m.get("returnUrl")??void 0,k=I.useContext(ne),j=k==null?void 0:k.isAuthenticationByPhone,{data:T}=de({searchParams:{termsTypes:[...l(e=>e.type,P)]}}),[C,A]=I.useState(()=>{const e=d(T,L,b(([,n])=>n.used),l(([n])=>n.toUpperCase()),h);return d(P,b(n=>ce(n.type,e)),h)}),[f,S]=I.useState(ae),w=M(e=>e.isChecked,[...C,...f]),H=e=>{A(n=>d(n,l(i=>({...i,isChecked:!e})),h)),S(n=>d(n,l(i=>({...i,isChecked:!e})),h))},$=e=>{A(n=>d(n,l(i=>i.type===e?{...i,isChecked:!i.isChecked}:i),h))},z=e=>{S(n=>d(n,l(i=>i.type===e?{...i,isChecked:!i.isChecked}:i),h))},K=e=>{if(!T)return"";const n=d(T,L,b(([i])=>i.toUpperCase()===e),l(([,i])=>i),re);return n?n.contents:""},{openKcpAuthRegister:q}=ie(),v=e=>{var i,g;const n=d(C,b(p=>p.isChecked),l(p=>p.type),h);N(O.SIGNUP.FORM,{state:{terms:n,smsAgreed:(i=f.find(p=>p.type==="smsAgreed"))==null?void 0:i.isChecked,directMailAgreed:(g=f.find(p=>p.type==="directMailAgreed"))==null?void 0:g.isChecked,...e}})},F=()=>{if(!d(C,b(({isRequired:n})=>n),M(({isChecked:n})=>n))){B({message:r("필수항목에 대한 동의를 체크해주세요.")});return}if(j){q();return}v({data:{provider:_,accessToken:U,refreshToken:E,code:R,expiry:D,returnUrl:G}})};return se({onNext:async e=>{if(e.provider&&e.accessToken&&e.key)try{await oe({method:"POST",url:"/profile/rename",data:{key:e.key},headers:{"Shop-By-Authorization":`Bearer ${e.accessToken}`}})}catch{}v({data:e})}}),t.jsxs("div",{children:[t.jsx(s.AllCheckContainer,{children:t.jsxs("label",{children:[t.jsx(y,{onCheckedChange:()=>H(w),checked:w,id:"allTermCheck"}),t.jsxs(s.AllCheckText,{children:[r("모든 약관을 확인하고 전체 동의합니다."),"  ",t.jsxs("span",{children:["(",r("선택정보 포함"),")"]})]})]})}),t.jsx(s.TermList,{children:C.map(({type:e,label:n,isRequired:i,isChecked:g})=>t.jsxs(s.TermItem,{children:[t.jsxs(s.CheckTermContainer,{children:[t.jsxs("label",{children:[t.jsx(y,{onCheckedChange:()=>$(e),checked:g}),t.jsxs(s.TermTitle,{children:[t.jsxs("span",{children:["[",r(i?"필수":"선택"),"]"]}),n]})]}),t.jsxs(s.ContentAllLink,{to:`${O.AUTH.TERMS.MAIN}/${e}`,children:[t.jsx("span",{children:r("전체보기")}),t.jsx(le,{})]})]}),t.jsx(s.TermContentContainer,{children:t.jsx("div",{dangerouslySetInnerHTML:{__html:K(e)}})})]},e))}),t.jsxs(s.OptInContainer,{children:[t.jsx(s.OptInTitle,{children:r("혜택/정보 수신 동의")}),t.jsx(s.OptInList,{children:f.map(({type:e,label:n,isRequired:i,isChecked:g})=>t.jsx(s.OptInListItem,{children:t.jsx(s.CheckOptInContainer,{children:t.jsxs("label",{children:[t.jsx(y,{onCheckedChange:()=>z(e),checked:g}),t.jsxs(s.TermTitle,{children:[t.jsxs("span",{children:["[",r(i?"필수":"선택"),"]"]}),r(n)]})]})})},e))})]}),t.jsx(s.NextButton,{onClick:F,children:r(j?"본인 인증하기":"다음")})]})};export{Le as default};