"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),o=require("react"),i=require("./index2.js"),h=require("./useStreamLayerApp2.js"),m=()=>i.E$1,S=i.styled_default(m())({name:"QuestionWrap",class:"q10hhsxv",propsAsIs:!0}),p=({gamification:e,persistent:n,hideHeader:d,insightId:t})=>{const r=o.useRef(""),l=i.useStore(e.openedQuestion.$store);return o.useEffect(()=>t?(!n||e.isOpenedQuestion(t)||(r.current=t,e.getFeedItem(t).then(s=>{r.current===t&&e.openQuestion(t,s)})),()=>{r.current=""}):(e.activeQuestionId.subscribe(({data:s})=>{var a;s&&((a=s.feedItem)==null?void 0:a.type)==="insight"&&(!n||e.isOpenedQuestion(s.feedItem.id)||(r.current=s.feedItem.id,e.openQuestion(s.feedItem.id,s.feedItem))),!s&&r.current&&(e.closeQuestion(r.current),r.current="")}),()=>{}),[e,n,t]),l?u.jsx(i.x,{style:{height:"100%"},children:u.jsx(S,{hideHeader:d,gamification:e,hideSponsor:!0})}):null},c=({sdk:e,persistent:n,insightId:d,hideHeader:t})=>{if(!i.useStore(e.featuresList.getStore()))return null;const r=e.getFeature(h.SdkOverlayType.GAMES);return r?u.jsx(p,{insightId:d,persistent:n,hideHeader:t,gamification:r}):null},f=({event:e,hideHeader:n,persistent:d})=>{const t=i.useStreamLayer();return t?u.jsxs("div",{className:"StreamLayerSDK",children:[u.jsx(i.d,{children:u.jsx(c,{sdk:t,event:e,hideHeader:n,persistent:d})}),e!==void 0&&u.jsx(i.StreamLayerSDKEvent,{event:e})]}):null};exports.StreamLayerSDKInsight=f;exports.StreamLayerSDKInsightUI=c;
