/*!
 * KoliBri - The accessible HTML-Standard
 */
import{a7 as e,K as o,Z as n,R as t}from"./index-0489af72.js";const f=e=>{for(n()&&(t("↓ Search form element start."),console.log(e));e instanceof HTMLElement&&"FORM"!==e.tagName&&"KOL-FORM"!==e.tagName;){try{e=e.parentElement instanceof HTMLElement?e.parentElement:e.parentNode instanceof ShadowRoot?e.parentNode.host:null}catch(e){}n()&&(console.log(e),t("↑ Search form element finished."))}return e},i=(t={})=>{var n,a;const s=f(t.form);if(s instanceof HTMLElement){const t=new Event("reset",{bubbles:!0,cancelable:!0});if("FORM"===s.tagName)e(t,s),s.dispatchEvent(t);else if("KOL-FORM"===s.tagName){e(t,o.querySelector("form",s));const i=s;"function"==typeof(null===(n=i._on)||void 0===n?void 0:n.onReset)&&(null===(a=i._on)||void 0===a||a.onReset(t))}}},s=(a={})=>{var s,i;const l=f(a.form);if(l instanceof HTMLElement){const a=new SubmitEvent("submit",{bubbles:!0,cancelable:!0,submitter:l});if("FORM"===l.tagName)e(a,l),l.dispatchEvent(a),n()&&!1===l.noValidate&&t("If you have not focusable or hidden form fields in your form, you should enable noValidate for your form.",{force:!0}),"function"==typeof l.requestSubmit&&l.requestSubmit();else if("KOL-FORM"===l.tagName){e(a,o.querySelector("form",l));const t=l;"function"==typeof(null===(s=t._on)||void 0===s?void 0:s.onSubmit)&&(null===(i=t._on)||void 0===i||i.onSubmit(a))}}};export{i as a,s as p};