import { clone } from '@hiberworld/code-kit-utils';
/**
 * Get a clone of an object
 * @deprecated use codekit-utils clone()
 * @example
 * ```
  const cube = getPrefab({ p: [0, 0, 5], material: 't_rusted_metal_01' });
  addTo(root, cube);
  const cube2 = getClone(cube, { p: [-3, 0, 5] });
  addTo(root, cube2);
 * ```
 */
export const getClone = (target, opt) => {
    const theClone = clone(target, {
        transform: {
            pos: opt?.p,
            scale: opt?.s,
            rot: opt?.r,
        },
        children: opt?.children ?? [],
    });
    if (opt && theClone?.transform && target?.transform) {
        if (!opt.p)
            theClone.transform.pos = target.transform.pos;
        if (!opt.r)
            theClone.transform.rot = target.transform.rot;
        if (!opt.s)
            theClone.transform.scale = target.transform.scale;
    }
    return theClone;
};
//# sourceMappingURL=getClone.js.map