{"version":3,"file":"/js/blocks/sub-features-carousel/script.js","mappings":"6IAEAA,SACEC,iBACA,oBACA,WAECD,SACEE,iBAAiB,wDACjBC,SACA,SAACC,GAEY,IAAIC,EAAAA,EACfD,EACA,CACCE,KAAM,WACNC,IAAK,GACLC,QAAQ,EACRC,SAAU,EACVC,QAAS,EACTC,OAAO,EACPC,KAAM,CACLC,OAAQ,EACRC,MAAO,IAERC,YAAa,CACZ,IAAK,CACJL,QAAS,EACTE,KAAM,CACLC,OAAQ,EACRC,MAAO,IAGT,IAAK,CACJJ,QAAS,EACTE,KAAM,CACLC,OAAQ,EACRC,MAAO,MAGT,KAAM,CACLJ,QAAS,EACTE,KAAM,CACLC,OAAQ,EACRC,MAAO,MAGT,KAAM,CACLJ,QAAS,EACTE,KAAM,CACLC,OAAQ,EACRC,MAAO,SAKVE,QAEIC,QAEP,GAGH,IAGFjB,SACKC,iBACG,eACA,WACIiB,OAAOC,KACH,cACA,SAACC,GAAS,MACN,CACIC,WAAW,EACXD,UAAWA,EACXE,cAAe,KACfC,iBAAkB,KAClBC,MAAO,KAEPC,KAAI,WAAG,IAAAC,EAAA,KACHC,KAAKC,OACD,aACA,SAACP,GACGQ,QAAQC,IAAI,YAAaT,GACzBA,EAAYK,EAAKK,YAAcL,EAAKM,WACxC,GAER,EACAD,UAAS,WAAG,IAAAE,EAAA,KACe,UAAnBN,KAAKP,WACLc,YACI,WACID,EAAKT,MAAMW,cAAcC,YACrBC,KAAKC,UAAU,CAACC,MAAO,UAAWC,KAAM,cACxC,IAER,GACA,KAGe,SAAnBb,KAAKP,WACLO,KAAKH,MAAMiB,MAEnB,EACAT,UAAS,WACkB,UAAnBL,KAAKP,WACLO,KAAKH,MAAMW,cAAcC,YACrBC,KAAKC,UAAU,CAACC,MAAO,UAAWC,KAAM,cACxC,KAGe,SAAnBb,KAAKP,WACLO,KAAKH,MAAMkB,OAEnB,EACAC,YAAW,SAACnB,EAAOlB,GAAM,IAAAsC,EAAA,KACrBf,QAAQC,IAAIN,GACZK,QAAQC,IAAIH,KAAKkB,OAEjBlB,KAAKmB,WAAU,WACPF,EAAKC,MAAMrB,GACXoB,EAAKpB,MAAQoB,EAAKC,MAAMrB,GAAOuB,kBAE/BlB,QAAQmB,KAAK,QAADC,OAASzB,EAAK,gBAElC,IAEAG,KAAKP,UAAYd,EACjBqB,KAAKL,cAAgBE,EACrBG,KAAKN,WAAY,CACrB,EACH,GAGb,G","sources":["webpack://wp-plugin-cirrus-blocks/./blocks/sub-features-carousel/script.js"],"sourcesContent":["import Glide from \"@glidejs/glide\";\n\ndocument\n\t.addEventListener(\n\t\t'DOMContentLoaded',\n\t\t() => {\n\n\t\t\tdocument\n\t\t\t\t.querySelectorAll('.cirrus-sub-features-carousel [data-name=\"carousel\"]')\n\t\t\t\t.forEach(\n\t\t\t\t\t(el) => {\n\n\t\t\t\t\t\tlet glide = new Glide(\n\t\t\t\t\t\t\tel,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'carousel',\n\t\t\t\t\t\t\t\tgap: 40,\n\t\t\t\t\t\t\t\trewind: false,\n\t\t\t\t\t\t\t\tperTouch: 1,\n\t\t\t\t\t\t\t\tperView: 2,\n\t\t\t\t\t\t\t\tbound: true,\n\t\t\t\t\t\t\t\tpeek: {\n\t\t\t\t\t\t\t\t\tbefore: 0,\n\t\t\t\t\t\t\t\t\tafter: 50,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tbreakpoints: {\n\t\t\t\t\t\t\t\t\t639: {\n\t\t\t\t\t\t\t\t\t\tperView: 1,\n\t\t\t\t\t\t\t\t\t\tpeek: {\n\t\t\t\t\t\t\t\t\t\t\tbefore: 0,\n\t\t\t\t\t\t\t\t\t\t\tafter: 0,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t767: {\n\t\t\t\t\t\t\t\t\t\tperView: 1,\n\t\t\t\t\t\t\t\t\t\tpeek: {\n\t\t\t\t\t\t\t\t\t\t\tbefore: 0,\n\t\t\t\t\t\t\t\t\t\t\tafter: 100,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t1023: {\n\t\t\t\t\t\t\t\t\t\tperView: 1,\n\t\t\t\t\t\t\t\t\t\tpeek: {\n\t\t\t\t\t\t\t\t\t\t\tbefore: 0,\n\t\t\t\t\t\t\t\t\t\t\tafter: 200,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t1439: {\n\t\t\t\t\t\t\t\t\t\tperView: 1,\n\t\t\t\t\t\t\t\t\t\tpeek: {\n\t\t\t\t\t\t\t\t\t\t\tbefore: 0,\n\t\t\t\t\t\t\t\t\t\t\tafter: 100,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t).mount();\n\n\t\t\t\t\t\tglide.update();\n\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t}\n\t);\n \ndocument\n    .addEventListener(\n        'alpine:init',\n        () => {\n            Alpine.data(\n                'videoModal',\n                (videoType) => (\n                    {\n                        showVideo: false,\n                        videoType: videoType,\n                        selectedVideo: null,\n                        selectedVideoRef: null,\n                        video: null, \n\n                        init() {\n                            this.$watch(\n                                'showVideo',\n                                (showVideo) => {\n                                    console.log('showVideo', showVideo);\n                                    showVideo ? this.playVideo() : this.stopVideo();\n                                }\n                            );\n                        },\n                        playVideo() {\n                            if (this.videoType === 'embed') {\n                                setTimeout(\n                                    () => {\n                                        this.video.contentWindow.postMessage(\n                                            JSON.stringify({event: 'command', func: 'playVideo'}),\n                                            '*'\n                                        );\n                                    },\n                                    500\n                                );\n                            }\n                            if (this.videoType === 'file') {\n                                this.video.load();\n                            }\n                        },\n                        stopVideo() {\n                            if (this.videoType === 'embed') {\n                                this.video.contentWindow.postMessage(\n                                    JSON.stringify({event: 'command', func: 'stopVideo'}),\n                                    '*'\n                                );\n                            }\n                            if (this.videoType === 'file') {\n                                this.video.pause();\n                            }\n                        },\n                        selectVideo(video, type) {\n                            console.log(video);\n                            console.log(this.$refs)\n                            \n                            this.$nextTick(() => {\n                                if (this.$refs[video]) {\n                                    this.video = this.$refs[video].firstElementChild;\n                                } else {\n                                    console.warn(`Ref \"${video}\" not found.`);\n                                }\n                            });\n\n                            this.videoType = type;\n                            this.selectedVideo = video;\n                            this.showVideo = true; \n                        }\n                    }\n                )\n            );\n        }\n    );\n"],"names":["document","addEventListener","querySelectorAll","forEach","el","Glide","type","gap","rewind","perTouch","perView","bound","peek","before","after","breakpoints","mount","update","Alpine","data","videoType","showVideo","selectedVideo","selectedVideoRef","video","init","_this","this","$watch","console","log","playVideo","stopVideo","_this2","setTimeout","contentWindow","postMessage","JSON","stringify","event","func","load","pause","selectVideo","_this3","$refs","$nextTick","firstElementChild","warn","concat"],"sourceRoot":""}