/* Minification failed. Returning unminified contents.
(1,1-6): run-time error JS1195: Expected expression: class
(1,58-59): run-time error JS1004: Expected ';': {
(1,280-281): run-time error JS1014: Invalid character: `
(1,340-341): run-time error JS1014: Invalid character: `
(1,827-838): run-time error JS1004: Expected ';': addPrefetch
(1,845-846): run-time error JS1004: Expected ';': {
(1,943-958): run-time error JS1004: Expected ';': warmConnections
(1,960-961): run-time error JS1004: Expected ';': {
(1,1318-1319): run-time error JS1004: Expected ';': {
(1,1396-1397): run-time error JS1195: Expected expression: >
(1,1502-1503): run-time error JS1195: Expected expression: >
(1,1516-1517): run-time error JS1195: Expected expression: ,
(1,1544-1545): run-time error JS1195: Expected expression: )
(1,1553-1570): run-time error JS1004: Expected ';': addYTPlayerIframe
(1,1573-1574): run-time error JS1004: Expected ';': {
(1,1604-1608): run-time error JS1004: Expected ';': this
(1,1790-1791): run-time error JS1003: Expected ':': (
(1,1793-1794): run-time error JS1100: Expected ',': {
(1,1816-1817): run-time error JS1002: Syntax error: }
(1,2267-2268): run-time error JS1014: Invalid character: `
(1,2273-2274): run-time error JS1004: Expected ';': :
(1,2038-2070): run-time error JS1018: 'return' statement outside of function: return this.addYTPlayerIframe(e)
(1,1881-1887): run-time error JS1018: 'return' statement outside of function: return
 */
class LiteYTEmbed extends HTMLElement{connectedCallback(){this.videoId=this.getAttribute("videoid");let e=this.querySelector(".lty-playbtn");if(this.playLabel=e&&e.textContent.trim()||this.getAttribute("playlabel")||"Play",this.style.backgroundImage||(this.style.backgroundImage=`url("https://i.ytimg.com/vi/${this.videoId}/hqdefault.jpg")`),e||((e=document.createElement("button")).type="button",e.classList.add("lty-playbtn"),this.append(e)),!e.textContent){let t=document.createElement("span");t.className="lyt-visually-hidden",t.textContent=this.playLabel,e.append(t)}e.removeAttribute("href"),this.addEventListener("pointerover",LiteYTEmbed.warmConnections,{once:!0}),this.addEventListener("click",this.addIframe),this.needsYTApiForAutoplay=navigator.vendor.includes("Apple")||navigator.userAgent.includes("Mobi")}static addPrefetch(e,t,i){let a=document.createElement("link");a.rel=e,a.href=t,i&&(a.as=i),document.head.append(a)}static warmConnections(){LiteYTEmbed.preconnected||(LiteYTEmbed.addPrefetch("preconnect","https://www.youtube-nocookie.com"),LiteYTEmbed.addPrefetch("preconnect","https://www.google.com"),LiteYTEmbed.addPrefetch("preconnect","https://googleads.g.doubleclick.net"),LiteYTEmbed.addPrefetch("preconnect","https://static.doubleclick.net"),LiteYTEmbed.preconnected=!0)}fetchYTPlayerApi(){window.YT||window.YT&&window.YT.Player||(this.ytApiPromise=new Promise((e,t)=>{var i=document.createElement("script");i.src="https://www.youtube.com/iframe_api",i.async=!0,i.onload=t=>{YT.ready(e)},i.onerror=t,this.append(i)}))}async addYTPlayerIframe(e){this.fetchYTPlayerApi(),await this.ytApiPromise;let t=document.createElement("div");this.append(t);let i=Object.fromEntries(e.entries());new YT.Player(t,{width:"100%",videoId:this.videoId,playerVars:i,events:{onReady(e){e.target.playVideo()}}})}async addIframe(){if(this.classList.contains("lyt-activated"))return;this.classList.add("lyt-activated");let e=new URLSearchParams(this.getAttribute("params")||[]);if(e.append("autoplay","1"),this.needsYTApiForAutoplay)return this.addYTPlayerIframe(e);let t=document.createElement("iframe");t.width=560,t.height=315,t.title=this.playLabel,t.allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",t.allowFullscreen=!0,t.src=`https://www.youtube-nocookie.com/embed/${encodeURIComponent(this.videoId)}?${e.toString()}`,this.append(t),t.focus()}}customElements.define("lite-youtube",LiteYTEmbed);;
