import {
  G as H,
  z as V,
  r as d,
  R as U,
  B as q,
  $ as oe,
  C as ie,
  H as I,
  aA as ce,
  I as y,
  Q as u,
  av as G,
  J as t,
  ao as D,
  P as a,
  O as f,
  ap as A,
  K as F,
  M as J,
  N as h,
  ax as E,
  au as de,
} from "./common.modules-cecf9b0d.js";
import {
  m as re,
  n as ue,
  A as m,
  o as ve,
  p as pe,
  c as B,
  g as _e,
  b as he,
  R as ge,
  q as ke,
  s as fe,
  t as ye,
  _ as K,
  v as we,
  w as me,
} from "./page-activity-ActivityDetail-6713f46c.js";
import { E as be } from "./page-activity-Bonus-c94a181e.js";
const Te = { class: "dailySignIn__container" },
  $e = { class: "task-banner" },
  Ae = { class: "banner-title" },
  Ie = { class: "banner-content" },
  Ce = { class: "task-panel" },
  De = { key: 0, class: "task-item" },
  Ne = { class: "task-item-header" },
  Re = { class: "hearder-status new" },
  Se = { class: "headerR" },
  Pe = { class: "task-item-type" },
  Le = { class: "type-title new" },
  ze = { class: "type-tip" },
  Be = { class: "task-item-description" },
  Ge = { class: "task-item-bottom" },
  je = { class: "bottom-title" },
  Me = { class: "task-item-header" },
  Oe = { key: 0, class: "task-item-subject" },
  We = { class: "sub-title" },
  xe = { class: "subject" },
  Ee = { class: "schedule" },
  He = { class: "subject" },
  Ve = { class: "schedule" },
  Ue = { key: 1, class: "task-item-type" },
  qe = { class: "type-tip" },
  Fe = { class: "task-item-description" },
  Je = { class: "task-item-bottom" },
  Ke = { class: "bottom-title" },
  Qe = ["onClick"],
  Xe = { class: "dialog-window" },
  Ye = { class: "dialog-wrapper" },
  Ze = { class: "dialog-title" },
  et = { class: "dialog-tips" },
  tt = { class: "dialog-content" },
  at = H({
    __name: "index",
    setup(Q) {
      const { t: o } = V(),
        w = d(!1),
        g = U(),
        { ActiveTaskMap: c, ActiveSotre: C, getActive: b } = re();
      b();
      const { downAppTip: T } = ue(),
        k = d(""),
        N = d("0"),
        i = d([]),
        P = d([]),
        R = d([]),
        l = q(() => {
          let e = [...P.value, ...R.value];
          if (e.length == 0) return [];
          const s = ["", 2, 1, 3];
          e = e.sort((_, $) => s[_.status] - s[$.status]);
          const v = e.filter((_) => _.status == 1);
          v.sort(
            (_, $) => z($.schedule, $.taskTarget) - z(_.schedule, _.taskTarget)
          );
          const W = e.findIndex((_) => _.status == 1);
          return e.splice(W, v.length, ...v), e;
        }),
        p = async () => {
          const e = await m(fe());
          e && (P.value = e.data.map((s) => ({ ...s, type: "week" })) || []);
        },
        S = async () => {
          const e = await m(ye());
          e && (R.value = e.data.map((s) => ({ ...s, type: "day" })) || []);
        },
        L = async () => {
          p(), S();
        },
        j = () => {
          g.push({ name: "activity" });
        };
      function z(e, s) {
        return s == 0 ? 0 : (e / s) * 100;
      }
      const r = async () => {
          i.value.length = 0;
          const e = await m(ve());
          e != null && e.data && i.value.push(e == null ? void 0 : e.data);
        },
        X = (e) =>
          ({ 1: o("goComplete"), 2: o("receive"), 3: o("claimed") }[e] || ""),
        Y = (e) =>
          ({ 1: o("undone"), 2: o("complete"), 3: o("complete") }[e] || ""),
        Z = (e) =>
          ({
            0: o("goComplete"),
            1: o("receive"),
            2: o("claimed"),
            3: o("claimed"),
          }[e] || ""),
        ee = (e) =>
          ({
            0: o("undone"),
            1: o("actTip2"),
            2: o("claimed"),
            3: o("complete"),
          }[e] || ""),
        M = d(null),
        te = async (e) => {
          M.value && clearTimeout(M.value),
            (M.value = setTimeout(async () => {
              if (e.status == 1) return se(e);
              if (e.status == 3) return;
              let s;
              e.type == "week"
                ? (s = await m(ge({ weeklyAwardId: e.configId })))
                : e.type == "day" &&
                  (s = await m(ke({ dailyAwardId: e.configId }))),
                s.code === 0 &&
                  ((w.value = !0),
                  (N.value = e.taskAwardAmount),
                  (k.value = e.taskTitle),
                  L());
            }, 100));
        },
        O = d(null),
        ae = async (e) => {
          O.value && clearTimeout(O.value),
            (O.value = setTimeout(async () => {
              if ([2, 3].includes(e.status)) return;
              if (e.status == 0) return await T("Recharge");
              (await m(pe({ id: e.id }))) &&
                ((w.value = !0),
                (N.value =
                  e.totalNumber == 0
                    ? "0"
                    : (
                        Math.floor((e.amount / e.totalNumber) * 100) / 100
                      ).toString()),
                (k.value = e.title),
                r());
            }, 100));
        },
        se = async (e) => {
          if (e.taskId == "D20")
            return e.schedule < e.taskTarget
              ? await T("Recharge")
              : g.push({ name: "home" });
          if (!c[e.taskId].goPath) return;
          if (
            (c[e.taskId].homeType &&
              sessionStorage.setItem("clickedGameType", c[e.taskId].homeType),
            c[e.taskId].goPath == "Recharge" ||
              c[e.taskId].goPath == "Withdraw")
          )
            return T(c[e.taskId].goPath);
          g.push({ name: c[e.taskId].goPath });
        },
        ne = () => {
          g.push({ name: "DailyTasks-Record" });
        };
      return (
        oe(
          () => C.value.isOpenActivityAward,
          (e) => {
            e && L();
          },
          { immediate: !0 }
        ),
        ie(() => {
          r();
        }),
        (e, s) => {
          var x;
          const v = I("svg-icon"),
            W = I("NavBar"),
            _ = I("van-dialog"),
            $ = ce("lazy");
          return (
            h(),
            y("div", Te, [
              u(
                W,
                {
                  title: "",
                  placeholder: !1,
                  "left-arrow": "",
                  onClickLeft: j,
                },
                {
                  right: G(() => [
                    t("div", { class: "navi-record", onClick: ne }, [
                      u(v, { name: "watchCollection" }),
                      t("span", null, a(e.$t("awardsRecord")), 1),
                    ]),
                  ]),
                  _: 1,
                }
              ),
              t("div", $e, [
                t("div", null, [
                  D(
                    `				<img v-lazy="getIconsPublic('activity/DailyTask', 'present')" />`
                  ),
                  t("p", null, [
                    t("div", Ae, a(e.$t("actTip1")), 1),
                    t("div", Ie, [
                      t("div", null, a(e.$t("awardsTip1")), 1),
                      t("div", null, a(e.$t("awardsTip3")), 1),
                    ]),
                  ]),
                ]),
              ]),
              t("div", Ce, [
                i.value.length > 0
                  ? (h(),
                    y("div", De, [
                      t("div", Ne, [
                        t("div", Re, a(e.$t("actTip3")), 1),
                        t(
                          "span",
                          Se,
                          a(ee((x = i.value[0]) == null ? void 0 : x.status)),
                          1
                        ),
                      ]),
                      t("div", Pe, [
                        t("div", Le, [
                          u(v, { name: "actNewGift" }),
                          t("div", null, a(i.value[0].title), 1),
                        ]),
                        t(
                          "div",
                          ze,
                          a(
                            i.value[0].receivedNumber +
                              "/" +
                              i.value[0].totalNumber
                          ),
                          1
                        ),
                      ]),
                      t("div", Be, a(i.value[0].description), 1),
                      t("div", Ge, [
                        t("div", null, a(e.$t("awardsAmount")), 1),
                        t("div", je, [
                          D(` <img v-lazy="getIcons('wallet', 'balance')" /> `),
                          u(v, { name: "activityWallet" }),
                          t("span", null, a(f(B)(i.value[0].amount)), 1),
                        ]),
                      ]),
                      t(
                        "div",
                        {
                          class: A([
                            "btn btnNew",
                            `status${i.value[0].status}`,
                          ]),
                          onClick: s[0] || (s[0] = (n) => ae(i.value[0])),
                        },
                        a(Z(i.value[0].status)),
                        3
                      ),
                    ]))
                  : D("v-if", !0),
                (h(!0),
                y(
                  F,
                  null,
                  J(
                    l.value,
                    (n, le) => (
                      h(),
                      y("div", { class: "task-item", key: le }, [
                        t("div", Me, [
                          t(
                            "div",
                            { class: A(["hearder-status", `${n.type}`]) },
                            a(
                              n.type == "week"
                                ? e.$t("actTip4")
                                : e.$t("dailyMission")
                            ),
                            3
                          ),
                          t(
                            "span",
                            {
                              class: A(
                                n.status == 2 ? "headerR" : "headerGray"
                              ),
                            },
                            a(Y(n.status)),
                            3
                          ),
                        ]),
                        n.taskId == "D20"
                          ? (h(),
                            y("div", Oe, [
                              t("div", We, [
                                u(v, { name: f(c).A1.icon }, null, 8, ["name"]),
                                t("div", null, a(n.taskTitle), 1),
                              ]),
                              t("div", xe, [
                                t("span", null, a(e.$t("recharge")), 1),
                                t(
                                  "span",
                                  Ee,
                                  a(n.schedule + "/" + n.taskTarget),
                                  1
                                ),
                              ]),
                              t("div", He, [
                                t("span", null, a(e.$t("betting")), 1),
                                t(
                                  "span",
                                  Ve,
                                  a(n.scheduleTwo + "/" + n.targetTwo),
                                  1
                                ),
                              ]),
                            ]))
                          : (h(),
                            y("div", Ue, [
                              t(
                                "div",
                                {
                                  class: A([
                                    "type-title",
                                    [f(c)[n.taskId].icon],
                                  ]),
                                },
                                [
                                  u(v, { name: f(c)[n.taskId].icon }, null, 8, [
                                    "name",
                                  ]),
                                  t("div", null, a(n.taskTitle), 1),
                                ],
                                2
                              ),
                              t(
                                "div",
                                qe,
                                a(n.schedule + "/" + n.taskTarget),
                                1
                              ),
                            ])),
                        t("div", Fe, a(n.taskDescribe), 1),
                        t("div", Je, [
                          t("div", null, a(e.$t("awardsAmount")), 1),
                          t("div", Ke, [
                            u(v, { name: "activityWallet" }),
                            D(
                              ` <img v-lazy="getIcons('wallet', 'balance')" /> `
                            ),
                            t("span", null, a(f(B)(n.taskAwardAmount)), 1),
                          ]),
                        ]),
                        t(
                          "div",
                          {
                            class: A(["btn btnOther", `status${n.status}`]),
                            onClick: (rt) => te(n),
                          },
                          a(X(n.status)),
                          11,
                          Qe
                        ),
                      ])
                    )
                  ),
                  128
                )),
              ]),
              u(
                _,
                {
                  show: w.value,
                  "onUpdate:show": s[3] || (s[3] = (n) => (w.value = n)),
                  "show-confirm-button": !1,
                  className: "noOverHidden",
                },
                {
                  default: G(() => [
                    t("div", Xe, [
                      t("div", Ye, [
                        E(t("img", null, null, 512), [
                          [$, f(_e)("public", "succeed")],
                        ]),
                        t("div", Ze, a(e.$t("awardsReceived")), 1),
                        t("div", et, a(k.value), 1),
                        t("div", tt, [
                          u(v, { name: "receivedSuccessfuly" }),
                          D(` <img v-lazy="getIcons('wallet', 'balance')" /> `),
                          t("span", null, a(f(B)(N.value)), 1),
                        ]),
                        t(
                          "div",
                          {
                            class: "dialog-btn",
                            onClick: s[1] || (s[1] = (n) => (w.value = !1)),
                          },
                          a(e.$t("confirm")),
                          1
                        ),
                        t(
                          "div",
                          {
                            class: "dialog-footer",
                            onClick: s[2] || (s[2] = (n) => (w.value = !1)),
                          },
                          [
                            E(t("img", null, null, 512), [
                              [$, f(he)("activity/DailyTask", "close")],
                            ]),
                          ]
                        ),
                      ]),
                    ]),
                  ]),
                  _: 1,
                },
                8,
                ["show"]
              ),
            ])
          );
        }
      );
    },
  });
