{"version":3,"file":"videoindexerplayer-b5d52b51.js","names":["define","Moduler","create","defaults","contentElement","triggerElement","pauseTriggerElement","triggerEvent","hideTriggersOnEvent","init","self","this","options","targetFrame","el","querySelector","triggers","querySelectorAll","forEach","trigger","addEventListener","e","t","remove","_notifyPlayer","play","pause","data","target","payload","origin","window","contentWindow","postMessage","error"],"sources":["videoindexerplayer.js"],"mappings":"AAAAA,OAAO,CAAC,YAAY,SAAUC,GAC1B,aAIA,OAAOA,EAAQC,OAAO,CAClBC,SAAU,CACNC,eAAgB,SAChBC,eAAgB,MAChBC,oBAAqB,KACrBC,aAAc,QACdC,qBAAqB,GAGzBC,KAAM,WACF,IAAIC,EAAOC,KAEXD,EAAKE,QAAQC,YAAcH,EAAKI,GAAGC,cAAcL,EAAKE,QAAQR,iBAAmBM,EAAKI,GAAGC,cAAc,UAEvG,IAAIC,EAAWN,EAAKI,GAAGG,iBAAiBP,EAAKE,QAAQP,iBAAmBK,EAAKI,GAAGC,cAAc,OAW9F,GATAC,EAASE,SAAQC,IACbA,EAAQC,iBAAiBV,EAAKE,QAAQL,cAAc,SAAUc,GACtDX,EAAKE,QAAQJ,qBACbQ,EAASE,SAAQI,GAAKA,EAAEC,WAE5Bb,EAAKc,cAAc,CAAEC,MAAM,GAAQf,EAAKE,QAAQC,YACpD,GAAE,IAGFH,EAAKE,QAAQN,oBAAqB,CACdI,EAAKI,GAAGG,iBAAiBP,EAAKE,QAAQN,qBAC5CY,SAAQC,IAClBA,EAAQC,iBAAiBV,EAAKE,QAAQL,cAAc,SAAUc,GAC1DX,EAAKc,cAAc,CAAEE,OAAO,GAAOhB,EAAKE,QAAQC,YACpD,GAAE,GAEV,CACJ,EAEAW,cAAe,SAAUG,EAAMC,GAC3B,IAAIC,EAAU,IACPF,EACHG,OAAQ,+BAGZ,GAAI,gBAAiBC,OACjB,IACQH,EAAOI,eACPJ,EAAOI,cAAcC,YAAYJ,EAASA,EAAQC,OAE1D,CAAE,MAAOI,GACL,MAAMA,CACV,CAER,GAER","sourcesContent":["define(['moduler'], function (Moduler) {\r\n 'use strict';\r\n /*\r\n * Add support for custom play button to videoindexer videos\r\n */\r\n return Moduler.create({\r\n defaults: {\r\n contentElement: 'iframe',\r\n triggerElement: 'img',\r\n pauseTriggerElement: null,\r\n triggerEvent: 'click',\r\n hideTriggersOnEvent: true\r\n },\r\n\r\n init: function () {\r\n var self = this;\r\n\r\n self.options.targetFrame = self.el.querySelector(self.options.contentElement) ?? self.el.querySelector('iframe');\r\n \r\n let triggers = self.el.querySelectorAll(self.options.triggerElement) ?? self.el.querySelector('img');\r\n\r\n triggers.forEach(trigger => {\r\n trigger.addEventListener(self.options.triggerEvent, function (e) {\r\n if (self.options.hideTriggersOnEvent) {\r\n triggers.forEach(t => t.remove());\r\n }\r\n self._notifyPlayer({ play: true }, self.options.targetFrame);\r\n });\r\n });\r\n\r\n if (self.options.pauseTriggerElement) {\r\n let pauseTriggers = self.el.querySelectorAll(self.options.pauseTriggerElement);\r\n pauseTriggers.forEach(trigger => {\r\n trigger.addEventListener(self.options.triggerEvent, function (e) {\r\n self._notifyPlayer({ pause: true}, self.options.targetFrame);\r\n });\r\n });\r\n }\r\n },\r\n\r\n _notifyPlayer: function (data, target) {\r\n let payload = {\r\n ...data,\r\n origin: \"https://www.videoindexer.ai\"\r\n };\r\n\r\n if ('postMessage' in window) {\r\n try {\r\n if (target.contentWindow) {\r\n target.contentWindow.postMessage(payload, payload.origin);\r\n }\r\n } catch (error) {\r\n throw error;\r\n }\r\n }\r\n }\r\n });\r\n});"]}