import{F as c}from"./KHR_interactivity-DRPs30Rf.js";import{g as d,d as g,b as h,R as l}from"./declarationMapper-CGPHX8aB.js";import{az as y,R as F}from"./index-6jOCfdig.js";import"./index-Ds2meNS5.js";import"./svelte/svelte_svelte.js";import"./svelte/svelte_animate.js";import"./svelte/svelte_attachments.js";import"./svelte/svelte_easing.js";import"./svelte/svelte_internal_client.js";import"./svelte/svelte_internal_flags_async.js";import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_internal_flags_tracing.js";import"./svelte/svelte_internal_server.js";import"./svelte/svelte_legacy.js";import"./svelte/svelte_motion.js";import"./svelte/svelte_reactivity.js";import"./svelte/svelte_reactivity_window.js";import"./svelte/svelte_server.js";import"./svelte/svelte_store.js";import"./svelte/svelte_transition.js";import"./svelte/svelte_events.js";import"./objectModelMapping-DT0r674A.js";class f extends c{constructor(t={}){super(t),this.keyFrames=[];const a=typeof t?.animationType=="string"?d(t.animationType):g(t?.animationType??0),e=t?.keyFramesCount??1,n=this.registerDataInput("duration_0",h,0),i=this.registerDataInput("value_0",a);this.keyFrames.push({duration:n,value:i});for(let r=1;r<e+1;r++){const u=this.registerDataInput(`duration_${r}`,h,r===e?t.duration:void 0),m=this.registerDataInput(`value_${r}`,a);this.keyFrames.push({duration:u,value:m})}this.initialValue=this.keyFrames[0].value,this.endValue=this.keyFrames[e].value,this.easingFunction=this.registerDataInput("easingFunction",l),this.animation=this.registerDataOutput("animation",l),this.propertyName=this.registerDataInput("propertyName",l,t?.propertyName),this.customBuildAnimation=this.registerDataInput("customBuildAnimation",l)}_updateOutputs(t){const a=t._getGlobalContextVariable("interpolationAnimations",[]),e=this.propertyName.getValue(t),n=this.easingFunction.getValue(t),i=this._createAnimation(t,e,n);if(this.animation.setValue(i,t),Array.isArray(i))for(const r of i)a.push(r.uniqueId);else a.push(i.uniqueId);t._setGlobalContextVariable("interpolationAnimations",a)}_createAnimation(t,a,e){const n=this.initialValue.richType,i=[],r=this.initialValue.getValue(t)||n.defaultValue;i.push({frame:0,value:r});const u=this.config?.numberOfKeyFrames??1;for(let s=1;s<u+1;s++){const p=this.keyFrames[s].duration?.getValue(t);let o=this.keyFrames[s].value?.getValue(t);s===u-1&&(o=o||n.defaultValue),p!==void 0&&o&&i.push({frame:p*60,value:o})}const m=this.customBuildAnimation.getValue(t);if(m)return m(null,null,t)(i,60,n.animationType,e);if(typeof a=="string"){const s=y.CreateAnimation(a,n.animationType,60,e);return s.setKeys(i),[s]}else return a.map(p=>{const o=y.CreateAnimation(p,n.animationType,60,e);return o.setKeys(i),o})}getClassName(){return"FlowGraphInterpolationBlock"}}F("FlowGraphInterpolationBlock",f);export{f as FlowGraphInterpolationBlock};
