PageSourceSearch

https://app.stoxly.ai/assets/LivestreamPipOverlay-hxVKWw9A.js

js stoxly.ai collected 2026-10-05 13:37:57 UTC 13,601 bytes, 3 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a10aa0-7596-7d42-9fcb-7c3eabc88525")}catch(e){}}();import{r as k,c as $,R as I,g4 as le,be as U,bg as ne,f as K,g as x,p as m,cJ as J,k as z,cK as X,h as c,q as f,X as N,l as H,V as q,j as se,av as oe,aD as ie,M as re,N as ue,n as de,cb as ce,T as ve,bk as fe,m as Y,bf as me,bB as he}from"./index-DUVIiaS-.js";import{u as pe}from"./useLivestreamPip-CgS8xhi-.js";import{j as ye}from"./useNewsQueries-BB2CO-jx.js";import{_ as be}from"./SpinnerLoader.vue_vue_type_script_setup_true_lang-BMPmvYDV.js";import{R as G}from"./rotate-cw-Dn0LRJBH.js";import{M as we}from"./maximize-2-Ctq1t9DM.js";import{M as ge}from"./minimize-2-C7R1FIZV.js";const ke={sm:360,md:520,lg:720},F=["sm","md","lg"];function xe(e){const i=F.indexOf(e);return F[(i+1)%F.length]??"sm"}function Ce(e,i,t=32){return Math.min(ke[e],Math.max(240,i-t))}const _e=3e4,Me=300*1e3;function Le(e){return Math.min(Me,_e*2**Math.max(0,e-1))}function Se(e,i){return{failedAt:i,failures:(e?.failures??0)+1}}function Te(e,i){return e?i-e.failedAt<Le(e.failures):!1}function $e(e,i,t){if(!e)return{kind:"none"};if(e.hlsUrl&&!t)return{kind:"source",source:e.hlsUrl,mode:"hls",reason:"hls"};const r=!!e.hlsUrl;if(i.status==="pending")return{kind:"resolving"};const u=i.status==="settled"?i.data:void 0;return u?.isLive&&u.videoId?{kind:"source",source:u.videoId,mode:"youtube",reason:r?"youtube-after-hls":"youtube-live"}:e.fallbackVideoId?{kind:"source",source:e.fallbackVideoId,mode:"youtube",reason:r?"youtube-after-hls":"fallback"}:{kind:"none"}}const De=12e3;let W=null;function Pe(){return W||(window.YT?.Player?Promise.resolve():(W=new Promise(e=>{const i=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{i?.(),e()};const t=document.createElement("script");t.src="https://www.youtube.com/iframe_api",document.head.appendChild(t)}),W))}function Ie(){const e=k(null),i=k(null),t=k(!0),r=k(!1),u=k(!1),h=k(null),v=k(null),b=$(()=>h.value?"failed":v.value?u.value?"playing":"loading":"idle");let s=null,d=null,w=null,R=null,D=0;const p=n=>n===D;function A(){R&&(clearTimeout(R),R=null)}function M(n){A(),R=setTimeout(()=>{p(n)&&!u.value&&!h.value&&(h.value="Stream did not start",r.value=!1)},De)}function L(n){p(n)&&(A(),u.value=!0,r.value=!0)}function S(n,l){p(n)&&(A(),h.value=l,r.value=!1)}function E(){s&&(s.destroy(),s=null),e.value&&(e.value.pause(),e.value.removeAttribute("src"),e.value.load())}function O(){if(d){try{d.destroy()}catch{}d=null}i.value&&i.value.replaceChildren()}function g(){A(),E(),O(),w&&(document.removeEventListener("visibilitychange",w),w=null)}function V(n){g(),v.value=n,u.value=!1,h.value=null;const l=++D;return M(l),l}function j(n){const l=V("hls"),y=e.value;if(!y){S(l,"Video element not available");return}y.muted=t.value,y.setAttribute("referrerpolicy","no-referrer"),a(l,y,n)}function a(n,l,y){const T=()=>{_(),p(n)&&(L(n),l.play().catch(()=>{}))},C=async()=>{if(_(),!p(n))return;l.removeAttribute("src"),l.load();const{default:B}=await ne(async()=>{const{default:ae}=await import("./hls-D02re3bK.js");return{default:ae}},[]);p(n)&&(B.isSupported()?o(n,B,l,y):S(n,"HLS stream error"))},_=()=>{l.removeEventListener("loadedmetadata",T),l.removeEventListener("error",C)};l.addEventListener("loadedmetadata",T,{once:!0}),l.addEventListener("error",C,{once:!0}),l.src=y}function o(n,l,y,T){const C=new l({liveSyncDuration:3,liveMaxLatencyDuration:1/0,liveDurationInfinity:!0,liveBackBufferLength:300});s=C,C.loadSource(T),C.attachMedia(y),C.on(l.Events.MANIFEST_PARSED,()=>{if(!p(n))return;L(n);const _=C.liveSyncPosition;_&&_>0&&(y.currentTime=_),y.play().catch(()=>{})}),C.on(l.Events.ERROR,(_,B)=>{B.fatal&&S(n,"HLS stream error")})}async function P(n){const l=V("youtube");try{await Pe()}catch{S(l,"Failed to load YouTube player");return}if(!p(l))return;if(!window.YT?.Player){S(l,"YouTube API not available");return}const y=i.value;if(!y){S(l,"Player container not found");return}y.replaceChildren();const T=document.createElement("div");T.className="h-full w-full",y.appendChild(T),d=new window.YT.Player(T,{videoId:n,host:"https://www.youtube-nocookie.com",playerVars:{autoplay:1,mute:1,modestbranding:1,rel:0,playsinline:1,controls:1},events:{onReady:()=>{p(l)&&(L(l),t.value=!0)},onError:C=>{const _=C.data;S(l,_===150||_===101?"This stream cannot be embedded":"YouTube player error")}}})}function Z(n,l){l==="hls"?j(n):P(n),te()}function Q(){D++,g(),v.value=null,r.value=!1,u.value=!1,h.value=null}function ee(){t.value=!t.value,v.value==="hls"&&e.value?e.value.muted=t.value:v.value==="youtube"&&d&&(t.value?d.mute():d.unMute())}function te(){w||(w=()=>{document.hidden?(v.value==="hls"&&e.value?e.value.pause():v.value==="youtube"&&d&&d.pauseVideo(),r.value=!1):(v.value==="hls"&&e.value?e.value.play().catch(()=>{}):v.value==="youtube"&&d&&d.playVideo(),r.value=!0)},document.addEventListener("visibilitychange",w))}return I(t,n=>{v.value==="hls"&&e.value&&(e.value.muted=n)}),le()&&U(g),{videoElementRef:e,ytHostRef:i,play:Z,stop:Q,destroy:g,toggleMute:ee,isMuted:t,isPlaying:r,isReady:u,error:h,status:b,playbackMode:v}}const He={class:"aspect-video bg-slate-950 rounded-lg overflow-hidden relative"},Re={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-2 bg-slate-950/80","data-testid":"livestream-status"},Ae={key:0,class:"text-xs text-slate-400"},ze={key:1,class:"text-[11px] text-slate-500"},Ne={key:1,class:"absolute inset-0 flex flex-col items-center justify-center bg-slate-950/90 gap-2","data-testid":"livestream-status"},Ee={class:"text-xs text-slate-500"},Oe=2e3,Ve=K({__name:"LivestreamPlayer",props:{source:{},mode:{},muted:{type:Boolean},channelName:{},resolving:{type:Boolean},notice:{}},emits:["hls-failed","reload"],setup(e,{emit:i}){const t=e,r=i,u=Ie(),h=$(()=>{if(t.resolving)return"loading";if(!t.source)return"none";const s=u.status.value;return s==="idle"?"loading":s}),v=k(!1);let b=null;return I(h,s=>{b&&clearTimeout(b),b=null,v.value=!1,s==="loading"&&(b=setTimeout(()=>{v.value=!0},Oe))},{immediate:!0}),U(()=>{b&&clearTimeout(b)}),I(()=>t.muted,s=>{u.isMuted.value!==s&&u.toggleMute()}),I(()=>u.error.value,s=>{s&&t.mode==="hls"&&r("hls-failed")}),I(()=>[t.source,t.mode],async([s,d])=>{s&&d?(await ie(),u.play(s,d)):u.stop()},{immediate:!0}),(s,d)=>(m(),x("div",He,[J(c("video",{ref:w=>{f(u).videoElementRef.value=w},class:"w-full h-full object-cover",playsinline:"",muted:""},null,512),[[X,e.mode==="hls"]]),J(c("div",{ref:w=>{f(u).ytHostRef.value=w},class:"w-full h-full"},null,512),[[X,e.mode==="youtube"]]),h.value==="loading"?(m(),x("div",Re,[N(f(be),{class:"text-emerald-500"}),v.value?(m(),x("p",Ae,H(s.$t("newsDashboard.livestreams.connecting",{name:e.channelName??""})),1)):z("",!0),e.notice?(m(),x("p",ze,H(e.notice),1)):z("",!0)])):h.value==="failed"||h.value==="none"?(m(),x("div",Ne,[d[1]||(d[1]=c("span",{class:"text-2xl"},"📺",-1)),c("p",Ee,H(h.value==="failed"?s.$t("newsDashboard.livestreams.startFailed",{name:e.channelName??""}):e.channelName?s.$t("newsDashboard.livestreams.notLive",{name:e.channelName}):s.$t("newsDashboard.livestreams.unavailable")),1),N(f(oe),{variant:"soft",size:"xs","data-testid":"livestream-retry",onClick:d[0]||(d[0]=w=>r("reload"))},{default:q(()=>[N(f(G),{size:12}),se(" "+H(s.$t("newsDashboard.livestreams.reload")),1)]),_:1})])):z("",!0)]))}}),Be={class:"flex flex-nowrap gap-1 overflow-x-auto scrollbar-hide py-px"},Ye=["onClick"],We={key:0,class:"text-[11px] text-slate-600"},je=K({__name:"LivestreamChannelList",props:{channels:{},selectedChannelId:{}},emits:["select"],setup(e){return(i,t)=>(m(),x("div",Be,[(m(!0),x(re,null,ue(e.channels,r=>(m(),x("button",{key:r.id,class:de(["px-2 py-0.5 text-[11px] font-medium rounded-md transition-all duration-200 shrink-0 whitespace-nowrap",e.selectedChannelId===r.id?"bg-emerald-500/15 text-fox-accent border border-emerald-500/30":"text-slate-500 hover:text-slate-300 bg-white/[0.03] hover:bg-white/[0.06] border border-white/[0.06]"]),onClick:u=>i.$emit("select",r)},H(r.name),11,Ye))),128)),e.channels.length===0?(m(),x("span",We,H(i.$t("newsDashboard.livestreams.noChannels")),1)):z("",!0)]))}}),Fe=ce(je,[["__scopeId","data-v-d6f9b580"]]),Ue={class:"flex items-center justify-between px-3 py-2 bg-slate-900/80"},Ke={class:"flex items-center gap-1.5"},Je={class:"text-[11px] font-medium text-slate-300"},Xe={class:"flex items-center gap-0.5"}
1,qe=["aria-label","title"],Ge=["aria-label","title"],Ze={key:0,class:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Qe={key:1,class:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},et={class:"px-2 py-1.5 bg-slate-900/60"},tt=8e3,ut=K({__name:"LivestreamPipOverlay",setup(e){const{t:i}=ve(),t=pe(),r=k("sm"),{width:u}=fe(),h=$(()=>`${Ce(r.value,u.value)}px`);function v(){r.value=xe(r.value)}const b=$(()=>{if(!t.channels.value.length)return null;const a=t.selectedChannelId.value;if(a){const o=t.channels.value.find(P=>P.id===a);if(o)return o}return t.channels.value.find(o=>o.id==="bloomberg")??t.channels.value[0]}),s=$(()=>{const a=b.value;return!a||a.useFallbackOnly||!a.handle?null:a.handle}),{data:d,isPending:w,refetch:R}=ye(s),D=k(!1);let p=null;I(s,()=>{p&&clearTimeout(p),D.value=!1,p=setTimeout(()=>{D.value=!0},tt)},{immediate:!0}),U(()=>{p&&clearTimeout(p)});const A=$(()=>s.value?w.value&&!D.value?{status:"pending"}:{status:"settled",data:d.value}:{status:"idle"}),M=k(new Map),L=k(Date.now());function S(){const a=b.value;a&&(L.value=Date.now(),M.value=new Map(M.value).set(a.id,Se(M.value.get(a.id),L.value)))}const E=k(0);function O(){const a=b.value;if(a&&M.value.has(a.id)){const o=new Map(M.value);o.delete(a.id),M.value=o}L.value=Date.now(),R(),E.value++}const g=$(()=>{const a=b.value;return $e(a,A.value,!!a&&Te(M.value.get(a.id),L.value))}),V=$(()=>g.value.kind==="source"&&g.value.reason==="youtube-after-hls"?i("newsDashboard.livestreams.switchingToYoutube"):null);I(g,a=>{t.isPip.value&&t.updateSource(a.kind==="source"?a.source:null,a.kind==="source"?a.mode:null)});function j(a){L.value=Date.now(),t.selectChannel(a)}return(a,o)=>(m(),Y(he,{"enter-active-class":"transition ease-out duration-300","enter-from-class":"opacity-0 translate-y-4 scale-95","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition ease-in duration-200","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-4 scale-95"},{default:q(()=>[f(t).isPip.value?(m(),x("div",{key:0,class:"fixed bottom-4 right-4 z-[9999] rounded-2xl border border-white/[0.12] bg-slate-950 shadow-2xl shadow-black/60 overflow-hidden",style:me({width:h.value})},[c("div",Ue,[c("div",Ke,[o[4]||(o[4]=c("span",{class:"h-2 w-2 rounded-full bg-red-500 animate-pulse"},null,-1)),c("span",Je,H(f(t).channelName.value||a.$t("newsDashboard.livestreams.title")),1)]),c("div",Xe,[c("button",{class:"rounded-md p-1 text-slate-400 transition-colors hover:bg-white/[0.08] hover:text-white","aria-label":a.$t("newsDashboard.livestreams.resize"),title:a.$t("newsDashboard.livestreams.resize"),"data-testid":"livestream-pip-resize",onClick:o[0]||(o[0]=P=>v())},[r.value!=="lg"?(m(),Y(f(we),{key:0,size:14})):(m(),Y(f(ge),{key:1,size:14}))],8,qe),c("button",{class:"rounded-md p-1 text-slate-400 transition-colors hover:bg-white/[0.08] hover:text-white","aria-label":a.$t("newsDashboard.livestreams.reload"),title:a.$t("newsDashboard.livestreams.reload"),"data-testid":"livestream-pip-reload",onClick:o[1]||(o[1]=P=>O())},[N(f(G),{size:14})],8,Ge),c("button",{class:"p-1 rounded-md hover:bg-white/[0.08] text-slate-400 hover:text-white transition-colors","data-testid":"livestream-pip-mute",onClick:o[2]||(o[2]=P=>f(t).toggleMute())},[f(t).isMuted.value?(m(),x("svg",Ze,[...o[5]||(o[5]=[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"},null,-1),c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2"},null,-1)])])):(m(),x("svg",Qe,[...o[6]||(o[6]=[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"},null,-1)])]))]),c("button",{class:"p-1 rounded-md hover:bg-white/[0.08] text-slate-400 hover:text-white transition-colors","data-testid":"livestream-pip-close",onClick:o[3]||(o[3]=P=>f(t).exitPip())},[...o[7]||(o[7]=[c("svg",{class:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[c("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])])]),(m(),Y(Ve,{key:E.value,source:g.value.kind==="source"?g.value.source:null,mode:g.value.kind==="source"?g.value.mode:null,resolving:g.value.kind==="resolving",notice:V.value,muted:f(t).isMuted.value,"channel-name":b.value?.name,onHlsFailed:S,onReload:O},null,8,["source","mode","resolving","notice","muted","channel-name"])),c("div",et,[N(Fe,{channels:f(t).channels.value,"selected-channel-id":f(t).selectedChannelId.value,onSelect:j},null,8,["channels","selected-channel-id"])])],4)):z("",!0)]),_:1}))}});
1export{ut as default};
2
3//# chunkId=01a10aa0-7596-7d42-9fcb-7c3eabc88525

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.