"use strict";const o=require("react/jsx-runtime"),a=require("./sl-types.js"),u=require("react"),v=require("./index10.js"),E=require("./index11.js"),Y=require("./utils.js"),x=require("./useStreamLayerApp2.js"),$=u.createContext({sdk:null,topNavigation:!1}),B=()=>u.useContext($),G=a.styled_default("div")({name:"QuestionAdvertisementContainer",class:"qwludgs",propsAsIs:!1}),J=a.styled_default("div")({name:"QuestionAdvertisementText",class:"qvce6pv",propsAsIs:!1}),K=a.styled_default("div")({name:"QuestionAdvertisementImage",class:"qsid7hx",propsAsIs:!1}),M=({sponsorLogo:e,id:l,hasBanner:r,setAdShowed:n})=>{const i=u.useRef();return u.useEffect(()=>(i.current=setTimeout(()=>{n(!0)},5e3),()=>{clearTimeout(i.current)}),[n,l,r]),o.jsxs(G,{children:[o.jsx(J,{children:"PRESENTED BY"}),o.jsx(K,{children:o.jsx("img",{src:e,alt:"ad-sponsor-logo"})})]})},V=a.styled_default("div")({name:"QuestionContainer",class:"q14ckf9e",propsAsIs:!1}),W=({openedQuestion:e,muted:l,webos:r})=>{var n,i;const{sdk:t}=B();return((n=e==null?void 0:e.attributes)==null?void 0:n.attributes.case)==="insight"?o.jsx(v.u,{...e.attributes.attributes.value,muted:l,controlVideo:t==null?void 0:t.controlVideoPlayer,webos:r}):((i=e==null?void 0:e.attributes)==null?void 0:i.attributes.case)==="tweet"?o.jsx(v.a,{...e.attributes.attributes.value,muted:l,controlVideo:t==null?void 0:t.controlVideoPlayer}):null},X=({extendedQuestion:e,vote:l,close:r,webos:n})=>{const{loading:i,data:t}=e;return t?o.jsx(E.ee,{webos:n,vote:l,close:r,openedQuestion:t,isLoading:!!i}):o.jsx(E.te,{})},Z=({gamification:e,sdk:l,muted:r,skipAutoClose:n,hideSponsor:i,className:t,hideHeader:D,webos:m})=>{var b,g,h,A,j,y,Q,q,w,T,S,f,U,I,N,k;const d=a.useStore(e.openedQuestion.$store),s=a.useStore(e.openedQuestion.$extendedStore),[_,P]=u.useState(!1),H=a.useStore(l.options),C=((b=d==null?void 0:d.attributes)==null?void 0:b.type)===x.QuestionType.FACTOID,c=(g=d==null?void 0:d.attributes)==null?void 0:g.backgroundImage,p=(h=s.data)==null?void 0:h.backgroundImage,O=C?c==null?void 0:c.landscapeUrl:p==null?void 0:p.landscapeUrl,z=C?c==null?void 0:c.portraitUrl:p==null?void 0:p.portraitUrl,L=Y.y({containerId:H.containerId,landscapeUrl:O,portraitUrl:z});if(!d)return null;const R=d.type,F=((j=(A=s.data)==null?void 0:A.options)==null?void 0:j.options.case)==="factoid"?s.data.options.options.value.closeTimer:void 0;return s.data&&s.data.adUnit===x.AdUnit.STANDART&&!_?o.jsxs(V,{className:t,children:[L,o.jsx(M,{id:s.data.id,hasBanner:!!((Q=(y=s.data.promotion)==null?void 0:y.banner)!=null&&Q.imageUrl),setAdShowed:P,sponsorLogo:((w=(q=s.data.promotion)==null?void 0:q.sponsor)==null?void 0:w.logo)||((T=s.data.sponsorship)==null?void 0:T.logo)||""})]}):o.jsxs(V,{className:t,children:[L,!D&&o.jsx(v.y,{closeTimer:n?void 0:F,close:e.closeQuestion,type:((S=d.attributes)==null?void 0:S.type)||x.QuestionType.UNSET,webos:m}),R==="question"&&o.jsx(X,{webos:m,vote:e.submitAnswer,close:e.closeQuestion,extendedQuestion:s}),R!=="question"&&o.jsx(W,{muted:r,openedQuestion:d,webos:m}),!i&&o.jsx(v.d,{sponsorLogo:((I=(U=(f=s.data)==null?void 0:f.promotion)==null?void 0:U.sponsor)==null?void 0:I.logo)||((k=(N=s.data)==null?void 0:N.sponsorship)==null?void 0:k.logo)})]})};exports.e=$;exports.ht=Z;exports.p=B;
