import{r as e,h as t,e as o}from"./p-ee1e0eb4.js";const i=class{constructor(t){e(this,t),this.video_thumbnail=""}componentDidLoad(){this.classMode=this.initialClassMode,this.classModeChanged()}classModeChanged(){if(this.classMode){var e=this.src.match(/youtube\.com.*(\?v=|\/embed\/)(.{11})/).pop();11==e.length&&(this.video_thumbnail="//img.youtube.com/vi/"+e+"/0.jpg")}}async classRoomModeChanged(e){this.classMode=e}render(){return t("div",null,this.classMode?t("div",null,t("img",{src:this.video_thumbnail})):t("div",{class:"embed-container"},t("iframe",{src:this.src.replace("watch?v=","embed/"),frameborder:"0",allowFullScreen:!0})))}get el(){return o(this)}static get watchers(){return{classMode:["classModeChanged"]}}};i.style=":host(.loaded) div.youtube-container{opacity:var(--sparkle-youtube-opacity-loaded, 1)}div.youtube-container{opacity:var(--sparkle-youtube-opacity-not-loaded, 0);transition:var(--sparkle-youtube-transition, opacity 0.15s linear)}.embed-container{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;max-width:100%}.embed-container iframe,.embed-container object,.embed-container embed{position:absolute;top:0;left:0;width:100%;height:100%}";export{i as sparkle_youtube}