import{R as m}from"./index-6jOCfdig.js";import{b}from"./KHR_interactivity-DRPs30Rf.js";import{R as n}from"./declarationMapper-CGPHX8aB.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 u extends b{constructor(i){if(super(i),!i.variable&&!i.variables)throw new Error("FlowGraphSetVariableBlock: variable/variables is not defined");if(i.variables&&i.variable)throw new Error("FlowGraphSetVariableBlock: variable and variables are both defined");if(i.variables)for(const a of i.variables)this.registerDataInput(a,n);else this.registerDataInput("value",n)}_execute(i,a){if(this.config?.variables)for(const e of this.config.variables)this._saveVariable(i,e);else this._saveVariable(i,this.config?.variable,"value");this.out._activateSignal(i)}_saveVariable(i,a,e){const r=i._getGlobalContextVariable("currentlyRunningAnimationGroups",[]);for(const l of r){const o=i.assetsContext.animationGroups.find(t=>t.uniqueId==l);if(o){for(const t of o.targetedAnimations)if(t.target===i&&t.animation.targetProperty===a){o.stop();const s=r.indexOf(l);s>-1&&r.splice(s,1),i._setGlobalContextVariable("currentlyRunningAnimationGroups",r);break}}}const p=this.getDataInput(e||a)?.getValue(i);i.setVariable(a,p)}getClassName(){return"FlowGraphSetVariableBlock"}serialize(i){super.serialize(i),i.config.variable=this.config?.variable}}m("FlowGraphSetVariableBlock",u);export{u as FlowGraphSetVariableBlock};
