import{h}from"../bodymovin-web-components.core.js";import{LottieAnimationLoader,LottieConfigCreator}from"./index.js";var LottieAnimationComponent=function(){function t(){this.autoplay=!1,this.dataJson=!1,this.loop=!1,this.src=!1}return t.prototype.onDataJsonChange=function(t){this.updateDataJson(t)},t.prototype.onSrcChange=function(t){this.updateSrc(t)},t.prototype.componentDidLoad=function(){this.lottieAnimationLoader=new LottieAnimationLoader,this.lottieConfigCreator=new LottieConfigCreator,this.updateDataJson(this.dataJson),this.updateSrc(this.src)},t.prototype.play=function(){this.lottieAnimation.play()},t.prototype.updateSrc=function(t){var n=this;t&&(this.lottieAnimation=this.lottieAnimationLoader.load(this.lottieConfigCreator.createWithSrc(this.animationContainerElement,t,this.autoplay,this.loop),function(t){return n.emitOnAnimationLoadedEvent(t)}))},t.prototype.updateDataJson=function(t){var n=this;t&&(this.lottieAnimation=this.lottieAnimationLoader.load(this.lottieConfigCreator.createWithData(this.animationContainerElement,t,this.autoplay,this.loop),function(t){return n.emitOnAnimationLoadedEvent(t)}))},t.prototype.emitOnAnimationLoadedEvent=function(t){this.onAnimationLoaded.emit(t)},t.prototype.render=function(){var t=this;return h("div",{class:"lottie-animation"},h("div",{class:"lottie-animation__container",ref:function(n){return t.animationContainerElement=n}}))},Object.defineProperty(t,"is",{get:function(){return"lottie-animation"},enumerable:!0,configurable:!0}),Object.defineProperty(t,"encapsulation",{get:function(){return"shadow"},enumerable:!0,configurable:!0}),Object.defineProperty(t,"properties",{get:function(){return{autoplay:{type:"Any",attr:"autoplay"},dataJson:{type:"Any",attr:"data-json",watchCallbacks:["onDataJsonChange"]},loop:{type:"Any",attr:"loop"},play:{method:!0},src:{type:"Any",attr:"src",watchCallbacks:["onSrcChange"]}}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"events",{get:function(){return[{name:"onAnimationLoaded",method:"onAnimationLoaded",bubbles:!0,cancelable:!0,composed:!0}]},enumerable:!0,configurable:!0}),Object.defineProperty(t,"style",{get:function(){return".lottie-animation,.lottie-animation__container{width:100%;height:100%}.lottie-animation svg{display:block;width:100%}"},enumerable:!0,configurable:!0}),t}();export{LottieAnimationComponent as LottieAnimation};