const st = K(at, [
    ["__scopeId", "data-v-d7213382"],
    [
      "__file",
      "/usr/local/jenkins-prod/workspace/ar051-india-tiranga/src/views/activity/DailyTasks/index.vue",
    ],
  ]),
  _t = Object.freeze(
    Object.defineProperty(
      { __proto__: null, default: st },
      Symbol.toStringTag,
      { value: "Module" }
    )
  ),
  nt = { class: "task-record-container" },
  lt = { class: "head" },
  ot = { class: "record-panel van-clearfix" },
  it = { class: "markRed" },
  ct = H({
    __name: "index",
    setup(Q) {
      const { t: o } = V(),
        w = U(),
        g = d([]),
        c = d(!1),
        C = d(!1),
        b = d(1),
        T = d(!1),
        k = d(1),
        N = q(() => (T.value ? "" : o("noMoreThere"))),
        i = async () => {
          let l;
          k.value == 1
            ? (l = await m(we({ pageNo: b.value, pageSize: 20 })))
            : (l = await m(me({ pageNo: b.value, pageSize: 20 }))),
            l
              ? ((T.value = l.data.totalCount == 0),
                l.data.totalPage <= b.value ? (C.value = !0) : (C.value = !1),
                l.data.list &&
                  (g.value.push(...l.data.list),
                  g.value.sort((p, S) => S.createDate - p.createDate)),
                b.value++)
              : (C.value = !0),
            (c.value = !1);
        },
        P = () => {
          w.push({ name: "DailyTasks" });
        };
      function R(l) {
        (k.value = l), (b.value = 1), (g.value.length = 0), i();
      }
      return (l, p) => {
        const S = I("NavBar"),
          L = I("van-sticky"),
          j = I("svg-icon"),
          z = I("van-list");
        return (
          h(),
          y("div", nt, [
            u(
              S,
              {
                title: l.$t("titlePickUpRecord"),
                placeholder: !1,
                "left-arrow": "",
                onClickLeft: P,
              },
              null,
              8,
              ["title"]
            ),
            u(
              L,
              { "offset-top": 49 },
              {
                default: G(() => [
                  t("div", lt, [
                    t(
                      "button",
                      {
                        class: A({ active: k.value == 1 }),
                        onClick: p[0] || (p[0] = (r) => R(1)),
                      },
                      a(l.$t("actTip7")),
                      3
                    ),
                    t(
                      "button",
                      {
                        class: A({ active: k.value == 2 }),
                        onClick: p[1] || (p[1] = (r) => R(2)),
                      },
                      a(l.$t("actTip8")),
                      3
                    ),
                  ]),
                ]),
                _: 1,
              }
            ),
            u(
              z,
              {
                loading: c.value,
                "onUpdate:loading": p[2] || (p[2] = (r) => (c.value = r)),
                finished: C.value,
                "finished-text": N.value,
                onLoad: i,
              },
              {
                default: G(() => [
                  t("div", ot, [
                    (h(!0),
                    y(
                      F,
                      null,
                      J(
                        g.value,
                        (r) => (
                          h(),
                          y(
                            "div",
                            { class: "record-panel-item", key: r.status },
                            [
                              t(
                                "h1",
                                null,
                                a(
                                  k.value == 1
                                    ? l.$t("actTip5")
                                    : l.$t("actTip6")
                                ),
                                1
                              ),
                              t("h2", null, [
                                t("span", null, a(r.taskTitle), 1),
                                t(
                                  "span",
                                  it,
                                  a(r.taskTarget + "/" + r.taskTarget),
                                  1
                                ),
                              ]),
                              t("div", null, [
                                t("span", null, a(r.createDate), 1),
                                t("h3", null, [
                                  u(j, { name: "activityWallet" }),
                                  t("span", null, a(f(B)(r.awardAmount)), 1),
                                ]),
                              ]),
                            ]
                          )
                        )
                      ),
                      128
                    )),
                  ]),
                ]),
                _: 1,
              },
              8,
              ["loading", "finished", "finished-text"]
            ),
            T.value ? (h(), de(be, { key: 0 })) : D("v-if", !0),
          ])
        );
      };
    },
  });
const dt = K(ct, [
    ["__scopeId", "data-v-40b81b7f"],
    [
      "__file",
      "/usr/local/jenkins-prod/workspace/ar051-india-tiranga/src/views/activity/DailyTasks/Record/index.vue",
    ],
  ]),
  ht = Object.freeze(
    Object.defineProperty(
      { __proto__: null, default: dt },
      Symbol.toStringTag,
      { value: "Module" }
    )
  );
export { ht as a, _t as i };
