export const __rspack_esm_id="79927";export const __rspack_esm_ids=["79927"];export const __webpack_modules__={7466(e,t,s){s.a(e,async function(e,a){try{s.r(t),s.d(t,{CloudForgotPasswordCard:()=>_});var r=s(62826),i=s(96196),o=s(44457),n=s(1087),l=s(89300),d=(s(38962),s(76776),s(75709),s(14503)),h=s(71117),c=s(79007),p=e([l]);l=(p.then?(await p)():p)[0];class _ extends i.WF{render(){return this.cardLess?this._renderContent():i.qy` <ha-card outlined .header="${this.localize(`ui.panel.${this.translationKeyPanel}.subtitle`)}"> ${this._renderContent()} </ha-card> `}_renderContent(){return i.qy` <div class="card-content"> <p> ${this.localize(`ui.panel.${this.translationKeyPanel}.instructions`)} </p> ${this._error?i.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:i.s6} <ha-textfield autofocus id="email" label="${this.localize(`ui.panel.${this.translationKeyPanel}.email`)}" .value="${this.email??""}" type="email" required .disabled="${this._inProgress}" @keydown="${this._keyDown}" .validationMessage="${this.localize(`ui.panel.${this.translationKeyPanel}.email_error_msg`)}"></ha-textfield> </div> <div class="card-actions"> <ha-progress-button @click="${this._handleEmailPasswordReset}" .progress="${this._inProgress}"> ${this.localize(`ui.panel.${this.translationKeyPanel}.send_reset_email`)} </ha-progress-button> </div> `}_keyDown(e){"Enter"===e.key&&this._handleEmailPasswordReset()}async _handleEmailPasswordReset(){const e=this.emailField,t=e.value;e.reportValidity()?(this._inProgress=!0,this._resetPassword(t)):e.focus()}static get styles(){return[d.RF,i.AH`ha-card{max-width:600px;margin:0 auto;margin-top:24px}h1{margin:0}ha-textfield{width:100%}.card-actions{display:flex;justify-content:flex-end;align-items:center}`]}constructor(...e){super(...e),this.translationKeyPanel="config.cloud.forgot_password",this.cardLess=!1,this._inProgress=!1,this._resetPassword=async e=>{this._inProgress=!0;try{this.hass?await(0,h.Ut)(this.hass,e):await(0,c.zN)(e),(0,n.r)(this,"cloud-email-changed",{value:e}),this._inProgress=!1,(0,n.r)(this,"cloud-done",{flashMessage:this.localize(`ui.panel.${this.translationKeyPanel}.check_your_email`)})}catch(t){this._inProgress=!1;"usernotfound"===(t&&t.body&&t.body.code)&&e!==e.toLowerCase()?await this._resetPassword(e.toLowerCase()):this._error=t&&t.body&&t.body.message?t.body.message:"Unknown error"}}}}(0,r.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"localize",void 0),(0,r.Cg)([(0,o.MZ)({attribute:"translation-key-panel"})],_.prototype,"translationKeyPanel",void 0),(0,r.Cg)([(0,o.MZ)()],_.prototype,"email",void 0),(0,r.Cg)([(0,o.MZ)({type:Boolean,attribute:"card-less"})],_.prototype,"cardLess",void 0),(0,r.Cg)([(0,o.wk)()],_.prototype,"_inProgress",void 0),(0,r.Cg)([(0,o.wk)()],_.prototype,"_error",void 0),(0,r.Cg)([(0,o.P)("#email",!0)],_.prototype,"emailField",void 0),_=(0,r.Cg)([(0,o.EM)("cloud-forgot-password-card")],_),a()}catch(e){a(e)}})}};
//# sourceMappingURL=79927.c7483634210bf009.js.map