import{ay as e,az as r}from"./p-BTBbFFOR.js";class t extends e{constructor(e){super(),this.config=e}evaluate(e){if(!this.isAcceptedInputType(e))throw new Error(`Invalid date value ${e} for mode ${this.config.mode}`);let t;switch(this.config.mode){case"single":t=r(e);break;case"range":t=Array.isArray(e)&&2===e.length&&e.every(r)}return{isValid:t,message:t?"":"This field is required"}}canEvaluate(e,r){return r?this.isAcceptedInputType(e)&&!r.disabled&&r.visible:this.isAcceptedInputType(e)}shouldShowError(e){return!e.disabled&&e.visible&&(e.touched||e.modified)}isAcceptedInputType(e){if(null==e)return!0;if(!this.config.mode)throw new Error(`Unexpected type of mode: ${this.config.mode}`);switch(this.config.mode){case"single":return"string"==typeof e;case"range":return Array.isArray(e);default:return!1}}}export{t as D}