/*!
 * KoliBri - The accessible HTML-Standard
 */
import{h as e}from"./component-names-C3fyby67.js";import{J as o,j as t,M as n,a as i,L as f}from"./common-Dd0zJQbD.js";const s=n=>{for(o()&&(t("↓ Search form element start."),f.debug(n));n instanceof HTMLElement&&"FORM"!==n.tagName&&n.tagName!==e.toUpperCase();){try{n=n.parentElement instanceof HTMLElement?n.parentElement:n.parentNode instanceof ShadowRoot?n.parentNode.host:null}catch(e){}o()&&(f.debug(n),t("↑ Search form element finished."))}return n},l=(t={})=>{var o,a;const r=s(t.form);if(r instanceof HTMLElement){const t=new Event("reset",{bubbles:!0,cancelable:!0});if("FORM"===r.tagName)n(t,r),r.dispatchEvent(t);else if(r.tagName===e.toUpperCase()){n(t,i.querySelector("form",r));const e=r;"function"==typeof(null===(o=e._on)||void 0===o?void 0:o.onReset)&&(null===(a=e._on)||void 0===a||a.onReset(t))}}},a=(a={})=>{const r=s(a.form);if(r instanceof HTMLElement){const a=new SubmitEvent("submit",{bubbles:!0,cancelable:!0,submitter:r});if("FORM"===r.tagName)o()&&!1===r.noValidate&&t("If you have not focusable or hidden form fields in your form, you should enable noValidate for your form.",{force:!0}),setTimeout(()=>{"function"==typeof r.requestSubmit?r.requestSubmit():(n(a,r),r.dispatchEvent(a))});else if(r.tagName===e.toUpperCase()){n(a,i.querySelector("form",r));const e=r;setTimeout(()=>{var t,o;"function"==typeof(null===(t=e._on)||void 0===t?void 0:t.onSubmit)&&(null===(o=e._on)||void 0===o||o.onSubmit(a))})}}};export{l as a,a as p};