import{P as b,v as g,x as y,g as F,e as N,a6 as P,J as V}from"./index-CTxlYqj4.js";import{u as v,a as x}from"./tag-Dx3OexMp.js";import{h as R,i as w}from"./VTextField-CWm47OUI.js";import{f as k}from"./forwardRefs-BSESyuUp.js";const{$gettext:a}=b;function u(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?!0:a("Not a valid email")}function C(e){if(isNaN(e))return!1;var t=parseFloat(e);return(t|0)===t}function S(e,t){return e===t}const O={required:e=>e!==""&&e!=null&&e!==void 0&&(!Array.isArray(e)||e.length)||a("Field is required"),email:e=>u(e),emailOrNull:e=>e!=null||e!==""||u(e),minLength:e=>t=>t.length>e||a("Minimum length is %{ length }",{length:e}),numericOrNull:e=>e==null||e===""||C(e)||a("Must be a numeric value or empty"),samePassword:(e,t)=>S(e,t)||a("Passwords mismatch"),portNumber:e=>e>0&&e<65536||a("Invalid port number")},q=y({...x(),...w()},"VForm"),$=g()({name:"VForm",props:q(),emits:{"update:modelValue":e=>!0,submit:e=>!0},setup(e,t){let{slots:i,emit:f}=t;const o=R(e),m=F();function c(n){n.preventDefault(),o.reset()}function d(n){const s=n,r=o.validate();s.then=r.then.bind(r),s.catch=r.catch.bind(r),s.finally=r.finally.bind(r),f("submit",s),s.defaultPrevented||r.then(p=>{var l;let{valid:h}=p;h&&((l=m.value)==null||l.submit())}),s.preventDefault()}return v(()=>{var n;return N("form",{ref:m,class:V(["v-form",e.class]),style:P(e.style),novalidate:!0,onReset:c,onSubmit:d},[(n=i.default)==null?void 0:n.call(i,o)])}),k(o,m)}});export{$ as V,O as r};
