import { browser } from 'wxt/browser';

const isExtensionProtocol = () => {
  const protocol = window.location.protocol;
  return protocol === 'chrome-extension:' || protocol === 'moz-extension:';
};

export const getIsOptionManifest = () => isExtensionProtocol();
export const getIsPopupManifest = () => isExtensionProtocol() && window.location.pathname.includes('popup');
export const getIsContentpManifest = () => !!browser.runtime?.id && typeof document !== 'undefined' && !isExtensionProtocol();
export const getIsBackgroundpManifest = () => typeof self !== 'undefined' && !!self.registration;
