const n=n=>n.getRootNode();const t=n=>n.host||null;const e=(e,r)=>{const s=e=>{if(!e)return null;if(e.assignedSlot)e=e.assignedSlot;const c=n(e);const o=c.querySelector(r);const u=t(c);return o?o:u?s(u):null};return s(e)};const r=(e,r)=>{const s=e=>e?e.closest(r)||s(t(n(e))):null;return s(e)};var s;(function(n){n["max"]="max";n["maxLength"]="maxLength";n["min"]="min";n["minLength"]="minLength";n["pattern"]="pattern";n["required"]="required"})(s||(s={}));const c={required:"This entry is required"};function o(n,t){const e={validate:r=>{const s=n.validate(r);const c=t.validate(r);if(!s)e.errorMessage=n.errorMessage;else if(!c)e.errorMessage=t.errorMessage;return s&&c}};return e}function u(n){const t=Object.values(s).filter((t=>n[t]!=null)).map((t=>({name:t,options:n[t]})));return a(t)}const i=()=>({validate:n=>true});const a=n=>(n||[]).map((n=>d(n.name))).reduce(o,i());const l=()=>({errorMessage:c.required,validate:n=>n&&"validity"in n?!n.validity.valueMissing:true});const d=n=>{switch(n){case s.required:return l();default:return i()}};export{u as a,r as c,i as d,e as q};
//# sourceMappingURL=p-27658beb.js.map