"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),t=require("./index2.js"),o=require("./app.js"),d=require("./useStreamLayerApp2.js"),p=t.styled_default("div")({name:"PointsContainer",class:"psiob9b",propsAsIs:!1}),m=t.styled_default("div")({name:"PointsIcon",class:"p1gqe4lh",propsAsIs:!1}),y=()=>t.c1,S=t.styled_default(y())({name:"PointsSvg",class:"p15syg2y",propsAsIs:!0}),f=t.styled_default("div")({name:"PointsBody",class:"p12n4f2h",propsAsIs:!1}),j=t.styled_default("div")({name:"PointsTitle",class:"poqmx89",propsAsIs:!1}),x=t.styled_default("div")({name:"PointsValue",class:"prj9b3v",propsAsIs:!1}),v=({points:e,onClick:r})=>s.jsxs(p,{className:t.f,onClick:r,children:[s.jsx(m,{children:s.jsx(S,{name:"icon-trophy"})}),s.jsxs(f,{children:[s.jsx(j,{children:"Total points"}),s.jsx(x,{children:s.jsx(t.d,{value:e})})]})]}),h=({gamification:e})=>{const r=e.userSummary.$store,[l,u]=i.useState(0);return i.useEffect(()=>{const c=r.subscribe(n=>{var a;(a=n==null?void 0:n.summary)!=null&&a.points&&u(n.summary.points)});return()=>{c()}},[r]),s.jsx(v,{points:l,onClick:()=>{e.status.get()===t.FeatureStatus.Suspended&&e.openFeature()}})},g=({sdk:e})=>{if(!t.useStore(e.featuresList.getStore()))return null;const r=e.getFeature(d.SdkOverlayType.GAMES);return r?s.jsx(h,{gamification:r}):null},P=()=>{const e=o.useStreamLayer();return e?s.jsx("div",{className:"StreamLayerSDK",children:s.jsx(o.i,{children:s.jsx(g,{sdk:e})})}):null};exports.StreamLayerSDKPoints=P;
