{"version":3,"file":"extensionUtils.mjs","names":[],"sources":["../../../src/domain/extension/extensionUtils.ts"],"sourcesContent":["export const EXTENSION_PREFIXES = ['chrome-extension://', 'moz-extension://']\n\nexport function containsExtensionUrl(str: string): boolean {\n  return EXTENSION_PREFIXES.some((prefix) => str.includes(prefix))\n}\n\n/**\n * Utility function to detect if the SDK is being initialized in an unsupported browser extension environment.\n *\n * @param windowLocation - The current window location to check\n * @param stack - The error stack to check for extension URLs\n * @returns true if running in an unsupported browser extension environment\n */\nexport function isUnsupportedExtensionEnvironment(windowLocation: string, stack: string = '') {\n  // If the page itself is an extension page.\n  if (containsExtensionUrl(windowLocation)) {\n    return false\n  }\n\n  // Since we generate the error on the init, we check the 2nd frame line.\n  const frameLines = stack.split('\\n').filter((line) => {\n    const trimmedLine = line.trim()\n    return trimmedLine.length && /^at\\s+|@/.test(trimmedLine)\n  })\n  const target = frameLines[1] || ''\n\n  return containsExtensionUrl(target)\n}\n"],"mappings":";AAAA,MAAa,qBAAqB,CAAC,uBAAuB,kBAAkB;AAE5E,SAAgB,qBAAqB,KAAsB;CACzD,OAAO,mBAAmB,MAAM,WAAW,IAAI,SAAS,MAAM,CAAC;AACjE;;;;;;;;AASA,SAAgB,kCAAkC,gBAAwB,QAAgB,IAAI;CAE5F,IAAI,qBAAqB,cAAc,GACrC,OAAO;CAUT,OAAO,qBANY,MAAM,MAAM,IAAI,CAAC,CAAC,QAAQ,SAAS;EACpD,MAAM,cAAc,KAAK,KAAK;EAC9B,OAAO,YAAY,UAAU,WAAW,KAAK,WAAW;CAC1D,CACwB,CAAC,CAAC,MAAM,EAEE;AACpC"}