
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b4daf8dd-6763-51b4-849e-9faf29c62019")}catch(e){}}();
import{r as o}from"./react-router-Dad2jQ_5.js";function E(e){return document.forms.namedItem(e)}function d(e,r){var n=e?.elements.namedItem(r),t=n?n instanceof Element?[n]:Array.from(n.values()):[];return t.filter(u=>u instanceof HTMLInputElement||u instanceof HTMLSelectElement||u instanceof HTMLTextAreaElement)}function y(e,r,n){var t,u=d(e,r);if(u.length>1){var i=n;for(var a of u)if(!(typeof i<"u"&&a instanceof HTMLInputElement&&a.type==="checkbox"&&(a.checked?i.includes(a.value):!i.includes(a.value))))return a}return(t=u[0])!==null&&t!==void 0?t:null}function h(e,r,n){var t=document.createElement("select"),u=typeof n=="string"?[n]:n??[];t.name=r,t.multiple=!0,t.dataset.conform="true",t.setAttribute("aria-hidden","true"),t.tabIndex=-1,t.style.position="absolute",t.style.width="1px",t.style.height="1px",t.style.padding="0",t.style.margin="-1px",t.style.overflow="hidden",t.style.clip="rect(0,0,0,0)",t.style.whiteSpace="nowrap",t.style.border="0";for(var i of u)t.options.add(new Option(i,i,!0,!0));return e.appendChild(t),t}function v(e){return e.dataset.conform==="true"}function b(e,r){if(e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio"))e.checked=Array.isArray(r)?r.includes(e.value):e.value===r;else if(e instanceof HTMLSelectElement&&e.multiple){var n=Array.isArray(r)?[...r]:[r];for(var t of e.options){var u=n.indexOf(t.value),i=u>-1;t.selected=i,i&&n.splice(u,1)}if(v(e))for(var a of n)e.options.add(new Option(a,a,!1,!0))}else if(e.value!==r){var{set:s}=Object.getOwnPropertyDescriptor(e,"value")||{},c=Object.getPrototypeOf(e),{set:f}=Object.getOwnPropertyDescriptor(c,"value")||{};if(f&&s!==f)f.call(e,r);else if(s)s.call(e,r);else throw new Error("The given element does not have a value setter")}}function g(){var e=o.useRef(null),r=o.useRef({change:!1,focus:!1,blur:!1});return o.useEffect(()=>{var n=a=>s=>{var c=e.current;c&&s.target===c&&(r.current[a]=!0)},t=n("change"),u=n("focus"),i=n("blur");return document.addEventListener("input",t,!0),document.addEventListener("focusin",u,!0),document.addEventListener("focusout",i,!0),()=>{document.removeEventListener("input",t,!0),document.removeEventListener("focusin",u,!0),document.removeEventListener("focusout",i,!0)}},[e]),o.useMemo(()=>({change(n){if(!r.current.change){r.current.change=!0;var t=e.current;t&&(b(t,n),t.dispatchEvent(new InputEvent("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))}r.current.change=!1},focus(){if(!r.current.focus){r.current.focus=!0;var n=e.current;n&&(n.dispatchEvent(new FocusEvent("focusin",{bubbles:!0})),n.dispatchEvent(new FocusEvent("focus")))}r.current.focus=!1},blur(){if(!r.current.blur){r.current.blur=!0;var n=e.current;n&&(n.dispatchEvent(new FocusEvent("focusout",{bubbles:!0})),n.dispatchEvent(new FocusEvent("blur")))}r.current.blur=!1},register(n){e.current=n}}),[])}function m(e){var r=()=>{var a;return typeof e.initialValue=="string"?e.initialValue:(a=e.initialValue)===null||a===void 0?void 0:a.map(s=>s??"")},[n,t]=o.useState(e.key),[u,i]=o.useState(r);return n!==e.key&&(i(r),t(e.key)),[u,i]}function I(e){var[r,n]=m(e),t=o.useRef(!1),{register:u,change:i,focus:a,blur:s}=g();return o.useEffect(()=>{var c=E(e.formId);if(!c){console.warn("useInputControl is unable to find form#".concat(e.formId," and identify if a dummy input is required"));return}var f=y(c,e.name);return!f&&typeof r<"u"&&(!Array.isArray(r)||r.length>0)&&(f=h(c,e.name,r)),u(f),t.current?i(r??""):t.current=!0,()=>{u(null);var p=d(c,e.name);for(var l of p)v(l)&&l.remove()}},[e.formId,e.name,r,i,u]),{value:r,change:n,focus:a,blur:s}}export{I as u};
//# sourceMappingURL=integrations-BlO-ZYx4.js.map

//# debugId=b4daf8dd-6763-51b4-849e-9faf29c62019
