import { useState } from "react";
const useMergedState = (option) => {
  const { defaultValue, value } = option || {};
  const [innerValue, setInnerValue] = useState(() => {
    if (value !== void 0) {
      return value;
    }
    if (defaultValue !== void 0) {
      return typeof defaultValue === "function" ? defaultValue() : defaultValue;
    }
    return void 0;
  });
  const mergedValue = value !== void 0 ? value : innerValue;
  function triggerChange(newValue) {
    setInnerValue(newValue);
  }
  return [mergedValue, triggerChange];
};
var stdin_default = useMergedState;
export {
  stdin_default as default
};
