import '../../tandem/js/PhetioIDUtils.js';
import '../../globals.js';
// Copyright 2021-2024, University of Colorado Boulder
/**
 * Mixin for THREE.Object3D types that handles instrumentation details.
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import ThreeObject3DPhetioObject from './ThreeObject3DPhetioObject.js';
import mobius from './mobius.js';
import memoize from '../../phet-core/js/memoize.js';
/**
 * @param type - Should be THREE.Object3D or a subtype
 */
const ThreeInstrumentable = memoize((type) => {
    return class ThreeInstrumentableMixin extends type {
        /**
         * Pass tandem as the first arg, the rest will be passed through
         */
        constructor(...args) {
            const options = args[args.length - 1];
            const threeArgs = args.slice(0, args.length - 1);
            super(...threeArgs);
            this.phetioObject = new ThreeObject3DPhetioObject(options);
        }
        /**
         * Releases references
         */
        dispose() {
            // @ts-expect-error
            super.dispose && super.dispose();
            this.phetioObject.dispose();
        }
    };
});
mobius.register('ThreeInstrumentable', ThreeInstrumentable);
export default ThreeInstrumentable;
//# sourceMappingURL=ThreeInstrumentable.js.map