import{h as t}from"./p-acaa4892.js";import{c as n}from"./p-27658beb.js";function e(t){return"checked"in t}function i(t){return"indeterminate"in t}const o=new WeakMap;const s=new WeakSet;function r(t,n){const e="internalFormComponentRegister";let i=false;t.addEventListener(e,(t=>{i=t.composedPath().some((t=>s.has(t)));t.stopPropagation()}),{once:true});n.dispatchEvent(new CustomEvent(e,{bubbles:true,composed:true}));return i}function u(){this.value=this.defaultValue;if(e(this))this.checked=this.defaultChecked;if(i(this))this.indeterminate=this.defaultIndeterminate}function c(t){const{host:o,value:c}=t;const a=n(o,"form");const f=(t.onFormReset||u).bind(t);if(!a||r(a,o))return;a.addEventListener("reset",f);s.add(o);t.formEl=a;t.defaultValue=c;if(e(t))t.defaultChecked=t.checked;if(i(t))t.defaultIndeterminate=t.indeterminate}function a(t){const{host:n,formEl:e}=t;const i=o.get(n);if(!e)return;e.removeEventListener("reset",i);o.delete(n);t.formEl=null;s.delete(n)}const f=({component:n,type:o})=>{const{disabled:s,required:r,value:u,name:c,host:a,hiddenInput:f}=n;const l="hidden-form-input";let m=a.querySelector(`input[slot="${l}"]`);if(!m){m=a.ownerDocument.createElement("input");if(c)m.name=c;if(!f)n.hiddenInput=m;m.tabIndex=-1;m.slot=l;m.style.opacity="0";m.style.position="absolute";m.style.zIndex="-1";m.type=o;m.setAttribute("role",o);m.setAttribute("aria-labelledby",a.id);m.addEventListener("invalid",(t=>t.preventDefault()));a.appendChild(m)}if(e(n))m.checked=n.checked;if(i(n))m.indeterminate=n.indeterminate;m.disabled=s;m.required=r;m.value=u;return t("slot",{name:l})};export{f as H,c,a as d};
//# sourceMappingURL=p-55d95bed.js.map