import { reactive as s } from "vue";
import { debounce as n } from "@milaboratories/helpers";
function c(o) {
  const r = s({
    isLoading: !1,
    result: void 0,
    error: void 0,
    async run(...e) {
      this.isLoading = !0, this.error = void 0;
      try {
        this.result = await o(...e);
      } catch (i) {
        this.error = i;
      } finally {
        this.isLoading = !1;
      }
    },
    debounce(e, i = 1e3) {
      return n(() => {
        const t = e();
        this.run(...t).catch(console.error);
      }, i);
    }
  });
  return r.run = r.run.bind(r), r;
}
export {
  c as useQuery
};
//# sourceMappingURL=useQuery.js.map
