import{r as s,h as i,H as t}from"./p-dfbe004d.js";import{o as r}from"./p-d63f2554.js";import{_ as a}from"./p-8415f806.js";import"./p-fd56940f.js";import"./p-9a7a47e8.js";const h=class{constructor(i){s(this,i),this.size="medium",this.value="",this.pill=!1,this.showLabel=!0,this.help="",this.disabled=!1,this.readonly=!1,this.required=!1,this.confirmation=!1,this.enableValidation=!0}async reportValidity(){var s,i,t,r,h,o,e,d;if(this.loggedIn)return!0;null===(i=null===(s=this.input)||void 0===s?void 0:s.setCustomValidity)||void 0===i||i.call(s,""),null===(r=null===(t=this.confirmInput)||void 0===t?void 0:t.setCustomValidity)||void 0===r||r.call(t,""),this.confirmation&&(null===(h=this.confirmInput)||void 0===h?void 0:h.value)&&(null===(o=this.input)||void 0===o?void 0:o.value)!==(null===(e=this.confirmInput)||void 0===e?void 0:e.value)&&this.confirmInput.setCustomValidity(a("Password does not match.","surecart")),this.enableValidation&&(this.validatePassword(null===(d=this.input)||void 0===d?void 0:d.value)||this.input.setCustomValidity(a("Passwords should at least 6 characters and contain one special character.","surecart")));const l=await this.input.reportValidity();return!!l&&(this.confirmInput?this.confirmInput.reportValidity():l)}validatePassword(s){return!!new RegExp("^(?=.*?[#?!@$%^&*-]).{6,}$").test(s)}render(){var s;return this.loggedIn?i(t,{style:{display:"none"}}):i("div",{class:"password"},i("sc-input",{ref:s=>this.input=s,label:this.label,help:this.help,autofocus:this.autofocus,placeholder:this.placeholder,showLabel:this.showLabel,size:this.size?this.size:"medium",type:"password",name:"password",value:this.value,required:this.required,disabled:this.disabled}),this.confirmation&&i("sc-input",{ref:s=>this.confirmInput=s,label:null!==(s=this.confirmationLabel)&&void 0!==s?s:a("Confirm Password","surecart"),help:this.confirmationHelp,placeholder:this.confirmationPlaceholder,size:this.size?this.size:"medium",type:"password",value:this.value,required:this.required,disabled:this.disabled}))}};r(h,["loggedIn","emailExists"],!1),h.style=":host{display:block}.password{display:grid;gap:var(--sc-form-row-spacing, 0.75em)}";export{h as sc_order_password}