document.addEventListener("DOMContentLoaded",function(e){let t=document.querySelector(".credit-card-mask"),n=document.querySelector(".expiry-date-mask"),r=document.querySelector(".cvv-code-mask"),a=document.querySelector(".btn-reset");t&&(t.addEventListener("input",e=>{t.value=formatCreditCard(e.target.value);e=e.target.value.replace(/\D/g,""),e=getCreditCardType(e);document.querySelector(".card-type").innerHTML=e&&"unknown"!==e&&"general"!==e?'<img src="'+assetsPath+"img/icons/payments/"+e+'-cc.png" class="cc-icon-image" height="28"/>':""}),registerCursorTracker({input:t,delimiter:" "}),a.addEventListener("click",function(e){document.querySelector(".card-type").innerHTML=""})),n&&(n.addEventListener("input",e=>{n.value=formatDate(e.target.value,{date:!0,delimiter:"/",datePattern:["m","y"]})}),registerCursorTracker({input:n,delimiter:"/"})),r&&r.addEventListener("input",e=>{e=e.target.value.replace(/\D/g,"");r.value=formatNumeral(e,{numeral:!0,numeralPositiveOnly:!0})}),FormValidation.formValidation(document.getElementById("addNewCCForm"),{fields:{modalAddCard:{validators:{notEmpty:{message:"Please enter your credit card number"}}}},plugins:{trigger:new FormValidation.plugins.Trigger,bootstrap5:new FormValidation.plugins.Bootstrap5({eleValidClass:"",rowSelector:".form-control-validation"}),submitButton:new FormValidation.plugins.SubmitButton,autoFocus:new FormValidation.plugins.AutoFocus},init:e=>{e.on("plugins.message.placed",function(e){e.element.parentElement.classList.contains("input-group")&&e.element.parentElement.insertAdjacentElement("afterend",e.messageElement)})}}).on("plugins.message.displayed",function(e){e.element.parentElement.classList.contains("input-group")&&e.element.parentElement.insertAdjacentElement("afterend",e.messageElement.parentElement)})});