{"version":3,"sources":["webpack:///./LeLab.Web/src/js/video.entry.js"],"names":["PageComponent","constructor","node","this","video","queryString","clicked","clickHandler","click","bind","poster","querySelector","autoplay","dataset","videoAutoplay","loop","videoLoop","initializeVideo","addEventListener","e","target","closest","preventDefault","videoId","classList","add","iframe","document","createElement","videoType","paramsQuery","src","width","frameBorder","allow","allowfullscreen","appendChild","destroy","removeEventListener"],"mappings":"4FAAA,kBA+EA,IAAIA,IAAc,eA7ElB,MACIC,aAAY,KAAEC,IACVC,KAAKC,MAAQF,EACbC,KAAKE,YAAc,GACnBF,KAAKG,SAAU,EACfH,KAAKI,aAAeJ,KAAKK,MAAMC,KAAKN,MAEpCA,KAAKO,OAASP,KAAKC,MAAMO,cAAc,uBAEvCR,KAAKS,SAAgD,SAArCT,KAAKC,MAAMS,QAAQC,cACnCX,KAAKY,KAAwC,SAAjCZ,KAAKC,MAAMS,QAAQG,UAE3Bb,KAAKS,SACLT,KAAKc,kBAELd,KAAKC,MAAMc,iBAAiB,QAASf,KAAKI,cAIlDC,MAAMW,GAGF,GAFYA,EAAEC,OAAOC,QAAQ,uBAU7B,OAJAlB,KAAKc,kBAELd,KAAKG,SAAU,EACfa,EAAEG,kBACK,EAGXL,kBACI,IAAIM,EAAUpB,KAAKC,MAAMS,QAAQU,QAEjC,IAAKA,EACD,OAGJ,IAAIb,EAASP,KAAKC,MAAMO,cAAc,uBAElCD,GACAA,EAAOc,UAAUC,IAAI,UAGzB,IAAIC,EAASC,SAASC,cAAc,UAChCC,EAAY1B,KAAKC,MAAMS,QAAQgB,UAC/BC,EAAc,eAAH,OAAkB3B,KAAKY,KAAO,SAAW,IAEtC,YAAdc,EACAH,EAAOK,IAAP,wCAA8CR,GAA9C,OAAwDO,GAAxD,OAAsE3B,KAAKS,SAAW,qBAAuB,IACxF,UAAdiB,IACPH,EAAOK,IAAP,yCAA+CR,GAA/C,OAAyDO,GAAzD,OACI3B,KAAKS,SAAW,4BAA8B,KAItDc,EAAOM,MAAQ,IACfN,EAAOM,MAAQ,IACfN,EAAOO,YAAc,EACrBP,EAAOQ,MAAQ,0EACfR,EAAOS,gBAAkB,GAEzBhC,KAAKC,MAAMgC,YAAYV,GAG3BW,UACIlC,KAAKC,MAAMkC,oBAAoB,QAASnC,KAAKI,qBACtCJ,KAAKC,aACLD,KAAKG,eACLH,KAAKI,oBACLJ,KAAKS,gBACLT,KAAKY,U","file":"video.js","sourcesContent":["import { PageComponent } from \"barba\";\r\n\r\nclass Video {\r\n constructor({ node }) {\r\n this.video = node;\r\n this.queryString = \"\";\r\n this.clicked = false;\r\n this.clickHandler = this.click.bind(this);\r\n\r\n this.poster = this.video.querySelector(\"[data-video-poster]\");\r\n\r\n this.autoplay = this.video.dataset.videoAutoplay === \"True\";\r\n this.loop = this.video.dataset.videoLoop === \"True\";\r\n\r\n if (this.autoplay) {\r\n this.initializeVideo();\r\n } else {\r\n this.video.addEventListener(\"click\", this.clickHandler);\r\n }\r\n }\r\n\r\n click(e) {\r\n const btn = e.target.closest(\"[data-video-button]\");\r\n\r\n if (!btn) {\r\n return;\r\n }\r\n\r\n this.initializeVideo();\r\n\r\n this.clicked = true;\r\n e.preventDefault();\r\n return false;\r\n }\r\n\r\n initializeVideo() {\r\n let videoId = this.video.dataset.videoId;\r\n\r\n if (!videoId) {\r\n return;\r\n }\r\n\r\n let poster = this.video.querySelector(\"[data-video-poster]\");\r\n\r\n if (poster) {\r\n poster.classList.add(\"hidden\");\r\n }\r\n\r\n let iframe = document.createElement(\"iframe\");\r\n let videoType = this.video.dataset.videoType;\r\n let paramsQuery = `?autoplay=1&${this.loop ? \"loop=1\" : \"\"}`;\r\n\r\n if (videoType === \"Youtube\") {\r\n iframe.src = `https://www.youtube.com/embed/${videoId}${paramsQuery}${this.autoplay ? \"&controls=0&mute=1\" : \"\"}`;\r\n } else if (videoType === \"Vimeo\") {\r\n iframe.src = `https://player.vimeo.com/video/${videoId}${paramsQuery}${\r\n this.autoplay ? \"&background=1&autopause=0\" : \"\"\r\n }`;\r\n }\r\n\r\n iframe.width = 560;\r\n iframe.width = 315;\r\n iframe.frameBorder = 0;\r\n iframe.allow = \"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\";\r\n iframe.allowfullscreen = \"\";\r\n\r\n this.video.appendChild(iframe);\r\n }\r\n\r\n destroy() {\r\n this.video.removeEventListener(\"click\", this.clickHandler);\r\n delete this.video;\r\n delete this.clicked;\r\n delete this.clickHandler;\r\n delete this.autoplay;\r\n delete this.loop;\r\n }\r\n}\r\n\r\nnew PageComponent(\"[data-video]\", Video);\r\n"],"sourceRoot":""}