import{n as k,o as f,p as m,h as t,u as _,r as b,v as i}from"./CkWh75VR.js";function E(e,a,v=a){var c=new WeakSet;k(e,"input",async r=>{var l=r?e.defaultValue:e.value;if(l=s(e)?u(l):l,v(l),f!==null&&c.add(f),await m(),l!==(l=a())){var h=e.selectionStart,d=e.selectionEnd,n=e.value.length;if(e.value=l??"",d!==null){var o=e.value.length;h===d&&d===n&&o>n?(e.selectionStart=o,e.selectionEnd=o):(e.selectionStart=h,e.selectionEnd=Math.min(d,o))}}}),(t&&e.defaultValue!==e.value||_(a)==null&&e.value)&&(v(s(e)?u(e.value):e.value),f!==null&&c.add(f)),b(()=>{var r=a();if(e===document.activeElement){var l=i??f;if(c.has(l))return}s(e)&&r===u(e.value)||e.type==="date"&&!r&&!e.value||r!==e.value&&(e.value=r??"")})}function S(e,a,v=a){k(e,"change",c=>{var r=c?e.defaultChecked:e.checked;v(r)}),(t&&e.defaultChecked!==e.checked||_(a)==null)&&v(e.checked),b(()=>{var c=a();e.checked=!!c})}function s(e){var a=e.type;return a==="number"||a==="range"}function u(e){return e===""?null:+e}export{S as a,E as b};
