import{_ as P}from"./BlueButton.vue_vue_type_script_setup_true_lang-CY8chwQm.js";import{_ as V}from"./InputPassword.vue_vue_type_script_setup_true_lang-dEz0sNQ-.js";import{_ as B}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as C}from"./BlockBalanceAgreement-396E9Da8.js";import{r,u as b,l as k,o as S,c as y,b as l,a as o,f as d,t as A,w as E,A as N}from"./index-Bb2UEb_P.js";import{u as R}from"./global-BK91p1BE.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./IconEye-Cnj13y34.js";import"./HtmlContent-DrkJBX3e.js";import"./IconCloseCircle-ctElXVvc.js";import"./clauses-Bhz_DuFa.js";import"./index-Dax_IkAt.js";import"./ButtonDefault-CzWpVlv6.js";import"./common-U_VzDrmL.js";const U={class:"tw-w-full"},$={class:"tw-px-4 md:tw-px-8"},G={class:"tw-mt-4"},j={class:"tw-flex tw-flex-col sm:tw-flex-row sm:tw-items-center tw-gap-4 tw-mt-4"},D={class:"tw-flex tw-flex-col sm:tw-flex-row sm:tw-items-center tw-gap-4 tw-mt-4"},Y={__name:"UserChangePassword",setup(I){const e=r(""),t=r(""),n=r(""),m=r(!1),p=R(),c=b(),w=N("emitter");async function f(){if(e.value&&t.value&&e.value===t.value){m.value=!0;const a=await c.userPasswordChange({Password:e.value,_Password:t.value});m.value=!1,a==="success"&&(e.value="",t.value="",w.emit("open-modal",{component:"PasswordChanged",data:{}}))}else w.emit("open-modal",{component:"Error",data:{message:"Пароли не совпадают или не заполнены"}})}function v(){e.value=n.value,t.value=n.value}return k(async()=>{const a=await p.generatePassword();a!=="ERROR"&&(n.value=a.Password)}),(a,s)=>{const _=C,x=B,u=V,g=P;return S(),y("div",U,[l(_),o("div",$,[s[6]||(s[6]=o("h1",{class:"tw-text-xl sm:tw-text-4xl"},"Сменить пароль",-1)),l(x),o("div",G,[s[2]||(s[2]=d(" Использовать сгенерированный пароль: ",-1)),o("span",{class:"tw-text-sky-400 tw-font-semibold tw-cursor-pointer tw-ml-1",onClick:v},A(n.value),1)]),o("div",j,[s[3]||(s[3]=o("div",{class:"tw-flex-none tw-w-64"},"Новый пароль",-1)),l(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=i=>e.value=i),"is-new":!0,name:"password",class:"tw-w-full sm:tw-w-[450px]"},null,8,["modelValue"])]),o("div",D,[s[4]||(s[4]=o("div",{class:"tw-flex-none tw-w-64"},"Подтвердить пароль",-1)),l(u,{modelValue:t.value,"onUpdate:modelValue":s[1]||(s[1]=i=>t.value=i),"is-new":!0,name:"confirmPassword",class:"tw-w-full sm:tw-w-[450px]"},null,8,["modelValue"])]),l(g,{loading:m.value,disabled:!e.value||!t.value,class:"sm:tw-ml-[17rem] tw-mt-4",onClick:f},{default:E(()=>s[5]||(s[5]=[d(" Изменить пароль ",-1)])),_:1,__:[5]},8,["loading","disabled"])])])}}};export{Y as default};
