pcm-agents 1.0.19 → 1.0.20

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 (337) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/app-globals-BIO4q6tX.js.map +1 -1
  3. package/dist/cjs/{components-chat-message_33.cjs.entry.js → components-chat-message_31.cjs.entry.js} +2429 -320
  4. package/dist/cjs/components-chat-message_31.cjs.entry.js.map +1 -0
  5. package/dist/cjs/components-oem-virtual-chat-modal.cjs.entry.js +2 -2
  6. package/dist/cjs/{conversation-utils-CKlwCDRf.js → conversation-utils-s_nVpMzq.js} +4 -4
  7. package/dist/cjs/{conversation-utils-CKlwCDRf.js.map → conversation-utils-s_nVpMzq.js.map} +1 -1
  8. package/dist/cjs/index-C_qhED9Z.js +2 -2
  9. package/dist/cjs/{index-DLbq5wiz.js → index-DAdBAmyB.js} +3 -3
  10. package/dist/cjs/{index-DLbq5wiz.js.map → index-DAdBAmyB.js.map} +1 -1
  11. package/dist/cjs/index.cjs.js +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/markdown-D3_atg0b.js +2564 -0
  14. package/dist/cjs/{markdown-C0QWZi9Q.js.map → markdown-D3_atg0b.js.map} +1 -1
  15. package/dist/cjs/oem-cast-modal.cjs.entry.js +1 -1
  16. package/dist/cjs/oem-htws-modal.cjs.entry.js +6 -2
  17. package/dist/cjs/oem-htws-modal.cjs.entry.js.map +1 -1
  18. package/dist/cjs/oem-htws-modal.entry.cjs.js.map +1 -1
  19. package/dist/cjs/oem-jd-modal.cjs.entry.js +7 -3
  20. package/dist/cjs/oem-jd-modal.cjs.entry.js.map +1 -1
  21. package/dist/cjs/oem-jd-modal.entry.cjs.js.map +1 -1
  22. package/dist/cjs/oem-jlpp-modal.cjs.entry.js +6 -2
  23. package/dist/cjs/oem-jlpp-modal.cjs.entry.js.map +1 -1
  24. package/dist/cjs/oem-jlpp-modal.entry.cjs.js.map +1 -1
  25. package/dist/cjs/oem-jlzz-modal.cjs.entry.js +7 -3
  26. package/dist/cjs/oem-jlzz-modal.cjs.entry.js.map +1 -1
  27. package/dist/cjs/oem-jlzz-modal.entry.cjs.js.map +1 -1
  28. package/dist/cjs/oem-mnct-modal.cjs.entry.js +6 -2
  29. package/dist/cjs/oem-mnct-modal.cjs.entry.js.map +1 -1
  30. package/dist/cjs/oem-mnct-modal.entry.cjs.js.map +1 -1
  31. package/dist/cjs/oem-mnms-modal.cjs.entry.js +7 -3
  32. package/dist/cjs/oem-mnms-modal.cjs.entry.js.map +1 -1
  33. package/dist/cjs/oem-mnms-modal.entry.cjs.js.map +1 -1
  34. package/dist/cjs/oem-qgqjl-modal.cjs.entry.js +9 -5
  35. package/dist/cjs/oem-qgqjl-modal.cjs.entry.js.map +1 -1
  36. package/dist/cjs/oem-qgqjl-modal.entry.cjs.js.map +1 -1
  37. package/dist/cjs/pcm-agents.cjs.js +1 -1
  38. package/dist/cjs/pcm-hr-chat-modal.cjs.entry.js +2 -2
  39. package/dist/cjs/pcm-jlsx-modal.cjs.entry.js +8 -4
  40. package/dist/cjs/pcm-jlsx-modal.cjs.entry.js.map +1 -1
  41. package/dist/cjs/pcm-jlsx-modal.entry.cjs.js.map +1 -1
  42. package/dist/cjs/{sentry-reporter-BmrqhSKs.js → sentry-reporter-DR35XbVc.js} +3 -3
  43. package/dist/cjs/{sentry-reporter-BmrqhSKs.js.map → sentry-reporter-DR35XbVc.js.map} +1 -1
  44. package/dist/collection/collection-manifest.json +0 -2
  45. package/dist/collection/components/components-upload/components-upload.js +1 -1
  46. package/dist/collection/components/components-voice-input-btn/components-voice-input-btn.css +67 -67
  47. package/dist/collection/components/components-voice-input-btn/components-voice-input-btn.js +2 -2
  48. package/dist/collection/components/components-voice-input-btn/components-voice-input-btn.js.map +1 -1
  49. package/dist/collection/components/oem-cast-modal/oem-cast-modal.js +1 -1
  50. package/dist/collection/components/oem-htws-modal/oem-htws-modal.js +25 -1
  51. package/dist/collection/components/oem-htws-modal/oem-htws-modal.js.map +1 -1
  52. package/dist/collection/components/oem-jd-modal/oem-jd-modal.js +25 -1
  53. package/dist/collection/components/oem-jd-modal/oem-jd-modal.js.map +1 -1
  54. package/dist/collection/components/oem-jlpp-modal/oem-jlpp-modal.js +25 -1
  55. package/dist/collection/components/oem-jlpp-modal/oem-jlpp-modal.js.map +1 -1
  56. package/dist/collection/components/oem-jlsx-modal/oem-jlsx-modal.js +25 -1
  57. package/dist/collection/components/oem-jlsx-modal/oem-jlsx-modal.js.map +1 -1
  58. package/dist/collection/components/oem-jlzz-modal/oem-jlzz-modal.js +26 -2
  59. package/dist/collection/components/oem-jlzz-modal/oem-jlzz-modal.js.map +1 -1
  60. package/dist/collection/components/oem-mnct-modal/oem-mnct-modal.js +25 -1
  61. package/dist/collection/components/oem-mnct-modal/oem-mnct-modal.js.map +1 -1
  62. package/dist/collection/components/oem-mnms-modal/oem-mnms-modal.js +26 -2
  63. package/dist/collection/components/oem-mnms-modal/oem-mnms-modal.js.map +1 -1
  64. package/dist/collection/components/oem-qgqjl-modal/oem-qgqjl-modal.js +26 -2
  65. package/dist/collection/components/oem-qgqjl-modal/oem-qgqjl-modal.js.map +1 -1
  66. package/dist/collection/components/oem-zygh-modal/oem-zygh-modal.js +26 -2
  67. package/dist/collection/components/oem-zygh-modal/oem-zygh-modal.js.map +1 -1
  68. package/dist/collection/components/pcm-1zhanshi-mnms-modal/pcm-1zhanshi-mnms-modal.js +25 -1
  69. package/dist/collection/components/pcm-1zhanshi-mnms-modal/pcm-1zhanshi-mnms-modal.js.map +1 -1
  70. package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.js +25 -1
  71. package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.js.map +1 -1
  72. package/dist/collection/components/pcm-ats-mnms-modal/pcm-ats-mnms-modal.js +25 -1
  73. package/dist/collection/components/pcm-ats-mnms-modal/pcm-ats-mnms-modal.js.map +1 -1
  74. package/dist/collection/components/pcm-htws-modal/pcm-htws-modal.js +25 -1
  75. package/dist/collection/components/pcm-htws-modal/pcm-htws-modal.js.map +1 -1
  76. package/dist/collection/components/pcm-hyzj-modal/pcm-hyzj-modal.js +25 -1
  77. package/dist/collection/components/pcm-hyzj-modal/pcm-hyzj-modal.js.map +1 -1
  78. package/dist/collection/components/pcm-jd-modal/pcm-jd-modal.js +25 -1
  79. package/dist/collection/components/pcm-jd-modal/pcm-jd-modal.js.map +1 -1
  80. package/dist/collection/components/pcm-jlpp-modal/pcm-jlpp-modal.js +25 -1
  81. package/dist/collection/components/pcm-jlpp-modal/pcm-jlpp-modal.js.map +1 -1
  82. package/dist/collection/components/pcm-jlsx-modal/pcm-jlsx-modal.js +25 -1
  83. package/dist/collection/components/pcm-jlsx-modal/pcm-jlsx-modal.js.map +1 -1
  84. package/dist/collection/components/pcm-jlzz-modal/pcm-jlzz-modal.js +26 -2
  85. package/dist/collection/components/pcm-jlzz-modal/pcm-jlzz-modal.js.map +1 -1
  86. package/dist/collection/components/pcm-mnct-modal/pcm-mnct-modal.js +26 -2
  87. package/dist/collection/components/pcm-mnct-modal/pcm-mnct-modal.js.map +1 -1
  88. package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.js +26 -2
  89. package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.js.map +1 -1
  90. package/dist/collection/components/pcm-mnms-zp-modal/pcm-mnms-zp-modal.js +26 -2
  91. package/dist/collection/components/pcm-mnms-zp-modal/pcm-mnms-zp-modal.js.map +1 -1
  92. package/dist/collection/components/pcm-msbg-modal/pcm-msbg-modal.js +25 -1
  93. package/dist/collection/components/pcm-msbg-modal/pcm-msbg-modal.js.map +1 -1
  94. package/dist/collection/components/pcm-qgqjl-modal/pcm-qgqjl-modal.js +26 -2
  95. package/dist/collection/components/pcm-qgqjl-modal/pcm-qgqjl-modal.js.map +1 -1
  96. package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.js +26 -2
  97. package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.js.map +1 -1
  98. package/dist/collection/components/pcm-zygh-v2-modal/pcm-zygh-v2-modal.js +26 -2
  99. package/dist/collection/components/pcm-zygh-v2-modal/pcm-zygh-v2-modal.js.map +1 -1
  100. package/dist/components/components-chat-message.js +1 -1
  101. package/dist/components/components-digital-human.js +1 -1
  102. package/dist/components/components-export-records-modal.js +1 -1
  103. package/dist/components/components-mobile-input-btn.js +1 -1
  104. package/dist/components/components-mobile-upload-btn.js +1 -1
  105. package/dist/components/components-oem-virtual-chat-modal.js +1 -1
  106. package/dist/components/components-position-selector.js +1 -1
  107. package/dist/components/components-thousand-resume-wrapper.js +1 -1
  108. package/dist/components/components-upload.js +1 -1
  109. package/dist/components/components-voice-input-btn.js +1 -1
  110. package/dist/components/index.js +1 -1
  111. package/dist/components/index.js.map +1 -1
  112. package/dist/components/oem-cast-modal.js +1 -1
  113. package/dist/components/oem-htws-modal.js +11 -6
  114. package/dist/components/oem-htws-modal.js.map +1 -1
  115. package/dist/components/oem-jd-modal.js +11 -6
  116. package/dist/components/oem-jd-modal.js.map +1 -1
  117. package/dist/components/oem-jlpp-modal.js +13 -8
  118. package/dist/components/oem-jlpp-modal.js.map +1 -1
  119. package/dist/components/oem-jlsx-modal.js +12 -7
  120. package/dist/components/oem-jlsx-modal.js.map +1 -1
  121. package/dist/components/oem-jlzz-modal.js +12 -7
  122. package/dist/components/oem-jlzz-modal.js.map +1 -1
  123. package/dist/components/oem-mnct-modal.js +13 -8
  124. package/dist/components/oem-mnct-modal.js.map +1 -1
  125. package/dist/components/oem-mnms-modal.js +15 -10
  126. package/dist/components/oem-mnms-modal.js.map +1 -1
  127. package/dist/components/oem-qgqjl-modal.js +16 -11
  128. package/dist/components/oem-qgqjl-modal.js.map +1 -1
  129. package/dist/components/oem-zygh-modal.js +11 -6
  130. package/dist/components/oem-zygh-modal.js.map +1 -1
  131. package/dist/components/{p-ChHHPVqa.js → p-53YKry0i.js} +12 -7
  132. package/dist/components/p-53YKry0i.js.map +1 -0
  133. package/dist/components/p-B85MJLTf.js +8 -0
  134. package/dist/components/p-B85MJLTf.js.map +1 -0
  135. package/dist/components/{p-CRuYvhDS.js → p-By3OtTlN.js} +3 -3
  136. package/dist/components/{p-CRuYvhDS.js.map → p-By3OtTlN.js.map} +1 -1
  137. package/dist/components/{p-BFBILVHb.js → p-C-RZ-vJH.js} +3 -3
  138. package/dist/components/{p-BFBILVHb.js.map → p-C-RZ-vJH.js.map} +1 -1
  139. package/dist/components/{p-BbgkkZ8z.js → p-C1pgC3Jv.js} +3 -3
  140. package/dist/components/{p-BbgkkZ8z.js.map → p-C1pgC3Jv.js.map} +1 -1
  141. package/dist/components/{p-OFgPkEGL.js → p-C4npZucW.js} +4 -4
  142. package/dist/components/{p-OFgPkEGL.js.map → p-C4npZucW.js.map} +1 -1
  143. package/dist/components/{p-CUgq8UDs.js → p-CPRmVvQS.js} +4 -4
  144. package/dist/components/p-CPRmVvQS.js.map +1 -0
  145. package/dist/components/{p-sXNEbeK0.js → p-CjAaZc9n.js} +3 -3
  146. package/dist/components/{p-sXNEbeK0.js.map → p-CjAaZc9n.js.map} +1 -1
  147. package/dist/components/{p-BsVthfPT.js → p-Cp8-JkXG.js} +4 -4
  148. package/dist/components/{p-BsVthfPT.js.map → p-Cp8-JkXG.js.map} +1 -1
  149. package/dist/components/p-D483moFs.js +2310 -0
  150. package/dist/components/p-D483moFs.js.map +1 -0
  151. package/dist/components/{p-DW7If7Qd.js → p-D9KmSj_x.js} +5 -4
  152. package/dist/components/p-D9KmSj_x.js.map +1 -0
  153. package/dist/components/{p-BM8LfA-I.js → p-DSd0hTX7.js} +4 -4
  154. package/dist/components/{p-BM8LfA-I.js.map → p-DSd0hTX7.js.map} +1 -1
  155. package/dist/components/{p-DMxCytIw.js → p-Dlk1tp9R.js} +4 -4
  156. package/dist/components/{p-DMxCytIw.js.map → p-Dlk1tp9R.js.map} +1 -1
  157. package/dist/components/{p-BMyYj4Nh.js → p-DrKxtpsI.js} +3 -3
  158. package/dist/components/{p-BMyYj4Nh.js.map → p-DrKxtpsI.js.map} +1 -1
  159. package/dist/components/p-DuXrU5Qi.js +2559 -0
  160. package/dist/components/p-DuXrU5Qi.js.map +1 -0
  161. package/dist/components/{p-aK_x2dmu.js → p-mVRqIhzD.js} +3 -3
  162. package/dist/components/{p-aK_x2dmu.js.map → p-mVRqIhzD.js.map} +1 -1
  163. package/dist/components/{p-C5cxtSmw.js → p-yzl8QYOf.js} +3 -3
  164. package/dist/components/{p-C5cxtSmw.js.map → p-yzl8QYOf.js.map} +1 -1
  165. package/dist/components/pcm-1zhanshi-mnms-modal.js +11 -6
  166. package/dist/components/pcm-1zhanshi-mnms-modal.js.map +1 -1
  167. package/dist/components/pcm-app-chat-modal.js +1 -1
  168. package/dist/components/pcm-ats-mnms-modal.js +11 -6
  169. package/dist/components/pcm-ats-mnms-modal.js.map +1 -1
  170. package/dist/components/pcm-hr-chat-modal.js +2 -2
  171. package/dist/components/pcm-htws-modal.js +14 -9
  172. package/dist/components/pcm-htws-modal.js.map +1 -1
  173. package/dist/components/pcm-hyzj-modal.js +11 -6
  174. package/dist/components/pcm-hyzj-modal.js.map +1 -1
  175. package/dist/components/pcm-jd-modal.js +12 -7
  176. package/dist/components/pcm-jd-modal.js.map +1 -1
  177. package/dist/components/pcm-jlpp-modal.js +14 -9
  178. package/dist/components/pcm-jlpp-modal.js.map +1 -1
  179. package/dist/components/pcm-jlsx-modal.js +12 -7
  180. package/dist/components/pcm-jlsx-modal.js.map +1 -1
  181. package/dist/components/pcm-jlzz-modal.js +13 -8
  182. package/dist/components/pcm-jlzz-modal.js.map +1 -1
  183. package/dist/components/pcm-mnct-modal.js +14 -9
  184. package/dist/components/pcm-mnct-modal.js.map +1 -1
  185. package/dist/components/pcm-mnms-modal.js +15 -10
  186. package/dist/components/pcm-mnms-modal.js.map +1 -1
  187. package/dist/components/pcm-mnms-zp-modal.js +15 -10
  188. package/dist/components/pcm-mnms-zp-modal.js.map +1 -1
  189. package/dist/components/pcm-msbg-modal.js +11 -6
  190. package/dist/components/pcm-msbg-modal.js.map +1 -1
  191. package/dist/components/pcm-qgqjl-modal.js +16 -11
  192. package/dist/components/pcm-qgqjl-modal.js.map +1 -1
  193. package/dist/components/pcm-virtual-chat-modal.js +1 -1
  194. package/dist/components/pcm-zsk-chat-modal.js +3 -3
  195. package/dist/components/pcm-zygh-modal.js +13 -8
  196. package/dist/components/pcm-zygh-modal.js.map +1 -1
  197. package/dist/components/pcm-zygh-v2-modal.js +13 -8
  198. package/dist/components/pcm-zygh-v2-modal.js.map +1 -1
  199. package/dist/esm/app-globals-Chti62re.js.map +1 -1
  200. package/dist/esm/{components-chat-message_33.entry.js → components-chat-message_31.entry.js} +2430 -319
  201. package/dist/esm/components-chat-message_31.entry.js.map +1 -0
  202. package/dist/esm/components-oem-virtual-chat-modal.entry.js +2 -2
  203. package/dist/esm/{conversation-utils-BGcxaSyr.js → conversation-utils-DQ2uwLtT.js} +4 -4
  204. package/dist/esm/{conversation-utils-BGcxaSyr.js.map → conversation-utils-DQ2uwLtT.js.map} +1 -1
  205. package/dist/esm/index-Bq0K-WqZ.js +2 -2
  206. package/dist/esm/{index-BaYctFVD.js → index-kfrWoYxt.js} +3 -3
  207. package/dist/esm/{index-BaYctFVD.js.map → index-kfrWoYxt.js.map} +1 -1
  208. package/dist/esm/index.js +1 -1
  209. package/dist/esm/loader.js +1 -1
  210. package/dist/esm/markdown-DcmYnk0q.js +2561 -0
  211. package/dist/esm/{markdown-CnhOGURu.js.map → markdown-DcmYnk0q.js.map} +1 -1
  212. package/dist/esm/oem-cast-modal.entry.js +1 -1
  213. package/dist/esm/oem-htws-modal.entry.js +6 -2
  214. package/dist/esm/oem-htws-modal.entry.js.map +1 -1
  215. package/dist/esm/oem-jd-modal.entry.js +7 -3
  216. package/dist/esm/oem-jd-modal.entry.js.map +1 -1
  217. package/dist/esm/oem-jlpp-modal.entry.js +6 -2
  218. package/dist/esm/oem-jlpp-modal.entry.js.map +1 -1
  219. package/dist/esm/oem-jlzz-modal.entry.js +7 -3
  220. package/dist/esm/oem-jlzz-modal.entry.js.map +1 -1
  221. package/dist/esm/oem-mnct-modal.entry.js +6 -2
  222. package/dist/esm/oem-mnct-modal.entry.js.map +1 -1
  223. package/dist/esm/oem-mnms-modal.entry.js +7 -3
  224. package/dist/esm/oem-mnms-modal.entry.js.map +1 -1
  225. package/dist/esm/oem-qgqjl-modal.entry.js +9 -5
  226. package/dist/esm/oem-qgqjl-modal.entry.js.map +1 -1
  227. package/dist/esm/pcm-agents.js +1 -1
  228. package/dist/esm/pcm-hr-chat-modal.entry.js +2 -2
  229. package/dist/esm/pcm-jlsx-modal.entry.js +8 -4
  230. package/dist/esm/pcm-jlsx-modal.entry.js.map +1 -1
  231. package/dist/esm/{sentry-reporter-CQ8bX8AM.js → sentry-reporter-YZTzmY6w.js} +3 -3
  232. package/dist/esm/{sentry-reporter-CQ8bX8AM.js.map → sentry-reporter-YZTzmY6w.js.map} +1 -1
  233. package/dist/pcm-agents/index.esm.js +1 -1
  234. package/dist/pcm-agents/oem-htws-modal.entry.esm.js.map +1 -1
  235. package/dist/pcm-agents/oem-jd-modal.entry.esm.js.map +1 -1
  236. package/dist/pcm-agents/oem-jlpp-modal.entry.esm.js.map +1 -1
  237. package/dist/pcm-agents/oem-jlzz-modal.entry.esm.js.map +1 -1
  238. package/dist/pcm-agents/oem-mnct-modal.entry.esm.js.map +1 -1
  239. package/dist/pcm-agents/oem-mnms-modal.entry.esm.js.map +1 -1
  240. package/dist/pcm-agents/oem-qgqjl-modal.entry.esm.js.map +1 -1
  241. package/dist/pcm-agents/p-17523d4c.entry.js +2 -0
  242. package/dist/pcm-agents/{p-52b8396f.entry.js → p-26996eda.entry.js} +2 -2
  243. package/dist/pcm-agents/p-26996eda.entry.js.map +1 -0
  244. package/dist/pcm-agents/{p-d25b1c70.entry.js → p-26f57e7b.entry.js} +2 -2
  245. package/dist/pcm-agents/p-26f57e7b.entry.js.map +1 -0
  246. package/dist/pcm-agents/{p-a33ebff7.entry.js → p-4d649f2a.entry.js} +2 -2
  247. package/dist/pcm-agents/p-4d649f2a.entry.js.map +1 -0
  248. package/dist/pcm-agents/{p-85b37d21.entry.js → p-54dc87b9.entry.js} +2 -2
  249. package/dist/pcm-agents/{p-07d0bfa5.entry.js → p-57c1b476.entry.js} +2 -2
  250. package/dist/pcm-agents/p-6ee0ae10.entry.js +8 -0
  251. package/dist/pcm-agents/p-6ee0ae10.entry.js.map +1 -0
  252. package/dist/pcm-agents/{p-415d021b.entry.js → p-7225d0ca.entry.js} +2 -2
  253. package/dist/pcm-agents/{p-86c15766.entry.js → p-893dbe28.entry.js} +2 -2
  254. package/dist/pcm-agents/p-893dbe28.entry.js.map +1 -0
  255. package/dist/pcm-agents/{p-BUe4kiCQ.js → p-Bd4_jEOe.js} +2 -2
  256. package/dist/pcm-agents/{p-BUe4kiCQ.js.map → p-Bd4_jEOe.js.map} +1 -1
  257. package/dist/pcm-agents/{p-DzZpAxqF.js → p-CGa8AOoe.js} +2 -2
  258. package/dist/pcm-agents/{p-DzZpAxqF.js.map → p-CGa8AOoe.js.map} +1 -1
  259. package/dist/pcm-agents/p-CeRTfvY9.js.map +1 -1
  260. package/dist/pcm-agents/p-DcmYnk0q.js +2 -0
  261. package/dist/pcm-agents/{p-CnhOGURu.js.map → p-DcmYnk0q.js.map} +1 -1
  262. package/dist/pcm-agents/{p-DpK1mBu7.js → p-I2lIWOKl.js} +2 -2
  263. package/dist/pcm-agents/{p-DpK1mBu7.js.map → p-I2lIWOKl.js.map} +1 -1
  264. package/dist/pcm-agents/{p-c95e6896.entry.js → p-ba2e1a60.entry.js} +2 -2
  265. package/dist/pcm-agents/{p-cd2844d8.entry.js → p-c9bddaf0.entry.js} +2 -2
  266. package/dist/pcm-agents/{p-900ade9f.entry.js → p-f1de36bb.entry.js} +2 -2
  267. package/dist/pcm-agents/p-f1de36bb.entry.js.map +1 -0
  268. package/dist/pcm-agents/pcm-agents.esm.js +1 -1
  269. package/dist/pcm-agents/pcm-jlsx-modal.entry.esm.js.map +1 -1
  270. package/dist/types/components/oem-htws-modal/oem-htws-modal.d.ts +4 -0
  271. package/dist/types/components/oem-jd-modal/oem-jd-modal.d.ts +4 -0
  272. package/dist/types/components/oem-jlpp-modal/oem-jlpp-modal.d.ts +4 -0
  273. package/dist/types/components/oem-jlsx-modal/oem-jlsx-modal.d.ts +4 -0
  274. package/dist/types/components/oem-jlzz-modal/oem-jlzz-modal.d.ts +4 -0
  275. package/dist/types/components/oem-mnct-modal/oem-mnct-modal.d.ts +4 -0
  276. package/dist/types/components/oem-mnms-modal/oem-mnms-modal.d.ts +4 -0
  277. package/dist/types/components/oem-qgqjl-modal/oem-qgqjl-modal.d.ts +4 -0
  278. package/dist/types/components/oem-zygh-modal/oem-zygh-modal.d.ts +4 -0
  279. package/dist/types/components/pcm-1zhanshi-mnms-modal/pcm-1zhanshi-mnms-modal.d.ts +4 -0
  280. package/dist/types/components/pcm-app-chat-modal/pcm-app-chat-modal.d.ts +4 -0
  281. package/dist/types/components/pcm-ats-mnms-modal/pcm-ats-mnms-modal.d.ts +4 -0
  282. package/dist/types/components/pcm-htws-modal/pcm-htws-modal.d.ts +4 -0
  283. package/dist/types/components/pcm-hyzj-modal/pcm-hyzj-modal.d.ts +4 -0
  284. package/dist/types/components/pcm-jd-modal/pcm-jd-modal.d.ts +4 -0
  285. package/dist/types/components/pcm-jlpp-modal/pcm-jlpp-modal.d.ts +4 -0
  286. package/dist/types/components/pcm-jlsx-modal/pcm-jlsx-modal.d.ts +4 -0
  287. package/dist/types/components/pcm-jlzz-modal/pcm-jlzz-modal.d.ts +4 -0
  288. package/dist/types/components/pcm-mnct-modal/pcm-mnct-modal.d.ts +4 -0
  289. package/dist/types/components/pcm-mnms-modal/pcm-mnms-modal.d.ts +4 -0
  290. package/dist/types/components/pcm-mnms-zp-modal/pcm-mnms-zp-modal.d.ts +4 -0
  291. package/dist/types/components/pcm-msbg-modal/pcm-msbg-modal.d.ts +4 -0
  292. package/dist/types/components/pcm-qgqjl-modal/pcm-qgqjl-modal.d.ts +4 -0
  293. package/dist/types/components/pcm-zygh-modal/pcm-zygh-modal.d.ts +4 -0
  294. package/dist/types/components/pcm-zygh-v2-modal/pcm-zygh-v2-modal.d.ts +4 -0
  295. package/dist/types/components.d.ts +200 -261
  296. package/package.json +1 -1
  297. package/readme.md +307 -307
  298. package/dist/cjs/components-chat-message_33.cjs.entry.js.map +0 -1
  299. package/dist/cjs/markdown-C0QWZi9Q.js +0 -2674
  300. package/dist/collection/components/pcm-button/pcm-button.css +0 -199
  301. package/dist/collection/components/pcm-button/pcm-button.js +0 -374
  302. package/dist/collection/components/pcm-button/pcm-button.js.map +0 -1
  303. package/dist/collection/components/pcm-card/pcm-card.css +0 -260
  304. package/dist/collection/components/pcm-card/pcm-card.js +0 -402
  305. package/dist/collection/components/pcm-card/pcm-card.js.map +0 -1
  306. package/dist/components/p-CUgq8UDs.js.map +0 -1
  307. package/dist/components/p-ChHHPVqa.js.map +0 -1
  308. package/dist/components/p-CnhOGURu.js +0 -2671
  309. package/dist/components/p-CnhOGURu.js.map +0 -1
  310. package/dist/components/p-DW7If7Qd.js.map +0 -1
  311. package/dist/components/pcm-button.d.ts +0 -11
  312. package/dist/components/pcm-button.js +0 -140
  313. package/dist/components/pcm-button.js.map +0 -1
  314. package/dist/components/pcm-card.d.ts +0 -11
  315. package/dist/components/pcm-card.js +0 -202
  316. package/dist/components/pcm-card.js.map +0 -1
  317. package/dist/esm/components-chat-message_33.entry.js.map +0 -1
  318. package/dist/esm/markdown-CnhOGURu.js +0 -2671
  319. package/dist/pcm-agents/p-52b8396f.entry.js.map +0 -1
  320. package/dist/pcm-agents/p-86c15766.entry.js.map +0 -1
  321. package/dist/pcm-agents/p-900ade9f.entry.js.map +0 -1
  322. package/dist/pcm-agents/p-CnhOGURu.js +0 -2
  323. package/dist/pcm-agents/p-a33ebff7.entry.js.map +0 -1
  324. package/dist/pcm-agents/p-be640465.entry.js +0 -2
  325. package/dist/pcm-agents/p-d25b1c70.entry.js.map +0 -1
  326. package/dist/pcm-agents/p-f2445cbd.entry.js +0 -8
  327. package/dist/pcm-agents/p-f2445cbd.entry.js.map +0 -1
  328. package/dist/types/components/pcm-button/pcm-button.d.ts +0 -64
  329. package/dist/types/components/pcm-card/pcm-card.d.ts +0 -79
  330. /package/dist/pcm-agents/{p-be640465.entry.js.map → p-17523d4c.entry.js.map} +0 -0
  331. /package/dist/pcm-agents/{p-85b37d21.entry.js.map → p-54dc87b9.entry.js.map} +0 -0
  332. /package/dist/pcm-agents/{p-07d0bfa5.entry.js.map → p-57c1b476.entry.js.map} +0 -0
  333. /package/dist/pcm-agents/{p-415d021b.entry.js.map → p-7225d0ca.entry.js.map} +0 -0
  334. /package/dist/pcm-agents/{p-c95e6896.entry.js.map → p-ba2e1a60.entry.js.map} +0 -0
  335. /package/dist/pcm-agents/{p-cd2844d8.entry.js.map → p-c9bddaf0.entry.js.map} +0 -0
  336. /package/dist/types/code/{sdk → agents-sdk}/packages/pcm-agents/.stencil/store/auth.store.d.ts +0 -0
  337. /package/dist/types/code/{sdk → agents-sdk}/packages/pcm-agents/.stencil/store/config.store.d.ts +0 -0
