import{a2 as s,v as f,a3 as i,a4 as m,a5 as l,L as u}from"./index-DCi8lcS0.js";const c=e=>{for(s()&&(f("↓ Search form element start."),u.debug(e));e instanceof HTMLElement&&e.tagName!=="FORM"&&e.tagName!==m.toUpperCase();){try{e.parentElement instanceof HTMLElement?e=e.parentElement:e.parentNode instanceof ShadowRoot?e=e.parentNode.host:e=null}catch{}s()&&(u.debug(e),f("↑ Search form element finished."))}return e},d=(e={})=>{var t,n;const o=c(e.form);if(o instanceof HTMLElement){const a=new Event("reset",{bubbles:!0,cancelable:!0});if(o.tagName==="FORM")i(a,o),o.dispatchEvent(a);else if(o.tagName===m.toUpperCase()){i(a,l.querySelector("form",o));const r=o;typeof((t=r._on)===null||t===void 0?void 0:t.onReset)=="function"&&((n=r._on)===null||n===void 0||n.onReset(a))}}},v=(e={})=>{const t=c(e.form);if(t instanceof HTMLElement){const n=new SubmitEvent("submit",{bubbles:!0,cancelable:!0,submitter:t});if(t.tagName==="FORM")s()&&t.noValidate===!1&&f("If you have not focusable or hidden form fields in your form, you should enable noValidate for your form.",{force:!0}),setTimeout(()=>{typeof t.requestSubmit=="function"?t.requestSubmit():(i(n,t),t.dispatchEvent(n))});else if(t.tagName===m.toUpperCase()){i(n,l.querySelector("form",t));const o=t;setTimeout(()=>{var a,r;typeof((a=o._on)===null||a===void 0?void 0:a.onSubmit)=="function"&&((r=o._on)===null||r===void 0||r.onSubmit(n))})}}};export{d as a,v as p};
//# sourceMappingURL=controller-BsKjyZ3W-D8nN5pcG.js.map
