'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-22fd9091.js');
const core = require('./core-787915c4.js');
require('./_commonjsHelpers-5cfcba41.js');
require('./index-a20d8492.js');
require('./runStore-bfd81991.js');
const index$1 = require('./index-66ca60fa.js');
const Mutations = require('./Mutations-7f7eb38b.js');

const AuthResetPasswordForm = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.updatePasswordFormId = "updatePassword";
  }
  async formEventHandler({ detail }) {
    if (detail.formId != this.updatePasswordFormId)
      return;
    return this.updatePassword(detail);
  }
  async updatePassword(detail) {
    const userInput = {};
    Object.keys(detail).map((value) => {
      if (detail[value].key) {
        userInput[detail[value].key] = detail[value].value;
      }
    });
    await core.coreState.client.mutate({
      mutation: index$1.src(Mutations.userUpdatePasswordMutationGQL),
      variables: {
        userPasswordInput: userInput,
      },
    });
  }
  render() {
    return (index.h("corejam-box", null, index.h("corejam-box", { bWidthBottom: 1, bColor: "gray-400", mb: 8, mt: 12 }, index.h("corejam-type", { as: "h3", size: "xl" }, "Update Password")), index.h("corejam-form-container", { name: this.updatePasswordFormId }, index.h("corejam-box", { flex: true, mb: 8 }, index.h("corejam-box", { w: "6" }, index.h("corejam-form-input", { name: "oldPassword", type: "password", formId: this.updatePasswordFormId, label: "Current Password", placeholder: "Current password" }))), index.h("corejam-box", { flex: true, mb: 8 }, index.h("corejam-box", { w: "6" }, index.h("corejam-form-input", { name: "password", type: "password", formId: this.updatePasswordFormId, label: "New Password", placeholder: "New password" }))), index.h("corejam-box", { flex: true, mb: 8 }, index.h("corejam-box", { w: "6" }, index.h("corejam-form-input", { name: "passwordConfirm", type: "password", formId: this.updatePasswordFormId, label: "Confirm Password", placeholder: "Confirm password" }))), index.h("corejam-form-submit", { formId: this.updatePasswordFormId }, index.h("corejam-type", { size: "sm", weight: "bold", transform: "uppercase", decoration: "underline" }, "Save")))));
  }
};

exports.auth_reset_password_form = AuthResetPasswordForm;
