PageSourceSearch

https://store.iasgs.com/_next/static/chunks/9756-765795a4299964a0.js

js iasgs.com collected 2026-10-03 18:27:51 UTC 32,925 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9756],{89756:function(e,t,r){r.d(t,{Z:function(){return Y}});var n=r(47568),a=r(26042),s=r(69396),i=r(29815),o=r(97582),c=r(85893),u=r(67294),l=r(35739),d=r(72685),f=r(43341),m=r(86419),v=r(5152),x=r.n(v),p=r(89355),g=r(89885),h=r(73716),b=r(24271),y=r(96486),_=r(3751),j=r(19201),k=r(94933),w=r(1470),N=r(41352),S=r(30143),E=r(84979),A=r(8971),Z=r(47737),z=r(42841),C=r(67814),M=r(59417),L=r(34288),I=r(45508),D=r(97340),H=r(95034);function q(e){var t=e.firebase,r=e.id,a=(0,u.useState)(),s=a[0],l=a[1],d=(0,u.useState)({}),f=d[0],m=d[1],v=(0,p.N8)(t),x=(0,p.iH)(v,"/data/live_quick_polls/"+r+"/active_poll_v2"),h=(0,p.iH)(v,"/data/live_quick_polls/"+r),b=(0,p.iH)(v,"/data/live_quick_polls/"+r+"/enable_leaderboard"),j=(0,p.iH)(v,"/data/live_quick_polls/"+r+"/active_poll_answer"),k=(0,u.useContext)(g.Z),w=e.currentUser||k.currentUser,N=(0,u.useState)(!1),S=N[0],E=N[1],Z=(0,u.useState)([]),z=Z[0],C=Z[1],M=(0,u.useState)(),L=M[0],I=M[1],D=(0,_.useTimer)({autoStart:!1,expiryTimestamp:new Date}),q=(0,u.useState)(),F=q[0],V=q[1],R=(0,u.useState)(!1),T=R[0],O=R[1],U=function(e){var t=e.key,r=s.totalOptions,n=parseInt(t);n>=1&&n<=r&&!F&&G(n-1)};(0,u.useEffect)((function(){return(0,p.jM)(x,(function(e){var t=e.val(),r=null===t||void 0===t?void 0:t.active_poll_data;if(r&&r.question?(l(r),m((null===t||void 0===t?void 0:t.poll_config)||{}),r.isAnswerType=!(0,y.isEmpty)(r.answer),r.poll_duration>0&&D.restart(new Date(r.created_at+r.poll_duration),!0),E(!0)):(l(null),m({}),r=null,E(!1)),null==r)return I(null),C([]),void E(!1)})),(0,p.jM)(b,(function(e){var t=e.val();O(1==t)})),P(),function(){(0,p.S1)(x,"value"),(0,p.S1)(b,"value")}}),[]),(0,u.useEffect)((function(){var e;return L?(B(),e=setInterval((function(){B()}),(null===f||void 0===f?void 0:f.update_vote_duration)||5e3)):e&&clearInterval(e),function(){e&&clearInterval(e)}}),[L]),(0,u.useEffect)((function(){var e=!1;return"1"==(null===f||void 0===f?void 0:f.start_polling)?e||(document.addEventListener("keydown",U),e=!0):e&&(document.removeEventListener("keydown",U),e=!1),function(){e&&document.removeEventListener("keydown",U)}}),[null===f||void 0===f?void 0:f.start_polling]);var P=function(){var e=(0,p.iH)(v,"/data/live_quick_polls/"+r+"/user_answers/user_"+w.userid);return(0,p.U2)(e).then((function(e){var t=null===e||void 0===e?void 0:e.val();return t?(I(null===e||void 0===e?void 0:e.val()),t):null}))},B=function(){(0,p.U2)(j).then((function(e){var t=e.val();if(t){var r=(0,i.Z)(new Array(s.totalOptions)).map((function(e,r){return t["option_".concat(r)]})).reduce((function(e,t){return e+t})),n=(0,i.Z)(new Array(s.totalOptions)).map((function(e,n){var a;return{id:n,selected:(null===L||void 0===L?void 0:L.selected_option_answers)&&(null===L||void 0===L?void 0:L.selected_option_answers.includes(n)),isAnswer:!!s.isAnswerType&&(null===(a=s.answer)||void 0===a?void 0:a.includes(n)),option:s.options[n],votes:0==r?0:Math.round(t["option_".concat(n)]/r*100)}}));C(n)}}))},G=function(){var e=(0,n.Z)((function(e){var t,n,a,i,c,u,l,d;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:return"0"==f.start_polling?[2]:(V(!0),[4,P()]);case 1:return o.sent()?(V(!1),[2]):((t={})["/active_poll_answer/option_".concat(e)]=(0,p.nP)(1),n=!s.isAnswerType||s.answer[0]==e,a={is_correct:n,name:w.name,selected_option_answers:[e],selected_option_text:[s.options[e]],source:"website"},I(a),t["/user_answers/user_".concat(w.userid)]=a,T?(i=(new Date).getTime(),c=Math.abs(i-s.created_at),u=(0,p.iH)(v,"/data/live_quick_polls/".concat(r,"/leaderboard/user_").concat(w.userid,"/score")),[4,(0,p.U2)(u)]):[3,3]);case 2:l=(l=o.sent()).val()||0,t["/leaderboard/user_".concat(w.userid,"/name")]=w.name,d=s.isAnswerType?n?f.positive_marks:f.negative_marks:0,t["/leaderboard/user_".concat(w.userid,"/score")]=l+d,t["/leaderboard/user_".concat(w.userid,"/time_consumed")]=(0,p.nP)(c),t["/leaderboard/user_".concat(w.userid,"/source")]="website",o.label=3;case 3:return(0,p.Vx)(h,t),V(!1),[2]}}))}));return function(t){return e.apply(this,arguments)}}(),J=function(e){return!(0,y.isEmpty)(L)&&s.isAnswerType?e.isAnswer?"border-green-500 bg-green-500/30 text-green-700 dark:text-green-400":e.selected&&!e.isAnswer?"border-destructive bg-destructive/30 text-destructive":"border-border bg-background":e.selected?"border-primary bg-primary/10 text-foreground":"border-border bg-background"};return s?(0,c.jsxs)("div",{className:"poll-card overflow-hidden rounded-xl border border-border bg-secondary",children:[(0,c.jsxs)("button",{type:"button",onClick:function(){return E(!S)},"aria-expanded":S,className:"flex w-full cursor-pointer items-start justify-between gap-3 px-4 py-3 text-left",children:[(0,c.jsxs)("span",{className:"text-sm font-semibold leading-snug text-foreground",children:[(0,c.jsx)("span",{className:"text-muted-foreground",children:"Q:"})," ",s.question]}),(0,c.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:["1"==f.start_polling?(0,c.jsxs)(H.C,{variant:"success",size:"sm",className:"shrink-0 gap-1.5",children:[(0,c.jsx)("span",{className:"size-1.5 animate-pulse rounded-full bg-current"}),"Active"]}):(0,c.jsxs)(H.C,{variant:"muted",size:"sm",className:"shrink-0 gap-1.5",children:[(0,c.jsx)("span",{className:"size-1.5 rounded-full bg-current"}),"Ended"]}),(0,c.jsx)(A.Z,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-300 ".concat(S?"rotate-180":""),"aria-hidden":"true"})]})]}),(0,c.jsx)("div",{className:"".concat(S?"max-h-full opacity-100":"max-h-0 opacity-0"," transition-all duration-300 ease-in-out overflow-hidden"),children:(0,c.jsxs)("div",{className:"flex flex-col gap-2 px-3 pb-3",children:[(0,y.isEmpty)(L)||(0,y.isEmpty)(z)?(0,i.Z)(new Array(s.totalOptions)).map((function(e,t){return(0,c.jsx)("div",{className:"cursor-pointer rounded-lg border border-border bg-background px-3 py-2.5 text-sm text-foreground transition-colors hover:border-primary/50 hover:bg-accent/40",role:"button",onClick:function(){return!F&&G(t)},children:s.options&&s.options[t]},t)}
1)):z.map((function(e){return(0,c.jsxs)("div",{className:"relative overflow-hidden rounded-lg border px-3 py-2.5 ".concat(J(e)),children:[0==f.enable_private_poll&&(0,c.jsx)("div",{style:{width:e.votes+"%"},className:"absolute inset-y-0 left-0 z-0 bg-primary/15"}),(0,c.jsxs)("div",{className:"relative z-10 flex items-center justify-between gap-2 text-sm font-medium",children:[(0,c.jsx)("span",{children:e.option}),0==f.enable_private_poll&&(0,c.jsxs)("span",{className:"shrink-0 tabular-nums text-xs font-semibold",children:[e.votes,"%"]})]})]},e.option)})),D.isRunning&&(0,c.jsxs)("div",{className:"px-1 pt-0.5 text-xs text-muted-foreground",children:["Poll ends in"," ",(0,c.jsx)("b",{className:"tabular-nums text-foreground",children:D.seconds+60*D.minutes})," ","secs"]})]})})]}):null}var F=r(63231),V=r(12854),R=r(70499);function T(e){var t=e.firebase,r=e.id,a=e.isOpen,s=e.toggle,l=e.container,d=void 0===l?"hlsplayerwithchat":l,f=e.currentUser,m=(0,u.useState)(),v=m[0],x=m[1],g=(0,p.N8)(t),h=(0,p.iH)(g,"/data/live_quick_polls/"+r+"/leaderboard"),b=(0,p.iH)(g,"/data/live_quick_polls/"+r+"/active_poll_v2/poll_config/count_poll");(0,u.useEffect)((function(){var e=(0,p.IO)(h,(0,p.g2)("score"),(0,p.vh)(50));return(0,p.jM)(e,function(){var e=(0,n.Z)((function(e){var t,r,n,a;return(0,o.__generator)(this,(function(s){switch(s.label){case 0:return(t=e.val())?[4,(0,p.U2)(b)]:[3,2];case 1:return r=(r=s.sent()).val()||0,Object.keys(e.val()).forEach((function(e){if(t[e].score>r){var n={};n["/".concat(e,"/score")]=r,(0,p.Vx)(h,n),t[e].score=r}})),t=(t=Object.values(t)).sort((function(e,t){return e.score==t.score?Math.abs(e.time_consumed)-Math.abs(t.time_consumed):t.score-e.score})),(n=(0,i.Z)(new Array(10))).forEach((function(e,r){t[r]?n[r]=t[r]:n[r]={}})),x(n),[3,3];case 2:a=(0,i.Z)(new Array(10)).map((function(e){return{}})),x(a),s.label=3;case 3:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}(),{onlyOnce:!0}),function(){(0,p.S1)(h,"value")}}),[]);var y="undefined"!==typeof document?document.getElementById(d):null,_=function(e){return(e||"").trim().split(/\s+/).map((function(e){return e[0]})).slice(0,2).join("").toUpperCase()||"?"},j=(v||[]).filter((function(e){return e&&e.name})),k=j.slice(0,3),S=j.slice(3),E=function(e,t){if(!e)return null;var r=1===t,n={1:{ring:"ring-amber-400",badge:"bg-amber-400 text-amber-950"},2:{ring:"ring-zinc-300",badge:"bg-zinc-300 text-zinc-800"},3:{ring:"ring-amber-700/70",badge:"bg-amber-700 text-amber-50"}}[t];return(0,c.jsxs)("div",{className:"flex flex-1 flex-col items-center gap-1 ".concat(r?"-mt-3":""),children:[r&&(0,c.jsx)(F.Z,{className:"size-5 text-amber-400","aria-hidden":"true"}),(0,c.jsxs)("div",{className:"relative",children:[(0,c.jsx)("div",{className:"flex ".concat(r?"size-16":"size-12"," items-center justify-center rounded-full bg-muted text-base font-bold text-foreground ring-2 ").concat(n.ring),children:_(e.name)}),(0,c.jsx)("span",{className:"absolute -bottom-1.5 left-1/2 flex size-5 -translate-x-1/2 items-center justify-center rounded-full text-[10px] font-bold tabular-nums ".concat(n.badge),children:t})]}),(0,c.jsx)("span",{className:"mt-1.5 max-w-[88px] truncate text-xs font-semibold text-foreground",children:e.name}),(0,c.jsxs)("span",{className:"text-xs font-bold tabular-nums text-primary",children:[e.score>0?e.score:0," pts"]})]},t)};return(0,c.jsx)(R.Vq,{open:a,onOpenChange:function(e){e||s()},children:(0,c.jsxs)(R.PK,{container:y,children:[(0,c.jsx)(R.t9,{}),(0,c.jsxs)(V.VY,{"aria-describedby":void 0,style:{maxWidth:"420px"},className:"fixed left-1/2 top-1/2 z-[51] flex max-h-[85vh] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-background text-foreground shadow-lg duration-200 focus:outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",children:[(0,c.jsxs)("div",{className:"flex shrink-0 items-center justify-center gap-2 border-b border-border px-6 py-4",children:[(0,c.jsx)(w.Z,{className:"size-5 text-amber-500","aria-hidden":"true"}),(0,c.jsx)(R.$N,{className:"text-lg font-semibold tracking-tight",children:"Leaderboard"})]}),(0,c.jsxs)(R.GG,{className:"absolute right-3 top-3.5 flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent focus:outline-none",children:[(0,c.jsx)(N.Z,{className:"size-4"}),(0,c.jsx)("span",{className:"sr-only",children:"Close"})]}),0===j.length?(0,c.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 px-6 py-12 text-center",children:[(0,c.jsx)(w.Z,{className:"size-8 text-muted-foreground/40","aria-hidden":"true"}),(0,c.jsx)("p",{className:"mb-0 text-sm text-muted-foreground",children:"No scores yet."})]}):(0,c.jsxs)(c.Fragment,{children:[k.length>0&&(0,c.jsxs)("div",{className:"flex shrink-0 items-end justify-center gap-4 border-b border-border bg-muted/30 px-4 pb-5 pt-6",children:[E(k[1],2),E(k[0],1),E(k[2],3)]}),S.length>0&&(0,c.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-2",children:S.map((function(e,t){var r=t+4,n=function(e){return f&&e.name===f.name}(e);return(0,c.jsxs)("div",{className:"flex items-center gap-3 rounded-lg px-2.5 py-2 ".concat(n?"bg-primary/5 ring-1 ring-primary/20":""),children:[(0,c.jsx)("span",{className:"w-5 shrink-0 text-center text-xs font-semibold tabular-nums text-muted-foreground",children:r}),(0,c.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-bold text-foreground",children:_(e.name)}),(0,c.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:e.name}),(0,c.jsx)("span",{className:"shrink-0 text-sm font-semibold tabular-nums text-primary",children:e.score>0?"".concat(e.score," pts"):"\u2014"})]},t)}))})]})]})]})})}var O=r(62922),U=r(11163),P=r(99209),B=r(29823),G=function(e){return"".concat(B.dA.CHAT_STORAGE_KEY_PREFIX).concat(e)},J=function(e){try{var t=localStorage.getItem(G(e));if(!t)return[];var r=JSON.parse(t);return r.expiresAt?Date.now()>r.expiresAt?(W(e),[]):r.messages||[]:Array.isArray(r)?r:[]}catch(n){return[]}},K=function(e,t){try{var r={messages:t,expiresAt:Date.now()+B.h1};localStorage.setItem(G(e),JSON.stringify(r))}catch(n){console.error("Error saving to localStorage:",n)}},W=function(e){try{localStorage.removeItem(G(e))}catch(t){console.error("Error clearing localStorage:",t)}},Q=x()((function(){return Promise.all([r.e(2344),r.e(8414)]).then(r.bind(r,88414))}),{loadableGenerated:{webpack:function(){return[88414]}},ssr:!1});function Y(e){var t=e.disableHandraise,r=void 0!==t&&t,v=e.defaultChatMode,x=void 0===v?B.MV.SELF.value:v,H=e.chatConfig,F=void 0===H?{}:H,V=(0,u.useState)(B.MV.DISABLED.value),R=V[0],G=V[1],Y=(0,u.useState)([]),X=Y[0],$=Y[1],ee=(0,u.useState)([]),te=ee[0],re=ee[1],ne=(0,u.useState)(!1),ae=ne[0],se=ne[1],ie=(0,u.useState)(!1),oe=ie[0],ce=ie[1],ue=(0,u.useState)(!1),le=ue[0],de=ue[1],fe=(0,u.useState)(!0),me=fe[0],ve=fe[1],xe=(0,u.useState)(!1),pe=xe[0],ge=xe[1],he=(0,u.useState)(!1),be=he[0],ye=he[1],_e=(0,u.useState)(),je=_e[0],ke=_e[1],we=(0,u.useState)(null),Ne=we[0],Se=we[1],Ee=(0,u.useState)(null),Ae=Ee[0],Ze=Ee[1],ze=(0,u.useState)(null),Ce=ze[0],Me=ze[1],Le=(0,u.useState)(x),Ie=Le[0],De=Le[1],He=(0,u.useState)(!1),qe=He[0],Fe=He[1],Ve=(0,u.useState)(!0),Re=Ve[0],Te=Ve[1],Oe=(0,u.useState)(!0),Ue=Oe[0],Pe=Oe[1],Be=(0,u.useState)([]),Ge=Be[0],Je=Be[1],Ke=(0,u.useState)(!0),We=Ke[0],Qe=Ke[1],Ye=(0,u.useRef)(Ne),Xe=(0,u.useCallback)((function(){if(Ce){var e=(0,p.N8)(Ce),t=(0,p.IO)((0,p.iH)(e,"/youtubedata/"+dt),(0,p.vh)(ft));return(0,p.yv)(t,(function(e){var t=(0,s.Z)((0,a.Z)({},e.val()),{key:e.key});re((function(e){return e.some((function(e){return e.key===t.key}))?e:(0,i.Z)(e).concat([t])}))})),t}}
1),[Ce,dt]),$e=(0,u.useCallback)((function(e){e&&(0,p.S1)(e,"child_added")}),[]),et=(0,u.useCallback)((function(){if(Ce){var e=J(dt);e.length>0&&re((function(t){var r=new Set(t.map((function(e){return e.key}))),n=e.filter((function(e){return!r.has(e.key)}));return(0,i.Z)(t).concat((0,i.Z)(n))}));var t=(0,p.N8)(Ce),r=(0,p.iH)(t,"/adminMessages/".concat(dt));return(0,p.yv)(r,(function(e){var t=(0,s.Z)((0,a.Z)({},e.val()),{key:e.key});"1"!==t.pinstatus&&re((function(e){return e.some((function(e){return e.key===t.key}))?e:(0,i.Z)(e).concat([t])}))})),r}}),[Ce,dt]),tt=(0,u.useCallback)((function(e){e&&(0,p.S1)(e,"child_added")}),[]);(0,u.useEffect)((function(){Ye.current=Ne}),[Ne]);var rt=function(){return ke(!je)},nt=null,at=(0,u.useRef)(null),st=(0,u.useRef)(null),it=(0,u.useContext)(g.Z),ot=(0,U.useRouter)(),ct=it.appConfig,ut=e.currentUser||it.currentUser,lt=(0,_.useTimer)({autoStart:!1,expiryTimestamp:new Date}),dt="1"==e.video.ytFlagWeb?(0,I.NA)(e.video.video_id):e.video.recording_schedule,ft=50,mt=(0,u.useCallback)((0,n.Z)((function(){var t,r,n,a;return(0,o.__generator)(this,(function(s){switch(s.label){case 0:if(e.firebase)return Me(e.firebase),[2];if(t=ot.query.lcId?"[LINKEDCOURSE-".concat(11,"-").concat(ot.query.lcId,"]"):"[DEFAULT]",r=ct.web_firebaseconfig,!ot.query.lcId||!(0,b.gG)(t))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(0,P.OF)({lcId:ot.query.lcId,lcApi:(0,I.NA)(ot.query.api)})];case 2:return r=s.sent(),[3,4];case 3:return n=s.sent(),console.error("Error in getting firebase config",n),Te(!1),[3,4];case 4:try{a=(0,b.G5)(r,t),Me(a)}catch(i){console.error("Failed to initialize Firebase:",i),Te(!1)}return[2]}}
1))})),[e.firebase,ot.query.lcId,ot.query.api,ct.web_firebaseconfig]),vt=function(e){var t=e.message,r=e.isPinned,n=void 0!==r&&r,a=ut&&String(t.userId)===String(ut.userid),s="-1"===String(t.userId),i=(0,c.jsx)("p",{className:"mb-0 whitespace-pre-wrap break-words text-sm leading-relaxed",children:(0,c.jsx)(D.Z,{options:{target:"_blank",rel:"noopener noreferrer"},children:(0,h.i5)(t.userComment)})}),o=(0,O.by)(t.userTime,Number(t.postedAt));return n||s?(0,c.jsxs)("div",{className:"rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-foreground",children:[i,(0,c.jsxs)("div",{className:"mt-1 flex items-center gap-1.5 text-[10px] text-muted-foreground",children:[(0,c.jsx)("span",{className:"font-semibold text-primary",children:t.userName}),(0,c.jsx)("span",{className:"tabular-nums",children:o})]})]}):(0,c.jsxs)("div",{className:"flex w-full flex-col gap-0.5 ".concat(a?"items-end":"items-start"),children:[(0,c.jsxs)("div",{className:"flex items-center gap-1.5 px-0.5 ".concat(a?"flex-row-reverse":""),children:[(0,c.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full ".concat(a?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:(0,c.jsx)(k.Z,{className:"size-[18px]","aria-hidden":"true"})}),(0,c.jsx)("span",{className:"max-w-[140px] truncate text-xs font-semibold text-foreground/80",children:t.userName})]}),(0,c.jsxs)("div",{className:"max-w-[85%] px-3 py-2 ".concat(a?"rounded-2xl rounded-tr-sm bg-primary text-primary-foreground":"rounded-2xl rounded-tl-sm border border-border bg-secondary text-foreground"),children:[i,(0,c.jsx)("div",{className:"mt-0.5 text-right text-[10px] tabular-nums ".concat(a?"text-primary-foreground/70":"text-muted-foreground"),children:o})]})]})},xt=function(){var e,t,r,n=st.current.value,o=(0,h.MI)(n);if(me&&!(0,y.isEmpty)(null===o||void 0===o?void 0:o.trim())&&!le)if((null!==(e=F.chatCharacterLimit)&&void 0!==e?e:ct.web_chatcharacterlimit)>0&&o.trim().length>(null!==(t=F.chatCharacterLimit)&&void 0!==t?t:ct.web_chatcharacterlimit))j.A.warn("Only ".concat(null!==(r=F.chatCharacterLimit)&&void 0!==r?r:ct.web_chatcharacterlimit," are allowed"),{position:"bottom-right"});else if(lt.isRunning)j.A.info("You can send the next message after ".concat(lt.seconds," seconds"));else{if((0,h.$N)(n))return st.current.value=o,void j.A.warn("URLs are not allowed",{position:"bottom-right"});var c={userName:ut.name,userComment:o,userFlag:"0",userTime:(0,h.xv)(),postedAt:(new Date).getTime(),userId:ut.userid,pinstatus:"0"};if(st.current.value="",R===B.MV.SELF.value){var u=(0,s.Z)((0,a.Z)({},c),{key:"local_".concat(Date.now(),"_").concat(Math.random())});re((function(e){var t=(0,i.Z)(e).concat([u]);return K(dt,t),t}))}if(!Ce||!Ue){var l=(0,s.Z)((0,a.Z)({},c),{key:"local_".concat(Date.now(),"_").concat(Math.random())});return re((function(e){return(0,i.Z)(e).concat([l])})),void Te(!1)}var d=(0,p.N8)(Ce);nt=(0,p.iH)(d,"/youtubedata/"+dt),(0,p.VF)(nt,{}).then((function(e){var t=e.key,r=(0,p.iH)(d,"/youtubedata/"+dt+"/"+t);(0,p.t8)(r,c),Te(!0),"1"!=F.chatDelay&&"1"!=ct.web_enablechatdelay||lt.restart((new Date).setSeconds((new Date).getSeconds()+30))})).catch((function(e){console.error("Failed to send message to Firebase:",e);var t=(0,s.Z)((0,a.Z)({},c),{key:"local_".concat(Date.now(),"_").concat(Math.random())});re((function(e){var r=(0,i.Z)(e).concat([t]);return R===B.MV.SELF.value&&K(dt,r),r})),Te(!1)}))}},pt=function(){if(se(!1),Ye.current&&Ce){var e=Ye.current.key,t=(0,p.N8)(Ce),r=(0,p.iH)(t,"/data/handRaise/".concat(dt,"/users/").concat(e,"/request_status")),n=(0,p.iH)(t,"/data/handRaise/".concat(dt,"/users/").concat(e,"/room_id")),a=(0,p.iH)(t,"/data/handRaise/".concat(dt,"/users/").concat(e,"/voice_call_token")),s=(0,p.iH)(t,"/data/handRaise/".concat(dt,"/current_live_call/").concat(ut.userid));(0,p.t8)(r,"Ended"),(0,p.t8)(n,""),(0,p.t8)(a,""),(0,p.t8)(s,null)}};return(0,u.useEffect)((function(){mt()}),[mt]),(0,u.useEffect)((function(){var e=function(){Pe(!0),Re||(mt(),setTimeout((function(){if(Ce){var e=(0,p.N8)(Ce),t=(0,p.iH)(e,"/test_c
1onnection");(0,p.t8)(t,{timestamp:Date.now()}).then((function(){(0,p.t8)(t,null),Te(!0)})).catch((function(){Te(!1)}))}}),1e3))},t=function(){Pe(!1),Te(!1)};return Pe(navigator.onLine),window.addEventListener("online",e),window.addEventListener("offline",t),function(){window.removeEventListener("online",e),window.removeEventListener("offline",t)}}),[Re,mt]),(0,u.useEffect)((function(){if(Ce){var t=(0,p.N8)(Ce);nt=(0,p.iH)(t,"/youtubedata/"+dt);var r=(0,p.iH)(t,"/data/live_chat_switcher/".concat(dt)),n=(0,p.iH)(t,"/adminMessages/".concat(dt));(0,p.Jr)(n,(function(e){var t=e.val();Je((function(r){return"1"==t.pinstatus?(0,i.Z)(r.filter((function(t){return t.key!==e.key}))).concat([(0,s.Z)((0,a.Z)({},t),{key:e.key,pinnedAt:Date.now()})]):r.filter((function(t){return t.key!==e.key}))}))})),(0,p.yv)(n,(function(e){var t=e.val();"1"==t.pinstatus&&Je((function(r){return(0,i.Z)(r).concat([(0,s.Z)((0,a.Z)({},t),{key:e.key,pinnedAt:Date.now()})])}))})),(0,p.MQ)(n,(function(e){Je((function(t){return t.filter((function(t){return t.key!==e.key}))}))})),(0,p.jM)(r,(function(t){var r=t.val(),n=String(null!==r?r:e.video.chat_status);!Re&&Ue&&Te(!0),"1"==n?(G(Ie),Fe(!1),re((function(e){if(Ie===B.MV.SELF.value){var t=e.filter((function(e){return e.userId===ut.userid||"-1"===e.userId}));$(t.slice(-ft))}else $(e.slice(-ft));return e}))):"2"==n?(G(B.MV.SELF.value),Fe(!0),re((function(e){var t=e.filter((function(e){return e.userId===ut.userid||"-1"===e.userId}));return $(t.slice(-ft)),e}))):(G(B.MV.DISABLED.value),Fe(!0),$([]))})),(0,p.MQ)(nt,(function(e){var t=e.key;re((function(e){return e.filter((function(e){return e.key!==t}))})),$((function(e){return e.filter((function(e){return e.key!==t}))}))}));var o=(0,p.iH)(t,"/data/user_block_status/"+ut.userid),c=(0,p.iH)(t,"/data/handRaise/"+dt+"/users"),u=(0,p.iH)(t,"/data/handRaise/"+dt+"/block_users/"+ut.userid),l=(0,p.iH)(t,"/data/handRaise/".concat(dt,"/is_handraise_disabled")),d=(0,p.iH)(t,"/data/live_quick_polls/"+dt+"/enable_leaderboard");(0,p.jM)(u,(function(e){var t=e.val();ce(1==t)})),(0,p.jM)(l,(function(e){var t=e.val();ge(!0===t)})),(0,p.jM)(o,(function(e){var t=e.val();de(1==t)}));var f=(0,p.iH)(t,"/chat_switcher/"+dt);return(0,p.jM)(f,(function(e){0==e.val()?(ve(!1),j.A.info("Chat has been disabled")):ve(!0)})),oe||le||((0,p.yv)(c,(function(e){var t=e.val();t.user_id==ut.userid&&("Pending"==t.request_status?(se(!0),Se((0,s.Z)((0,a.Z)({},t),{key:e.key}))):"Accepted"==t.request_status?(Se((0,s.Z)((0,a.Z)({},t),{key:e.key})),se(!0)):"Rejected"==t.request_status||"Blocked"==t.request_status?(se(!1),Se(null),j.A.info("Hand raise request cancelled by you/admin.")):"Ended"==t.request_status&&(se(!1),Se(null)))})),(0,p.Jr)(c,(function(e){var t=e.val();"Pending"==t.request_status?(se(!0),Se((0,s.Z)((0,a.Z)({},t),{key:e.key}))):t.user_id==ut.userid&&("Accepted"==t.request_status?(se(!0),Se((0,s.Z)((0,a.Z)({},t),{key:e.key}))):"Rejected"==t.request_status||"Blocked"==t.request_status?(se(!1),Se(null),j.A.info("Hand raise request cancelled by you/admin.")):"Ended"==t.request_status&&(se(!1),Se(null)))}))),(0,p.jM)(d,(function(e){1==e.val()?ye(!0):(ke(!1),ye(!1))})),window.addEventListener("beforeunload",pt),function(){var e;"Pending"==(null===(e=Ye.current)||void 0===e?void 0:e.request_status)&&pt(),(0,p.S1)(c,"child_added"),(0,p.S1)(c,"child_changed"),(0,p.S1)(o,"value"),(0,p.S1)(u,"value"),(0,p.S1)(l,"value"),(0,p.S1)(f,"value"),(0,p.S1)(d,"value"),(0,p.S1)(r,"value"),(0,p.S1)(n,"child_added"),(0,p.S1)(n,"child_changed"),(0,p.S1)(n,"child_removed"),se(!1),ye(!1),window.removeEventListener("beforeunload",pt)}}}),[Ce]),(0,u.useEffect)((function(){at.current&&at.current.scrollTo({top:at.current.scrollHeight,behavior:"smooth"})}),[X]),(0,u.useEffect)((function(){if(R==B.MV.SELF.value||R==B.MV.DISABLED.value){var e=te.filter((function(e){return e.userId===ut.userid||"-1"===e.userId})).slice(-ft);$(e)}else $(te.slice(-ft))}),[te,R,ut.userid]),(0,u.useEffect)((function(){if(Ce){var e=null,t=null;return R===B.MV.ALL.value?e=Xe():R===B.MV.SELF.value&&(t=et()),function(){e&&$e(e),t&&tt(t)}}}),[R,Ce,Xe,$e,et,tt]),(0,u.useEffect)((function(){return function(){try{for(var e=[],t=0;t<localStorage.length;t++){var r=localStorage.key(t);if(r&&r.startsWith(B.dA.CHAT_STORAGE_KEY_PREFIX))try{var n=localStorage.getItem(r);if(n){var a=JSON.parse(n);a.expiresAt&&Date.now()>a.expiresAt&&e.push(r)}}catch(s){e.push(r)}}e.forEach((function(e){return localStorage.removeItem(e)})),e.length>0&&console.log("\ud83d\uddd1\ufe0f Cleaned up ".concat(e.length," expired chat(s)"))}catch(i){console.error("Error during cleanup:",i)}}(),function(){W(dt)}
1}),[]),Ce?(0,c.jsxs)("div",{id:"chatContainer",className:"flex h-full max-h-full flex-col bg-background text-foreground",children:[(0,c.jsxs)("div",{className:"flex items-center gap-1.5 border-b border-border bg-background px-4 py-3",children:[(0,c.jsx)("span",{className:"mr-auto text-base font-semibold tracking-tight text-foreground",children:"Chat"}),R!==B.MV.DISABLED.value&&(0,c.jsxs)("select",{className:"h-8 rounded-md border border-border bg-secondary px-2 text-xs font-medium text-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-60",value:R,onChange:function(e){return t=e.target.value,void(qe||(De(t),G(t),re((function(e){if(t===B.MV.SELF.value){var r=J(dt),n=r.length>0?r:e,a=n.filter((function(e){return e.userId===ut.userid||"-1"===e.userId}));return $(a.slice(-ft)),K(dt,a),n}if(t===B.MV.ALL.value){W(dt);var s=e.filter((function(e){return!e.key.startsWith("local_")}));return $(s.slice(-ft)),s}return e}))));var t},disabled:qe,children:[(0,c.jsx)("option",{value:B.MV.ALL.value,children:"All Chat"}),(0,c.jsx)("option",{value:B.MV.SELF.value,children:"Self Chat"})]}),!r&&"1"==ct.web_enablehandraiselive&&!oe&&!pe&&(0,c.jsxs)(f.J2,{open:!!Ae,onOpenChange:function(e){e||Ze(null)},children:[(0,c.jsx)(m.ee,{asChild:!0,children:(0,c.jsx)(l.z,{variant:"ghost",onClick:ae?function(){return Ze("handButton")}:function(){if(!ae&&!oe&&Ce&&!r){var e={created_at:(new Date).getTime(),user_id:ut.userid,user_name:ut.name,request_status:"Pending",room_id:"",voice_call_token:""},t=(0,p.N8)(Ce);nt=(0,p.iH)(t,"/data/handRaise/"+dt+"/users"),(0,p.VF)(nt,e).then((function(e){se(!0),j.A.success("Hand raised")}))}},className:"size-8 shrink-0 rounded-full p-0 ".concat(ae?"bg-primary/10 text-primary":"text-muted-foreground"),id:"handButton","aria-label":ae?"Lower hand":"Raise hand",children:(0,c.jsx)(C.G,{icon:ae?M.ioV:L.ioV,className:"text-[18px]"})})}),(0,c.jsx)(f.yk,{side:"bottom",className:"w-auto p-3",children:(0,c.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,c.jsx)("p",{className:"mb-0 text-center text-sm",children:"Are you sure you want to lower your hand?"}),(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)(l.z,{variant:"secondary",size:"sm",onClick:function(){return Ze(null)},children:"Cancel"}),(0,c.jsx)(l.z,{variant:"default",size:"sm",onClick:function(){if(Ne){var e=(0,p.N8)(Ce),t=(0,p.iH)(e,"/data/handRaise/".concat(dt,"/users/").concat(Ne.key));null===Ne.key||void 0===Ne.key||""===Ne.key||(0,y.isEmpty)(Ne.key)||(0,p.Vx)(t,{request_status:"Rejected"}),se(!1),Se(null),Ze(null)}},children:"Lower Hand"})]})]})})]}),be&&(0,c.jsx)(l.z,{variant:"ghost",onClick:rt,className:"size-8 shrink-0 rounded-full p-0 text-amber-500","aria-label":"Leaderboard",children:(0,c.jsx)(w.Z,{className:"size-[18px]"})}),e.toggleChat&&(0,c.jsx)(l.z,{variant:"ghost",onClick:e.toggleChat,className:"close-btn size-8 shrink-0 rounded-full p-0 text-muted-foreground","aria-label":"Close chat",children:(0,c.jsx)(N.Z,{className:"size-[18px]"})})]}),(0,c.jsxs)("div",{className:"msg_container_base relative flex flex-grow flex-col gap-2 overflow-y-auto px-3 py-3 !bg-background",ref:at,style:{minHeight:"100px",maxHeight:"100%"},children:[!r&&"Accepted"==(null===Ne||void 0===Ne?void 0:Ne.request_status)&&(null===Ne||void 0===Ne?void 0:Ne.room_id)&&(null===Ne||void 0===Ne?void 0:Ne.voice_call_token)&&(0,c.jsx)("div",{className:"sticky pt-2 top-0 left-0 w-full",style:{zIndex:1e3},children:(0,c.jsx)(Q,{roomId:Ne.room_id,token:Ne.voice_call_token,isDefaultMuted:!0,hasAdminMuted:Ne.is_admin_muted,onCallEnded:pt})}),(0,c.jsxs)("div",{className:"sticky top-0 z-20 flex flex-col gap-2 bg-background",children:[(0,c.jsx)(q,{firebase:Ce,id:dt,currentUser:ut}),Ge.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"flex cursor-pointer items-center justify-between rounded-lg border border-primary/20 bg-primary/5 px-3 py-1.5",onClick:function(){return Qe(!We)},children:[(0,c.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,c.jsx)(S.Z,{className:"size-3.5 text-primary","aria-hidden":"true"}),(0,c.jsxs)("span",{className:"text-[11px] font-bold uppercase tracking-wide text-primary tabular-nums",children:["Pinned \xb7 ",Ge.length]})]}),We?(0,c.jsx)(E.Z,{className:"size-4 text-primary"}):(0,c.jsx)(A.Z,{className:"size-4 text-primary"})]}),(0,c.jsx)("div",{className:"overflow-hidden transition-all duration-300 ease-in-out ".concat(We?"max-h-[150px]":"max-h-0"),children:(0,c.jsx)("div",{className:"flex flex-col gap-1.5 overflow-y-auto p-1.5",style:{maxHeight:"150px"},children:(0,i.Z)(Ge).sort((function(e,t){return t.pinnedAt-e.pinnedAt})).map((function(e){return(0,c.jsx)(vt,{message:e,isPinned:!0},e.key)}))})})]})]}),je&&(0,c.jsx)(T,{firebase:Ce,id:dt,container:e.leaderboardContainer,toggle:rt,isOpen:je,currentUser:ut}),0==X.length&&(0,c.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 py-10 text-center",children:[(0,c.jsx)(Z.Z,{className:"size-8 text-muted-foreground
1/40","aria-hidden":"true"}),(0,c.jsx)("p",{className:"mb-0 text-sm text-muted-foreground",children:R===B.MV.SELF.value?B.MV.SELF.message:B.MV.ALL.message})]}),X.map((function(e,t){return(0,c.jsx)(vt,{message:e},e.key)}))]}),(0,c.jsx)("div",{className:"mt-auto border-t border-border bg-background px-3 py-3",children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(d.I,{ref:st,type:"text",placeholder:"Write your message here ...",onKeyDown:function(e){"Enter"==e.key&&xt()},name:"typedMessage",id:"typedMessage",className:"mb-0 h-10 flex-1 rounded-lg",disabled:!me||le},"typedMessage"),(0,c.jsx)(l.z,{variant:"default",id:"btn-chat",disabled:!me||le,onClick:xt,className:"size-10 shrink-0 rounded-lg p-0","aria-label":"Send message",children:(0,c.jsx)(z.Z,{className:"size-[18px]"})})]})})]}):null}},95034:function(e,t,r){r.d(t,{C:function(){return u},t:function(){return c}});var n=r(26042),a=r(99534),s=r(85893),i=(r(67294),r(12003)),o=r(62461),c=(0,i.j)("inline-flex items-center gap-1.5 whitespace-nowrap font-bold transition-colors duration-200 ease [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{success:"bg-green-100 text-green-600 dark:bg-green-900/40 dark:text-green-500",default:"bg-primary text-primary-foreground hover:bg-primary/90 border border-input",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 border border-input",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-border",muted:"bg-muted text-muted-foreground hover:bg-muted/80 border border-border",blue:"bg-blue-100 text-blue-700 dark:bg-blue-500/15 dark:text-blue-400",outline:"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground",category:"text-primary bg-accent hover:bg-accent/80 border border-border shadow-sm",ghost:"text-foreground hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",new:"bg-primary text-primary-foreground border border-primary/20"},size:{xs:"text-[10px] px-1.5 py-px rounded-sm [&_svg]:size-3",sm:"text-xs px-2 py-0.5 rounded-sm [&_svg]:size-3",default:"text-sm px-2.5 py-0.5 rounded-md [&_svg]:size-4",lg:"text-sm px-3 py-1 rounded-lg [&_svg]:size-4"}},defaultVariants:{variant:"default",size:"default"}});function u(e){var t=e.className,r=e.variant,i=e.size,u=(0,a.Z)(e,["className","variant","size"]);return(0,s.jsx)("div",(0,n.Z)({className:(0,o.cn)(c({variant:r,size:i}),t)},u))}},62922:function(e,t,r){r.d(t,{AQ:function(){return c},Av:function(){return a},by:function(){return o},dA:function(){return s},vF:function(){return i}});var n=function(e){if(!e)return"00";var t=e>=10?e.toString()[0]:"0",r=e>=10?e.toString()[1]:e.toString();return"".concat(t).concat(r)},a=function(e,t,r){var a=[];return a.push(n(e)),a.push(n(t)),a.push(n(r)),a.join(":")};function s(e){var t=new Date(e),r=new Intl.DateTimeFormat("en-GB",{day:"2-digit",month:"short"}).format(t),n=new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!0}).format(t).toLowerCase().replace(" ","");return"".concat(r," \xb7 ").concat(n)}function i(e){return new Date(e).toDateString()===(new Date).toDateString()?new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!0}).format(new Date(e)):new Intl.DateTimeFormat("en-GB",{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit",hour12:!0}).format(new Date(e))}var o=function(e,t){return t?i(t):e?e.toLocaleUpperCase():""},c=function(e,t){return"".concat(n(e),":").concat(n(t))}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.