@matechat/core 1.10.0 → 1.11.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/Attachment/Attachment.vue.d.ts +121 -0
  2. package/Attachment/attachment-types.d.ts +103 -0
  3. package/Attachment/drop-area.vue.d.ts +13 -0
  4. package/Attachment/index.css +1 -1
  5. package/Attachment/index.d.ts +2 -0
  6. package/Attachment/index.js +211 -311
  7. package/Attachment/uploader.d.ts +11 -0
  8. package/Attachment/use-upload.d.ts +8 -0
  9. package/Bubble/Bubble.vue.d.ts +75 -0
  10. package/Bubble/BubbleLoading.vue.d.ts +3 -0
  11. package/Bubble/bubble-constants.d.ts +4 -0
  12. package/Bubble/bubble-types.d.ts +38 -0
  13. package/Bubble/components/Avatar.vue.d.ts +57 -0
  14. package/Bubble/components/AvatarBodyIcon.vue.d.ts +24 -0
  15. package/Bubble/components/AvatarNoBodyIcon.vue.d.ts +24 -0
  16. package/Bubble/components/avatar-types.d.ts +25 -0
  17. package/Bubble/index.css +1 -1
  18. package/Bubble/index.d.ts +2 -0
  19. package/Bubble/index.js +142 -148
  20. package/FileList/FileIcon/CodeFile.vue.d.ts +10 -0
  21. package/FileList/FileIcon/CompressedFile.vue.d.ts +10 -0
  22. package/FileList/FileIcon/DefaultFileIcon.vue.d.ts +10 -0
  23. package/FileList/FileIcon/Document.vue.d.ts +10 -0
  24. package/FileList/FileIcon/DrawingBoard.vue.d.ts +10 -0
  25. package/FileList/FileIcon/EmailFile.vue.d.ts +10 -0
  26. package/FileList/FileIcon/Excel.vue.d.ts +10 -0
  27. package/FileList/FileIcon/FlowChart.vue.d.ts +10 -0
  28. package/FileList/FileIcon/FolderClosed.vue.d.ts +10 -0
  29. package/FileList/FileIcon/FolderOpen.vue.d.ts +10 -0
  30. package/FileList/FileIcon/Image.vue.d.ts +10 -0
  31. package/FileList/FileIcon/Markdown.vue.d.ts +10 -0
  32. package/FileList/FileIcon/Mind.vue.d.ts +10 -0
  33. package/FileList/FileIcon/Mp4.vue.d.ts +10 -0
  34. package/FileList/FileIcon/MultidimentionalTable.vue.d.ts +10 -0
  35. package/FileList/FileIcon/Page.vue.d.ts +10 -0
  36. package/FileList/FileIcon/Pdf.vue.d.ts +10 -0
  37. package/FileList/FileIcon/Ppt.vue.d.ts +10 -0
  38. package/FileList/FileIcon/Unknown.vue.d.ts +10 -0
  39. package/FileList/FileIcon/Wrong.vue.d.ts +10 -0
  40. package/FileList/FileList.vue.d.ts +36 -0
  41. package/FileList/fileList-types.d.ts +21 -0
  42. package/FileList/index.d.ts +2 -0
  43. package/FileList/index.js +220 -228
  44. package/Header/Header.vue.d.ts +47 -0
  45. package/Header/header-types.d.ts +14 -0
  46. package/Header/index.d.ts +2 -0
  47. package/Header/index.js +0 -1
  48. package/Input/Input.vue.d.ts +165 -0
  49. package/Input/components/EditableBlock.vue.d.ts +101 -0
  50. package/Input/components/InputTag.vue.d.ts +30 -0
  51. package/Input/components/LoadingIcon.vue.d.ts +3 -0
  52. package/Input/components/SendIcon.vue.d.ts +3 -0
  53. package/Input/components/button.vue.d.ts +3 -0
  54. package/Input/components/textarea-utils.d.ts +17 -0
  55. package/Input/components/textarea.vue.d.ts +3 -0
  56. package/Input/components/use-textarea-autosize.d.ts +12 -0
  57. package/Input/components/util.d.ts +3 -0
  58. package/Input/index.css +1 -1
  59. package/Input/index.d.ts +2 -0
  60. package/Input/index.js +114 -252
  61. package/Input/input-types.d.ts +118 -0
  62. package/Introduction/Introduction.vue.d.ts +88 -0
  63. package/Introduction/index.css +1 -1
  64. package/Introduction/index.d.ts +2 -0
  65. package/Introduction/index.js +8 -9
  66. package/Introduction/introduction-types.d.ts +37 -0
  67. package/Layout/Aside.vue.d.ts +13 -0
  68. package/Layout/Content.vue.d.ts +13 -0
  69. package/Layout/Header.vue.d.ts +13 -0
  70. package/Layout/Layout.vue.d.ts +13 -0
  71. package/Layout/Sender.vue.d.ts +13 -0
  72. package/Layout/index.d.ts +6 -0
  73. package/Layout/index.js +0 -1
  74. package/List/List.vue.d.ts +98 -0
  75. package/List/const.d.ts +5 -0
  76. package/List/index.css +1 -1
  77. package/List/index.d.ts +3 -0
  78. package/List/index.js +51 -54
  79. package/List/list-types.d.ts +52 -0
  80. package/List/use-list.d.ts +13 -0
  81. package/Locale/i18n.d.ts +21 -0
  82. package/Locale/index.d.ts +7 -0
  83. package/Locale/index.js +35 -103
  84. package/Locale/lang/en-us.d.ts +34 -0
  85. package/Locale/lang/zh-cn.d.ts +34 -0
  86. package/MarkdownCard/CodeBlock.vue.d.ts +76 -0
  87. package/MarkdownCard/MDCardParser.d.ts +12 -0
  88. package/MarkdownCard/MDCardService.d.ts +14 -0
  89. package/MarkdownCard/MermaidService.d.ts +22 -0
  90. package/MarkdownCard/index.css +1 -1
  91. package/MarkdownCard/index.d.ts +2 -0
  92. package/MarkdownCard/index.js +205 -559
  93. package/MarkdownCard/mdCard.types.d.ts +88 -0
  94. package/MarkdownCard/mdCard.vue.d.ts +29 -0
  95. package/Mention/Mention.vue.d.ts +51 -0
  96. package/Mention/const.d.ts +4 -0
  97. package/Mention/index.d.ts +2 -0
  98. package/Mention/index.js +0 -1
  99. package/Mention/mention-types.d.ts +24 -0
  100. package/Mention/use-mention.d.ts +10 -0
  101. package/Prompt/Prompt.vue.d.ts +38 -0
  102. package/Prompt/PromptItem.vue.d.ts +11 -0
  103. package/Prompt/components/Icon.vue.d.ts +42 -0
  104. package/Prompt/components/icon-types.d.ts +18 -0
  105. package/Prompt/index.d.ts +2 -0
  106. package/Prompt/prompt-types.d.ts +33 -0
  107. package/README.md +12 -8
  108. package/Toolbar/Toolbar.vue.d.ts +68 -0
  109. package/Toolbar/icon/CopyIcon.vue.d.ts +42 -0
  110. package/Toolbar/icon/DeleteIcon.vue.d.ts +42 -0
  111. package/Toolbar/icon/DislikeIcon.vue.d.ts +46 -0
  112. package/Toolbar/icon/LikeIcon.vue.d.ts +46 -0
  113. package/Toolbar/icon/RefreshIcon.vue.d.ts +42 -0
  114. package/Toolbar/icon/ShareIcon.vue.d.ts +42 -0
  115. package/Toolbar/index.css +1 -0
  116. package/Toolbar/index.d.ts +8 -0
  117. package/Toolbar/index.js +519 -0
  118. package/Toolbar/toolbar.types.d.ts +60 -0
  119. package/mate-chat.js +0 -6
  120. package/package.json +4 -1
