@ktnpm_devops/react-component 0.20.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. package/dist/composites/CustomRangePicker/CustomRangePicker.d.ts.map +1 -1
  2. package/dist/composites/DatePickerDropdown/DatePickerDropdown.d.ts.map +1 -1
  3. package/dist/composites/FilterDropdown/FilterDropdown.d.ts.map +1 -1
  4. package/dist/composites/MultiSelectDropdown/MultiSelectDropdown.d.ts.map +1 -1
  5. package/dist/composites/SingleSelectDropdown/SingleSelectDropdown.d.ts.map +1 -1
  6. package/dist/hooks/usePanelPlacement.d.ts +12 -20
  7. package/dist/hooks/usePanelPlacement.d.ts.map +1 -1
  8. package/dist/index10.cjs +1 -1
  9. package/dist/index10.js +1 -1
  10. package/dist/index100.cjs +10 -39
  11. package/dist/index100.cjs.map +1 -1
  12. package/dist/index100.js +9 -38
  13. package/dist/index100.js.map +1 -1
  14. package/dist/index101.cjs +62 -47
  15. package/dist/index101.cjs.map +1 -1
  16. package/dist/index101.js +62 -47
  17. package/dist/index101.js.map +1 -1
  18. package/dist/index102.cjs +18 -35
  19. package/dist/index102.cjs.map +1 -1
  20. package/dist/index102.js +17 -34
  21. package/dist/index102.js.map +1 -1
  22. package/dist/index103.cjs +27 -43
  23. package/dist/index103.cjs.map +1 -1
  24. package/dist/index103.js +26 -42
  25. package/dist/index103.js.map +1 -1
  26. package/dist/index104.cjs +18 -24
  27. package/dist/index104.cjs.map +1 -1
  28. package/dist/index104.js +17 -23
  29. package/dist/index104.js.map +1 -1
  30. package/dist/index105.cjs +18 -39
  31. package/dist/index105.cjs.map +1 -1
  32. package/dist/index105.js +17 -38
  33. package/dist/index105.js.map +1 -1
  34. package/dist/index106.cjs +7 -9
  35. package/dist/index106.cjs.map +1 -1
  36. package/dist/index106.js +6 -8
  37. package/dist/index106.js.map +1 -1
  38. package/dist/index107.cjs +24 -10
  39. package/dist/index107.cjs.map +1 -1
  40. package/dist/index107.js +23 -9
  41. package/dist/index107.js.map +1 -1
  42. package/dist/index108.cjs +22 -20
  43. package/dist/index108.cjs.map +1 -1
  44. package/dist/index108.js +21 -19
  45. package/dist/index108.js.map +1 -1
  46. package/dist/index109.cjs +7 -14
  47. package/dist/index109.cjs.map +1 -1
  48. package/dist/index109.js +6 -13
  49. package/dist/index109.js.map +1 -1
  50. package/dist/index11.cjs +1 -1
  51. package/dist/index11.js +1 -1
  52. package/dist/index110.cjs +24 -10
  53. package/dist/index110.cjs.map +1 -1
  54. package/dist/index110.js +23 -9
  55. package/dist/index110.js.map +1 -1
  56. package/dist/index111.cjs +17 -69
  57. package/dist/index111.cjs.map +1 -1
  58. package/dist/index111.js +16 -68
  59. package/dist/index111.js.map +1 -1
  60. package/dist/index112.cjs +2 -11
  61. package/dist/index112.cjs.map +1 -1
  62. package/dist/index112.js +2 -11
  63. package/dist/index112.js.map +1 -1
  64. package/dist/index113.cjs +10 -28
  65. package/dist/index113.cjs.map +1 -1
  66. package/dist/index113.js +11 -29
  67. package/dist/index113.js.map +1 -1
  68. package/dist/index114.cjs +2 -14
  69. package/dist/index114.cjs.map +1 -1
  70. package/dist/index114.js +2 -14
  71. package/dist/index114.js.map +1 -1
  72. package/dist/index115.cjs +32 -35
  73. package/dist/index115.cjs.map +1 -1
  74. package/dist/index115.js +32 -35
  75. package/dist/index115.js.map +1 -1
  76. package/dist/index116.cjs +16 -34
  77. package/dist/index116.cjs.map +1 -1
  78. package/dist/index116.js +16 -34
  79. package/dist/index116.js.map +1 -1
  80. package/dist/index117.cjs +14 -14
  81. package/dist/index117.js +15 -15
  82. package/dist/index118.cjs +14 -14
  83. package/dist/index118.js +15 -15
  84. package/dist/index119.cjs +13 -52
  85. package/dist/index119.cjs.map +1 -1
  86. package/dist/index119.js +14 -53
  87. package/dist/index119.js.map +1 -1
  88. package/dist/index12.cjs +1 -1
  89. package/dist/index12.js +1 -1
  90. package/dist/index120.cjs +36 -6
  91. package/dist/index120.cjs.map +1 -1
  92. package/dist/index120.js +36 -6
  93. package/dist/index120.js.map +1 -1
  94. package/dist/index121.cjs +49 -19
  95. package/dist/index121.cjs.map +1 -1
  96. package/dist/index121.js +50 -20
  97. package/dist/index121.js.map +1 -1
  98. package/dist/index122.cjs +48 -10
  99. package/dist/index122.cjs.map +1 -1
  100. package/dist/index122.js +47 -9
  101. package/dist/index122.js.map +1 -1
  102. package/dist/index123.cjs +18 -16
  103. package/dist/index123.cjs.map +1 -1
  104. package/dist/index123.js +17 -15
  105. package/dist/index123.js.map +1 -1
  106. package/dist/index124.cjs +32 -2
  107. package/dist/index124.cjs.map +1 -1
  108. package/dist/index124.js +33 -3
  109. package/dist/index124.js.map +1 -1
  110. package/dist/index125.cjs +30 -36
  111. package/dist/index125.cjs.map +1 -1
  112. package/dist/index125.js +30 -36
  113. package/dist/index125.js.map +1 -1
  114. package/dist/index126.cjs +2 -14
  115. package/dist/index126.cjs.map +1 -1
  116. package/dist/index126.js +2 -14
  117. package/dist/index126.js.map +1 -1
  118. package/dist/index127.cjs +46 -22
  119. package/dist/index127.cjs.map +1 -1
  120. package/dist/index127.js +46 -22
  121. package/dist/index127.js.map +1 -1
  122. package/dist/index128.cjs +12 -30
  123. package/dist/index128.cjs.map +1 -1
  124. package/dist/index128.js +12 -30
  125. package/dist/index128.js.map +1 -1
  126. package/dist/index129.cjs +43 -9
  127. package/dist/index129.cjs.map +1 -1
  128. package/dist/index129.js +43 -9
  129. package/dist/index129.js.map +1 -1
  130. package/dist/index13.cjs +1 -1
  131. package/dist/index13.js +1 -1
  132. package/dist/index130.cjs +70 -1158
  133. package/dist/index130.cjs.map +1 -1
  134. package/dist/index130.js +70 -1159
  135. package/dist/index130.js.map +1 -1
  136. package/dist/index131.cjs +1063 -1475
  137. package/dist/index131.cjs.map +1 -1
  138. package/dist/index131.js +1063 -1475
  139. package/dist/index131.js.map +1 -1
  140. package/dist/index132.cjs +1572 -31
  141. package/dist/index132.cjs.map +1 -1
  142. package/dist/index132.js +1572 -30
  143. package/dist/index132.js.map +1 -1
  144. package/dist/index133.cjs +37 -0
  145. package/dist/index133.cjs.map +1 -0
  146. package/dist/index133.js +37 -0
  147. package/dist/index133.js.map +1 -0
  148. package/dist/index14.cjs +1 -1
  149. package/dist/index14.js +1 -1
  150. package/dist/index15.cjs +1 -1
  151. package/dist/index15.js +1 -1
  152. package/dist/index16.cjs +1 -1
  153. package/dist/index16.js +1 -1
  154. package/dist/index17.cjs +1 -1
  155. package/dist/index17.js +1 -1
  156. package/dist/index18.cjs +1 -1
  157. package/dist/index18.js +1 -1
  158. package/dist/index19.cjs +1 -1
  159. package/dist/index19.js +1 -1
  160. package/dist/index20.cjs +1 -1
  161. package/dist/index20.js +1 -1
  162. package/dist/index21.cjs +1 -1
  163. package/dist/index21.js +1 -1
  164. package/dist/index22.cjs +1 -1
  165. package/dist/index22.js +1 -1
  166. package/dist/index23.cjs +1 -1
  167. package/dist/index23.js +1 -1
  168. package/dist/index24.cjs +1 -1
  169. package/dist/index24.js +1 -1
  170. package/dist/index25.cjs +4 -3
  171. package/dist/index25.cjs.map +1 -1
  172. package/dist/index25.js +4 -3
  173. package/dist/index25.js.map +1 -1
  174. package/dist/index26.cjs +1 -1
  175. package/dist/index26.js +1 -1
  176. package/dist/index27.cjs +4 -3
  177. package/dist/index27.cjs.map +1 -1
  178. package/dist/index27.js +4 -3
  179. package/dist/index27.js.map +1 -1
  180. package/dist/index28.cjs +1 -1
  181. package/dist/index28.js +1 -1
  182. package/dist/index29.cjs +4 -3
  183. package/dist/index29.cjs.map +1 -1
  184. package/dist/index29.js +4 -3
  185. package/dist/index29.js.map +1 -1
  186. package/dist/index30.cjs +10 -10
  187. package/dist/index30.js +10 -10
  188. package/dist/index31.cjs +4 -4
  189. package/dist/index31.js +4 -4
  190. package/dist/index32.cjs +3 -3
  191. package/dist/index32.js +3 -3
  192. package/dist/index33.cjs +1 -1
  193. package/dist/index33.js +1 -1
  194. package/dist/index34.cjs +1 -1
  195. package/dist/index34.js +1 -1
  196. package/dist/index35.cjs +1 -1
  197. package/dist/index35.js +1 -1
  198. package/dist/index36.cjs +2 -2
  199. package/dist/index36.js +2 -2
  200. package/dist/index37.cjs +1 -1
  201. package/dist/index37.js +1 -1
  202. package/dist/index38.cjs +4 -3
  203. package/dist/index38.cjs.map +1 -1
  204. package/dist/index38.js +4 -3
  205. package/dist/index38.js.map +1 -1
  206. package/dist/index39.cjs +1 -1
  207. package/dist/index39.js +1 -1
  208. package/dist/index40.cjs +1 -1
  209. package/dist/index40.js +1 -1
  210. package/dist/index41.cjs +1 -1
  211. package/dist/index41.js +1 -1
  212. package/dist/index42.cjs +1 -1
  213. package/dist/index42.js +1 -1
  214. package/dist/index43.cjs +1 -1
  215. package/dist/index43.js +1 -1
  216. package/dist/index44.cjs +1 -1
  217. package/dist/index44.js +1 -1
  218. package/dist/index45.cjs +3 -3
  219. package/dist/index45.js +3 -3
  220. package/dist/index47.cjs +1 -1
  221. package/dist/index47.js +1 -1
  222. package/dist/index48.cjs +1 -1
  223. package/dist/index48.js +1 -1
  224. package/dist/index49.cjs +1 -1
  225. package/dist/index49.js +1 -1
  226. package/dist/index50.cjs +4 -3
  227. package/dist/index50.cjs.map +1 -1
  228. package/dist/index50.js +4 -3
  229. package/dist/index50.js.map +1 -1
  230. package/dist/index51.cjs +1 -1
  231. package/dist/index51.js +1 -1
  232. package/dist/index52.cjs +2 -2
  233. package/dist/index52.js +2 -2
  234. package/dist/index53.cjs +1 -1
  235. package/dist/index53.js +1 -1
  236. package/dist/index54.cjs +1 -1
  237. package/dist/index54.js +1 -1
  238. package/dist/index55.cjs +2 -2
  239. package/dist/index55.js +2 -2
  240. package/dist/index56.cjs +1 -1
  241. package/dist/index56.js +1 -1
  242. package/dist/index57.cjs +1 -1
  243. package/dist/index57.js +1 -1
  244. package/dist/index58.cjs +1 -1
  245. package/dist/index58.js +1 -1
  246. package/dist/index61.cjs +23 -2
  247. package/dist/index61.cjs.map +1 -1
  248. package/dist/index61.js +24 -3
  249. package/dist/index61.js.map +1 -1
  250. package/dist/index63.cjs +16 -19
  251. package/dist/index63.cjs.map +1 -1
  252. package/dist/index63.js +17 -20
  253. package/dist/index63.js.map +1 -1
  254. package/dist/index64.cjs +17 -14
  255. package/dist/index64.cjs.map +1 -1
  256. package/dist/index64.js +17 -14
  257. package/dist/index64.js.map +1 -1
  258. package/dist/index65.cjs +17 -2
  259. package/dist/index65.cjs.map +1 -1
  260. package/dist/index65.js +18 -3
  261. package/dist/index65.js.map +1 -1
  262. package/dist/index66.cjs +19 -22
  263. package/dist/index66.cjs.map +1 -1
  264. package/dist/index66.js +20 -23
  265. package/dist/index66.js.map +1 -1
  266. package/dist/index67.cjs +12 -15
  267. package/dist/index67.cjs.map +1 -1
  268. package/dist/index67.js +12 -15
  269. package/dist/index67.js.map +1 -1
  270. package/dist/index68.cjs +65 -2
  271. package/dist/index68.cjs.map +1 -1
  272. package/dist/index68.js +66 -3
  273. package/dist/index68.js.map +1 -1
  274. package/dist/index69.cjs +2 -14
  275. package/dist/index69.cjs.map +1 -1
  276. package/dist/index69.js +3 -15
  277. package/dist/index69.js.map +1 -1
  278. package/dist/index70.cjs +73 -18
  279. package/dist/index70.cjs.map +1 -1
  280. package/dist/index70.js +72 -17
  281. package/dist/index70.js.map +1 -1
  282. package/dist/index71.cjs +52 -19
  283. package/dist/index71.cjs.map +1 -1
  284. package/dist/index71.js +52 -19
  285. package/dist/index71.js.map +1 -1
  286. package/dist/index72.cjs +77 -14
  287. package/dist/index72.cjs.map +1 -1
  288. package/dist/index72.js +78 -15
  289. package/dist/index72.js.map +1 -1
  290. package/dist/index73.cjs +19 -134
  291. package/dist/index73.cjs.map +1 -1
  292. package/dist/index73.js +18 -133
  293. package/dist/index73.js.map +1 -1
  294. package/dist/index74.cjs +30 -36
  295. package/dist/index74.cjs.map +1 -1
  296. package/dist/index74.js +30 -36
  297. package/dist/index74.js.map +1 -1
  298. package/dist/index75.cjs +29 -20
  299. package/dist/index75.cjs.map +1 -1
  300. package/dist/index75.js +29 -20
  301. package/dist/index75.js.map +1 -1
  302. package/dist/index76.cjs +5 -29
  303. package/dist/index76.cjs.map +1 -1
  304. package/dist/index76.js +6 -30
  305. package/dist/index76.js.map +1 -1
  306. package/dist/index77.cjs +9 -46
  307. package/dist/index77.cjs.map +1 -1
  308. package/dist/index77.js +8 -45
  309. package/dist/index77.js.map +1 -1
  310. package/dist/index78.cjs +26 -77
  311. package/dist/index78.cjs.map +1 -1
  312. package/dist/index78.js +26 -77
  313. package/dist/index78.js.map +1 -1
  314. package/dist/index79.cjs +33 -42
  315. package/dist/index79.cjs.map +1 -1
  316. package/dist/index79.js +33 -42
  317. package/dist/index79.js.map +1 -1
  318. package/dist/index80.cjs +134 -58
  319. package/dist/index80.cjs.map +1 -1
  320. package/dist/index80.js +133 -57
  321. package/dist/index80.js.map +1 -1
  322. package/dist/index81.cjs +36 -30
  323. package/dist/index81.cjs.map +1 -1
  324. package/dist/index81.js +36 -30
  325. package/dist/index81.js.map +1 -1
  326. package/dist/index82.cjs +58 -48
  327. package/dist/index82.cjs.map +1 -1
  328. package/dist/index82.js +57 -47
  329. package/dist/index82.js.map +1 -1
  330. package/dist/index83.cjs +37 -15
  331. package/dist/index83.cjs.map +1 -1
  332. package/dist/index83.js +37 -15
  333. package/dist/index83.js.map +1 -1
  334. package/dist/index84.cjs +92 -36
  335. package/dist/index84.cjs.map +1 -1
  336. package/dist/index84.js +91 -35
  337. package/dist/index84.js.map +1 -1
  338. package/dist/index85.cjs +34 -10
  339. package/dist/index85.cjs.map +1 -1
  340. package/dist/index85.js +34 -10
  341. package/dist/index85.js.map +1 -1
  342. package/dist/index86.cjs +116 -70
  343. package/dist/index86.cjs.map +1 -1
  344. package/dist/index86.js +115 -69
  345. package/dist/index86.js.map +1 -1
  346. package/dist/index87.cjs +42 -17
  347. package/dist/index87.cjs.map +1 -1
  348. package/dist/index87.js +41 -16
  349. package/dist/index87.js.map +1 -1
  350. package/dist/index88.cjs +22 -6
  351. package/dist/index88.cjs.map +1 -1
  352. package/dist/index88.js +21 -5
  353. package/dist/index88.js.map +1 -1
  354. package/dist/index89.cjs +63 -109
  355. package/dist/index89.cjs.map +1 -1
  356. package/dist/index89.js +64 -110
  357. package/dist/index89.js.map +1 -1
  358. package/dist/index90.cjs +7 -42
  359. package/dist/index90.cjs.map +1 -1
  360. package/dist/index90.js +6 -41
  361. package/dist/index90.js.map +1 -1
  362. package/dist/index91.cjs +34 -16
  363. package/dist/index91.cjs.map +1 -1
  364. package/dist/index91.js +34 -16
  365. package/dist/index91.js.map +1 -1
  366. package/dist/index92.cjs +33 -20
  367. package/dist/index92.cjs.map +1 -1
  368. package/dist/index92.js +33 -20
  369. package/dist/index92.js.map +1 -1
  370. package/dist/index93.cjs +36 -62
  371. package/dist/index93.cjs.map +1 -1
  372. package/dist/index93.js +37 -63
  373. package/dist/index93.js.map +1 -1
  374. package/dist/index94.cjs +23 -6
  375. package/dist/index94.cjs.map +1 -1
  376. package/dist/index94.js +23 -6
  377. package/dist/index94.js.map +1 -1
  378. package/dist/index95.cjs +39 -39
  379. package/dist/index95.cjs.map +1 -1
  380. package/dist/index95.js +38 -38
  381. package/dist/index95.js.map +1 -1
  382. package/dist/index96.cjs +9 -22
  383. package/dist/index96.cjs.map +1 -1
  384. package/dist/index96.js +8 -21
  385. package/dist/index96.js.map +1 -1
  386. package/dist/index97.cjs +10 -6
  387. package/dist/index97.cjs.map +1 -1
  388. package/dist/index97.js +9 -5
  389. package/dist/index97.js.map +1 -1
  390. package/dist/index98.cjs +19 -39
  391. package/dist/index98.cjs.map +1 -1
  392. package/dist/index98.js +19 -39
  393. package/dist/index98.js.map +1 -1
  394. package/dist/index99.cjs +12 -91
  395. package/dist/index99.cjs.map +1 -1
  396. package/dist/index99.js +12 -91
  397. package/dist/index99.js.map +1 -1
  398. package/dist/style.css +55 -0
  399. package/dist/utils/clippingRect.d.ts +11 -11
  400. package/dist/utils/clippingRect.d.ts.map +1 -1
  401. package/dist/utils/panelPlacement.d.ts +34 -0
  402. package/dist/utils/panelPlacement.d.ts.map +1 -0
  403. package/dist/utils/panelPlacement.test.d.ts +2 -0
  404. package/dist/utils/panelPlacement.test.d.ts.map +1 -0
  405. package/dist/utils/panelPlacement.types.d.ts +57 -0
  406. package/dist/utils/panelPlacement.types.d.ts.map +1 -0
  407. package/package.json +1 -1
