import{u as Me,Q as Oe,aP as L,d as N,j as e,c as i,a6 as w,G as f,aQ as S,t as A,n as I,a9 as P,T as a,aM as re,c1 as te,C as V,bJ as we,k,az as se,aE as ne,aC as O,aD as b,b0 as ie,bA as le,aR as ae,aj as de,ak as oe,aT as ce,V as Fe,w as Ue,c2 as De,c3 as Be,m as ue,a as xe,ai as he,aL as me,L as pe,U as je,E as Y,c4 as ge,bD as be,R as Ge,bz as _e,aB as Le,a8 as qe,o as H,af as Z,ar as K,ao as ye,ap as fe,aX as ve,a_ as Ae,c5 as He,s as W,c6 as Qe,c7 as Ve,W as Ye,c8 as Ze,b9 as Ke,a$ as Ce,aq as Xe,c9 as Je}from"../index.Crez7j-Y.bundle.js";import{G as X,M as J}from"./MemberClaimAPIs.Df7MVfiB.bundle.js";import{u as Q}from"./useClaimHooks.DyLDR42V.bundle.js";import{E as z}from"./ExpandSection.D-EhWsaW.bundle.js";import{M as ze}from"./MaterialStyle.eGG2fFDZ.bundle.js";import{u as er}from"./StorageAPIs.Dbq9bCDO.bundle.js";const rr=(r,n,t)=>{const{getGuestClaimOrderInfoAPI:c}=X();return Me({queryKey:Oe.guestClaimOrderInfo(r,n),queryFn:()=>c(r,n),refetchOnWindowFocus:!1,...t})},tr=(r,n,t)=>{const{getClaimOrderInfoAPI:c}=J();return Me({queryKey:Oe.memberClaimOrderInfo(r,n),queryFn:()=>c(r,n),refetchOnWindowFocus:!1,...t})};function sr(){var d,s,l,h,v,u,o,m,y,g,C,T,R,E,$,F,U,B,G,_,q;const{register:r,setValue:n,formState:{errors:t}}=L(),[c,j]=N.useState(!1),x=()=>{j(!1)},p=D=>{n("exchangeAddress.receiverZipCd",D.zipCode),n("exchangeAddress.receiverAddress",D.address),n("exchangeAddress.receiverDetailAddress",D.detailAddress),n("exchangeAddress.receiverJibunAddress",D.jibunAddress),j(!1)};return e.jsxs(i,{bgcolor:w,p:{desktop:3,mobile:0},borderRadius:2,children:[e.jsxs(f,{container:!0,direction:"column",gap:2,py:2,children:[e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(S,{variant:"subtitle1",children:"수령자명"})}),e.jsx(i,{flex:3,display:"flex",flexDirection:"column",gap:2,children:e.jsx(i,{display:"inline-flex",gap:2,alignItems:"center",flexDirection:"row",children:e.jsx(A,{...r("exchangeAddress.receiverName"),fullWidth:!0,size:"small",variant:"outlined",sx:{flex:3},error:!!((d=t.exchangeAddress)!=null&&d.receiverName),helperText:(l=(s=t.exchangeAddress)==null?void 0:s.receiverName)==null?void 0:l.message})})})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",children:e.jsx(i,{children:e.jsx(S,{variant:"subtitle1",children:"배송지 주소"})})}),e.jsxs(i,{flex:3,display:"flex",flexDirection:"column",gap:2,children:[e.jsxs(i,{display:"inline-flex",gap:2,alignItems:"center",flexDirection:"row",children:[e.jsx(A,{...r("exchangeAddress.receiverZipCd"),size:"small",disabled:!0,inputProps:{readOnly:!0},sx:{flex:{desktop:3,mobile:1},bgcolor:I},error:!!((h=t.exchangeAddress)!=null&&h.receiverZipCd),helperText:(u=(v=t.exchangeAddress)==null?void 0:v.receiverZipCd)==null?void 0:u.message}),e.jsx(P,{variant:"outlined",color:"inherit",sx:{flex:1},onClick:()=>j(!0),children:"우편번호 검색"})]}),e.jsx(A,{...r("exchangeAddress.receiverAddress"),fullWidth:!0,size:"small",disabled:!0,inputProps:{readOnly:!0},sx:{bgcolor:I},error:!!((o=t.exchangeAddress)!=null&&o.receiverAddress),helperText:(y=(m=t.exchangeAddress)==null?void 0:m.receiverAddress)==null?void 0:y.message}),e.jsx(A,{...r("exchangeAddress.receiverDetailAddress"),fullWidth:!0,name:"receiverDetailAddress",size:"small",placeholder:"상세주소를 입력해 주세요.",error:!!((g=t.exchangeAddress)!=null&&g.receiverDetailAddress),helperText:(T=(C=t.exchangeAddress)==null?void 0:C.receiverDetailAddress)==null?void 0:T.message})]})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(S,{variant:"subtitle1",children:"휴대폰 번호"})}),e.jsx(i,{flex:3,children:e.jsx(A,{...r("exchangeAddress.receiverContact1"),fullWidth:!0,size:"small",variant:"outlined",placeholder:"휴대폰번호 - 없이 입력",error:!!((R=t.exchangeAddress)!=null&&R.receiverContact1),helperText:($=(E=t.exchangeAddress)==null?void 0:E.receiverContact1)==null?void 0:$.message})})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(a,{variant:"subtitle1",children:"전화번호"})}),e.jsx(i,{flex:3,children:e.jsx(A,{...r("exchangeAddress.receiverContact2"),fullWidth:!0,size:"small",variant:"outlined",placeholder:"전화번호 - 없이 입력",error:!!((F=t.exchangeAddress)!=null&&F.receiverContact2),helperText:(B=(U=t.exchangeAddress)==null?void 0:U.receiverContact2)==null?void 0:B.message})})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(a,{variant:"subtitle1",children:"배송 참고사항"})}),e.jsx(i,{flex:3,children:e.jsx(A,{...r("exchangeAddress.deliveryMemo"),fullWidth:!0,size:"small",variant:"outlined",placeholder:"배송 시 요청사항을 입력해 주세요.",error:!!((G=t.exchangeAddress)!=null&&G.deliveryMemo),helperText:(q=(_=t.exchangeAddress)==null?void 0:_.deliveryMemo)==null?void 0:q.message})})]})]}),e.jsx(re,{}),e.jsx(te,{children:e.jsx(a,{variant:"body",color:V,children:"결제하신 수단에 따라 취소 방법이 다를 수 있습니다."})}),e.jsx(we,{open:c,onModalClose:x,onAddressSelect:p})]})}function nr(r){var o,m,y,g,C,T,R,E,$,F,U,B,G,_,q,D,Te,Pe,ke,Se,Ie,Re,We;const{deliveryCompanyTypeWithLabels:n,returnWarehouse:t}=r,{register:c,control:j,setValue:x,watch:p,formState:{errors:d}}=L(),[s,l]=N.useState(!1),h=()=>{l(!1)},v=M=>{x("returnAddress.receiverZipCd",M.zipCode),x("returnAddress.receiverAddress",M.address),x("returnAddress.receiverDetailAddress",M.detailAddress),x("returnAddress.receiverJibunAddress",M.jibunAddress),l(!1)},u=p("returnWayType");return e.jsxs(i,{bgcolor:w,p:{desktop:3,mobile:0},borderRadius:2,children:[e.jsx(f,{container:!0,direction:"column",gap:2,py:2,children:u==="SELLER_COLLECT"?e.jsxs(e.Fragment,{children:[e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(S,{variant:"subtitle1",children:"반품자명"})}),e.jsx(i,{flex:3,display:"flex",flexDirection:"column",gap:2,children:e.jsx(i,{display:"inline-flex",gap:2,alignItems:"center",flexDirection:"row",children:e.jsx(A,{...c("returnAddress.receiverName"),fullWidth:!0,size:"small",variant:"outlined",error:!!((o=d.returnAddress)!=null&&o.receiverName),helperText:(y=(m=d.returnAddress)==null?void 0:m.receiverName)==null?void 0:y.message})})})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",children:e.jsx(i,{children:e.jsx(S,{variant:"subtitle1",children:"수거지 주소"})})}),e.jsxs(i,{flex:3,display:"flex",flexDirection:"column",gap:2,children:[e.jsxs(i,{display:"inline-flex",gap:2,alignItems:"center",flexDirection:"row",children:[e.jsx(A,{...c("returnAddress.receiverZipCd"),size:"small",disabled:!0,inputProps:{readOnly:!0},sx:{flex:{desktop:3,mobile:1},bgcolor:I},error:!!((g=d.returnAddress)!=null&&g.receiverZipCd),helperText:(T=(C=d.returnAddress)==null?void 0:C.receiverZipCd)==null?void 0:T.message}),e.jsx(P,{variant:"outlined",color:"inherit",sx:{flex:1},onClick:()=>l(!0),children:"우편번호 검색"})]}),e.jsx(A,{...c("returnAddress.receiverAddress"),size:"small",disabled:!0,fullWidth:!0,inputProps:{readOnly:!0},sx:{bgcolor:I},error:!!((R=d.returnAddress)!=null&&R.receiverAddress),helperText:($=(E=d.returnAddress)==null?void 0:E.receiverAddress)==null?void 0:$.message}),e.jsx(A,{...c("returnAddress.receiverDetailAddress"),fullWidth:!0,size:"small",placeholder:"상세주소를 입력해 주세요.",error:!!((F=d.returnAddress)!=null&&F.receiverDetailAddress),helperText:(B=(U=d.returnAddress)==null?void 0:U.receiverDetailAddress)==null?void 0:B.message})]})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(S,{variant:"subtitle1",children:"휴대폰 번호"})}),e.jsx(i,{flex:3,children:e.jsx(A,{...c("returnAddress.receiverContact1"),fullWidth:!0,size:"small",variant:"outlined",placeholder:"휴대폰번호 - 없이 입력",error:!!((G=d.returnAddress)!=null&&G.receiverContact1),helperText:(q=(_=d.returnAddress)==null?void 0:_.receiverContact1)==null?void 0:q.message})})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(a,{variant:"subtitle1",children:"전화번호"})}),e.jsx(i,{flex:3,children:e.jsx(A,{...c("returnAddress.receiverContact2"),fullWidth:!0,size:"small",variant:"outlined",placeholder:"전화번호 - 없이 입력",error:!!((D=d.returnAddress)!=null&&D.receiverContact2),helperText:(Pe=(Te=d.returnAddress)==null?void 0:Te.receiverContact2)==null?void 0:Pe.message})})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(a,{variant:"subtitle1",children:"수거 참고사항"})}),e.jsx(i,{flex:3,children:e.jsx(A,{...c("returnAddress.deliveryMemo"),fullWidth:!0,size:"small",variant:"outlined",placeholder:"수거 시 요청사항을 입력해 주세요.",error:!!((ke=d.returnAddress)!=null&&ke.deliveryMemo),helperText:(Ie=(Se=d.returnAddress)==null?void 0:Se.deliveryMemo)==null?void 0:Ie.message})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(a,{variant:"subtitle1",children:"반품 주소지"})}),e.jsx(i,{flex:3,p:2,border:"1px solid ".concat(k),children:e.jsx(se,{size:"small",sx:{"& td":{borderBottom:"none"}},children:e.jsxs(ne,{children:[e.jsxs(O,{children:[e.jsx(b,{width:"20%",children:e.jsx(a,{variant:"subtitle1",fontWeight:400,children:"이름"})}),e.jsx(b,{width:"80%",children:e.jsx(a,{variant:"subtitle1",fontWeight:400,children:"InBody"})})]}),e.jsxs(O,{children:[e.jsx(b,{children:e.jsx(a,{variant:"subtitle1",fontWeight:400,children:"주소"})}),e.jsx(b,{children:e.jsx(a,{variant:"subtitle1",fontWeight:400,children:t==null?void 0:t.summary})})]}),e.jsxs(O,{children:[e.jsx(b,{children:e.jsx(a,{variant:"subtitle1",fontWeight:400,children:"전화번호"})}),e.jsx(b,{children:e.jsx(a,{variant:"subtitle1",fontWeight:400,children:t==null?void 0:t.contact})})]})]})})})]}),e.jsx(f,{item:!0,desktop:12,mobile:12,container:!0,children:n&&e.jsxs(e.Fragment,{children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(a,{variant:"subtitle1",children:"반품 접수 정보"})}),e.jsxs(i,{flex:3,display:"flex",gap:2,children:[e.jsxs(ie,{size:"small",sx:{flex:1},error:!!d.deliveryCompanyType,children:[e.jsx(le,{id:"delivery-company-select-label",children:e.jsx(a,{variant:"body",children:"택배사를 선택해주세요."})}),e.jsx(ae,{name:"deliveryCompanyType",control:j,render:({field:M})=>{var Ee;return e.jsx(de,{...M,label:"택배사를 선택해주세요.",value:(Ee=M.value)!=null?Ee:"",MenuProps:{PaperProps:{style:{maxHeight:ze}}},children:n.map(ee=>e.jsx(oe,{value:ee.deliveryCompanyType,children:e.jsx(a,{variant:"body",children:ee.label})},ee.deliveryCompanyType))})}}),e.jsx(ce,{children:(Re=d.deliveryCompanyType)==null?void 0:Re.message})]}),e.jsx(i,{flex:2,children:e.jsx(A,{...c("invoiceNo"),fullWidth:!0,size:"small",variant:"outlined",placeholder:"반품 운송장 번호를 입력해주세요.",error:!!d.invoiceNo,helperText:(We=d.invoiceNo)==null?void 0:We.message})})]})]})})]})}),e.jsx(re,{}),e.jsx(te,{children:e.jsx(a,{variant:"body",color:V,children:"결제하신 수단에 따라 취소 방법이 다를 수 있습니다."})}),e.jsx(we,{open:s,onModalClose:h,onAddressSelect:v})]})}function ir({showClaimReason:r,showFileAttachment:n}){var m,y;const t=N.useRef(null),{getClaimReasons:c}=Q(),j=c(),{register:x,setValue:p,control:d,formState:{errors:s}}=L(),{uploadedFiles:l,deleteUploadFile:h,IMAGE_ACCEPTS:v,imageFilesUploadAsync:u}=er();N.useEffect(()=>{const g=l.map(C=>C.imageUrl);p("claimImageUrls",g)},[l]);const o=ue.첨부파일;return e.jsxs(i,{bgcolor:w,p:{desktop:3,mobile:0},borderRadius:2,children:[e.jsxs(f,{container:!0,direction:"column",gap:2,py:2,children:[r&&e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(S,{variant:"subtitle1",children:"사유"})}),e.jsxs(ie,{fullWidth:!0,size:"small",sx:{flex:3},error:!!s.claimReasonType,children:[e.jsx(le,{id:"claim-reason-select-label",children:e.jsx(a,{variant:"body",children:"사유를 선택해주세요."})}),e.jsx(ae,{name:"claimReasonType",control:d,render:({field:g})=>{var C;return e.jsx(de,{...g,value:(C=g.value)!=null?C:"",label:"사유를 선택해주세요.",children:j.map(T=>e.jsx(oe,{value:T.claimReasonType,children:e.jsx(a,{variant:"subtitle1",fontWeight:400,children:T.label})},T.claimReasonType))})}}),e.jsx(ce,{children:(m=s.claimReasonType)==null?void 0:m.message})]})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(S,{variant:"subtitle1",children:"상세 사유"})}),e.jsx(A,{...x("claimReasonDetail"),sx:{flex:3},fullWidth:!0,multiline:!0,minRows:5,maxRows:5,variant:"outlined",error:!!s.claimReasonDetail,helperText:(y=s.claimReasonDetail)==null?void 0:y.message})]}),n&&e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(a,{variant:"subtitle1",children:"첨부파일"})}),e.jsxs(i,{flex:3,children:[e.jsx("input",{accept:v,style:{display:"none"},id:"image-file-upload",ref:t,multiple:!0,type:"file",onChange:u}),e.jsx(P,{type:"button",variant:"outlined",color:"inherit",onClick:()=>{var g;return(g=t.current)==null?void 0:g.click()},children:e.jsx(a,{variant:"button",children:"사진 첨부하기"})}),l.length>0&&e.jsx(Fe,{sx:{py:2,px:0,display:"flex",justifyContent:"start",flexWrap:"wrap",gap:2},children:l.map(g=>e.jsxs(Ue,{sx:{display:"inline-block",width:"auto",p:0,position:"relative"},children:[e.jsx("img",{src:"".concat(g.imageUrl,"?").concat(o,"x").concat(o),alt:g.originalFileName,width:o,height:o,style:{border:"1px solid ".concat(k),objectFit:"contain",aspectRatio:"1/1"}}),e.jsx(P,{sx:{position:"absolute",p:0,top:0,minWidth:0,color:w,"&:hover":{bgcolor:De},right:0,bgcolor:De},onClick:()=>h(g.imageUrl),children:e.jsx(Be,{})})]}))})]})]})]}),e.jsx(re,{}),e.jsx(te,{children:e.jsx(a,{variant:"body",color:V,children:"고객님의 귀책 사유로 상품 등이 훼손 또는 멸실 된 경우 반품/교환 제한(불가) 및 비용이 발생될 수 있습니다."})})]})}function lr({availableBanks:r}){var x,p,d,s,l,h,v,u,o;const{register:n,control:t,setValue:c,formState:{errors:j}}=L();return e.jsx(i,{bgcolor:w,p:{desktop:3,mobile:0},borderRadius:2,children:e.jsxs(f,{container:!0,direction:"column",gap:2,py:2,children:[e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(S,{variant:"subtitle1",children:"은행"})}),e.jsxs(ie,{fullWidth:!0,size:"small",sx:{flex:3},error:!!((x=j.bankAccountInfo)!=null&&x.bank),children:[e.jsx(le,{id:"bank-select-label",children:e.jsx(a,{variant:"body",children:"은행을 선택해주세요."})}),e.jsx(ae,{name:"bankAccountInfo.bank",control:t,render:({field:m})=>{var y;return e.jsx(de,{...m,label:"은행을 선택해주세요.",value:(y=m.value)!=null?y:"",onChange:g=>{var R;const C=g.target.value,T=r.find(E=>E.bank===C);m.onChange(C),c("bankAccountInfo.bankName",(R=T==null?void 0:T.label)!=null?R:"")},MenuProps:{PaperProps:{style:{maxHeight:ze}}},children:r.map(g=>e.jsx(oe,{value:g.bank,children:e.jsx(a,{variant:"body",children:g.label})},g.bank))})}}),e.jsx(ce,{children:(d=(p=j.bankAccountInfo)==null?void 0:p.bank)==null?void 0:d.message})]})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(S,{variant:"subtitle1",children:"계좌번호"})}),e.jsx(A,{...n("bankAccountInfo.bankAccount"),fullWidth:!0,size:"small",sx:{flex:3},variant:"outlined",placeholder:"계좌번호 - 없이 입력",error:!!((s=j.bankAccountInfo)!=null&&s.bankAccount),helperText:(h=(l=j.bankAccountInfo)==null?void 0:l.bankAccount)==null?void 0:h.message})]}),e.jsxs(f,{item:!0,desktop:12,mobile:12,container:!0,children:[e.jsx(i,{flex:1,display:"flex",alignItems:"center",children:e.jsx(S,{variant:"subtitle1",children:"예금주"})}),e.jsx(A,{...n("bankAccountInfo.bankDepositorName"),fullWidth:!0,size:"small",sx:{flex:3},variant:"outlined",placeholder:"예금주를 입력해주세요.",error:!!((v=j.bankAccountInfo)!=null&&v.bankDepositorName),helperText:(o=(u=j.bankAccountInfo)==null?void 0:u.bankDepositorName)==null?void 0:o.message})]})]})})}const $e=r=>{const{isDesktop:n,isMobile:t}=xe(),{watch:c}=L(),x=(c("claimedProductOptions")||[]).some(p=>p.orderProductOptionNo===r.claimableOption.orderOptionNo);return e.jsxs(e.Fragment,{children:[n&&e.jsx(ar,{...r,isSelected:x}),t&&e.jsx(dr,{...r,isSelected:x})]})};function ar(r){const{isSelected:n,claimableOption:t,index:c,length:j,onQuantityChange:x,onToggleProductOption:p}=r,d=t.orderCnt,[s,l]=N.useState(d),h=ue.클레임제품,{formatPriceWithCommas:v}=he(),{getClaimStatusTypeLabel:u}=Q(),o=m=>{m<=0||m>d||(l(m),x(t.orderOptionNo,m))};return e.jsxs(O,{children:[c===0&&e.jsxs(b,{rowSpan:j,align:"center",children:[e.jsx(a,{variant:"body",component:"p",fontWeight:500,children:me(t.orderStatusDate.registerYmdt).format("YYYY-MM-DD")}),e.jsx(pe,{variant:"small",href:"".concat(je.ORDER_DETAIL,"?orderNo=").concat(t.orderNo),children:t.orderNo})]}),e.jsx(b,{align:"center",children:e.jsx(Y,{checked:n,onChange:m=>p(t.orderOptionNo,t.orderCnt,m.target.checked)})}),e.jsx(b,{children:e.jsxs(i,{display:"flex",gap:1,children:[e.jsx("img",{src:"".concat(t.imageUrl,"?").concat(h,"x").concat(h),alt:t.optionName,width:h,height:h,style:{border:"1px solid ".concat(k)}}),e.jsxs(i,{display:"flex",flexDirection:"column",justifyContent:"center",gap:1,children:[e.jsx(a,{variant:"small",children:t.brandName}),e.jsx(a,{variant:"body",fontWeight:500,children:t.productName}),e.jsx(a,{variant:"small",children:t.optionTitle})]})]})}),e.jsx(b,{align:"center",children:e.jsx(a,{variant:"body",fontWeight:500,children:"".concat(t.orderCnt,"개")})}),e.jsx(b,{align:"center",children:e.jsx(a,{variant:"body",fontWeight:500,children:v(t.price.buyAmt,"WON")})}),e.jsx(b,{align:"center",children:e.jsx(a,{variant:"body",children:u(t.orderStatusType)})}),e.jsx(b,{children:e.jsxs(i,{display:"flex",justifyContent:"center",children:[e.jsx(P,{size:"small",color:"inherit",sx:{minWidth:30,height:30,borderRadius:0,border:"1px solid ".concat(k)},onClick:()=>o(s-1),children:e.jsx(ge,{fontSize:"small"})}),e.jsx(A,{size:"small",sx:{"& .MuiInputBase-root":{borderRadius:0,height:30},"& .MuiInputBase-input":{p:0,textAlign:"center"},bgcolor:I},disabled:!0,variant:"outlined",value:s}),e.jsx(P,{size:"small",color:"inherit",sx:{minWidth:30,height:30,borderRadius:0,border:"1px solid ".concat(k)},onClick:()=>o(s+1),children:e.jsx(be,{fontSize:"small"})})]})})]})}function dr(r){const{claimableOption:n,isSelected:t,onQuantityChange:c,onToggleProductOption:j}=r,x=n.orderCnt,[p,d]=N.useState(x),s=_e.클레임제품,{formatPriceWithCommas:l}=he(),{getClaimStatusTypeLabel:h}=Q(),v=u=>{u<=0||u>x||(d(u),c(n.orderOptionNo,u))};return e.jsxs(i,{py:2,borderBottom:"1px solid ".concat(k),children:[e.jsxs(i,{display:"flex",gap:1,alignItems:"center",children:[e.jsx(Y,{sx:{p:0},checked:t,onChange:u=>j(n.orderOptionNo,n.orderCnt,u.target.checked)}),e.jsxs(pe,{sx:{display:"flex",gap:1,alignItems:"center"},href:"".concat(je.PRODUCT_DETAIL,"?productNo=").concat(n.productNo),underline:"none",children:[e.jsx(i,{display:"flex",flexDirection:"column",alignItems:"center",sx:{border:"1px solid ".concat(k)},children:e.jsx("img",{src:"".concat(n.imageUrl,"?").concat(s,"x").concat(s),alt:n.optionName,width:s,height:s})}),e.jsxs(i,{display:"flex",flexDirection:"column",width:"100%",children:[e.jsx(a,{variant:"body",children:n.brandName}),e.jsx(a,{variant:"subtitle1",children:n.productName}),e.jsx(a,{variant:"body",children:n.optionTitle})]})]})]}),e.jsxs(i,{display:"flex",flexDirection:"column",alignItems:"flex-end",children:[e.jsxs(i,{display:"flex",gap:1,children:[e.jsx(a,{variant:"subtitle1",color:Ge,children:h(n.orderStatusType)}),e.jsx(a,{variant:"subtitle1",children:"\n ".concat(l(n.price.buyAmt,"WON")," / ").concat(n.orderCnt," 개")})]}),e.jsxs(i,{display:"flex",alignItems:"center",justifyContent:"space-between",width:150,children:[e.jsx(P,{size:"small",color:"inherit",sx:{minWidth:30,height:30,borderRadius:0,border:"1px solid ".concat(k),bgcolor:I},onClick:()=>v(p-1),children:e.jsx(ge,{fontSize:"small"})}),e.jsx(A,{size:"small",inputProps:{style:{textAlign:"center"}},sx:{"& .MuiInputBase-root":{borderRadius:0,height:30},"& .MuiInputBase-input":{p:0,textAlign:"center"},bgcolor:I},disabled:!0,value:p}),e.jsx(P,{size:"small",color:"inherit",sx:{minWidth:30,height:30,borderRadius:0,border:"1px solid ".concat(k),bgcolor:I},onClick:()=>v(p+1),children:e.jsx(be,{fontSize:"small"})})]})]})]})}function or(r){const{originalOption:n,claimableOptions:t}=r,c=N.useMemo(()=>n&&t?[n,...t]:[],[n,t]),{watch:j,setValue:x}=L(),p=j("claimedProductOptions")||[],d=p.length===c.length,s=(o,m)=>{const y=p.map(g=>g.orderProductOptionNo===o?{...g,productCnt:m}:g);x("claimedProductOptions",y)},l=(o,m,y)=>{if(y){const g=[...p,{orderProductOptionNo:o,productCnt:m}];x("claimedProductOptions",g)}else{const g=p.filter(C=>C.orderProductOptionNo!==o);x("claimedProductOptions",g)}},h=(o,m)=>{if(m){const y=c.map(g=>({orderProductOptionNo:g.orderOptionNo,productCnt:g.orderCnt}));x("claimedProductOptions",y);return}x("claimedProductOptions",[])},{isDesktop:v,isMobile:u}=xe();return e.jsxs(i,{bgcolor:w,p:{desktop:3,mobile:0},borderRadius:2,children:[v&&e.jsx(cr,{...r,claimableOption:c,selectedAllProductOptions:d,onToggleAllProductOptions:h,onToggleProductOption:l,onChangeOptionQuantity:s}),u&&e.jsx(ur,{...r,claimableOption:c,selectedAllProductOptions:d,onToggleAllProductOptions:h,onToggleProductOption:l,onChangeOptionQuantity:s})]})}function cr(r){const{claimableOption:n,selectedAllProductOptions:t,onToggleAllProductOptions:c,claimType:j,onToggleProductOption:x,onChangeOptionQuantity:p}=r,d={RETURN:"반품 수량",EXCHANGE:"교환 수량",CANCEL:"취소 수량"};return e.jsxs(se,{size:"small",sx:{"& th":{py:1,px:0,bgcolor:I},"& td":{px:0}},children:[e.jsx(Le,{children:e.jsxs(O,{children:[e.jsx(b,{align:"center",width:150,children:e.jsx(a,{variant:"body",fontWeight:500,children:"주문일자(주문번호)"})}),e.jsx(b,{align:"center",width:40,children:e.jsx(Y,{sx:{py:0},checked:t,onChange:c})}),e.jsx(b,{align:"center",width:320,children:e.jsx(a,{variant:"body",fontWeight:500,children:"상품 정보"})}),e.jsx(b,{align:"center",width:60,children:e.jsx(a,{variant:"body",fontWeight:500,children:"수량"})}),e.jsx(b,{align:"center",width:100,children:e.jsx(a,{variant:"body",fontWeight:500,children:"상품금액"})}),e.jsx(b,{align:"center",width:100,children:e.jsx(a,{variant:"body",fontWeight:500,children:"진행상태"})}),e.jsx(b,{align:"center",width:120,children:e.jsx(a,{variant:"body",fontWeight:500,children:d[j]})})]})}),e.jsx(ne,{children:n.map((s,l,h)=>e.jsx($e,{index:l,length:h.length,claimableOption:s,onToggleProductOption:x,onQuantityChange:p},s.orderOptionNo))})]})}function ur(r){const{claimableOption:n,selectedAllProductOptions:t,onToggleAllProductOptions:c,onToggleProductOption:j,onChangeOptionQuantity:x}=r,p=n[0].orderNo,d=n[0].orderStatusDate.registerYmdt;return e.jsxs(e.Fragment,{children:[e.jsxs(i,{display:"flex",alignItems:"center",gap:2,borderBottom:"2px solid ".concat(qe),mb:1,children:[e.jsx(Y,{sx:{px:0},checked:t,onChange:c}),e.jsx(a,{variant:"subtitle1",children:me(d).format("YYYY-MM-DD")}),e.jsx(a,{variant:"subtitle1",color:V,children:p})]}),n.map((s,l,h)=>e.jsx($e,{index:l,length:h.length,claimableOption:s,onToggleProductOption:j,onQuantityChange:x},s.orderOptionNo))]})}function xr({originalOption:r,isPending:n}){const{setValue:t}=L(),{formatPriceWithCommas:c}=he(),{getClaimStatusTypeLabel:j}=Q(),x=(r==null?void 0:r.orderCnt)||1,[p,d]=N.useState(x),s=h=>{h<=0||h>x||(d(h),t("productCnt",h),t("exchangeOption.orderCnt",h))},l=ue.클레임제품;return e.jsx(i,{bgcolor:w,p:{desktop:3,mobile:0},borderRadius:2,children:e.jsxs(se,{size:"small",sx:{"& th":{py:1,px:0,bgcolor:I},"& td":{px:0}},children:[e.jsx(Le,{children:e.jsxs(O,{children:[e.jsx(b,{align:"center",width:150,children:e.jsx(a,{variant:"body",fontWeight:500,children:"주문일자(주문번호)"})}),e.jsx(b,{align:"center",width:320,children:e.jsx(a,{variant:"body",fontWeight:500,children:"상품 정보"})}),e.jsx(b,{align:"center",width:60,children:e.jsx(a,{variant:"body",fontWeight:500,children:"수량"})}),e.jsx(b,{align:"center",width:100,children:e.jsx(a,{variant:"body",fontWeight:500,children:"상품금액"})}),e.jsx(b,{align:"center",width:100,children:e.jsx(a,{variant:"body",fontWeight:500,children:"진행상태"})}),e.jsx(b,{align:"center",width:120,children:e.jsx(a,{variant:"body",fontWeight:500,children:"교환 수량"})})]})}),e.jsx(ne,{children:e.jsxs(O,{children:[e.jsxs(b,{align:"center",children:[e.jsx(a,{variant:"body",component:"p",fontWeight:500,children:me(r==null?void 0:r.orderStatusDate.registerYmdt).format("YYYY-MM-DD")}),e.jsx(pe,{variant:"small",href:"".concat(je.ORDER_DETAIL,"?orderNo=").concat(r==null?void 0:r.orderNo),children:r==null?void 0:r.orderNo})]}),e.jsx(b,{children:e.jsxs(i,{display:"flex",gap:1,children:[r&&e.jsx("img",{src:"".concat(r.imageUrl,"?").concat(l,"x").concat(l),alt:r.optionName,width:l,height:l}),e.jsxs(i,{display:"flex",flexDirection:"column",justifyContent:"center",gap:1,children:[e.jsx(a,{variant:"small",children:r==null?void 0:r.brandName}),e.jsx(a,{variant:"body",fontWeight:500,children:r==null?void 0:r.productName}),e.jsx(a,{variant:"small",children:r==null?void 0:r.optionTitle})]})]})}),e.jsx(b,{align:"center",children:e.jsx(a,{variant:"body",fontWeight:500,children:r==null?void 0:r.orderCnt})}),e.jsx(b,{align:"center",children:e.jsx(a,{variant:"body",fontWeight:500,children:c((r==null?void 0:r.price.buyAmt)||0,"WON")})}),e.jsx(b,{align:"center",children:r?j(r.orderStatusType):""}),e.jsx(b,{children:e.jsxs(i,{display:"flex",justifyContent:"center",children:[e.jsx(P,{size:"small",color:"inherit",sx:{minWidth:30,height:30,borderRadius:0,border:"1px solid ".concat(k)},onClick:()=>s(p-1),children:e.jsx(ge,{fontSize:"small"})}),e.jsx(A,{size:"small",sx:{"& .MuiInputBase-root":{borderRadius:0,height:30,minWidth:50},"& .MuiInputBase-input":{p:0,textAlign:"center"},bgcolor:I},disabled:!0,variant:"outlined",value:p}),e.jsx(P,{size:"small",color:"inherit",sx:{minWidth:30,height:30,borderRadius:0,border:"1px solid ".concat(k)},onClick:()=>s(p+1),children:e.jsx(be,{fontSize:"small"})})]})})]})})]})})}function hr({claimTypeLabel:r}){const n=H(),t=()=>{n(-1)};return e.jsxs(f,{desktop:6,mobile:11,mx:"auto",container:!0,wrap:"nowrap",gap:2,mb:10,children:[e.jsx(P,{fullWidth:!0,variant:"outlined",color:"inherit",onClick:t,sx:{py:1.5},children:e.jsx(a,{variant:"button",children:"취소"})}),e.jsx(P,{fullWidth:!0,type:"submit",variant:"contained",color:"error",sx:{py:1.5},children:e.jsx(a,{variant:"button",children:"".concat(r," 신청")})})]})}function mr(r){const n=Z(K,u=>u.isLogin),{createGuestCancelClaimAPI:t}=X(),{createMemberCancelClaimAPI:c}=J(),j=n?c:t,x=ye(),p=fe({mutationFn:u=>j(u),onSuccess:()=>{x.invalidateQueries({queryKey:["OrderList"]}),x.invalidateQueries({queryKey:["OrderDetail"]})}}),d=ve({resolver:Ae(He),defaultValues:{claimReasonType:void 0,claimReasonDetail:void 0,claimedProductOptions:void 0,claimType:"CANCEL",saveBankAccountInfo:!1,refundsImmediately:!0,bankAccountInfo:null,responsibleObjectType:null}}),{setValue:s}=d,l=N.useRef(!1);N.useEffect(()=>{if(r){const u=r.originalOption,o=[{productCnt:u.orderCnt,orderProductOptionNo:u.orderOptionNo}];s("claimedProductOptions",o),l.current=!0}},[r]);const h=H();return{onSubmitAsync:async u=>{if(!p.isPending)try{await p.mutateAsync(u),W("success","취소 신청이 완료되었습니다.\n 취소관련 정보는 마이페이지의 취소/반품/교환 내역에서 확인 가능합니다."),h(-1)}catch(o){W("error","취소 신청 중 오류가 발생했습니다. 다시 시도해 주시거나 고객센터로 문의해 주세요.")}},methods:d}}function pr(r){const n=Z(K,u=>u.isLogin),{createGuestExchangeClaimAPI:t}=X(),{createMemberExchangeClaimAPI:c}=J(),j=n?c:t,x=ye(),p=fe({mutationFn:({orderOptionNo:u,request:o})=>j(u,o),onSuccess:()=>{x.invalidateQueries({queryKey:["OrderList"]}),x.invalidateQueries({queryKey:["OrderDetail"]})}}),d=ve({resolver:Ae(Qe),defaultValues:{claimReasonType:void 0,claimReasonDetail:void 0,orderOptionNo:void 0,productCnt:void 0,exchangeOption:void 0,returnWayType:"SELLER_COLLECT",saveBankAccountInfo:!1,returnAddress:null,exchangeAddress:null,responsibleObjectType:null,additionalPayRemitter:null,bankAccountInfo:null,orderStatusType:null,deliveryCompanyType:null,claimImageUrls:null,additionalPayBankAccount:null,additionalPayType:null,invoiceNo:null}}),{setValue:s}=d,l=N.useRef(!1);N.useEffect(()=>{if(r){const u=r.originalOption;s("productCnt",u.orderCnt),s("orderOptionNo",u.orderOptionNo),s("exchangeOption.optionNo",u.optionNo),s("exchangeOption.orderCnt",u.orderCnt),s("exchangeOption.additionalProductNo",u.additionalProductNo),s("exchangeOption.productNo",u.productNo),s("exchangeOption.inputTexts",u.inputs);const o=r.returnAddress;o&&(s("returnAddress.receiverName",o.receiverName),s("returnAddress.countryCd",o.countryCd),s("returnAddress.receiverZipCd",o.receiverZipCd),s("returnAddress.receiverAddress",o.receiverAddress),s("returnAddress.receiverDetailAddress",o.receiverDetailAddress),s("returnAddress.receiverContact1",o.receiverContact1),s("returnAddress.receiverContact2",o.receiverContact2),s("returnAddress.customsIdNumber",o.customsIdNumber),s("returnAddress.countryCd",o.countryCd),s("returnAddress.receiverCity",null),s("returnAddress.receiverFirstName",null),s("returnAddress.receiverJibunAddress",null),s("returnAddress.receiverLastName",null),s("returnAddress.receiverState",null));const m=r.exchangeAddress;m&&(s("exchangeAddress.receiverName",m.receiverName),s("exchangeAddress.countryCd",m.countryCd),s("exchangeAddress.receiverZipCd",m.receiverZipCd),s("exchangeAddress.receiverAddress",m.receiverAddress),s("exchangeAddress.receiverDetailAddress",m.receiverDetailAddress),s("exchangeAddress.receiverContact1",m.receiverContact1),s("exchangeAddress.receiverContact2",m.receiverContact2),s("exchangeAddress.customsIdNumber",m.customsIdNumber),s("exchangeAddress.countryCd",m.countryCd),s("exchangeAddress.receiverCity",null),s("exchangeAddress.receiverFirstName",null),s("exchangeAddress.receiverJibunAddress",null),s("exchangeAddress.receiverLastName",null),s("exchangeAddress.receiverState",null)),l.current=!0}},[r]);const h=H();return{onSubmitAsync:async u=>{if(!p.isPending)try{const{orderOptionNo:o,...m}=u;await p.mutateAsync({orderOptionNo:o,request:m}),await W("success","교환 신청이 완료되었습니다.\n 교환관련 정보는 마이페이지의 취소/반품/교환 내역에서 확인 가능합니다."),h(-1)}catch(o){W("error","교환 신청 중 오류가 발생했습니다. 다시 시도해 주시거나 고객센터로 문의해 주세요.")}},methods:d}}function jr(r){const n=Z(K,o=>o.isLogin),{createGuestReturnClaimAPI:t}=X(),{createMemberReturnClaimAPI:c}=J(),j=n?c:t,x=ye(),p=fe({mutationFn:o=>j(o),onSuccess:()=>{x.invalidateQueries({queryKey:["OrderList"]}),x.invalidateQueries({queryKey:["OrderDetail"]})}}),d=Ve(r.payType==="VIRTUAL_ACCOUNT"),s=ve({resolver:Ae(d),defaultValues:{claimReasonType:void 0,claimReasonDetail:void 0,claimedProductOptions:void 0,returnAddress:void 0,claimType:"RETURN",returnWayType:"SELLER_COLLECT",saveBankAccountInfo:!1,claimImageUrls:null,bankAccountInfo:null,responsibleObjectType:null,deliveryCompanyType:null,invoiceNo:null}}),{setValue:l}=s,h=N.useRef(!1);N.useEffect(()=>{if(r){const o=r.originalOption,m=[{productCnt:o.orderCnt,orderProductOptionNo:o.orderOptionNo}];l("claimedProductOptions",m);const y=r.returnAddress;y&&(l("returnAddress.receiverName",y.receiverName),l("returnAddress.countryCd",y.countryCd),l("returnAddress.receiverZipCd",y.receiverZipCd),l("returnAddress.receiverAddress",y.receiverAddress),l("returnAddress.receiverDetailAddress",y.receiverDetailAddress),l("returnAddress.receiverContact1",y.receiverContact1),l("returnAddress.receiverContact2",y.receiverContact2),l("returnAddress.customsIdNumber",y.customsIdNumber),l("returnAddress.countryCd",y.countryCd),l("returnAddress.receiverCity",null),l("returnAddress.receiverFirstName",null),l("returnAddress.receiverJibunAddress",null),l("returnAddress.receiverLastName",null),l("returnAddress.receiverState",null)),h.current=!0}},[r]);const v=H();return{methods:s,onSubmitAsync:async o=>{if(!p.isPending)try{await p.mutateAsync(o),W("success","반품 신청이 완료되었습니다.\n 반품관련 정보는 마이페이지의 취소/반품/교환 내역에서 확인 가능합니다."),v(-1)}catch(m){W("error","반품 신청 중 오류가 발생했습니다. 다시 시도해 주시거나 고객센터로 문의해 주세요.")}}}}function Pr(){const r=H(),[n]=Ye(),t=n.get("orderOptionNo"),c=n.get("claimType"),j=Ze.safeParse(c).data;if(!(t!==null&&!isNaN(Number(t))&&Number(t)>0)||!j)return W("error","잘못된 접근입니다."),r(-1),null;const p=Number(t),d=Z(K,h=>h.isLogin),{data:s,isPending:l}=d?tr(p,j):rr(p,j);return N.useEffect(()=>{const h=async()=>{await W("warning","발송 준비중(배송중)인 상품은 취소가 어려운 점 양해 부탁드립니다.").then(()=>r(-1))};s&&(s==null?void 0:s.claimType)==="CANCEL"&&(s==null?void 0:s.originalOption.orderStatusType)!=="PAY_DONE"&&h()},[s]),l?e.jsx(i,{height:"40dvh",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(Ke,{color:"inherit"})}):e.jsxs(e.Fragment,{children:[s&&j==="CANCEL"&&e.jsx(gr,{claimOrderInfo:s,isPending:l}),s&&j==="RETURN"&&e.jsx(br,{claimOrderInfo:s,isPending:l}),s&&j==="EXCHANGE"&&e.jsx(yr,{claimOrderInfo:s,isPending:l})]})}function gr({claimOrderInfo:r,isPending:n}){const{methods:t,onSubmitAsync:c}=mr(r);return e.jsx(Ce,{...t,children:e.jsx("form",{onSubmit:t.handleSubmit(c),children:e.jsx(Ne,{isPending:n,claimType:"CANCEL",claimOrderInfo:r})})})}function br({claimOrderInfo:r,isPending:n}){const{methods:t,onSubmitAsync:c}=jr(r);return e.jsx(Ce,{...t,children:e.jsx("form",{onSubmit:t.handleSubmit(c),children:e.jsx(Ne,{isPending:n,claimType:"RETURN",claimOrderInfo:r})})})}function yr({claimOrderInfo:r,isPending:n}){const{methods:t,onSubmitAsync:c}=pr(r);return e.jsx(Ce,{...t,children:e.jsx("form",{onSubmit:t.handleSubmit(c),children:e.jsx(Ne,{isPending:n,claimType:"EXCHANGE",claimOrderInfo:r})})})}function Ne(r){const{claimType:n,claimOrderInfo:t,isPending:c}=r,{shouldShowClaimReason:j,shouldShowOldProductReturn:x,shouldShowNewProductShipping:p,shouldShowFileAttachment:d,shouldShowRefundBank:s}=Q(),l=t.originalOption.payType,h=t.originalOption.orderStatusType,v=d(n,h),u=j(l,h),o=s(n,l),m=x(n,h),y=p(n,h),g={CANCEL:"취소",EXCHANGE:"교환",RETURN:"반품"},{isMobile:C}=xe();return e.jsxs(i,{px:{desktop:4,mobile:2},gap:5,component:"section",display:"flex",flexDirection:"column",children:[C&&e.jsx(Xe,{title:"".concat(g[n]," 신청")}),e.jsx(z,{title:"".concat(g[n]," 신청"),children:n==="EXCHANGE"?e.jsx(xr,{originalOption:t.originalOption,isPending:c}):e.jsx(or,{originalOption:t.originalOption,claimableOptions:t.claimableOptions,claimType:n})}),e.jsx(z,{title:"".concat(g[n]," 사유"),children:e.jsx(ir,{showClaimReason:u,showFileAttachment:v})}),o&&e.jsx(z,{title:"반품 정보",children:t&&e.jsx(lr,{availableBanks:t.availableBanks})}),m&&e.jsx(z,{title:"반품 수거 정보",children:e.jsx(nr,{deliveryCompanyTypeWithLabels:t==null?void 0:t.deliveryCompanyTypeWithLabels,returnWarehouse:t==null?void 0:t.returnWarehouse})}),y&&e.jsx(z,{title:"교환 출고 정보",children:e.jsx(sr,{})}),m&&e.jsx(z,{title:"반품 수거 안내",children:e.jsx(Je,{})}),e.jsx(hr,{claimTypeLabel:g[n]})]})}export{Pr as default};