import { q } from './BaseTextInput-Bfb2_8Ur.mjs';
import { a as useNuxtApp, b as useI18n, _ as __nuxt_component_0$2 } from './server.mjs';
import { l } from './Success-B3ItDJKk.mjs';
import { ref, resolveComponent, mergeProps, unref, withCtx, createVNode, toDisplayString, createTextVNode, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrInterpolate, ssrRenderComponent, ssrRenderAttr, ssrRenderTeleport } from 'vue/server-renderer';
import { p as pe } from './index-Dj5w-pp2.mjs';
import * as R from 'yup';
import './SvgIcon-DRvxO0-V.mjs';
import '../_/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:fs';
import 'node:url';
import 'node:path';
import 'unhead';
import '@unhead/shared';
import 'vue-router';
import 'vue-rate';
import 'date-fns';
import '@hennge/vue3-pagination';
import 'axios';
import 'vue-social-sharing';
import './Modal-CfKvzdGl.mjs';
import './Backdrop-BEGlY-L5.mjs';

const P = { __name: "change-password", __ssrInlineRender: true, setup(c2) {
  const P2 = useNuxtApp().$axios, $2 = ref(false), { t: _ } = useI18n(), S = ref(R.object().shape({ oldPassword: R.string().required(_("ERRORS.old_password")), password: R.string().required(_("ERRORS.password")), confirmPassword: R.string().required(_("ERRORS.confirmPassword")).oneOf([R.ref("password"), null], _("ERRORS.confirmPassword")) })), T = ref({}), U = ref(false), x = async (a2) => {
    U.value = true, P2.post("update-password", { old_password: a2.oldPassword, password: a2.password, password_confirmation: a2.confirmPassword, _method: "PATCH" }).then((a3) => {
      $2.value = true;
    }).catch((a3) => {
      pe.error(a3.response.data.message);
    }).finally(() => {
      U.value = false;
    });
  };
  return (o2, s2, l2, c3) => {
    const g2 = resolveComponent("VeeForm"), F2 = q, P3 = __nuxt_component_0$2, _2 = l;
    s2(`<div${ssrRenderAttrs(mergeProps({ class: "bg-[#F6F7FC] p-6 h-fit" }, c3))}><h3 class="font-bold text-xl mb-14">${ssrInterpolate(o2.$t("TITLES.change_password"))}</h3>`), s2(ssrRenderComponent(g2, { "validation-schema": unref(S), onSubmit: x, initialValues: unref(T) }, { default: withCtx((a2, s3, e2, r2) => {
      if (!s3) return [createVNode("div", { class: "grid grid-cols-1 [&_label]:!bg-[#F6F7FC] [&_input]:!bg-[#FFFFFF03] [&_button[aria-haspopup=listbox]]:!bg-[#FFFFFF03] gap-8" }, [createVNode("div", null, [createVNode(F2, { name: "oldPassword", label: o2.$t("LABELS.old_password"), placeholder: o2.$t("INPUTS.old_password"), type: "password", value: unref(T).oldPassword, "onUpdate:value": (a3) => unref(T).oldPassword = a3 }, null, 8, ["label", "placeholder", "value", "onUpdate:value"])]), createVNode("div", null, [createVNode(F2, { name: "password", label: o2.$t("LABELS.password"), placeholder: o2.$t("INPUTS.password"), type: "password", value: unref(T).password, "onUpdate:value": (a3) => unref(T).password = a3 }, null, 8, ["label", "placeholder", "value", "onUpdate:value"])]), createVNode("div", null, [createVNode(F2, { name: "confirmPassword", label: o2.$t("LABELS.confirmPassword"), placeholder: o2.$t("INPUTS.confirmPassword"), type: "password", value: unref(T).confirmPassword, "onUpdate:value": (a3) => unref(T).confirmPassword = a3 }, null, 8, ["label", "placeholder", "value", "onUpdate:value"])]), createVNode("div", { class: "flex items-center gap-6 mt-10" }, [createVNode("button", { loading: unref(U), type: "submit", class: "base-btn capitalize disabled:!bg-[#909090] w-full mb-2" }, toDisplayString(o2.$t("BUTTONS.confirm")), 9, ["loading"]), createVNode(P3, { to: o2.localePath("/profile"), class: "base-btn capitalize !text-primary !bg-transparent border border-primary disabled:!bg-[#909090] w-full mb-2" }, { default: withCtx(() => [createTextVNode(toDisplayString(o2.$t("BUTTONS.cancel")), 1)]), _: 1 }, 8, ["to"])])])];
      s3(`<div class="grid grid-cols-1 [&amp;_label]:!bg-[#F6F7FC] [&amp;_input]:!bg-[#FFFFFF03] [&amp;_button[aria-haspopup=listbox]]:!bg-[#FFFFFF03] gap-8"${r2}><div${r2}>`), s3(ssrRenderComponent(F2, { name: "oldPassword", label: o2.$t("LABELS.old_password"), placeholder: o2.$t("INPUTS.old_password"), type: "password", value: unref(T).oldPassword, "onUpdate:value": (a3) => unref(T).oldPassword = a3 }, null, e2, r2)), s3(`</div><div${r2}>`), s3(ssrRenderComponent(F2, { name: "password", label: o2.$t("LABELS.password"), placeholder: o2.$t("INPUTS.password"), type: "password", value: unref(T).password, "onUpdate:value": (a3) => unref(T).password = a3 }, null, e2, r2)), s3(`</div><div${r2}>`), s3(ssrRenderComponent(F2, { name: "confirmPassword", label: o2.$t("LABELS.confirmPassword"), placeholder: o2.$t("INPUTS.confirmPassword"), type: "password", value: unref(T).confirmPassword, "onUpdate:value": (a3) => unref(T).confirmPassword = a3 }, null, e2, r2)), s3(`</div><div class="flex items-center gap-6 mt-10"${r2}><button${ssrRenderAttr("loading", unref(U))} type="submit" class="base-btn capitalize disabled:!bg-[#909090] w-full mb-2"${r2}>${ssrInterpolate(o2.$t("BUTTONS.confirm"))}</button>`), s3(ssrRenderComponent(P3, { to: o2.localePath("/profile"), class: "base-btn capitalize !text-primary !bg-transparent border border-primary disabled:!bg-[#909090] w-full mb-2" }, { default: withCtx((a3, s4, e3, r3) => {
        if (!s4) return [createTextVNode(toDisplayString(o2.$t("BUTTONS.cancel")), 1)];
        s4(`${ssrInterpolate(o2.$t("BUTTONS.cancel"))}`);
      }), _: 1 }, e2, r2)), s3("</div></div>");
    }), _: 1 }, l2)), unref($2) ? ssrRenderTeleport(s2, (a2) => {
      a2(ssrRenderComponent(_2, { class: "[&_h2]:!font-Montserrat [&_h2]:!not-italic [&_h2]:!font-semibold", onClose: (a3) => $2.value = false, title: "Password changed", desc: "Change Password Successfully" }, null, l2));
    }, "body", false, l2) : s2("<!---->"), s2("</div>");
  };
} }, $ = P.setup;
P.setup = (a2, o2) => {
  const s2 = useSSRContext();
  return (s2.modules || (s2.modules = /* @__PURE__ */ new Set())).add("pages/profile/change-password.vue"), $ ? $(a2, o2) : undefined;
};

export { P as default };
//# sourceMappingURL=change-password-bM1zvkqH.mjs.map
