import { ref as c } from "vue";
var n = /* @__PURE__ */ ((r) => (r.loading = "loading", r.error = "error", r.success = "success", r))(n || {});
function i(r) {
  const e = c({
    state: "loading"
    /* loading */
  }), s = async (a) => {
    const t = a || r;
    if (!t) {
      e.value = { state: "error", error: new Error("No promise task provided") };
      return;
    }
    e.value = {
      state: "loading"
      /* loading */
    };
    try {
      const o = await t();
      e.value = { state: "success", data: o };
    } catch (o) {
      e.value = { state: "error", error: o };
    }
  };
  return r && s(), { result: e, execute: s };
}
export {
  n as R,
  i as u
};
