import { Obj } from '@ephox/katamari';
import * as Tagger from '../../registry/Tagger';
import { isSketchSpec } from '../ui/Sketcher';
const record = (spec) => {
    const uid = isSketchSpec(spec) && Obj.hasNonNullableKey(spec, 'uid') ? spec.uid : Tagger.generate('memento');
    const get = (anyInSystem) => anyInSystem.getSystem().getByUid(uid).getOrDie();
    const getOpt = (anyInSystem) => anyInSystem.getSystem().getByUid(uid).toOptional();
    const asSpec = () => ({
        ...spec,
        uid
    });
    return {
        get,
        getOpt,
        asSpec
    };
};
export { record };
//# sourceMappingURL=Memento.js.map