@@ -1,41 +1,39 @@
1
- import "./index.css";
2
- import { defineComponent as oe, ref as x, computed as z, watch as k, nextTick as W, onMounted as re, createElementBlock as L, openBlock as C, normalizeClass as j, renderSlot as R, createVNode as pe, createElementVNode as M, toDisplayString as V, createCommentVNode as O, unref as v, Transition as ye, withCtx as fe, withDirectives as Me, vShow as Ce, isVNode as le, h as f, useSlots as we, Fragment as A, createBlock as Le, resolveDynamicComponent as ve } from "vue";
3
- import D from "highlight.js";
4
- import Ie from "markdown-it";
5
- import { debounce as Ne } from "lodash-es";
6
- import { getDefaultWhiteList as De, getDefaultCSSWhiteList as xe, filterXSS as Te } from "xss";
7
- import { useMcI18n as Ae } from "@matechat/core/Locale";
8
- const je = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eenlarge%3c/title%3e%3cg%20id='enlarge'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M7.16666667,1%20C10.572409,1%2013.3333333,3.76092429%2013.3333333,7.16666667%20C13.3333333,8.68984984%2012.781084,10.0840543%2011.8658888,11.1599767%20L14.4225201,13.7154466%20C14.6177822,13.9107088%2014.6177822,14.2272912%2014.4225201,14.4225534%20C14.2489537,14.5961197%2013.9795293,14.6154049%2013.7846612,14.4804088%20L13.7154133,14.4225534%20L11.158968,11.8667467%20C10.083183,12.7814291%208.68937384,13.3333333%207.16666667,13.3333333%20C3.76092429,13.3333333%201,10.572409%201,7.16666667%20C1,3.76092429%203.76092429,1%207.16666667,1%20Z%20M7.16666667,2%20C4.31320904,2%202,4.31320904%202,7.16666667%20C2,10.0201243%204.31320904,12.3333333%207.16666667,12.3333333%20C10.0201243,12.3333333%2012.3333333,10.0201243%2012.3333333,7.16666667%20C12.3333333,4.31320904%2010.0201243,2%207.16666667,2%20Z%20M7.16666667,4.66666667%20C7.41212656,4.66666667%207.61627504,4.84354183%207.658611,5.07679103%20L7.66666667,5.16666667%20L7.666,6.668%20L9.16601582,6.66666666%20C9.44215796,6.66630764%209.66630679,6.88987368%209.66666668,7.16601582%20C9.66698576,7.4114755%209.49037648,7.61585405%209.25718258,7.65849359%20L9.16731751,7.66666666%20L7.666,7.668%20L7.66666667,9.16666667%20C7.66666667,9.44280904%207.44280904,9.66666667%207.16666667,9.66666667%20C6.92120678,9.66666667%206.7170583,9.48979151%206.67472234,9.2565423%20L6.66666667,9.16666667%20L6.666,7.669%20L5.17251751,7.67186668%20C4.89637537,7.6722257%204.67222654,7.44865965%204.67186666,7.17251751%20C4.67154758,6.92705783%204.84815685,6.72267929%205.08135075,6.68003974%20L5.17121582,6.67186709%20L6.666,6.669%20L6.66666667,5.16666667%20C6.66666667,4.89052429%206.89052429,4.66666667%207.16666667,4.66666667%20Z'%20id='形状结合'%20fill='%2371757F'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e", ke = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3ezoom-out%3c/title%3e%3cg%20id='zoom-out'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M7.16666667,1%20C10.572409,1%2013.3333333,3.76092429%2013.3333333,7.16666667%20C13.3333333,8.68984984%2012.781084,10.0840543%2011.8658888,11.1599767%20L14.4225201,13.7154466%20C14.6177822,13.9107088%2014.6177822,14.2272912%2014.4225201,14.4225534%20C14.2489537,14.5961197%2013.9795293,14.6154049%2013.7846612,14.4804088%20L13.7154133,14.4225534%20L11.158968,11.8667467%20C10.083183,12.7814291%208.68937384,13.3333333%207.16666667,13.3333333%20C3.76092429,13.3333333%201,10.572409%201,7.16666667%20C1,3.76092429%203.76092429,1%207.16666667,1%20Z%20M7.16666667,2%20C4.31320904,2%202,4.31320904%202,7.16666667%20C2,10.0201243%204.31320904,12.3333333%207.16666667,12.3333333%20C10.0201243,12.3333333%2012.3333333,10.0201243%2012.3333333,7.16666667%20C12.3333333,4.31320904%2010.0201243,2%207.16666667,2%20Z%20M9.16601582,6.66666666%20C9.44215796,6.66630764%209.66630679,6.88987368%209.66666668,7.16601582%20C9.66698576,7.4114755%209.49037648,7.61585405%209.25718258,7.65849359%20L9.16731751,7.66666666%20L5.17251751,7.67186668%20C4.89637537,7.6722257%204.67222654,7.44865965%204.67186666,7.17251751%20C4.67154758,6.92705783%204.84815685,6.72267929%205.08135075,6.68003974%20L5.17121582,6.67186709%20L9.16601582,6.66666666%20Z'%20id='形状结合'%20fill='%2371757F'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e", be = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3ei下载%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='i下载'%3e%3cpath%20d='M14.5,14%20C14.7761424,14%2015,14.2238576%2015,14.5%20C15,14.7761424%2014.7761424,15%2014.5,15%20L1.5,15%20C1.22385763,15%201,14.7761424%201,14.5%20C1,14.2238576%201.22385763,14%201.5,14%20L14.5,14%20Z%20M8,1%20C8.24545989,1%208.44960837,1.17687516%208.49194433,1.41012437%20L8.5,1.5%20L8.5,10.793%20L11.6464466,7.64644661%20C11.820013,7.47288026%2012.0894374,7.45359511%2012.2843055,7.58859116%20L12.3535534,7.64644661%20C12.5271197,7.82001296%2012.5464049,8.08943736%2012.4114088,8.2843055%20L12.3535534,8.35355339%20L8.35355339,12.3535534%20L8.34128643,12.3654113%20C8.32881868,12.3770608%208.31575424,12.3880797%208.30214392,12.3984173%20L8.35355339,12.3535534%20C8.32671912,12.3803877%208.29759357,12.4035342%208.26680652,12.422993%20C8.25568247,12.4299807%208.24404667,12.4367067%208.23212724,12.4429657%20C8.21827569,12.4502504%208.20453886,12.4566485%208.1905951,12.4623894%20C8.17802507,12.4675915%208.16473685,12.4724419%208.15119917,12.4767316%20C8.13583471,12.481552%208.12047425,12.4856039%208.10498705,12.4889143%20C8.09430622,12.4912471%208.08325248,12.4932298%208.07207924,12.494843%20C8.05487076,12.4972949%208.03773477,12.498877%208.02056948,12.4995793%20C8.01375728,12.4998604%208.00689494,12.5%208,12.5%20L7.98043349,12.4996194%20C7.96293275,12.4989382%207.94546098,12.4973429%207.92809589,12.4948333%20L8,12.5%20C7.96390296,12.5%207.92869933,12.4961748%207.89477235,12.4889078%20C7.87952575,12.4856039%207.86416529,12.481552%207.84898836,12.4767587%20C7.83526315,12.4724419%207.82197493,12.4675915%207.80896344,12.4622078%20C7.79546114,12.4566485%207.78172431,12.4502504%207.76824181,12.443195%20C7.75595333,12.4367067%207.74431753,12.4299807%207.73298968,12.422812%20C7.72729809,12.4192668%207.72146362,12.4154054%207.7156945,12.4114088%20L7.69785608,12.3984173%20C7.68424576,12.3880797%207.67118132,12.3770608%207.65871357,12.3654113%20L7.64644661,12.3535534%20L3.64644661,8.35355339%20C3.45118446,8.15829124%203.45118446,7.84170876%203.64644661,7.64644661%20C3.82001296,7.47288026%204.08943736,7.45359511%204.2843055,7.58859116%20L4.35355339,7.64644661%20L7.5,10.793%20L7.5,1.5%20C7.5,1.22385763%207.72385763,1%208,1%20Z'%20id='形状结合'%20fill='%2371757F'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/svg%3e", Se = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e全部收起%3c/title%3e%3cg%20id='全部收起'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M4.715694,14.4114091%20C4.910563,14.5464051%205.179987,14.5271201%205.353553,14.3535531%20L5.353553,14.3535531%20L7.99999988,11.7070001%20L10.646447,14.3535531%20L10.715694,14.4114091%20C10.910563,14.5464051%2011.179987,14.5271201%2011.353553,14.3535531%20C11.548816,14.1582911%2011.548816,13.8417091%2011.353553,13.6464471%20L11.353553,13.6464471%20L8.353553,10.6464471%20L8.284306,10.5885911%20C8.089437,10.4535951%207.820013,10.4728801%207.646447,10.6464471%20L7.646447,10.6464471%20L4.646447,13.6464471%20L4.588591,13.7156941%20C4.453595,13.9105631%204.47288,14.1799871%204.646447,14.3535531%20L4.646447,14.3535531%20L4.715694,14.4114091%20Z%20M14.5,7.50000012%20C14.776142,7.50000012%2015,7.72385812%2015,8.00000012%20C15,8.27614212%2014.776142,8.50000012%2014.5,8.50000012%20L1.5,8.50000012%20C1.223858,8.50000012%201,8.27614212%201,8.00000012%20C1,7.72385812%201.223858,7.50000012%201.5,7.50000012%20L14.5,7.50000012%20Z%20M8.284306,5.41140912%20L8.353553,5.35355312%20L11.353553,2.35355312%20C11.548816,2.15829112%2011.548816,1.84170912%2011.353553,1.64644712%20C11.179987,1.47288012%2010.910563,1.45359512%2010.715694,1.58859112%20L10.646447,1.64644712%20L7.99999988,4.29300012%20L5.353553,1.64644712%20C5.179987,1.47288012%204.910563,1.45359512%204.715694,1.58859112%20L4.646447,1.64644712%20C4.47288,1.82001312%204.453595,2.08943712%204.588591,2.28430612%20L4.646447,2.35355312%20L7.646447,5.35355312%20C7.820013,5.52712012%208.089437,5.54640512%208.284306,5.41140912%20Z'%20id='形状结合'%20fill='%2371757F'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e", Oe = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgMTYgMTYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8dGl0bGU+ZnVuY3Rpb24gaWNvbi9jb3B5PC90aXRsZT4KICAgIDxnIGlkPSLpobXpnaItMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9IkFQSS1zdGFydGVyLeWbvuagh+WFpeW6kyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU5Mi4wMDAwMDAsIC0yMDQuMDAwMDAwKSI+CiAgICAgICAgICAgIDxnIGlkPSLmlrnmoLzlpIfku70tMTYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDU2MC4wMDAwMDAsIDE4MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDx0ZXh0IGlkPSLlm77moIciIGZvbnQtZmFtaWx5PSJQaW5nRmFuZ1NDLVJlZ3VsYXIsIFBpbmdGYW5nIFNDIiBmb250LXNpemU9IjEyIiBmb250LXdlaWdodD0ibm9ybWFsIiBsaW5lLXNwYWNpbmc9IjE2IiBmaWxsPSIjNzE3NTdGIj4KICAgICAgICAgICAgICAgICAgICA8dHNwYW4geD0iMjcuMTM2I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CA2MDIuNzc2MTQyLDIwOSA2MDIuNSwyMDkgTDYwMi41LDIwOSBaIE02MDQuNSwyMDcgTDU5Ny41LDIwNyBDNTk3LjI1NDU0LDIwNyA1OTcuMDUwMzkyLDIwNy4xNzY4NzUgNTk3LjAwODA1NiwyMDcuNDEwMTI0IEw1OTcsMjA3LjUgTDU5NywyMDggTDYwMi41LDIwOCBDNjAzLjI3OTY5NiwyMDggNjAzLjkyMDQ0OSwyMDguNTk0ODg4IDYwMy45OTMxMzMsMjA5LjM1NTU0IEw2MDQsMjA5LjUgTDYwNCwyMTUgTDYwNC41LDIxNSBDNjA0Ljc0NTQ2LDIxNSA2MDQuOTQ5NjA4LDIxNC44MjMxMjUgNjA0Ljk5MTk0NCwyMTQuNTg5ODc2IEw2MDUsMjE0LjUgTDYwNSwyMDcuNSBDNjA1LDIwNy4yNTQ1NCA2MDQuODIzMTI1LDIwNy4wNTAzOTIgNjA0LjU4OTg3NiwyMDcuMDA4MDU2IEw2MDQuNSwyMDcgWiIgaWQ9IuW9oueKtue7k+WQiCIgZmlsbD0iIzcxNzU3RiIgZmlsbC1ydWxlPSJub256ZXJvIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=", Ee = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3estatus/whiteBG/correct%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpolygon%20id='path-1'%20points='6.53553391%209.77817459%2012.1923882%204.12132034%2013.6066017%205.53553391%206.53553391%2012.6066017%203%209.07106781%204.41421356%207.65685425%206.53553391%209.77817459'%3e%3c/polygon%3e%3c/defs%3e%3cg%20id='status/whiteBG/correct'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cmask%20id='mask-2'%20fill='white'%3e%3cuse%20xlink:href='%23path-1'%3e%3c/use%3e%3c/mask%3e%3cuse%20id='Mask'%20fill='%233DCCA6'%20xlink:href='%23path-1'%3e%3c/use%3e%3c/g%3e%3c/svg%3e";
9
- class ce {
1
+ import { defineComponent as E, ref as O, computed as y, createElementBlock as u, openBlock as I, normalizeClass as x, renderSlot as T, createVNode as Q, createElementVNode as D, toDisplayString as P, unref as b, Transition as G, withCtx as H, createCommentVNode as U, useSlots as Z, h as w, watch as S, onMounted as X, Fragment as R, createBlock as F, resolveDynamicComponent as V } from "vue";
2
+ import C from "highlight.js";
3
+ import K from "markdown-it";
4
+ import { debounce as J } from "lodash-es";
5
+ import { getDefaultWhiteList as $, getDefaultCSSWhiteList as q, filterXSS as ee } from "xss";
6
+ const te = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e全部收起%3c/title%3e%3cg%20id='全部收起'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M4.715694,14.4114091%20C4.910563,14.5464051%205.179987,14.5271201%205.353553,14.3535531%20L5.353553,14.3535531%20L7.99999988,11.7070001%20L10.646447,14.3535531%20L10.715694,14.4114091%20C10.910563,14.5464051%2011.179987,14.5271201%2011.353553,14.3535531%20C11.548816,14.1582911%2011.548816,13.8417091%2011.353553,13.6464471%20L11.353553,13.6464471%20L8.353553,10.6464471%20L8.284306,10.5885911%20C8.089437,10.4535951%207.820013,10.4728801%207.646447,10.6464471%20L7.646447,10.6464471%20L4.646447,13.6464471%20L4.588591,13.7156941%20C4.453595,13.9105631%204.47288,14.1799871%204.646447,14.3535531%20L4.646447,14.3535531%20L4.715694,14.4114091%20Z%20M14.5,7.50000012%20C14.776142,7.50000012%2015,7.72385812%2015,8.00000012%20C15,8.27614212%2014.776142,8.50000012%2014.5,8.50000012%20L1.5,8.50000012%20C1.223858,8.50000012%201,8.27614212%201,8.00000012%20C1,7.72385812%201.223858,7.50000012%201.5,7.50000012%20L14.5,7.50000012%20Z%20M8.284306,5.41140912%20L8.353553,5.35355312%20L11.353553,2.35355312%20C11.548816,2.15829112%2011.548816,1.84170912%2011.353553,1.64644712%20C11.179987,1.47288012%2010.910563,1.45359512%2010.715694,1.58859112%20L10.646447,1.64644712%20L7.99999988,4.29300012%20L5.353553,1.64644712%20C5.179987,1.47288012%204.910563,1.45359512%204.715694,1.58859112%20L4.646447,1.64644712%20C4.47288,1.82001312%204.453595,2.08943712%204.588591,2.28430612%20L4.646447,2.35355312%20L7.646447,5.35355312%20C7.820013,5.52712012%208.089437,5.54640512%208.284306,5.41140912%20Z'%20id='形状结合'%20fill='%2371757F'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e", se = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgMTYgMTYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8dGl0bGU+ZnVuY3Rpb24gaWNvbi9jb3B5PC90aXRsZT4KICAgIDxnIGlkPSLpobXpnaItMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9IkFQSS1zdGFydGVyLeWbvuagh+WFpeW6kyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU5Mi4wMDAwMDAsIC0yMDQuMDAwMDAwKSI+Ci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%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3estatus/whiteBG/correct%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpolygon%20id='path-1'%20points='6.53553391%209.77817459%2012.1923882%204.12132034%2013.6066017%205.53553391%206.53553391%2012.6066017%203%209.07106781%204.41421356%207.65685425%206.53553391%209.77817459'%3e%3c/polygon%3e%3c/defs%3e%3cg%20id='status/whiteBG/correct'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cmask%20id='mask-2'%20fill='white'%3e%3cuse%20xlink:href='%23path-1'%3e%3c/use%3e%3c/mask%3e%3cuse%20id='Mask'%20fill='%233DCCA6'%20xlink:href='%23path-1'%3e%3c/use%3e%3c/g%3e%3c/svg%3e";
7
+ class W {
10
8
  constructor() {
11
- this.xssWhiteList = De(), this.cssWhiteList = xe(), this.setDefaultXss();
9
+ this.xssWhiteList = $(), this.cssWhiteList = q(), this.setDefaultXss();
12
10
  }
13
11
  setDefaultXss() {
14
12
  this.xssWhiteList.input = ["type", "checked", "disabled", "class"], this.xssWhiteList.label = ["for"], this.xssWhiteList.ul = ["class"], this.xssWhiteList.div = ["class"], this.xssWhiteList.a = ["href", "class", "target", "name"], this.xssWhiteList.ol = ["start"], this.xssWhiteList.p = ["class"], this.xssWhiteList.span = ["style", "class", "title", "id"], this.xssWhiteList.svg = ["style", "class", "width", "height", "viewbox", "preserveaspectratio", "id", "fill", "stroke"], this.xssWhiteList.path = ["style", "class", "d", "id", "fill", "stroke"], this.xssWhiteList.th = ["style"], this.xssWhiteList.td = ["style"];
15
13
  }
16
- onIgnoreTagAttr(s, r, a, n) {
17
- if (!n && (r === "id" || s === "span" && r === "style"))
18
- return r + "=" + a;
14
+ onIgnoreTagAttr(t, o, r, s) {
15
+ if (!s && (o === "id" || t === "span" && o === "style"))
16
+ return o + "=" + r;
19
17
  }
20
18
  getXssWhiteList() {
21
19
  return this.xssWhiteList;
22
20
  }
23
- setXssWhiteList(s) {
24
- this.xssWhiteList = s;
21
+ setXssWhiteList(t) {
22
+ this.xssWhiteList = t;
25
23
  }
26
- setCustomXssRules(s) {
27
- s && s.forEach((r) => {
28
- r.value === null ? delete this.xssWhiteList[r.key] : this.xssWhiteList[r.key] = r.value;
24
+ setCustomXssRules(t) {
25
+ t && t.forEach((o) => {
26
+ o.value === null ? delete this.xssWhiteList[o.key] : this.xssWhiteList[o.key] = o.value;
29
27
  });
30
28
  }
31
- setMdPlugins(s, r) {
32
- s && s.length && s.forEach((a) => {
33
- const { plugin: n, opts: g } = a;
34
- r.use(n, g);
29
+ setMdPlugins(t, o) {
30
+ t && t.length && t.forEach((r) => {
31
+ const { plugin: s, opts: m } = r;
32
+ o.use(s, m);
35
33
  });
36
34
  }
37
- filterHtml(s) {
38
- return Te(s, {
35
+ filterHtml(t) {
36
+ return ee(t, {
39
37
  whiteList: this.xssWhiteList,
40
38
  onIgnoreTagAttr: this.onIgnoreTagAttr,
41
39
  css: {
@@ -49,22 +47,16 @@ class ce {
49
47
  });
50
48
  }
51
49
  }
52
- const Be = {
50
+ const oe = {
53
51
  key: 0,
54
52
  class: "mc-code-block-header"
55
- }, Ue = { class: "mc-code-lang" }, _e = { class: "mc-code-block-actions" }, ze = {
53
+ }, ne = { class: "mc-code-lang" }, ce = { class: "mc-code-block-actions" }, ae = {
56
54
  key: 0,
57
- style: { "margin-right": "8px" }
58
- }, We = ["title"], Ze = ["title"], Ye = ["title"], Pe = ["title"], Qe = ["title"], Ge = {
59
- key: 0,
60
- src: Oe
61
- }, He = {
55
+ src: se
56
+ }, re = {
62
57
  key: 1,
63
- src: Ee
64
- }, Fe = {
65
- key: 0,
66
- class: "mc-mermaid-content"
67
- }, $e = { key: 1 }, Xe = ["innerHTML"], Re = /* @__PURE__ */ oe({
58
+ src: ie
59
+ }, le = { key: 0 }, de = { key: 0 }, ge = ["innerHTML"], Me = /* @__PURE__ */ E({
68
60
  __name: "CodeBlock",
69
61
  props: {
70
62
  code: {
@@ -82,246 +74,100 @@ const Be = {
82
74
  theme: {
83
75
  type: String,
84
76
  default: "light"
85
- },
86
- enableMermaid: {
87
- type: Boolean,
88
- default: !1
89
- },
90
- mermaidConfig: {
91
- type: Object,
92
- default: () => ({})
93
77
  }
94
78
  },
95
- setup(i) {
96
- const s = i, { t: r } = Ae(), a = new ce();
97
- let n = null;
98
- const g = x(!0), d = x(!1);
99
- x("");
100
- const l = x(!0), c = z(() => {
101
- var t;
102
- return s.enableMermaid && ((t = s.language) == null ? void 0 : t.toLowerCase()) === "mermaid";
103
- }), h = z(() => {
104
- try {
105
- const t = s.code.indexOf('<span class="mc-typewriter');
106
- let e;
107
- return s.language && D.getLanguage(s.language) ? t !== -1 ? e = D.highlight(s.code.slice(0, t), { language: s.language }).value + s.code.slice(t) : e = D.highlight(s.code, { language: s.language }).value : typeof D.highlightAuto !== void 0 ? t !== -1 ? e = D.highlightAuto(s.code.slice(0, t)).value + s.code.slice(t) : e = D.highlightAuto(s.code).value : e = a.filterHtml(s.code), e;
108
- } catch {
109
- }
110
- }), w = x(null), E = () => {
111
- var e;
112
- const t = (e = w.value) == null ? void 0 : e.querySelector(".mc-mermaid-content");
113
- t && n && n.zoomIn(t);
114
- }, I = () => {
115
- var e;
116
- const t = (e = w.value) == null ? void 0 : e.querySelector(".mc-mermaid-content");
117
- t && n && n.zoomOut(t);
118
- }, Y = () => {
119
- var e;
120
- const t = (e = w.value) == null ? void 0 : e.querySelector(".mc-mermaid-content");
121
- t && n && n.download(t);
122
- }, N = async () => {
123
- if (!(!c.value || !s.code)) {
124
- if (!n)
125
- try {
126
- const { MermaidService: t } = await import("./MermaidService-B6BcjbW_.js"), e = {
127
- theme: s.theme === "dark" ? "dark" : "default",
128
- ...s.mermaidConfig
129
- };
130
- n = new t(e);
131
- } catch (t) {
132
- console.error("Failed to load MermaidService:", t);
133
- return;
134
- }
135
- W(async () => {
136
- var e;
137
- const t = (e = w.value) == null ? void 0 : e.querySelector(".mc-mermaid-content");
138
- t && await n.renderToContainer(t, s.code.replace(/<span[^>]*\bclass\s*=\s*['"]mc-typewriter[^>]*>([\s\S]*?)<\/span>/g, "$1"), s.theme);
139
- });
140
- }
141
- }, P = () => {
142
- g.value = !g.value;
143
- }, B = Ne((t) => {
144
- const e = t.target;
79
+ setup(l) {
80
+ const t = l, o = new W(), r = O(!0), s = O(!1), m = y(() => {
81
+ if (t.language && C.getLanguage(t.language))
82
+ try {
83
+ return C.highlight(t.code, { language: t.language }).value;
84
+ } catch {
85
+ }
86
+ return o.filterHtml(t.code);
87
+ }), a = () => {
88
+ r.value = !r.value;
89
+ }, M = J((e) => {
90
+ const g = e.target;
145
91
  if (navigator.clipboard)
146
- navigator.clipboard.writeText(s.code);
92
+ navigator.clipboard.writeText(t.code);
147
93
  else {
148
- const o = document.createElement("textarea");
149
- o.style.position = "fixed", o.style.top = "-9999px", o.style.left = "-9999px", o.style.zIndex = "-1", o.value = s.code, document.body.appendChild(o), o.select(), document.execCommand("copy"), document.body.removeChild(o);
94
+ const c = document.createElement("textarea");
95
+ c.style.position = "fixed", c.style.top = "-9999px", c.style.left = "-9999px", c.style.zIndex = "-1", c.value = t.code, document.body.appendChild(c), c.select(), document.execCommand("copy"), document.body.removeChild(c);
150
96
  }
151
- e.classList.remove("icon-copy-new"), d.value = !0, setTimeout(() => {
152
- d.value = !1;
97
+ g.classList.remove("icon-copy-new"), s.value = !0, setTimeout(() => {
98
+ s.value = !1;
153
99
  }, 1500);
154
- }, 300), Q = (t) => {
155
- t.dataset || (t.dataset = {}), t.style.height && (t.dataset.height = t.style.height), t.style.maxHeight = 0;
156
- }, G = (t) => {
100
+ }, 300), A = (e) => {
101
+ e.dataset || (e.dataset = {}), e.style.height && (e.dataset.height = e.style.height), e.style.maxHeight = 0;
102
+ }, p = (e) => {
157
103
  requestAnimationFrame(() => {
158
- t.dataset.oldOverflow = t.style.overflow, t.dataset.height ? t.style.maxHeight = t.dataset.height : t.scrollHeight !== 0 ? t.style.maxHeight = `${t.scrollHeight}px` : t.style.maxHeight = 0, t.style.overflow = "hidden";
159
- });
160
- }, U = (t) => {
161
- t.style.maxHeight = "", t.style.overflow = t.dataset.oldOverflow;
162
- }, b = (t) => {
163
- t.dataset || (t.dataset = {}), t.dataset.oldOverflow = t.style.overflow, t.style.maxHeight = `${t.scrollHeight}px`, t.style.overflow = "hidden";
164
- }, H = (t) => {
165
- t.scrollHeight !== 0 && (t.style.maxHeight = 0);
166
- }, F = (t) => {
167
- t.style.maxHeight = "", t.style.overflow = t.dataset.oldOverflow;
168
- }, $ = z(() => s.theme === "dark" ? "mc-code-block-dark" : "mc-code-block-light");
169
- return k(() => [s.code, s.theme, s.enableMermaid], () => {
170
- c.value && W(() => {
171
- N();
104
+ e.dataset.oldOverflow = e.style.overflow, e.dataset.height ? e.style.maxHeight = e.dataset.height : e.scrollHeight !== 0 ? e.style.maxHeight = `${e.scrollHeight}px` : e.style.maxHeight = 0, e.style.overflow = "hidden";
172
105
  });
173
- }, { immediate: !0 }), k(
174
- () => l.value,
175
- (t) => {
176
- t && c.value && W(() => {
177
- N();
178
- });
179
- }
180
- ), re(() => {
181
- c.value && N();
182
- }), (t, e) => (C(), L(
106
+ }, k = (e) => {
107
+ e.style.maxHeight = "", e.style.overflow = e.dataset.oldOverflow;
108
+ }, i = (e) => {
109
+ e.dataset || (e.dataset = {}), e.dataset.oldOverflow = e.style.overflow, e.style.maxHeight = `${e.scrollHeight}px`, e.style.overflow = "hidden";
110
+ }, n = (e) => {
111
+ e.scrollHeight !== 0 && (e.style.maxHeight = 0);
112
+ }, d = (e) => {
113
+ e.style.maxHeight = "", e.style.overflow = e.dataset.oldOverflow;
114
+ }, h = y(() => t.theme === "dark" ? "mc-code-block-dark" : "mc-code-block-light");
115
+ return (e, g) => (I(), u(
183
116
  "div",
184
117
  {
185
- class: j(["mc-code-block", $.value]),
186
- ref_key: "rootRef",
187
- ref: w
118
+ class: x(["mc-code-block", h.value])
188
119
  },
189
120
  [
190
- t.$slots.header ? R(t.$slots, "header", { key: 1 }, void 0, !0) : (C(), L("div", Be, [
191
- M(
121
+ e.$slots.header ? T(e.$slots, "header", { key: 1 }, void 0, !0) : (I(), u("div", oe, [
122
+ D(
192
123
  "span",
193
- Ue,
194
- V(i.language),
124
+ ne,
125
+ P(l.language),
195
126
  1
196
127
  /* TEXT */
197
128
  ),
198
- R(t.$slots, "actions", {}, () => [
199
- M("div", _e, [
200
- c.value ? (C(), L("div", ze, [
201
- M(
202
- "ul",
203
- {
204
- class: j(["mc-diagram-switch", { "mc-show-code": !l.value }])
205
- },
206
- [
207
- M(
208
- "li",
209
- {
210
- onClick: e[0] || (e[0] = (o) => l.value = !0),
211
- class: j({ "mc-diagram-switch-active": l.value })
212
- },
213
- V(v(r)("Md.diagram")),
214
- 3
215
- /* TEXT, CLASS */
216
- ),
217
- M(
218
- "li",
219
- {
220
- onClick: e[1] || (e[1] = (o) => l.value = !1),
221
- class: j({ "mc-diagram-switch-active": !l.value })
222
- },
223
- V(v(r)("Md.code")),
224
- 3
225
- /* TEXT, CLASS */
226
- )
227
- ],
228
- 2
229
- /* CLASS */
230
- )
231
- ])) : O("v-if", !0),
232
- c.value && l.value ? (C(), L("div", {
233
- key: 1,
234
- class: "mc-action-btn mc-toggle-btn",
235
- title: v(r)("Md.zoomIn"),
236
- onClick: E
237
- }, [...e[3] || (e[3] = [
238
- M(
239
- "img",
240
- { src: je },
241
- null,
242
- -1
243
- /* CACHED */
244
- )
245
- ])], 8, We)) : O("v-if", !0),
246
- c.value && l.value ? (C(), L("div", {
247
- key: 2,
129
+ T(e.$slots, "actions", {}, () => [
130
+ D("div", ce, [
131
+ D("div", {
248
132
  class: "mc-action-btn mc-toggle-btn",
249
- title: v(r)("Md.zoomOut"),
250
- onClick: I
251
- }, [...e[4] || (e[4] = [
252
- M(
133
+ onClick: a
134
+ }, g[1] || (g[1] = [
135
+ D(
253
136
  "img",
254
- { src: ke },
137
+ { src: te },
255
138
  null,
256
139
  -1
257
- /* CACHED */
140
+ /* HOISTED */
258
141
  )
259
- ])], 8, Ze)) : O("v-if", !0),
260
- c.value && l.value ? (C(), L("div", {
261
- key: 3,
262
- class: "mc-action-btn mc-toggle-btn",
263
- title: v(r)("Md.downLoad"),
264
- onClick: Y
265
- }, [...e[5] || (e[5] = [
266
- M(
267
- "img",
268
- { src: be },
269
- null,
270
- -1
271
- /* CACHED */
272
- )
273
- ])], 8, Ye)) : O("v-if", !0),
274
- M("div", {
275
- class: "mc-action-btn mc-toggle-btn",
276
- title: v(r)("Md.toggle"),
277
- onClick: P
278
- }, [...e[6] || (e[6] = [
279
- M(
280
- "img",
281
- { src: Se },
282
- null,
283
- -1
284
- /* CACHED */
285
- )
286
- ])], 8, Pe),
287
- M("div", {
142
+ ])),
143
+ D("div", {
288
144
  class: "mc-action-btn mc-copy-btn",
289
- title: v(r)("Md.copy"),
290
- onClick: e[2] || (e[2] = //@ts-ignore
291
- (...o) => v(B) && v(B)(...o))
145
+ onClick: g[0] || (g[0] = //@ts-ignore
146
+ (...c) => b(M) && b(M)(...c))
292
147
  }, [
293
- d.value ? (C(), L("img", He)) : (C(), L("img", Ge))
294
- ], 8, Qe)
148
+ s.value ? (I(), u("img", re)) : (I(), u("img", ae))
149
+ ])
295
150
  ])
296
151
  ], !0)
297
152
  ])),
298
- pe(ye, {
153
+ Q(G, {
299
154
  name: "collapse-transition",
300
- onBeforeEnter: Q,
301
- onEnter: G,
302
- onAfterEnter: U,
303
- onBeforeLeave: b,
304
- onLeave: H,
305
- onAfterLeave: F,
306
- persisted: ""
155
+ onBeforeEnter: A,
156
+ onEnter: p,
157
+ onAfterEnter: k,
158
+ onBeforeLeave: i,
159
+ onLeave: n,
160
+ onAfterLeave: d
307
161
  }, {
308
- default: fe(() => [
309
- Me(M(
310
- "div",
311
- null,
312
- [
313
- c.value && l.value && !t.$slots.content ? (C(), L("div", Fe)) : t.$slots.content ? R(t.$slots, "content", { key: 2 }, void 0, !0) : (C(), L("pre", $e, [
314
- M("code", {
315
- class: j(`hljs language-${i.language}`),
316
- innerHTML: h.value
317
- }, null, 10, Xe)
318
- ]))
319
- ],
320
- 512
321
- /* NEED_PATCH */
322
- ), [
323
- [Ce, g.value]
324
- ])
162
+ default: H(() => [
163
+ r.value ? (I(), u("div", le, [
164
+ e.$slots.content ? T(e.$slots, "content", { key: 1 }, void 0, !0) : (I(), u("pre", de, [
165
+ D("code", {
166
+ class: x(`hljs language-${l.language}`),
167
+ innerHTML: m.value
168
+ }, null, 10, ge)
169
+ ]))
170
+ ])) : U("v-if", !0)
325
171
  ]),
326
172
  _: 3
327
173
  /* FORWARDED */
@@ -331,42 +177,20 @@ const Be = {
331
177
  /* CLASS */
332
178
  ));
333
179
  }
334
- }), ae = (i, s) => {
335
- const r = i.__vccOpts || i;
336
- for (const [a, n] of s)
337
- r[a] = n;
338
- return r;
339
- }, Ve = /* @__PURE__ */ ae(Re, [["__scopeId", "data-v-6332bb90"]]), ne = {
340
- step: 2,
341
- interval: 50,
342
- style: "normal"
343
- }, Ke = {
180
+ }), z = (l, t) => {
181
+ const o = l.__vccOpts || l;
182
+ for (const [r, s] of t)
183
+ o[r] = s;
184
+ return o;
185
+ }, he = /* @__PURE__ */ z(Me, [["__scopeId", "data-v-675aa633"]]), Ie = {
344
186
  content: {
345
187
  type: String,
346
188
  default: ""
347
189
  },
348
- typing: {
349
- type: Boolean,
350
- default: !1
351
- },
352
190
  enableThink: {
353
191
  type: Boolean,
354
192
  default: !1
355
193
  },
356
- typingOptions: {
357
- step: {
358
- type: Number,
359
- default: 2
360
- },
361
- interval: {
362
- type: [Number, Array],
363
- default: 60
364
- },
365
- style: {
366
- type: String,
367
- default: "normal"
368
- }
369
- },
370
194
  thinkOptions: {
371
195
  customClass: {
372
196
  type: String,
@@ -388,323 +212,145 @@ const Be = {
388
212
  theme: {
389
213
  type: String,
390
214
  default: "light"
391
- },
392
- enableMermaid: {
393
- type: Boolean,
394
- default: !1
395
- },
396
- mermaidConfig: {
397
- type: Object,
398
- default: () => ({})
399
215
  }
400
- }, Je = (i, s) => {
401
- const r = (i == null ? void 0 : i.content) || "", a = (s == null ? void 0 : s.content) || "", n = r.match(/<(\w+)/), g = a.match(/<\/(\w+)/);
402
- return n && g ? n[1] === g[1] : !1;
403
- }, qe = (i) => {
404
- const s = i.content || "";
405
- if (s.match(/<(\w+)[^>]*\/>/))
406
- return !0;
407
- const r = [], a = /<(\w+)[^>]*>/g, n = /<\/(\w+)>/g;
408
- let g, d;
409
- a.lastIndex = 0, n.lastIndex = 0;
410
- const l = [];
411
- for (; (g = a.exec(s)) !== null; )
412
- l.push({
413
- type: "open",
414
- tagName: g[1],
415
- index: g.index
416
- });
417
- for (; (d = n.exec(s)) !== null; )
418
- l.push({
419
- type: "close",
420
- tagName: d[1],
421
- index: d.index
422
- });
423
- l.sort((c, h) => c.index - h.index);
424
- for (const c of l)
425
- if (c.type === "open")
426
- r.push(c.tagName);
427
- else {
428
- if (r.length === 0 || r[r.length - 1] !== c.tagName)
429
- return !1;
430
- r.pop();
431
- }
432
- return r.length === 0;
433
- }, K = (i) => ({
434
- nodeType: i ? i.type.replace("_open", "") : "root",
435
- openNode: i,
436
- closeNode: null,
437
- children: [],
438
- vNodeKey: (i == null ? void 0 : i.vNodeKey) || ""
439
- }), et = (i, s) => {
440
- const r = i.content.startsWith("</");
441
- if (!s.length) {
442
- i.nesting = r ? 0 : 1, s.push(i);
443
- return;
444
- }
445
- const a = s[s.length - 1];
446
- Je(a, i) ? (i.nesting = -1, s.pop()) : r ? i.nesting = 0 : (i.nesting = 1, s.push(i));
447
- }, de = (i) => {
448
- const s = (l) => {
449
- const c = K(l);
450
- return l.children && l.children.length > 0 && (c.children = de(l.children)), c;
451
- }, r = K(null);
452
- let a = r;
453
- const n = [], g = [], d = [];
454
- return i.forEach((l, c) => {
455
- if (l.vNodeKey = `mc-markdown-content-key-${c}`, l.tokenIndex = c, l.type.includes("html_")) {
456
- if (qe(l)) {
457
- l.nesting = 0;
458
- return;
459
- }
460
- const h = l.type === "html_block" ? d : g;
461
- et(l, h);
462
- }
463
- }), i.forEach((l, c) => {
464
- let h;
465
- if (l.nesting === 1)
466
- h = K(l), a.children.push(h), n.push(a), a = h;
467
- else if (l.nesting === -1) {
468
- if (a.closeNode = l, !n.length)
469
- throw new Error("AST stack underflow.");
470
- h = n.pop(), a = h;
471
- } else if (l.nesting === 0)
472
- if (l.type === "inline" && l.children && l.children.length > 0) {
473
- const w = s(l);
474
- a.children.push(w);
475
- } else
476
- a.children.push(l);
477
- else
478
- throw new Error(`Invalid nesting level found in token index ${c}.`);
479
- }), r.children;
480
- }, _ = (i) => {
481
- if (!i || !i.trim()) return [];
482
- if (typeof window > "u" || typeof DOMParser > "u")
483
- return [i];
484
- const r = new DOMParser().parseFromString(`<body>${i}</body>`, "text/html"), a = [];
485
- return r.body.childNodes.forEach((n, g) => {
486
- const d = ge(n);
487
- (le(d) || typeof d == "string") && (typeof d == "object" && (d.key = g), a.push(d));
488
- }), a;
489
- }, ge = (i) => {
490
- if (i.nodeType === Node.TEXT_NODE) return i.textContent;
491
- if (i.nodeType !== Node.ELEMENT_NODE) return i.textContent || "";
492
- const s = i, r = {};
493
- if (s.hasAttributes() && s.attributes)
494
- for (const n of Array.from(s.attributes))
495
- r[n.name] = n.value;
496
- const a = [];
497
- return s.childNodes.length > 0 && s.childNodes.forEach((n) => {
498
- const g = ge(n);
499
- (le(g) || typeof g == "string") && a.push(g);
500
- }), Z(s.tagName) ? f(s.tagName.toLowerCase(), r, a) : (i == null ? void 0 : i.textContent) || "";
501
- }, Z = (i) => {
502
- if (!i) return !1;
503
- try {
504
- return document.createElement(i), !0;
505
- } catch {
506
- return !1;
507
- }
508
- }, tt = /* @__PURE__ */ oe({
216
+ }, ue = /* @__PURE__ */ E({
509
217
  __name: "mdCard",
510
- props: Ke,
511
- emits: ["afterMdtInit", "typingStart", "typing", "typingEnd"],
512
- setup(i, { expose: s, emit: r }) {
513
- const a = new ce(), n = i, g = r, d = we();
514
- let l = null;
515
- const c = Ie({
218
+ props: Ie,
219
+ emits: ["afterMdtInit"],
220
+ setup(l, { expose: t, emit: o }) {
221
+ const r = new W(), s = l, m = o, a = Z(), M = K({
516
222
  breaks: !0,
517
223
  linkify: !0,
518
224
  html: !0,
519
- highlight: (e, o) => {
520
- if (o && D.getLanguage(o))
225
+ highlight: (i, n) => {
226
+ if (n && C.getLanguage(n))
521
227
  try {
522
- return D.highlight(e, { language: o }).value;
228
+ return C.highlight(i, { language: n }).value;
523
229
  } catch {
524
230
  }
525
231
  return "";
526
232
  },
527
- ...n.mdOptions
528
- }), h = x(0), w = x(!1), E = x(), I = () => {
529
- var m;
530
- let e = n.content || "";
531
- if (n.typing && w.value) {
532
- e = n.content.slice(0, h.value) || "";
533
- const p = { ...ne, ...n == null ? void 0 : n.typingOptions };
534
- p.style === "cursor" ? e += '<span class="mc-typewriter mc-typewriter-cursor">|</span>' : (p.style === "color" || p.style === "gradient") && (e = e.slice(0, -5) + `<span class="mc-typewriter mc-typewriter-${p.style}">${e.slice(-5)}</span>`);
535
- }
536
- if (n.enableThink) {
537
- const p = ((m = n.thinkOptions) == null ? void 0 : m.customClass) || "mc-think-block";
538
- e = (e == null ? void 0 : e.replace("<think>", `<div class="${p}">`).replace("</think>", "</div>")) || "";
539
- }
540
- const o = c.parse(e, {}), u = de(o), y = Y(u);
541
- E.value = f(A, y);
542
- }, Y = (e) => e.map((o) => N(o)), N = (e) => {
543
- var o, u;
544
- if (e.nodeType === "html_inline" || e.nodeType === "html_block") {
545
- const y = _(((o = e.openNode) == null ? void 0 : o.content) || "");
546
- if (!y || y.length === 0)
547
- return f("span", ((u = e.openNode) == null ? void 0 : u.content) || "");
548
- const m = y.map((p) => {
549
- if (typeof p == "string")
550
- return f("span", p);
551
- const S = e.children.map((T) => N(T));
552
- return Array.isArray(p.children) ? p.children = [...p.children, ...S] : p.children = [p.children, ...S].filter((T) => T), p;
233
+ ...s.mdOptions
234
+ });
235
+ M.renderer.rules.fence = (i, n) => `<!----MC_MARKDOWN_CODE_BLOCK_${n}---->`;
236
+ const A = (i, n, d) => {
237
+ const h = {
238
+ actions: () => {
239
+ var e;
240
+ return (e = a.actions) == null ? void 0 : e.call(a, {
241
+ codeBlockData: {
242
+ code: n,
243
+ language: i
244
+ }
245
+ });
246
+ }
247
+ };
248
+ return a.header && (h.header = () => {
249
+ var e;
250
+ return (e = a.header) == null ? void 0 : e.call(a, {
251
+ codeBlockData: {
252
+ code: n,
253
+ language: i
254
+ }
553
255
  });
554
- return f(A, m);
555
- }
556
- if (e.nodeType === "inline") {
557
- const y = c.renderer.render([e.openNode], c.options, {}), m = _(y);
558
- return f(A, m);
559
- }
560
- return P(e) ? B(e) : G(e);
561
- }, P = (e) => "type" in e && "content" in e, B = (e) => {
562
- if (e.type === "text")
563
- return e.content;
564
- if (e.type === "inline")
565
- return Q(e);
566
- if (e.type === "fence")
567
- return U(e);
568
- if (e.type === "softbreak")
569
- return c.options.breaks ? f("br") : `
570
- `;
571
- if (e.type === "html_block" || e.type === "html_inline")
572
- return e.type === "html_block" ? f("div", { innerHTML: e.content }) : f("span", { innerHTML: e.content });
573
- if (e.type === "math_block" && e.markup === "$$") {
574
- const o = c.renderer.render([e], c.options, {}), u = _(o);
575
- return f(A, u);
576
- }
577
- if (e.tag) {
578
- const o = Z(e.tag) ? e.tag : "div", u = b(e.attrs || []);
579
- return f(o, { ...u, key: e.vNodeKey }, e.content);
580
- }
581
- return e.content;
582
- }, Q = (e) => {
583
- const o = c.renderer.render([e], c.options, {}), u = _(o);
584
- return f(A, u);
585
- }, G = (e) => {
586
- var m, p, S, T, J, q, ee, te, se;
587
- let o = "div";
588
- (m = e.openNode) != null && m.tag && Z((p = e.openNode) == null ? void 0 : p.tag) && (o = (S = e.openNode) == null ? void 0 : S.tag);
589
- const u = b(((T = e.openNode) == null ? void 0 : T.attrs) || []);
590
- if (((J = e.openNode) == null ? void 0 : J.type) === "fence")
591
- return U(e.openNode);
592
- if ((q = e.openNode) != null && q.tag) {
593
- let X = Z((ee = e.openNode) == null ? void 0 : ee.tag) ? (te = e.openNode) == null ? void 0 : te.tag : "div";
594
- const ue = e.children.map((me) => N(me)), he = b(((se = e.openNode) == null ? void 0 : se.attrs) || []);
595
- return f(X, { ...he, key: e.vNodeKey }, ue);
596
- }
597
- const y = e.children.map((X) => N(X));
598
- return f(o, { ...u, key: e.vNodeKey }, y);
599
- }, U = (e) => {
600
- var y;
601
- const o = ((y = e.info) == null ? void 0 : y.replace(/<span\b[^>]*>/i, "").replace("</span>", "")) || "", u = e.content;
602
- return H(o, u, e.tokenIndex);
603
- }, b = (e) => e.reduce((o, [u, y]) => (o[u] = y, o), {});
604
- k(
605
- () => {
256
+ }), a.content && (h.content = () => {
606
257
  var e;
607
- return [n.enableThink, (e = n.thinkOptions) == null ? void 0 : e.customClass, n.theme];
608
- },
609
- () => {
610
- I();
611
- }
612
- );
613
- const H = (e, o, u) => {
614
- const y = {
615
- actions: d.actions ? () => {
616
- var m;
617
- return ((m = d.actions) == null ? void 0 : m.call(d, { codeBlockData: { code: o, language: e } })) || null;
618
- } : void 0,
619
- header: d.header ? () => {
620
- var m;
621
- return ((m = d.header) == null ? void 0 : m.call(d, { codeBlockData: { code: o, language: e } })) || null;
622
- } : void 0,
623
- content: d.content ? () => {
624
- var m;
625
- return ((m = d.content) == null ? void 0 : m.call(d, { codeBlockData: { code: o, language: e } })) || null;
626
- } : void 0
627
- };
628
- return f(
629
- Ve,
258
+ return (e = a.content) == null ? void 0 : e.call(a, {
259
+ codeBlockData: {
260
+ code: n,
261
+ language: i
262
+ }
263
+ });
264
+ }), w(
265
+ he,
630
266
  {
631
- language: e,
632
- code: o,
633
- blockIndex: u,
634
- theme: n.theme,
635
- enableMermaid: n.enableMermaid,
636
- mermaidConfig: n.mermaidConfig,
637
- key: `code-block-${u}`
267
+ language: i,
268
+ code: n,
269
+ blockIndex: d,
270
+ theme: s.theme
638
271
  },
639
- y
272
+ h
640
273
  );
641
- }, F = () => {
642
- clearTimeout(l), w.value = !0, g("typingStart");
643
- const e = { ...ne, ...n == null ? void 0 : n.typingOptions }, o = () => {
644
- let u = e.step;
645
- if (Array.isArray(e.step) && (u = e.step[0] + Math.floor(Math.random() * (e.step[1] - e.step[0]))), h.value += u, I(), g("typing"), h.value >= n.content.length) {
646
- $(), I();
647
- return;
274
+ }, p = y(() => {
275
+ var h, e;
276
+ let i = s.content || "";
277
+ if (s.enableThink) {
278
+ const g = ((h = s.thinkOptions) == null ? void 0 : h.customClass) || "mc-think-block";
279
+ i = ((e = s.content) == null ? void 0 : e.replace("<think>", `<div class="${g}">`).replace("</think>", "</div>")) || "";
280
+ }
281
+ const n = M.parse(i, {}), d = M.render(i);
282
+ return {
283
+ name: "MarkdownRenderer",
284
+ render() {
285
+ if (typeof document > "u")
286
+ return;
287
+ const g = document.createElement("div");
288
+ g.innerHTML = d;
289
+ const c = [];
290
+ let L = 0, N;
291
+ const f = /<!----MC_MARKDOWN_CODE_BLOCK_(\d+)---->/g;
292
+ let j = 0;
293
+ for (; N = f.exec(d), !!N; ) {
294
+ N.index > L && c.push(
295
+ w("div", {
296
+ innerHTML: d.slice(L, N.index)
297
+ })
298
+ );
299
+ const v = n[Number.parseInt(N[1])], _ = v.info || "", Y = v.content;
300
+ c.push(A(_, Y, j)), j++, L = f.lastIndex;
301
+ }
302
+ return L < d.length && c.push(
303
+ w("div", {
304
+ innerHTML: d.slice(L)
305
+ })
306
+ ), w("div", c);
648
307
  }
649
- l = setTimeout(o, e.interval);
650
308
  };
651
- l = setTimeout(o);
652
- };
653
- k(
654
- () => n.content,
655
- (e, o) => {
656
- if (!n.typing) {
657
- h.value = (e == null ? void 0 : e.length) || 0, I();
658
- return;
659
- }
660
- e.indexOf(o) === -1 && (h.value = 0), W(() => F());
661
- },
662
- { immediate: !0 }
663
- );
664
- const $ = () => {
665
- w.value = !1, g("typingEnd");
666
- };
667
- k(
668
- () => n.customXssRules,
669
- (e) => {
670
- a.setCustomXssRules(e), I();
671
- },
672
- { deep: !1 }
673
- ), k(
674
- () => n.mdPlugins,
675
- (e) => {
676
- a.setMdPlugins(e, c), I();
309
+ });
310
+ S(
311
+ () => s.customXssRules,
312
+ (i) => {
313
+ r.setCustomXssRules(i);
314
+ }
315
+ ), S(
316
+ () => s.mdPlugins,
317
+ (i) => {
318
+ r.setMdPlugins(i, M);
677
319
  },
678
- { immediate: !0, deep: !1 }
320
+ {
321
+ immediate: !0
322
+ }
679
323
  );
680
- const t = z(() => n.theme === "dark" ? "mc-markdown-render-dark" : "mc-markdown-render-light");
681
- return re(() => {
682
- g("afterMdtInit", c);
683
- }), s({ mdt: c }), (e, o) => (C(), L(
684
- A,
324
+ const k = y(() => s.theme === "dark" ? "mc-markdown-render-dark" : "mc-markdown-render-light");
325
+ return X(() => {
326
+ m("afterMdtInit", M);
327
+ }), t({
328
+ mdt: M
329
+ }), (i, n) => (I(), u(
330
+ R,
685
331
  null,
686
332
  [
687
- M(
333
+ D(
688
334
  "div",
689
335
  {
690
- class: j(["mc-markdown-render", t.value])
336
+ class: x(["mc-markdown-render", k.value])
691
337
  },
692
338
  [
693
- (C(), Le(ve(E.value)))
339
+ (I(), F(V(p.value)))
694
340
  ],
695
341
  2
696
342
  /* CLASS */
697
343
  ),
698
- O("v-if", !0)
344
+ U("v-if", !0)
699
345
  ],
700
346
  64
701
347
  /* STABLE_FRAGMENT */
702
348
  ));
703
349
  }
704
- }), ie = /* @__PURE__ */ ae(tt, [["__scopeId", "data-v-794093aa"]]);
705
- ie.install = (i) => {
706
- i.component("McMarkdownCard", ie);
350
+ }), B = /* @__PURE__ */ z(ue, [["__scopeId", "data-v-0183c1e8"]]);
351
+ B.install = (l) => {
352
+ l.component("McMarkdownCard", B);
707
353
  };
708
354
  export {
709
- ie as McMarkdownCard
355
+ B as McMarkdownCard
710
356
  };