{"version":3,"file":"ReactMonacoDiffEditorLazy.mjs","sources":["../../../../src/components/Monaco/ReactMonacoDiffEditorLazy.tsx"],"sourcesContent":["import { css } from '@emotion/css';\n\nimport { type GrafanaTheme2 } from '@grafana/data';\nimport { t } from '@grafana/i18n';\n\nimport { useStyles2 } from '../../themes/ThemeContext';\nimport { useAsyncDependency } from '../../utils/useAsyncDependency';\nimport { ErrorWithStack } from '../ErrorBoundary/ErrorWithStack';\nimport { LoadingPlaceholder } from '../LoadingPlaceholder/LoadingPlaceholder';\n\n// we only use import type so it will not be included in the bundle\nimport type { ReactMonacoDiffEditorProps } from './types';\n\n/**\n * @internal\n * Experimental export\n **/\nexport const ReactMonacoDiffEditorLazy = (props: ReactMonacoDiffEditorProps) => {\n  const styles = useStyles2(getStyles);\n  const { loading, error, dependency } = useAsyncDependency(\n    import(/* webpackChunkName: \"react-monaco-diff-editor\" */ './ReactMonacoDiffEditor')\n  );\n\n  if (loading) {\n    return (\n      <LoadingPlaceholder\n        text={t('grafana-ui.monaco.loading-placeholder', 'Loading editor')}\n        className={styles.container}\n      />\n    );\n  }\n\n  if (error) {\n    return (\n      <ErrorWithStack\n        title={t('grafana-ui.monaco.error-label', 'React Monaco Editor failed to load')}\n        error={error}\n        errorInfo={{ componentStack: error?.stack ?? '' }}\n      />\n    );\n  }\n\n  const ReactMonacoDiffEditor = dependency.ReactMonacoDiffEditor;\n  return <ReactMonacoDiffEditor {...props} loading={props.loading ?? null} />;\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n  return {\n    container: css({\n      marginBottom: 'unset',\n      marginLeft: theme.spacing(1),\n    }),\n  };\n};\n"],"names":[],"mappings":";;;;;;;;;AAiBO,MAAM,yBAAA,GAA4B,CAAC,KAAA,KAAsC;AAjBhF,EAAA,IAAA,EAAA,EAAA,EAAA;AAkBE,EAAA,MAAM,MAAA,GAAS,WAAW,SAAS,CAAA;AACnC,EAAA,MAAM,EAAE,OAAA,EAAS,KAAA,EAAO,UAAA,EAAW,G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