{"version":3,"file":"chunks/672e7be38efe2b.js","mappings":";8TACA,itNA+CA,QAhDMA,WACJ,WAAaC,EAAeC,GAAQ,iHAClCC,KAAKD,OAASA,EACdC,KAAKC,MAAQH,EAAcI,cAAc,SAEzCF,KAAKG,QAAU,CACbC,KAAM,KACNC,UAAW,CAAC,EAAG,GAAK,IAGtBL,KAAKM,SAAW,IAAIC,qBAAJ,gCAAyB,k6BAAQN,EAAR,MAE7BO,gBAAkBP,EAAMQ,mBAAqB,IAFhB,0CAI7BR,EAAMS,OAAOC,OAJgB,8DAQnCV,EAAMS,OAAOE,OAAQ,EARc,UAS7BX,EAAMS,OAAOC,OATgB,QAWjC,EAAKZ,OAAOc,UACd,EAAKP,SAASQ,aAZqB,wBAcA,IAA5Bb,EAAMQ,mBACfR,EAAMS,OAAOK,QAfwB,8OAAzB,sDAiBbf,KAAKG,SAERH,KAAKgB,MACN,0CAED,WACOhB,KAAKD,OAAOkB,WACfjB,KAAKM,SAASY,QAAQlB,KAAKC,OAC3BD,KAAKmB,aAER,2BAED,WAAc,WACZnB,KAAKC,MAAMmB,QAAU,WACd,EAAKrB,OAAOsB,MACf,EAAKf,SAASQ,YAEjB,CACF,4EA7CGjB","sources":["webpack:///./resources/js/components/generic/videoHtml.ts"],"sourcesContent":["class VideoHtml {\n constructor (componentRoot, params) {\n this.params = params;\n this.video = componentRoot.querySelector('video');\n\n this.options = {\n root: null,\n threshold: [0, 0.5, 1]\n };\n\n this.observer = new IntersectionObserver(async ([video]) => {\n // setting video player to async await as shown in mdn example. \n if (video.isIntersecting && video.intersectionRatio >= 0.5) {\n try {\n await video.target.play();\n } catch(err) {\n // if play run into issue that typically means autoplay is disabled\n // in that case we'll set video player to mute then play the video once more\n video.target.muted = true;\n await video.target.play();\n }\n if (this.params.controls) {\n this.observer.disconnect();\n }\n } else if (video.intersectionRatio === 0) {\n video.target.pause();\n }\n }, this.options);\n\n this.init();\n }\n\n init () {\n if (!this.params.autoplay) {\n this.observer.observe(this.video);\n this.bindEvents();\n }\n }\n\n bindEvents () {\n this.video.onended = () => {\n if (!this.params.loop) {\n this.observer.disconnect();\n }\n }\n }\n}\n\nexport default VideoHtml;"],"names":["VideoHtml","componentRoot","params","this","video","querySelector","options","root","threshold","observer","IntersectionObserver","isIntersecting","intersectionRatio","target","play","muted","controls","disconnect","pause","init","autoplay","observe","bindEvents","onended","loop"],"sourceRoot":""}