{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { Client } from './client';\nimport { getCurrentScope } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { ClientOptions } from './types/options';\nimport { consoleSandbox, debug } from './utils/debug-logger';\n\n/** A class object that can instantiate Client objects. */\nexport type ClientClass = new (options: O) => F;\n\n/**\n * Internal function to create a new SDK client instance. The client is\n * installed and then bound to the current scope.\n *\n * @param clientClass The client class to instantiate.\n * @param options Options to pass to the client.\n */\nexport function initAndBind(\n clientClass: ClientClass,\n options: O,\n): Client {\n if (options.debug === true) {\n if (DEBUG_BUILD) {\n debug.enable();\n } else {\n // use `console.warn` rather than `debug.warn` since by non-debug bundles have all `debug.x` statements stripped\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');\n });\n }\n }\n const scope = getCurrentScope();\n scope.update(options.initialScope);\n\n const client = new clientClass(options);\n setCurrentClient(client);\n client.init();\n return client;\n}\n\n/**\n * Make the given client the current client.\n */\nexport function setCurrentClient(client: Client): void {\n getCurrentScope().setClient(client);\n}\n"],"names":[],"mappings":";;;;AAgBO,SAAS,WAAA,CACd,aACA,OAAA,EACQ;AACR,EAAA,IAAI,OAAA,CAAQ,UAAU,IAAA,EAAM;AAC1B,IAAA,IAAI,WAAA,EAAa;AACf,MAAA,KAAA,CAAM,MAAA,EAAO;AAAA,IACf,CAAA,MAAO;AAEL,MAAA,cAAA,CAAe,MAAM;AAEnB,QAAA,OAAA,CAAQ,KAAK,8EAA8E,CAAA;AAAA,MAC7F,CAAC,CAAA;AAAA,IACH;AAAA,EACF;AACA,EAAA,MAAM,QAAQ,eAAA,EAAgB;AAC9B,EAAA,KAAA,CAAM,MAAA,CAAO,QAAQ,YAAY,CAAA;AAEjC,EAAA,MAAM,MAAA,GAAS,IAAI,WAAA,CAAY,OAAO,CAAA;AACtC,EAAA,gBAAA,CAAiB,MAAM,CAAA;AACvB,EAAA,MAAA,CAAO,IAAA,EAAK;AACZ,EAAA,OAAO,MAAA;AACT;AAKO,SAAS,iBAAiB,MAAA,EAAsB;AACrD,EAAA,eAAA,EAAgB,CAAE,UAAU,MAAM,CAAA;AACpC;;;;"}