landing-klikaset/wp-content/plugins/elementor-pro/assets/js/lottie.565b778d23c04461c4ea...

2 lines
14 KiB
JavaScript
Raw Permalink Normal View History

2024-05-06 11:04:37 +07:00
/*! elementor-pro - v3.21.0 - 15-04-2024 */
"use strict";(self.webpackChunkelementor_pro=self.webpackChunkelementor_pro||[]).push([[288],{1464:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;class lottieHandler extends elementorModules.frontend.handlers.Base{getDefaultSettings(){return{selectors:{container:".e-lottie__container",containerLink:".e-lottie__container__link",animation:".e-lottie__animation",caption:".e-lottie__caption"},classes:{caption:"e-lottie__caption"}}}getDefaultElements(){const{selectors:t}=this.getSettings();return{$widgetWrapper:this.$element,$container:this.$element.find(t.container),$containerLink:this.$element.find(t.containerLink),$animation:this.$element.find(t.animation),$caption:this.$element.find(t.caption),$sectionParent:this.$element.closest(".elementor-section"),$columnParent:this.$element.closest(".elementor-column"),$containerParent:this.$element.closest(".e-con")}}onInit(){super.onInit(...arguments),this.lottie=null,this.state={isAnimationScrollUpdateNeededOnFirstLoad:!0,isNewLoopCycle:!1,isInViewport:!1,loop:!1,animationDirection:"forward",currentAnimationTrigger:"",effectsRelativeTo:"",hoverOutMode:"",hoverArea:"",caption:"",playAnimationCount:0,animationSpeed:0,linkTimeout:0,viewportOffset:{start:0,end:100}},this.intersectionObservers={animation:{observer:null,element:null},lazyload:{observer:null,element:null}},this.animationFrameRequest={timer:null,lastScrollY:0},this.listeners={collection:[],elements:{$widgetArea:{triggerAnimationHoverIn:null,triggerAnimationHoverOut:null},$container:{triggerAnimationClick:null}}},this.initLottie()}initLottie(){this.getLottieSettings().lazyload?this.lazyloadLottie():this.generateLottie()}lazyloadLottie(){this.intersectionObservers.lazyload.observer=elementorModules.utils.Scroll.scrollObserver({offset:"0px 0px 200px",callback:t=>{t.isInViewport&&(this.generateLottie(),this.intersectionObservers.lazyload.observer.unobserve(this.intersectionObservers.lazyload.element))}}),this.intersectionObservers.lazyload.element=this.elements.$container[0],this.intersectionObservers.lazyload.observer.observe(this.intersectionObservers.lazyload.element)}generateLottie(){this.createLottieInstance(),this.setLottieEvents()}createLottieInstance(){const t=this.getLottieSettings();this.lottie=bodymovin.loadAnimation({container:this.elements.$animation[0],path:this.getAnimationPath(),renderer:t.renderer,autoplay:!1,name:"lottie-widget"}),this.elements.$animation.data("lottie",this.lottie)}getAnimationPath(){const t=this.getLottieSettings();return t.source_json?.url&&"json"===t.source_json.url.toLowerCase().substr(-4)?t.source_json.url:t.source_external_url?.url?t.source_external_url.url:elementorProFrontend.config.lottie.defaultAnimationUrl}setCaption(){const t=this.getLottieSettings();if("external_url"===t.source||"media_file"===t.source&&"custom"===t.caption_source){this.getCaptionElement().text(t.caption)}}getCaptionElement(){if(!this.elements.$caption.length){const{classes:t}=this.getSettings();return this.elements.$caption=jQuery("<p>",{class:t.caption}),this.elements.$container.append(this.elements.$caption),this.elements.$caption}return this.elements.$caption}setLottieEvents(){this.lottie.addEventListener("DOMLoaded",(()=>this.onLottieDomLoaded())),this.lottie.addEventListener("complete",(()=>this.onComplete()))}saveInitialValues(){const t=this.getLottieSettings();this.lottie.__initialTotalFrames=this.lottie.totalFrames,this.lottie.__initialFirstFrame=this.lottie.firstFrame,this.state.currentAnimationTrigger=t.trigger,this.state.effectsRelativeTo=t.effects_relative_to,this.state.viewportOffset.start=t.viewport?t.viewport.sizes.start:0,this.state.viewportOffset.end=t.viewport?t.viewport.sizes.end:100,this.state.animationSpeed=t.play_speed?.size,this.state.linkTimeout=t.link_timeout,this.state.caption=t.caption,this.state.loop=t.loop}setAnimationFirstFrame(){const t=this.getAnimationFrames();t.first=t.first-this.lottie.__initialFirstFrame,this.lottie.goToAndStop(t.first,!0)}initAnimationTrigger(){switch(this.getLottieSettings().trigger){case"none":this.playLottie();break;case"arrivi