{"version":3,"file":"globalContext.mjs","sources":["../../../src/context/globalContext.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { NoAmplifyContextError } from '../errors/NoAmplifyContextError';\nlet _globalContext = null;\n/**\n * Returns the global {@link AmplifyContext} set by `Amplify.configure()`.\n *\n * @throws {@link NoAmplifyContextError} If `Amplify.configure()` has not been\n * called yet and no context is available.\n */\nexport function getGlobalContext() {\n    if (!_globalContext) {\n        // Typed error (stable name/code) so categories can catch the unconfigured\n        // path uniformly. Message text is preserved for back-compat.\n        throw new NoAmplifyContextError();\n    }\n    return _globalContext;\n}\n/**\n * Stores the given context as the global {@link AmplifyContext}.\n *\n * @internal\n */\nexport function setGlobalContext(ctx) {\n    _globalContext = ctx;\n}\n/**\n * Returns `true` if a global {@link AmplifyContext} has been set.\n */\nexport function hasGlobalContext() {\n    return _globalContext !== null;\n}\n/**\n * Clears the global {@link AmplifyContext}.\n *\n * @internal — intended for testing and HMR.\n */\nexport function clearGlobalContext() {\n    _globalContext = null;\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEA,IAAI,cAAc,GAAG,IAAI;AACzB;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,GAAG;AACnC,IAAI,IAAI,CAAC,cAAc,EAAE;AACzB;AACA;AACA,QAAQ,MAAM,IAAI,qBAAqB,EAAE;AACzC,IAAI;AACJ,IAAI,OAAO,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,GAAG,EAAE;AACtC,IAAI,cAAc,GAAG,GAAG;AACxB;AACA;AACA;AACA;AACO,SAAS,gBAAgB,GAAG;AACnC,IAAI,OAAO,cAAc,KAAK,IAAI;AAClC;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,GAAG;AACrC,IAAI,cAAc,GAAG,IAAI;AACzB;;;;"}