package/dist/index131.cjs CHANGED
@@ -1,1578 +1,1166 @@
1
1
  "use strict";
2
- /*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */
3
- function _arrayLikeToArray(r, a) {
4
- (null == a || a > r.length) && (a = r.length);
5
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6
- return n;
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ var _a;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ function M() {
8
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
7
9
  }
8
- function _arrayWithHoles(r) {
9
- if (Array.isArray(r)) return r;
10
+ exports.defaults = M();
11
+ function G(u3) {
12
+ exports.defaults = u3;
10
13
  }
11
- function _iterableToArrayLimit(r, l) {
12
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
13
- if (null != t) {
14
- var e, n, i, u, a = [], f = true, o = false;
15
- try {
16
- if (i = (t = t.call(r)).next, 0 === l) ;
17
- else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
18
- } catch (r2) {
19
- o = true, n = r2;
20
- } finally {
21
- try {
22
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
23
- } finally {
24
- if (o) throw n;
25
- }
26
- }
27
- return a;
14
+ var _ = { exec: () => null };
15
+ function k(u3, e = "") {
16
+ let t = typeof u3 == "string" ? u3 : u3.source, n = { replace: (r, i) => {
17
+ let s = typeof i == "string" ? i : i.source;
18
+ return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
19
+ }, getRegex: () => new RegExp(t, e) };
20
+ return n;
21
+ }
22
+ var be = (() => {
23
+ try {
24
+ return !!new RegExp("(?<=1)(?<!1)");
25
+ } catch {
26
+ return false;
28
27
  }
28
+ })(), m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (u3) => new RegExp(`^( {0,3}${u3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}#`), htmlBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}>`) }, Re = /^(?:[ \t]*(?:\n|$))+/, Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Te = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = / {0,3}(?:[*+-]|\d{1,9}[.)])/, se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ie = k(se).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ye = k(se).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Pe = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Se = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), $e = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), v = "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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _e = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oe = k(j).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Le = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(), K = { blockquote: Le, code: Oe, def: Se, fences: Te, heading: we, hr: C, html: _e, lheading: ie, list: $e, newline: Re, paragraph: oe, table: _, text: Pe }, ne = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Me = { ...K, lheading: ye, table: ne, paragraph: k(j).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ne).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() }, ze = { ...K, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).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(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(j).replace("hr", C).replace("heading", ` *#{1,6} *[^
29
+ ]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ee = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ie = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ae = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, z = /[\p{P}\p{S}]/u, H = /[\s\p{P}\p{S}]/u, W = /[^\s\p{P}\p{S}]/u, Ce = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, H).getRegex(), le = /(?!~)[\p{P}\p{S}]/u, Be = /(?!~)[\s\p{P}\p{S}]/u, De = /(?:[^\s\p{P}\p{S}]|~)/u, qe = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", be ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, ve = k(ue, "u").replace(/punct/g, z).getRegex(), He = k(ue, "u").replace(/punct/g, le).getRegex(), pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ze = k(pe, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Ge = k(pe, "gu").replace(/notPunctSpace/g, De).replace(/punctSpace/g, Be).replace(/punct/g, le).getRegex(), Ne = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Qe = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, z).getRegex(), je = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Fe = k(je, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Ue = k(/\\(punct)/, "gu").replace(/punct/g, z).getRegex(), Ke = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(), We = k(U).replace("(?:-->|$)", "-->").getRegex(), Xe = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", We).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ce = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), he = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ve = k("reflink|nolink(?!\\()", "g").replace("reflink", ce).replace("nolink", he).getRegex(), re = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, X = { _backpedal: _, anyPunctuation: Ue, autolink: Ke, blockSkip: qe, br: ae, code: Ie, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: ve, emStrongRDelimAst: Ze, emStrongRDelimUnd: Ne, escape: Ee, link: Je, nolink: he, punctuation: Ce, reflink: ce, reflinkSearch: Ve, tag: Xe, text: Ae, url: _ }, Ye = { ...X, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, N = { ...X, emStrongRDelimAst: Ge, emStrongLDelim: He, delLDelim: Qe, delRDelim: Fe, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", re).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", re).getRegex() }, et = { ...N, br: k(ae).replace("{2,}", "*").getRegex(), text: k(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, B = { normal: K, gfm: Me, pedantic: ze }, E = { normal: X, gfm: N, breaks: et, pedantic: Ye };
30
+ var tt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ke = (u3) => tt[u3];
31
+ function T(u3, e) {
32
+ if (e) {
33
+ if (m.escapeTest.test(u3)) return u3.replace(m.escapeReplace, ke);
34
+ } else if (m.escapeTestNoEncode.test(u3)) return u3.replace(m.escapeReplaceNoEncode, ke);
35
+ return u3;
29
36
  }
30
- function _nonIterableRest() {
31
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
37
+ function J(u3) {
38
+ try {
39
+ u3 = encodeURI(u3).replace(m.percentDecode, "%");
40
+ } catch {
41
+ return null;
42
+ }
43
+ return u3;
32
44
  }
33
- function _slicedToArray(r, e) {
34
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
45
+ function V(u3, e) {
46
+ var _a2;
47
+ let t = u3.replace(m.findPipe, (i, s, a) => {
48
+ let o = false, l = s;
49
+ for (; --l >= 0 && a[l] === "\\"; ) o = !o;
50
+ return o ? "|" : " |";
51
+ }), n = t.split(m.splitPipe), r = 0;
52
+ if (n[0].trim() || n.shift(), n.length > 0 && !((_a2 = n.at(-1)) == null ? void 0 : _a2.trim()) && n.pop(), e) if (n.length > e) n.splice(e);
53
+ else for (; n.length < e; ) n.push("");
54
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
55
+ return n;
35
56
  }
36
- function _unsupportedIterableToArray(r, a) {
37
- if (r) {
38
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
39
- var t = {}.toString.call(r).slice(8, -1);
40
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
57
+ function I(u3, e, t) {
58
+ let n = u3.length;
59
+ if (n === 0) return "";
60
+ let r = 0;
61
+ for (; r < n; ) {
62
+ let i = u3.charAt(n - r - 1);
63
+ if (i === e && true) r++;
64
+ else break;
41
65
  }
66
+ return u3.slice(0, n - r);
42
67
  }
43
- const entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
44
- let freeze = Object.freeze, seal = Object.seal, create = Object.create;
45
- let _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
46
- if (!freeze) {
47
- freeze = function freeze2(x) {
48
- return x;
49
- };
68
+ function de(u3, e) {
69
+ if (u3.indexOf(e[1]) === -1) return -1;
70
+ let t = 0;
71
+ for (let n = 0; n < u3.length; n++) if (u3[n] === "\\") n++;
72
+ else if (u3[n] === e[0]) t++;
73
+ else if (u3[n] === e[1] && (t--, t < 0)) return n;
74
+ return t > 0 ? -2 : -1;
50
75
  }
51
- if (!seal) {
52
- seal = function seal2(x) {
53
- return x;
54
- };
76
+ function ge(u3, e = 0) {
77
+ let t = e, n = "";
78
+ for (let r of u3) if (r === " ") {
79
+ let i = 4 - t % 4;
80
+ n += " ".repeat(i), t += i;
81
+ } else n += r, t++;
82
+ return n;
55
83
  }
56
- if (!apply) {
57
- apply = function apply2(func, thisArg) {
58
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
59
- args[_key - 2] = arguments[_key];
60
- }
61
- return func.apply(thisArg, args);
62
- };
84
+ function fe(u3, e, t, n, r) {
85
+ let i = e.href, s = e.title || null, a = u3[1].replace(r.other.outputLinkReplace, "$1");
86
+ n.state.inLink = true;
87
+ let o = { type: u3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
88
+ return n.state.inLink = false, o;
63
89
  }
64
- if (!construct) {
65
- construct = function construct2(Func) {
66
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
67
- args[_key2 - 1] = arguments[_key2];
68
- }
69
- return new Func(...args);
70
- };
90
+ function nt(u3, e, t) {
91
+ let n = u3.match(t.other.indentCodeCompensation);
92
+ if (n === null) return e;
93
+ let r = n[1];
94
+ return e.split(`
95
+ `).map((i) => {
96
+ let s = i.match(t.other.beginningSpace);
97
+ if (s === null) return i;
98
+ let [a] = s;
99
+ return a.length >= r.length ? i.slice(r.length) : i;
100
+ }).join(`
101
+ `);
71
102
  }
72
- const arrayForEach = unapply(Array.prototype.forEach);
73
- const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
74
- const arrayPop = unapply(Array.prototype.pop);
75
- const arrayPush = unapply(Array.prototype.push);
76
- const arraySplice = unapply(Array.prototype.splice);
77
- const arrayIsArray = Array.isArray;
78
- const stringToLowerCase = unapply(String.prototype.toLowerCase);
79
- const stringToString = unapply(String.prototype.toString);
80
- const stringMatch = unapply(String.prototype.match);
81
- const stringReplace = unapply(String.prototype.replace);
82
- const stringIndexOf = unapply(String.prototype.indexOf);
83
- const stringTrim = unapply(String.prototype.trim);
84
- const numberToString = unapply(Number.prototype.toString);
85
- const booleanToString = unapply(Boolean.prototype.toString);
86
- const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
87
- const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
88
- const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
89
- const objectToString = unapply(Object.prototype.toString);
90
- const regExpTest = unapply(RegExp.prototype.test);
91
- const typeErrorCreate = unconstruct(TypeError);
92
- function unapply(func) {
93
- return function(thisArg) {
94
- if (thisArg instanceof RegExp) {
95
- thisArg.lastIndex = 0;
96
- }
97
- for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
98
- args[_key3 - 1] = arguments[_key3];
103
+ var w = class {
104
+ constructor(e) {
105
+ __publicField(this, "options");
106
+ __publicField(this, "rules");
107
+ __publicField(this, "lexer");
108
+ this.options = e || exports.defaults;
109
+ }
110
+ space(e) {
111
+ let t = this.rules.block.newline.exec(e);
112
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
113
+ }
114
+ code(e) {
115
+ let t = this.rules.block.code.exec(e);
116
+ if (t) {
117
+ let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
118
+ return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : I(n, `
119
+ `) };
99
120
  }
100
- return apply(func, thisArg, args);
101
- };
102
- }
103
- function unconstruct(Func) {
104
- return function() {
105
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
106
- args[_key4] = arguments[_key4];
121
+ }
122
+ fences(e) {
123
+ let t = this.rules.block.fences.exec(e);
124
+ if (t) {
125
+ let n = t[0], r = nt(n, t[3] || "", this.rules);
126
+ return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
107
127
  }
108
- return construct(Func, args);
109
- };
110
- }
111
- function addToSet(set, array) {
112
- let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
113
- if (setPrototypeOf) {
114
- setPrototypeOf(set, null);
115
- }
116
- if (!arrayIsArray(array)) {
117
- return set;
118
- }
119
- let l = array.length;
120
- while (l--) {
121
- let element = array[l];
122
- if (typeof element === "string") {
123
- const lcElement = transformCaseFunc(element);
124
- if (lcElement !== element) {
125
- if (!isFrozen(array)) {
126
- array[l] = lcElement;
127
- }
128
- element = lcElement;
128
+ }
129
+ heading(e) {
130
+ let t = this.rules.block.heading.exec(e);
131
+ if (t) {
132
+ let n = t[2].trim();
133
+ if (this.rules.other.endingHash.test(n)) {
134
+ let r = I(n, "#");
135
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
129
136
  }
137
+ return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
130
138
  }
131
- set[element] = true;
132
139
  }
133
- return set;
134
- }
135
- function cleanArray(array) {
136
- for (let index = 0; index < array.length; index++) {
137
- const isPropertyExist = objectHasOwnProperty(array, index);
138
- if (!isPropertyExist) {
139
- array[index] = null;
140
- }
140
+ hr(e) {
141
+ let t = this.rules.block.hr.exec(e);
142
+ if (t) return { type: "hr", raw: I(t[0], `
143
+ `) };
141
144
  }
142
- return array;
143
- }
144
- function clone(object) {
145
- const newObject = create(null);
146
- for (const _ref2 of entries(object)) {
147
- var _ref3 = _slicedToArray(_ref2, 2);
148
- const property = _ref3[0];
149
- const value = _ref3[1];
150
- const isPropertyExist = objectHasOwnProperty(object, property);
151
- if (isPropertyExist) {
152
- if (arrayIsArray(value)) {
153
- newObject[property] = cleanArray(value);
154
- } else if (value && typeof value === "object" && value.constructor === Object) {
155
- newObject[property] = clone(value);
156
- } else {
157
- newObject[property] = value;
145
+ blockquote(e) {
146
+ let t = this.rules.block.blockquote.exec(e);
147
+ if (t) {
148
+ let n = I(t[0], `
149
+ `).split(`
150
+ `), r = "", i = "", s = [];
151
+ for (; n.length > 0; ) {
152
+ let a = false, o = [], l;
153
+ for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = true;
154
+ else if (!a) o.push(n[l]);
155
+ else break;
156
+ n = n.slice(l);
157
+ let p = o.join(`
158
+ `), c = p.replace(this.rules.other.blockquoteSetextReplace, `
159
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
160
+ r = r ? `${r}
161
+ ${p}` : p, i = i ? `${i}
162
+ ${c}` : c;
163
+ let d = this.lexer.state.top;
164
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = d, n.length === 0) break;
165
+ let h = s.at(-1);
166
+ if ((h == null ? void 0 : h.type) === "code") break;
167
+ if ((h == null ? void 0 : h.type) === "blockquote") {
168
+ let R = h, f = R.raw + `
169
+ ` + n.join(`
170
+ `), S = this.blockquote(f);
171
+ s[s.length - 1] = S, r = r.substring(0, r.length - R.raw.length) + S.raw, i = i.substring(0, i.length - R.text.length) + S.text;
172
+ break;
173
+ } else if ((h == null ? void 0 : h.type) === "list") {
174
+ let R = h, f = R.raw + `
175
+ ` + n.join(`
176
+ `), S = this.list(f);
177
+ s[s.length - 1] = S, r = r.substring(0, r.length - h.raw.length) + S.raw, i = i.substring(0, i.length - R.raw.length) + S.raw, n = f.substring(s.at(-1).raw.length).split(`
178
+ `);
179
+ continue;
180
+ }
158
181
  }
182
+ return { type: "blockquote", raw: r, tokens: s, text: i };
159
183
  }
160
184
  }
161
- return newObject;
162
- }
163
- function stringifyValue(value) {
164
- switch (typeof value) {
165
- case "string": {
166
- return value;
167
- }
168
- case "number": {
169
- return numberToString(value);
170
- }
171
- case "boolean": {
172
- return booleanToString(value);
173
- }
174
- case "bigint": {
175
- return bigintToString ? bigintToString(value) : "0";
176
- }
177
- case "symbol": {
178
- return symbolToString ? symbolToString(value) : "Symbol()";
179
- }
180
- case "undefined": {
181
- return objectToString(value);
182
- }
183
- case "function":
184
- case "object": {
185
- if (value === null) {
186
- return objectToString(value);
185
+ list(e) {
186
+ var _a2, _b;
187
+ let t = this.rules.block.list.exec(e);
188
+ if (t) {
189
+ let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
190
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
191
+ let s = this.rules.other.listItemRegex(n), a = false;
192
+ for (; e; ) {
193
+ let l = false, p = "", c = "";
194
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
195
+ p = t[0], e = e.substring(p.length);
196
+ let d = ge(t[2].split(`
197
+ `, 1)[0], t[1].length), h = e.split(`
198
+ `, 1)[0], R = !d.trim(), f = 0;
199
+ if (this.options.pedantic ? (f = 2, c = d.trimStart()) : R ? f = t[1].length + 1 : (f = d.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = d.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
200
+ `, e = e.substring(h.length + 1), l = true), !l) {
201
+ let S = this.rules.other.nextBulletRegex(f), Y = this.rules.other.hrRegex(f), ee = this.rules.other.fencesBeginRegex(f), te = this.rules.other.headingBeginRegex(f), me = this.rules.other.htmlBeginRegex(f), xe = this.rules.other.blockquoteBeginRegex(f);
202
+ for (; e; ) {
203
+ let Z = e.split(`
204
+ `, 1)[0], A;
205
+ if (h = Z, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), ee.test(h) || te.test(h) || me.test(h) || xe.test(h) || S.test(h) || Y.test(h)) break;
206
+ if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
207
+ ` + A.slice(f);
208
+ else {
209
+ if (R || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ee.test(d) || te.test(d) || Y.test(d)) break;
210
+ c += `
211
+ ` + h;
212
+ }
213
+ R = !h.trim(), p += Z + `
214
+ `, e = e.substring(Z.length + 1), d = A.slice(f);
215
+ }
216
+ }
217
+ i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)), i.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), i.raw += p;
218
+ }
219
+ let o = i.items.at(-1);
220
+ if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
221
+ else return;
222
+ i.raw = i.raw.trimEnd();
223
+ for (let l of i.items) {
224
+ if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
225
+ if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), ((_a2 = l.tokens[0]) == null ? void 0 : _a2.type) === "text" || ((_b = l.tokens[0]) == null ? void 0 : _b.type) === "paragraph") {
226
+ l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
227
+ for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
228
+ this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
229
+ break;
230
+ }
231
+ }
232
+ let p = this.rules.other.listTaskCheckbox.exec(l.raw);
233
+ if (p) {
234
+ let c = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
235
+ l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({ type: "paragraph", raw: c.raw, text: c.raw, tokens: [c] }) : l.tokens.unshift(c);
236
+ }
237
+ }
238
+ if (!i.loose) {
239
+ let p = l.tokens.filter((d) => d.type === "space"), c = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
240
+ i.loose = c;
241
+ }
187
242
  }
188
- const valueAsRecord = value;
189
- const valueToString = lookupGetter(valueAsRecord, "toString");
190
- if (typeof valueToString === "function") {
191
- const stringified = valueToString(valueAsRecord);
192
- return typeof stringified === "string" ? stringified : objectToString(stringified);
243
+ if (i.loose) for (let l of i.items) {
244
+ l.loose = true;
245
+ for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
193
246
  }
194
- return objectToString(value);
247
+ return i;
195
248
  }
196
- default: {
197
- return objectToString(value);
249
+ }
250
+ html(e) {
251
+ let t = this.rules.block.html.exec(e);
252
+ if (t) return { type: "html", block: true, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
253
+ }
254
+ def(e) {
255
+ let t = this.rules.block.def.exec(e);
256
+ if (t) {
257
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
258
+ return { type: "def", tag: n, raw: t[0], href: r, title: i };
198
259
  }
199
260
  }
200
- }
201
- function lookupGetter(object, prop) {
202
- while (object !== null) {
203
- const desc = getOwnPropertyDescriptor(object, prop);
204
- if (desc) {
205
- if (desc.get) {
206
- return unapply(desc.get);
207
- }
208
- if (typeof desc.value === "function") {
209
- return unapply(desc.value);
210
- }
261
+ table(e) {
262
+ var _a2;
263
+ let t = this.rules.block.table.exec(e);
264
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
265
+ let n = V(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = ((_a2 = t[3]) == null ? void 0 : _a2.trim()) ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
266
+ `) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
267
+ if (n.length === r.length) {
268
+ for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
269
+ for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
270
+ for (let a of i) s.rows.push(V(a, s.header.length).map((o, l) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[l] })));
271
+ return s;
211
272
  }
212
- object = getPrototypeOf(object);
213
273
  }
214
- function fallbackValue() {
215
- return null;
274
+ lheading(e) {
275
+ let t = this.rules.block.lheading.exec(e);
276
+ if (t) {
277
+ let n = t[1].trim();
278
+ return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
279
+ }
216
280
  }
217
- return fallbackValue;
218
- }
219
- function isRegex(value) {
220
- try {
221
- regExpTest(value, "");
222
- return true;
223
- } catch (_unused) {
224
- return false;
281
+ paragraph(e) {
282
+ let t = this.rules.block.paragraph.exec(e);
283
+ if (t) {
284
+ let n = t[1].charAt(t[1].length - 1) === `
285
+ ` ? t[1].slice(0, -1) : t[1];
286
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
287
+ }
225
288
  }
226
- }
227
- const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
228
- const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
229
- const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
230
- const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
231
- const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
232
- const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
233
- const text = freeze(["#text"]);
234
- const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]);
235
- const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dominant-baseline", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "pointer-events", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-orientation", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "vector-effect", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
236
- const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
237
- const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
238
- const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
239
- const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
240
- const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
241
- const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
242
- const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
243
- const IS_ALLOWED_URI = seal(
244
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
245
- // eslint-disable-line no-useless-escape
246
- );
247
- const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
248
- const ATTR_WHITESPACE = seal(
249
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
250
- // eslint-disable-line no-control-regex
251
- );
252
- const DOCTYPE_NAME = seal(/^html$/i);
253
- const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
254
- const ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
255
- const COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
256
- const FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
257
- const SELF_CLOSING_TAG = seal(/\/>/i);
258
- const NODE_TYPE = {
259
- element: 1,
260
- attribute: 2,
261
- text: 3,
262
- cdataSection: 4,
263
- entityReference: 5,
264
- // Deprecated
265
- entityNode: 6,
266
- // Deprecated
267
- processingInstruction: 7,
268
- comment: 8,
269
- document: 9,
270
- documentType: 10,
271
- documentFragment: 11,
272
- notation: 12
273
- // Deprecated
274
- };
275
- const LITERAL_TEXT_ELEMENT_NAMES = ["style", "script", "xmp", "iframe", "noembed", "noframes", "plaintext", "noscript"];
276
- const LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
277
- const LITERAL_TEXT_CLOSE = function() {
278
- const map = {};
279
- arrayForEach(LITERAL_TEXT_ELEMENT_NAMES, (name) => {
280
- map[name] = seal(new RegExp("</" + name + "(?=[\\t\\n\\f\\r />])", "i"));
281
- });
282
- return freeze(map);
283
- }();
284
- const getGlobal = function getGlobal2() {
285
- return typeof window === "undefined" ? null : window;
286
- };
287
- const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
288
- if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
289
- return null;
289
+ text(e) {
290
+ let t = this.rules.block.text.exec(e);
291
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
290
292
  }
291
- let suffix = null;
292
- const ATTR_NAME = "data-tt-policy-suffix";
293
- if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
294
- suffix = purifyHostElement.getAttribute(ATTR_NAME);
293
+ escape(e) {
294
+ let t = this.rules.inline.escape.exec(e);
295
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
295
296
  }
296
- const policyName = "dompurify" + (suffix ? "#" + suffix : "");
297
- try {
298
- return trustedTypes.createPolicy(policyName, {
299
- createHTML(html2) {
300
- return html2;
301
- },
302
- createScriptURL(scriptUrl) {
303
- return scriptUrl;
304
- }
305
- });
306
- } catch (_) {
307
- console.warn("TrustedTypes policy " + policyName + " could not be created.");
308
- return null;
297
+ tag(e) {
298
+ let t = this.rules.inline.tag.exec(e);
299
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
309
300
  }
310
- };
311
- const _createHooksMap = function _createHooksMap2() {
312
- return {
313
- afterSanitizeAttributes: [],
314
- afterSanitizeElements: [],
315
- afterSanitizeShadowDOM: [],
316
- beforeSanitizeAttributes: [],
317
- beforeSanitizeElements: [],
318
- beforeSanitizeShadowDOM: [],
319
- uponSanitizeAttribute: [],
320
- uponSanitizeElement: [],
321
- uponSanitizeShadowNode: []
322
- };
323
- };
324
- const _resolveSetOption = function _resolveSetOption2(cfg, key, fallback, options) {
325
- return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
326
- };
327
- const _resolveObjectOption = function _resolveObjectOption2(cfg, key, makeFallback) {
328
- const value = objectHasOwnProperty(cfg, key) ? cfg[key] : void 0;
329
- return value && typeof value === "object" ? clone(value) : makeFallback();
330
- };
331
- function createDOMPurify() {
332
- let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
333
- const DOMPurify = (root) => createDOMPurify(root);
334
- DOMPurify.version = "3.4.14";
335
- DOMPurify.removed = [];
336
- if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
337
- DOMPurify.isSupported = false;
338
- return DOMPurify;
339
- }
340
- let document = window2.document;
341
- const originalDocument = document;
342
- const currentScript = originalDocument.currentScript;
343
- window2.DocumentFragment;
344
- const HTMLTemplateElement = window2.HTMLTemplateElement, Node = window2.Node, Element = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap;
345
- _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap;
346
- window2.HTMLFormElement;
347
- const DOMParser = window2.DOMParser, trustedTypes = window2.trustedTypes;
348
- const ElementPrototype = Element.prototype;
349
- const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
350
- const remove = lookupGetter(ElementPrototype, "remove");
351
- const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
352
- const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
353
- const getParentNode = lookupGetter(ElementPrototype, "parentNode");
354
- const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
355
- const getAttributes = lookupGetter(ElementPrototype, "attributes");
356
- const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
357
- const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
358
- const getOwnerDocument = Node && Node.prototype ? lookupGetter(Node.prototype, "ownerDocument") : null;
359
- const _readNodeType = function _readNodeType2(node) {
360
- return getNodeType ? getNodeType(node) : node.nodeType;
361
- };
362
- const _readNodeName = function _readNodeName2(node) {
363
- return getNodeName ? getNodeName(node) : node.nodeName;
364
- };
365
- if (typeof HTMLTemplateElement === "function") {
366
- const template = document.createElement("template");
367
- if (template.content && template.content.ownerDocument) {
368
- document = template.content.ownerDocument;
301
+ link(e) {
302
+ let t = this.rules.inline.link.exec(e);
303
+ if (t) {
304
+ let n = t[2].trim();
305
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
306
+ if (!this.rules.other.endAngleBracket.test(n)) return;
307
+ let s = I(n.slice(0, -1), "\\");
308
+ if ((n.length - s.length) % 2 === 0) return;
309
+ } else {
310
+ let s = de(t[2], "()");
311
+ if (s === -2) return;
312
+ if (s > -1) {
313
+ let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
314
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
315
+ }
316
+ }
317
+ let r = t[2], i = "";
318
+ if (this.options.pedantic) {
319
+ let s = this.rules.other.pedanticHrefTitle.exec(r);
320
+ s && (r = s[1], i = s[3]);
321
+ } else i = t[3] ? t[3].slice(1, -1) : "";
322
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), fe(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
369
323
  }
370
324
  }
371
- let trustedTypesPolicy;
372
- let emptyHTML = "";
373
- let defaultTrustedTypesPolicy;
374
- let defaultTrustedTypesPolicyResolved = false;
375
- let IN_TRUSTED_TYPES_POLICY = 0;
376
- const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy2() {
377
- if (IN_TRUSTED_TYPES_POLICY > 0) {
378
- throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
379
- }
380
- };
381
- const _createTrustedHTML = function _createTrustedHTML2(html2) {
382
- _assertNotInTrustedTypesPolicy();
383
- IN_TRUSTED_TYPES_POLICY++;
384
- try {
385
- return trustedTypesPolicy.createHTML(html2);
386
- } finally {
387
- IN_TRUSTED_TYPES_POLICY--;
388
- }
389
- };
390
- const _createTrustedScriptURL = function _createTrustedScriptURL2(scriptUrl) {
391
- _assertNotInTrustedTypesPolicy();
392
- IN_TRUSTED_TYPES_POLICY++;
393
- try {
394
- return trustedTypesPolicy.createScriptURL(scriptUrl);
395
- } finally {
396
- IN_TRUSTED_TYPES_POLICY--;
397
- }
398
- };
399
- const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy2() {
400
- if (!defaultTrustedTypesPolicyResolved) {
401
- defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
402
- defaultTrustedTypesPolicyResolved = true;
403
- }
404
- return defaultTrustedTypesPolicy;
405
- };
406
- const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
407
- const importNode = originalDocument.importNode;
408
- let hooks = _createHooksMap();
409
- DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
410
- const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
411
- let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
412
- let ALLOWED_TAGS = null;
413
- const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
414
- let ALLOWED_ATTR = null;
415
- const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
416
- let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
417
- tagNameCheck: {
418
- writable: true,
419
- configurable: false,
420
- enumerable: true,
421
- value: null
422
- },
423
- attributeNameCheck: {
424
- writable: true,
425
- configurable: false,
426
- enumerable: true,
427
- value: null
428
- },
429
- allowCustomizedBuiltInElements: {
430
- writable: true,
431
- configurable: false,
432
- enumerable: true,
433
- value: false
434
- }
435
- }));
436
- let FORBID_TAGS = null;
437
- let FORBID_ATTR = null;
438
- const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
439
- tagCheck: {
440
- writable: true,
441
- configurable: false,
442
- enumerable: true,
443
- value: null
444
- },
445
- attributeCheck: {
446
- writable: true,
447
- configurable: false,
448
- enumerable: true,
449
- value: null
450
- }
451
- }));
452
- let ALLOW_ARIA_ATTR = true;
453
- let ALLOW_DATA_ATTR = true;
454
- let ALLOW_UNKNOWN_PROTOCOLS = false;
455
- let ALLOW_SELF_CLOSE_IN_ATTR = true;
456
- let SAFE_FOR_TEMPLATES = false;
457
- let SAFE_FOR_XML = true;
458
- let WHOLE_DOCUMENT = false;
459
- let SET_CONFIG = false;
460
- let SET_CONFIG_ALLOWED_TAGS = null;
461
- let SET_CONFIG_ALLOWED_ATTR = null;
462
- let FORCE_BODY = false;
463
- let RETURN_DOM = false;
464
- let RETURN_DOM_FRAGMENT = false;
465
- let RETURN_TRUSTED_TYPE = false;
466
- let SANITIZE_DOM = true;
467
- let SANITIZE_NAMED_PROPS = false;
468
- const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
469
- let KEEP_CONTENT = true;
470
- let IN_PLACE = false;
471
- let USE_PROFILES = {};
472
- let FORBID_CONTENTS = null;
473
- const DEFAULT_FORBID_CONTENTS = addToSet({}, [
474
- "annotation-xml",
475
- "audio",
476
- "colgroup",
477
- "desc",
478
- "foreignobject",
479
- "head",
480
- "iframe",
481
- "math",
482
- "mi",
483
- "mn",
484
- "mo",
485
- "ms",
486
- "mtext",
487
- "noembed",
488
- "noframes",
489
- "noscript",
490
- "plaintext",
491
- "script",
492
- // <selectedcontent> mirrors the selected <option>'s subtree, cloned by
493
- // the UA (customizable <select>) — including any on* handlers — and the
494
- // engine re-mirrors synchronously whenever a removal changes which
495
- // option/selectedcontent is current, even inside DOMPurify's inert
496
- // DOMParser document. Hoisting its children on removal re-inserts a fresh
497
- // mirror target ahead of the walk, which the engine refills, looping
498
- // forever (DoS) and amplifying output. Dropping its content on removal
499
- // (rather than hoisting) breaks that cascade; the content is a duplicate
500
- // of the option, which is sanitized on its own. See campaign-3 F1/F6.
501
- "selectedcontent",
502
- "style",
503
- "svg",
504
- "template",
505
- "thead",
506
- "title",
507
- "video",
508
- "xmp"
509
- ]);
510
- let DATA_URI_TAGS = null;
511
- const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
512
- let URI_SAFE_ATTRIBUTES = null;
513
- const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
514
- const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
515
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
516
- const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
517
- let NAMESPACE = HTML_NAMESPACE;
518
- let IS_EMPTY_INPUT = false;
519
- let ALLOWED_NAMESPACES = null;
520
- const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
521
- const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze(["mi", "mo", "mn", "ms", "mtext"]);
522
- let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
523
- const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
524
- let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
525
- const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
526
- let PARSER_MEDIA_TYPE = null;
527
- const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
528
- const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
529
- let transformCaseFunc = null;
530
- let CONFIG = null;
531
- const formElement = document.createElement("form");
532
- const isRegexOrFunction = function isRegexOrFunction2(testValue) {
533
- return testValue instanceof RegExp || testValue instanceof Function;
534
- };
535
- const _parseConfig = function _parseConfig2() {
536
- let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
537
- if (CONFIG && CONFIG === cfg) {
538
- return;
539
- }
540
- if (!cfg || typeof cfg !== "object") {
541
- cfg = {};
542
- }
543
- cfg = clone(cfg);
544
- PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
545
- SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
546
- transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
547
- ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, {
548
- transform: transformCaseFunc
549
- });
550
- ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, {
551
- transform: transformCaseFunc
552
- });
553
- ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, {
554
- transform: stringToString
555
- });
556
- URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
557
- transform: transformCaseFunc,
558
- base: DEFAULT_URI_SAFE_ATTRIBUTES
559
- });
560
- DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
561
- transform: transformCaseFunc,
562
- base: DEFAULT_DATA_URI_TAGS
563
- });
564
- FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, {
565
- transform: transformCaseFunc
566
- });
567
- FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), {
568
- transform: transformCaseFunc
569
- });
570
- FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), {
571
- transform: transformCaseFunc
572
- });
573
- USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
574
- ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
575
- ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
576
- ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
577
- ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
578
- SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
579
- SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
580
- WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
581
- RETURN_DOM = cfg.RETURN_DOM || false;
582
- RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
583
- RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
584
- FORCE_BODY = cfg.FORCE_BODY || false;
585
- SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
586
- SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
587
- KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
588
- IN_PLACE = cfg.IN_PLACE || false;
589
- IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
590
- NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
591
- MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(
592
- cfg,
593
- "MATHML_TEXT_INTEGRATION_POINTS",
594
- () => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS)
595
- // Default built-in map
596
- );
597
- HTML_INTEGRATION_POINTS = _resolveObjectOption(
598
- cfg,
599
- "HTML_INTEGRATION_POINTS",
600
- () => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS)
601
- // Default built-in map
602
- );
603
- const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create(null));
604
- CUSTOM_ELEMENT_HANDLING = create(null);
605
- if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
606
- CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
607
- }
608
- if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
609
- CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
610
- }
611
- if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
612
- CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
613
- }
614
- seal(CUSTOM_ELEMENT_HANDLING);
615
- if (SAFE_FOR_TEMPLATES) {
616
- ALLOW_DATA_ATTR = false;
617
- }
618
- if (RETURN_DOM_FRAGMENT) {
619
- RETURN_DOM = true;
620
- }
621
- if (USE_PROFILES) {
622
- ALLOWED_TAGS = addToSet({}, text);
623
- ALLOWED_ATTR = create(null);
624
- if (USE_PROFILES.html === true) {
625
- addToSet(ALLOWED_TAGS, html$1);
626
- addToSet(ALLOWED_ATTR, html);
627
- }
628
- if (USE_PROFILES.svg === true) {
629
- addToSet(ALLOWED_TAGS, svg$1);
630
- addToSet(ALLOWED_ATTR, svg);
631
- addToSet(ALLOWED_ATTR, xml);
632
- }
633
- if (USE_PROFILES.svgFilters === true) {
634
- addToSet(ALLOWED_TAGS, svgFilters);
635
- addToSet(ALLOWED_ATTR, svg);
636
- addToSet(ALLOWED_ATTR, xml);
637
- }
638
- if (USE_PROFILES.mathMl === true) {
639
- addToSet(ALLOWED_TAGS, mathMl$1);
640
- addToSet(ALLOWED_ATTR, mathMl);
641
- addToSet(ALLOWED_ATTR, xml);
325
+ reflink(e, t) {
326
+ let n;
327
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
328
+ let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
329
+ if (!i) {
330
+ let s = n[0].charAt(0);
331
+ return { type: "text", raw: s, text: s };
642
332
  }
333
+ return fe(n, i, n[0], this.lexer, this.rules);
643
334
  }
644
- EXTRA_ELEMENT_HANDLING.tagCheck = null;
645
- EXTRA_ELEMENT_HANDLING.attributeCheck = null;
646
- if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
647
- if (typeof cfg.ADD_TAGS === "function") {
648
- EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
649
- } else if (arrayIsArray(cfg.ADD_TAGS)) {
650
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
651
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
335
+ }
336
+ emStrong(e, t, n = "") {
337
+ let r = this.rules.inline.emStrongLDelim.exec(e);
338
+ if (!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
339
+ if (!(r[1] || r[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
340
+ let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
341
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) !== null; ) {
342
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
343
+ if (o = [...a].length, r[3] || r[4]) {
344
+ l += o;
345
+ continue;
346
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
347
+ p += o;
348
+ continue;
652
349
  }
653
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
654
- }
655
- }
656
- if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
657
- if (typeof cfg.ADD_ATTR === "function") {
658
- EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
659
- } else if (arrayIsArray(cfg.ADD_ATTR)) {
660
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
661
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
350
+ if (l -= o, l > 0) continue;
351
+ o = Math.min(o, o + l + p);
352
+ let d = [...r[0]][0].length, h = e.slice(0, s + r.index + d + o);
353
+ if (Math.min(s, o) % 2) {
354
+ let f = h.slice(1, -1);
355
+ return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
662
356
  }
663
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
664
- }
665
- }
666
- if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
667
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
668
- FORBID_CONTENTS = clone(FORBID_CONTENTS);
357
+ let R = h.slice(2, -2);
358
+ return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
669
359
  }
670
- addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
671
- }
672
- if (KEEP_CONTENT) {
673
- ALLOWED_TAGS["#text"] = true;
674
- }
675
- if (WHOLE_DOCUMENT) {
676
- addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
677
360
  }
678
- if (ALLOWED_TAGS.table) {
679
- addToSet(ALLOWED_TAGS, ["tbody"]);
680
- delete FORBID_TAGS.tbody;
361
+ }
362
+ codespan(e) {
363
+ let t = this.rules.inline.code.exec(e);
364
+ if (t) {
365
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
366
+ return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
681
367
  }
682
- if (cfg.TRUSTED_TYPES_POLICY) {
683
- if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
684
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
685
- }
686
- if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
687
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
688
- }
689
- const previousTrustedTypesPolicy = trustedTypesPolicy;
690
- trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
691
- try {
692
- emptyHTML = _createTrustedHTML("");
693
- } catch (error) {
694
- trustedTypesPolicy = previousTrustedTypesPolicy;
695
- throw error;
696
- }
697
- } else if (cfg.TRUSTED_TYPES_POLICY === null) {
698
- trustedTypesPolicy = void 0;
699
- emptyHTML = "";
700
- } else {
701
- if (trustedTypesPolicy === void 0) {
702
- trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
703
- }
704
- if (trustedTypesPolicy && typeof emptyHTML === "string") {
705
- emptyHTML = _createTrustedHTML("");
368
+ }
369
+ br(e) {
370
+ let t = this.rules.inline.br.exec(e);
371
+ if (t) return { type: "br", raw: t[0] };
372
+ }
373
+ del(e, t, n = "") {
374
+ let r = this.rules.inline.delLDelim.exec(e);
375
+ if (!r) return;
376
+ if (!(r[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
377
+ let s = [...r[0]].length - 1, a, o, l = s, p = this.rules.inline.delRDelim;
378
+ for (p.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = p.exec(t)) !== null; ) {
379
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a || (o = [...a].length, o !== s)) continue;
380
+ if (r[3] || r[4]) {
381
+ l += o;
382
+ continue;
383
+ }
384
+ if (l -= o, l > 0) continue;
385
+ o = Math.min(o, o + l);
386
+ let c = [...r[0]][0].length, d = e.slice(0, s + r.index + c + o), h = d.slice(s, -s);
387
+ return { type: "del", raw: d, text: h, tokens: this.lexer.inlineTokens(h) };
706
388
  }
707
389
  }
708
- if (freeze) {
709
- freeze(cfg);
710
- }
711
- CONFIG = cfg;
712
- };
713
- const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
714
- const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
715
- const _checkSvgNamespace = function _checkSvgNamespace2(tagName, parent, parentTagName) {
716
- if (parent.namespaceURI === HTML_NAMESPACE) {
717
- return tagName === "svg";
718
- }
719
- if (parent.namespaceURI === MATHML_NAMESPACE) {
720
- return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
721
- }
722
- return Boolean(ALL_SVG_TAGS[tagName]);
723
- };
724
- const _checkMathMlNamespace = function _checkMathMlNamespace2(tagName, parent, parentTagName) {
725
- if (parent.namespaceURI === HTML_NAMESPACE) {
726
- return tagName === "math";
727
- }
728
- if (parent.namespaceURI === SVG_NAMESPACE) {
729
- return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
730
- }
731
- return Boolean(ALL_MATHML_TAGS[tagName]);
732
- };
733
- const _checkHtmlNamespace = function _checkHtmlNamespace2(tagName, parent, parentTagName) {
734
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
735
- return false;
736
- }
737
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
738
- return false;
739
- }
740
- return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
741
- };
742
- const _checkValidNamespace = function _checkValidNamespace2(element) {
743
- let parent = getParentNode(element);
744
- if (!parent || !parent.tagName) {
745
- parent = {
746
- namespaceURI: NAMESPACE,
747
- tagName: "template"
748
- };
749
- }
750
- const tagName = stringToLowerCase(element.tagName);
751
- const parentTagName = stringToLowerCase(parent.tagName);
752
- if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
753
- return false;
754
- }
755
- if (element.namespaceURI === SVG_NAMESPACE) {
756
- return _checkSvgNamespace(tagName, parent, parentTagName);
757
- }
758
- if (element.namespaceURI === MATHML_NAMESPACE) {
759
- return _checkMathMlNamespace(tagName, parent, parentTagName);
760
- }
761
- if (element.namespaceURI === HTML_NAMESPACE) {
762
- return _checkHtmlNamespace(tagName, parent, parentTagName);
390
+ }
391
+ autolink(e) {
392
+ let t = this.rules.inline.autolink.exec(e);
393
+ if (t) {
394
+ let n, r;
395
+ return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
763
396
  }
764
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
765
- return true;
397
+ }
398
+ url(e) {
399
+ var _a2;
400
+ let t;
401
+ if (t = this.rules.inline.url.exec(e)) {
402
+ let n, r;
403
+ if (t[2] === "@") n = t[0], r = "mailto:" + n;
404
+ else {
405
+ let i;
406
+ do
407
+ i = t[0], t[0] = ((_a2 = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : _a2[0]) ?? "";
408
+ while (i !== t[0]);
409
+ n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
410
+ }
411
+ return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
766
412
  }
767
- return false;
768
- };
769
- const _forceRemove = function _forceRemove2(node) {
770
- arrayPush(DOMPurify.removed, {
771
- element: node
772
- });
773
- try {
774
- getParentNode(node).removeChild(node);
775
- } catch (_) {
776
- remove(node);
777
- if (!getParentNode(node)) {
778
- throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
779
- }
413
+ }
414
+ inlineText(e) {
415
+ let t = this.rules.inline.text.exec(e);
416
+ if (t) {
417
+ let n = this.lexer.state.inRawBlock;
418
+ return { type: "text", raw: t[0], text: t[0], escaped: n };
780
419
  }
781
- };
782
- const _stripAttributeNode = function _stripAttributeNode2(element, attribute, name) {
783
- try {
784
- element.removeAttributeNode(attribute);
785
- } catch (_) {
786
- try {
787
- element.removeAttribute(name);
788
- } catch (_2) {
420
+ }
421
+ };
422
+ var x = class u {
423
+ constructor(e) {
424
+ __publicField(this, "tokens");
425
+ __publicField(this, "options");
426
+ __publicField(this, "state");
427
+ __publicField(this, "inlineQueue");
428
+ __publicField(this, "tokenizer");
429
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || exports.defaults, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
430
+ let t = { other: m, block: B.normal, inline: E.normal };
431
+ this.options.pedantic ? (t.block = B.pedantic, t.inline = E.pedantic) : this.options.gfm && (t.block = B.gfm, this.options.breaks ? t.inline = E.breaks : t.inline = E.gfm), this.tokenizer.rules = t;
432
+ }
433
+ static get rules() {
434
+ return { block: B, inline: E };
435
+ }
436
+ static lex(e, t) {
437
+ return new u(t).lex(e);
438
+ }
439
+ static lexInline(e, t) {
440
+ return new u(t).inlineTokens(e);
441
+ }
442
+ lex(e) {
443
+ e = e.replace(m.carriageReturn, `
444
+ `), this.blockTokens(e, this.tokens);
445
+ for (let t = 0; t < this.inlineQueue.length; t++) {
446
+ let n = this.inlineQueue[t];
447
+ this.inlineTokens(n.src, n.tokens);
448
+ }
449
+ return this.inlineQueue = [], this.tokens;
450
+ }
451
+ blockTokens(e, t = [], n = false) {
452
+ var _a2, _b, _c;
453
+ for (this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
454
+ let r;
455
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
456
+ if (r = this.tokenizer.space(e)) {
457
+ e = e.substring(r.raw.length);
458
+ let s = t.at(-1);
459
+ r.raw.length === 1 && s !== void 0 ? s.raw += `
460
+ ` : t.push(r);
461
+ continue;
789
462
  }
790
- }
791
- };
792
- const _neutralizeRoot = function _neutralizeRoot2(root) {
793
- _neutralizeSubtree(root);
794
- const childNodes = getChildNodes(root);
795
- if (childNodes) {
796
- const snapshot = [];
797
- arrayForEach(childNodes, (child) => {
798
- arrayPush(snapshot, child);
799
- });
800
- arrayForEach(snapshot, (child) => {
801
- try {
802
- remove(child);
803
- } catch (_) {
804
- }
805
- });
806
- }
807
- const attributes = getAttributes(root);
808
- if (attributes) {
809
- for (let i = attributes.length - 1; i >= 0; --i) {
810
- const attribute = attributes[i];
811
- const name = attribute && attribute.name;
812
- if (typeof name === "string") {
813
- _stripAttributeNode(root, attribute, name);
814
- }
463
+ if (r = this.tokenizer.code(e)) {
464
+ e = e.substring(r.raw.length);
465
+ let s = t.at(-1);
466
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
467
+ `) ? "" : `
468
+ `) + r.raw, s.text += `
469
+ ` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
470
+ continue;
815
471
  }
816
- }
817
- };
818
- const _removeAttribute = function _removeAttribute2(name, element, attr) {
819
- if (!attr) {
820
- try {
821
- attr = element.getAttributeNode(name);
822
- } catch (_) {
823
- attr = null;
472
+ if (r = this.tokenizer.fences(e)) {
473
+ e = e.substring(r.raw.length), t.push(r);
474
+ continue;
824
475
  }
825
- }
826
- arrayPush(DOMPurify.removed, {
827
- attribute: attr || null,
828
- from: element
829
- });
830
- try {
831
- if (attr) {
832
- element.removeAttributeNode(attr);
833
- } else {
834
- element.removeAttribute(name);
476
+ if (r = this.tokenizer.heading(e)) {
477
+ e = e.substring(r.raw.length), t.push(r);
478
+ continue;
835
479
  }
836
- } catch (_) {
837
- try {
838
- element.removeAttribute(name);
839
- } catch (_2) {
480
+ if (r = this.tokenizer.hr(e)) {
481
+ e = e.substring(r.raw.length), t.push(r);
482
+ continue;
840
483
  }
841
- }
842
- if (name === "is") {
843
- if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
844
- try {
845
- _forceRemove(element);
846
- } catch (_) {
847
- }
848
- } else {
849
- try {
850
- element.setAttribute(name, "");
851
- } catch (_) {
852
- }
484
+ if (r = this.tokenizer.blockquote(e)) {
485
+ e = e.substring(r.raw.length), t.push(r);
486
+ continue;
853
487
  }
854
- }
855
- };
856
- const _stripDisallowedAttributes = function _stripDisallowedAttributes2(element) {
857
- const attributes = getAttributes(element);
858
- if (!attributes) {
859
- return;
860
- }
861
- for (let i = attributes.length - 1; i >= 0; --i) {
862
- const attribute = attributes[i];
863
- const name = attribute && attribute.name;
864
- if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) {
488
+ if (r = this.tokenizer.list(e)) {
489
+ e = e.substring(r.raw.length), t.push(r);
865
490
  continue;
866
491
  }
867
- _stripAttributeNode(element, attribute, name);
868
- }
869
- };
870
- const _neutralizeSubtree = function _neutralizeSubtree2(root) {
871
- const stack = [root];
872
- while (stack.length > 0) {
873
- const node = stack.pop();
874
- const nodeType = _readNodeType(node);
875
- if (nodeType === NODE_TYPE.element) {
876
- _stripDisallowedAttributes(node);
492
+ if (r = this.tokenizer.html(e)) {
493
+ e = e.substring(r.raw.length), t.push(r);
494
+ continue;
877
495
  }
878
- const childNodes = getChildNodes(node);
879
- if (childNodes) {
880
- for (let i = childNodes.length - 1; i >= 0; --i) {
881
- stack.push(childNodes[i]);
882
- }
496
+ if (r = this.tokenizer.def(e)) {
497
+ e = e.substring(r.raw.length);
498
+ let s = t.at(-1);
499
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
500
+ `) ? "" : `
501
+ `) + r.raw, s.text += `
502
+ ` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
503
+ continue;
883
504
  }
884
- }
885
- };
886
- const _isPatchLinkageAttribute = function _isPatchLinkageAttribute2(lcName, lcTag) {
887
- if (!SAFE_FOR_XML) {
888
- return false;
889
- }
890
- if (lcName === "patchsrc") {
891
- return true;
892
- }
893
- return lcName === "for" && lcTag !== "label" && lcTag !== "output";
894
- };
895
- const _neutralizePatchLinkage = function _neutralizePatchLinkage2(root) {
896
- if (!SAFE_FOR_XML) {
897
- return;
898
- }
899
- const stack = [root];
900
- while (stack.length > 0) {
901
- const node = stack.pop();
902
- const nodeType = _readNodeType(node);
903
- if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
904
- try {
905
- remove(node);
906
- } catch (_) {
907
- }
505
+ if (r = this.tokenizer.table(e)) {
506
+ e = e.substring(r.raw.length), t.push(r);
908
507
  continue;
909
508
  }
910
- if (nodeType === NODE_TYPE.element) {
911
- const element = node;
912
- const lcTag = transformCaseFunc(_readNodeName(node));
913
- try {
914
- if (element.hasAttribute && element.hasAttribute("patchsrc")) {
915
- element.removeAttribute("patchsrc");
916
- }
917
- if (element.hasAttribute && element.hasAttribute("for") && _isPatchLinkageAttribute("for", lcTag)) {
918
- element.removeAttribute("for");
919
- }
920
- } catch (_) {
921
- }
509
+ if (r = this.tokenizer.lheading(e)) {
510
+ e = e.substring(r.raw.length), t.push(r);
511
+ continue;
922
512
  }
923
- const childNodes = getChildNodes(node);
924
- if (childNodes) {
925
- for (let i = childNodes.length - 1; i >= 0; --i) {
926
- stack.push(childNodes[i]);
927
- }
513
+ let i = e;
514
+ if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
515
+ let s = 1 / 0, a = e.slice(1), o;
516
+ this.options.extensions.startBlock.forEach((l) => {
517
+ o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
518
+ }), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
519
+ }
520
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
521
+ let s = t.at(-1);
522
+ n && (s == null ? void 0 : s.type) === "paragraph" ? (s.raw += (s.raw.endsWith(`
523
+ `) ? "" : `
524
+ `) + r.raw, s.text += `
525
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
526
+ continue;
928
527
  }
929
- }
930
- };
931
- const _initDocument = function _initDocument2(dirty) {
932
- let doc = null;
933
- let leadingWhitespace = null;
934
- if (FORCE_BODY) {
935
- dirty = "<remove></remove>" + dirty;
936
- } else {
937
- const matches = stringMatch(dirty, /^[\r\n\t ]+/);
938
- leadingWhitespace = matches && matches[0];
939
- }
940
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
941
- dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
942
- }
943
- const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
944
- if (NAMESPACE === HTML_NAMESPACE) {
945
- try {
946
- doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
947
- } catch (_) {
528
+ if (r = this.tokenizer.text(e)) {
529
+ e = e.substring(r.raw.length);
530
+ let s = t.at(-1);
531
+ (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
532
+ `) ? "" : `
533
+ `) + r.raw, s.text += `
534
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
535
+ continue;
948
536
  }
949
- }
950
- if (!doc || !doc.documentElement) {
951
- doc = implementation.createDocument(NAMESPACE, "template", null);
952
- try {
953
- doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
954
- } catch (_) {
537
+ if (e) {
538
+ let s = "Infinite loop on byte: " + e.charCodeAt(0);
539
+ if (this.options.silent) {
540
+ console.error(s);
541
+ break;
542
+ } else throw new Error(s);
955
543
  }
956
544
  }
957
- const body = doc.body || doc.documentElement;
958
- if (dirty && leadingWhitespace) {
959
- body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
960
- }
961
- if (NAMESPACE === HTML_NAMESPACE) {
962
- return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
963
- }
964
- return WHOLE_DOCUMENT ? doc.documentElement : body;
965
- };
966
- const _createNodeIterator = function _createNodeIterator2(root) {
967
- const doc = getOwnerDocument ? getOwnerDocument(root) : root.ownerDocument;
968
- return createNodeIterator.call(
969
- doc || root,
970
- root,
971
- // eslint-disable-next-line no-bitwise
972
- NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
973
- null
974
- );
975
- };
976
- const _stripTemplateExpressions = function _stripTemplateExpressions2(value) {
977
- value = stringReplace(value, MUSTACHE_EXPR$1, " ");
978
- value = stringReplace(value, ERB_EXPR$1, " ");
979
- value = stringReplace(value, TMPLIT_EXPR$1, " ");
980
- return value;
981
- };
982
- const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
983
- var _node$querySelectorAl;
984
- node.normalize();
985
- const doc = getOwnerDocument ? getOwnerDocument(node) : node.ownerDocument;
986
- const walker = createNodeIterator.call(
987
- doc || node,
988
- node,
989
- // eslint-disable-next-line no-bitwise
990
- NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION,
991
- null
992
- );
993
- let currentNode = walker.nextNode();
994
- while (currentNode) {
995
- currentNode.data = _stripTemplateExpressions(currentNode.data);
996
- currentNode = walker.nextNode();
997
- }
998
- const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
999
- if (templates) {
1000
- arrayForEach(templates, (tmpl) => {
1001
- if (_isDocumentFragment(tmpl.content)) {
1002
- _scrubTemplateExpressions2(tmpl.content);
1003
- }
1004
- });
1005
- }
1006
- };
1007
- const _isClobbered = function _isClobbered2(element) {
1008
- const realTagName = getNodeName ? getNodeName(element) : null;
1009
- if (typeof realTagName !== "string") {
1010
- return false;
1011
- }
1012
- if (transformCaseFunc(realTagName) !== "form") {
1013
- return false;
1014
- }
1015
- return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || // Realm-safe NamedNodeMap detection: equality against the cached
1016
- // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
1017
- // makes the direct read diverge from the cached read; a clean form
1018
- // (same-realm OR foreign-realm) has both reads pointing at the same
1019
- // canonical NamedNodeMap.
1020
- element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
1021
- // returns the integer 1 for any Element regardless of realm; direct
1022
- // read on a clobbered form (e.g. <input name="nodeType">) returns
1023
- // the named child element. Cheap addition — nodeType is read from
1024
- // an internal slot, no serialization cost — and removes a residual
1025
- // clobbering surface used by several mXSS / PI / comment branches
1026
- // in _sanitizeElements that compare currentNode.nodeType directly.
1027
- element.nodeType !== getNodeType(element) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
1028
- // "childNodes" shadows the prototype getter. Direct reads of
1029
- // form.childNodes from a clobbered form return the named child
1030
- // instead of the real NodeList, so any walk that reads it directly
1031
- // skips the form's real children. Compare the direct read to the
1032
- // cached Node.prototype getter — when the form's named-property
1033
- // getter intercepts the read, the two values differ and we flag
1034
- // the form. This catches every clobbering child type (input,
1035
- // select, etc.) regardless of whether the named child happens to
1036
- // carry a numeric .length, which a typeof-based probe would miss
1037
- // (e.g. HTMLSelectElement.length is a defined unsigned-long).
1038
- element.childNodes !== getChildNodes(element);
1039
- };
1040
- const _isDocumentFragment = function _isDocumentFragment2(value) {
1041
- if (!getNodeType || typeof value !== "object" || value === null) {
1042
- return false;
1043
- }
1044
- try {
1045
- return getNodeType(value) === NODE_TYPE.documentFragment;
1046
- } catch (_) {
1047
- return false;
1048
- }
1049
- };
1050
- const _isNode = function _isNode2(value) {
1051
- if (!getNodeType || typeof value !== "object" || value === null) {
1052
- return false;
1053
- }
1054
- try {
1055
- return typeof getNodeType(value) === "number";
1056
- } catch (_) {
1057
- return false;
1058
- }
1059
- };
1060
- function _executeHooks(hooks2, currentNode, data) {
1061
- if (hooks2.length === 0) {
1062
- return;
1063
- }
1064
- arrayForEach(hooks2, (hook) => {
1065
- hook.call(DOMPurify, currentNode, data, CONFIG);
1066
- });
545
+ return this.state.top = true, t;
1067
546
  }
1068
- const _isUnsafeNode = function _isUnsafeNode2(currentNode, tagName) {
1069
- if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) {
1070
- return true;
1071
- }
1072
- if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && LITERAL_TEXT_ELEMENTS[tagName] && (_isNode(currentNode.firstElementChild) || typeof currentNode.textContent === "string" && regExpTest(LITERAL_TEXT_CLOSE[tagName], currentNode.textContent))) {
1073
- return true;
1074
- }
1075
- if (currentNode.nodeType === NODE_TYPE.processingInstruction) {
1076
- return true;
1077
- }
1078
- if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) {
1079
- return true;
1080
- }
1081
- return false;
1082
- };
1083
- const _matchesNameCheck = function _matchesNameCheck2(check, name) {
1084
- if (check instanceof RegExp) {
1085
- return regExpTest(check, name);
1086
- }
1087
- if (check instanceof Function) {
1088
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1089
- args[_key - 2] = arguments[_key];
1090
- }
1091
- return Boolean(check(name, ...args));
1092
- }
1093
- return false;
1094
- };
1095
- const _sanitizeDisallowedNode = function _sanitizeDisallowedNode2(currentNode, tagName, root) {
1096
- if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1097
- return false;
1098
- }
1099
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1100
- const parentNode = getParentNode(currentNode);
1101
- const childNodes = getChildNodes(currentNode);
1102
- if (childNodes && parentNode) {
1103
- const childCount = childNodes.length;
1104
- for (let i = childCount - 1; i >= 0; --i) {
1105
- const hoisted = currentNode === root ? cloneNode(childNodes[i], true) : childNodes[i];
1106
- parentNode.insertBefore(hoisted, getNextSibling(currentNode));
1107
- }
1108
- }
1109
- }
1110
- _forceRemove(currentNode);
1111
- return true;
1112
- };
1113
- const _forkSharedAllowlist = function _forkSharedAllowlist2(hookList, set, defaultSet, setConfigSet) {
1114
- if (hookList.length === 0) {
1115
- return set;
1116
- }
1117
- return set === defaultSet || set === setConfigSet ? clone(set) : set;
1118
- };
1119
- const _handleHookDetachedNode = function _handleHookDetachedNode2(currentNode, root) {
1120
- if (currentNode === root || getParentNode(currentNode) !== null) {
1121
- return false;
1122
- }
1123
- if (IN_PLACE) {
1124
- _neutralizeSubtree(currentNode);
1125
- }
1126
- return true;
1127
- };
1128
- const _sanitizeElements = function _sanitizeElements2(currentNode, root) {
1129
- _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1130
- if (_handleHookDetachedNode(currentNode, root)) {
1131
- return true;
1132
- }
1133
- if (_isClobbered(currentNode)) {
1134
- _forceRemove(currentNode);
1135
- return true;
1136
- }
1137
- const tagName = transformCaseFunc(_readNodeName(currentNode));
1138
- ALLOWED_TAGS = _forkSharedAllowlist(hooks.uponSanitizeElement, ALLOWED_TAGS, DEFAULT_ALLOWED_TAGS, SET_CONFIG_ALLOWED_TAGS);
1139
- _executeHooks(hooks.uponSanitizeElement, currentNode, {
1140
- tagName,
1141
- allowedTags: ALLOWED_TAGS
1142
- });
1143
- if (_handleHookDetachedNode(currentNode, root)) {
1144
- return true;
1145
- }
1146
- if (_isUnsafeNode(currentNode, tagName)) {
1147
- _forceRemove(currentNode);
1148
- return true;
1149
- }
1150
- if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
1151
- const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
1152
- if (removed === false) {
1153
- _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1154
- }
1155
- return removed;
1156
- }
1157
- const nt = _readNodeType(currentNode);
1158
- if (nt === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
1159
- _forceRemove(currentNode);
1160
- return true;
1161
- }
1162
- if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
1163
- _forceRemove(currentNode);
1164
- return true;
1165
- }
1166
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1167
- const content = _stripTemplateExpressions(currentNode.textContent);
1168
- if (currentNode.textContent !== content) {
1169
- arrayPush(DOMPurify.removed, {
1170
- element: currentNode.cloneNode()
1171
- });
1172
- currentNode.textContent = content;
1173
- }
1174
- }
1175
- _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1176
- return false;
1177
- };
1178
- const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
1179
- if (FORBID_ATTR[lcName]) {
1180
- return false;
1181
- }
1182
- if (_isPatchLinkageAttribute(lcName, lcTag)) {
1183
- return false;
1184
- }
1185
- if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) {
1186
- return false;
1187
- }
1188
- const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
1189
- if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) {
1190
- return true;
1191
- }
1192
- if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) {
1193
- return true;
1194
- }
1195
- if (!nameIsPermitted) {
1196
- return (
1197
- // Condition a) covers a basically valid custom element tag name whose
1198
- // tag passes the configured tagNameCheck and whose attribute name
1199
- // passes the configured attributeNameCheck ...
1200
- _isBasicCustomElement(lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName, lcTag) || // Condition b) covers an `is` attribute whose value passes the
1201
- // configured tagNameCheck while customized built-in elements are
1202
- // allowed.
1203
- lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value)
1204
- );
1205
- }
1206
- if (URI_SAFE_ATTRIBUTES[lcName]) {
1207
- return true;
1208
- }
1209
- if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) {
1210
- return true;
1211
- }
1212
- if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) {
1213
- return true;
1214
- }
1215
- if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) {
1216
- return true;
1217
- }
1218
- return !value;
1219
- };
1220
- const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]);
1221
- const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
1222
- return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
1223
- };
1224
- const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute2(lcTag, lcName, namespaceURI, value) {
1225
- if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) {
1226
- switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1227
- case "TrustedHTML": {
1228
- return _createTrustedHTML(value);
1229
- }
1230
- case "TrustedScriptURL": {
1231
- return _createTrustedScriptURL(value);
1232
- }
547
+ inline(e, t = []) {
548
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
549
+ }
550
+ inlineTokens(e, t = []) {
551
+ var _a2, _b, _c, _d, _e2;
552
+ this.tokenizer.lexer = this;
553
+ let n = e, r = null;
554
+ if (this.tokens.links) {
555
+ let o = Object.keys(this.tokens.links);
556
+ if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
557
+ }
558
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
559
+ let i;
560
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
561
+ n = ((_b = (_a2 = this.options.hooks) == null ? void 0 : _a2.emStrongMask) == null ? void 0 : _b.call({ lexer: this }, n)) ?? n;
562
+ let s = false, a = "";
563
+ for (; e; ) {
564
+ s || (a = ""), s = false;
565
+ let o;
566
+ if ((_d = (_c = this.options.extensions) == null ? void 0 : _c.inline) == null ? void 0 : _d.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
567
+ if (o = this.tokenizer.escape(e)) {
568
+ e = e.substring(o.raw.length), t.push(o);
569
+ continue;
1233
570
  }
1234
- }
1235
- return value;
1236
- };
1237
- const _setAttributeValue = function _setAttributeValue2(currentNode, name, namespaceURI, value) {
1238
- try {
1239
- if (namespaceURI) {
1240
- currentNode.setAttributeNS(namespaceURI, name, value);
1241
- } else {
1242
- currentNode.setAttribute(name, value);
571
+ if (o = this.tokenizer.tag(e)) {
572
+ e = e.substring(o.raw.length), t.push(o);
573
+ continue;
1243
574
  }
1244
- if (_isClobbered(currentNode)) {
1245
- _forceRemove(currentNode);
1246
- } else {
1247
- arrayPop(DOMPurify.removed);
575
+ if (o = this.tokenizer.link(e)) {
576
+ e = e.substring(o.raw.length), t.push(o);
577
+ continue;
1248
578
  }
1249
- } catch (_) {
1250
- _removeAttribute(name, currentNode);
1251
- }
1252
- };
1253
- const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
1254
- _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1255
- const attributes = currentNode.attributes;
1256
- if (!attributes || _isClobbered(currentNode)) {
1257
- return;
1258
- }
1259
- ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
1260
- const hookEvent = {
1261
- attrName: "",
1262
- attrValue: "",
1263
- keepAttr: true,
1264
- allowedAttributes: ALLOWED_ATTR,
1265
- forceKeepAttr: void 0
1266
- };
1267
- let l = attributes.length;
1268
- const lcTag = transformCaseFunc(currentNode.nodeName);
1269
- while (l--) {
1270
- const attr = attributes[l];
1271
- const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
1272
- const lcName = transformCaseFunc(name);
1273
- const initValue = attrValue;
1274
- let value = name === "value" ? initValue : stringTrim(initValue);
1275
- hookEvent.attrName = lcName;
1276
- hookEvent.attrValue = value;
1277
- hookEvent.keepAttr = true;
1278
- hookEvent.forceKeepAttr = void 0;
1279
- _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1280
- value = hookEvent.attrValue;
1281
- if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
1282
- _removeAttribute(name, currentNode, attr);
1283
- value = SANITIZE_NAMED_PROPS_PREFIX + value;
579
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
580
+ e = e.substring(o.raw.length);
581
+ let p = t.at(-1);
582
+ o.type === "text" && (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
583
+ continue;
1284
584
  }
1285
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
1286
- _removeAttribute(name, currentNode, attr);
585
+ if (o = this.tokenizer.emStrong(e, n, a)) {
586
+ e = e.substring(o.raw.length), t.push(o);
1287
587
  continue;
1288
588
  }
1289
- if (lcName === "attributename" && stringMatch(value, "href")) {
1290
- _removeAttribute(name, currentNode, attr);
589
+ if (o = this.tokenizer.codespan(e)) {
590
+ e = e.substring(o.raw.length), t.push(o);
1291
591
  continue;
1292
592
  }
1293
- if (hookEvent.forceKeepAttr) {
593
+ if (o = this.tokenizer.br(e)) {
594
+ e = e.substring(o.raw.length), t.push(o);
1294
595
  continue;
1295
596
  }
1296
- if (!hookEvent.keepAttr) {
1297
- _removeAttribute(name, currentNode, attr);
597
+ if (o = this.tokenizer.del(e, n, a)) {
598
+ e = e.substring(o.raw.length), t.push(o);
1298
599
  continue;
1299
600
  }
1300
- if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
1301
- _removeAttribute(name, currentNode, attr);
601
+ if (o = this.tokenizer.autolink(e)) {
602
+ e = e.substring(o.raw.length), t.push(o);
1302
603
  continue;
1303
604
  }
1304
- if (SAFE_FOR_TEMPLATES) {
1305
- value = _stripTemplateExpressions(value);
605
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
606
+ e = e.substring(o.raw.length), t.push(o);
607
+ continue;
1306
608
  }
1307
- if (!_isValidAttribute(lcTag, lcName, value)) {
1308
- _removeAttribute(name, currentNode, attr);
609
+ let l = e;
610
+ if ((_e2 = this.options.extensions) == null ? void 0 : _e2.startInline) {
611
+ let p = 1 / 0, c = e.slice(1), d;
612
+ this.options.extensions.startInline.forEach((h) => {
613
+ d = h.call({ lexer: this }, c), typeof d == "number" && d >= 0 && (p = Math.min(p, d));
614
+ }), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
615
+ }
616
+ if (o = this.tokenizer.inlineText(l)) {
617
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
618
+ let p = t.at(-1);
619
+ (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
1309
620
  continue;
1310
621
  }
1311
- value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
1312
- if (value !== initValue) {
1313
- _setAttributeValue(currentNode, name, namespaceURI, value);
622
+ if (e) {
623
+ let p = "Infinite loop on byte: " + e.charCodeAt(0);
624
+ if (this.options.silent) {
625
+ console.error(p);
626
+ break;
627
+ } else throw new Error(p);
1314
628
  }
1315
629
  }
1316
- _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1317
- };
1318
- const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
1319
- let shadowNode = null;
1320
- const shadowIterator = _createNodeIterator(fragment);
1321
- _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1322
- while (shadowNode = shadowIterator.nextNode()) {
1323
- _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1324
- _sanitizeElements(shadowNode, fragment);
1325
- _sanitizeAttributes(shadowNode);
1326
- if (_isDocumentFragment(shadowNode.content)) {
1327
- _sanitizeShadowDOM2(shadowNode.content);
1328
- }
1329
- if (_readNodeType(shadowNode) === NODE_TYPE.element) {
1330
- const innerSr = getShadowRoot(shadowNode);
1331
- if (_isDocumentFragment(innerSr)) {
1332
- _sanitizeAttachedShadowRoots(innerSr);
1333
- _sanitizeShadowDOM2(innerSr);
630
+ return t;
631
+ }
632
+ };
633
+ var y = class {
634
+ constructor(e) {
635
+ __publicField(this, "options");
636
+ __publicField(this, "parser");
637
+ this.options = e || exports.defaults;
638
+ }
639
+ space(e) {
640
+ return "";
641
+ }
642
+ code({ text: e, lang: t, escaped: n }) {
643
+ var _a2;
644
+ let r = (_a2 = (t || "").match(m.notSpaceStart)) == null ? void 0 : _a2[0], i = e.replace(m.endingNewline, "") + `
645
+ `;
646
+ return r ? '<pre><code class="language-' + T(r) + '">' + (n ? i : T(i, true)) + `</code></pre>
647
+ ` : "<pre><code>" + (n ? i : T(i, true)) + `</code></pre>
648
+ `;
649
+ }
650
+ blockquote({ tokens: e }) {
651
+ return `<blockquote>
652
+ ${this.parser.parse(e)}</blockquote>
653
+ `;
654
+ }
655
+ html({ text: e }) {
656
+ return e;
657
+ }
658
+ def(e) {
659
+ return "";
660
+ }
661
+ heading({ tokens: e, depth: t }) {
662
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
663
+ `;
664
+ }
665
+ hr(e) {
666
+ return `<hr>
667
+ `;
668
+ }
669
+ list(e) {
670
+ let t = e.ordered, n = e.start, r = "";
671
+ for (let a = 0; a < e.items.length; a++) {
672
+ let o = e.items[a];
673
+ r += this.listitem(o);
674
+ }
675
+ let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
676
+ return "<" + i + s + `>
677
+ ` + r + "</" + i + `>
678
+ `;
679
+ }
680
+ listitem(e) {
681
+ return `<li>${this.parser.parse(e.tokens)}</li>
682
+ `;
683
+ }
684
+ checkbox({ checked: e }) {
685
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
686
+ }
687
+ paragraph({ tokens: e }) {
688
+ return `<p>${this.parser.parseInline(e)}</p>
689
+ `;
690
+ }
691
+ table(e) {
692
+ let t = "", n = "";
693
+ for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
694
+ t += this.tablerow({ text: n });
695
+ let r = "";
696
+ for (let i = 0; i < e.rows.length; i++) {
697
+ let s = e.rows[i];
698
+ n = "";
699
+ for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
700
+ r += this.tablerow({ text: n });
701
+ }
702
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
703
+ <thead>
704
+ ` + t + `</thead>
705
+ ` + r + `</table>
706
+ `;
707
+ }
708
+ tablerow({ text: e }) {
709
+ return `<tr>
710
+ ${e}</tr>
711
+ `;
712
+ }
713
+ tablecell(e) {
714
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
715
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
716
+ `;
717
+ }
718
+ strong({ tokens: e }) {
719
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
720
+ }
721
+ em({ tokens: e }) {
722
+ return `<em>${this.parser.parseInline(e)}</em>`;
723
+ }
724
+ codespan({ text: e }) {
725
+ return `<code>${T(e, true)}</code>`;
726
+ }
727
+ br(e) {
728
+ return "<br>";
729
+ }
730
+ del({ tokens: e }) {
731
+ return `<del>${this.parser.parseInline(e)}</del>`;
732
+ }
733
+ link({ href: e, title: t, tokens: n }) {
734
+ let r = this.parser.parseInline(n), i = J(e);
735
+ if (i === null) return r;
736
+ e = i;
737
+ let s = '<a href="' + e + '"';
738
+ return t && (s += ' title="' + T(t) + '"'), s += ">" + r + "</a>", s;
739
+ }
740
+ image({ href: e, title: t, text: n, tokens: r }) {
741
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
742
+ let i = J(e);
743
+ if (i === null) return T(n);
744
+ e = i;
745
+ let s = `<img src="${e}" alt="${T(n)}"`;
746
+ return t && (s += ` title="${T(t)}"`), s += ">", s;
747
+ }
748
+ text(e) {
749
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : T(e.text);
750
+ }
751
+ };
752
+ var $ = class {
753
+ strong({ text: e }) {
754
+ return e;
755
+ }
756
+ em({ text: e }) {
757
+ return e;
758
+ }
759
+ codespan({ text: e }) {
760
+ return e;
761
+ }
762
+ del({ text: e }) {
763
+ return e;
764
+ }
765
+ html({ text: e }) {
766
+ return e;
767
+ }
768
+ text({ text: e }) {
769
+ return e;
770
+ }
771
+ link({ text: e }) {
772
+ return "" + e;
773
+ }
774
+ image({ text: e }) {
775
+ return "" + e;
776
+ }
777
+ br() {
778
+ return "";
779
+ }
780
+ checkbox({ raw: e }) {
781
+ return e;
782
+ }
783
+ };
784
+ var b = class u2 {
785
+ constructor(e) {
786
+ __publicField(this, "options");
787
+ __publicField(this, "renderer");
788
+ __publicField(this, "textRenderer");
789
+ this.options = e || exports.defaults, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
790
+ }
791
+ static parse(e, t) {
792
+ return new u2(t).parse(e);
793
+ }
794
+ static parseInline(e, t) {
795
+ return new u2(t).parseInline(e);
796
+ }
797
+ parse(e) {
798
+ var _a2, _b;
799
+ this.renderer.parser = this;
800
+ let t = "";
801
+ for (let n = 0; n < e.length; n++) {
802
+ let r = e[n];
803
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[r.type]) {
804
+ let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
805
+ if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(s.type)) {
806
+ t += a || "";
807
+ continue;
1334
808
  }
1335
809
  }
1336
- }
1337
- _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1338
- };
1339
- const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots2(root) {
1340
- const stack = [{
1341
- node: root,
1342
- shadow: null
1343
- }];
1344
- while (stack.length > 0) {
1345
- const item = stack.pop();
1346
- if (item.shadow) {
1347
- _sanitizeShadowDOM2(item.shadow);
1348
- continue;
1349
- }
1350
- const node = item.node;
1351
- const nodeType = _readNodeType(node);
1352
- const isElement = nodeType === NODE_TYPE.element;
1353
- const childNodes = getChildNodes(node);
1354
- if (childNodes) {
1355
- for (let i = childNodes.length - 1; i >= 0; --i) {
1356
- stack.push({
1357
- node: childNodes[i],
1358
- shadow: null
1359
- });
810
+ let i = r;
811
+ switch (i.type) {
812
+ case "space": {
813
+ t += this.renderer.space(i);
814
+ break;
1360
815
  }
1361
- }
1362
- if (isElement) {
1363
- const rootName = getNodeName ? getNodeName(node) : null;
1364
- if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
1365
- const content = node.content;
1366
- if (_isDocumentFragment(content)) {
1367
- stack.push({
1368
- node: content,
1369
- shadow: null
1370
- });
1371
- }
816
+ case "hr": {
817
+ t += this.renderer.hr(i);
818
+ break;
1372
819
  }
1373
- }
1374
- if (isElement) {
1375
- const sr = getShadowRoot(node);
1376
- if (_isDocumentFragment(sr)) {
1377
- stack.push({
1378
- node: null,
1379
- shadow: sr
1380
- }, {
1381
- node: sr,
1382
- shadow: null
1383
- });
820
+ case "heading": {
821
+ t += this.renderer.heading(i);
822
+ break;
1384
823
  }
1385
- }
1386
- }
1387
- };
1388
- DOMPurify.sanitize = function(dirty) {
1389
- let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1390
- let body = null;
1391
- let importedNode = null;
1392
- let currentNode = null;
1393
- let returnNode = null;
1394
- IS_EMPTY_INPUT = !dirty;
1395
- if (IS_EMPTY_INPUT) {
1396
- dirty = "<!-->";
1397
- }
1398
- if (typeof dirty !== "string" && !_isNode(dirty)) {
1399
- dirty = stringifyValue(dirty);
1400
- if (typeof dirty !== "string") {
1401
- throw typeErrorCreate("dirty is not a string, aborting");
1402
- }
1403
- }
1404
- if (!DOMPurify.isSupported) {
1405
- return dirty;
1406
- }
1407
- if (SET_CONFIG) {
1408
- ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
1409
- ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
1410
- } else {
1411
- _parseConfig(cfg);
1412
- }
1413
- if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) {
1414
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
1415
- }
1416
- if (hooks.uponSanitizeAttribute.length > 0) {
1417
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
1418
- }
1419
- DOMPurify.removed = [];
1420
- const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
1421
- if (inPlace) {
1422
- _neutralizePatchLinkage(dirty);
1423
- const nn = _readNodeName(dirty);
1424
- if (typeof nn === "string") {
1425
- const tagName = transformCaseFunc(nn);
1426
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1427
- _neutralizeRoot(dirty);
1428
- throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
824
+ case "code": {
825
+ t += this.renderer.code(i);
826
+ break;
827
+ }
828
+ case "table": {
829
+ t += this.renderer.table(i);
830
+ break;
831
+ }
832
+ case "blockquote": {
833
+ t += this.renderer.blockquote(i);
834
+ break;
835
+ }
836
+ case "list": {
837
+ t += this.renderer.list(i);
838
+ break;
839
+ }
840
+ case "checkbox": {
841
+ t += this.renderer.checkbox(i);
842
+ break;
843
+ }
844
+ case "html": {
845
+ t += this.renderer.html(i);
846
+ break;
847
+ }
848
+ case "def": {
849
+ t += this.renderer.def(i);
850
+ break;
851
+ }
852
+ case "paragraph": {
853
+ t += this.renderer.paragraph(i);
854
+ break;
855
+ }
856
+ case "text": {
857
+ t += this.renderer.text(i);
858
+ break;
859
+ }
860
+ default: {
861
+ let s = 'Token with "' + i.type + '" type was not found.';
862
+ if (this.options.silent) return console.error(s), "";
863
+ throw new Error(s);
1429
864
  }
1430
865
  }
1431
- if (_isClobbered(dirty)) {
1432
- _neutralizeRoot(dirty);
1433
- throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
1434
- }
1435
- try {
1436
- _sanitizeAttachedShadowRoots(dirty);
1437
- } catch (error) {
1438
- _neutralizeRoot(dirty);
1439
- throw error;
1440
- }
1441
- } else if (_isNode(dirty)) {
1442
- body = _initDocument("<!---->");
1443
- importedNode = body.ownerDocument.importNode(dirty, true);
1444
- if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
1445
- body = importedNode;
1446
- } else if (importedNode.nodeName === "HTML") {
1447
- body = importedNode;
1448
- } else {
1449
- body.appendChild(importedNode);
1450
- }
1451
- _sanitizeAttachedShadowRoots(importedNode);
1452
- } else {
1453
- if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
1454
- dirty.indexOf("<") === -1) {
1455
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
1456
- }
1457
- body = _initDocument(dirty);
1458
- if (!body) {
1459
- return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
1460
- }
1461
- }
1462
- if (body && FORCE_BODY) {
1463
- _forceRemove(body.firstChild);
1464
866
  }
1465
- const walkRoot = inPlace ? dirty : body;
1466
- try {
1467
- const nodeIterator = _createNodeIterator(walkRoot);
1468
- while (currentNode = nodeIterator.nextNode()) {
1469
- _sanitizeElements(currentNode, walkRoot);
1470
- _sanitizeAttributes(currentNode);
1471
- if (_isDocumentFragment(currentNode.content)) {
1472
- _sanitizeShadowDOM2(currentNode.content);
867
+ return t;
868
+ }
869
+ parseInline(e, t = this.renderer) {
870
+ var _a2, _b;
871
+ this.renderer.parser = this;
872
+ let n = "";
873
+ for (let r = 0; r < e.length; r++) {
874
+ let i = e[r];
875
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[i.type]) {
876
+ let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
877
+ if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
878
+ n += a || "";
879
+ continue;
1473
880
  }
1474
881
  }
1475
- } catch (error) {
1476
- if (inPlace) {
1477
- _neutralizeRoot(dirty);
1478
- arrayForEach(DOMPurify.removed, (entry) => {
1479
- if (entry.element) {
1480
- _neutralizeSubtree(entry.element);
1481
- }
1482
- });
1483
- }
1484
- throw error;
1485
- }
1486
- if (inPlace) {
1487
- arrayForEach(DOMPurify.removed, (entry) => {
1488
- if (entry.element) {
1489
- _neutralizeSubtree(entry.element);
882
+ let s = i;
883
+ switch (s.type) {
884
+ case "escape": {
885
+ n += t.text(s);
886
+ break;
887
+ }
888
+ case "html": {
889
+ n += t.html(s);
890
+ break;
891
+ }
892
+ case "link": {
893
+ n += t.link(s);
894
+ break;
895
+ }
896
+ case "image": {
897
+ n += t.image(s);
898
+ break;
899
+ }
900
+ case "checkbox": {
901
+ n += t.checkbox(s);
902
+ break;
903
+ }
904
+ case "strong": {
905
+ n += t.strong(s);
906
+ break;
907
+ }
908
+ case "em": {
909
+ n += t.em(s);
910
+ break;
911
+ }
912
+ case "codespan": {
913
+ n += t.codespan(s);
914
+ break;
915
+ }
916
+ case "br": {
917
+ n += t.br(s);
918
+ break;
919
+ }
920
+ case "del": {
921
+ n += t.del(s);
922
+ break;
923
+ }
924
+ case "text": {
925
+ n += t.text(s);
926
+ break;
927
+ }
928
+ default: {
929
+ let a = 'Token with "' + s.type + '" type was not found.';
930
+ if (this.options.silent) return console.error(a), "";
931
+ throw new Error(a);
1490
932
  }
1491
- });
1492
- if (SAFE_FOR_TEMPLATES) {
1493
- _scrubTemplateExpressions2(dirty);
1494
933
  }
1495
- return dirty;
1496
934
  }
1497
- if (RETURN_DOM) {
1498
- if (SAFE_FOR_TEMPLATES) {
1499
- _scrubTemplateExpressions2(body);
1500
- }
1501
- if (RETURN_DOM_FRAGMENT) {
1502
- returnNode = createDocumentFragment.call(body.ownerDocument);
1503
- while (body.firstChild) {
1504
- returnNode.appendChild(body.firstChild);
935
+ return n;
936
+ }
937
+ };
938
+ var P = (_a = class {
939
+ constructor(e) {
940
+ __publicField(this, "options");
941
+ __publicField(this, "block");
942
+ this.options = e || exports.defaults;
943
+ }
944
+ preprocess(e) {
945
+ return e;
946
+ }
947
+ postprocess(e) {
948
+ return e;
949
+ }
950
+ processAllTokens(e) {
951
+ return e;
952
+ }
953
+ emStrongMask(e) {
954
+ return e;
955
+ }
956
+ provideLexer(e = this.block) {
957
+ return e ? x.lex : x.lexInline;
958
+ }
959
+ provideParser(e = this.block) {
960
+ return e ? b.parse : b.parseInline;
961
+ }
962
+ }, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
963
+ var D = class {
964
+ constructor(...e) {
965
+ __publicField(this, "defaults", M());
966
+ __publicField(this, "options", this.setOptions);
967
+ __publicField(this, "parse", this.parseMarkdown(true));
968
+ __publicField(this, "parseInline", this.parseMarkdown(false));
969
+ __publicField(this, "Parser", b);
970
+ __publicField(this, "Renderer", y);
971
+ __publicField(this, "TextRenderer", $);
972
+ __publicField(this, "Lexer", x);
973
+ __publicField(this, "Tokenizer", w);
974
+ __publicField(this, "Hooks", P);
975
+ this.use(...e);
976
+ }
977
+ walkTokens(e, t) {
978
+ var _a2, _b;
979
+ let n = [];
980
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
981
+ case "table": {
982
+ let i = r;
983
+ for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
984
+ for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
985
+ break;
986
+ }
987
+ case "list": {
988
+ let i = r;
989
+ n = n.concat(this.walkTokens(i.items, t));
990
+ break;
991
+ }
992
+ default: {
993
+ let i = r;
994
+ ((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[i.type]) ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
995
+ let a = i[s].flat(1 / 0);
996
+ n = n.concat(this.walkTokens(a, t));
997
+ }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
998
+ }
999
+ }
1000
+ return n;
1001
+ }
1002
+ use(...e) {
1003
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1004
+ return e.forEach((n) => {
1005
+ let r = { ...n };
1006
+ if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
1007
+ if (!i.name) throw new Error("extension name required");
1008
+ if ("renderer" in i) {
1009
+ let s = t.renderers[i.name];
1010
+ s ? t.renderers[i.name] = function(...a) {
1011
+ let o = i.renderer.apply(this, a);
1012
+ return o === false && (o = s.apply(this, a)), o;
1013
+ } : t.renderers[i.name] = i.renderer;
1505
1014
  }
1506
- } else {
1507
- returnNode = body;
1015
+ if ("tokenizer" in i) {
1016
+ if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1017
+ let s = t[i.level];
1018
+ s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
1019
+ }
1020
+ "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
1021
+ }), r.extensions = t), n.renderer) {
1022
+ let i = this.defaults.renderer || new y(this.defaults);
1023
+ for (let s in n.renderer) {
1024
+ if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
1025
+ if (["options", "parser"].includes(s)) continue;
1026
+ let a = s, o = n.renderer[a], l = i[a];
1027
+ i[a] = (...p) => {
1028
+ let c = o.apply(i, p);
1029
+ return c === false && (c = l.apply(i, p)), c || "";
1030
+ };
1031
+ }
1032
+ r.renderer = i;
1033
+ }
1034
+ if (n.tokenizer) {
1035
+ let i = this.defaults.tokenizer || new w(this.defaults);
1036
+ for (let s in n.tokenizer) {
1037
+ if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
1038
+ if (["options", "rules", "lexer"].includes(s)) continue;
1039
+ let a = s, o = n.tokenizer[a], l = i[a];
1040
+ i[a] = (...p) => {
1041
+ let c = o.apply(i, p);
1042
+ return c === false && (c = l.apply(i, p)), c;
1043
+ };
1044
+ }
1045
+ r.tokenizer = i;
1046
+ }
1047
+ if (n.hooks) {
1048
+ let i = this.defaults.hooks || new P();
1049
+ for (let s in n.hooks) {
1050
+ if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
1051
+ if (["options", "block"].includes(s)) continue;
1052
+ let a = s, o = n.hooks[a], l = i[a];
1053
+ P.passThroughHooks.has(s) ? i[a] = (p) => {
1054
+ if (this.defaults.async && P.passThroughHooksRespectAsync.has(s)) return (async () => {
1055
+ let d = await o.call(i, p);
1056
+ return l.call(i, d);
1057
+ })();
1058
+ let c = o.call(i, p);
1059
+ return l.call(i, c);
1060
+ } : i[a] = (...p) => {
1061
+ if (this.defaults.async) return (async () => {
1062
+ let d = await o.apply(i, p);
1063
+ return d === false && (d = await l.apply(i, p)), d;
1064
+ })();
1065
+ let c = o.apply(i, p);
1066
+ return c === false && (c = l.apply(i, p)), c;
1067
+ };
1068
+ }
1069
+ r.hooks = i;
1508
1070
  }
1509
- if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1510
- returnNode = importNode.call(originalDocument, returnNode, true);
1071
+ if (n.walkTokens) {
1072
+ let i = this.defaults.walkTokens, s = n.walkTokens;
1073
+ r.walkTokens = function(a) {
1074
+ let o = [];
1075
+ return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
1076
+ };
1511
1077
  }
1512
- return returnNode;
1513
- }
1514
- let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1515
- if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1516
- serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
1517
- }
1518
- if (SAFE_FOR_TEMPLATES) {
1519
- serializedHTML = _stripTemplateExpressions(serializedHTML);
1520
- }
1521
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
1522
- };
1523
- DOMPurify.setConfig = function() {
1524
- let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1525
- _parseConfig(cfg);
1526
- SET_CONFIG = true;
1527
- SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
1528
- SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
1529
- };
1530
- DOMPurify.clearConfig = function() {
1531
- CONFIG = null;
1532
- SET_CONFIG = false;
1533
- SET_CONFIG_ALLOWED_TAGS = null;
1534
- SET_CONFIG_ALLOWED_ATTR = null;
1535
- trustedTypesPolicy = defaultTrustedTypesPolicy;
1536
- emptyHTML = "";
1537
- };
1538
- DOMPurify.isValidAttribute = function(tag, attr, value) {
1539
- if (!CONFIG) {
1540
- _parseConfig({});
1541
- }
1542
- const lcTag = transformCaseFunc(tag);
1543
- const lcName = transformCaseFunc(attr);
1544
- return _isValidAttribute(lcTag, lcName, value);
1545
- };
1546
- DOMPurify.addHook = function(entryPoint, hookFunction) {
1547
- if (typeof hookFunction !== "function") {
1548
- return;
1549
- }
1550
- if (!objectHasOwnProperty(hooks, entryPoint)) {
1551
- return;
1552
- }
1553
- arrayPush(hooks[entryPoint], hookFunction);
1554
- };
1555
- DOMPurify.removeHook = function(entryPoint, hookFunction) {
1556
- if (!objectHasOwnProperty(hooks, entryPoint)) {
1557
- return void 0;
1558
- }
1559
- if (hookFunction !== void 0) {
1560
- const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1561
- return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
1562
- }
1563
- return arrayPop(hooks[entryPoint]);
1564
- };
1565
- DOMPurify.removeHooks = function(entryPoint) {
1566
- if (!objectHasOwnProperty(hooks, entryPoint)) {
1567
- return;
1568
- }
1569
- hooks[entryPoint] = [];
1570
- };
1571
- DOMPurify.removeAllHooks = function() {
1572
- hooks = _createHooksMap();
1573
- };
1574
- return DOMPurify;
1078
+ this.defaults = { ...this.defaults, ...r };
1079
+ }), this;
1080
+ }
1081
+ setOptions(e) {
1082
+ return this.defaults = { ...this.defaults, ...e }, this;
1083
+ }
1084
+ lexer(e, t) {
1085
+ return x.lex(e, t ?? this.defaults);
1086
+ }
1087
+ parser(e, t) {
1088
+ return b.parse(e, t ?? this.defaults);
1089
+ }
1090
+ parseMarkdown(e) {
1091
+ return (n, r) => {
1092
+ let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
1093
+ if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1094
+ if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
1095
+ if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1096
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
1097
+ let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
1098
+ s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
1099
+ let h = await (s.hooks ? await s.hooks.provideParser(e) : e ? b.parse : b.parseInline)(c, s);
1100
+ return s.hooks ? await s.hooks.postprocess(h) : h;
1101
+ })().catch(a);
1102
+ try {
1103
+ s.hooks && (n = s.hooks.preprocess(n));
1104
+ let l = (s.hooks ? s.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, s);
1105
+ s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
1106
+ let c = (s.hooks ? s.hooks.provideParser(e) : e ? b.parse : b.parseInline)(l, s);
1107
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
1108
+ } catch (o) {
1109
+ return a(o);
1110
+ }
1111
+ };
1112
+ }
1113
+ onError(e, t) {
1114
+ return (n) => {
1115
+ if (n.message += `
1116
+ Please report this to https://github.com/markedjs/marked.`, e) {
1117
+ let r = "<p>An error occurred:</p><pre>" + T(n.message + "", true) + "</pre>";
1118
+ return t ? Promise.resolve(r) : r;
1119
+ }
1120
+ if (t) return Promise.reject(n);
1121
+ throw n;
1122
+ };
1123
+ }
1124
+ };
1125
+ var L = new D();
1126
+ function g(u3, e) {
1127
+ return L.parse(u3, e);
1575
1128
  }
