{"version":3,"file":"use-editor-md-theme.mjs","sources":["../../../../../../../packages/components/editor-md/src/composables/use-editor-md-theme.ts"],"sourcesContent":["import { onBeforeMount, onBeforeUnmount, onMounted, ref } from 'vue'\n\nexport function useEditorMdTheme(callback: () => void) {\n  const win: any = window\n  const isDarkMode = ref(false)\n  let themeService: any\n\n  const themeChange = () => {\n    if (themeService) {\n      isDarkMode.value = themeService.currentTheme.id.includes('dark')\n      callback()\n    }\n  }\n\n  onBeforeMount(() => {\n    themeService = win?.['devuiThemeService']\n  })\n\n  onMounted(() => {\n    themeChange()\n    if (themeService && themeService.eventBus) {\n      themeService.eventBus.add('themeChanged', themeChange)\n    }\n  })\n\n  onBeforeUnmount(() => {\n    if (themeService && themeService.eventBus) {\n      themeService.eventBus.remove('themeChanged', themeChange)\n    }\n  })\n\n  return { isDarkMode }\n}\n"],"names":[],"mappings":";;AACO,SAAS,gBAAgB,CAAC,QAAQ,EAAE;AAC3C,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC;AACrB,EAAE,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AAChC,EAAE,IAAI,YAAY,CAAC;AACnB,EAAE,MAAM,WAAW,GAAG,MAAM;AAC5B,IAAI,IAAI,YAAY,EAAE;AACtB,MAAM,UAAU,CAAC,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACvE,MAAM,QAAQ,EAAE,CAAC;AACjB,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,aAAa,CAAC,MAAM;AACtB,IAAI,YAAY,GAAG,GAAG,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACnE,GAAG,CAAC,CAAC;AACL,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,WAAW,EAAE,CAAC;AAClB,IAAI,IAAI,YAAY,IAAI,YAAY,CAAC,QAAQ,EAAE;AAC/C,MAAM,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AAC7D,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,eAAe,CAAC,MAAM;AACxB,IAAI,IAAI,YAAY,IAAI,YAAY,CAAC,QAAQ,EAAE;AAC/C,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AAChE,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB;;;;"}