1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[18178],{18178:(e,t,n)=>{n.d(t,{Ay:()=>w,C7:()=>g,UT:()=>y});var a=n(95155),l=n(12115),r=n(43751),i=n(91995),o=n(77051),c=n(19909),s=n(93094);n(16594);var u=n(34678),d=n(35299),f=n(57828),h=n(20229),p=n(2068),m=n(35130),v=n(54231),x=n(87492);function b(e){let{hostName:t}=e;return(0,a.jsxs)("div",{className:"relative w-full bg-black overflow-hidden",style:{aspectRatio:"16 / 9"},"data-live-inline-player":!0,"data-live-ended":"true",children:[(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 bg-black/85 text-white/80 px-6 text-center",role:"status","aria-live":"polite",children:[(0,a.jsx)(u.A,{className:"w-8 h-8","aria-hidden":"true"}),(0,a.jsx)("p",{className:"text-[13px] font-semibold",children:"This live video has ended"}),t?(0,a.jsxs)("p",{className:"text-[12px] text-white/55",children:[t," is no longer live"]}):null]}),(0,a.jsx)("span",{className:"absolute top-3 left-3 inline-flex items-center gap-1.5 px-2 py-1 rounded-md bg-white/15 text-white text-[12px] font-bold uppercase tracking-wide",children:"Ended"})]})}let g=e=>{let t=Math.max(0,Math.floor(e||0)),n=Math.floor(t/3600),a=Math.floor(t%3600/60),l=t%60;return n>0?"".concat(n,":").concat(String(a).padStart(2,"0"),":").concat(String(l).padStart(2,"0")):"".concat(a,":").concat(String(l).padStart(2,"0"))};function y(e){let{startedAt:t,viewerCount:n=0,onClickVideo:c,hostName:u,rounded:v=!1,onTrackGone:x,onTrackHere:y,ended:w=!1,hideChrome:k=!1,reconnecting:j=!1}=e,N=(0,r.t)([s.CC.Source.Camera,s.CC.Source.ScreenShare]).filter(e=>{var t,n;return!(null==(t=e.participant)?void 0:t.isLocal)&&(null==(n=e.publication)?void 0:n.track)}),S=N.find(e=>e.source===s.CC.Source.ScreenShare)||N[0],T=(null==S?void 0:S.source)===s.CC.Source.ScreenShare,C=(0,r.K)(),A=(0,i.f)(),E=C.filter(e=>e.audioTrackPublications.size>0||e.videoTrackPublications.size>0).length,I=Math.max(0,C.length-Math.min(1,E)),L=Math.max(Number(n)||0,I),P=(0,l.useMemo)(()=>{let e=t?new Date(t).getTime():NaN;return Number.isFinite(e)?e:Date.now()},[t]),[R,M]=(0,l.useState)(()=>Math.max(0,Math.floor((Date.now()-P)/1e3)));(0,l.useEffect)(()=>{if(w)return;let e=()=>M(Math.max(0,Math.floor((Date.now()-P)/1e3)));e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[P,w]);let O=(0,l.useRef)(!1),K=(0,l.useRef)(null),z=(0,l.useRef)(!1),D=(0,l.useRef)(!1);(0,l.useEffect)(()=>{if(!w){if(S){O.current=!0,z.current=!1,K.current&&(clearTimeout(K.current),K.current=null),D.current||(D.current=!0,"function"==typeof y&&y());return}return!O.current||z.current||K.current||(K.current=setTimeout(()=>{K.current=null,z.current||(z.current=!0,"function"==typeof x&&x())},1200)),()=>{K.current&&(clearTimeout(K.current),K.current=null)}}},[S,w,x,y]);let[J,B]=(0,l.useState)(!0),U=(0,l.useCallback)(e=>
1{A&&A.remoteParticipants.forEach(t=>{t.audioTrackPublications.forEach(t=>{var n,a;null==(a=t.track)||null==(n=a.attachedElements)||n.forEach(t=>{t.muted=e})})})},[A]);(0,l.useEffect)(()=>{U(J)},[U,J,S]);let _=(0,l.useCallback)(e=>{e.stopPropagation(),B(e=>{let t=!e;return U(t),t})},[U]),V=(0,l.useCallback)(()=>{"function"==typeof c&&c()},[c]),F=(0,l.useCallback)(e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),V())},[V]);return w?(0,a.jsx)(b,{hostName:u}):(0,a.jsxs)("div",{className:"relative w-full bg-black overflow-hidden ".concat(""),style:{aspectRatio:"16 / 9"},"data-live-inline-player":!0,children:[(0,a.jsx)("div",{role:"button",tabIndex:0,"aria-label":"Watch ".concat(u||"the"," live video in full screen"),onClick:V,onKeyDown:F,className:"absolute inset-0 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:S?(0,a.jsx)(o.V,{trackRef:S,className:"w-full h-full object-contain bg-black"}):(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 text-white/75",children:[(0,a.jsx)(d.A,{className:"w-7 h-7 animate-spin"}),(0,a.jsx)("p",{className:"text-[13px] font-medium",children:j?"Reconnecting to ".concat(u||"the broadcaster","â¦"):"Connecting to ".concat(u||"the broadcaster","â¦")})]})}),!k&&(0,a.jsxs)("div",{className:"absolute top-3 left-3 flex items-center gap-2 pointer-events-none",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-md bg-[#fa383e] text-white text-[12px] font-bold uppercase tracking-wide shadow-md",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-pulse"}),"LIVE ",g(R)]}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md bg-black/55 text-white text-[12px] font-semibold backdrop-blur-sm",children:[(0,a.jsx)(f.A,{className:"w-3.5 h-3.5"}),L.toLocaleString()]})]}),T&&(0,a.jsxs)("div",{className:"absolute top-3 right-3 inline-flex items-center gap-1.5 px-2 py-1 rounded-md bg-black/60 text-white text-[12px] font-semibold shadow-md backdrop-blur-sm pointer-events-none",children:[(0,a.jsx)(h.A,{className:"w-3.5 h-3.5"}),"Sharing screen"]}),(0,a.jsx)("div",{className:"absolute bottom-3 right-3",children:(0,a.jsx)("button",{type:"button",onClick:_,"aria-label":J?"Unmute live video":"Mute live video",title:J?"Unmute":"Mute",className:"p-2 rounded-full bg-black/55 hover:bg-black/75 text-white backdrop-blur-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white",children:J?(0,a.jsx)(p.A,{className:"w-[18px] h-[18px]"}):(0,a.jsx)(m.A,{className:"w-[18px] h-[18px]"})})})]})}function w(e){let{streamId:t,streamKey:n,startedAt:r,viewerCount:i=0,viewerName:o="Viewer",onClickVideo:s,hostName:f,rounded:h=!0,onEnded:p}=e,[m,g]=(0,l.useState)(""),[w,k]=(0,l.useState)(""),[j,N]=(0,l.useState)(null),[S,T]=(0,l.useState)(!0),[C,A]=(0,l.useState)(!1),[E,I]=(0,l.useState)(!1),L=(0,l.useRef)(!1),P=(0,l.useCallback)(async()=>{if(t&&!L.current){L.current=!0;try{var e,n,a;let l=await x.default.get("/live/".concat(t)),r=null!=(a=null!=(n=null==l||null==(e=l.data)?void 0:e.data)?n:null==l?void 0:l.data)?a:null,i=(null==r?void 0:r.liveStream)||(null==r?void 0:r.stream)||r||null,o=String((null==i?void 0:i.status)||"").toLowerCase();i&&o&&"live"!==o&&A(!0)}catch(e){}finally{L.current=!1}}},[t]);(0,l.useEffect)(()=>{if(!t||C)return;let e=setInterval(P,5e3);return()=>clearInterval(e)},[t,C,P]);let R=(0,l.useCallback)(()=>{P()},[P]),M=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(C||!m||!w){M.current&&(clearTimeout(M.current),M.current=null),E&&I(!1);return}return M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{M.current=null,I(!0)},12e3),()=>{M.current&&(clearTimeout(M.current),M.current=null)}},[m,w,C]);let O=(0,l.useCallback)(()=>{M.current&&(clearTimeout(M.current),M.current=null),I(!1)},[]),K=(0,l.useRef)(!1);(0,l.useEffect)(()=>{C&&!K.current&&(K.current=!0,"function"==typeof p&&p())},[C,p]),(0,l.useEffect)(()=>{if(C)return;if(!n){T(!1),N("missing-stream-key");return}let e=!1;return T(!0),N(null),(0,v.W4)(n,o,{canPublish:!1}).then(t=>{let{token:n,serverUrl:a}=t;if(!e){if(!n||!a)return void N("no-token");g(n),k(a)}}).catch(()=>{e||N("token-failed")}).finally(()=>{e||T(!1)}),()=>{e=!0}},[n,o,C]);let z=(0,l.useRef)(null),D=(0,l.useRef)(null),J=(0,l.useRef)(!1);return((0,l.useEffect)(()=>
1{if(t&&!C)return D.current&&(clearTimeout(D.current),D.current=null),J.current||z.current||(z.current=setTimeout(()=>{z.current=null,J.current=!0,x.default.post("/live/".concat(t,"/join")).catch(()=>{})},0)),()=>{z.current&&(clearTimeout(z.current),z.current=null),D.current=setTimeout(()=>{J.current&&(J.current=!1,x.default.post("/live/".concat(t,"/leave")).catch(()=>{})),D.current=null},250)}},[t,C]),C)?(0,a.jsx)(b,{hostName:f}):S?(0,a.jsxs)("div",{className:"relative w-full bg-black flex flex-col items-center justify-center gap-3 text-white/75",style:{aspectRatio:"16 / 9"},children:[(0,a.jsx)(d.A,{className:"w-7 h-7 animate-spin"}),(0,a.jsx)("p",{className:"text-[13px] font-medium",children:"Joining live videoâ¦"})]}):!j&&m&&w?(0,a.jsx)(c.L,{token:m,serverUrl:w,connect:!0,video:!1,audio:!1,className:"w-full","data-lk-theme":"default",children:(0,a.jsx)(y,{startedAt:r,viewerCount:i,onClickVideo:s,hostName:f,rounded:h,onTrackGone:R,onTrackHere:O,reconnecting:E,ended:!1})}):(0,a.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>"function"==typeof s&&s(),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),"function"==typeof s&&s())},"aria-label":"Live video unavailable â tap to open",className:"relative w-full bg-black flex flex-col items-center justify-center gap-2 text-white/70 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",style:{aspectRatio:"16 / 9"},children:[(0,a.jsx)(u.A,{className:"w-8 h-8"}),(0,a.jsx)("p",{className:"text-[13px] font-medium",children:"Live video isnât available right now"}),(0,a.jsxs)("span",{className:"absolute top-3 left-3 inline-flex items-center gap-1.5 px-2 py-1 rounded-md bg-[#fa383e] text-white text-[12px] font-bold uppercase tracking-wide shadow-md",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-pulse"}),"LIVE"]})]})}},54231:(e,t,n)=>{n.d(t,{Dw:()=>d,Jr:()=>c,Qi:()=>s,Qn:()=>f,W4:()=>i,iP:()=>u,mg:()=>o});var a=n(95704);void 0!==a&&a.env;let l=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n]},r=()=>localStorage.getItem("token");async function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};l("[LiveKit] Fetching token...",{roomName:e,participantName:t,canPublish:n.canPublish,isAdmin:n.isAdmin});let i=r(),o={roomName:e,participantName:t};"boolean"==typeof n.canPublish&&(o.canPublish=n.canPublish),!0===n.isAdmin&&(o.isAdmin=!0),n.metadata&&(o.metadata=n.metadata),n.callAttemptId&&(o.callAttemptId=n.callAttemptId);try{var c;let t=await fetch("".concat("/api/v1","/livekit/token"),{method:"POST",headers:{"Content-Type":"application/json",...i?{Authorization:"Bearer ".concat(i)}:{}},body:JSON.stringify(o)}),n=await t.json();if(!t.ok)throw console.error("[LiveKit] Token fetch failed:",t.status),Error((null==n?void 0:n.error)||(null==n?void 0:n.message)||"Failed to get call token");let r=(null==n?void 0:n.data)||n,s=r.serverUrl||a.env.NEXT_PUBLIC_LIVEKIT_URL||"";if("https:"===window.location.protocol&&s.startsWith("ws://")){let e=window.location.hostname,t=window.location.port?":".concat(window.location.port):"",n="wss://".concat(e).concat(t,"/livekit-ws");l("[LiveKit] HTTPS page detected â rewriting",s,"â",n),s=n}return l("[LiveKit] Token received successfully",{tokenLength:null==(c=r.token)?void 0:c.length,serverUrl:s,room:r.room||e}),{token:r.token,serverUrl:s}}catch(e){throw console.error("[LiveKit] Token fetch error:",e.message),e}}async function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"video",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=r();try{await fetch("".concat("/api/v1","/calls/start"),{method:"POST",headers:{"Content-Type":"application/json",...l?{Authorization:"Bearer ".concat(l)}:{}},body:JSON.stringify({roomName:e,receiverId:t,callType:n,callAttemptId:a||void 0})})}catch(e){}}async function c(e,t){let n=r();try{await fetch("".concat("/api/v1","/calls/leave"),{method:"POST",headers:{"Content-Type":"application/json",...n?{Authorization:"Bearer ".concat(n)}:{}}
1,body:JSON.stringify({roomName:e,status:t})})}catch(e){}}async function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=r();try{await fetch("".concat("/api/v1","/calls/answer"),{method:"POST",headers:{"Content-Type":"application/json",...n?{Authorization:"Bearer ".concat(n)}:{}},body:JSON.stringify({roomName:e,callAttemptId:t||void 0})})}catch(e){}}async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;let n=r();try{await fetch("".concat("/api/v1","/calls/reject"),{method:"POST",headers:{"Content-Type":"application/json",...n?{Authorization:"Bearer ".concat(n)}:{}},body:JSON.stringify({roomName:e,callerId:t||void 0})})}catch(e){}}async function d(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e||!t)return;let a=r();try{await fetch("".concat("/api/v1","/calls/participant-event"),{method:"POST",headers:{"Content-Type":"application/json",...a?{Authorization:"Bearer ".concat(a)}:{}},body:JSON.stringify({roomName:e,eventType:t,conversationId:n||void 0})})}catch(e){}}async function f(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;l("[LiveKit] Notifying incoming call...",{peerId:e,conversationId:i,roomName:t,isVideo:n,callerName:a,callAttemptId:o});let c=r();try{let r=await fetch("".concat("/api/v1","/calls/notify"),{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:"Bearer ".concat(c)}:{}},body:JSON.stringify({peerId:e||void 0,conversationId:i||void 0,roomName:t,isVideo:n,callerName:a,callAttemptId:o||void 0})}),s=await r.json();if(!r.ok)throw console.error("[LiveKit] Call notify failed:",r.status,s),Error((null==s?void 0:s.error)||(null==s?void 0:s.message)||"Failed to notify");return l("[LiveKit] Call notification sent successfully"),(null==s?void 0:s.data)||s}catch(e){throw console.error("[LiveKit] Call notify error:",e.message),e}}}}]);
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.