import{m as w,k as j,Q as f,b as S,bw as y,j as s,U as L,V as B,av as b,W as C,bI as F,aC as k,Y as q,Z as P,X as v,x as A,bv as E}from"./index-E0AVXOTn.js";const N=w.div(["display:flex;flex-direction:column;gap:24px;"]),T=w.div(["display:flex;align-items:center;gap:4px;"]),g={Container:N,ButtonContainer:T},R=({...n})=>{const{close:r,boardData:a,onConfirm:e}=n,{t}=j(),{register:o,handleSubmit:m,formState:{errors:x}}=f({defaultValues:{password:""}}),{openAsyncDialog:h}=S(),p=m(async c=>{var l,u;try{await y.getArticle((a==null?void 0:a.boardNo)||"",(a==null?void 0:a.articleNo)||0,{password:c.password}),e==null||e(c.password)}catch(i){r(),await h({message:i instanceof Error&&(((u=(l=i==null?void 0:i.response)==null?void 0:l.data)==null?void 0:u.message)||i.message)||t("비밀번호가 일치하지 않습니다.")})}finally{r()}});return s.jsx(L,{...n,title:t("비밀번호 인증"),children:s.jsxs(g.Container,{children:[s.jsxs("form",{onSubmit:p,children:[s.jsx("p",{style:{fontSize:14,color:"#666",marginBottom:16,lineHeight:1.5},children:t("글 작성 시 설정한 비밀번호를 입력해 주세요.")}),s.jsxs(B,{children:[s.jsx(b,{isRequired:!0,children:t("비밀번호")}),s.jsx(C,{type:"password",placeholder:t("비밀번호 입력"),...o("password",{required:t("비밀번호를 입력해 주세요.")}),maxLength:20,autoFocus:!0}),s.jsx(F,{name:"password",errors:x})]})]}),s.jsxs(g.ButtonContainer,{children:[s.jsx(k,{type:"button",onClick:r,children:t("취소")},"cancel"),s.jsx(q,{type:"button",onClick:p,children:t("확인")},"submit")]})]})})},V=({close:n,onConfirm:r,isOpen:a=!0,boardData:e,...t})=>{const{t:o}=j(),{register:m,handleSubmit:x,formState:{errors:h}}=f({defaultValues:{password:""}}),{openAsyncDialog:p}=S(),c=x(async l=>{var u,i;try{await y.getArticle((e==null?void 0:e.boardNo)||"",(e==null?void 0:e.articleNo)||0,{password:l.password}),r==null||r(l.password)}catch(d){n(),await p({message:d instanceof Error&&(((i=(u=d==null?void 0:d.response)==null?void 0:u.data)==null?void 0:i.message)||d.message)||o("비밀번호가 일치하지 않습니다.")})}finally{n()}});return s.jsx(P,{...t,isDeskTopUsable:!0,isOpen:a,close:n,width:"400px",title:o("비밀번호 인증"),footerButtonList:[s.jsx(k,{type:"button",onClick:n,children:o("취소")},"cancel"),s.jsx(q,{type:"button",onClick:c,children:o("확인")},"submit")],children:s.jsxs("form",{onSubmit:c,children:[s.jsx("p",{style:{fontSize:14,color:"#666",marginBottom:16,lineHeight:1.5},children:o("글 작성 시 설정한 비밀번호를 입력해 주세요.")}),s.jsxs(B,{children:[s.jsx(b,{isRequired:!0,children:o("비밀번호")}),s.jsx(C,{type:"password",placeholder:o("비밀번호 입력"),...m("password",{required:o("비밀번호를 입력해 주세요.")}),maxLength:20,autoFocus:!0}),s.jsx(v,{name:"password",errors:h})]})]})})},z=({options:n}={})=>A({queryKey:E.config(),queryFn:async()=>{const{data:r}=await y.getConfig();return r},staleTime:3600*1e3,gcTime:7200*1e3,...n});export{R as P,V as a,z as u};