import { jsxs as l, jsx as s } from "react/jsx-runtime";
import { h as Is } from "./index8.js";
import { useState as w, useRef as K, useEffect as T, useCallback as hs, useMemo as $s } from "react";
import { s as e, c as gs, u as ws, a as R } from "./sl-types.js";
import { e as Ts } from "./index3.js";
import "./feature.js";
import { x as G } from "./storage.js";
import { D as ys, a as Cs, e as H, o as bs } from "./index12.js";
import { B as I } from "./index6.js";
import { d as v, Q as $, a as J, N as E, S as fs, A as B } from "./useStreamLayerApp2.js";
import { O as D } from "./index14.js";
import { E as Ns, y as ks } from "./index13.js";
import { d as qs } from "./index5.js";
import { B as xs, z as Es, F as Ss } from "./hooks-WfHlJH12.js";
const C = /* @__PURE__ */ e("div")({
  name: "Media",
  class: "m1bcvojl",
  propsAsIs: !1
}), Ds = () => C, Ls = /* @__PURE__ */ e(Ds())({
  name: "MediaImgBottom",
  class: "m58gin0",
  propsAsIs: !0
}), Ms = () => C, x = /* @__PURE__ */ e(Ms())({
  name: "MediaImgSolid",
  class: "m1atm8do",
  propsAsIs: !0
}), Os = () => C, Rs = /* @__PURE__ */ e(Os())({
  name: "MediaImgRounded",
  class: "myx3xoi",
  propsAsIs: !0
}), Bs = () => C, js = /* @__PURE__ */ e(Bs())({
  name: "MediaImgCentered",
  class: "m1bwv0gx",
  propsAsIs: !0
}), zs = () => C, Ps = /* @__PURE__ */ e(zs())({
  name: "MediaImgInsight",
  class: "mntjanp",
  propsAsIs: !0
}), Us = /* @__PURE__ */ e("div")({
  name: "VideoIcon",
  class: "v1kofb47",
  propsAsIs: !1
}), Fs = {
  [v.UNSET]: x,
  [v.NONE]: x,
  [v.ROUNDED]: Rs,
  [v.CENTERED]: js,
  [v.TRANSPARENT]: Ls,
  [v.SOLID]: x
}, j = ({
  src: n,
  imageMode: o = v.UNSET,
  withVideo: t,
  fromInsight: i
}) => {
  if (o === v.NONE)
    return null;
  const a = i ? Ps : Fs[o];
  return /* @__PURE__ */ l(a, {
    children: [/* @__PURE__ */ s("img", {
      src: n,
      alt: ""
    }), t && /* @__PURE__ */ s(Us, {
      children: /* @__PURE__ */ s(I, {
        name: "icon-play"
      })
    })]
  });
}, Vs = /* @__PURE__ */ e("div")({
  name: "NotificationContent",
  class: "nuraq9m",
  propsAsIs: !1
}), Qs = /* @__PURE__ */ e("div")({
  name: "NotificationContainer",
  class: "ns1nzpg",
  propsAsIs: !1
}), X = /* @__PURE__ */ e("div")({
  name: "Body",
  class: "b1j59nzs",
  propsAsIs: !1
}), Ws = /* @__PURE__ */ e("div")({
  name: "Title",
  class: "t9vmnpp",
  propsAsIs: !1
}), Ys = /* @__PURE__ */ e("button")({
  name: "Button",
  class: "b14ivj5k",
  propsAsIs: !1
}), _s = () => I, Ks = /* @__PURE__ */ e(_s())({
  name: "StyledChevronRight",
  class: "s1atci8n",
  propsAsIs: !0
}), Gs = /* @__PURE__ */ e("div")({
  name: "QuoteWrap",
  class: "q4w8jgs",
  propsAsIs: !1
}), Hs = /* @__PURE__ */ e("blockquote")({
  name: "Quote",
  class: "qaa0kez",
  propsAsIs: !1
}), Js = /* @__PURE__ */ e("div")({
  name: "Body",
  class: "b1wvd52w",
  propsAsIs: !1
}), Xs = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "ccvukea",
  propsAsIs: !1
}), Zs = ({ image: n, tweet: o, account: t, accountVerified: i, body: a, title: p }) => {
  var d;
  return /* @__PURE__ */ l(Xs, { children: [
    p && /* @__PURE__ */ s(Gs, { children: /* @__PURE__ */ s(Hs, { children: p }) }),
    /* @__PURE__ */ s(
      ys,
      {
        image: n,
        name: (d = o == null ? void 0 : o.meta) == null ? void 0 : d.accountName,
        userName: t,
        verified: i,
        createdTweet: o == null ? void 0 : o.date
      }
    ),
    /* @__PURE__ */ s(Js, { children: Cs(a) })
  ] });
}, se = ({ title: n, questionType: o, questionTypeData: t }) => /* @__PURE__ */ l(X, { children: [
  /* @__PURE__ */ s(
    G,
    {
      questionTypeData: t,
      questionType: o,
      questionStatus: J.UNSET
    }
  ),
  n && /* @__PURE__ */ s(Ws, { children: n })
] }), ee = ({ tweet: n }) => n ? /* @__PURE__ */ s(X, { children: /* @__PURE__ */ s(Zs, { ...n, controlVideo: () => {
} }) }) : null, ne = ({ action: n, questionType: o, inApp: t, insight: i, tweet: a }) => {
  var p;
  const d = H[o], r = bs[o];
  if (!d || !t || !t.notification)
    return null;
  const { title: m, image: u, imageMode: A } = t.notification;
  let g = u;
  o === $.TWEET && a != null && a.tweetMedia && (g = a.tweetMedia.image), A === v.NONE && (g = "");
  const h = t.useMediaFromContent && (i == null ? void 0 : i.image), c = o === $.TWEET && ((p = a == null ? void 0 : a.tweetMedia) == null ? void 0 : p.video) || o === $.FACTOID && (i == null ? void 0 : i.video);
  return /* @__PURE__ */ s(Qs, { "data-a": "intr", className: "SL_InApp", onClick: n, children: /* @__PURE__ */ l(Vs, { style: g ? {} : { paddingLeft: "1.5rem" }, children: [
    g && !h && /* @__PURE__ */ s(j, { src: g, imageMode: A, withVideo: !!c }),
    h && /* @__PURE__ */ s(j, { src: h, fromInsight: !0, withVideo: !!c }),
    o === $.TWEET ? /* @__PURE__ */ s(ee, { tweet: a }) : /* @__PURE__ */ s(se, { questionTypeData: d, questionType: o, title: m }),
    /* @__PURE__ */ s(Ys, { name: "inapp-button", children: r || "Open" }),
    /* @__PURE__ */ s(Ks, { name: "chevronRight" })
  ] }) });
}, oe = () => ({
  color: n
}) => n || "transparent", z = /* @__PURE__ */ e("div")({
  name: "MediaComponentWrap",
  class: "mek728j",
  propsAsIs: !1,
  vars: {
    "mek728j-0": [oe()]
  }
}), y = /* @__PURE__ */ e("div")({
  name: "Media",
  class: "m461t56",
  propsAsIs: !1
}), ie = () => y, te = /* @__PURE__ */ e(ie())({
  name: "MediaImgBottom",
  class: "m22bh04",
  propsAsIs: !0
}), ae = () => y, re = /* @__PURE__ */ e(ae())({
  name: "MediaVideo",
  class: "m17u1e34",
  propsAsIs: !0
}), ce = () => y, le = /* @__PURE__ */ e(ce())({
  name: "MediaImgContentMedia",
  class: "m4j3eds",
  propsAsIs: !0
}), de = () => y, pe = /* @__PURE__ */ e(de())({
  name: "MediaImgSolid",
  class: "m1lp3swr",
  propsAsIs: !0
}), me = () => y, ue = /* @__PURE__ */ e(me())({
  name: "MediaImgRounded",
  class: "mc7lij",
  propsAsIs: !0
}), ve = () => y, Ae = /* @__PURE__ */ e(ve())({
  name: "MediaImgCentered",
  class: "mwwaw7o",
  propsAsIs: !0
}), Ie = () => y, S = /* @__PURE__ */ e(Ie())({
  name: "MediaNone",
  class: "mqfzyyr",
  propsAsIs: !0
}), he = "v170mtgf", $e = {
  [v.UNSET]: S,
  [v.NONE]: S,
  [v.ROUNDED]: ue,
  [v.CENTERED]: Ae,
  [v.TRANSPARENT]: te,
  [v.SOLID]: pe
}, P = ({
  src: n,
  imageMode: o = v.UNSET,
  withVideo: t,
  color: i,
  useContentMedia: a,
  thumbnailUrl: p
}) => {
  if (!n)
    return /* @__PURE__ */ s(z, {
      color: i,
      children: /* @__PURE__ */ s(S, {})
    });
  const d = a === E.ENABLED ? le : $e[o];
  return /* @__PURE__ */ s(z, {
    color: i,
    children: t ? /* @__PURE__ */ s(re, {
      children: /* @__PURE__ */ s(Ns, {
        className: he,
        source: n,
        poster: p || ""
      })
    }) : /* @__PURE__ */ s(d, {
      children: /* @__PURE__ */ s("img", {
        src: n,
        alt: ""
      })
    })
  });
}, ge = () => ({
  withoutPadding: n
}) => n ? "0px" : "1rem", Z = /* @__PURE__ */ e("div")({
  name: "NotificationContent",
  class: "n1p3bk1c",
  propsAsIs: !1,
  vars: {
    "n1p3bk1c-0": [ge()]
  }
}), we = /* @__PURE__ */ e("div")({
  name: "MainContent",
  class: "m1g211mu",
  propsAsIs: !1
}), Te = () => I, ye = /* @__PURE__ */ e(Te())({
  name: "StyledChevronRight",
  class: "sx1hq4c",
  propsAsIs: !0
}), ss = /* @__PURE__ */ e("div")({
  name: "NotificationContainer",
  class: "n1fcriet",
  propsAsIs: !1
}), Ce = () => ({
  questionType: n
}) => n === $.FACTOID ? "7.3rem" : "4.5rem", be = () => ({
  webos: n
}) => n ? "11px 0px 8px 0px" : "11px 0px", fe = () => ({
  imageMode: n,
  webos: o
}) => o ? "330px" : n === v.SOLID ? "310px" : n === v.CENTERED || n === v.ROUNDED || n === v.TRANSPARENT ? "370px" : "430px", Ne = /* @__PURE__ */ e("div")({
  name: "Body",
  class: "b1byyovs",
  propsAsIs: !1,
  vars: {
    "b1byyovs-0": [Ce()],
    "b1byyovs-1": [be()],
    "b1byyovs-2": [fe()]
  }
}), ke = () => ({
  webos: n
}) => n ? "0.85rem" : "1.033rem", qe = () => ({
  webos: n
}) => n ? "0.95rem" : "1.25rem", xe = () => ({
  webos: n
}) => n ? "4.7rem" : "2.25rem", Ee = () => ({
  webos: n
}) => n ? "pre-wrap" : "nowrap", Se = /* @__PURE__ */ e("div")({
  name: "Title",
  class: "t1y5k5id",
  propsAsIs: !1,
  vars: {
    "t1y5k5id-0": [ke()],
    "t1y5k5id-1": [qe()],
    "t1y5k5id-2": [xe()],
    "t1y5k5id-3": [Ee()]
  }
}), De = /* @__PURE__ */ e("div")({
  name: "Description",
  class: "dw9eb7l",
  propsAsIs: !1
}), Le = /* @__PURE__ */ e("div")({
  name: "LogoImgContainer",
  class: "ldu8wgy",
  propsAsIs: !1
}), es = /* @__PURE__ */ e("img")({
  name: "LogoImg",
  class: "ln4a3eh",
  propsAsIs: !1
}), Me = () => ss, Oe = /* @__PURE__ */ e(Me())({
  name: "NotificationInterstitialContainer",
  class: "no2k63v",
  propsAsIs: !0
}), Re = /* @__PURE__ */ e("div")({
  name: "TVButtons",
  class: "th9nn6a",
  propsAsIs: !1
}), ns = /* @__PURE__ */ e("button")({
  name: "TVButton",
  class: "t1eee77p",
  propsAsIs: !1
}), Be = () => ns, je = /* @__PURE__ */ e(Be())({
  name: "DismissButton",
  class: "ds000hw",
  propsAsIs: !0
}), ze = () => ns, Pe = /* @__PURE__ */ e(ze())({
  name: "AnswerButton",
  class: "a1nz9hoe",
  propsAsIs: !0
}), Ue = ({ title: n, questionType: o, questionTypeData: t, description: i, imageMode: a, webos: p }) => /* @__PURE__ */ l(Ne, { imageMode: a, questionType: o, webos: p, children: [
  /* @__PURE__ */ s(
    G,
    {
      questionTypeData: t,
      questionType: o,
      questionStatus: J.UNSET
    }
  ),
  n && /* @__PURE__ */ s(Se, { webos: p, children: n }),
  i && /* @__PURE__ */ s(De, { children: i })
] }), Fe = D(Oe), Ve = D(je), Qe = D(Pe), We = ({
  className: n,
  sponsorLogo: o,
  onClick: t,
  webos: i
}) => /* @__PURE__ */ s(
  Fe,
  {
    className: n,
    autoFocus: !0,
    webos: i,
    onClick: t,
    "data-webos": i,
    children: /* @__PURE__ */ s(Z, { withoutPadding: !0, children: /* @__PURE__ */ s(es, { src: o }) })
  }
), Ye = ({
  action: n,
  close: o,
  questionType: t,
  inApp: i,
  insight: a,
  color: p,
  webos: d,
  className: r
}) => {
  var m, u, A;
  const [g, h] = w(!1), c = K();
  T(() => (i != null && i.sponsorLogo && (h(!0), c.current = setTimeout(() => {
    h(!1);
  }, 5e3)), () => clearTimeout(c.current)), [i == null ? void 0 : i.sponsorLogo]);
  const O = H[t];
  if (!O || !i || !i.notification)
    return null;
  const { title: ps, image: ms, imageMode: f, useContentMedia: N } = i.notification, us = t === $.FACTOID ? a == null ? void 0 : a.heading : ps, vs = t === $.FACTOID ? a == null ? void 0 : a.body : "", As = ms, k = t === $.FACTOID && ((m = a == null ? void 0 : a.video) == null ? void 0 : m.url) && (i == null ? void 0 : i.isVideo) && N === E.ENABLED, q = N === E.ENABLED ? k ? (u = a == null ? void 0 : a.video) == null ? void 0 : u.url : a == null ? void 0 : a.image : "";
  return i != null && i.sponsorLogo && g ? /* @__PURE__ */ s(
    We,
    {
      className: r,
      sponsorLogo: i == null ? void 0 : i.sponsorLogo,
      webos: d,
      onClick: () => h(!1)
    }
  ) : /* @__PURE__ */ l(
    ss,
    {
      "data-a": "intr",
      className: gs("SL_InApp", r),
      onClick: (b) => {
        d || n == null || n(b);
      },
      "data-is-insight": t === $.FACTOID,
      "data-webos": d,
      children: [
        (i == null ? void 0 : i.sponsorLogo) && /* @__PURE__ */ s(Le, { children: /* @__PURE__ */ s(es, { src: i == null ? void 0 : i.sponsorLogo }) }),
        /* @__PURE__ */ l(Z, { children: [
          /* @__PURE__ */ l(we, { children: [
            !q && /* @__PURE__ */ s(P, { src: As, imageMode: f, withVideo: !!k, color: p }),
            q && /* @__PURE__ */ s(
              P,
              {
                src: q,
                imageMode: f,
                withVideo: !!k,
                color: p,
                useContentMedia: N,
                thumbnailUrl: (A = a == null ? void 0 : a.video) == null ? void 0 : A.thumbnailUrl
              }
            ),
            /* @__PURE__ */ s(
              Ue,
              {
                questionTypeData: O,
                questionType: t,
                title: us,
                description: vs,
                imageMode: f,
                webos: d
              }
            )
          ] }),
          !d && /* @__PURE__ */ s(ye, { name: "chevronRight" }),
          d && /* @__PURE__ */ l(Re, { children: [
            /* @__PURE__ */ s(
              Ve,
              {
                webos: !0,
                "data-close-btn": "true",
                onClick: (b) => {
                  b.stopPropagation(), o == null || o(b);
                },
                children: "Dismiss"
              }
            ),
            /* @__PURE__ */ s(Qe, { webos: !0, autoFocus: !0, onClick: n, children: "Answer" })
          ] })
        ] })
      ]
    }
  );
}, _e = /* @__PURE__ */ e("div")({
  name: "NotificationContainer",
  class: "n11jcrxe",
  propsAsIs: !1
}), U = /* @__PURE__ */ e("img")({
  name: "Icon",
  class: "i1vmpt6u",
  propsAsIs: !1
}), Ke = /* @__PURE__ */ e("div")({
  name: "IconContainer",
  class: "i180665s",
  propsAsIs: !1
}), Ge = () => I, He = /* @__PURE__ */ e(Ge())({
  name: "TitleIcon",
  class: "t16zzzei",
  propsAsIs: !0
}), Je = () => ks, Xe = /* @__PURE__ */ e(Je())({
  name: "Close",
  class: "c1sur0q2",
  propsAsIs: !0
}), Ze = /* @__PURE__ */ e("div")({
  name: "Body",
  class: "bai9j52",
  propsAsIs: !1
}), sn = /* @__PURE__ */ e("div")({
  name: "Title",
  class: "t1bnt25p",
  propsAsIs: !1
}), en = /* @__PURE__ */ e("div")({
  name: "Description",
  class: "dmixjec",
  propsAsIs: !1
}), nn = /* @__PURE__ */ e("button")({
  name: "Button",
  class: "b1ubkw1q",
  propsAsIs: !1
}), on = ({
  open: n,
  close: o,
  ...t
}) => {
  var i, a;
  return /* @__PURE__ */ l(
    _e,
    {
      "data-a": "intr",
      onClick: () => {
        n == null || n(), t && t.markIstantOpen();
      },
      children: [
        /* @__PURE__ */ l(Ke, { children: [
          /* @__PURE__ */ s(U, { className: "on-light", src: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification.png" }),
          /* @__PURE__ */ s(
            U,
            {
              className: "on-dark",
              src: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/notification-dark.png"
            }
          )
        ] }),
        /* @__PURE__ */ l(Ze, { children: [
          /* @__PURE__ */ l(sn, { children: [
            /* @__PURE__ */ s(He, { name: "icon-trophy-solid" }),
            (i = t == null ? void 0 : t.titleCard) == null ? void 0 : i.title
          ] }),
          /* @__PURE__ */ l(en, { children: [
            /* @__PURE__ */ s("span", { children: (a = t == null ? void 0 : t.titleCard) == null ? void 0 : a.subtitle }),
            /* @__PURE__ */ s(nn, { name: "inapp-button", children: "Play Now" })
          ] })
        ] }),
        /* @__PURE__ */ s(
          Xe,
          {
            close: (p) => {
              p == null || p.stopPropagation(), o == null || o();
            }
          }
        )
      ]
    }
  );
}, tn = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "cef8huz",
  propsAsIs: !1
}), an = () => I, rn = /* @__PURE__ */ e(an())({
  name: "CheckIcon",
  class: "c1mo15kk",
  propsAsIs: !0
}), cn = () => I, ln = /* @__PURE__ */ e(cn())({
  name: "PredictionIcon",
  class: "p16zkqnm",
  propsAsIs: !0
}), dn = /* @__PURE__ */ e("div")({
  name: "PredictionIconContainer",
  class: "pjszi7a",
  propsAsIs: !1
}), pn = /* @__PURE__ */ e("div")({
  name: "BodyContainer",
  class: "bftbmo3",
  propsAsIs: !1
}), mn = /* @__PURE__ */ e("div")({
  name: "Body",
  class: "barrbyu",
  propsAsIs: !1
}), un = /* @__PURE__ */ e("div")({
  name: "Subtitle",
  class: "sz7237i",
  propsAsIs: !1
}), vn = ({
  step: n,
  children: o,
  answer: t,
  state: i = "pending"
}) => {
  const [a, p] = w(0), [d] = w(() => new ResizeObserver((m) => {
    window.requestAnimationFrame(() => {
      var u, A;
      p(((A = (u = m == null ? void 0 : m[0]) == null ? void 0 : u.contentRect) == null ? void 0 : A.width) ?? 0);
    });
  })), r = hs((m) => {
    m ? d.observe(m) : d.disconnect();
  }, [d]);
  return T(() => () => {
    d.disconnect();
  }, [d]), /* @__PURE__ */ l(tn, {
    children: [/* @__PURE__ */ s(dn, {
      children: /* @__PURE__ */ s(ln, {
        name: "icon-prediction"
      })
    }), /* @__PURE__ */ s(pn, {
      style: {
        minWidth: `${a}px`
      },
      children: /* @__PURE__ */ s(mn, {
        children: o
      }, n)
    }), /* @__PURE__ */ s(un, {
      ref: r,
      className: i,
      children: /* @__PURE__ */ l("div", {
        children: [/* @__PURE__ */ s(rn, {
          name: "icon-check"
        }), "Your Pick: ", t]
      })
    })]
  });
}, An = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "ckyzolp",
  propsAsIs: !1
}), L = /* @__PURE__ */ e("div")({
  name: "Line",
  class: "l16t1zr7",
  propsAsIs: !1
}), In = () => L, hn = /* @__PURE__ */ e(In())({
  name: "Line1",
  class: "le78kvg",
  propsAsIs: !0
}), $n = () => L, gn = /* @__PURE__ */ e($n())({
  name: "Line2",
  class: "l1o7966d",
  propsAsIs: !0
}), wn = () => L, Tn = /* @__PURE__ */ e(wn())({
  name: "Line3",
  class: "lu9lyxq",
  propsAsIs: !0
}), yn = () => /* @__PURE__ */ l(An, {
  children: [/* @__PURE__ */ s(hn, {
    children: /* @__PURE__ */ s("div", {})
  }), /* @__PURE__ */ s(gn, {
    children: /* @__PURE__ */ s("div", {})
  }), /* @__PURE__ */ s(Tn, {
    children: /* @__PURE__ */ s("div", {})
  })]
}), Cn = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "c10jy6zf",
  propsAsIs: !1
}), bn = () => I, fn = /* @__PURE__ */ e(bn())({
  name: "CheckIcon",
  class: "c1c7scay",
  propsAsIs: !0
}), Nn = () => /* @__PURE__ */ l(Cn, {
  children: [/* @__PURE__ */ s(fn, {
    name: "icon-check"
  }), " Prediction results are in!"]
}), kn = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "cf6k2yy",
  propsAsIs: !1
}), qn = /* @__PURE__ */ e("div")({
  name: "Caption",
  class: "c1c8xjus",
  propsAsIs: !1
}), xn = /* @__PURE__ */ e("div")({
  name: "Title",
  class: "t1d1uekn",
  propsAsIs: !1
}), En = ({
  title: n
}) => /* @__PURE__ */ l(kn, {
  children: [/* @__PURE__ */ s(qn, {
    children: "Results for"
  }), /* @__PURE__ */ s(xn, {
    children: n
  })]
}), os = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "c181a1as",
  propsAsIs: !1
}), is = /* @__PURE__ */ e("div")({
  name: "Title",
  class: "t1cduox6",
  propsAsIs: !1
}), Sn = () => I, ts = /* @__PURE__ */ e(Sn())({
  name: "CorrectIcon",
  class: "c1onrv6j",
  propsAsIs: !0
}), Dn = () => ts, Ln = /* @__PURE__ */ e(Dn())({
  name: "InCorrectIcon",
  class: "i17n9o7e",
  propsAsIs: !0
}), Mn = () => /* @__PURE__ */ l(os, {
  children: [/* @__PURE__ */ l(is, {
    children: ["Congratulations!", /* @__PURE__ */ s("br", {}), "You answered correctly."]
  }), /* @__PURE__ */ s(ts, {
    name: "icon-check"
  })]
}), On = ({
  title: n
}) => /* @__PURE__ */ l(os, {
  children: [/* @__PURE__ */ l(is, {
    children: ["Better luck next time!", /* @__PURE__ */ s("br", {}), "Correct: ", n]
  }), /* @__PURE__ */ s(Ln, {
    name: "icon-cross"
  })]
}), Rn = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "cnxgcs2",
  propsAsIs: !1
}), Bn = /* @__PURE__ */ e("div")({
  name: "Title",
  class: "t903f8n",
  propsAsIs: !1
}), jn = () => I, zn = /* @__PURE__ */ e(jn())({
  name: "CheckIcon",
  class: "ceyu3qj",
  propsAsIs: !0
}), Pn = ({
  points: n
}) => /* @__PURE__ */ l(Rn, {
  children: [/* @__PURE__ */ l(Bn, {
    children: ["You won ", /* @__PURE__ */ s(qs, {
      delay: 0.5,
      prefix: "+",
      suffix: " points",
      value: n
    })]
  }), /* @__PURE__ */ s(zn, {
    name: "icon-trophy-solid"
  })]
}), F = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "cq3agu2",
  propsAsIs: !1
}), V = /* @__PURE__ */ e("div")({
  name: "Body",
  class: "b16qj0do",
  propsAsIs: !1
}), Q = {
  1: 3e3,
  2: 4e3,
  3: 4e3,
  4: 4e3
}, Un = ({ close: n, action: o, setStep: t, votedAnswer: i, correct: a, correctAnswerTitle: p, questionTitle: d, step: r }) => {
  if (T(() => {
    if (t) {
      const u = setTimeout(() => {
        Q[r + 1] && (a || r < 3) ? t(r + 1) : n == null || n();
      }, Q[r]);
      return () => {
        u && clearTimeout(u);
      };
    }
    return () => {
    };
  }, [t, r, n, a]), r === 1)
    return /* @__PURE__ */ s(F, { children: /* @__PURE__ */ s(V, { children: /* @__PURE__ */ s(Nn, {}) }) });
  let m = "pending";
  return (r === 3 || r === 4) && (m = a ? "correct" : "incorrect"), /* @__PURE__ */ s(F, { "data-a": "intr", onClick: () => o == null ? void 0 : o(), children: /* @__PURE__ */ l(V, { children: [
    r !== 1 && /* @__PURE__ */ s(yn, {}, r),
    /* @__PURE__ */ l(vn, { state: m, step: r, answer: (i == null ? void 0 : i.title) || "unknown", children: [
      r === 2 && /* @__PURE__ */ s(En, { title: d || "unknown" }),
      r === 3 && a && /* @__PURE__ */ s(Mn, {}),
      r === 3 && !a && /* @__PURE__ */ s(On, { title: p || "unknown" }),
      r === 4 && /* @__PURE__ */ s(Pn, { points: (i == null ? void 0 : i.points) || 0 })
    ] })
  ] }) });
}, Fn = ({ close: n, action: o, votedAnswer: t, correct: i, correctAnswerTitle: a, questionTitle: p }) => {
  const [d, r] = w(1);
  return /* @__PURE__ */ s(
    Un,
    {
      close: n,
      action: o,
      votedAnswer: t,
      correct: i,
      correctAnswerTitle: a,
      questionTitle: p,
      setStep: r,
      step: d,
      title: ""
    }
  );
}, Vn = /* @__PURE__ */ e("div")({
  name: "NotificationContainer",
  class: "n1i4h28u",
  propsAsIs: !1
}), Qn = ({ className: n, ...o }) => /* @__PURE__ */ s(Vn, { className: n, children: /* @__PURE__ */ s(Fn, { ...o }) }), Wn = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "cwa9tgs",
  propsAsIs: !1
}), Yn = /* @__PURE__ */ e("div")({
  name: "BodyContainer",
  class: "b1xx7swj",
  propsAsIs: !1
}), _n = /* @__PURE__ */ e("div")({
  name: "Body",
  class: "b1a21en",
  propsAsIs: !1
}), Kn = ({
  step: n,
  children: o,
  state: t = "pending"
}) => {
  const [i, a] = w(0);
  return T(() => {
    const p = new ResizeObserver((d) => {
      window.requestAnimationFrame(() => {
        var r, m;
        const u = ((m = (r = d == null ? void 0 : d[0]) == null ? void 0 : r.contentRect) == null ? void 0 : m.width) ?? 0;
        a(u);
      });
    });
    return () => {
      p.disconnect();
    };
  }, []), /* @__PURE__ */ s(Wn, {
    style: {
      padding: `${n === 3 && t === "incorrect" || n === 1 ? "5px 100px" : "5px 40px"}`
    },
    children: /* @__PURE__ */ s(Yn, {
      style: {
        minWidth: `${i}px`
      },
      children: /* @__PURE__ */ s(_n, {
        children: o
      }, n)
    })
  });
}, Gn = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "c1nd5cu8",
  propsAsIs: !1
}), M = /* @__PURE__ */ e("div")({
  name: "Line",
  class: "lgbipw0",
  propsAsIs: !1
}), Hn = () => M, Jn = /* @__PURE__ */ e(Hn())({
  name: "Line1",
  class: "l1anth16",
  propsAsIs: !0
}), Xn = () => M, Zn = /* @__PURE__ */ e(Xn())({
  name: "Line2",
  class: "l193yd7v",
  propsAsIs: !0
}), so = () => M, eo = /* @__PURE__ */ e(so())({
  name: "Line3",
  class: "lhbflsp",
  propsAsIs: !0
}), no = () => /* @__PURE__ */ l(Gn, {
  children: [/* @__PURE__ */ s(Jn, {
    children: /* @__PURE__ */ s("div", {})
  }), /* @__PURE__ */ s(Zn, {
    children: /* @__PURE__ */ s("div", {})
  }), /* @__PURE__ */ s(eo, {
    children: /* @__PURE__ */ s("div", {})
  })]
}), oo = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "c1lvd429",
  propsAsIs: !1
}), io = () => I, to = /* @__PURE__ */ e(io())({
  name: "PredictionIcon",
  class: "p1n4m87t",
  propsAsIs: !0
}), ao = () => /* @__PURE__ */ l(oo, {
  children: [/* @__PURE__ */ s(to, {
    name: "icon-prediction"
  }), " Prediction results are in!"]
}), ro = () => I, co = /* @__PURE__ */ e(ro())({
  name: "CheckIcon",
  class: "c126r8f9",
  propsAsIs: !0
}), lo = /* @__PURE__ */ e("div")({
  name: "Answer",
  class: "a1o2rpgl",
  propsAsIs: !1
}), po = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "cej6ci1",
  propsAsIs: !1
}), mo = /* @__PURE__ */ e("div")({
  name: "Title",
  class: "tob24mr",
  propsAsIs: !1
}), uo = ({
  title: n,
  answer: o
}) => /* @__PURE__ */ l(po, {
  children: [/* @__PURE__ */ s(mo, {
    children: n
  }), /* @__PURE__ */ l(lo, {
    children: [/* @__PURE__ */ s(co, {
      name: "icon-prediction"
    }), "Your Pick: ", o]
  })]
}), as = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "c1lesal4",
  propsAsIs: !1
}), rs = /* @__PURE__ */ e("div")({
  name: "Title",
  class: "tv66n4w",
  propsAsIs: !1
}), vo = () => I, Ao = /* @__PURE__ */ e(vo())({
  name: "CorrectIcon",
  class: "cx0vlv2",
  propsAsIs: !0
}), cs = /* @__PURE__ */ e("div")({
  name: "Answer",
  class: "akfh4v5",
  propsAsIs: !1
}), Io = ({
  answer: n
}) => /* @__PURE__ */ l(as, {
  children: [/* @__PURE__ */ s(rs, {
    children: "Congratulations! You answered correctly."
  }), /* @__PURE__ */ l(cs, {
    children: [/* @__PURE__ */ s(Ao, {
      name: "icon-correct"
    }), "Your Pick: ", n]
  })]
}), ho = ({
  title: n,
  answer: o
}) => /* @__PURE__ */ l(as, {
  children: [/* @__PURE__ */ l(rs, {
    children: ["Better luck next time!", /* @__PURE__ */ s("br", {}), "Correct: ", n]
  }), /* @__PURE__ */ l(cs, {
    children: ["Your Pick: ", o]
  })]
}), W = /* @__PURE__ */ e("div")({
  name: "Container",
  class: "cmox3ot",
  propsAsIs: !1
}), Y = /* @__PURE__ */ e("div")({
  name: "Body",
  class: "bqq1ix4",
  propsAsIs: !1
}), _ = {
  1: 3e3,
  2: 4e3,
  3: 4e3
}, $o = ({ close: n, action: o, setStep: t, votedAnswer: i, correct: a, correctAnswerTitle: p, questionTitle: d, step: r }) => {
  if (T(() => {
    if (t) {
      const u = setTimeout(() => {
        _[r + 1] && (a || r < 3) ? t(r + 1) : n == null || n();
      }, _[r]);
      return () => {
        u && clearTimeout(u);
      };
    }
    return () => {
    };
  }, [t, r, n, a]), r === 1)
    return /* @__PURE__ */ s(W, { children: /* @__PURE__ */ s(Y, { children: /* @__PURE__ */ s(ao, {}) }) });
  let m = "pending";
  return r === 3 && (m = a ? "correct" : "incorrect"), /* @__PURE__ */ s(W, { "data-a": "intr", onClick: () => o == null ? void 0 : o(), children: /* @__PURE__ */ l(Y, { children: [
    r !== 1 && /* @__PURE__ */ s(no, {}, r),
    /* @__PURE__ */ l(Kn, { state: m, step: r, children: [
      r === 2 && /* @__PURE__ */ s(uo, { title: d || "unknown", answer: (i == null ? void 0 : i.title) || "unknown" }),
      r === 3 && a && /* @__PURE__ */ s(Io, { answer: (i == null ? void 0 : i.title) || "unknown" }),
      r === 3 && !a && /* @__PURE__ */ s(ho, { title: p || "unknown", answer: (i == null ? void 0 : i.title) || "unknown" })
    ] })
  ] }) });
}, go = ({ close: n, action: o, votedAnswer: t, correct: i, correctAnswerTitle: a, questionTitle: p }) => {
  const [d, r] = w(1);
  return /* @__PURE__ */ s(
    $o,
    {
      close: n,
      action: o,
      votedAnswer: t,
      correct: i,
      correctAnswerTitle: a,
      questionTitle: p,
      setStep: r,
      step: d,
      title: ""
    }
  );
}, ls = /* @__PURE__ */ e("div")({
  name: "NotificationContainer",
  class: "nn0nqh6",
  propsAsIs: !1
}), wo = () => ({
  withoutPadding: n
}) => n ? "0px" : "1rem", To = /* @__PURE__ */ e("div")({
  name: "NotificationContent",
  class: "n1bcdf3j",
  propsAsIs: !1,
  vars: {
    "n1bcdf3j-0": [wo()]
  }
}), ds = /* @__PURE__ */ e("img")({
  name: "LogoImg",
  class: "l8jorbq",
  propsAsIs: !1
}), yo = () => ls, Co = /* @__PURE__ */ e(yo())({
  name: "NotificationInterstitialContainer",
  class: "nf920y3",
  propsAsIs: !0
}), bo = /* @__PURE__ */ e("div")({
  name: "LogoImgContainer",
  class: "lzsmehn",
  propsAsIs: !1
}), fo = ({
  className: n,
  sponsorLogo: o,
  onClick: t
}) => /* @__PURE__ */ s(Co, { className: n, onClick: t, children: /* @__PURE__ */ s(To, { withoutPadding: !0, children: /* @__PURE__ */ s(ds, { src: o }) }) }), No = ({ className: n, ...o }) => {
  var t, i, a, p, d;
  const [r, m] = w(!1), u = K();
  return T(() => {
    var A;
    return (A = o == null ? void 0 : o.inApp) != null && A.sponsorLogo && (m(!0), u.current = setTimeout(() => {
      m(!1);
    }, 5e3)), () => clearTimeout(u.current);
  }, [(t = o == null ? void 0 : o.inApp) == null ? void 0 : t.sponsorLogo]), (i = o == null ? void 0 : o.inApp) != null && i.sponsorLogo && r ? /* @__PURE__ */ s(
    fo,
    {
      className: n,
      sponsorLogo: (a = o.inApp) == null ? void 0 : a.sponsorLogo,
      onClick: () => m(!1)
    }
  ) : /* @__PURE__ */ s(ls, { className: n, children: /* @__PURE__ */ l("div", { children: [
    ((p = o == null ? void 0 : o.inApp) == null ? void 0 : p.sponsorLogo) && /* @__PURE__ */ s(bo, { children: /* @__PURE__ */ s(ds, { src: (d = o == null ? void 0 : o.inApp) == null ? void 0 : d.sponsorLogo }) }),
    /* @__PURE__ */ s(go, { ...o })
  ] }) });
}, ko = ({ sdk: n, webos: o }) => {
  var t, i, a, p, d, r, m, u;
  const [A] = w(n.getNotificationsStore()), g = ws(A), h = n.getFeature(fs.GAMES), c = $s(() => n.getActiveNotification(), [n, g]);
  return T(() => {
    c && Ts.emit("notification", {
      action: "rendered",
      payload: {
        questionId: c.data.questionId,
        questionType: c.data.questionType
      }
    });
  }, [c]), c && c.type === R.QUESTION_RESOLVED ? c.data.question && c.data.questionType === $.PREDICTION ? c && ((t = c.data.inApp) == null ? void 0 : t.adUnit) === B.STANDART ? /* @__PURE__ */ s(
    No,
    {
      action: c.action,
      close: c.close,
      ...c.data.question,
      inApp: c.data.inApp
    }
  ) : /* @__PURE__ */ s(
    Qn,
    {
      action: c.action,
      close: c.close,
      ...c.data.question
    }
  ) : null : c && c.type === R.ONBOARDING ? c.data.onboarding ? /* @__PURE__ */ s(
    on,
    {
      open: h == null ? void 0 : h.openOnboarding,
      close: c.close,
      ...c.data.onboarding
    }
  ) : null : c && ((i = c.data.inApp) == null ? void 0 : i.adUnit) === B.STANDART ? /* @__PURE__ */ s(
    Ye,
    {
      ...c.data,
      action: c.action,
      close: c.close,
      color: ((d = (p = (a = c == null ? void 0 : c.data) == null ? void 0 : a.inApp) == null ? void 0 : p.notification) == null ? void 0 : d.indicatorColor) || ((u = (m = (r = c == null ? void 0 : c.data) == null ? void 0 : r.inApp) == null ? void 0 : m.appearance) == null ? void 0 : u.primaryColor),
      webos: o
    }
  ) : c && /* @__PURE__ */ s(ne, { ...c.data, action: c.action });
}, Fo = ({ theme: n }) => {
  const o = xs(), t = Es(), i = Ss();
  return o && (i.appNotification || i.onboardingNotification) ? i.app && !i.onboardingNotification ? null : /* @__PURE__ */ s("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ s(Is, { customTheme: n ?? t.theme, themeMode: t.themeMode, children: /* @__PURE__ */ s(ko, { sdk: o }) }) }) : null;
};
export {
  Fo as StreamLayerSDKNotification,
  ko as StreamLayerSDKNotificationUI
};