1576
- var purify = createDOMPurify();
1577
- module.exports = purify;
1129
+ g.options = g.setOptions = function(u3) {
1130
+ return L.setOptions(u3), g.defaults = L.defaults, G(g.defaults), g;
1131
+ };
1132
+ g.getDefaults = M;
1133
+ g.defaults = exports.defaults;
1134
+ g.use = function(...u3) {
1135
+ return L.use(...u3), g.defaults = L.defaults, G(g.defaults), g;
1136
+ };
1137
+ g.walkTokens = function(u3, e) {
1138
+ return L.walkTokens(u3, e);
1139
+ };
1140
+ g.parseInline = L.parseInline;
1141
+ g.Parser = b;
1142
+ g.parser = b.parse;
1143
+ g.Renderer = y;
1144
+ g.TextRenderer = $;
1145
+ g.Lexer = x;
1146
+ g.lexer = x.lex;
1147
+ g.Tokenizer = w;
1148
+ g.Hooks = P;
1149
+ g.parse = g;
1150
+ g.options;
1151
+ g.setOptions;
1152
+ g.use;
1153
+ g.walkTokens;
1154
+ g.parseInline;
1155
+ b.parse;
1156
+ x.lex;
1157
+ exports.Hooks = P;
1158
+ exports.Lexer = x;
1159
+ exports.Marked = D;
1160
+ exports.Parser = b;
1161
+ exports.Renderer = y;
1162
+ exports.TextRenderer = $;
1163
+ exports.Tokenizer = w;
1164
+ exports.getDefaults = M;
1165
+ exports.marked = g;
1578
1166
  //# sourceMappingURL=index131.cjs.map