import {ImageMetadata} from './common';

export const getMetadataFromUrl = async (imageUrl?: string) => {
  if (typeof imageUrl === 'undefined') {
    return {} as Partial<ImageMetadata>;
  }

  if (typeof window !== 'undefined') {
    const { getMetadataFromUrl: client } = await import('./client');
    return client(imageUrl);
  }

  const { getMetadataFromUrl: server } = await import('./server');
  return server(imageUrl);
};

export * from './common';
