;
{
  try {
    let 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] = "009ce03f-6100-4f97-b658-7de54f12cfcf", e._sentryDebugIdIdentifier = "sentry-dbid-009ce03f-6100-4f97-b658-7de54f12cfcf");
  } catch (e) {
  }
}
;
import { useRef, useCallback } from "preact/hooks";
const debounce = (func, wait) => {
  let timerId;
  let shouldInvoke;
  return (...args) => {
    shouldInvoke = true;
    if (!timerId) {
      func(...args);
      shouldInvoke = false;
    }
    clearTimeout(timerId);
    timerId = setTimeout(() => shouldInvoke && func(...args), wait);
  };
};
const useDebouncedCallback = (func, wait) => {
  const timeout = useRef();
  return useCallback(
    (...args) => {
      const later = () => {
        clearTimeout(timeout.current);
        func(...args);
      };
      clearTimeout(timeout.current);
      timeout.current = setTimeout(later, wait);
    },
    [func, wait]
  );
};
const debouncedInputEvent = debounce(
  (userEvents, properties) => userEvents.addFieldEvent("Interacted with form field", properties),
  500
);
export {
  debounce as a,
  debouncedInputEvent as d,
  useDebouncedCallback as u
};
