import { stackParserFromStackParserOptions } from "../../../../../core/build/esm/utils/stacktrace.js";
import { setNormalizeStringifier } from "../../../../../core/build/esm/utils/normalize.js";
import { getIntegrationsToSetup } from "../../../../../core/build/esm/integration.js";
import { initAndBind } from "../../../../../core/build/esm/sdk.js";
import { functionToStringIntegration } from "../../../../../core/build/esm/integrations/functiontostring.js";
import { inboundFiltersIntegration } from "../../../../../core/build/esm/integrations/eventFilters.js";
import { dedupeIntegration } from "../../../../../core/build/esm/integrations/dedupe.js";
import { conversationIdIntegration } from "../../../../../core/build/esm/integrations/conversationId.js";
import { BrowserClient } from "./client.js";
import { makeFetchTransport } from "./transports/fetch.js";
import { defaultStackParser } from "./stack-parsers.js";
import { breadcrumbsIntegration } from "./integrations/breadcrumbs.js";
import { browserApiErrorsIntegration } from "./integrations/browserapierrors.js";
import { browserSessionIntegration } from "./integrations/browsersession.js";
import { cultureContextIntegration } from "./integrations/culturecontext.js";
import { globalHandlersIntegration } from "./integrations/globalhandlers.js";
import { httpContextIntegration } from "./integrations/httpcontext.js";
import { linkedErrorsIntegration } from "./integrations/linkederrors.js";
import { normalizeStringifyValue } from "./normalizeStringifyValue.js";
import { checkAndWarnIfIsEmbeddedBrowserExtension } from "./utils/detectBrowserExtension.js";
//#region node_modules/@sentry/browser/build/npm/esm/prod/sdk.js
function getDefaultIntegrations(_options) {
	return [
		inboundFiltersIntegration(),
		functionToStringIntegration(),
		conversationIdIntegration(),
		browserApiErrorsIntegration(),
		breadcrumbsIntegration(),
		globalHandlersIntegration(),
		linkedErrorsIntegration(),
		dedupeIntegration(),
		httpContextIntegration(),
		cultureContextIntegration(),
		browserSessionIntegration()
	];
}
function init(options = {}) {
	const shouldDisableBecauseIsBrowserExtenstion = !options.skipBrowserExtensionCheck && checkAndWarnIfIsEmbeddedBrowserExtension();
	let defaultIntegrations = options.defaultIntegrations == null ? getDefaultIntegrations() : options.defaultIntegrations;
	const clientOptions = {
		...options,
		enabled: shouldDisableBecauseIsBrowserExtenstion ? false : options.enabled,
		stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),
		integrations: getIntegrationsToSetup({
			integrations: options.integrations,
			defaultIntegrations
		}),
		transport: options.transport || makeFetchTransport
	};
	setNormalizeStringifier(normalizeStringifyValue);
	return initAndBind(BrowserClient, clientOptions);
}
//#endregion
export { init };
