{"version":3,"file":"Lottie.7O2C6-g0.mjs","names":["useRef","useCallback","lottie"],"sources":["https:/framerusercontent.com/modules/YbkSqZ7STzW5WsMb1yan/7oWoX9MqdnxameM59dqC/Lottie.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useCallback,useEffect}from\"react\";import{motion,addPropertyControls,ControlType,RenderTarget}from\"framer\";import{defaultEvents}from\"https://framer.com/m/framer/default-utils.js@^0.45.0\";import{useAutoMotionValue}from\"https://framer.com/m/framer/useAutoMotionValue.js@0.3.0\";import lottie from\"https://jspm.dev/lottie-web@5.7.8\";var SrcType;(function(SrcType){SrcType[\"File\"]=\"Upload\";SrcType[\"Url\"]=\"URL\";})(SrcType||(SrcType={}));var Poster;(function(Poster){Poster[\"Auto\"]=\"Auto\";Poster[\"Custom\"]=\"Custom\";})(Poster||(Poster={}));const placeholderUrl=\"https://raw.githubusercontent.com/framer/Lottie/master/Lottie.framerfx/assets/logo.json\";/**\n * LOTTIE\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 350\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */ export function Lottie(props){const{style,srcUrl,srcFile,srcType,poster,progress:progressRaw,playing,loop,posterProgress,pauseOnCanvas,isForwardsDirection,speed,onClick,onMouseEnter,onMouseLeave,onMouseDown,onMouseUp,onComplete}=props;const isOnCanvas=RenderTarget.current()===RenderTarget.canvas;const shouldPlay=(!pauseOnCanvas||!isOnCanvas)&&playing;const direction=isForwardsDirection?1:-1;const isCustomPoster=poster===Poster.Custom;const el=useRef();const didInitialMount=useRef(false);const animationInfo=useRef({data:null,animation:null,duration:null});const progress=useAutoMotionValue(progressRaw,{transform:v=>v*.01});const play=()=>{var ref,ref1;return(ref=animationInfo.current)===null||ref===void 0?void 0:(ref1=ref.animation)===null||ref1===void 0?void 0:ref1.play();};const pause=()=>{var ref,ref1;return(ref=animationInfo.current)===null||ref===void 0?void 0:(ref1=ref.animation)===null||ref1===void 0?void 0:ref1.pause();};const destroy=()=>{var ref,ref1;return(ref=animationInfo.current)===null||ref===void 0?void 0:(ref1=ref.animation)===null||ref1===void 0?void 0:ref1.destroy();};const scrubTo=useCallback((normalizedProgress,shouldPlayAfter)=>{if(!animationInfo.current.duration||!animationInfo.current.animation)return;// Lottie gets weird when scrubbing to the exact last frame\nconst frameNumberTarget=normalizedProgress===1?animationInfo.current.duration-1:normalizedProgress*animationInfo.current.duration;if(shouldPlayAfter)animationInfo.current.animation.goToAndPlay(frameNumberTarget,true);else animationInfo.current.animation.goToAndStop(frameNumberTarget,true);},[]);const fetchLottieData=useCallback(async url=>{if(!url)return null;const data=await fetch(url,{method:\"GET\",credentials:\"omit\",redirect:\"follow\"}).then(d=>d.json());return data;},[]);// Fetch lottie animation & start setup\nconst init=useCallback(async()=>{// Clear current animation\ndestroy();let dataUrl;if(srcType===SrcType.Url)dataUrl=srcUrl;if(srcType===SrcType.File)dataUrl=srcFile;if(!dataUrl){console.warn(\"No valid Lottie animation provided\");dataUrl=placeholderUrl;}const data=await fetchLottieData(dataUrl);animationInfo.current.data=data;return setup(didInitialMount.current);},[srcType,srcUrl,srcFile]);// Create Lottie animation\nconst setup=useCallback(shouldPlayAfter=>{if(!el.current)return;destroy();const options={container:el.current,renderer:\"svg\",loop:!isOnCanvas&&loop,autoplay:shouldPlay,animationData:animationInfo.current.data,rendererSettings:{preserveAspectRatio:\"xMidYMid slice\"}};const anim=animationInfo.current.animation=lottie.loadAnimation(options);animationInfo.current.duration=anim.getDuration(true);anim.setDirection(direction);anim.setSpeed(speed);didInitialMount.current=true;if(isOnCanvas&&isCustomPoster)scrubTo(posterProgress,false);else scrubTo(progress.get(),shouldPlay||shouldPlayAfter);return()=>{anim.destroy();};},[loop,shouldPlay,speed,direction,isOnCanvas,isCustomPoster,posterProgress,]);// Initial setup or re-init when source changes\nuseEffect(()=>{let cleanup;init().then(c=>cleanup=c);return()=>{if(cleanup)cleanup();};},[srcType,srcFile,srcUrl]);// No run-time option for loop option, recreating anim\nuseEffect(()=>{if(!didInitialMount.current)return;return setup(false);},[loop]);// Perf hack lets see if anyone notices\nuseEffect(()=>lottie.setQuality(isOnCanvas?\"low\":\"medium\"),[]);// useEffect(() => {\n//     if (!isOnCanvas) return\n//     const normalizedProgress = progress.get() * 0.01\n//     if (shouldPlay) scrubTo(normalizedProgress, true)\n//     else scrubTo(normalizedProgress, false)\n// }, [progressRaw, shouldPlay])\nuseEffect(()=>progress.onChange(val=>{if(isOnCanvas)return;if(shouldPlay)scrubTo(val,true);else scrubTo(val,false);}),[]);useEffect(()=>{const val=progress.get();if(shouldPlay)scrubTo(val,true);else scrubTo(val,false);},[progressRaw]);useEffect(()=>{if(!isOnCanvas)return;const normalizedPosterProgress=posterProgress*.01;if(isCustomPoster)scrubTo(normalizedPosterProgress,false);else scrubTo(progress.get(),false);},[isCustomPoster,posterProgress]);useEffect(()=>{var ref;if(!((ref=animationInfo.current)===null||ref===void 0?void 0:ref.animation))return;animationInfo.current.animation.setSpeed(speed);scrubTo(progress.get(),true);},[speed]);useEffect(()=>{var ref;if(!((ref=animationInfo.current)===null||ref===void 0?void 0:ref.animation))return;animationInfo.current.animation.setDirection(direction);scrubTo(progress.get(),true);},[direction]);useEffect(()=>{if(shouldPlay)play();else pause();},[shouldPlay]);return /*#__PURE__*/ _jsx(motion.div,{ref:el,style:style,onClick,onMouseEnter,onMouseLeave,onMouseDown,onMouseUp});}Lottie.defaultProps={height:200,width:200,srcType:SrcType.Url,pauseOnCanvas:true,srcUrl:placeholderUrl,progress:0,poster:Poster.Auto,posterProgress:0};addPropertyControls(Lottie,{srcType:{type:ControlType.Enum,displaySegmentedControl:true,title:\"Source\",options:[SrcType.Url,SrcType.File]},srcUrl:{type:ControlType.String,title:\" \",placeholder:\"../example.json\",hidden:props=>props.srcType===SrcType.File},srcFile:{type:ControlType.File,title:\" \",allowedFileTypes:[\"json\"],hidden:props=>props.srcType===SrcType.Url},playing:{type:ControlType.Boolean,title:\"Playing\",enabledTitle:\"Yes\",disabledTitle:\"No\"},// Temporarily disabling for perf\n// pauseOnCanvas: {\n//     type: ControlType.Boolean,\n//     title: \"Canvas\",\n//     disabledTitle: \"Play\",\n//     enabledTitle: \"Pause\",\n//     hidden: (props) => props.playing === false,\n// },\nloop:{type:ControlType.Boolean,title:\"Loop\",enabledTitle:\"Yes\",disabledTitle:\"No\"},isForwardsDirection:{title:\"Direction\",type:ControlType.Boolean,enabledTitle:\"Normal\",disabledTitle:\"Reverse\"},speed:{type:ControlType.Number,defaultValue:1,min:0,max:10,step:.5,displayStepper:true,unit:\"x\"},poster:{title:\"Poster\",type:ControlType.Enum,options:[Poster.Auto,Poster.Custom],displaySegmentedControl:true},posterProgress:{title:\" \",type:ControlType.Number,max:100,min:0,unit:\"%\",hidden:({poster})=>poster===Poster.Auto},progress:{title:\"Progress\",type:ControlType.Number,max:100,min:0,unit:\"%\",description:\"This component is made for JSON files. [Learn more here](https://lottiefiles.com/what-is-lottie).\"},...defaultEvents});\nexport const __FramerMetadata__ = {\"exports\":{\"Lottie\":{\"type\":\"reactComponent\",\"name\":\"Lottie\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"350\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Lottie.map"],"mappings":"+hBAQI,SAAgB,EAAO,EAAM,CAAC,GAAK,CAAC,QAAM,SAAO,UAAQ,UAAQ,SAAO,SAAS,EAAY,UAAQ,OAAK,iBAAe,gBAAc,sBAAoB,QAAM,UAAQ,eAAa,eAAa,cAAY,YAAU,cAAY,EAAY,EAAW,EAAa,SAAS,GAAG,EAAa,OAAa,GAAY,CAAC,GAAe,CAAC,IAAa,EAAc,EAAU,EAAoB,EAAE,GAAS,EAAe,IAAS,EAAO,OAAa,EAAGA,GAAQ,C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