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