@anyblock/remark-any-block 1.0.3-beta1 → 3.4.11

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.
@@ -62,6 +62,16 @@ function jsdom_disable() {
62
62
  global.history = void 0;
63
63
  global.document = void 0;
64
64
  }
65
+ const ABCSetting = {
66
+ env: "obsidian",
67
+ // 某些环境的独占 api,其他环境用不上
68
+ obsidian: {
69
+ global_app: null,
70
+ global_ctx: null,
71
+ mermaid: void 0,
72
+ markmap_event: void 0
73
+ }
74
+ };
65
75
  const ABReg = {
66
76
  /**
67
77
  * AB块头部
@@ -83,9 +93,9 @@ const ABReg = {
83
93
  * - 不允许 `::` 是避免与 dataview 的 inline property 冲突
84
94
  */
85
95
  // 有前缀版本(给选择器用)
86
- reg_header: /^((\s|>\s|-\s|\*\s|\+\s)*)(%%)?(\[((?!toc|TOC|\!|< )[\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?(%%)?\s*$/,
96
+ reg_header: /^((\s|>\s|-\s|\*\s|\+\s)*)(%%)?(\[((?!toc|TOC|\!|< )[\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?\3\s*$/,
87
97
  // 可以用空`|`来解除首字符限制。(`|`注意:可以用来弄严格模式,`#`注意:建议后面空一格避免变成“标签”,`!`注意:别易误触发 `> [!note]`
88
- reg_header_up: /^((\s|>\s|-\s|\*\s|\+\s)*)(%%)?(\[((?!toc|TOC|\!)< [\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?(%%)?\s*$/,
98
+ reg_header_up: /^((\s|>\s|-\s|\*\s|\+\s)*)(%%)?(\[((?!toc|TOC|\!)< [\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?\3\s*$/,
89
99
  // 向上检查标志的 头部选择器
90
100
  reg_mdit_head: /^((\s|>\s|-\s|\*\s|\+\s)*)(::::*)\s?(.*)/,
91
101
  reg_mdit_tail: /^((\s|>\s|-\s|\*\s|\+\s)*)(::::*)/,
@@ -98,8 +108,8 @@ const ABReg = {
98
108
  reg_heading: /^((\s|>\s|-\s|\*\s|\+\s)*)(\#+\s)(.*)/,
99
109
  reg_table: /^((\s|>\s|-\s|\*\s|\+\s)*)(\|(.*)\|)/,
100
110
  // 无前缀版本(给处理器用,处理器不需要处理前缀,前缀在选择器阶段已经被去除了)
101
- reg_header_noprefix: /^((\s)*)(%%)?(\[((?!toc|TOC|\!|< )[\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?(%%)?\s*$/,
102
- reg_header_up_noprefix: /^((\s)*)(%%)?(\[((?!toc|TOC|\!)< [\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?(%%)?\s*$/,
111
+ reg_header_noprefix: /^((\s)*)(%%)?(\[((?!toc|TOC|\!|< )[\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?\3\s*$/,
112
+ reg_header_up_noprefix: /^((\s)*)(%%)?(\[((?!toc|TOC|\!)< [\|\!#:;\(\)\s0-9a-zA-Z\u4e00-\u9fa5](?!.*::).*)\]):?\3\s*$/,
103
113
  reg_mdit_head_noprefix: /^((\s)*)(::::*)\s?(.*)/,
104
114
  reg_mdit_tail_noprefix: /^((\s)*)(::::*)/,
105
115
  reg_list_noprefix: /^((\s)*)(-\s|\*\s|\+\s)(.*)/,
@@ -112,12 +122,6 @@ const ABReg = {
112
122
  inline_split: /\| |, |, |\. |。 |: |: /
113
123
  // 内联切分。`|`或全角符号+一空格,半角符号+两空格 (后者由于空格压缩,若经历了重渲染可能有问题)
114
124
  };
115
- const ABCSetting = {
116
- env: "obsidian",
117
- // MarkdownPostProcessorContext类型, obsidian专用
118
- mermaid: void 0
119
- // obsidian专用,表示使用哪种方式渲染mermaid
120
- };
121
125
  const convert = (
122
126
  // Note: overloads in JSDoc can’t yet use different `@template`s.
123
127
  /**
@@ -392,11 +396,11 @@ function autoABAlias(header, selectorName, content) {
392
396
  } else if (selectorName == "table" || ABReg.reg_table_noprefix.test(content.trimStart())) {
393
397
  header = "|table_140lne" + header;
394
398
  }
395
- for (const item of ABAlias_json) {
399
+ for (const item of get_ABAlias_iter()) {
396
400
  header = header.replace(item.regex, item.replacement);
397
401
  }
398
402
  for (const item of ABAlias_json_withSub) {
399
- header = header.replace(item.regex, (match2, ...groups) => {
403
+ header = header.replace(item.regex, (_match, ...groups) => {
400
404
  return item.replacement.replace(/\$(\d+)/g, (_, number) => groups[number - 1] ?? "");
401
405
  });
402
406
  }
@@ -429,15 +433,35 @@ const ABAlias_json_withSub = [
429
433
  // 注意避免和原上/上面的callout语法冲突,以及自身递归
430
434
  ];
431
435
  const ABAlias_json_mdit = [
432
- { regex: /\|:::_140lne\|(2?tabs?|标签页?)\|/, replacement: "|mditTabs|" },
436
+ { regex: /\|:::_140lne\|((?:mdit2|2)?tabs?|标签页?)\|/, replacement: "|mditTabs|" },
433
437
  { regex: "|:::_140lne|demo|", replacement: "|mditDemo|" },
434
438
  { regex: "|:::_140lne|abDemo|", replacement: "|mditABDemo|" },
435
- { regex: /\|:::_140lne\|(2?col|分栏)\|/, replacement: "|mditCol|" },
436
- { regex: /\|:::_140lne\|(2?card|卡片)\|/, replacement: "|mditCard|" },
437
- { regex: /\|:::_140lne\|(2?chat|聊天)\|/, replacement: "|mditChat|code(chat)|" }
439
+ { regex: /\|:::_140lne\|((?:mdit2|2)?col|分栏)\|/, replacement: "|mditCol|" },
440
+ { regex: /\|:::_140lne\|((?:mdit2|2)?card|卡片)\|/, replacement: "|mditCard|" },
441
+ { regex: /\|:::_140lne\|((?:mdit2|2)?chat|聊天)\|/, replacement: "|mditChat|code(chat)|" },
442
+ //
443
+ // {regex: /\|:::_140lne\|2?(timeline|时间线)\|/, replacement: "|title2timeline|"},
444
+ // {regex: /\|:::_140lne\|2?(tabs?|标签页?)\||\|title2tabs?\|/, replacement: "|title2c2listdata|c2listdata2tab|"},
445
+ // {regex: /\|:::_140lne\|2?(col|分栏)\||\|title2col\|/, replacement: "|title2c2listdata|c2listdata2items|addClass(ab-col)|"},
446
+ // {regex: /\|:::_140lne\|2?(card|卡片)\||\|title2card\|/, replacement: "|title2c2listdata|c2listdata2items|addClass(ab-card)|addClass(ab-lay-vfall)|"},
447
+ // {regex: /\|:::_140lne\|2?(nodes?|节点)\||\|(title2node|title2abMindmap)\|/, replacement: "|title2listdata|listdata2strict|listdata2nodes|"},
448
+ // list - 多叉多层树
449
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(mermaid|flow|流程图)\|/, replacement: "|mdit2list|list2mermaid|" },
450
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(mehrmaid|mdmermaid)\|/, replacement: "|mdit2list|list2mehrmaidText|code(mehrmaid)|" },
451
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(puml)?(plantuml|mindmap|脑图|思维导图)\|/, replacement: "|mdit2list|list2pumlMindmap|" },
452
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(markmap|mdMindmap|md脑图|md思维导图)\|/, replacement: "|mdit2list|list2markmap|" },
453
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(wbs|(工作)?分解(图|结构))\|/, replacement: "|mdit2list|list2pumlWBS|" },
454
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(table|multiWayTable|multiCrossTable|表格?|多叉表格?|跨行表格?)\|/, replacement: "|mdit2list|list2table|" },
455
+ // list - lt树 (属于多层一叉树)
456
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(lt|listTable|treeTable|listGrid|treeGrid|列表格|树形表格?)\|/, replacement: "|mdit2list|list2lt|" },
457
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(list|列表)\|/, replacement: "|mdit2list|list2lt|addClass(ab-listtable-likelist)|" },
458
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(dir|dirTree|目录树?|目录结构)\|/, replacement: "|mdit2list|list2dt|" },
459
+ // list - 二层树
460
+ { regex: /\|:::_140lne\|(fakeList|仿列表)\|/, replacement: "|mdit2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" },
461
+ // 至后
462
+ { regex: "|mdit2list|", replacement: "|mdit2listdata|listdata2strict|listdata2list|" }
438
463
  ];
439
464
  const ABAlias_json_title = [
440
- { regex: "|title2list|", replacement: "|title2listdata|listdata2strict|listdata2list|" },
441
465
  // title - list&title
442
466
  { regex: /\|heading_140lne\|2?(timeline|时间线)\|/, replacement: "|title2timeline|" },
443
467
  { regex: /\|heading_140lne\|2?(tabs?|标签页?)\||\|title2tabs?\|/, replacement: "|title2c2listdata|c2listdata2tab|" },
@@ -456,7 +480,9 @@ const ABAlias_json_title = [
456
480
  { regex: /\|heading_140lne\|2?(list|列表)\|/, replacement: "|title2list|list2lt|addClass(ab-listtable-likelist)|" },
457
481
  { regex: /\|heading_140lne\|2?(dir|dirTree|目录树?|目录结构)\|/, replacement: "|title2list|list2dt|" },
458
482
  // list - 二层树
459
- { regex: /\|heading_140lne\|(fakeList|仿列表)\|/, replacement: "|title2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" }
483
+ { regex: /\|heading_140lne\|(fakeList|仿列表)\|/, replacement: "|title2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" },
484
+ // 至后
485
+ { regex: "|title2list|", replacement: "|title2listdata|listdata2strict|listdata2list|" }
460
486
  ];
461
487
  const ABAlias_json_list = [
462
488
  // 特殊
@@ -540,7 +566,9 @@ const ABAlias_json_general = [
540
566
  { regex: "|超超小字|", replacement: "|addClass(ab-custom-font-smallxx)|" },
541
567
  { regex: "|加粗|", replacement: "|addClass(ab-custom-font-bold)|" }
542
568
  ];
543
- const ABAlias_json_default = [
569
+ const ABAlias_user = [];
570
+ const ABAlias_pro = [];
571
+ const ABAlias_default = [
544
572
  ...ABAlias_json_mdit,
545
573
  ...ABAlias_json_title,
546
574
  ...ABAlias_json_list,
@@ -550,10 +578,11 @@ const ABAlias_json_default = [
550
578
  ...ABAlias_json_general
551
579
  // 这个放最后
552
580
  ];
553
- let ABAlias_json = [
554
- ...ABAlias_json_default
555
- // 设置决定是否停用
556
- ];
581
+ function* get_ABAlias_iter() {
582
+ yield* ABAlias_user;
583
+ yield* ABAlias_pro;
584
+ yield* ABAlias_default;
585
+ }
557
586
  const ABAlias_json_end = [
558
587
  { regex: "|:::_140lne", replacement: "" },
559
588
  { regex: "|heading_140lne", replacement: "" },
@@ -610,24 +639,18 @@ class ABConvertManager {
610
639
  * @param header 转换方式
611
640
  * @param content 要转换的初始文本 (无前缀版本,前缀在选择器环节已经删除了)
612
641
  * @param selectorName 选择器名,空表示未知
613
- * @return 等于el,无用,后面可以删了
614
642
  */
615
643
  static autoABConvert(el, header, content, selectorName = "", ctx) {
616
- let prev_result = content;
617
- let prev_type = "string";
618
- let prev_type2 = ABConvert_IOEnum.text;
619
- let prev_processor;
620
644
  let prev2 = {
621
- // 组合在一起是为了引用传参
622
- prev_result,
623
- prev_type,
624
- prev_type2,
625
- prev_processor
645
+ prev_result: content,
646
+ prev_type: "string",
647
+ prev_type2: ABConvert_IOEnum.text,
648
+ prev_processor: void 0
626
649
  };
627
650
  {
628
- header = autoABAlias(header, selectorName, prev_result);
651
+ header = autoABAlias(header, selectorName, prev2.prev_result);
629
652
  let list_header = header.split("|");
630
- prev_result = this.autoABConvert_runConvert(el, list_header, prev2, ctx);
653
+ this.autoABConvert_runConvert(el, list_header, prev2, ctx);
631
654
  this.autoABConvert_last(el, header, selectorName, prev2, ctx);
632
655
  }
633
656
  }
@@ -686,7 +709,12 @@ class ABConvertManager {
686
709
  break;
687
710
  }
688
711
  }
689
- prev2.prev_result = abReplaceProcessor.process(el, item_header, prev2.prev_result, ctx);
712
+ try {
713
+ prev2.prev_result = abReplaceProcessor.process(el, item_header, prev2.prev_result, ctx);
714
+ } catch (e) {
715
+ console.error(`处理器执行错误, id:${abReplaceProcessor.id}, header:${item_header}, error:`, e);
716
+ break;
717
+ }
690
718
  prev2.prev_type = typeof prev2.prev_result;
691
719
  prev2.prev_type2 = abReplaceProcessor.process_return;
692
720
  prev2.prev_processor = abReplaceProcessor.process;
@@ -700,7 +728,7 @@ class ABConvertManager {
700
728
  /**
701
729
  * 子函数,后处理/尾处理,主要进行末尾追加指令
702
730
  */
703
- static autoABConvert_last(el, header, selectorName, prev2, ctx) {
731
+ static autoABConvert_last(el, _header, _selectorName, prev2, _ctx) {
704
732
  if (prev2.prev_type == "string" && prev2.prev_type2 == ABConvert_IOEnum.text) {
705
733
  const subEl = document.createElement("div");
706
734
  el.appendChild(subEl);
@@ -708,7 +736,7 @@ class ABConvertManager {
708
736
  prev2.prev_result = el;
709
737
  prev2.prev_type = "object";
710
738
  prev2.prev_type2 = ABConvert_IOEnum.el;
711
- prev2.process = "md";
739
+ prev2.prev_processor = "md";
712
740
  } else if (prev2.prev_type == "string" && prev2.prev_type2 == ABConvert_IOEnum.json) {
713
741
  const code_str = "```json\n" + prev2.prev_result + "\n```\n";
714
742
  const subEl = document.createElement("div");
@@ -717,7 +745,7 @@ class ABConvertManager {
717
745
  prev2.prev_result = el;
718
746
  prev2.prev_type = "object";
719
747
  prev2.prev_type2 = ABConvert_IOEnum.el;
720
- prev2.process = "show_json";
748
+ prev2.prev_processor = "show_json";
721
749
  } else if (prev2.prev_type == "object" && (prev2.prev_type2 == ABConvert_IOEnum.list_stream || prev2.prev_type2 == ABConvert_IOEnum.c2list_stream || prev2.prev_type2 == ABConvert_IOEnum.json)) {
722
750
  const code_str = "```json\n" + JSON.stringify(prev2.prev_result, null, 2) + "\n```\n";
723
751
  const subEl = document.createElement("div");
@@ -726,7 +754,7 @@ class ABConvertManager {
726
754
  prev2.prev_result = el;
727
755
  prev2.prev_type = "object";
728
756
  prev2.prev_type2 = ABConvert_IOEnum.el;
729
- prev2.process = "show_listStream";
757
+ prev2.prev_processor = "show_listStream";
730
758
  } else if (prev2.prev_type == "object" && prev2.prev_type2 == ABConvert_IOEnum.el) {
731
759
  return prev2;
732
760
  } else {
@@ -1170,7 +1198,7 @@ class ListProcess {
1170
1198
  }
1171
1199
  }
1172
1200
  /**
1173
- * 标题大纲转列表数据(@todo 正文的level+10,要减掉)
1201
+ * 标题大纲转列表数据
1174
1202
  *
1175
1203
  * @detail
1176
1204
  * 这里要将标题、正文、列表 的等级合为一块,所以存在偏移值:
@@ -1179,6 +1207,7 @@ class ListProcess {
1179
1207
  * 2. 正文等级, = 0, 取值[+1,+Infi]
1180
1208
  * 3. 列表等级, = `(.*)-`个数+1, 取值[0]
1181
1209
  *
1210
+ * (比较旧版是正文+10,列表+11,后来允许标题等级为负数。这样方便很多)
1182
1211
  */
1183
1212
  static title2data(text2) {
1184
1213
  let list_itemInfo = [];
@@ -1189,13 +1218,21 @@ class ListProcess {
1189
1218
  if (codeBlockFlag == "") {
1190
1219
  const match2 = line.match(ABReg.reg_code);
1191
1220
  if (match2 && match2[3]) {
1192
- codeBlockFlag = match2[1] + match2[3];
1193
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1221
+ if (mul_mode === "heading" || mul_mode === "") {
1222
+ list_itemInfo.push({
1223
+ content: line,
1224
+ level: 0
1225
+ });
1226
+ mul_mode = "para";
1227
+ } else {
1228
+ codeBlockFlag = match2[1] + match2[3];
1229
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1230
+ }
1194
1231
  continue;
1195
1232
  }
1196
1233
  } else {
1197
1234
  if (line.indexOf(codeBlockFlag) == 0) codeBlockFlag = "";
1198
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1235
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1199
1236
  continue;
1200
1237
  }
1201
1238
  const match_heading = line.match(ABReg.reg_heading_noprefix);
@@ -1212,21 +1249,125 @@ class ListProcess {
1212
1249
  list_itemInfo.push({
1213
1250
  content: match_list[4],
1214
1251
  level: match_list[1].length + 1
1215
- //+10
1216
1252
  });
1217
1253
  mul_mode = "list";
1218
1254
  } else if (/^\S/.test(line) && mul_mode == "list") {
1219
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1255
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1220
1256
  } else {
1221
1257
  if (mul_mode == "para") {
1222
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1258
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1259
+ } else if (/^\s*$/.test(line)) {
1260
+ continue;
1261
+ } else {
1262
+ list_itemInfo.push({
1263
+ content: line,
1264
+ level: 0
1265
+ });
1266
+ mul_mode = "para";
1267
+ }
1268
+ }
1269
+ }
1270
+ removeTailBlank();
1271
+ return list_itemInfo;
1272
+ function removeTailBlank() {
1273
+ if (mul_mode == "para" || mul_mode == "list") {
1274
+ list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content.replace(/\s*$/, "");
1275
+ }
1276
+ }
1277
+ }
1278
+ /**
1279
+ * MarkdownIt 转列表数据
1280
+ *
1281
+ * @detail
1282
+ * 与 title2data 的逻辑基本相同
1283
+ *
1284
+ * 这里要将Mdit标识 (@xxx)、正文、列表 的等级合为一块,所以存在偏移值:
1285
+ *
1286
+ * 1. Mdit等级, = `@<数字>`-100,
1287
+ * 2. 正文等级, = 0, 取值[+1,+Infi]
1288
+ * 3. 列表等级, = `(.*)-`个数+1, 取值[0]
1289
+ *
1290
+ * 例如:
1291
+ *
1292
+ * :::
1293
+ *
1294
+ * @1 AAA
1295
+ *
1296
+ * aaa
1297
+ *
1298
+ * @2 BBB
1299
+ *
1300
+ * @2 B22
1301
+ *
1302
+ * ccc
1303
+ * ddd
1304
+ *
1305
+ * @1 A22
1306
+ *
1307
+ * :::
1308
+ *
1309
+ * 会被转化为
1310
+ *
1311
+ * - AAA
1312
+ * - BBB
1313
+ * - B22
1314
+ * - ccc
1315
+ * ddd
1316
+ * - A22
1317
+ */
1318
+ static mdit2data(text2) {
1319
+ let list_itemInfo = [];
1320
+ const list_text = text2.split("\n");
1321
+ let mul_mode = "";
1322
+ let codeBlockFlag = "";
1323
+ for (let line of list_text) {
1324
+ if (codeBlockFlag == "") {
1325
+ const match2 = line.match(ABReg.reg_code);
1326
+ if (match2 && match2[3]) {
1327
+ if (mul_mode === "mdit" || mul_mode === "") {
1328
+ list_itemInfo.push({
1329
+ content: line,
1330
+ level: 0
1331
+ });
1332
+ mul_mode = "para";
1333
+ } else {
1334
+ codeBlockFlag = match2[1] + match2[3];
1335
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1336
+ }
1337
+ continue;
1338
+ }
1339
+ } else {
1340
+ if (line.indexOf(codeBlockFlag) == 0) codeBlockFlag = "";
1341
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1342
+ continue;
1343
+ }
1344
+ const match_mdit = line.match(/^(\s*)@(\d+)\s+(.*)$/);
1345
+ const match_list = line.match(ABReg.reg_list_noprefix);
1346
+ if (match_mdit && !match_mdit[1]) {
1347
+ removeTailBlank();
1348
+ list_itemInfo.push({
1349
+ content: match_mdit[3],
1350
+ level: Number(match_mdit[2]) - 100
1351
+ });
1352
+ mul_mode = "mdit";
1353
+ } else if (match_list) {
1354
+ removeTailBlank();
1355
+ list_itemInfo.push({
1356
+ content: match_list[4],
1357
+ level: match_list[1].length + 1
1358
+ });
1359
+ mul_mode = "list";
1360
+ } else if (/^\S/.test(line) && mul_mode == "list") {
1361
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1362
+ } else {
1363
+ if (mul_mode == "para") {
1364
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1223
1365
  } else if (/^\s*$/.test(line)) {
1224
1366
  continue;
1225
1367
  } else {
1226
1368
  list_itemInfo.push({
1227
1369
  content: line,
1228
1370
  level: 0
1229
- //+10
1230
1371
  });
1231
1372
  mul_mode = "para";
1232
1373
  }
@@ -1461,6 +1602,16 @@ const abc_title2listdata = ABConvert.factory({
1461
1602
  return ListProcess.title2data(content);
1462
1603
  }
1463
1604
  });
1605
+ ABConvert.factory({
1606
+ id: "mdit2listdata",
1607
+ name: "mdit到listdata",
1608
+ process_param: ABConvert_IOEnum.text,
1609
+ process_return: ABConvert_IOEnum.list_stream,
1610
+ detail: "mdit到listdata",
1611
+ process: (el, header, content) => {
1612
+ return ListProcess.mdit2data(content);
1613
+ }
1614
+ });
1464
1615
  ABConvert.factory({
1465
1616
  id: "listdata2list",
1466
1617
  name: "listdata到列表",
@@ -2456,6 +2607,1085 @@ ABConvert.factory({
2456
2607
  return newContent;
2457
2608
  }
2458
2609
  });
2610
+ function _arrayLikeToArray(r, a) {
2611
+ (null == a || a > r.length) && (a = r.length);
2612
+ for (var e = 0, n2 = Array(a); e < a; e++) n2[e] = r[e];
2613
+ return n2;
2614
+ }
2615
+ function _arrayWithHoles(r) {
2616
+ if (Array.isArray(r)) return r;
2617
+ }
2618
+ function _iterableToArrayLimit(r, l2) {
2619
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2620
+ if (null != t) {
2621
+ var e, n2, i, u, a = [], f = true, o = false;
2622
+ try {
2623
+ if (i = (t = t.call(r)).next, 0 === l2) ;
2624
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l2); f = true) ;
2625
+ } catch (r2) {
2626
+ o = true, n2 = r2;
2627
+ } finally {
2628
+ try {
2629
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
2630
+ } finally {
2631
+ if (o) throw n2;
2632
+ }
2633
+ }
2634
+ return a;
2635
+ }
2636
+ }
2637
+ function _nonIterableRest() {
2638
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2639
+ }
2640
+ function _slicedToArray(r, e) {
2641
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
2642
+ }
2643
+ function _unsupportedIterableToArray(r, a) {
2644
+ if (r) {
2645
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
2646
+ var t = {}.toString.call(r).slice(8, -1);
2647
+ 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;
2648
+ }
2649
+ }
2650
+ const entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2651
+ let freeze = Object.freeze, seal = Object.seal, create = Object.create;
2652
+ let _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
2653
+ if (!freeze) {
2654
+ freeze = function freeze2(x) {
2655
+ return x;
2656
+ };
2657
+ }
2658
+ if (!seal) {
2659
+ seal = function seal2(x) {
2660
+ return x;
2661
+ };
2662
+ }
2663
+ if (!apply) {
2664
+ apply = function apply2(func, thisArg) {
2665
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2666
+ args[_key - 2] = arguments[_key];
2667
+ }
2668
+ return func.apply(thisArg, args);
2669
+ };
2670
+ }
2671
+ if (!construct) {
2672
+ construct = function construct2(Func) {
2673
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2674
+ args[_key2 - 1] = arguments[_key2];
2675
+ }
2676
+ return new Func(...args);
2677
+ };
2678
+ }
2679
+ const arrayForEach = unapply(Array.prototype.forEach);
2680
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
2681
+ const arrayPop = unapply(Array.prototype.pop);
2682
+ const arrayPush = unapply(Array.prototype.push);
2683
+ const arraySplice = unapply(Array.prototype.splice);
2684
+ const arrayIsArray = Array.isArray;
2685
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
2686
+ const stringToString = unapply(String.prototype.toString);
2687
+ const stringMatch = unapply(String.prototype.match);
2688
+ const stringReplace = unapply(String.prototype.replace);
2689
+ const stringIndexOf = unapply(String.prototype.indexOf);
2690
+ const stringTrim = unapply(String.prototype.trim);
2691
+ const numberToString = unapply(Number.prototype.toString);
2692
+ const booleanToString = unapply(Boolean.prototype.toString);
2693
+ const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
2694
+ const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
2695
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
2696
+ const objectToString = unapply(Object.prototype.toString);
2697
+ const regExpTest = unapply(RegExp.prototype.test);
2698
+ const typeErrorCreate = unconstruct(TypeError);
2699
+ function unapply(func) {
2700
+ return function(thisArg) {
2701
+ if (thisArg instanceof RegExp) {
2702
+ thisArg.lastIndex = 0;
2703
+ }
2704
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
2705
+ args[_key3 - 1] = arguments[_key3];
2706
+ }
2707
+ return apply(func, thisArg, args);
2708
+ };
2709
+ }
2710
+ function unconstruct(Func) {
2711
+ return function() {
2712
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2713
+ args[_key4] = arguments[_key4];
2714
+ }
2715
+ return construct(Func, args);
2716
+ };
2717
+ }
2718
+ function addToSet(set2, array) {
2719
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
2720
+ if (setPrototypeOf) {
2721
+ setPrototypeOf(set2, null);
2722
+ }
2723
+ if (!arrayIsArray(array)) {
2724
+ return set2;
2725
+ }
2726
+ let l2 = array.length;
2727
+ while (l2--) {
2728
+ let element = array[l2];
2729
+ if (typeof element === "string") {
2730
+ const lcElement = transformCaseFunc(element);
2731
+ if (lcElement !== element) {
2732
+ if (!isFrozen(array)) {
2733
+ array[l2] = lcElement;
2734
+ }
2735
+ element = lcElement;
2736
+ }
2737
+ }
2738
+ set2[element] = true;
2739
+ }
2740
+ return set2;
2741
+ }
2742
+ function cleanArray(array) {
2743
+ for (let index2 = 0; index2 < array.length; index2++) {
2744
+ const isPropertyExist = objectHasOwnProperty(array, index2);
2745
+ if (!isPropertyExist) {
2746
+ array[index2] = null;
2747
+ }
2748
+ }
2749
+ return array;
2750
+ }
2751
+ function clone$3(object) {
2752
+ const newObject = create(null);
2753
+ for (const _ref2 of entries(object)) {
2754
+ var _ref3 = _slicedToArray(_ref2, 2);
2755
+ const property = _ref3[0];
2756
+ const value = _ref3[1];
2757
+ const isPropertyExist = objectHasOwnProperty(object, property);
2758
+ if (isPropertyExist) {
2759
+ if (arrayIsArray(value)) {
2760
+ newObject[property] = cleanArray(value);
2761
+ } else if (value && typeof value === "object" && value.constructor === Object) {
2762
+ newObject[property] = clone$3(value);
2763
+ } else {
2764
+ newObject[property] = value;
2765
+ }
2766
+ }
2767
+ }
2768
+ return newObject;
2769
+ }
2770
+ function stringifyValue(value) {
2771
+ switch (typeof value) {
2772
+ case "string": {
2773
+ return value;
2774
+ }
2775
+ case "number": {
2776
+ return numberToString(value);
2777
+ }
2778
+ case "boolean": {
2779
+ return booleanToString(value);
2780
+ }
2781
+ case "bigint": {
2782
+ return bigintToString ? bigintToString(value) : "0";
2783
+ }
2784
+ case "symbol": {
2785
+ return symbolToString ? symbolToString(value) : "Symbol()";
2786
+ }
2787
+ case "undefined": {
2788
+ return objectToString(value);
2789
+ }
2790
+ case "function":
2791
+ case "object": {
2792
+ if (value === null) {
2793
+ return objectToString(value);
2794
+ }
2795
+ const valueAsRecord = value;
2796
+ const valueToString = lookupGetter(valueAsRecord, "toString");
2797
+ if (typeof valueToString === "function") {
2798
+ const stringified = valueToString(valueAsRecord);
2799
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
2800
+ }
2801
+ return objectToString(value);
2802
+ }
2803
+ default: {
2804
+ return objectToString(value);
2805
+ }
2806
+ }
2807
+ }
2808
+ function lookupGetter(object, prop2) {
2809
+ while (object !== null) {
2810
+ const desc = getOwnPropertyDescriptor(object, prop2);
2811
+ if (desc) {
2812
+ if (desc.get) {
2813
+ return unapply(desc.get);
2814
+ }
2815
+ if (typeof desc.value === "function") {
2816
+ return unapply(desc.value);
2817
+ }
2818
+ }
2819
+ object = getPrototypeOf(object);
2820
+ }
2821
+ function fallbackValue() {
2822
+ return null;
2823
+ }
2824
+ return fallbackValue;
2825
+ }
2826
+ function isRegex(value) {
2827
+ try {
2828
+ regExpTest(value, "");
2829
+ return true;
2830
+ } catch (_unused) {
2831
+ return false;
2832
+ }
2833
+ }
2834
+ const html$1$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"]);
2835
+ 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"]);
2836
+ 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"]);
2837
+ 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"]);
2838
+ 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"]);
2839
+ const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
2840
+ const text$2 = freeze(["#text"]);
2841
+ const html$2 = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "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"]);
2842
+ 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", "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", "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-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "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"]);
2843
+ 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"]);
2844
+ const xml$1 = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
2845
+ const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
2846
+ const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
2847
+ const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
2848
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
2849
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
2850
+ const IS_ALLOWED_URI = seal(
2851
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
2852
+ // eslint-disable-line no-useless-escape
2853
+ );
2854
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
2855
+ const ATTR_WHITESPACE = seal(
2856
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
2857
+ // eslint-disable-line no-control-regex
2858
+ );
2859
+ const DOCTYPE_NAME = seal(/^html$/i);
2860
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
2861
+ const NODE_TYPE$1 = {
2862
+ element: 1,
2863
+ text: 3,
2864
+ // Deprecated
2865
+ progressingInstruction: 7,
2866
+ comment: 8,
2867
+ document: 9
2868
+ };
2869
+ const getGlobal = function getGlobal2() {
2870
+ return typeof window === "undefined" ? null : window;
2871
+ };
2872
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
2873
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
2874
+ return null;
2875
+ }
2876
+ let suffix = null;
2877
+ const ATTR_NAME = "data-tt-policy-suffix";
2878
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
2879
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
2880
+ }
2881
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
2882
+ try {
2883
+ return trustedTypes.createPolicy(policyName, {
2884
+ createHTML(html2) {
2885
+ return html2;
2886
+ },
2887
+ createScriptURL(scriptUrl) {
2888
+ return scriptUrl;
2889
+ }
2890
+ });
2891
+ } catch (_) {
2892
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
2893
+ return null;
2894
+ }
2895
+ };
2896
+ const _createHooksMap = function _createHooksMap2() {
2897
+ return {
2898
+ afterSanitizeAttributes: [],
2899
+ afterSanitizeElements: [],
2900
+ afterSanitizeShadowDOM: [],
2901
+ beforeSanitizeAttributes: [],
2902
+ beforeSanitizeElements: [],
2903
+ beforeSanitizeShadowDOM: [],
2904
+ uponSanitizeAttribute: [],
2905
+ uponSanitizeElement: [],
2906
+ uponSanitizeShadowNode: []
2907
+ };
2908
+ };
2909
+ function createDOMPurify() {
2910
+ let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
2911
+ const DOMPurify = (root2) => createDOMPurify(root2);
2912
+ DOMPurify.version = "3.4.3";
2913
+ DOMPurify.removed = [];
2914
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE$1.document || !window2.Element) {
2915
+ DOMPurify.isSupported = false;
2916
+ return DOMPurify;
2917
+ }
2918
+ let document2 = window2.document;
2919
+ const originalDocument = document2;
2920
+ const currentScript = originalDocument.currentScript;
2921
+ const DocumentFragment = window2.DocumentFragment, HTMLTemplateElement = window2.HTMLTemplateElement, Node3 = window2.Node, Element2 = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window2.HTMLFormElement, DOMParser = window2.DOMParser, trustedTypes = window2.trustedTypes;
2922
+ const ElementPrototype = Element2.prototype;
2923
+ const cloneNode2 = lookupGetter(ElementPrototype, "cloneNode");
2924
+ const remove2 = lookupGetter(ElementPrototype, "remove");
2925
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
2926
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
2927
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
2928
+ if (typeof HTMLTemplateElement === "function") {
2929
+ const template = document2.createElement("template");
2930
+ if (template.content && template.content.ownerDocument) {
2931
+ document2 = template.content.ownerDocument;
2932
+ }
2933
+ }
2934
+ let trustedTypesPolicy;
2935
+ let emptyHTML = "";
2936
+ const _document = document2, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName2 = _document.getElementsByTagName;
2937
+ const importNode = originalDocument.importNode;
2938
+ let hooks = _createHooksMap();
2939
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
2940
+ 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;
2941
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
2942
+ let ALLOWED_TAGS = null;
2943
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text$2]);
2944
+ let ALLOWED_ATTR = null;
2945
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html$2, ...svg, ...mathMl, ...xml$1]);
2946
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
2947
+ tagNameCheck: {
2948
+ writable: true,
2949
+ configurable: false,
2950
+ enumerable: true,
2951
+ value: null
2952
+ },
2953
+ attributeNameCheck: {
2954
+ writable: true,
2955
+ configurable: false,
2956
+ enumerable: true,
2957
+ value: null
2958
+ },
2959
+ allowCustomizedBuiltInElements: {
2960
+ writable: true,
2961
+ configurable: false,
2962
+ enumerable: true,
2963
+ value: false
2964
+ }
2965
+ }));
2966
+ let FORBID_TAGS = null;
2967
+ let FORBID_ATTR = null;
2968
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
2969
+ tagCheck: {
2970
+ writable: true,
2971
+ configurable: false,
2972
+ enumerable: true,
2973
+ value: null
2974
+ },
2975
+ attributeCheck: {
2976
+ writable: true,
2977
+ configurable: false,
2978
+ enumerable: true,
2979
+ value: null
2980
+ }
2981
+ }));
2982
+ let ALLOW_ARIA_ATTR = true;
2983
+ let ALLOW_DATA_ATTR = true;
2984
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
2985
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
2986
+ let SAFE_FOR_TEMPLATES = false;
2987
+ let SAFE_FOR_XML = true;
2988
+ let WHOLE_DOCUMENT = false;
2989
+ let SET_CONFIG = false;
2990
+ let FORCE_BODY = false;
2991
+ let RETURN_DOM = false;
2992
+ let RETURN_DOM_FRAGMENT = false;
2993
+ let RETURN_TRUSTED_TYPE = false;
2994
+ let SANITIZE_DOM = true;
2995
+ let SANITIZE_NAMED_PROPS = false;
2996
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
2997
+ let KEEP_CONTENT = true;
2998
+ let IN_PLACE = false;
2999
+ let USE_PROFILES = {};
3000
+ let FORBID_CONTENTS = null;
3001
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
3002
+ let DATA_URI_TAGS = null;
3003
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
3004
+ let URI_SAFE_ATTRIBUTES = null;
3005
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
3006
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
3007
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
3008
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
3009
+ let NAMESPACE = HTML_NAMESPACE;
3010
+ let IS_EMPTY_INPUT = false;
3011
+ let ALLOWED_NAMESPACES = null;
3012
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
3013
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
3014
+ let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
3015
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
3016
+ let PARSER_MEDIA_TYPE = null;
3017
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
3018
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
3019
+ let transformCaseFunc = null;
3020
+ let CONFIG = null;
3021
+ const formElement = document2.createElement("form");
3022
+ const isRegexOrFunction = function isRegexOrFunction2(testValue) {
3023
+ return testValue instanceof RegExp || testValue instanceof Function;
3024
+ };
3025
+ const _parseConfig = function _parseConfig2() {
3026
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3027
+ if (CONFIG && CONFIG === cfg) {
3028
+ return;
3029
+ }
3030
+ if (!cfg || typeof cfg !== "object") {
3031
+ cfg = {};
3032
+ }
3033
+ cfg = clone$3(cfg);
3034
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
3035
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
3036
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
3037
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
3038
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
3039
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
3040
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone$3(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
3041
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone$3(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
3042
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
3043
+ FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone$3({});
3044
+ FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone$3({});
3045
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone$3(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
3046
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
3047
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
3048
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
3049
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
3050
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
3051
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
3052
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
3053
+ RETURN_DOM = cfg.RETURN_DOM || false;
3054
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
3055
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
3056
+ FORCE_BODY = cfg.FORCE_BODY || false;
3057
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
3058
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
3059
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
3060
+ IN_PLACE = cfg.IN_PLACE || false;
3061
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
3062
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
3063
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone$3(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
3064
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone$3(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
3065
+ const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone$3(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
3066
+ CUSTOM_ELEMENT_HANDLING = create(null);
3067
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
3068
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
3069
+ }
3070
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
3071
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
3072
+ }
3073
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
3074
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
3075
+ }
3076
+ if (SAFE_FOR_TEMPLATES) {
3077
+ ALLOW_DATA_ATTR = false;
3078
+ }
3079
+ if (RETURN_DOM_FRAGMENT) {
3080
+ RETURN_DOM = true;
3081
+ }
3082
+ if (USE_PROFILES) {
3083
+ ALLOWED_TAGS = addToSet({}, text$2);
3084
+ ALLOWED_ATTR = create(null);
3085
+ if (USE_PROFILES.html === true) {
3086
+ addToSet(ALLOWED_TAGS, html$1$1);
3087
+ addToSet(ALLOWED_ATTR, html$2);
3088
+ }
3089
+ if (USE_PROFILES.svg === true) {
3090
+ addToSet(ALLOWED_TAGS, svg$1);
3091
+ addToSet(ALLOWED_ATTR, svg);
3092
+ addToSet(ALLOWED_ATTR, xml$1);
3093
+ }
3094
+ if (USE_PROFILES.svgFilters === true) {
3095
+ addToSet(ALLOWED_TAGS, svgFilters);
3096
+ addToSet(ALLOWED_ATTR, svg);
3097
+ addToSet(ALLOWED_ATTR, xml$1);
3098
+ }
3099
+ if (USE_PROFILES.mathMl === true) {
3100
+ addToSet(ALLOWED_TAGS, mathMl$1);
3101
+ addToSet(ALLOWED_ATTR, mathMl);
3102
+ addToSet(ALLOWED_ATTR, xml$1);
3103
+ }
3104
+ }
3105
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
3106
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
3107
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
3108
+ if (typeof cfg.ADD_TAGS === "function") {
3109
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
3110
+ } else if (arrayIsArray(cfg.ADD_TAGS)) {
3111
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
3112
+ ALLOWED_TAGS = clone$3(ALLOWED_TAGS);
3113
+ }
3114
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
3115
+ }
3116
+ }
3117
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
3118
+ if (typeof cfg.ADD_ATTR === "function") {
3119
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
3120
+ } else if (arrayIsArray(cfg.ADD_ATTR)) {
3121
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
3122
+ ALLOWED_ATTR = clone$3(ALLOWED_ATTR);
3123
+ }
3124
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
3125
+ }
3126
+ }
3127
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
3128
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
3129
+ }
3130
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
3131
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
3132
+ FORBID_CONTENTS = clone$3(FORBID_CONTENTS);
3133
+ }
3134
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
3135
+ }
3136
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
3137
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
3138
+ FORBID_CONTENTS = clone$3(FORBID_CONTENTS);
3139
+ }
3140
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
3141
+ }
3142
+ if (KEEP_CONTENT) {
3143
+ ALLOWED_TAGS["#text"] = true;
3144
+ }
3145
+ if (WHOLE_DOCUMENT) {
3146
+ addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
3147
+ }
3148
+ if (ALLOWED_TAGS.table) {
3149
+ addToSet(ALLOWED_TAGS, ["tbody"]);
3150
+ delete FORBID_TAGS.tbody;
3151
+ }
3152
+ if (cfg.TRUSTED_TYPES_POLICY) {
3153
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
3154
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
3155
+ }
3156
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
3157
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
3158
+ }
3159
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
3160
+ emptyHTML = trustedTypesPolicy.createHTML("");
3161
+ } else {
3162
+ if (trustedTypesPolicy === void 0) {
3163
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
3164
+ }
3165
+ if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
3166
+ emptyHTML = trustedTypesPolicy.createHTML("");
3167
+ }
3168
+ }
3169
+ if (freeze) {
3170
+ freeze(cfg);
3171
+ }
3172
+ CONFIG = cfg;
3173
+ };
3174
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
3175
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
3176
+ const _checkValidNamespace = function _checkValidNamespace2(element) {
3177
+ let parent2 = getParentNode(element);
3178
+ if (!parent2 || !parent2.tagName) {
3179
+ parent2 = {
3180
+ namespaceURI: NAMESPACE,
3181
+ tagName: "template"
3182
+ };
3183
+ }
3184
+ const tagName = stringToLowerCase(element.tagName);
3185
+ const parentTagName = stringToLowerCase(parent2.tagName);
3186
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
3187
+ return false;
3188
+ }
3189
+ if (element.namespaceURI === SVG_NAMESPACE) {
3190
+ if (parent2.namespaceURI === HTML_NAMESPACE) {
3191
+ return tagName === "svg";
3192
+ }
3193
+ if (parent2.namespaceURI === MATHML_NAMESPACE) {
3194
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
3195
+ }
3196
+ return Boolean(ALL_SVG_TAGS[tagName]);
3197
+ }
3198
+ if (element.namespaceURI === MATHML_NAMESPACE) {
3199
+ if (parent2.namespaceURI === HTML_NAMESPACE) {
3200
+ return tagName === "math";
3201
+ }
3202
+ if (parent2.namespaceURI === SVG_NAMESPACE) {
3203
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
3204
+ }
3205
+ return Boolean(ALL_MATHML_TAGS[tagName]);
3206
+ }
3207
+ if (element.namespaceURI === HTML_NAMESPACE) {
3208
+ if (parent2.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
3209
+ return false;
3210
+ }
3211
+ if (parent2.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
3212
+ return false;
3213
+ }
3214
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
3215
+ }
3216
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
3217
+ return true;
3218
+ }
3219
+ return false;
3220
+ };
3221
+ const _forceRemove = function _forceRemove2(node) {
3222
+ arrayPush(DOMPurify.removed, {
3223
+ element: node
3224
+ });
3225
+ try {
3226
+ getParentNode(node).removeChild(node);
3227
+ } catch (_) {
3228
+ remove2(node);
3229
+ }
3230
+ };
3231
+ const _removeAttribute = function _removeAttribute2(name2, element) {
3232
+ try {
3233
+ arrayPush(DOMPurify.removed, {
3234
+ attribute: element.getAttributeNode(name2),
3235
+ from: element
3236
+ });
3237
+ } catch (_) {
3238
+ arrayPush(DOMPurify.removed, {
3239
+ attribute: null,
3240
+ from: element
3241
+ });
3242
+ }
3243
+ element.removeAttribute(name2);
3244
+ if (name2 === "is") {
3245
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
3246
+ try {
3247
+ _forceRemove(element);
3248
+ } catch (_) {
3249
+ }
3250
+ } else {
3251
+ try {
3252
+ element.setAttribute(name2, "");
3253
+ } catch (_) {
3254
+ }
3255
+ }
3256
+ }
3257
+ };
3258
+ const _initDocument = function _initDocument2(dirty) {
3259
+ let doc = null;
3260
+ let leadingWhitespace = null;
3261
+ if (FORCE_BODY) {
3262
+ dirty = "<remove></remove>" + dirty;
3263
+ } else {
3264
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
3265
+ leadingWhitespace = matches && matches[0];
3266
+ }
3267
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
3268
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
3269
+ }
3270
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
3271
+ if (NAMESPACE === HTML_NAMESPACE) {
3272
+ try {
3273
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
3274
+ } catch (_) {
3275
+ }
3276
+ }
3277
+ if (!doc || !doc.documentElement) {
3278
+ doc = implementation.createDocument(NAMESPACE, "template", null);
3279
+ try {
3280
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
3281
+ } catch (_) {
3282
+ }
3283
+ }
3284
+ const body = doc.body || doc.documentElement;
3285
+ if (dirty && leadingWhitespace) {
3286
+ body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
3287
+ }
3288
+ if (NAMESPACE === HTML_NAMESPACE) {
3289
+ return getElementsByTagName2.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
3290
+ }
3291
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
3292
+ };
3293
+ const _createNodeIterator = function _createNodeIterator2(root2) {
3294
+ return createNodeIterator.call(
3295
+ root2.ownerDocument || root2,
3296
+ root2,
3297
+ // eslint-disable-next-line no-bitwise
3298
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
3299
+ null
3300
+ );
3301
+ };
3302
+ const _isClobbered = function _isClobbered2(element) {
3303
+ return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
3304
+ };
3305
+ const _isNode = function _isNode2(value) {
3306
+ return typeof Node3 === "function" && value instanceof Node3;
3307
+ };
3308
+ function _executeHooks(hooks2, currentNode, data2) {
3309
+ arrayForEach(hooks2, (hook) => {
3310
+ hook.call(DOMPurify, currentNode, data2, CONFIG);
3311
+ });
3312
+ }
3313
+ const _sanitizeElements = function _sanitizeElements2(currentNode) {
3314
+ let content = null;
3315
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
3316
+ if (_isClobbered(currentNode)) {
3317
+ _forceRemove(currentNode);
3318
+ return true;
3319
+ }
3320
+ const tagName = transformCaseFunc(currentNode.nodeName);
3321
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
3322
+ tagName,
3323
+ allowedTags: ALLOWED_TAGS
3324
+ });
3325
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
3326
+ _forceRemove(currentNode);
3327
+ return true;
3328
+ }
3329
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
3330
+ _forceRemove(currentNode);
3331
+ return true;
3332
+ }
3333
+ if (currentNode.nodeType === NODE_TYPE$1.progressingInstruction) {
3334
+ _forceRemove(currentNode);
3335
+ return true;
3336
+ }
3337
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE$1.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
3338
+ _forceRemove(currentNode);
3339
+ return true;
3340
+ }
3341
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
3342
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
3343
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
3344
+ return false;
3345
+ }
3346
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
3347
+ return false;
3348
+ }
3349
+ }
3350
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
3351
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
3352
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
3353
+ if (childNodes && parentNode) {
3354
+ const childCount = childNodes.length;
3355
+ for (let i = childCount - 1; i >= 0; --i) {
3356
+ const childClone = cloneNode2(childNodes[i], true);
3357
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
3358
+ }
3359
+ }
3360
+ }
3361
+ _forceRemove(currentNode);
3362
+ return true;
3363
+ }
3364
+ if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
3365
+ _forceRemove(currentNode);
3366
+ return true;
3367
+ }
3368
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
3369
+ _forceRemove(currentNode);
3370
+ return true;
3371
+ }
3372
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE$1.text) {
3373
+ content = currentNode.textContent;
3374
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3375
+ content = stringReplace(content, expr, " ");
3376
+ });
3377
+ if (currentNode.textContent !== content) {
3378
+ arrayPush(DOMPurify.removed, {
3379
+ element: currentNode.cloneNode()
3380
+ });
3381
+ currentNode.textContent = content;
3382
+ }
3383
+ }
3384
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
3385
+ return false;
3386
+ };
3387
+ const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
3388
+ if (FORBID_ATTR[lcName]) {
3389
+ return false;
3390
+ }
3391
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
3392
+ return false;
3393
+ }
3394
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
3395
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ;
3396
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;
3397
+ else if (!nameIsPermitted || FORBID_ATTR[lcName]) {
3398
+ if (
3399
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
3400
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
3401
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
3402
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || // Alternative, second condition checks if it's an `is`-attribute, AND
3403
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
3404
+ lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
3405
+ ) ;
3406
+ else {
3407
+ return false;
3408
+ }
3409
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
3410
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
3411
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
3412
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
3413
+ else if (value) {
3414
+ return false;
3415
+ } else ;
3416
+ return true;
3417
+ };
3418
+ 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"]);
3419
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
3420
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
3421
+ };
3422
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
3423
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
3424
+ const attributes2 = currentNode.attributes;
3425
+ if (!attributes2 || _isClobbered(currentNode)) {
3426
+ return;
3427
+ }
3428
+ const hookEvent = {
3429
+ attrName: "",
3430
+ attrValue: "",
3431
+ keepAttr: true,
3432
+ allowedAttributes: ALLOWED_ATTR,
3433
+ forceKeepAttr: void 0
3434
+ };
3435
+ let l2 = attributes2.length;
3436
+ while (l2--) {
3437
+ const attr2 = attributes2[l2];
3438
+ const name2 = attr2.name, namespaceURI = attr2.namespaceURI, attrValue = attr2.value;
3439
+ const lcName = transformCaseFunc(name2);
3440
+ const initValue = attrValue;
3441
+ let value = name2 === "value" ? initValue : stringTrim(initValue);
3442
+ hookEvent.attrName = lcName;
3443
+ hookEvent.attrValue = value;
3444
+ hookEvent.keepAttr = true;
3445
+ hookEvent.forceKeepAttr = void 0;
3446
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
3447
+ value = hookEvent.attrValue;
3448
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
3449
+ _removeAttribute(name2, currentNode);
3450
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
3451
+ }
3452
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
3453
+ _removeAttribute(name2, currentNode);
3454
+ continue;
3455
+ }
3456
+ if (lcName === "attributename" && stringMatch(value, "href")) {
3457
+ _removeAttribute(name2, currentNode);
3458
+ continue;
3459
+ }
3460
+ if (hookEvent.forceKeepAttr) {
3461
+ continue;
3462
+ }
3463
+ if (!hookEvent.keepAttr) {
3464
+ _removeAttribute(name2, currentNode);
3465
+ continue;
3466
+ }
3467
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
3468
+ _removeAttribute(name2, currentNode);
3469
+ continue;
3470
+ }
3471
+ if (SAFE_FOR_TEMPLATES) {
3472
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3473
+ value = stringReplace(value, expr, " ");
3474
+ });
3475
+ }
3476
+ const lcTag = transformCaseFunc(currentNode.nodeName);
3477
+ if (!_isValidAttribute(lcTag, lcName, value)) {
3478
+ _removeAttribute(name2, currentNode);
3479
+ continue;
3480
+ }
3481
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
3482
+ if (namespaceURI) ;
3483
+ else {
3484
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
3485
+ case "TrustedHTML": {
3486
+ value = trustedTypesPolicy.createHTML(value);
3487
+ break;
3488
+ }
3489
+ case "TrustedScriptURL": {
3490
+ value = trustedTypesPolicy.createScriptURL(value);
3491
+ break;
3492
+ }
3493
+ }
3494
+ }
3495
+ }
3496
+ if (value !== initValue) {
3497
+ try {
3498
+ if (namespaceURI) {
3499
+ currentNode.setAttributeNS(namespaceURI, name2, value);
3500
+ } else {
3501
+ currentNode.setAttribute(name2, value);
3502
+ }
3503
+ if (_isClobbered(currentNode)) {
3504
+ _forceRemove(currentNode);
3505
+ } else {
3506
+ arrayPop(DOMPurify.removed);
3507
+ }
3508
+ } catch (_) {
3509
+ _removeAttribute(name2, currentNode);
3510
+ }
3511
+ }
3512
+ }
3513
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
3514
+ };
3515
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
3516
+ let shadowNode = null;
3517
+ const shadowIterator = _createNodeIterator(fragment);
3518
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
3519
+ while (shadowNode = shadowIterator.nextNode()) {
3520
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
3521
+ _sanitizeElements(shadowNode);
3522
+ _sanitizeAttributes(shadowNode);
3523
+ if (shadowNode.content instanceof DocumentFragment) {
3524
+ _sanitizeShadowDOM2(shadowNode.content);
3525
+ }
3526
+ }
3527
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
3528
+ };
3529
+ const _sanitizeAttachedShadowRoots2 = function _sanitizeAttachedShadowRoots(root2) {
3530
+ if (root2.nodeType === NODE_TYPE$1.element && root2.shadowRoot instanceof DocumentFragment) {
3531
+ const sr = root2.shadowRoot;
3532
+ _sanitizeAttachedShadowRoots2(sr);
3533
+ _sanitizeShadowDOM2(sr);
3534
+ }
3535
+ const childNodes = root2.childNodes;
3536
+ if (!childNodes) {
3537
+ return;
3538
+ }
3539
+ const snapshot = [];
3540
+ arrayForEach(childNodes, (child) => {
3541
+ arrayPush(snapshot, child);
3542
+ });
3543
+ for (const child of snapshot) {
3544
+ _sanitizeAttachedShadowRoots2(child);
3545
+ }
3546
+ };
3547
+ DOMPurify.sanitize = function(dirty) {
3548
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3549
+ let body = null;
3550
+ let importedNode = null;
3551
+ let currentNode = null;
3552
+ let returnNode = null;
3553
+ IS_EMPTY_INPUT = !dirty;
3554
+ if (IS_EMPTY_INPUT) {
3555
+ dirty = "<!-->";
3556
+ }
3557
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
3558
+ dirty = stringifyValue(dirty);
3559
+ if (typeof dirty !== "string") {
3560
+ throw typeErrorCreate("dirty is not a string, aborting");
3561
+ }
3562
+ }
3563
+ if (!DOMPurify.isSupported) {
3564
+ return dirty;
3565
+ }
3566
+ if (!SET_CONFIG) {
3567
+ _parseConfig(cfg);
3568
+ }
3569
+ DOMPurify.removed = [];
3570
+ if (typeof dirty === "string") {
3571
+ IN_PLACE = false;
3572
+ }
3573
+ if (IN_PLACE) {
3574
+ const nn = dirty.nodeName;
3575
+ if (typeof nn === "string") {
3576
+ const tagName = transformCaseFunc(nn);
3577
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
3578
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
3579
+ }
3580
+ }
3581
+ _sanitizeAttachedShadowRoots2(dirty);
3582
+ } else if (dirty instanceof Node3) {
3583
+ body = _initDocument("<!---->");
3584
+ importedNode = body.ownerDocument.importNode(dirty, true);
3585
+ if (importedNode.nodeType === NODE_TYPE$1.element && importedNode.nodeName === "BODY") {
3586
+ body = importedNode;
3587
+ } else if (importedNode.nodeName === "HTML") {
3588
+ body = importedNode;
3589
+ } else {
3590
+ body.appendChild(importedNode);
3591
+ }
3592
+ _sanitizeAttachedShadowRoots2(importedNode);
3593
+ } else {
3594
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
3595
+ dirty.indexOf("<") === -1) {
3596
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
3597
+ }
3598
+ body = _initDocument(dirty);
3599
+ if (!body) {
3600
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
3601
+ }
3602
+ }
3603
+ if (body && FORCE_BODY) {
3604
+ _forceRemove(body.firstChild);
3605
+ }
3606
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
3607
+ while (currentNode = nodeIterator.nextNode()) {
3608
+ _sanitizeElements(currentNode);
3609
+ _sanitizeAttributes(currentNode);
3610
+ if (currentNode.content instanceof DocumentFragment) {
3611
+ _sanitizeShadowDOM2(currentNode.content);
3612
+ }
3613
+ }
3614
+ if (IN_PLACE) {
3615
+ return dirty;
3616
+ }
3617
+ if (RETURN_DOM) {
3618
+ if (SAFE_FOR_TEMPLATES) {
3619
+ body.normalize();
3620
+ let html2 = body.innerHTML;
3621
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3622
+ html2 = stringReplace(html2, expr, " ");
3623
+ });
3624
+ body.innerHTML = html2;
3625
+ }
3626
+ if (RETURN_DOM_FRAGMENT) {
3627
+ returnNode = createDocumentFragment.call(body.ownerDocument);
3628
+ while (body.firstChild) {
3629
+ returnNode.appendChild(body.firstChild);
3630
+ }
3631
+ } else {
3632
+ returnNode = body;
3633
+ }
3634
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
3635
+ returnNode = importNode.call(originalDocument, returnNode, true);
3636
+ }
3637
+ return returnNode;
3638
+ }
3639
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
3640
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
3641
+ serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
3642
+ }
3643
+ if (SAFE_FOR_TEMPLATES) {
3644
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3645
+ serializedHTML = stringReplace(serializedHTML, expr, " ");
3646
+ });
3647
+ }
3648
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
3649
+ };
3650
+ DOMPurify.setConfig = function() {
3651
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3652
+ _parseConfig(cfg);
3653
+ SET_CONFIG = true;
3654
+ };
3655
+ DOMPurify.clearConfig = function() {
3656
+ CONFIG = null;
3657
+ SET_CONFIG = false;
3658
+ };
3659
+ DOMPurify.isValidAttribute = function(tag, attr2, value) {
3660
+ if (!CONFIG) {
3661
+ _parseConfig({});
3662
+ }
3663
+ const lcTag = transformCaseFunc(tag);
3664
+ const lcName = transformCaseFunc(attr2);
3665
+ return _isValidAttribute(lcTag, lcName, value);
3666
+ };
3667
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
3668
+ if (typeof hookFunction !== "function") {
3669
+ return;
3670
+ }
3671
+ arrayPush(hooks[entryPoint], hookFunction);
3672
+ };
3673
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
3674
+ if (hookFunction !== void 0) {
3675
+ const index2 = arrayLastIndexOf(hooks[entryPoint], hookFunction);
3676
+ return index2 === -1 ? void 0 : arraySplice(hooks[entryPoint], index2, 1)[0];
3677
+ }
3678
+ return arrayPop(hooks[entryPoint]);
3679
+ };
3680
+ DOMPurify.removeHooks = function(entryPoint) {
3681
+ hooks[entryPoint] = [];
3682
+ };
3683
+ DOMPurify.removeAllHooks = function() {
3684
+ hooks = _createHooksMap();
3685
+ };
3686
+ return DOMPurify;
3687
+ }
3688
+ var purify = createDOMPurify();
2459
3689
  ABConvert.factory({
2460
3690
  id: "md",
2461
3691
  name: "md",
@@ -2475,7 +3705,7 @@ ABConvert.factory({
2475
3705
  process_param: ABConvert_IOEnum.text,
2476
3706
  process_return: ABConvert_IOEnum.el,
2477
3707
  process: (el, header, content) => {
2478
- el.innerHTML = `<p>${content.replace(/ /g, "&nbsp;").split("\n").join("<br/>")}</p>`;
3708
+ el.innerHTML = purify.sanitize(`<p>${content.replace(/ /g, "&nbsp;").split("\n").join("<br/>")}</p>`);
2479
3709
  return el;
2480
3710
  }
2481
3711
  });
@@ -3195,12 +4425,10 @@ ABConvert.factory({
3195
4425
  process_return: ABConvert_IOEnum.json,
3196
4426
  process: (el, header, content) => {
3197
4427
  return JSON.stringify(
3198
- ABAlias_json.map((item) => {
3199
- return {
3200
- regex: item.regex.toString(),
3201
- replacement: item.replacement
3202
- };
3203
- }),
4428
+ Array.from(get_ABAlias_iter(), (item) => ({
4429
+ regex: item.regex.toString(),
4430
+ replacement: item.replacement
4431
+ })),
3204
4432
  null,
3205
4433
  2
3206
4434
  );
@@ -15151,7 +16379,7 @@ ABConvert.factory({
15151
16379
  async function render_pumlText(text2, div) {
15152
16380
  var encoded = plantumlEncoder.encode(text2);
15153
16381
  let url = "http://www.plantuml.com/plantuml/img/" + encoded;
15154
- div.innerHTML = `<img src="${url}">`;
16382
+ div.innerHTML = purify.sanitize(`<img src="${url}">`);
15155
16383
  return div;
15156
16384
  }
15157
16385
  function getID(length = 16) {
@@ -15326,206 +16554,20 @@ async function data2mindmap(list_itemInfo, div) {
15326
16554
  return render_mermaidText(mermaidText, div);
15327
16555
  }
15328
16556
  async function render_mermaidText(mermaidText, div) {
15329
- if (ABCSetting.env.startsWith("obsidian") && ABCSetting.mermaid) {
15330
- ABCSetting.mermaid.then(async (mermaid) => {
15331
- const { svg } = await mermaid.render("ab-mermaid-" + getID(), mermaidText);
15332
- div.innerHTML = svg;
16557
+ if (ABCSetting.env.startsWith("obsidian") && ABCSetting.obsidian.mermaid) {
16558
+ ABCSetting.obsidian.mermaid.then(async (mermaid) => {
16559
+ const { svg: svg2 } = await mermaid.render("ab-mermaid-" + getID(), mermaidText);
16560
+ const div_mermaid = document.createElement("div");
16561
+ div.appendChild(div_mermaid);
16562
+ div_mermaid.classList.add("mermaid");
16563
+ div_mermaid.innerHTML = svg2;
15333
16564
  });
15334
16565
  } else {
15335
16566
  div.classList.add("ab-raw");
15336
- div.innerHTML = `<div class="ab-raw-data" type-data="mermaid" content-data='${mermaidText}'></div>`;
16567
+ div.innerHTML = purify.sanitize(`<div class="ab-raw-data" type-data="mermaid" content-data='${mermaidText}'></div>`);
15337
16568
  }
15338
16569
  return div;
15339
16570
  }
15340
- function abConvertEvent(d, isCycle = false) {
15341
- if (d.querySelector(".ab-super-width")) {
15342
- const els_note = d.querySelectorAll(".ab-note");
15343
- for (const el_note of els_note) {
15344
- if (el_note.querySelector(".ab-super-width")) {
15345
- const el_replace = el_note.parentNode;
15346
- if (el_replace && el_replace.classList.contains("ab-replace")) {
15347
- el_replace.classList.add("ab-super-width-p");
15348
- }
15349
- }
15350
- }
15351
- const els_view = document.querySelectorAll(".app-container .workspace-leaf");
15352
- for (const el_view of els_view) {
15353
- el_view.style.setProperty("--ab-width-outer", (el_view.offsetWidth - 40).toString() + "px");
15354
- }
15355
- }
15356
- if (d.querySelector(".ab-nodes-node")) {
15357
- const els_min = document.querySelectorAll(".ab-nodes.min .ab-nodes-node");
15358
- const list_children = d.querySelectorAll(".ab-nodes-node");
15359
- for (const children2 of list_children) {
15360
- const el_content = children2.querySelector(".ab-nodes-content");
15361
- if (!el_content) continue;
15362
- const el_child = children2.querySelector(".ab-nodes-children");
15363
- if (!el_child) continue;
15364
- const el_bracket = el_child.querySelector(".ab-nodes-bracket");
15365
- if (!el_bracket) continue;
15366
- const el_bracket2 = el_child.querySelector(".ab-nodes-bracket2");
15367
- if (!el_bracket2) continue;
15368
- const els_child = el_child.childNodes;
15369
- if (els_child.length < 3) {
15370
- el_bracket.style.setProperty("display", "none");
15371
- el_bracket2.style.setProperty("display", "none");
15372
- continue;
15373
- }
15374
- const el_child_first = els_child[2];
15375
- const el_child_last = els_child[els_child.length - 1];
15376
- const el_child_first_content = el_child_first.querySelector(".ab-nodes-content");
15377
- const el_child_last_content = el_child_last.querySelector(".ab-nodes-content");
15378
- let height = 0;
15379
- let heightToReduce = (el_child_first.offsetHeight + el_child_last.offsetHeight) / 2;
15380
- if (els_child.length == 3) {
15381
- height = el_child_first_content.offsetHeight - 20 > 20 ? el_child_first_content.offsetHeight - 20 : 20;
15382
- el_bracket2.style.cssText = `
15383
- height: ${height}px;
15384
- top: calc(50% - ${height / 2}px);
15385
- `;
15386
- } else {
15387
- el_bracket2.style.cssText = `
15388
- height: calc(100% - ${heightToReduce}px);
15389
- top: ${el_child_first.offsetHeight / 2}px;
15390
- `;
15391
- }
15392
- if (Array.prototype.includes.call(els_min, children2)) {
15393
- if (els_child.length == 3) {
15394
- el_bracket.style.cssText = `
15395
- display: block;
15396
- top: calc(50% + ${el_content.offsetHeight / 2}px - 3px);
15397
- clip-path: circle(40% at 50% 40%);
15398
- `;
15399
- } else {
15400
- el_bracket.setAttribute("display", "none");
15401
- }
15402
- if (els_child.length == 3 && el_content.offsetHeight == el_child_first_content.offsetHeight) {
15403
- el_bracket2.style.cssText = `
15404
- height: 1px;
15405
- top: calc(50% + ${el_content.offsetHeight / 2}px - 1px);
15406
- width: 18px; /* 可以溢出点 */
15407
- border-radius: 0;
15408
- border: none;
15409
- border-bottom: 1px solid var(--node-color);
15410
- `;
15411
- } else {
15412
- if (els_child.length == 3) {
15413
- height = el_child_last_content.offsetHeight / 2 - el_content.offsetHeight / 2;
15414
- el_bracket2.style.setProperty("height", `${height}px`);
15415
- el_bracket2.style.setProperty("top", `calc(50% + ${el_content.offsetHeight / 2}px)`);
15416
- el_bracket2.style.setProperty("border-radius", `0 0 0 10px`);
15417
- el_bracket2.style.setProperty("border-top", `0`);
15418
- } else {
15419
- heightToReduce = el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 + el_child_last.offsetHeight / 2 - el_child_last_content.offsetHeight / 2;
15420
- el_bracket2.style.setProperty("height", `calc(100% - ${heightToReduce}px + 1px)`);
15421
- el_bracket2.style.setProperty("top", `${el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 - 1}px`);
15422
- }
15423
- el_bracket2.style.setProperty("width", "20px");
15424
- }
15425
- }
15426
- }
15427
- }
15428
- if (d.querySelector(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)")) {
15429
- const root_el_list = d.querySelectorAll(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)");
15430
- for (const root_el of root_el_list) {
15431
- root_el.classList.add("js-waterfall");
15432
- const list_children = root_el.querySelectorAll(".ab-items-item");
15433
- const columnCountTmp = parseInt(window.getComputedStyle(root_el).getPropertyValue("column-count"));
15434
- let columnCount;
15435
- if (columnCountTmp && !isNaN(columnCountTmp) && columnCountTmp > 0) {
15436
- columnCount = columnCountTmp;
15437
- } else if (root_el.classList.contains("ab-col-auto") && list_children.length <= 4) {
15438
- columnCount = list_children.length;
15439
- root_el.classList.add("ab-col" + columnCount);
15440
- } else {
15441
- columnCount = 4;
15442
- root_el.classList.add("ab-col" + columnCount);
15443
- }
15444
- const height_cache = [];
15445
- const el_cache = [];
15446
- for (let i = 0; i < columnCount; i++) {
15447
- height_cache.push(0);
15448
- el_cache.push([]);
15449
- }
15450
- for (const children2 of list_children) {
15451
- const minValue = Math.min.apply(null, height_cache);
15452
- const minIndex = height_cache.indexOf(minValue);
15453
- const heightTmp = parseInt(window.getComputedStyle(children2).getPropertyValue("height"));
15454
- height_cache[minIndex] += heightTmp && !isNaN(heightTmp) && heightTmp > 0 ? heightTmp : 10;
15455
- el_cache[minIndex].push(children2);
15456
- }
15457
- const fillNumber = columnCount - list_children.length % columnCount;
15458
- if (fillNumber != 4) {
15459
- for (let i = 0; i < fillNumber; i++) {
15460
- const children2 = document.createElement("div");
15461
- children2.classList.add(".ab-items-item.placeholder");
15462
- children2.setAttribute("style", "height: 20px");
15463
- const minValue = Math.min.apply(null, height_cache);
15464
- const minIndex = height_cache.indexOf(minValue);
15465
- height_cache[minIndex] += 20;
15466
- el_cache[minIndex].push(children2);
15467
- }
15468
- }
15469
- root_el.innerHTML = "";
15470
- for (let i = 0; i < columnCount; i++) {
15471
- for (const j of el_cache[i]) {
15472
- root_el.appendChild(j);
15473
- }
15474
- }
15475
- }
15476
- }
15477
- if (!isCycle && d.querySelector(".ab-markmap-div")) {
15478
- const divEl = d;
15479
- let markmapId = "";
15480
- if (divEl.tagName === "DIV") {
15481
- markmapId = divEl.querySelector(".ab-markmap-div")?.id || "";
15482
- }
15483
- let mindmaps;
15484
- if (markmapId) {
15485
- mindmaps = document.querySelectorAll("#" + markmapId);
15486
- } else {
15487
- mindmaps = document.querySelectorAll(".ab-markmap-div");
15488
- }
15489
- for (const el_div of mindmaps) {
15490
- const el_svg = el_div.querySelector("svg");
15491
- const el_g = el_svg?.querySelector("g");
15492
- if (el_svg && el_g) {
15493
- const scale_new = el_g.getBBox().height / el_div.offsetWidth;
15494
- el_svg.setAttribute("style", `height:${el_g.getBBox().height * scale_new + 40}px`);
15495
- markmap_event(d);
15496
- }
15497
- }
15498
- }
15499
- }
15500
- function markmap_event(d) {
15501
- if (d.querySelector(".ab-markmap-svg")) {
15502
- console.log(" - markmap_event");
15503
- let script_el = document.querySelector('script[script-id="ab-markmap-script"]');
15504
- if (script_el) script_el.remove();
15505
- const divEl = d;
15506
- let markmapId = "";
15507
- if (divEl.tagName === "DIV") {
15508
- markmapId = divEl.querySelector(".ab-markmap-svg")?.id || "";
15509
- }
15510
- script_el = document.createElement("script");
15511
- document.head.appendChild(script_el);
15512
- script_el.type = "module";
15513
- script_el.setAttribute("script-id", "ab-markmap-script");
15514
- script_el.textContent = `
15515
- import { Markmap, } from 'https://jspm.dev/markmap-view';
15516
- const markmapId = "${markmapId || ""}";
15517
- let mindmaps;
15518
- if (markmapId) {
15519
- mindmaps = document.querySelectorAll('#' + markmapId);
15520
- } else {
15521
- mindmaps = document.querySelectorAll('.ab-markmap-svg'); // 注意一下这里的选择器
15522
- }
15523
- for(const mindmap of mindmaps) {
15524
- mindmap.innerHTML = "";
15525
- Markmap.create(mindmap,null,JSON.parse(mindmap.getAttribute('data-json')));
15526
- }`;
15527
- }
15528
- }
15529
16571
  const testPath = "npm2url/dist/index.cjs";
15530
16572
  const defaultProviders = {
15531
16573
  jsdelivr: (path) => `https://cdn.jsdelivr.net/npm/${path}`,
@@ -41151,8 +42193,8 @@ function requireKatex() {
41151
42193
  var _functions = {};
41152
42194
  var _htmlGroupBuilders = {};
41153
42195
  var _mathmlGroupBuilders = {};
41154
- function defineFunction(_ref) {
41155
- var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder;
42196
+ function defineFunction(_ref2) {
42197
+ var type = _ref2.type, names = _ref2.names, props = _ref2.props, handler = _ref2.handler, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder;
41156
42198
  var data2 = {
41157
42199
  type,
41158
42200
  numArgs: props.numArgs,
@@ -42150,8 +43192,8 @@ function requireKatex() {
42150
43192
  props: {
42151
43193
  numArgs: 1
42152
43194
  },
42153
- handler: function handler(_ref, args) {
42154
- var parser = _ref.parser, funcName = _ref.funcName;
43195
+ handler: function handler(_ref2, args) {
43196
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42155
43197
  var base = args[0];
42156
43198
  return {
42157
43199
  type: "accentUnder",
@@ -42226,8 +43268,8 @@ function requireKatex() {
42226
43268
  numArgs: 1,
42227
43269
  numOptionalArgs: 1
42228
43270
  },
42229
- handler: function handler(_ref, args, optArgs) {
42230
- var parser = _ref.parser, funcName = _ref.funcName;
43271
+ handler: function handler(_ref2, args, optArgs) {
43272
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42231
43273
  return {
42232
43274
  type: "xArrow",
42233
43275
  mode: parser.mode,
@@ -42319,8 +43361,8 @@ function requireKatex() {
42319
43361
  numArgs: 1,
42320
43362
  allowedInText: true
42321
43363
  },
42322
- handler: function handler(_ref, args) {
42323
- var parser = _ref.parser;
43364
+ handler: function handler(_ref2, args) {
43365
+ var parser = _ref2.parser;
42324
43366
  var arg = assertNodeType(args[0], "ordgroup");
42325
43367
  var group = arg.body;
42326
43368
  var number = "";
@@ -42358,8 +43400,8 @@ function requireKatex() {
42358
43400
  greediness: 3,
42359
43401
  argTypes: ["color", "original"]
42360
43402
  },
42361
- handler: function handler(_ref, args) {
42362
- var parser = _ref.parser;
43403
+ handler: function handler(_ref2, args) {
43404
+ var parser = _ref2.parser;
42363
43405
  var color2 = assertNodeType(args[0], "color-token").color;
42364
43406
  var body = args[1];
42365
43407
  return {
@@ -42405,8 +43447,8 @@ function requireKatex() {
42405
43447
  argTypes: ["size"],
42406
43448
  allowedInText: true
42407
43449
  },
42408
- handler: function handler(_ref, args, optArgs) {
42409
- var parser = _ref.parser, funcName = _ref.funcName;
43450
+ handler: function handler(_ref2, args, optArgs) {
43451
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42410
43452
  var size = optArgs[0];
42411
43453
  var newRow = funcName === "\\cr";
42412
43454
  var newLine = false;
@@ -42499,8 +43541,8 @@ function requireKatex() {
42499
43541
  numArgs: 0,
42500
43542
  allowedInText: true
42501
43543
  },
42502
- handler: function handler(_ref) {
42503
- var parser = _ref.parser, funcName = _ref.funcName;
43544
+ handler: function handler(_ref2) {
43545
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42504
43546
  parser.consumeSpaces();
42505
43547
  var token = parser.fetch();
42506
43548
  if (globalMap[token.text]) {
@@ -42834,14 +43876,14 @@ function requireKatex() {
42834
43876
  var delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) {
42835
43877
  var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight);
42836
43878
  var pathNode = new domTree_PathNode(sqrtName, path);
42837
- var svg = new SvgNode([pathNode], {
43879
+ var svg2 = new SvgNode([pathNode], {
42838
43880
  // Note: 1000:1 ratio of viewBox to document em width.
42839
43881
  "width": "400em",
42840
43882
  "height": height + "em",
42841
43883
  "viewBox": "0 0 400000 " + viewBoxHeight,
42842
43884
  "preserveAspectRatio": "xMinYMin slice"
42843
43885
  });
42844
- return buildCommon.makeSvgSpan(["hide-tail"], [svg], options);
43886
+ return buildCommon.makeSvgSpan(["hide-tail"], [svg2], options);
42845
43887
  };
42846
43888
  var makeSqrtImage = function makeSqrtImage2(height, options) {
42847
43889
  var newOptions = options.havingBaseSizing();
@@ -43451,8 +44493,8 @@ function requireKatex() {
43451
44493
  greediness: 3,
43452
44494
  argTypes: ["color", "text"]
43453
44495
  },
43454
- handler: function handler(_ref, args, optArgs) {
43455
- var parser = _ref.parser, funcName = _ref.funcName;
44496
+ handler: function handler(_ref2, args, optArgs) {
44497
+ var parser = _ref2.parser, funcName = _ref2.funcName;
43456
44498
  var color2 = assertNodeType(args[0], "color-token").color;
43457
44499
  var body = args[1];
43458
44500
  return {
@@ -43530,8 +44572,8 @@ function requireKatex() {
43530
44572
  mathmlBuilder: enclose_mathmlBuilder
43531
44573
  });
43532
44574
  var _environments = {};
43533
- function defineEnvironment(_ref) {
43534
- var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder;
44575
+ function defineEnvironment(_ref2) {
44576
+ var type = _ref2.type, names = _ref2.names, props = _ref2.props, handler = _ref2.handler, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder;
43535
44577
  var data2 = {
43536
44578
  type,
43537
44579
  numArgs: props.numArgs || 0,
@@ -43562,8 +44604,8 @@ function requireKatex() {
43562
44604
  }
43563
44605
  return hlineInfo;
43564
44606
  }
43565
- function parseArray(parser, _ref, style) {
43566
- var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, addJot = _ref.addJot, cols = _ref.cols, arraystretch = _ref.arraystretch, colSeparationType = _ref.colSeparationType;
44607
+ function parseArray(parser, _ref2, style) {
44608
+ var hskipBeforeAndAfter = _ref2.hskipBeforeAndAfter, addJot = _ref2.addJot, cols = _ref2.cols, arraystretch = _ref2.arraystretch, colSeparationType = _ref2.colSeparationType;
43567
44609
  parser.gullet.beginGroup();
43568
44610
  parser.gullet.macros.set("\\\\", "\\cr");
43569
44611
  if (!arraystretch) {
@@ -44202,8 +45244,8 @@ function requireKatex() {
44202
45244
  numArgs: 1,
44203
45245
  argTypes: ["text"]
44204
45246
  },
44205
- handler: function handler(_ref, args) {
44206
- var parser = _ref.parser, funcName = _ref.funcName;
45247
+ handler: function handler(_ref2, args) {
45248
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44207
45249
  var nameGroup = args[0];
44208
45250
  if (nameGroup.type !== "ordgroup") {
44209
45251
  throw new src_ParseError("Invalid environment name", nameGroup);
@@ -44283,8 +45325,8 @@ function requireKatex() {
44283
45325
  props: {
44284
45326
  numArgs: 1
44285
45327
  },
44286
- handler: function handler(_ref, args) {
44287
- var parser = _ref.parser, funcName = _ref.funcName;
45328
+ handler: function handler(_ref2, args) {
45329
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44288
45330
  var body = args[0];
44289
45331
  return {
44290
45332
  type: "mclass",
@@ -44407,8 +45449,8 @@ function requireKatex() {
44407
45449
  numArgs: 1,
44408
45450
  greediness: 2
44409
45451
  },
44410
- handler: function handler(_ref, args) {
44411
- var parser = _ref.parser, funcName = _ref.funcName;
45452
+ handler: function handler(_ref2, args) {
45453
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44412
45454
  var body = args[0];
44413
45455
  var func = funcName;
44414
45456
  if (func in fontAliases) {
@@ -44662,8 +45704,8 @@ function requireKatex() {
44662
45704
  numArgs: 2,
44663
45705
  greediness: 2
44664
45706
  },
44665
- handler: function handler(_ref, args) {
44666
- var parser = _ref.parser, funcName = _ref.funcName;
45707
+ handler: function handler(_ref2, args) {
45708
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44667
45709
  var numer = args[0];
44668
45710
  var denom = args[1];
44669
45711
  var hasBarLine;
@@ -44964,8 +46006,8 @@ function requireKatex() {
44964
46006
  props: {
44965
46007
  numArgs: 1
44966
46008
  },
44967
- handler: function handler(_ref, args) {
44968
- var parser = _ref.parser, funcName = _ref.funcName;
46009
+ handler: function handler(_ref2, args) {
46010
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44969
46011
  return {
44970
46012
  type: "horizBrace",
44971
46013
  mode: parser.mode,
@@ -44985,8 +46027,8 @@ function requireKatex() {
44985
46027
  argTypes: ["url", "original"],
44986
46028
  allowedInText: true
44987
46029
  },
44988
- handler: function handler(_ref, args) {
44989
- var parser = _ref.parser;
46030
+ handler: function handler(_ref2, args) {
46031
+ var parser = _ref2.parser;
44990
46032
  var body = args[1];
44991
46033
  var href = assertNodeType(args[0], "url").url;
44992
46034
  if (!parser.settings.isTrusted({
@@ -45066,9 +46108,9 @@ function requireKatex() {
45066
46108
  argTypes: ["raw", "original"],
45067
46109
  allowedInText: true
45068
46110
  },
45069
- handler: function handler(_ref, args) {
45070
- var parser = _ref.parser, funcName = _ref.funcName;
45071
- _ref.token;
46111
+ handler: function handler(_ref2, args) {
46112
+ var parser = _ref2.parser, funcName = _ref2.funcName;
46113
+ _ref2.token;
45072
46114
  var value = assertNodeType(args[0], "raw").string;
45073
46115
  var body = args[1];
45074
46116
  if (parser.settings.strict) {
@@ -45151,8 +46193,8 @@ function requireKatex() {
45151
46193
  numArgs: 2,
45152
46194
  allowedInText: true
45153
46195
  },
45154
- handler: function handler(_ref, args) {
45155
- var parser = _ref.parser;
46196
+ handler: function handler(_ref2, args) {
46197
+ var parser = _ref2.parser;
45156
46198
  return {
45157
46199
  type: "htmlmathml",
45158
46200
  mode: parser.mode,
@@ -45199,8 +46241,8 @@ function requireKatex() {
45199
46241
  argTypes: ["raw", "url"],
45200
46242
  allowedInText: false
45201
46243
  },
45202
- handler: function handler(_ref, args, optArgs) {
45203
- var parser = _ref.parser;
46244
+ handler: function handler(_ref2, args, optArgs) {
46245
+ var parser = _ref2.parser;
45204
46246
  var width = {
45205
46247
  number: 0,
45206
46248
  unit: "em"
@@ -45314,8 +46356,8 @@ function requireKatex() {
45314
46356
  argTypes: ["size"],
45315
46357
  allowedInText: true
45316
46358
  },
45317
- handler: function handler(_ref, args) {
45318
- var parser = _ref.parser, funcName = _ref.funcName;
46359
+ handler: function handler(_ref2, args) {
46360
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45319
46361
  var size = assertNodeType(args[0], "size");
45320
46362
  if (parser.settings.strict) {
45321
46363
  var mathFunction = funcName[1] === "m";
@@ -45354,8 +46396,8 @@ function requireKatex() {
45354
46396
  numArgs: 1,
45355
46397
  allowedInText: true
45356
46398
  },
45357
- handler: function handler(_ref, args) {
45358
- var parser = _ref.parser, funcName = _ref.funcName;
46399
+ handler: function handler(_ref2, args) {
46400
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45359
46401
  var body = args[0];
45360
46402
  return {
45361
46403
  type: "lap",
@@ -45399,8 +46441,8 @@ function requireKatex() {
45399
46441
  allowedInText: true,
45400
46442
  allowedInMath: false
45401
46443
  },
45402
- handler: function handler(_ref, args) {
45403
- var funcName = _ref.funcName, parser = _ref.parser;
46444
+ handler: function handler(_ref2, args) {
46445
+ var funcName = _ref2.funcName, parser = _ref2.parser;
45404
46446
  var outerMode = parser.mode;
45405
46447
  parser.switchMode("math");
45406
46448
  var close = funcName === "\\(" ? "\\)" : "$";
@@ -45448,8 +46490,8 @@ function requireKatex() {
45448
46490
  props: {
45449
46491
  numArgs: 4
45450
46492
  },
45451
- handler: function handler(_ref, args) {
45452
- var parser = _ref.parser;
46493
+ handler: function handler(_ref2, args) {
46494
+ var parser = _ref2.parser;
45453
46495
  return {
45454
46496
  type: "mathchoice",
45455
46497
  mode: parser.mode,
@@ -45681,8 +46723,8 @@ function requireKatex() {
45681
46723
  props: {
45682
46724
  numArgs: 0
45683
46725
  },
45684
- handler: function handler(_ref, args) {
45685
- var parser = _ref.parser, funcName = _ref.funcName;
46726
+ handler: function handler(_ref2, args) {
46727
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45686
46728
  var fName = funcName;
45687
46729
  if (fName.length === 1) {
45688
46730
  fName = singleCharBigOps[fName];
@@ -45888,8 +46930,8 @@ function requireKatex() {
45888
46930
  props: {
45889
46931
  numArgs: 1
45890
46932
  },
45891
- handler: function handler(_ref, args) {
45892
- var parser = _ref.parser, funcName = _ref.funcName;
46933
+ handler: function handler(_ref2, args) {
46934
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45893
46935
  var body = args[0];
45894
46936
  return {
45895
46937
  type: "operatorname",
@@ -45921,8 +46963,8 @@ function requireKatex() {
45921
46963
  props: {
45922
46964
  numArgs: 1
45923
46965
  },
45924
- handler: function handler(_ref, args) {
45925
- var parser = _ref.parser;
46966
+ handler: function handler(_ref2, args) {
46967
+ var parser = _ref2.parser;
45926
46968
  var body = args[0];
45927
46969
  return {
45928
46970
  type: "overline",
@@ -45967,8 +47009,8 @@ function requireKatex() {
45967
47009
  numArgs: 1,
45968
47010
  allowedInText: true
45969
47011
  },
45970
- handler: function handler(_ref, args) {
45971
- var parser = _ref.parser;
47012
+ handler: function handler(_ref2, args) {
47013
+ var parser = _ref2.parser;
45972
47014
  var body = args[0];
45973
47015
  return {
45974
47016
  type: "phantom",
@@ -46066,8 +47108,8 @@ function requireKatex() {
46066
47108
  argTypes: ["size", "hbox"],
46067
47109
  allowedInText: true
46068
47110
  },
46069
- handler: function handler(_ref, args) {
46070
- var parser = _ref.parser;
47111
+ handler: function handler(_ref2, args) {
47112
+ var parser = _ref2.parser;
46071
47113
  var amount = assertNodeType(args[0], "size").value;
46072
47114
  var body = args[1];
46073
47115
  return {
@@ -46104,8 +47146,8 @@ function requireKatex() {
46104
47146
  numOptionalArgs: 1,
46105
47147
  argTypes: ["size", "size", "size"]
46106
47148
  },
46107
- handler: function handler(_ref, args, optArgs) {
46108
- var parser = _ref.parser;
47149
+ handler: function handler(_ref2, args, optArgs) {
47150
+ var parser = _ref2.parser;
46109
47151
  var shift = optArgs[0];
46110
47152
  var width = assertNodeType(args[0], "size");
46111
47153
  var height = assertNodeType(args[1], "size");
@@ -46178,8 +47220,8 @@ function requireKatex() {
46178
47220
  numArgs: 0,
46179
47221
  allowedInText: true
46180
47222
  },
46181
- handler: function handler(_ref, args) {
46182
- var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser;
47223
+ handler: function handler(_ref2, args) {
47224
+ var breakOnTokenText = _ref2.breakOnTokenText, funcName = _ref2.funcName, parser = _ref2.parser;
46183
47225
  var body = parser.parseExpression(false, breakOnTokenText);
46184
47226
  return {
46185
47227
  type: "sizing",
@@ -46206,8 +47248,8 @@ function requireKatex() {
46206
47248
  numOptionalArgs: 1,
46207
47249
  allowedInText: true
46208
47250
  },
46209
- handler: function handler(_ref, args, optArgs) {
46210
- var parser = _ref.parser;
47251
+ handler: function handler(_ref2, args, optArgs) {
47252
+ var parser = _ref2.parser;
46211
47253
  var smashHeight = false;
46212
47254
  var smashDepth = false;
46213
47255
  var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
@@ -46287,8 +47329,8 @@ function requireKatex() {
46287
47329
  numArgs: 1,
46288
47330
  numOptionalArgs: 1
46289
47331
  },
46290
- handler: function handler(_ref, args, optArgs) {
46291
- var parser = _ref.parser;
47332
+ handler: function handler(_ref2, args, optArgs) {
47333
+ var parser = _ref2.parser;
46292
47334
  var index2 = optArgs[0];
46293
47335
  var body = args[0];
46294
47336
  return {
@@ -46372,8 +47414,8 @@ function requireKatex() {
46372
47414
  numArgs: 0,
46373
47415
  allowedInText: true
46374
47416
  },
46375
- handler: function handler(_ref, args) {
46376
- var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser;
47417
+ handler: function handler(_ref2, args) {
47418
+ var breakOnTokenText = _ref2.breakOnTokenText, funcName = _ref2.funcName, parser = _ref2.parser;
46377
47419
  var body = parser.parseExpression(true, breakOnTokenText);
46378
47420
  var style = funcName.slice(1, funcName.length - 5);
46379
47421
  return {
@@ -46758,8 +47800,8 @@ function requireKatex() {
46758
47800
  greediness: 2,
46759
47801
  allowedInText: true
46760
47802
  },
46761
- handler: function handler(_ref, args) {
46762
- var parser = _ref.parser, funcName = _ref.funcName;
47803
+ handler: function handler(_ref2, args) {
47804
+ var parser = _ref2.parser, funcName = _ref2.funcName;
46763
47805
  var body = args[0];
46764
47806
  return {
46765
47807
  type: "text",
@@ -46785,8 +47827,8 @@ function requireKatex() {
46785
47827
  numArgs: 1,
46786
47828
  allowedInText: true
46787
47829
  },
46788
- handler: function handler(_ref, args) {
46789
- var parser = _ref.parser;
47830
+ handler: function handler(_ref2, args) {
47831
+ var parser = _ref2.parser;
46790
47832
  return {
46791
47833
  type: "underline",
46792
47834
  mode: parser.mode,
@@ -49656,7 +50698,7 @@ ABConvert.factory({
49656
50698
  process_return: ABConvert_IOEnum.el,
49657
50699
  process: (el, header, content) => {
49658
50700
  list2markmap(content, el);
49659
- markmap_event(el);
50701
+ ABCSetting.obsidian.markmap_event?.(el);
49660
50702
  return el;
49661
50703
  }
49662
50704
  });
@@ -49672,13 +50714,46 @@ function list2markmap(markdown, div) {
49672
50714
  svg_div.classList.add("ab-markmap-div");
49673
50715
  svg_div.id = "ab-markmap-div-" + id;
49674
50716
  const html_str = `<svg class="ab-markmap-svg" id="ab-markmap-${id}" data-json='${JSON.stringify(root2)}' style="height:${height_adapt}px"></svg>`;
49675
- svg_div.innerHTML = html_str;
50717
+ svg_div.innerHTML = purify.sanitize(html_str, {
50718
+ USE_PROFILES: { svg: true }
50719
+ });
49676
50720
  } else {
49677
50721
  div.classList.add("ab-raw");
49678
- div.innerHTML = `<div class="ab-raw-data" type-data="markmap" content-data='${markdown}'></div>`;
50722
+ div.innerHTML = purify.sanitize(`<div class="ab-raw-data" type-data="markmap" content-data='${markdown}'></div>`);
49679
50723
  }
49680
50724
  return div;
49681
50725
  }
50726
+ async function markmap_event(d) {
50727
+ if (ABCSetting.env == "obsidian-min") return;
50728
+ if (d.querySelector(".ab-markmap-svg")) {
50729
+ console.log(" - markmap_event");
50730
+ let script_el = document.querySelector('script[script-id="ab-markmap-script"]');
50731
+ if (script_el) script_el.remove();
50732
+ const divEl = d;
50733
+ let markmapId = "";
50734
+ if (divEl.tagName === "DIV") {
50735
+ markmapId = divEl.querySelector(".ab-markmap-svg")?.id || "";
50736
+ }
50737
+ script_el = document.createElement("script");
50738
+ document.head.appendChild(script_el);
50739
+ script_el.type = "module";
50740
+ script_el.setAttribute("script-id", "ab-markmap-script");
50741
+ script_el.textContent = `
50742
+ import { Markmap, } from 'https://jspm.dev/markmap-view';
50743
+ const markmapId = "${markmapId || ""}";
50744
+ let mindmaps;
50745
+ if (markmapId) {
50746
+ mindmaps = document.querySelectorAll('#' + markmapId);
50747
+ } else {
50748
+ mindmaps = document.querySelectorAll('.ab-markmap-svg'); // 注意一下这里的选择器
50749
+ }
50750
+ for(const mindmap of mindmaps) {
50751
+ mindmap.innerHTML = "";
50752
+ Markmap.create(mindmap,null,JSON.parse(mindmap.getAttribute('data-json')));
50753
+ }`;
50754
+ }
50755
+ }
50756
+ ABCSetting.obsidian.markmap_event = markmap_event;
49682
50757
  const md = new MarkdownIt({
49683
50758
  html: true,
49684
50759
  // 启用 HTML 标签解析
@@ -49735,6 +50810,166 @@ const quartz_transformer_anyblock = () => {
49735
50810
  }
49736
50811
  };
49737
50812
  };
50813
+ function abConvertEvent(d, isCycle = false) {
50814
+ if (d.querySelector(".ab-super-width")) {
50815
+ const els_note = d.querySelectorAll(".ab-note");
50816
+ for (const el_note of els_note) {
50817
+ if (el_note.classList.contains("ab-super-width") || el_note.querySelector(".ab-super-width")) {
50818
+ const el_replace = el_note.parentNode;
50819
+ if (el_replace && el_replace.classList.contains("ab-replace")) {
50820
+ el_replace.classList.add("ab-super-width-p");
50821
+ }
50822
+ }
50823
+ }
50824
+ const els_view = document.querySelectorAll(".app-container .workspace-leaf");
50825
+ for (const el_view of els_view) {
50826
+ el_view.style.setProperty("--ab-width-outer", (el_view.offsetWidth - 40).toString() + "px");
50827
+ }
50828
+ }
50829
+ if (d.querySelector(".ab-nodes-node")) {
50830
+ const els_min = document.querySelectorAll(".ab-nodes.min .ab-nodes-node");
50831
+ const list_children = d.querySelectorAll(".ab-nodes-node");
50832
+ for (const children2 of list_children) {
50833
+ const el_content = children2.querySelector(".ab-nodes-content");
50834
+ if (!el_content) continue;
50835
+ const el_child = children2.querySelector(".ab-nodes-children");
50836
+ if (!el_child) continue;
50837
+ const el_bracket = el_child.querySelector(".ab-nodes-bracket");
50838
+ if (!el_bracket) continue;
50839
+ const el_bracket2 = el_child.querySelector(".ab-nodes-bracket2");
50840
+ if (!el_bracket2) continue;
50841
+ const els_child = el_child.childNodes;
50842
+ if (els_child.length < 3) {
50843
+ el_bracket.style.setProperty("display", "none");
50844
+ el_bracket2.style.setProperty("display", "none");
50845
+ continue;
50846
+ }
50847
+ const el_child_first = els_child[2];
50848
+ const el_child_last = els_child[els_child.length - 1];
50849
+ const el_child_first_content = el_child_first.querySelector(".ab-nodes-content");
50850
+ const el_child_last_content = el_child_last.querySelector(".ab-nodes-content");
50851
+ let height = 0;
50852
+ let heightToReduce = (el_child_first.offsetHeight + el_child_last.offsetHeight) / 2;
50853
+ if (els_child.length == 3) {
50854
+ height = el_child_first_content.offsetHeight - 20 > 20 ? el_child_first_content.offsetHeight - 20 : 20;
50855
+ el_bracket2.style.cssText = `
50856
+ height: ${height}px;
50857
+ top: calc(50% - ${height / 2}px);
50858
+ `;
50859
+ } else {
50860
+ el_bracket2.style.cssText = `
50861
+ height: calc(100% - ${heightToReduce}px);
50862
+ top: ${el_child_first.offsetHeight / 2}px;
50863
+ `;
50864
+ }
50865
+ if (Array.prototype.includes.call(els_min, children2)) {
50866
+ if (els_child.length == 3) {
50867
+ el_bracket.style.cssText = `
50868
+ display: block;
50869
+ top: calc(50% + ${el_content.offsetHeight / 2}px - 3px);
50870
+ clip-path: circle(40% at 50% 40%);
50871
+ `;
50872
+ } else {
50873
+ el_bracket.setAttribute("display", "none");
50874
+ }
50875
+ if (els_child.length == 3 && el_content.offsetHeight == el_child_first_content.offsetHeight) {
50876
+ el_bracket2.style.cssText = `
50877
+ height: 1px;
50878
+ top: calc(50% + ${el_content.offsetHeight / 2}px - 1px);
50879
+ width: 18px; /* 可以溢出点 */
50880
+ border-radius: 0;
50881
+ border: none;
50882
+ border-bottom: 1px solid var(--node-color);
50883
+ `;
50884
+ } else {
50885
+ if (els_child.length == 3) {
50886
+ height = el_child_last_content.offsetHeight / 2 - el_content.offsetHeight / 2;
50887
+ el_bracket2.style.setProperty("height", `${height}px`);
50888
+ el_bracket2.style.setProperty("top", `calc(50% + ${el_content.offsetHeight / 2}px)`);
50889
+ el_bracket2.style.setProperty("border-radius", `0 0 0 10px`);
50890
+ el_bracket2.style.setProperty("border-top", `0`);
50891
+ } else {
50892
+ heightToReduce = el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 + el_child_last.offsetHeight / 2 - el_child_last_content.offsetHeight / 2;
50893
+ el_bracket2.style.setProperty("height", `calc(100% - ${heightToReduce}px + 1px)`);
50894
+ el_bracket2.style.setProperty("top", `${el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 - 1}px`);
50895
+ }
50896
+ el_bracket2.style.setProperty("width", "20px");
50897
+ }
50898
+ }
50899
+ }
50900
+ }
50901
+ if (d.querySelector(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)")) {
50902
+ const root_el_list = d.querySelectorAll(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)");
50903
+ for (const root_el of root_el_list) {
50904
+ root_el.classList.add("js-waterfall");
50905
+ const list_children = root_el.querySelectorAll(".ab-items-item");
50906
+ const columnCountTmp = parseInt(window.getComputedStyle(root_el).getPropertyValue("column-count"));
50907
+ let columnCount;
50908
+ if (columnCountTmp && !isNaN(columnCountTmp) && columnCountTmp > 0) {
50909
+ columnCount = columnCountTmp;
50910
+ } else if (root_el.classList.contains("ab-col-auto") && list_children.length <= 4) {
50911
+ columnCount = list_children.length;
50912
+ root_el.classList.add("ab-col" + columnCount);
50913
+ } else {
50914
+ columnCount = 4;
50915
+ root_el.classList.add("ab-col" + columnCount);
50916
+ }
50917
+ const height_cache = [];
50918
+ const el_cache = [];
50919
+ for (let i = 0; i < columnCount; i++) {
50920
+ height_cache.push(0);
50921
+ el_cache.push([]);
50922
+ }
50923
+ for (const children2 of list_children) {
50924
+ const minValue = Math.min.apply(null, height_cache);
50925
+ const minIndex = height_cache.indexOf(minValue);
50926
+ const heightTmp = parseInt(window.getComputedStyle(children2).getPropertyValue("height"));
50927
+ height_cache[minIndex] += heightTmp && !isNaN(heightTmp) && heightTmp > 0 ? heightTmp : 10;
50928
+ el_cache[minIndex].push(children2);
50929
+ }
50930
+ const fillNumber = columnCount - list_children.length % columnCount;
50931
+ if (fillNumber != 4) {
50932
+ for (let i = 0; i < fillNumber; i++) {
50933
+ const children2 = document.createElement("div");
50934
+ children2.classList.add(".ab-items-item.placeholder");
50935
+ children2.setAttribute("style", "height: 20px");
50936
+ const minValue = Math.min.apply(null, height_cache);
50937
+ const minIndex = height_cache.indexOf(minValue);
50938
+ height_cache[minIndex] += 20;
50939
+ el_cache[minIndex].push(children2);
50940
+ }
50941
+ }
50942
+ root_el.innerHTML = "";
50943
+ for (let i = 0; i < columnCount; i++) {
50944
+ for (const j of el_cache[i]) {
50945
+ root_el.appendChild(j);
50946
+ }
50947
+ }
50948
+ }
50949
+ }
50950
+ if (!isCycle && d.querySelector(".ab-markmap-div")) {
50951
+ const divEl = d;
50952
+ let markmapId = "";
50953
+ if (divEl.tagName === "DIV") {
50954
+ markmapId = divEl.querySelector(".ab-markmap-div")?.id || "";
50955
+ }
50956
+ let mindmaps;
50957
+ if (markmapId) {
50958
+ mindmaps = document.querySelectorAll("#" + markmapId);
50959
+ } else {
50960
+ mindmaps = document.querySelectorAll(".ab-markmap-div");
50961
+ }
50962
+ for (const el_div of mindmaps) {
50963
+ const el_svg = el_div.querySelector("svg");
50964
+ const el_g = el_svg?.querySelector("g");
50965
+ if (el_svg && el_g) {
50966
+ const scale_new = el_g.getBBox().height / el_div.offsetWidth;
50967
+ el_svg.setAttribute("style", `height:${el_g.getBBox().height * scale_new + 40}px`);
50968
+ ABCSetting.obsidian.markmap_event?.(d);
50969
+ }
50970
+ }
50971
+ }
50972
+ }
49738
50973
  exports.ABConvertManager = ABConvertManager;
49739
50974
  exports.ABReg = ABReg;
49740
50975
  exports.abConvertEvent = abConvertEvent;