import { hk as u, cl as n, c1 as i, hl as l, L as p } from "./684d2f28.js";
import "react";
import "react-dom";
it("test action handler", (o) => {
  const [r] = u();
  let t = 0;
  const a = n(0, !0), e = {
    action: a,
    reduceFn: () => {
      t += 1;
    }
  }, s = {
    ...e,
    action: {
      ...a,
      priority: "defer"
    }
  }, d = {
    ...e,
    action: void 0
  };
  i.range(3).forEach(() => {
    r(e);
  }), expect(t).toBe(3), i.range(3).forEach(() => {
    r(s);
  }), expect(t).toBe(3), r(e), expect(t).toBe(7);
  let c = 0;
  i.range(3).forEach(() => {
    c = r(s);
  }), expect(c).toBe(3), expect(t).toBe(7), setTimeout(() => {
    c = r(d), expect(t).toBe(11), expect(c).toBe(0), o();
  }), r(s);
});
test("nestDispatchHandler", () => {
  const o = l(), r = [], t = (a) => {
    o(a, (e) => {
      e.type === p.CHANGE_VALUE && (r.push("start" + e.value), e.value === 1 && (t(n(2, !0)), t(n(4, !0))), e.value === 2 && t(n(3, !0)), e.value === 4 && t(n(5, !0)), e.value === 6 && t(n(7, !0)), r.push("end" + e.value));
    });
  };
  t(n(1, !0)), t(n(6, !0)), expect(r).toStrictEqual(["start1", "end1", "start2", "end2", "start3", "end3", "start4", "end4", "start5", "end5", "start6", "end6", "start7", "end7"]);
});
