"use strict";(globalThis.webpackChunktrueplayer=globalThis.webpackChunktrueplayer||[]).push([[360],{189(e,t,a){a.d(t,{createYouTubeProvider:()=>d});var o=a(418),i=a(855);let r=null;function n(e){if(e.videoId)return e.videoId;const t=(e.src||"").match(/(?:v=|\.be\/|embed\/|shorts\/|live\/)([\w-]{11})/);return t?t[1]:e.src}async function d(e,t,a={}){const d=await(r||(r=new Promise(e=>{if(window.YT&&window.YT.Player)return void e(window.YT);const t=window.onYouTubeIframeAPIReady;if(window.onYouTubeIframeAPIReady=()=>{t&&t(),e(window.YT)},!document.querySelector('script[src*="youtube.com/iframe_api"]')){const e=document.createElement("script");e.src="https://www.youtube.com/iframe_api",document.head.appendChild(e)}}),r)),u=(0,o.z)(),l=document.createElement("div");l.className="tp-media",e.appendChild(l);let s=null,c=0;const m=new d.Player(l,{videoId:n(t),host:window.TruePlayerGlobal&&window.TruePlayerGlobal.youtube_nocookie?"https://www.youtube-nocookie.com":void 0,playerVars:{controls:0,modestbranding:1,rel:0,playsinline:1,fs:0,disablekb:1,iv_load_policy:3,autoplay:a.autoStart?1:0,mute:a.behavior&&a.behavior.muted?1:0,origin:window.location.origin},events:{onReady:()=>{c=m.getDuration()||0,u.emit("ready"),u.emit("durationchange")},onError:e=>{u.emit("error",{code:e&&e.data,message:{2:(0,i.__)("That YouTube link doesn’t contain a valid video ID."),5:(0,i.__)("YouTube couldn’t play this video in the browser."),100:(0,i.__)("That YouTube video was removed, or is private."),101:(0,i.__)("The owner of that YouTube video doesn’t allow it to be embedded."),150:(0,i.__)("The owner of that YouTube video doesn’t allow it to be embedded.")}[e&&e.data]||(0,i.__)("This YouTube video could not be played.")})},onStateChange:e=>{const t=m.getDuration()||0;t&&t!==c&&(c=t,u.emit("durationchange")),e.data===d.PlayerState.PLAYING?(u.emit("play"),u.emit("playing"),s||(s=setInterval(()=>u.emit("timeupdate"),250))):e.data===d.PlayerState.PAUSED?u.emit("pause"):e.data===d.PlayerState.ENDED?u.emit("ended"):e.data===d.PlayerState.BUFFERING&&u.emit("waiting")}}});return{kind:"youtube",element:l,capabilities:{pip:!1,quality:!1,rate:!0,tracks:!1},on:u.on,play:()=>m.playVideo(),pause:()=>m.pauseVideo(),seek:e=>m.seekTo(e,!0),setVolume:e=>m.setVolume(100*e),setMuted:e=>e?m.mute():m.unMute(),setRate:e=>m.setPlaybackRate(e),getCurrentTime:()=>m.getCurrentTime()||0,getDuration:()=>m.getDuration()||c||0,getBufferedEnd:()=>(m.getVideoLoadedFraction()||0)*(m.getDuration()||0),isPaused:()=>m.getPlayerState()!==d.PlayerState.PLAYING,isMuted:()=>m.isMuted(),getVolume:()=>(m.getVolume()||0)/100,getRate:()=>m.getPlaybackRate()||1,getQualities:()=>[],setQuality:()=>{},getTextTracks:()=>[],setTextTrack:()=>{},requestPiP:()=>Promise.reject(),destroy:()=>{s&&clearInterval(s);try{m.destroy()}catch(e){}u.clear()}}}}}]);