{"version":3,"file":"ReactMonacoDiffEditor.mjs","sources":["../../../../src/components/Monaco/ReactMonacoDiffEditor.tsx"],"sourcesContent":["import { DiffEditor, loader as monacoEditorLoader } from '@monaco-editor/react';\nimport * as monaco from 'monaco-editor';\nimport { useEffect } from 'react';\n\nimport { useTheme2 } from '../../themes/ThemeContext';\n\nimport defineThemes from './theme';\nimport type { ReactMonacoDiffEditorProps } from './types';\n\n// pass the monaco editor to the loader to bypass requirejs\nmonacoEditorLoader.config({ monaco });\n\nexport const ReactMonacoDiffEditor = (props: ReactMonacoDiffEditorProps) => {\n  const { options, onMount, ...restProps } = props;\n\n  const theme = useTheme2();\n\n  useEffect(() => {\n    defineThemes(monaco, theme);\n  }, [theme]);\n\n  return (\n    <DiffEditor\n      {...restProps}\n      options={{\n        ...options,\n        fontFamily: theme.typography.code.fontFamily,\n      }}\n      theme={theme.isDark ? 'grafana-dark' : 'grafana-light'}\n      onMount={(editor, monaco) => {\n        // we use a custom font in our monaco editor\n        // we need monaco to remeasure the fonts after they are loaded to prevent alignment issues\n        document.fonts.ready.then(() => {\n          monaco.editor.remeasureFonts();\n        });\n        onMount?.(editor, monaco);\n      }}\n    />\n  );\n};\n"],"names":["monacoEditorLoader","monaco"],"mappings":";;;;;;;;AAUAA,MAAA,CAAmB,MAAA,CAAO,EAAE,MAAA,EAAQ,CAAA;AAE7B,MAAM,qBAAA,GAAwB,CAAC,KAAA,KAAsC;AAC1E,EAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAS,GAAG,WAAU,GAAI,KAAA;AAE3C,EAAA,MAAM,QAAQ,SAAA,EAAU;AAExB,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,YAAA,CAAa,QAAQ,KAAK,CAAA;AAAA,EAC5B,CAAA,EAAG,CAAC,KAAK,CAAC,CAAA;AAEV,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACE,GAAG,SAAA;AAAA,MACJ,OAAA,EAAS;AAAA,QACP,GAAG,OAAA;AAAA,QACH,UAAA,EAAY,KAAA,CAAM,UAAA,CAAW,IAAA,CAAK;AAAA,OACpC;AAAA,MACA,KAAA,EAAO,KAAA,CAAM,MAAA,GAAS,cAAA,GAAiB,eAAA;AAAA,MACvC,OAAA,EAAS,CAAC,MAAA,EAAQC,OAAAA,KAAW;AAG3B,QAAA,QAAA,CAAS,KAAA,CAAM,KAAA,CAAM,IAAA,CAAK,MAAM;AAC9B,UAAAA,OAAAA,CAAO,OAAO,cAAA,EAAe;AAAA,QAC/B,CAAC,CAAA;AACD,QAAA,OAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAU,MAAA,EAAQA,OAAAA,CAAAA;AAAA,MACpB;AAAA;AAAA,GACF;AAEJ;;;;"}