import { bd as BezierCurveEase, R as RegisterClass } from './index-BvJBnIUK.esm.js';
import { F as FlowGraphBlock } from './KHR_interactivity-BGk_Crki.esm.js';
import { d as RichTypeNumber, q as RichTypeVector2, R as RichTypeAny } from './declarationMapper-CyxdrUFP.esm.js';
import './objectModelMapping-BtiDAwYm.esm.js';

/** This file must only contain pure code and pure imports */
/**
 * An easing block that generates a BezierCurveEase easingFunction object based on the data provided.
 */
class FlowGraphBezierCurveEasingBlock extends FlowGraphBlock {
    constructor(
    /**
     * the configuration of the block
     */
    config) {
        super(config);
        this.config = config;
        /**
         * Internal cache of reusable easing functions.
         * key is type-mode-properties
         */
        this._easingFunctions = {};
        this.mode = this.registerDataInput("mode", RichTypeNumber, 0);
        this.controlPoint1 = this.registerDataInput("controlPoint1", RichTypeVector2);
        this.controlPoint2 = this.registerDataInput("controlPoint2", RichTypeVector2);
        this.easingFunction = this.registerDataOutput("easingFunction", RichTypeAny);
    }
    _updateOutputs(context) {
        const mode = this.mode.getValue(context);
        const controlPoint1 = this.controlPoint1.getValue(context);
        const controlPoint2 = this.controlPoint2.getValue(context);
        if (mode === undefined) {
            return;
        }
        const key = `${mode}-${controlPoint1.x}-${controlPoint1.y}-${controlPoint2.x}-${controlPoint2.y}`;
        if (!this._easingFunctions[key]) {
            const easing = new BezierCurveEase(controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y);
            easing.setEasingMode(mode);
            this._easingFunctions[key] = easing;
        }
        this.easingFunction.setValue(this._easingFunctions[key], context);
    }
    getClassName() {
        return "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */;
    }
}
let _Registered = false;
/**
 * Register side effects for flowGraphBezierCurveEasingBlock.
 * Safe to call multiple times; only the first call has an effect.
 */
function RegisterFlowGraphBezierCurveEasingBlock() {
    if (_Registered) {
        return;
    }
    _Registered = true;
    RegisterClass("FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */, FlowGraphBezierCurveEasingBlock);
}

/**
 * Re-exports pure implementation and applies runtime side effects.
 * Import flowGraphBezierCurveEasingBlock.pure for tree-shakeable, side-effect-free usage.
 */
RegisterFlowGraphBezierCurveEasingBlock();

export { FlowGraphBezierCurveEasingBlock, RegisterFlowGraphBezierCurveEasingBlock };
//# sourceMappingURL=flowGraphBezierCurveEasingBlock-CLrTQbHQ.esm.js.map