@@ -0,0 +1,2564 @@
1
+ 'use strict';
2
+
3
+ function getDefaultExportFromCjs (x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
+ }
6
+
7
+ function _classPrivateFieldLooseBase(e, t) { if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance"); return e; }
8
+ var id = 0;
9
+ function _classPrivateFieldLooseKey(e) { return "__private_" + id++ + "_" + e; }
10
+ /**
11
+ * marked v9.1.6 - a markdown parser
12
+ * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
13
+ * https://github.com/markedjs/marked
14
+ */
15
+
16
+ /**
17
+ * DO NOT EDIT THIS FILE
18
+ * The code in this file is generated from files in ./src/
19
+ */
20
+
21
+ /**
22
+ * Gets the original marked default options.
23
+ */
24
+ function _getDefaults() {
25
+ return {
26
+ async: false,
27
+ breaks: false,
28
+ extensions: null,
29
+ gfm: true,
30
+ hooks: null,
31
+ pedantic: false,
32
+ renderer: null,
33
+ silent: false,
34
+ tokenizer: null,
35
+ walkTokens: null
36
+ };
37
+ }
38
+ let _defaults = _getDefaults();
39
+ function changeDefaults(newDefaults) {
40
+ _defaults = newDefaults;
41
+ }
42
+
43
+ /**
44
+ * Helpers
45
+ */
46
+ const escapeTest = /[&<>"']/;
47
+ const escapeReplace = new RegExp(escapeTest.source, 'g');
48
+ const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
49
+ const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
50
+ const escapeReplacements = {
51
+ '&': '&amp;',
52
+ '<': '&lt;',
53
+ '>': '&gt;',
54
+ '"': '&quot;',
55
+ "'": '&#39;'
56
+ };
57
+ const getEscapeReplacement = ch => escapeReplacements[ch];
58
+ function escape(html, encode) {
59
+ if (encode) {
60
+ if (escapeTest.test(html)) {
61
+ return html.replace(escapeReplace, getEscapeReplacement);
62
+ }
63
+ } else {
64
+ if (escapeTestNoEncode.test(html)) {
65
+ return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
66
+ }
67
+ }
68
+ return html;
69
+ }
70
+ const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
71
+ function unescape(html) {
72
+ // explicitly match decimal, hex, and named HTML entities
73
+ return html.replace(unescapeTest, (_, n) => {
74
+ n = n.toLowerCase();
75
+ if (n === 'colon') return ':';
76
+ if (n.charAt(0) === '#') {
77
+ return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
78
+ }
79
+ return '';
80
+ });
81
+ }
82
+ const caret = /(^|[^\[])\^/g;
83
+ function edit(regex, opt) {
84
+ regex = typeof regex === 'string' ? regex : regex.source;
85
+ opt = opt || '';
86
+ const obj = {
87
+ replace: (name, val) => {
88
+ val = typeof val === 'object' && 'source' in val ? val.source : val;
89
+ val = val.replace(caret, '$1');
90
+ regex = regex.replace(name, val);
91
+ return obj;
92
+ },
93
+ getRegex: () => {
94
+ return new RegExp(regex, opt);
95
+ }
96
+ };
97
+ return obj;
98
+ }
99
+ function cleanUrl(href) {
100
+ try {
101
+ href = encodeURI(href).replace(/%25/g, '%');
102
+ } catch (e) {
103
+ return null;
104
+ }
105
+ return href;
106
+ }
107
+ const noopTest = {
108
+ exec: () => null
109
+ };
110
+ function splitCells(tableRow, count) {
111
+ // ensure that every cell-delimiting pipe has a space
112
+ // before it to distinguish it from an escaped pipe
113
+ const row = tableRow.replace(/\|/g, (match, offset, str) => {
114
+ let escaped = false;
115
+ let curr = offset;
116
+ while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
117
+ if (escaped) {
118
+ // odd number of slashes means | is escaped
119
+ // so we leave it alone
120
+ return '|';
121
+ } else {
122
+ // add space before unescaped |
123
+ return ' |';
124
+ }
125
+ }),
126
+ cells = row.split(/ \|/);
127
+ let i = 0;
128
+ // First/last cell in a row cannot be empty if it has no leading/trailing pipe
129
+ if (!cells[0].trim()) {
130
+ cells.shift();
131
+ }
132
+ if (cells.length > 0 && !cells[cells.length - 1].trim()) {
133
+ cells.pop();
134
+ }
135
+ if (count) {
136
+ if (cells.length > count) {
137
+ cells.splice(count);
138
+ } else {
139
+ while (cells.length < count) cells.push('');
140
+ }
141
+ }
142
+ for (; i < cells.length; i++) {
143
+ // leading or trailing whitespace is ignored per the gfm spec
144
+ cells[i] = cells[i].trim().replace(/\\\|/g, '|');
145
+ }
146
+ return cells;
147
+ }
148
+ /**
149
+ * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
150
+ * /c*$/ is vulnerable to REDOS.
151
+ *
152
+ * @param str
153
+ * @param c
154
+ * @param invert Remove suffix of non-c chars instead. Default falsey.
155
+ */
156
+ function rtrim(str, c, invert) {
157
+ const l = str.length;
158
+ if (l === 0) {
159
+ return '';
160
+ }
161
+ // Length of suffix matching the invert condition.
162
+ let suffLen = 0;
163
+ // Step left until we fail to match the invert condition.
164
+ while (suffLen < l) {
165
+ const currChar = str.charAt(l - suffLen - 1);
166
+ if (currChar === c && true) {
167
+ suffLen++;
168
+ } else {
169
+ break;
170
+ }
171
+ }
172
+ return str.slice(0, l - suffLen);
173
+ }
174
+ function findClosingBracket(str, b) {
175
+ if (str.indexOf(b[1]) === -1) {
176
+ return -1;
177
+ }
178
+ let level = 0;
179
+ for (let i = 0; i < str.length; i++) {
180
+ if (str[i] === '\\') {
181
+ i++;
182
+ } else if (str[i] === b[0]) {
183
+ level++;
184
+ } else if (str[i] === b[1]) {
185
+ level--;
186
+ if (level < 0) {
187
+ return i;
188
+ }
189
+ }
190
+ }
191
+ return -1;
192
+ }
193
+ function outputLink(cap, link, raw, lexer) {
194
+ const href = link.href;
195
+ const title = link.title ? escape(link.title) : null;
196
+ const text = cap[1].replace(/\\([\[\]])/g, '$1');
197
+ if (cap[0].charAt(0) !== '!') {
198
+ lexer.state.inLink = true;
199
+ const token = {
200
+ type: 'link',
201
+ raw,
202
+ href,
203
+ title,
204
+ text,
205
+ tokens: lexer.inlineTokens(text)
206
+ };
207
+ lexer.state.inLink = false;
208
+ return token;
209
+ }
210
+ return {
211
+ type: 'image',
212
+ raw,
213
+ href,
214
+ title,
215
+ text: escape(text)
216
+ };
217
+ }
218
+ function indentCodeCompensation(raw, text) {
219
+ const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
220
+ if (matchIndentToCode === null) {
221
+ return text;
222
+ }
223
+ const indentToCode = matchIndentToCode[1];
224
+ return text.split('\n').map(node => {
225
+ const matchIndentInNode = node.match(/^\s+/);
226
+ if (matchIndentInNode === null) {
227
+ return node;
228
+ }
229
+ const [indentInNode] = matchIndentInNode;
230
+ if (indentInNode.length >= indentToCode.length) {
231
+ return node.slice(indentToCode.length);
232
+ }
233
+ return node;
234
+ }).join('\n');
235
+ }
236
+ /**
237
+ * Tokenizer
238
+ */
239
+ class _Tokenizer {
240
+ constructor(options) {
241
+ this.options = void 0;
242
+ // TODO: Fix this rules type
243
+ this.rules = void 0;
244
+ this.lexer = void 0;
245
+ this.options = options || _defaults;
246
+ }
247
+ space(src) {
248
+ const cap = this.rules.block.newline.exec(src);
249
+ if (cap && cap[0].length > 0) {
250
+ return {
251
+ type: 'space',
252
+ raw: cap[0]
253
+ };
254
+ }
255
+ }
256
+ code(src) {
257
+ const cap = this.rules.block.code.exec(src);
258
+ if (cap) {
259
+ const text = cap[0].replace(/^ {1,4}/gm, '');
260
+ return {
261
+ type: 'code',
262
+ raw: cap[0],
263
+ codeBlockStyle: 'indented',
264
+ text: !this.options.pedantic ? rtrim(text, '\n') : text
265
+ };
266
+ }
267
+ }
268
+ fences(src) {
269
+ const cap = this.rules.block.fences.exec(src);
270
+ if (cap) {
271
+ const raw = cap[0];
272
+ const text = indentCodeCompensation(raw, cap[3] || '');
273
+ return {
274
+ type: 'code',
275
+ raw,
276
+ lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, '$1') : cap[2],
277
+ text
278
+ };
279
+ }
280
+ }
281
+ heading(src) {
282
+ const cap = this.rules.block.heading.exec(src);
283
+ if (cap) {
284
+ let text = cap[2].trim();
285
+ // remove trailing #s
286
+ if (/#$/.test(text)) {
287
+ const trimmed = rtrim(text, '#');
288
+ if (this.options.pedantic) {
289
+ text = trimmed.trim();
290
+ } else if (!trimmed || / $/.test(trimmed)) {
291
+ // CommonMark requires space before trailing #s
292
+ text = trimmed.trim();
293
+ }
294
+ }
295
+ return {
296
+ type: 'heading',
297
+ raw: cap[0],
298
+ depth: cap[1].length,
299
+ text,
300
+ tokens: this.lexer.inline(text)
301
+ };
302
+ }
303
+ }
304
+ hr(src) {
305
+ const cap = this.rules.block.hr.exec(src);
306
+ if (cap) {
307
+ return {
308
+ type: 'hr',
309
+ raw: cap[0]
310
+ };
311
+ }
312
+ }
313
+ blockquote(src) {
314
+ const cap = this.rules.block.blockquote.exec(src);
315
+ if (cap) {
316
+ const text = rtrim(cap[0].replace(/^ *>[ \t]?/gm, ''), '\n');
317
+ const top = this.lexer.state.top;
318
+ this.lexer.state.top = true;
319
+ const tokens = this.lexer.blockTokens(text);
320
+ this.lexer.state.top = top;
321
+ return {
322
+ type: 'blockquote',
323
+ raw: cap[0],
324
+ tokens,
325
+ text
326
+ };
327
+ }
328
+ }
329
+ list(src) {
330
+ let cap = this.rules.block.list.exec(src);
331
+ if (cap) {
332
+ let bull = cap[1].trim();
333
+ const isordered = bull.length > 1;
334
+ const list = {
335
+ type: 'list',
336
+ raw: '',
337
+ ordered: isordered,
338
+ start: isordered ? +bull.slice(0, -1) : '',
339
+ loose: false,
340
+ items: []
341
+ };
342
+ bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
343
+ if (this.options.pedantic) {
344
+ bull = isordered ? bull : '[*+-]';
345
+ }
346
+ // Get next list item
347
+ const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
348
+ let raw = '';
349
+ let itemContents = '';
350
+ let endsWithBlankLine = false;
351
+ // Check if current bullet point can start a new List Item
352
+ while (src) {
353
+ let endEarly = false;
354
+ if (!(cap = itemRegex.exec(src))) {
355
+ break;
356
+ }
357
+ if (this.rules.block.hr.test(src)) {
358
+ // End list if bullet was actually HR (possibly move into itemRegex?)
359
+ break;
360
+ }
361
+ raw = cap[0];
362
+ src = src.substring(raw.length);
363
+ let line = cap[2].split('\n', 1)[0].replace(/^\t+/, t => ' '.repeat(3 * t.length));
364
+ let nextLine = src.split('\n', 1)[0];
365
+ let indent = 0;
366
+ if (this.options.pedantic) {
367
+ indent = 2;
368
+ itemContents = line.trimStart();
369
+ } else {
370
+ indent = cap[2].search(/[^ ]/); // Find first non-space char
371
+ indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
372
+ itemContents = line.slice(indent);
373
+ indent += cap[1].length;
374
+ }
375
+ let blankLine = false;
376
+ if (!line && /^ *$/.test(nextLine)) {
377
+ // Items begin with at most one blank line
378
+ raw += nextLine + '\n';
379
+ src = src.substring(nextLine.length + 1);
380
+ endEarly = true;
381
+ }
382
+ if (!endEarly) {
383
+ const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);
384
+ const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
385
+ const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
386
+ const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
387
+ // Check if following lines should be included in List Item
388
+ while (src) {
389
+ const rawLine = src.split('\n', 1)[0];
390
+ nextLine = rawLine;
391
+ // Re-align to follow commonmark nesting rules
392
+ if (this.options.pedantic) {
393
+ nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
394
+ }
395
+ // End list item if found code fences
396
+ if (fencesBeginRegex.test(nextLine)) {
397
+ break;
398
+ }
399
+ // End list item if found start of new heading
400
+ if (headingBeginRegex.test(nextLine)) {
401
+ break;
402
+ }
403
+ // End list item if found start of new bullet
404
+ if (nextBulletRegex.test(nextLine)) {
405
+ break;
406
+ }
407
+ // Horizontal rule found
408
+ if (hrRegex.test(src)) {
409
+ break;
410
+ }
411
+ if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
412
+ // Dedent if possible
413
+ itemContents += '\n' + nextLine.slice(indent);
414
+ } else {
415
+ // not enough indentation
416
+ if (blankLine) {
417
+ break;
418
+ }
419
+ // paragraph continuation unless last line was a different block level element
420
+ if (line.search(/[^ ]/) >= 4) {
421
+ // indented code block
422
+ break;
423
+ }
424
+ if (fencesBeginRegex.test(line)) {
425
+ break;
426
+ }
427
+ if (headingBeginRegex.test(line)) {
428
+ break;
429
+ }
430
+ if (hrRegex.test(line)) {
431
+ break;
432
+ }
433
+ itemContents += '\n' + nextLine;
434
+ }
435
+ if (!blankLine && !nextLine.trim()) {
436
+ // Check if current line is blank
437
+ blankLine = true;
438
+ }
439
+ raw += rawLine + '\n';
440
+ src = src.substring(rawLine.length + 1);
441
+ line = nextLine.slice(indent);
442
+ }
443
+ }
444
+ if (!list.loose) {
445
+ // If the previous item ended with a blank line, the list is loose
446
+ if (endsWithBlankLine) {
447
+ list.loose = true;
448
+ } else if (/\n *\n *$/.test(raw)) {
449
+ endsWithBlankLine = true;
450
+ }
451
+ }
452
+ let istask = null;
453
+ let ischecked;
454
+ // Check for task list items
455
+ if (this.options.gfm) {
456
+ istask = /^\[[ xX]\] /.exec(itemContents);
457
+ if (istask) {
458
+ ischecked = istask[0] !== '[ ] ';
459
+ itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
460
+ }
461
+ }
462
+ list.items.push({
463
+ type: 'list_item',
464
+ raw,
465
+ task: !!istask,
466
+ checked: ischecked,
467
+ loose: false,
468
+ text: itemContents,
469
+ tokens: []
470
+ });
471
+ list.raw += raw;
472
+ }
473
+ // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
474
+ list.items[list.items.length - 1].raw = raw.trimEnd();
475
+ list.items[list.items.length - 1].text = itemContents.trimEnd();
476
+ list.raw = list.raw.trimEnd();
477
+ // Item child tokens handled here at end because we needed to have the final item to trim it first
478
+ for (let i = 0; i < list.items.length; i++) {
479
+ this.lexer.state.top = false;
480
+ list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
481
+ if (!list.loose) {
482
+ // Check if list should be loose
483
+ const spacers = list.items[i].tokens.filter(t => t.type === 'space');
484
+ const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw));
485
+ list.loose = hasMultipleLineBreaks;
486
+ }
487
+ }
488
+ // Set all items to loose if list is loose
489
+ if (list.loose) {
490
+ for (let i = 0; i < list.items.length; i++) {
491
+ list.items[i].loose = true;
492
+ }
493
+ }
494
+ return list;
495
+ }
496
+ }
497
+ html(src) {
498
+ const cap = this.rules.block.html.exec(src);
499
+ if (cap) {
500
+ const token = {
501
+ type: 'html',
502
+ block: true,
503
+ raw: cap[0],
504
+ pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
505
+ text: cap[0]
506
+ };
507
+ return token;
508
+ }
509
+ }
510
+ def(src) {
511
+ const cap = this.rules.block.def.exec(src);
512
+ if (cap) {
513
+ const tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
514
+ const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline._escapes, '$1') : '';
515
+ const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, '$1') : cap[3];
516
+ return {
517
+ type: 'def',
518
+ tag,
519
+ raw: cap[0],
520
+ href,
521
+ title
522
+ };
523
+ }
524
+ }
525
+ table(src) {
526
+ const cap = this.rules.block.table.exec(src);
527
+ if (cap) {
528
+ if (!/[:|]/.test(cap[2])) {
529
+ // delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading
530
+ return;
531
+ }
532
+ const item = {
533
+ type: 'table',
534
+ raw: cap[0],
535
+ header: splitCells(cap[1]).map(c => {
536
+ return {
537
+ text: c,
538
+ tokens: []
539
+ };
540
+ }),
541
+ align: cap[2].replace(/^\||\| *$/g, '').split('|'),
542
+ rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
543
+ };
544
+ if (item.header.length === item.align.length) {
545
+ let l = item.align.length;
546
+ let i, j, k, row;
547
+ for (i = 0; i < l; i++) {
548
+ const align = item.align[i];
549
+ if (align) {
550
+ if (/^ *-+: *$/.test(align)) {
551
+ item.align[i] = 'right';
552
+ } else if (/^ *:-+: *$/.test(align)) {
553
+ item.align[i] = 'center';
554
+ } else if (/^ *:-+ *$/.test(align)) {
555
+ item.align[i] = 'left';
556
+ } else {
557
+ item.align[i] = null;
558
+ }
559
+ }
560
+ }
561
+ l = item.rows.length;
562
+ for (i = 0; i < l; i++) {
563
+ item.rows[i] = splitCells(item.rows[i], item.header.length).map(c => {
564
+ return {
565
+ text: c,
566
+ tokens: []
567
+ };
568
+ });
569
+ }
570
+ // parse child tokens inside headers and cells
571
+ // header child tokens
572
+ l = item.header.length;
573
+ for (j = 0; j < l; j++) {
574
+ item.header[j].tokens = this.lexer.inline(item.header[j].text);
575
+ }
576
+ // cell child tokens
577
+ l = item.rows.length;
578
+ for (j = 0; j < l; j++) {
579
+ row = item.rows[j];
580
+ for (k = 0; k < row.length; k++) {
581
+ row[k].tokens = this.lexer.inline(row[k].text);
582
+ }
583
+ }
584
+ return item;
585
+ }
586
+ }
587
+ }
588
+ lheading(src) {
589
+ const cap = this.rules.block.lheading.exec(src);
590
+ if (cap) {
591
+ return {
592
+ type: 'heading',
593
+ raw: cap[0],
594
+ depth: cap[2].charAt(0) === '=' ? 1 : 2,
595
+ text: cap[1],
596
+ tokens: this.lexer.inline(cap[1])
597
+ };
598
+ }
599
+ }
600
+ paragraph(src) {
601
+ const cap = this.rules.block.paragraph.exec(src);
602
+ if (cap) {
603
+ const text = cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1];
604
+ return {
605
+ type: 'paragraph',
606
+ raw: cap[0],
607
+ text,
608
+ tokens: this.lexer.inline(text)
609
+ };
610
+ }
611
+ }
612
+ text(src) {
613
+ const cap = this.rules.block.text.exec(src);
614
+ if (cap) {
615
+ return {
616
+ type: 'text',
617
+ raw: cap[0],
618
+ text: cap[0],
619
+ tokens: this.lexer.inline(cap[0])
620
+ };
621
+ }
622
+ }
623
+ escape(src) {
624
+ const cap = this.rules.inline.escape.exec(src);
625
+ if (cap) {
626
+ return {
627
+ type: 'escape',
628
+ raw: cap[0],
629
+ text: escape(cap[1])
630
+ };
631
+ }
632
+ }
633
+ tag(src) {
634
+ const cap = this.rules.inline.tag.exec(src);
635
+ if (cap) {
636
+ if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
637
+ this.lexer.state.inLink = true;
638
+ } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
639
+ this.lexer.state.inLink = false;
640
+ }
641
+ if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
642
+ this.lexer.state.inRawBlock = true;
643
+ } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
644
+ this.lexer.state.inRawBlock = false;
645
+ }
646
+ return {
647
+ type: 'html',
648
+ raw: cap[0],
649
+ inLink: this.lexer.state.inLink,
650
+ inRawBlock: this.lexer.state.inRawBlock,
651
+ block: false,
652
+ text: cap[0]
653
+ };
654
+ }
655
+ }
656
+ link(src) {
657
+ const cap = this.rules.inline.link.exec(src);
658
+ if (cap) {
659
+ const trimmedUrl = cap[2].trim();
660
+ if (!this.options.pedantic && /^</.test(trimmedUrl)) {
661
+ // commonmark requires matching angle brackets
662
+ if (!/>$/.test(trimmedUrl)) {
663
+ return;
664
+ }
665
+ // ending angle bracket cannot be escaped
666
+ const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
667
+ if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
668
+ return;
669
+ }
670
+ } else {
671
+ // find closing parenthesis
672
+ const lastParenIndex = findClosingBracket(cap[2], '()');
673
+ if (lastParenIndex > -1) {
674
+ const start = cap[0].indexOf('!') === 0 ? 5 : 4;
675
+ const linkLen = start + cap[1].length + lastParenIndex;
676
+ cap[2] = cap[2].substring(0, lastParenIndex);
677
+ cap[0] = cap[0].substring(0, linkLen).trim();
678
+ cap[3] = '';
679
+ }
680
+ }
681
+ let href = cap[2];
682
+ let title = '';
683
+ if (this.options.pedantic) {
684
+ // split pedantic href and title
685
+ const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
686
+ if (link) {
687
+ href = link[1];
688
+ title = link[3];
689
+ }
690
+ } else {
691
+ title = cap[3] ? cap[3].slice(1, -1) : '';
692
+ }
693
+ href = href.trim();
694
+ if (/^</.test(href)) {
695
+ if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
696
+ // pedantic allows starting angle bracket without ending angle bracket
697
+ href = href.slice(1);
698
+ } else {
699
+ href = href.slice(1, -1);
700
+ }
701
+ }
702
+ return outputLink(cap, {
703
+ href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
704
+ title: title ? title.replace(this.rules.inline._escapes, '$1') : title
705
+ }, cap[0], this.lexer);
706
+ }
707
+ }
708
+ reflink(src, links) {
709
+ let cap;
710
+ if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
711
+ let link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
712
+ link = links[link.toLowerCase()];
713
+ if (!link) {
714
+ const text = cap[0].charAt(0);
715
+ return {
716
+ type: 'text',
717
+ raw: text,
718
+ text
719
+ };
720
+ }
721
+ return outputLink(cap, link, cap[0], this.lexer);
722
+ }
723
+ }
724
+ emStrong(src, maskedSrc, prevChar = '') {
725
+ let match = this.rules.inline.emStrong.lDelim.exec(src);
726
+ if (!match) return;
727
+ // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
728
+ if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) return;
729
+ const nextChar = match[1] || match[2] || '';
730
+ if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
731
+ // unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)
732
+ const lLength = [...match[0]].length - 1;
733
+ let rDelim,
734
+ rLength,
735
+ delimTotal = lLength,
736
+ midDelimTotal = 0;
737
+ const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
738
+ endReg.lastIndex = 0;
739
+ // Clip maskedSrc to same section of string as src (move to lexer?)
740
+ maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
741
+ while ((match = endReg.exec(maskedSrc)) != null) {
742
+ rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
743
+ if (!rDelim) continue; // skip single * in __abc*abc__
744
+ rLength = [...rDelim].length;
745
+ if (match[3] || match[4]) {
746
+ // found another Left Delim
747
+ delimTotal += rLength;
748
+ continue;
749
+ } else if (match[5] || match[6]) {
750
+ // either Left or Right Delim
751
+ if (lLength % 3 && !((lLength + rLength) % 3)) {
752
+ midDelimTotal += rLength;
753
+ continue; // CommonMark Emphasis Rules 9-10
754
+ }
755
+ }
756
+ delimTotal -= rLength;
757
+ if (delimTotal > 0) continue; // Haven't found enough closing delimiters
758
+ // Remove extra characters. *a*** -> *a*
759
+ rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
760
+ // char length can be >1 for unicode characters;
761
+ const lastCharLength = [...match[0]][0].length;
762
+ const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
763
+ // Create `em` if smallest delimiter has odd char count. *a***
764
+ if (Math.min(lLength, rLength) % 2) {
765
+ const text = raw.slice(1, -1);
766
+ return {
767
+ type: 'em',
768
+ raw,
769
+ text,
770
+ tokens: this.lexer.inlineTokens(text)
771
+ };
772
+ }
773
+ // Create 'strong' if smallest delimiter has even char count. **a***
774
+ const text = raw.slice(2, -2);
775
+ return {
776
+ type: 'strong',
777
+ raw,
778
+ text,
779
+ tokens: this.lexer.inlineTokens(text)
780
+ };
781
+ }
782
+ }
783
+ }
784
+ codespan(src) {
785
+ const cap = this.rules.inline.code.exec(src);
786
+ if (cap) {
787
+ let text = cap[2].replace(/\n/g, ' ');
788
+ const hasNonSpaceChars = /[^ ]/.test(text);
789
+ const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
790
+ if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
791
+ text = text.substring(1, text.length - 1);
792
+ }
793
+ text = escape(text, true);
794
+ return {
795
+ type: 'codespan',
796
+ raw: cap[0],
797
+ text
798
+ };
799
+ }
800
+ }
801
+ br(src) {
802
+ const cap = this.rules.inline.br.exec(src);
803
+ if (cap) {
804
+ return {
805
+ type: 'br',
806
+ raw: cap[0]
807
+ };
808
+ }
809
+ }
810
+ del(src) {
811
+ const cap = this.rules.inline.del.exec(src);
812
+ if (cap) {
813
+ return {
814
+ type: 'del',
815
+ raw: cap[0],
816
+ text: cap[2],
817
+ tokens: this.lexer.inlineTokens(cap[2])
818
+ };
819
+ }
820
+ }
821
+ autolink(src) {
822
+ const cap = this.rules.inline.autolink.exec(src);
823
+ if (cap) {
824
+ let text, href;
825
+ if (cap[2] === '@') {
826
+ text = escape(cap[1]);
827
+ href = 'mailto:' + text;
828
+ } else {
829
+ text = escape(cap[1]);
830
+ href = text;
831
+ }
832
+ return {
833
+ type: 'link',
834
+ raw: cap[0],
835
+ text,
836
+ href,
837
+ tokens: [{
838
+ type: 'text',
839
+ raw: text,
840
+ text
841
+ }]
842
+ };
843
+ }
844
+ }
845
+ url(src) {
846
+ let cap;
847
+ if (cap = this.rules.inline.url.exec(src)) {
848
+ let text, href;
849
+ if (cap[2] === '@') {
850
+ text = escape(cap[0]);
851
+ href = 'mailto:' + text;
852
+ } else {
853
+ // do extended autolink path validation
854
+ let prevCapZero;
855
+ do {
856
+ prevCapZero = cap[0];
857
+ cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
858
+ } while (prevCapZero !== cap[0]);
859
+ text = escape(cap[0]);
860
+ if (cap[1] === 'www.') {
861
+ href = 'http://' + cap[0];
862
+ } else {
863
+ href = cap[0];
864
+ }
865
+ }
866
+ return {
867
+ type: 'link',
868
+ raw: cap[0],
869
+ text,
870
+ href,
871
+ tokens: [{
872
+ type: 'text',
873
+ raw: text,
874
+ text
875
+ }]
876
+ };
877
+ }
878
+ }
879
+ inlineText(src) {
880
+ const cap = this.rules.inline.text.exec(src);
881
+ if (cap) {
882
+ let text;
883
+ if (this.lexer.state.inRawBlock) {
884
+ text = cap[0];
885
+ } else {
886
+ text = escape(cap[0]);
887
+ }
888
+ return {
889
+ type: 'text',
890
+ raw: cap[0],
891
+ text
892
+ };
893
+ }
894
+ }
895
+ }
896
+
897
+ /**
898
+ * Block-Level Grammar
899
+ */
900
+ // Not all rules are defined in the object literal
901
+ // @ts-expect-error
902
+ const block = {
903
+ newline: /^(?: *(?:\n|$))+/,
904
+ code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
905
+ fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
906
+ hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
907
+ heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
908
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
909
+ list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
910
+ html: '^ {0,3}(?:' // optional indentation
911
+ + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
912
+ + '|comment[^\\n]*(\\n+|$)' // (2)
913
+ + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
914
+ + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
915
+ + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
916
+ + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
917
+ + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
918
+ + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
919
+ + ')',
920
+ def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
921
+ table: noopTest,
922
+ lheading: /^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
923
+ // regex template, placeholders will be replaced according to different paragraph
924
+ // interruption rules of commonmark and the original markdown spec:
925
+ _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
926
+ text: /^[^\n]+/
927
+ };
928
+ block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
929
+ block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
930
+ block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
931
+ block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
932
+ block.listItemStart = edit(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
933
+ block.list = edit(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
934
+ block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
935
+ block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
936
+ block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
937
+ block.lheading = edit(block.lheading).replace(/bull/g, block.bullet) // lists can interrupt
938
+ .getRegex();
939
+ block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
940
+ .replace('|table', '').replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
941
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
942
+ .getRegex();
943
+ block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
944
+ /**
945
+ * Normal Block Grammar
946
+ */
947
+ block.normal = {
948
+ ...block
949
+ };
950
+ /**
951
+ * GFM Block Grammar
952
+ */
953
+ block.gfm = {
954
+ ...block.normal,
955
+ table: '^ *([^\\n ].*)\\n' // Header
956
+ + ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
957
+ + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
958
+ };
959
+ block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
960
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
961
+ .getRegex();
962
+ block.gfm.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
963
+ .replace('table', block.gfm.table) // interrupt paragraphs with table
964
+ .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
965
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
966
+ .getRegex();
967
+ /**
968
+ * Pedantic grammar (original John Gruber's loose markdown specification)
969
+ */
970
+ block.pedantic = {
971
+ ...block.normal,
972
+ html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
973
+ + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
974
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
975
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
976
+ fences: noopTest,
977
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
978
+ paragraph: edit(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
979
+ };
980
+ /**
981
+ * Inline-Level Grammar
982
+ */
983
+ // Not all rules are defined in the object literal
984
+ // @ts-expect-error
985
+ const inline = {
986
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
987
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
988
+ url: noopTest,
989
+ tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
990
+ + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
991
+ + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
992
+ + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
993
+ + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
994
+ link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
995
+ reflink: /^!?\[(label)\]\[(ref)\]/,
996
+ nolink: /^!?\[(ref)\](?:\[\])?/,
997
+ reflinkSearch: 'reflink|nolink(?!\\()',
998
+ emStrong: {
999
+ lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
1000
+ // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
1001
+ // | Skip orphan inside strong | Consume to delim | (1) #*** | (2) a***#, a*** | (3) #***a, ***a | (4) ***# | (5) #***# | (6) a***a
1002
+ rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
1003
+ rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/ // ^- Not allowed for _
1004
+ },
1005
+ code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
1006
+ br: /^( {2,}|\\)\n(?!\s*$)/,
1007
+ del: noopTest,
1008
+ text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
1009
+ punctuation: /^((?![*_])[\spunctuation])/
1010
+ };
1011
+ // list of unicode punctuation marks, plus any missing characters from CommonMark spec
1012
+ inline._punctuation = '\\p{P}$+<=>`^|~';
1013
+ inline.punctuation = edit(inline.punctuation, 'u').replace(/punctuation/g, inline._punctuation).getRegex();
1014
+ // sequences em should skip over [title](link), `code`, <html>
1015
+ inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
1016
+ inline.anyPunctuation = /\\[punct]/g;
1017
+ inline._escapes = /\\([punct])/g;
1018
+ inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
1019
+ inline.emStrong.lDelim = edit(inline.emStrong.lDelim, 'u').replace(/punct/g, inline._punctuation).getRegex();
1020
+ inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'gu').replace(/punct/g, inline._punctuation).getRegex();
1021
+ inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'gu').replace(/punct/g, inline._punctuation).getRegex();
1022
+ inline.anyPunctuation = edit(inline.anyPunctuation, 'gu').replace(/punct/g, inline._punctuation).getRegex();
1023
+ inline._escapes = edit(inline._escapes, 'gu').replace(/punct/g, inline._punctuation).getRegex();
1024
+ inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
1025
+ inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
1026
+ inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
1027
+ inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
1028
+ inline.tag = edit(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
1029
+ inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
1030
+ inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
1031
+ inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
1032
+ inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
1033
+ inline.reflink = edit(inline.reflink).replace('label', inline._label).replace('ref', block._label).getRegex();
1034
+ inline.nolink = edit(inline.nolink).replace('ref', block._label).getRegex();
1035
+ inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
1036
+ /**
1037
+ * Normal Inline Grammar
1038
+ */
1039
+ inline.normal = {
1040
+ ...inline
1041
+ };
1042
+ /**
1043
+ * Pedantic Inline Grammar
1044
+ */
1045
+ inline.pedantic = {
1046
+ ...inline.normal,
1047
+ strong: {
1048
+ start: /^__|\*\*/,
1049
+ middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
1050
+ endAst: /\*\*(?!\*)/g,
1051
+ endUnd: /__(?!_)/g
1052
+ },
1053
+ em: {
1054
+ start: /^_|\*/,
1055
+ middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
1056
+ endAst: /\*(?!\*)/g,
1057
+ endUnd: /_(?!_)/g
1058
+ },
1059
+ link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
1060
+ reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
1061
+ };
1062
+ /**
1063
+ * GFM Inline Grammar
1064
+ */
1065
+ inline.gfm = {
1066
+ ...inline.normal,
1067
+ escape: edit(inline.escape).replace('])', '~|])').getRegex(),
1068
+ _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
1069
+ url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
1070
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
1071
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
1072
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
1073
+ };
1074
+ inline.gfm.url = edit(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
1075
+ /**
1076
+ * GFM + Line Breaks Inline Grammar
1077
+ */
1078
+ inline.breaks = {
1079
+ ...inline.gfm,
1080
+ br: edit(inline.br).replace('{2,}', '*').getRegex(),
1081
+ text: edit(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
1082
+ };
1083
+
1084
+ /**
1085
+ * Block Lexer
1086
+ */
1087
+ class _Lexer {
1088
+ constructor(options) {
1089
+ this.tokens = void 0;
1090
+ this.options = void 0;
1091
+ this.state = void 0;
1092
+ this.tokenizer = void 0;
1093
+ this.inlineQueue = void 0;
1094
+ // TokenList cannot be created in one go
1095
+ // @ts-expect-error
1096
+ this.tokens = [];
1097
+ this.tokens.links = Object.create(null);
1098
+ this.options = options || _defaults;
1099
+ this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
1100
+ this.tokenizer = this.options.tokenizer;
1101
+ this.tokenizer.options = this.options;
1102
+ this.tokenizer.lexer = this;
1103
+ this.inlineQueue = [];
1104
+ this.state = {
1105
+ inLink: false,
1106
+ inRawBlock: false,
1107
+ top: true
1108
+ };
1109
+ const rules = {
1110
+ block: block.normal,
1111
+ inline: inline.normal
1112
+ };
1113
+ if (this.options.pedantic) {
1114
+ rules.block = block.pedantic;
1115
+ rules.inline = inline.pedantic;
1116
+ } else if (this.options.gfm) {
1117
+ rules.block = block.gfm;
1118
+ if (this.options.breaks) {
1119
+ rules.inline = inline.breaks;
1120
+ } else {
1121
+ rules.inline = inline.gfm;
1122
+ }
1123
+ }
1124
+ this.tokenizer.rules = rules;
1125
+ }
1126
+ /**
1127
+ * Expose Rules
1128
+ */
1129
+ static get rules() {
1130
+ return {
1131
+ block,
1132
+ inline
1133
+ };
1134
+ }
1135
+ /**
1136
+ * Static Lex Method
1137
+ */
1138
+ static lex(src, options) {
1139
+ const lexer = new _Lexer(options);
1140
+ return lexer.lex(src);
1141
+ }
1142
+ /**
1143
+ * Static Lex Inline Method
1144
+ */
1145
+ static lexInline(src, options) {
1146
+ const lexer = new _Lexer(options);
1147
+ return lexer.inlineTokens(src);
1148
+ }
1149
+ /**
1150
+ * Preprocessing
1151
+ */
1152
+ lex(src) {
1153
+ src = src.replace(/\r\n|\r/g, '\n');
1154
+ this.blockTokens(src, this.tokens);
1155
+ let next;
1156
+ while (next = this.inlineQueue.shift()) {
1157
+ this.inlineTokens(next.src, next.tokens);
1158
+ }
1159
+ return this.tokens;
1160
+ }
1161
+ blockTokens(src, tokens = []) {
1162
+ if (this.options.pedantic) {
1163
+ src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
1164
+ } else {
1165
+ src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
1166
+ return leading + ' '.repeat(tabs.length);
1167
+ });
1168
+ }
1169
+ let token;
1170
+ let lastToken;
1171
+ let cutSrc;
1172
+ let lastParagraphClipped;
1173
+ while (src) {
1174
+ if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(extTokenizer => {
1175
+ if (token = extTokenizer.call({
1176
+ lexer: this
1177
+ }, src, tokens)) {
1178
+ src = src.substring(token.raw.length);
1179
+ tokens.push(token);
1180
+ return true;
1181
+ }
1182
+ return false;
1183
+ })) {
1184
+ continue;
1185
+ }
1186
+ // newline
1187
+ if (token = this.tokenizer.space(src)) {
1188
+ src = src.substring(token.raw.length);
1189
+ if (token.raw.length === 1 && tokens.length > 0) {
1190
+ // if there's a single \n as a spacer, it's terminating the last line,
1191
+ // so move it there so that we don't get unnecessary paragraph tags
1192
+ tokens[tokens.length - 1].raw += '\n';
1193
+ } else {
1194
+ tokens.push(token);
1195
+ }
1196
+ continue;
1197
+ }
1198
+ // code
1199
+ if (token = this.tokenizer.code(src)) {
1200
+ src = src.substring(token.raw.length);
1201
+ lastToken = tokens[tokens.length - 1];
1202
+ // An indented code block cannot interrupt a paragraph.
1203
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
1204
+ lastToken.raw += '\n' + token.raw;
1205
+ lastToken.text += '\n' + token.text;
1206
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1207
+ } else {
1208
+ tokens.push(token);
1209
+ }
1210
+ continue;
1211
+ }
1212
+ // fences
1213
+ if (token = this.tokenizer.fences(src)) {
1214
+ src = src.substring(token.raw.length);
1215
+ tokens.push(token);
1216
+ continue;
1217
+ }
1218
+ // heading
1219
+ if (token = this.tokenizer.heading(src)) {
1220
+ src = src.substring(token.raw.length);
1221
+ tokens.push(token);
1222
+ continue;
1223
+ }
1224
+ // hr
1225
+ if (token = this.tokenizer.hr(src)) {
1226
+ src = src.substring(token.raw.length);
1227
+ tokens.push(token);
1228
+ continue;
1229
+ }
1230
+ // blockquote
1231
+ if (token = this.tokenizer.blockquote(src)) {
1232
+ src = src.substring(token.raw.length);
1233
+ tokens.push(token);
1234
+ continue;
1235
+ }
1236
+ // list
1237
+ if (token = this.tokenizer.list(src)) {
1238
+ src = src.substring(token.raw.length);
1239
+ tokens.push(token);
1240
+ continue;
1241
+ }
1242
+ // html
1243
+ if (token = this.tokenizer.html(src)) {
1244
+ src = src.substring(token.raw.length);
1245
+ tokens.push(token);
1246
+ continue;
1247
+ }
1248
+ // def
1249
+ if (token = this.tokenizer.def(src)) {
1250
+ src = src.substring(token.raw.length);
1251
+ lastToken = tokens[tokens.length - 1];
1252
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
1253
+ lastToken.raw += '\n' + token.raw;
1254
+ lastToken.text += '\n' + token.raw;
1255
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1256
+ } else if (!this.tokens.links[token.tag]) {
1257
+ this.tokens.links[token.tag] = {
1258
+ href: token.href,
1259
+ title: token.title
1260
+ };
1261
+ }
1262
+ continue;
1263
+ }
1264
+ // table (gfm)
1265
+ if (token = this.tokenizer.table(src)) {
1266
+ src = src.substring(token.raw.length);
1267
+ tokens.push(token);
1268
+ continue;
1269
+ }
1270
+ // lheading
1271
+ if (token = this.tokenizer.lheading(src)) {
1272
+ src = src.substring(token.raw.length);
1273
+ tokens.push(token);
1274
+ continue;
1275
+ }
1276
+ // top-level paragraph
1277
+ // prevent paragraph consuming extensions by clipping 'src' to extension start
1278
+ cutSrc = src;
1279
+ if (this.options.extensions && this.options.extensions.startBlock) {
1280
+ let startIndex = Infinity;
1281
+ const tempSrc = src.slice(1);
1282
+ let tempStart;
1283
+ this.options.extensions.startBlock.forEach(getStartIndex => {
1284
+ tempStart = getStartIndex.call({
1285
+ lexer: this
1286
+ }, tempSrc);
1287
+ if (typeof tempStart === 'number' && tempStart >= 0) {
1288
+ startIndex = Math.min(startIndex, tempStart);
1289
+ }
1290
+ });
1291
+ if (startIndex < Infinity && startIndex >= 0) {
1292
+ cutSrc = src.substring(0, startIndex + 1);
1293
+ }
1294
+ }
1295
+ if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
1296
+ lastToken = tokens[tokens.length - 1];
1297
+ if (lastParagraphClipped && lastToken.type === 'paragraph') {
1298
+ lastToken.raw += '\n' + token.raw;
1299
+ lastToken.text += '\n' + token.text;
1300
+ this.inlineQueue.pop();
1301
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1302
+ } else {
1303
+ tokens.push(token);
1304
+ }
1305
+ lastParagraphClipped = cutSrc.length !== src.length;
1306
+ src = src.substring(token.raw.length);
1307
+ continue;
1308
+ }
1309
+ // text
1310
+ if (token = this.tokenizer.text(src)) {
1311
+ src = src.substring(token.raw.length);
1312
+ lastToken = tokens[tokens.length - 1];
1313
+ if (lastToken && lastToken.type === 'text') {
1314
+ lastToken.raw += '\n' + token.raw;
1315
+ lastToken.text += '\n' + token.text;
1316
+ this.inlineQueue.pop();
1317
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1318
+ } else {
1319
+ tokens.push(token);
1320
+ }
1321
+ continue;
1322
+ }
1323
+ if (src) {
1324
+ const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1325
+ if (this.options.silent) {
1326
+ console.error(errMsg);
1327
+ break;
1328
+ } else {
1329
+ throw new Error(errMsg);
1330
+ }
1331
+ }
1332
+ }
1333
+ this.state.top = true;
1334
+ return tokens;
1335
+ }
1336
+ inline(src, tokens = []) {
1337
+ this.inlineQueue.push({
1338
+ src,
1339
+ tokens
1340
+ });
1341
+ return tokens;
1342
+ }
1343
+ /**
1344
+ * Lexing/Compiling
1345
+ */
1346
+ inlineTokens(src, tokens = []) {
1347
+ let token, lastToken, cutSrc;
1348
+ // String with links masked to avoid interference with em and strong
1349
+ let maskedSrc = src;
1350
+ let match;
1351
+ let keepPrevChar, prevChar;
1352
+ // Mask out reflinks
1353
+ if (this.tokens.links) {
1354
+ const links = Object.keys(this.tokens.links);
1355
+ if (links.length > 0) {
1356
+ while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
1357
+ if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
1358
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
1359
+ }
1360
+ }
1361
+ }
1362
+ }
1363
+ // Mask out other blocks
1364
+ while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
1365
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1366
+ }
1367
+ // Mask out escaped characters
1368
+ while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
1369
+ maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1370
+ }
1371
+ while (src) {
1372
+ if (!keepPrevChar) {
1373
+ prevChar = '';
1374
+ }
1375
+ keepPrevChar = false;
1376
+ // extensions
1377
+ if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(extTokenizer => {
1378
+ if (token = extTokenizer.call({
1379
+ lexer: this
1380
+ }, src, tokens)) {
1381
+ src = src.substring(token.raw.length);
1382
+ tokens.push(token);
1383
+ return true;
1384
+ }
1385
+ return false;
1386
+ })) {
1387
+ continue;
1388
+ }
1389
+ // escape
1390
+ if (token = this.tokenizer.escape(src)) {
1391
+ src = src.substring(token.raw.length);
1392
+ tokens.push(token);
1393
+ continue;
1394
+ }
1395
+ // tag
1396
+ if (token = this.tokenizer.tag(src)) {
1397
+ src = src.substring(token.raw.length);
1398
+ lastToken = tokens[tokens.length - 1];
1399
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
1400
+ lastToken.raw += token.raw;
1401
+ lastToken.text += token.text;
1402
+ } else {
1403
+ tokens.push(token);
1404
+ }
1405
+ continue;
1406
+ }
1407
+ // link
1408
+ if (token = this.tokenizer.link(src)) {
1409
+ src = src.substring(token.raw.length);
1410
+ tokens.push(token);
1411
+ continue;
1412
+ }
1413
+ // reflink, nolink
1414
+ if (token = this.tokenizer.reflink(src, this.tokens.links)) {
1415
+ src = src.substring(token.raw.length);
1416
+ lastToken = tokens[tokens.length - 1];
1417
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
1418
+ lastToken.raw += token.raw;
1419
+ lastToken.text += token.text;
1420
+ } else {
1421
+ tokens.push(token);
1422
+ }
1423
+ continue;
1424
+ }
1425
+ // em & strong
1426
+ if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
1427
+ src = src.substring(token.raw.length);
1428
+ tokens.push(token);
1429
+ continue;
1430
+ }
1431
+ // code
1432
+ if (token = this.tokenizer.codespan(src)) {
1433
+ src = src.substring(token.raw.length);
1434
+ tokens.push(token);
1435
+ continue;
1436
+ }
1437
+ // br
1438
+ if (token = this.tokenizer.br(src)) {
1439
+ src = src.substring(token.raw.length);
1440
+ tokens.push(token);
1441
+ continue;
1442
+ }
1443
+ // del (gfm)
1444
+ if (token = this.tokenizer.del(src)) {
1445
+ src = src.substring(token.raw.length);
1446
+ tokens.push(token);
1447
+ continue;
1448
+ }
1449
+ // autolink
1450
+ if (token = this.tokenizer.autolink(src)) {
1451
+ src = src.substring(token.raw.length);
1452
+ tokens.push(token);
1453
+ continue;
1454
+ }
1455
+ // url (gfm)
1456
+ if (!this.state.inLink && (token = this.tokenizer.url(src))) {
1457
+ src = src.substring(token.raw.length);
1458
+ tokens.push(token);
1459
+ continue;
1460
+ }
1461
+ // text
1462
+ // prevent inlineText consuming extensions by clipping 'src' to extension start
1463
+ cutSrc = src;
1464
+ if (this.options.extensions && this.options.extensions.startInline) {
1465
+ let startIndex = Infinity;
1466
+ const tempSrc = src.slice(1);
1467
+ let tempStart;
1468
+ this.options.extensions.startInline.forEach(getStartIndex => {
1469
+ tempStart = getStartIndex.call({
1470
+ lexer: this
1471
+ }, tempSrc);
1472
+ if (typeof tempStart === 'number' && tempStart >= 0) {
1473
+ startIndex = Math.min(startIndex, tempStart);
1474
+ }
1475
+ });
1476
+ if (startIndex < Infinity && startIndex >= 0) {
1477
+ cutSrc = src.substring(0, startIndex + 1);
1478
+ }
1479
+ }
1480
+ if (token = this.tokenizer.inlineText(cutSrc)) {
1481
+ src = src.substring(token.raw.length);
1482
+ if (token.raw.slice(-1) !== '_') {
1483
+ // Track prevChar before string of ____ started
1484
+ prevChar = token.raw.slice(-1);
1485
+ }
1486
+ keepPrevChar = true;
1487
+ lastToken = tokens[tokens.length - 1];
1488
+ if (lastToken && lastToken.type === 'text') {
1489
+ lastToken.raw += token.raw;
1490
+ lastToken.text += token.text;
1491
+ } else {
1492
+ tokens.push(token);
1493
+ }
1494
+ continue;
1495
+ }
1496
+ if (src) {
1497
+ const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1498
+ if (this.options.silent) {
1499
+ console.error(errMsg);
1500
+ break;
1501
+ } else {
1502
+ throw new Error(errMsg);
1503
+ }
1504
+ }
1505
+ }
1506
+ return tokens;
1507
+ }
1508
+ }
1509
+
1510
+ /**
1511
+ * Renderer
1512
+ */
1513
+ class _Renderer {
1514
+ constructor(options) {
1515
+ this.options = void 0;
1516
+ this.options = options || _defaults;
1517
+ }
1518
+ code(code, infostring, escaped) {
1519
+ const lang = (infostring || '').match(/^\S*/)?.[0];
1520
+ code = code.replace(/\n$/, '') + '\n';
1521
+ if (!lang) {
1522
+ return '<pre><code>' + (escaped ? code : escape(code, true)) + '</code></pre>\n';
1523
+ }
1524
+ return '<pre><code class="language-' + escape(lang) + '">' + (escaped ? code : escape(code, true)) + '</code></pre>\n';
1525
+ }
1526
+ blockquote(quote) {
1527
+ return `<blockquote>\n${quote}</blockquote>\n`;
1528
+ }
1529
+ html(html, block) {
1530
+ return html;
1531
+ }
1532
+ heading(text, level, raw) {
1533
+ // ignore IDs
1534
+ return `<h${level}>${text}</h${level}>\n`;
1535
+ }
1536
+ hr() {
1537
+ return '<hr>\n';
1538
+ }
1539
+ list(body, ordered, start) {
1540
+ const type = ordered ? 'ol' : 'ul';
1541
+ const startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
1542
+ return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
1543
+ }
1544
+ listitem(text, task, checked) {
1545
+ return `<li>${text}</li>\n`;
1546
+ }
1547
+ checkbox(checked) {
1548
+ return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox">';
1549
+ }
1550
+ paragraph(text) {
1551
+ return `<p>${text}</p>\n`;
1552
+ }
1553
+ table(header, body) {
1554
+ if (body) body = `<tbody>${body}</tbody>`;
1555
+ return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
1556
+ }
1557
+ tablerow(content) {
1558
+ return `<tr>\n${content}</tr>\n`;
1559
+ }
1560
+ tablecell(content, flags) {
1561
+ const type = flags.header ? 'th' : 'td';
1562
+ const tag = flags.align ? `<${type} align="${flags.align}">` : `<${type}>`;
1563
+ return tag + content + `</${type}>\n`;
1564
+ }
1565
+ /**
1566
+ * span level renderer
1567
+ */
1568
+ strong(text) {
1569
+ return `<strong>${text}</strong>`;
1570
+ }
1571
+ em(text) {
1572
+ return `<em>${text}</em>`;
1573
+ }
1574
+ codespan(text) {
1575
+ return `<code>${text}</code>`;
1576
+ }
1577
+ br() {
1578
+ return '<br>';
1579
+ }
1580
+ del(text) {
1581
+ return `<del>${text}</del>`;
1582
+ }
1583
+ link(href, title, text) {
1584
+ const cleanHref = cleanUrl(href);
1585
+ if (cleanHref === null) {
1586
+ return text;
1587
+ }
1588
+ href = cleanHref;
1589
+ let out = '<a href="' + href + '"';
1590
+ if (title) {
1591
+ out += ' title="' + title + '"';
1592
+ }
1593
+ out += '>' + text + '</a>';
1594
+ return out;
1595
+ }
1596
+ image(href, title, text) {
1597
+ const cleanHref = cleanUrl(href);
1598
+ if (cleanHref === null) {
1599
+ return text;
1600
+ }
1601
+ href = cleanHref;
1602
+ let out = `<img src="${href}" alt="${text}"`;
1603
+ if (title) {
1604
+ out += ` title="${title}"`;
1605
+ }
1606
+ out += '>';
1607
+ return out;
1608
+ }
1609
+ text(text) {
1610
+ return text;
1611
+ }
1612
+ }
1613
+
1614
+ /**
1615
+ * TextRenderer
1616
+ * returns only the textual part of the token
1617
+ */
1618
+ class _TextRenderer {
1619
+ // no need for block level renderers
1620
+ strong(text) {
1621
+ return text;
1622
+ }
1623
+ em(text) {
1624
+ return text;
1625
+ }
1626
+ codespan(text) {
1627
+ return text;
1628
+ }
1629
+ del(text) {
1630
+ return text;
1631
+ }
1632
+ html(text) {
1633
+ return text;
1634
+ }
1635
+ text(text) {
1636
+ return text;
1637
+ }
1638
+ link(href, title, text) {
1639
+ return '' + text;
1640
+ }
1641
+ image(href, title, text) {
1642
+ return '' + text;
1643
+ }
1644
+ br() {
1645
+ return '';
1646
+ }
1647
+ }
1648
+
1649
+ /**
1650
+ * Parsing & Compiling
1651
+ */
1652
+ class _Parser {
1653
+ constructor(options) {
1654
+ this.options = void 0;
1655
+ this.renderer = void 0;
1656
+ this.textRenderer = void 0;
1657
+ this.options = options || _defaults;
1658
+ this.options.renderer = this.options.renderer || new _Renderer();
1659
+ this.renderer = this.options.renderer;
1660
+ this.renderer.options = this.options;
1661
+ this.textRenderer = new _TextRenderer();
1662
+ }
1663
+ /**
1664
+ * Static Parse Method
1665
+ */
1666
+ static parse(tokens, options) {
1667
+ const parser = new _Parser(options);
1668
+ return parser.parse(tokens);
1669
+ }
1670
+ /**
1671
+ * Static Parse Inline Method
1672
+ */
1673
+ static parseInline(tokens, options) {
1674
+ const parser = new _Parser(options);
1675
+ return parser.parseInline(tokens);
1676
+ }
1677
+ /**
1678
+ * Parse Loop
1679
+ */
1680
+ parse(tokens, top = true) {
1681
+ let out = '';
1682
+ for (let i = 0; i < tokens.length; i++) {
1683
+ const token = tokens[i];
1684
+ // Run any renderer extensions
1685
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
1686
+ const genericToken = token;
1687
+ const ret = this.options.extensions.renderers[genericToken.type].call({
1688
+ parser: this
1689
+ }, genericToken);
1690
+ if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(genericToken.type)) {
1691
+ out += ret || '';
1692
+ continue;
1693
+ }
1694
+ }
1695
+ switch (token.type) {
1696
+ case 'space':
1697
+ {
1698
+ continue;
1699
+ }
1700
+ case 'hr':
1701
+ {
1702
+ out += this.renderer.hr();
1703
+ continue;
1704
+ }
1705
+ case 'heading':
1706
+ {
1707
+ const headingToken = token;
1708
+ out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape(this.parseInline(headingToken.tokens, this.textRenderer)));
1709
+ continue;
1710
+ }
1711
+ case 'code':
1712
+ {
1713
+ const codeToken = token;
1714
+ out += this.renderer.code(codeToken.text, codeToken.lang, !!codeToken.escaped);
1715
+ continue;
1716
+ }
1717
+ case 'table':
1718
+ {
1719
+ const tableToken = token;
1720
+ let header = '';
1721
+ // header
1722
+ let cell = '';
1723
+ for (let j = 0; j < tableToken.header.length; j++) {
1724
+ cell += this.renderer.tablecell(this.parseInline(tableToken.header[j].tokens), {
1725
+ header: true,
1726
+ align: tableToken.align[j]
1727
+ });
1728
+ }
1729
+ header += this.renderer.tablerow(cell);
1730
+ let body = '';
1731
+ for (let j = 0; j < tableToken.rows.length; j++) {
1732
+ const row = tableToken.rows[j];
1733
+ cell = '';
1734
+ for (let k = 0; k < row.length; k++) {
1735
+ cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
1736
+ header: false,
1737
+ align: tableToken.align[k]
1738
+ });
1739
+ }
1740
+ body += this.renderer.tablerow(cell);
1741
+ }
1742
+ out += this.renderer.table(header, body);
1743
+ continue;
1744
+ }
1745
+ case 'blockquote':
1746
+ {
1747
+ const blockquoteToken = token;
1748
+ const body = this.parse(blockquoteToken.tokens);
1749
+ out += this.renderer.blockquote(body);
1750
+ continue;
1751
+ }
1752
+ case 'list':
1753
+ {
1754
+ const listToken = token;
1755
+ const ordered = listToken.ordered;
1756
+ const start = listToken.start;
1757
+ const loose = listToken.loose;
1758
+ let body = '';
1759
+ for (let j = 0; j < listToken.items.length; j++) {
1760
+ const item = listToken.items[j];
1761
+ const checked = item.checked;
1762
+ const task = item.task;
1763
+ let itemBody = '';
1764
+ if (item.task) {
1765
+ const checkbox = this.renderer.checkbox(!!checked);
1766
+ if (loose) {
1767
+ if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
1768
+ item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
1769
+ if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
1770
+ item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
1771
+ }
1772
+ } else {
1773
+ item.tokens.unshift({
1774
+ type: 'text',
1775
+ text: checkbox + ' '
1776
+ });
1777
+ }
1778
+ } else {
1779
+ itemBody += checkbox + ' ';
1780
+ }
1781
+ }
1782
+ itemBody += this.parse(item.tokens, loose);
1783
+ body += this.renderer.listitem(itemBody, task, !!checked);
1784
+ }
1785
+ out += this.renderer.list(body, ordered, start);
1786
+ continue;
1787
+ }
1788
+ case 'html':
1789
+ {
1790
+ const htmlToken = token;
1791
+ out += this.renderer.html(htmlToken.text, htmlToken.block);
1792
+ continue;
1793
+ }
1794
+ case 'paragraph':
1795
+ {
1796
+ const paragraphToken = token;
1797
+ out += this.renderer.paragraph(this.parseInline(paragraphToken.tokens));
1798
+ continue;
1799
+ }
1800
+ case 'text':
1801
+ {
1802
+ let textToken = token;
1803
+ let body = textToken.tokens ? this.parseInline(textToken.tokens) : textToken.text;
1804
+ while (i + 1 < tokens.length && tokens[i + 1].type === 'text') {
1805
+ textToken = tokens[++i];
1806
+ body += '\n' + (textToken.tokens ? this.parseInline(textToken.tokens) : textToken.text);
1807
+ }
1808
+ out += top ? this.renderer.paragraph(body) : body;
1809
+ continue;
1810
+ }
1811
+ default:
1812
+ {
1813
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
1814
+ if (this.options.silent) {
1815
+ console.error(errMsg);
1816
+ return '';
1817
+ } else {
1818
+ throw new Error(errMsg);
1819
+ }
1820
+ }
1821
+ }
1822
+ }
1823
+ return out;
1824
+ }
1825
+ /**
1826
+ * Parse Inline Tokens
1827
+ */
1828
+ parseInline(tokens, renderer) {
1829
+ renderer = renderer || this.renderer;
1830
+ let out = '';
1831
+ for (let i = 0; i < tokens.length; i++) {
1832
+ const token = tokens[i];
1833
+ // Run any renderer extensions
1834
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
1835
+ const ret = this.options.extensions.renderers[token.type].call({
1836
+ parser: this
1837
+ }, token);
1838
+ if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
1839
+ out += ret || '';
1840
+ continue;
1841
+ }
1842
+ }
1843
+ switch (token.type) {
1844
+ case 'escape':
1845
+ {
1846
+ const escapeToken = token;
1847
+ out += renderer.text(escapeToken.text);
1848
+ break;
1849
+ }
1850
+ case 'html':
1851
+ {
1852
+ const tagToken = token;
1853
+ out += renderer.html(tagToken.text);
1854
+ break;
1855
+ }
1856
+ case 'link':
1857
+ {
1858
+ const linkToken = token;
1859
+ out += renderer.link(linkToken.href, linkToken.title, this.parseInline(linkToken.tokens, renderer));
1860
+ break;
1861
+ }
1862
+ case 'image':
1863
+ {
1864
+ const imageToken = token;
1865
+ out += renderer.image(imageToken.href, imageToken.title, imageToken.text);
1866
+ break;
1867
+ }
1868
+ case 'strong':
1869
+ {
1870
+ const strongToken = token;
1871
+ out += renderer.strong(this.parseInline(strongToken.tokens, renderer));
1872
+ break;
1873
+ }
1874
+ case 'em':
1875
+ {
1876
+ const emToken = token;
1877
+ out += renderer.em(this.parseInline(emToken.tokens, renderer));
1878
+ break;
1879
+ }
1880
+ case 'codespan':
1881
+ {
1882
+ const codespanToken = token;
1883
+ out += renderer.codespan(codespanToken.text);
1884
+ break;
1885
+ }
1886
+ case 'br':
1887
+ {
1888
+ out += renderer.br();
1889
+ break;
1890
+ }
1891
+ case 'del':
1892
+ {
1893
+ const delToken = token;
1894
+ out += renderer.del(this.parseInline(delToken.tokens, renderer));
1895
+ break;
1896
+ }
1897
+ case 'text':
1898
+ {
1899
+ const textToken = token;
1900
+ out += renderer.text(textToken.text);
1901
+ break;
1902
+ }
1903
+ default:
1904
+ {
1905
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
1906
+ if (this.options.silent) {
1907
+ console.error(errMsg);
1908
+ return '';
1909
+ } else {
1910
+ throw new Error(errMsg);
1911
+ }
1912
+ }
1913
+ }
1914
+ }
1915
+ return out;
1916
+ }
1917
+ }
1918
+ class _Hooks {
1919
+ constructor(options) {
1920
+ this.options = void 0;
1921
+ this.options = options || _defaults;
1922
+ }
1923
+ /**
1924
+ * Process markdown before marked
1925
+ */
1926
+ preprocess(markdown) {
1927
+ return markdown;
1928
+ }
1929
+ /**
1930
+ * Process HTML after marked is finished
1931
+ */
1932
+ postprocess(html) {
1933
+ return html;
1934
+ }
1935
+ }
1936
+ _Hooks.passThroughHooks = new Set(['preprocess', 'postprocess']);
1937
+ var _parseMarkdown = /*#__PURE__*/_classPrivateFieldLooseKey("parseMarkdown");
1938
+ var _onError = /*#__PURE__*/_classPrivateFieldLooseKey("onError");
1939
+ class Marked {
1940
+ constructor(...args) {
1941
+ Object.defineProperty(this, _onError, {
1942
+ value: _onError2
1943
+ });
1944
+ Object.defineProperty(this, _parseMarkdown, {
1945
+ value: _parseMarkdown2
1946
+ });
1947
+ this.defaults = _getDefaults();
1948
+ this.options = this.setOptions;
1949
+ this.parse = _classPrivateFieldLooseBase(this, _parseMarkdown)[_parseMarkdown](_Lexer.lex, _Parser.parse);
1950
+ this.parseInline = _classPrivateFieldLooseBase(this, _parseMarkdown)[_parseMarkdown](_Lexer.lexInline, _Parser.parseInline);
1951
+ this.Parser = _Parser;
1952
+ this.Renderer = _Renderer;
1953
+ this.TextRenderer = _TextRenderer;
1954
+ this.Lexer = _Lexer;
1955
+ this.Tokenizer = _Tokenizer;
1956
+ this.Hooks = _Hooks;
1957
+ this.use(...args);
1958
+ }
1959
+ /**
1960
+ * Run callback for every token
1961
+ */
1962
+ walkTokens(tokens, callback) {
1963
+ let values = [];
1964
+ for (const token of tokens) {
1965
+ values = values.concat(callback.call(this, token));
1966
+ switch (token.type) {
1967
+ case 'table':
1968
+ {
1969
+ const tableToken = token;
1970
+ for (const cell of tableToken.header) {
1971
+ values = values.concat(this.walkTokens(cell.tokens, callback));
1972
+ }
1973
+ for (const row of tableToken.rows) {
1974
+ for (const cell of row) {
1975
+ values = values.concat(this.walkTokens(cell.tokens, callback));
1976
+ }
1977
+ }
1978
+ break;
1979
+ }
1980
+ case 'list':
1981
+ {
1982
+ const listToken = token;
1983
+ values = values.concat(this.walkTokens(listToken.items, callback));
1984
+ break;
1985
+ }
1986
+ default:
1987
+ {
1988
+ const genericToken = token;
1989
+ if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
1990
+ this.defaults.extensions.childTokens[genericToken.type].forEach(childTokens => {
1991
+ values = values.concat(this.walkTokens(genericToken[childTokens], callback));
1992
+ });
1993
+ } else if (genericToken.tokens) {
1994
+ values = values.concat(this.walkTokens(genericToken.tokens, callback));
1995
+ }
1996
+ }
1997
+ }
1998
+ }
1999
+ return values;
2000
+ }
2001
+ use(...args) {
2002
+ const extensions = this.defaults.extensions || {
2003
+ renderers: {},
2004
+ childTokens: {}
2005
+ };
2006
+ args.forEach(pack => {
2007
+ // copy options to new object
2008
+ const opts = {
2009
+ ...pack
2010
+ };
2011
+ // set async to true if it was set to true before
2012
+ opts.async = this.defaults.async || opts.async || false;
2013
+ // ==-- Parse "addon" extensions --== //
2014
+ if (pack.extensions) {
2015
+ pack.extensions.forEach(ext => {
2016
+ if (!ext.name) {
2017
+ throw new Error('extension name required');
2018
+ }
2019
+ if ('renderer' in ext) {
2020
+ // Renderer extensions
2021
+ const prevRenderer = extensions.renderers[ext.name];
2022
+ if (prevRenderer) {
2023
+ // Replace extension with func to run new extension but fall back if false
2024
+ extensions.renderers[ext.name] = function (...args) {
2025
+ let ret = ext.renderer.apply(this, args);
2026
+ if (ret === false) {
2027
+ ret = prevRenderer.apply(this, args);
2028
+ }
2029
+ return ret;
2030
+ };
2031
+ } else {
2032
+ extensions.renderers[ext.name] = ext.renderer;
2033
+ }
2034
+ }
2035
+ if ('tokenizer' in ext) {
2036
+ // Tokenizer Extensions
2037
+ if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
2038
+ throw new Error("extension level must be 'block' or 'inline'");
2039
+ }
2040
+ const extLevel = extensions[ext.level];
2041
+ if (extLevel) {
2042
+ extLevel.unshift(ext.tokenizer);
2043
+ } else {
2044
+ extensions[ext.level] = [ext.tokenizer];
2045
+ }
2046
+ if (ext.start) {
2047
+ // Function to check for start of token
2048
+ if (ext.level === 'block') {
2049
+ if (extensions.startBlock) {
2050
+ extensions.startBlock.push(ext.start);
2051
+ } else {
2052
+ extensions.startBlock = [ext.start];
2053
+ }
2054
+ } else if (ext.level === 'inline') {
2055
+ if (extensions.startInline) {
2056
+ extensions.startInline.push(ext.start);
2057
+ } else {
2058
+ extensions.startInline = [ext.start];
2059
+ }
2060
+ }
2061
+ }
2062
+ }
2063
+ if ('childTokens' in ext && ext.childTokens) {
2064
+ // Child tokens to be visited by walkTokens
2065
+ extensions.childTokens[ext.name] = ext.childTokens;
2066
+ }
2067
+ });
2068
+ opts.extensions = extensions;
2069
+ }
2070
+ // ==-- Parse "overwrite" extensions --== //
2071
+ if (pack.renderer) {
2072
+ const renderer = this.defaults.renderer || new _Renderer(this.defaults);
2073
+ for (const prop in pack.renderer) {
2074
+ const rendererFunc = pack.renderer[prop];
2075
+ const rendererKey = prop;
2076
+ const prevRenderer = renderer[rendererKey];
2077
+ // Replace renderer with func to run extension, but fall back if false
2078
+ renderer[rendererKey] = (...args) => {
2079
+ let ret = rendererFunc.apply(renderer, args);
2080
+ if (ret === false) {
2081
+ ret = prevRenderer.apply(renderer, args);
2082
+ }
2083
+ return ret || '';
2084
+ };
2085
+ }
2086
+ opts.renderer = renderer;
2087
+ }
2088
+ if (pack.tokenizer) {
2089
+ const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
2090
+ for (const prop in pack.tokenizer) {
2091
+ const tokenizerFunc = pack.tokenizer[prop];
2092
+ const tokenizerKey = prop;
2093
+ const prevTokenizer = tokenizer[tokenizerKey];
2094
+ // Replace tokenizer with func to run extension, but fall back if false
2095
+ tokenizer[tokenizerKey] = (...args) => {
2096
+ let ret = tokenizerFunc.apply(tokenizer, args);
2097
+ if (ret === false) {
2098
+ ret = prevTokenizer.apply(tokenizer, args);
2099
+ }
2100
+ return ret;
2101
+ };
2102
+ }
2103
+ opts.tokenizer = tokenizer;
2104
+ }
2105
+ // ==-- Parse Hooks extensions --== //
2106
+ if (pack.hooks) {
2107
+ const hooks = this.defaults.hooks || new _Hooks();
2108
+ for (const prop in pack.hooks) {
2109
+ const hooksFunc = pack.hooks[prop];
2110
+ const hooksKey = prop;
2111
+ const prevHook = hooks[hooksKey];
2112
+ if (_Hooks.passThroughHooks.has(prop)) {
2113
+ hooks[hooksKey] = arg => {
2114
+ if (this.defaults.async) {
2115
+ return Promise.resolve(hooksFunc.call(hooks, arg)).then(ret => {
2116
+ return prevHook.call(hooks, ret);
2117
+ });
2118
+ }
2119
+ const ret = hooksFunc.call(hooks, arg);
2120
+ return prevHook.call(hooks, ret);
2121
+ };
2122
+ } else {
2123
+ hooks[hooksKey] = (...args) => {
2124
+ let ret = hooksFunc.apply(hooks, args);
2125
+ if (ret === false) {
2126
+ ret = prevHook.apply(hooks, args);
2127
+ }
2128
+ return ret;
2129
+ };
2130
+ }
2131
+ }
2132
+ opts.hooks = hooks;
2133
+ }
2134
+ // ==-- Parse WalkTokens extensions --== //
2135
+ if (pack.walkTokens) {
2136
+ const walkTokens = this.defaults.walkTokens;
2137
+ const packWalktokens = pack.walkTokens;
2138
+ opts.walkTokens = function (token) {
2139
+ let values = [];
2140
+ values.push(packWalktokens.call(this, token));
2141
+ if (walkTokens) {
2142
+ values = values.concat(walkTokens.call(this, token));
2143
+ }
2144
+ return values;
2145
+ };
2146
+ }
2147
+ this.defaults = {
2148
+ ...this.defaults,
2149
+ ...opts
2150
+ };
2151
+ });
2152
+ return this;
2153
+ }
2154
+ setOptions(opt) {
2155
+ this.defaults = {
2156
+ ...this.defaults,
2157
+ ...opt
2158
+ };
2159
+ return this;
2160
+ }
2161
+ lexer(src, options) {
2162
+ return _Lexer.lex(src, options ?? this.defaults);
2163
+ }
2164
+ parser(tokens, options) {
2165
+ return _Parser.parse(tokens, options ?? this.defaults);
2166
+ }
2167
+ }
2168
+ function _parseMarkdown2(lexer, parser) {
2169
+ return (src, options) => {
2170
+ const origOpt = {
2171
+ ...options
2172
+ };
2173
+ const opt = {
2174
+ ...this.defaults,
2175
+ ...origOpt
2176
+ };
2177
+ // Show warning if an extension set async to true but the parse was called with async: false
2178
+ if (this.defaults.async === true && origOpt.async === false) {
2179
+ if (!opt.silent) {
2180
+ console.warn('marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.');
2181
+ }
2182
+ opt.async = true;
2183
+ }
2184
+ const throwError = _classPrivateFieldLooseBase(this, _onError)[_onError](!!opt.silent, !!opt.async);
2185
+ // throw error in case of non string input
2186
+ if (typeof src === 'undefined' || src === null) {
2187
+ return throwError(new Error('marked(): input parameter is undefined or null'));
2188
+ }
2189
+ if (typeof src !== 'string') {
2190
+ return throwError(new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected'));
2191
+ }
2192
+ if (opt.hooks) {
2193
+ opt.hooks.options = opt;
2194
+ }
2195
+ if (opt.async) {
2196
+ return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then(src => lexer(src, opt)).then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then(tokens => parser(tokens, opt)).then(html => opt.hooks ? opt.hooks.postprocess(html) : html).catch(throwError);
2197
+ }
2198
+ try {
2199
+ if (opt.hooks) {
2200
+ src = opt.hooks.preprocess(src);
2201
+ }
2202
+ const tokens = lexer(src, opt);
2203
+ if (opt.walkTokens) {
2204
+ this.walkTokens(tokens, opt.walkTokens);
2205
+ }
2206
+ let html = parser(tokens, opt);
2207
+ if (opt.hooks) {
2208
+ html = opt.hooks.postprocess(html);
2209
+ }
2210
+ return html;
2211
+ } catch (e) {
2212
+ return throwError(e);
2213
+ }
2214
+ };
2215
+ }
2216
+ function _onError2(silent, async) {
2217
+ return e => {
2218
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2219
+ if (silent) {
2220
+ const msg = '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
2221
+ if (async) {
2222
+ return Promise.resolve(msg);
2223
+ }
2224
+ return msg;
2225
+ }
2226
+ if (async) {
2227
+ return Promise.reject(e);
2228
+ }
2229
+ throw e;
2230
+ };
2231
+ }
2232
+ const markedInstance = new Marked();
2233
+ function marked(src, opt) {
2234
+ return markedInstance.parse(src, opt);
2235
+ }
2236
+ /**
2237
+ * Sets the default options.
2238
+ *
2239
+ * @param options Hash of options
2240
+ */
2241
+ marked.options = marked.setOptions = function (options) {
2242
+ markedInstance.setOptions(options);
2243
+ marked.defaults = markedInstance.defaults;
2244
+ changeDefaults(marked.defaults);
2245
+ return marked;
2246
+ };
2247
+ /**
2248
+ * Gets the original marked default options.
2249
+ */
2250
+ marked.getDefaults = _getDefaults;
2251
+ marked.defaults = _defaults;
2252
+ /**
2253
+ * Use Extension
2254
+ */
2255
+ marked.use = function (...args) {
2256
+ markedInstance.use(...args);
2257
+ marked.defaults = markedInstance.defaults;
2258
+ changeDefaults(marked.defaults);
2259
+ return marked;
2260
+ };
2261
+ /**
2262
+ * Run callback for every token
2263
+ */
2264
+ marked.walkTokens = function (tokens, callback) {
2265
+ return markedInstance.walkTokens(tokens, callback);
2266
+ };
2267
+ /**
2268
+ * Compiles markdown to HTML without enclosing `p` tag.
2269
+ *
2270
+ * @param src String of markdown source to be compiled
2271
+ * @param options Hash of options
2272
+ * @return String of compiled HTML
2273
+ */
2274
+ marked.parseInline = markedInstance.parseInline;
2275
+ /**
2276
+ * Expose
2277
+ */
2278
+ marked.Parser = _Parser;
2279
+ marked.parser = _Parser.parse;
2280
+ marked.Renderer = _Renderer;
2281
+ marked.TextRenderer = _TextRenderer;
2282
+ marked.Lexer = _Lexer;
2283
+ marked.lexer = _Lexer.lex;
2284
+ marked.Tokenizer = _Tokenizer;
2285
+ marked.Hooks = _Hooks;
2286
+ marked.parse = marked;
2287
+
2288
+ var lib;
2289
+ var hasRequiredLib;
2290
+
2291
+ function requireLib () {
2292
+ if (hasRequiredLib) return lib;
2293
+ hasRequiredLib = 1;
2294
+
2295
+ function index({
2296
+ interruptPatterns = [],
2297
+ skipEmptyRows = true
2298
+ } = {}) {
2299
+ return {
2300
+ extensions: [{
2301
+ name: 'spanTable',
2302
+ level: 'block',
2303
+ // Is this a block-level or inline-level tokenizer?
2304
+ start(src) {
2305
+ return src.match(/\n *([^\n ].*\|.*)\n/m)?.index;
2306
+ },
2307
+ // Hint to Marked.js to stop and check for a match
2308
+ tokenizer(src, tokens) {
2309
+ // const regex = this.tokenizer.rules.block.table;
2310
+ let regexString = '^ *([^\\n ].*\\|.*\\n(?: *[^\\s].*\\n)*?)' // Header
2311
+ + ' {0,3}(?:\\| *)?(:?-+(?: *(?:100|[1-9][0-9]?%) *-+)?:? *(?:\\| *:?-+(?: *(?:100|[1-9][0-9]?%) *-+)?:? *)*)(?:\\| *)?' // Align
2312
+ + '(?:\\n((?:(?! *\\n| {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})' // Cells
2313
+ + '(?:\\n+|$)| {0,3}#{1,6}(?:\\s|$)| {0,3}>| {4}[^\\n]| {0,3}(?:`{3,}' + '(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n| {0,3}(?:[*+-]|1[.)]) |' + '<\\/?(?:address|article|aside|base|basefont|blockquote|body' + '|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt' + '|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]' + '|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem' + '|meta|nav|noframes|ol|optgroup|option|p|param|section|source' + '|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)' + '(?: +|\\n|\\/?>)|<(?:script|pre|style|textarea|!--)endRegex).*(?:\\n|$))*)\\n*|$)'; // Cells
2314
+
2315
+ regexString = regexString.replace('endRegex', interruptPatterns.map(str => `|(?:${str})`).join(''));
2316
+ const widthRegex = / *(?:100|[1-9][0-9]?%) */g;
2317
+ const regex = new RegExp(regexString);
2318
+ const cap = regex.exec(src);
2319
+ if (cap) {
2320
+ const item = {
2321
+ type: 'spanTable',
2322
+ header: cap[1].replace(/\n$/, '').split('\n'),
2323
+ align: cap[2].replace(widthRegex, '').replace(/^ *|\| *$/g, '').split(/ *\| */),
2324
+ rows: cap[3]?.trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : [],
2325
+ width: cap[2].replace(/:/g, '').replace(/-+| /g, '').split('|')
2326
+ };
2327
+
2328
+ // Get first header row to determine how many columns
2329
+ item.header[0] = splitCells(item.header[0]);
2330
+ const colCount = item.header[0].reduce((length, header) => {
2331
+ return length + header.colspan;
2332
+ }, 0);
2333
+ if (colCount === item.align.length) {
2334
+ item.raw = cap[0];
2335
+ let i, j, k, row;
2336
+
2337
+ // Get alignment row (:---:)
2338
+ let l = item.align.length;
2339
+ for (i = 0; i < l; i++) {
2340
+ if (/^ *-+: *$/.test(item.align[i])) {
2341
+ item.align[i] = 'right';
2342
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
2343
+ item.align[i] = 'center';
2344
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
2345
+ item.align[i] = 'left';
2346
+ } else {
2347
+ item.align[i] = null;
2348
+ }
2349
+ }
2350
+
2351
+ // Get any remaining header rows
2352
+ l = item.header.length;
2353
+ for (i = 1; i < l; i++) {
2354
+ item.header[i] = splitCells(item.header[i], colCount, item.header[i - 1], skipEmptyRows);
2355
+ }
2356
+
2357
+ // Get main table cells
2358
+ l = item.rows.length;
2359
+ for (i = 0; i < l; i++) {
2360
+ item.rows[i] = splitCells(item.rows[i], colCount, item.rows[i - 1], skipEmptyRows);
2361
+ }
2362
+
2363
+ // header child tokens
2364
+ l = item.header.length;
2365
+ for (j = 0; j < l; j++) {
2366
+ row = item.header[j];
2367
+ for (k = 0; k < row.length; k++) {
2368
+ row[k].tokens = [];
2369
+ this.lexer.inline(row[k].text, row[k].tokens);
2370
+ }
2371
+ }
2372
+
2373
+ // cell child tokens
2374
+ l = item.rows.length;
2375
+ for (j = 0; j < l; j++) {
2376
+ row = item.rows[j];
2377
+ for (k = 0; k < row.length; k++) {
2378
+ row[k].tokens = [];
2379
+ this.lexer.inline(row[k].text, row[k].tokens);
2380
+ }
2381
+ }
2382
+ return item;
2383
+ }
2384
+ }
2385
+ },
2386
+ renderer(token) {
2387
+ let i, j, row, cell, col, text;
2388
+ let output = '<table>';
2389
+ output += '<thead>';
2390
+ for (i = 0; i < token.header.length; i++) {
2391
+ row = token.header[i];
2392
+ let col = 0;
2393
+ output += '<tr>';
2394
+ for (j = 0; j < row.length; j++) {
2395
+ cell = row[j];
2396
+ text = this.parser.parseInline(cell.tokens);
2397
+ output += getTableCell(text, cell, 'th', token.align[col], token.width[col]);
2398
+ col += cell.colspan;
2399
+ }
2400
+ output += '</tr>';
2401
+ }
2402
+ output += '</thead>';
2403
+ if (token.rows.length) {
2404
+ output += '<tbody>';
2405
+ for (i = 0; i < token.rows.length; i++) {
2406
+ row = token.rows[i];
2407
+ col = 0;
2408
+ if (!row[0].emptyRow) {
2409
+ output += '<tr>';
2410
+ for (j = 0; j < row.length; j++) {
2411
+ cell = row[j];
2412
+ text = this.parser.parseInline(cell.tokens);
2413
+ output += getTableCell(text, cell, 'td', token.align[col], token.width[col]);
2414
+ col += cell.colspan;
2415
+ }
2416
+ output += '</tr>';
2417
+ }
2418
+ }
2419
+ output += '</tbody>';
2420
+ }
2421
+ output += '</table>';
2422
+ return output;
2423
+ }
2424
+ }]
2425
+ };
2426
+ }
2427
+ const getTableCell = (text, cell, type, align, width) => {
2428
+ if (!cell.rowspan) {
2429
+ return '';
2430
+ }
2431
+ const tag = `<${type}` + `${cell.colspan > 1 ? ` colspan=${cell.colspan}` : ''}` + `${cell.rowspan > 1 ? ` rowspan=${cell.rowspan}` : ''}` + `${align ? ` align=${align}` : ''}` + `${width ? ` width=${width}` : ''}>`;
2432
+ return `${tag + text}</${type}>\n`;
2433
+ };
2434
+ const splitCells = (tableRow, count, prevRow = [], skipEmptyRows) => {
2435
+ const cells = [...tableRow.trim().matchAll(/(?:[^|\\]|\\.?)+(?:\|+|$)/g)].map(x => x[0]);
2436
+
2437
+ // Remove first/last cell in a row if whitespace only and no leading/trailing pipe
2438
+ if (!cells[0]?.trim()) {
2439
+ cells.shift();
2440
+ }
2441
+ if (!cells[cells.length - 1]?.trim()) {
2442
+ cells.pop();
2443
+ }
2444
+ let numCols = 0;
2445
+ let i, j, trimmedCell, prevCell, prevCols;
2446
+ for (i = 0; i < cells.length; i++) {
2447
+ trimmedCell = cells[i].split(/\|+$/)[0];
2448
+ cells[i] = {
2449
+ rowspan: 1,
2450
+ colspan: Math.max(cells[i].length - trimmedCell.length, 1),
2451
+ text: trimmedCell.trim().replace(/\\\|/g, '|')
2452
+ // display escaped pipes as normal character
2453
+ };
2454
+
2455
+ // Handle Rowspan
2456
+ if (trimmedCell.slice(-1) === '^' && prevRow.length) {
2457
+ // Find matching cell in previous row
2458
+ prevCols = 0;
2459
+ for (j = 0; j < prevRow.length; j++) {
2460
+ prevCell = prevRow[j];
2461
+ if (prevCols === numCols && prevCell.colspan === cells[i].colspan) {
2462
+ // merge into matching cell in previous row (the "target")
2463
+ cells[i].rowSpanTarget = prevCell.rowSpanTarget ?? prevCell;
2464
+ cells[i].rowSpanTarget.text += ` ${cells[i].text.slice(0, -1)}`;
2465
+ cells[i].rowSpanTarget.rowspan += 1;
2466
+ cells[i].rowspan = 0;
2467
+ break;
2468
+ }
2469
+ prevCols += prevCell.colspan;
2470
+ if (prevCols > numCols) {
2471
+ break;
2472
+ }
2473
+ }
2474
+ }
2475
+ numCols += cells[i].colspan;
2476
+ }
2477
+
2478
+ // If all cells have been merged, flag as an empty row
2479
+ if (cells.length > 0 && skipEmptyRows && cells.length === cells.filter(cell => {
2480
+ return cell.rowspan === 0;
2481
+ }).length) {
2482
+ cells[0].emptyRow = true;
2483
+ for (i = 0; i < cells.length; i++) {
2484
+ cells[i].rowSpanTarget.rowspan -= 1;
2485
+ }
2486
+ }
2487
+
2488
+ // Force main cell rows to match header column count
2489
+ if (numCols > count) {
2490
+ cells.splice(count);
2491
+ } else {
2492
+ while (numCols < count) {
2493
+ cells.push({
2494
+ rowspan: 1,
2495
+ colspan: 1,
2496
+ text: ''
2497
+ });
2498
+ numCols += 1;
2499
+ }
2500
+ }
2501
+ return cells;
2502
+ };
2503
+ lib = index;
2504
+ return lib;
2505
+ }
2506
+
2507
+ var libExports = requireLib();
2508
+ var extendedTables = /*@__PURE__*/getDefaultExportFromCjs(libExports);
2509
+
2510
+ /**
2511
+ * marked 全局配置是否已初始化
2512
+ * marked 的 use/setOptions 作用于模块单例,仅需配置一次
2513
+ */
2514
+ let markedConfigured = false;
2515
+ /**
2516
+ * 初始化 marked 全局配置(GFM 表格 + 扩展表格语法 + 换行转 <br>)
2517
+ */
2518
+ function ensureMarkedConfigured() {
2519
+ if (markedConfigured) {
2520
+ return;
2521
+ }
2522
+ marked.use(extendedTables);
2523
+ marked.setOptions({
2524
+ breaks: true,
2525
+ gfm: true
2526
+ });
2527
+ markedConfigured = true;
2528
+ }
2529
+ /**
2530
+ * 为表格包裹滚动容器:
2531
+ * 移动端(<=767px)由 .md-table-wrap 提供横向滚动,表格保持自然宽度不被压缩;
2532
+ * PC 端该容器为普通块级元素,不影响现有展示与打印。
2533
+ */
2534
+ function wrapMarkdownTables(html) {
2535
+ if (!html.includes('<table')) {
2536
+ return html;
2537
+ }
2538
+ return html
2539
+ .replace(/<table(\s|>)/gi, '<div class="md-table-wrap"><table$1')
2540
+ .replace(/<\/table>/gi, '</table></div>');
2541
+ }
2542
+ /**
2543
+ * 渲染 Markdown 为 HTML(项目内统一的渲染入口)
2544
+ *
2545
+ * - 统一应用 GFM / extended-tables / breaks 配置
2546
+ * - 所有 <table> 会被包裹在 <div class="md-table-wrap"> 中,
2547
+ * 配合 global/markdown.css 实现移动端横向滚动、PC 端保持原样
2548
+ *
2549
+ * @param content Markdown 源文本
2550
+ * @returns 渲染后的 HTML 字符串,空内容返回空字符串
2551
+ */
2552
+ function renderMarkdown(content) {
2553
+ if (!content) {
2554
+ return '';
2555
+ }
2556
+ ensureMarkedConfigured();
2557
+ return wrapMarkdownTables(marked(content));
2558
+ }
2559
+
2560
+ exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
2561
+ exports.renderMarkdown = renderMarkdown;
2562
+ //# sourceMappingURL=markdown-D3_atg0b.js.map
2563
+
2564
+ //# sourceMappingURL=markdown-D3_atg0b.js.map