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