import{b as m}from"./declarationMapper-CGPHX8aB.js";import{b as n}from"./KHR_interactivity-DRPs30Rf.js";import{R as u}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 p extends n{constructor(i){super(i),this.reset=this._registerSignalInput("reset"),this.duration=this.registerDataInput("duration",m),this.lastRemainingTime=this.registerDataOutput("lastRemainingTime",m,NaN)}_execute(i,o){if(o===this.reset){this.lastRemainingTime.setValue(NaN,i),i._setExecutionVariable(this,"lastRemainingTime",NaN),i._setExecutionVariable(this,"timestamp",0);return}const t=this.duration.getValue(i);if(t<=0||isNaN(t)||!isFinite(t))return this._reportError(i,"Invalid duration in Throttle block");const l=i._getExecutionVariable(this,"lastRemainingTime",NaN),e=Date.now();if(isNaN(l))return this.lastRemainingTime.setValue(0,i),i._setExecutionVariable(this,"lastRemainingTime",0),i._setExecutionVariable(this,"timestamp",e),this.out._activateSignal(i);{const a=e-i._getExecutionVariable(this,"timestamp",0),s=t*1e3;if(s<=a)return this.lastRemainingTime.setValue(0,i),i._setExecutionVariable(this,"lastRemainingTime",0),i._setExecutionVariable(this,"timestamp",e),this.out._activateSignal(i);{const r=s-a;this.lastRemainingTime.setValue(r/1e3,i),i._setExecutionVariable(this,"lastRemainingTime",r)}}}getClassName(){return"FlowGraphThrottleBlock"}}u("FlowGraphThrottleBlock",p);export{p as FlowGraphThrottleBlock};
