markdown-it-any-block 3.4.4 → 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.
@@ -4,7 +4,10 @@ const ABCSetting = {
4
4
  env: "obsidian",
5
5
  // 某些环境的独占 api,其他环境用不上
6
6
  obsidian: {
7
- mermaid: void 0
7
+ global_app: null,
8
+ global_ctx: null,
9
+ mermaid: void 0,
10
+ markmap_event: void 0
8
11
  }
9
12
  };
10
13
  const ABReg = {
@@ -177,15 +180,35 @@ const ABAlias_json_withSub = [
177
180
  // 注意避免和原上/上面的callout语法冲突,以及自身递归
178
181
  ];
179
182
  const ABAlias_json_mdit = [
180
- { regex: /\|:::_140lne\|(2?tabs?|标签页?)\|/, replacement: "|mditTabs|" },
183
+ { regex: /\|:::_140lne\|((?:mdit2|2)?tabs?|标签页?)\|/, replacement: "|mditTabs|" },
181
184
  { regex: "|:::_140lne|demo|", replacement: "|mditDemo|" },
182
185
  { regex: "|:::_140lne|abDemo|", replacement: "|mditABDemo|" },
183
- { regex: /\|:::_140lne\|(2?col|分栏)\|/, replacement: "|mditCol|" },
184
- { regex: /\|:::_140lne\|(2?card|卡片)\|/, replacement: "|mditCard|" },
185
- { regex: /\|:::_140lne\|(2?chat|聊天)\|/, replacement: "|mditChat|code(chat)|" }
186
+ { regex: /\|:::_140lne\|((?:mdit2|2)?col|分栏)\|/, replacement: "|mditCol|" },
187
+ { regex: /\|:::_140lne\|((?:mdit2|2)?card|卡片)\|/, replacement: "|mditCard|" },
188
+ { regex: /\|:::_140lne\|((?:mdit2|2)?chat|聊天)\|/, replacement: "|mditChat|code(chat)|" },
189
+ //
190
+ // {regex: /\|:::_140lne\|2?(timeline|时间线)\|/, replacement: "|title2timeline|"},
191
+ // {regex: /\|:::_140lne\|2?(tabs?|标签页?)\||\|title2tabs?\|/, replacement: "|title2c2listdata|c2listdata2tab|"},
192
+ // {regex: /\|:::_140lne\|2?(col|分栏)\||\|title2col\|/, replacement: "|title2c2listdata|c2listdata2items|addClass(ab-col)|"},
193
+ // {regex: /\|:::_140lne\|2?(card|卡片)\||\|title2card\|/, replacement: "|title2c2listdata|c2listdata2items|addClass(ab-card)|addClass(ab-lay-vfall)|"},
194
+ // {regex: /\|:::_140lne\|2?(nodes?|节点)\||\|(title2node|title2abMindmap)\|/, replacement: "|title2listdata|listdata2strict|listdata2nodes|"},
195
+ // list - 多叉多层树
196
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(mermaid|flow|流程图)\|/, replacement: "|mdit2list|list2mermaid|" },
197
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(mehrmaid|mdmermaid)\|/, replacement: "|mdit2list|list2mehrmaidText|code(mehrmaid)|" },
198
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(puml)?(plantuml|mindmap|脑图|思维导图)\|/, replacement: "|mdit2list|list2pumlMindmap|" },
199
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(markmap|mdMindmap|md脑图|md思维导图)\|/, replacement: "|mdit2list|list2markmap|" },
200
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(wbs|(工作)?分解(图|结构))\|/, replacement: "|mdit2list|list2pumlWBS|" },
201
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(table|multiWayTable|multiCrossTable|表格?|多叉表格?|跨行表格?)\|/, replacement: "|mdit2list|list2table|" },
202
+ // list - lt树 (属于多层一叉树)
203
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(lt|listTable|treeTable|listGrid|treeGrid|列表格|树形表格?)\|/, replacement: "|mdit2list|list2lt|" },
204
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(list|列表)\|/, replacement: "|mdit2list|list2lt|addClass(ab-listtable-likelist)|" },
205
+ { regex: /\|:::_140lne\|(?:mdit2|2)?(dir|dirTree|目录树?|目录结构)\|/, replacement: "|mdit2list|list2dt|" },
206
+ // list - 二层树
207
+ { regex: /\|:::_140lne\|(fakeList|仿列表)\|/, replacement: "|mdit2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" },
208
+ // 至后
209
+ { regex: "|mdit2list|", replacement: "|mdit2listdata|listdata2strict|listdata2list|" }
186
210
  ];
187
211
  const ABAlias_json_title = [
188
- { regex: "|title2list|", replacement: "|title2listdata|listdata2strict|listdata2list|" },
189
212
  // title - list&title
190
213
  { regex: /\|heading_140lne\|2?(timeline|时间线)\|/, replacement: "|title2timeline|" },
191
214
  { regex: /\|heading_140lne\|2?(tabs?|标签页?)\||\|title2tabs?\|/, replacement: "|title2c2listdata|c2listdata2tab|" },
@@ -204,7 +227,9 @@ const ABAlias_json_title = [
204
227
  { regex: /\|heading_140lne\|2?(list|列表)\|/, replacement: "|title2list|list2lt|addClass(ab-listtable-likelist)|" },
205
228
  { regex: /\|heading_140lne\|2?(dir|dirTree|目录树?|目录结构)\|/, replacement: "|title2list|list2dt|" },
206
229
  // list - 二层树
207
- { regex: /\|heading_140lne\|(fakeList|仿列表)\|/, replacement: "|title2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" }
230
+ { regex: /\|heading_140lne\|(fakeList|仿列表)\|/, replacement: "|title2list|list2table|addClass(ab-table-fc)|addClass(ab-table-likelist)|" },
231
+ // 至后
232
+ { regex: "|title2list|", replacement: "|title2listdata|listdata2strict|listdata2list|" }
208
233
  ];
209
234
  const ABAlias_json_list = [
210
235
  // 特殊
@@ -361,24 +386,18 @@ class ABConvertManager {
361
386
  * @param header 转换方式
362
387
  * @param content 要转换的初始文本 (无前缀版本,前缀在选择器环节已经删除了)
363
388
  * @param selectorName 选择器名,空表示未知
364
- * @return 等于el,无用,后面可以删了
365
389
  */
366
390
  static autoABConvert(el, header, content, selectorName = "", ctx) {
367
- let prev_result = content;
368
- let prev_type = "string";
369
- let prev_type2 = ABConvert_IOEnum.text;
370
- let prev_processor;
371
391
  let prev2 = {
372
- // 组合在一起是为了引用传参
373
- prev_result,
374
- prev_type,
375
- prev_type2,
376
- prev_processor
392
+ prev_result: content,
393
+ prev_type: "string",
394
+ prev_type2: ABConvert_IOEnum.text,
395
+ prev_processor: void 0
377
396
  };
378
397
  {
379
- header = autoABAlias(header, selectorName, prev_result);
398
+ header = autoABAlias(header, selectorName, prev2.prev_result);
380
399
  let list_header = header.split("|");
381
- prev_result = this.autoABConvert_runConvert(el, list_header, prev2, ctx);
400
+ this.autoABConvert_runConvert(el, list_header, prev2, ctx);
382
401
  this.autoABConvert_last(el, header, selectorName, prev2, ctx);
383
402
  }
384
403
  }
@@ -437,7 +456,12 @@ class ABConvertManager {
437
456
  break;
438
457
  }
439
458
  }
440
- prev2.prev_result = abReplaceProcessor.process(el, item_header, prev2.prev_result, ctx);
459
+ try {
460
+ prev2.prev_result = abReplaceProcessor.process(el, item_header, prev2.prev_result, ctx);
461
+ } catch (e) {
462
+ console.error(`处理器执行错误, id:${abReplaceProcessor.id}, header:${item_header}, error:`, e);
463
+ break;
464
+ }
441
465
  prev2.prev_type = typeof prev2.prev_result;
442
466
  prev2.prev_type2 = abReplaceProcessor.process_return;
443
467
  prev2.prev_processor = abReplaceProcessor.process;
@@ -451,7 +475,7 @@ class ABConvertManager {
451
475
  /**
452
476
  * 子函数,后处理/尾处理,主要进行末尾追加指令
453
477
  */
454
- static autoABConvert_last(el, header, selectorName, prev2, ctx) {
478
+ static autoABConvert_last(el, _header, _selectorName, prev2, _ctx) {
455
479
  if (prev2.prev_type == "string" && prev2.prev_type2 == ABConvert_IOEnum.text) {
456
480
  const subEl = document.createElement("div");
457
481
  el.appendChild(subEl);
@@ -459,7 +483,7 @@ class ABConvertManager {
459
483
  prev2.prev_result = el;
460
484
  prev2.prev_type = "object";
461
485
  prev2.prev_type2 = ABConvert_IOEnum.el;
462
- prev2.process = "md";
486
+ prev2.prev_processor = "md";
463
487
  } else if (prev2.prev_type == "string" && prev2.prev_type2 == ABConvert_IOEnum.json) {
464
488
  const code_str = "```json\n" + prev2.prev_result + "\n```\n";
465
489
  const subEl = document.createElement("div");
@@ -468,7 +492,7 @@ class ABConvertManager {
468
492
  prev2.prev_result = el;
469
493
  prev2.prev_type = "object";
470
494
  prev2.prev_type2 = ABConvert_IOEnum.el;
471
- prev2.process = "show_json";
495
+ prev2.prev_processor = "show_json";
472
496
  } 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)) {
473
497
  const code_str = "```json\n" + JSON.stringify(prev2.prev_result, null, 2) + "\n```\n";
474
498
  const subEl = document.createElement("div");
@@ -477,7 +501,7 @@ class ABConvertManager {
477
501
  prev2.prev_result = el;
478
502
  prev2.prev_type = "object";
479
503
  prev2.prev_type2 = ABConvert_IOEnum.el;
480
- prev2.process = "show_listStream";
504
+ prev2.prev_processor = "show_listStream";
481
505
  } else if (prev2.prev_type == "object" && prev2.prev_type2 == ABConvert_IOEnum.el) {
482
506
  return prev2;
483
507
  } else {
@@ -921,7 +945,7 @@ class ListProcess {
921
945
  }
922
946
  }
923
947
  /**
924
- * 标题大纲转列表数据(@todo 正文的level+10,要减掉)
948
+ * 标题大纲转列表数据
925
949
  *
926
950
  * @detail
927
951
  * 这里要将标题、正文、列表 的等级合为一块,所以存在偏移值:
@@ -930,6 +954,7 @@ class ListProcess {
930
954
  * 2. 正文等级, = 0, 取值[+1,+Infi]
931
955
  * 3. 列表等级, = `(.*)-`个数+1, 取值[0]
932
956
  *
957
+ * (比较旧版是正文+10,列表+11,后来允许标题等级为负数。这样方便很多)
933
958
  */
934
959
  static title2data(text2) {
935
960
  let list_itemInfo = [];
@@ -940,13 +965,21 @@ class ListProcess {
940
965
  if (codeBlockFlag == "") {
941
966
  const match2 = line.match(ABReg.reg_code);
942
967
  if (match2 && match2[3]) {
943
- codeBlockFlag = match2[1] + match2[3];
944
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
968
+ if (mul_mode === "heading" || mul_mode === "") {
969
+ list_itemInfo.push({
970
+ content: line,
971
+ level: 0
972
+ });
973
+ mul_mode = "para";
974
+ } else {
975
+ codeBlockFlag = match2[1] + match2[3];
976
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
977
+ }
945
978
  continue;
946
979
  }
947
980
  } else {
948
981
  if (line.indexOf(codeBlockFlag) == 0) codeBlockFlag = "";
949
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
982
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
950
983
  continue;
951
984
  }
952
985
  const match_heading = line.match(ABReg.reg_heading_noprefix);
@@ -963,21 +996,125 @@ class ListProcess {
963
996
  list_itemInfo.push({
964
997
  content: match_list[4],
965
998
  level: match_list[1].length + 1
966
- //+10
967
999
  });
968
1000
  mul_mode = "list";
969
1001
  } else if (/^\S/.test(line) && mul_mode == "list") {
970
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1002
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
971
1003
  } else {
972
1004
  if (mul_mode == "para") {
973
- list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content + "\n" + line;
1005
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1006
+ } else if (/^\s*$/.test(line)) {
1007
+ continue;
1008
+ } else {
1009
+ list_itemInfo.push({
1010
+ content: line,
1011
+ level: 0
1012
+ });
1013
+ mul_mode = "para";
1014
+ }
1015
+ }
1016
+ }
1017
+ removeTailBlank();
1018
+ return list_itemInfo;
1019
+ function removeTailBlank() {
1020
+ if (mul_mode == "para" || mul_mode == "list") {
1021
+ list_itemInfo[list_itemInfo.length - 1].content = list_itemInfo[list_itemInfo.length - 1].content.replace(/\s*$/, "");
1022
+ }
1023
+ }
1024
+ }
1025
+ /**
1026
+ * MarkdownIt 转列表数据
1027
+ *
1028
+ * @detail
1029
+ * 与 title2data 的逻辑基本相同
1030
+ *
1031
+ * 这里要将Mdit标识 (@xxx)、正文、列表 的等级合为一块,所以存在偏移值:
1032
+ *
1033
+ * 1. Mdit等级, = `@<数字>`-100,
1034
+ * 2. 正文等级, = 0, 取值[+1,+Infi]
1035
+ * 3. 列表等级, = `(.*)-`个数+1, 取值[0]
1036
+ *
1037
+ * 例如:
1038
+ *
1039
+ * :::
1040
+ *
1041
+ * @1 AAA
1042
+ *
1043
+ * aaa
1044
+ *
1045
+ * @2 BBB
1046
+ *
1047
+ * @2 B22
1048
+ *
1049
+ * ccc
1050
+ * ddd
1051
+ *
1052
+ * @1 A22
1053
+ *
1054
+ * :::
1055
+ *
1056
+ * 会被转化为
1057
+ *
1058
+ * - AAA
1059
+ * - BBB
1060
+ * - B22
1061
+ * - ccc
1062
+ * ddd
1063
+ * - A22
1064
+ */
1065
+ static mdit2data(text2) {
1066
+ let list_itemInfo = [];
1067
+ const list_text = text2.split("\n");
1068
+ let mul_mode = "";
1069
+ let codeBlockFlag = "";
1070
+ for (let line of list_text) {
1071
+ if (codeBlockFlag == "") {
1072
+ const match2 = line.match(ABReg.reg_code);
1073
+ if (match2 && match2[3]) {
1074
+ if (mul_mode === "mdit" || mul_mode === "") {
1075
+ list_itemInfo.push({
1076
+ content: line,
1077
+ level: 0
1078
+ });
1079
+ mul_mode = "para";
1080
+ } else {
1081
+ codeBlockFlag = match2[1] + match2[3];
1082
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1083
+ }
1084
+ continue;
1085
+ }
1086
+ } else {
1087
+ if (line.indexOf(codeBlockFlag) == 0) codeBlockFlag = "";
1088
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1089
+ continue;
1090
+ }
1091
+ const match_mdit = line.match(/^(\s*)@(\d+)\s+(.*)$/);
1092
+ const match_list = line.match(ABReg.reg_list_noprefix);
1093
+ if (match_mdit && !match_mdit[1]) {
1094
+ removeTailBlank();
1095
+ list_itemInfo.push({
1096
+ content: match_mdit[3],
1097
+ level: Number(match_mdit[2]) - 100
1098
+ });
1099
+ mul_mode = "mdit";
1100
+ } else if (match_list) {
1101
+ removeTailBlank();
1102
+ list_itemInfo.push({
1103
+ content: match_list[4],
1104
+ level: match_list[1].length + 1
1105
+ });
1106
+ mul_mode = "list";
1107
+ } else if (/^\S/.test(line) && mul_mode == "list") {
1108
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
1109
+ } else {
1110
+ if (mul_mode == "para") {
1111
+ list_itemInfo[list_itemInfo.length - 1].content += "\n" + line;
974
1112
  } else if (/^\s*$/.test(line)) {
975
1113
  continue;
976
1114
  } else {
977
1115
  list_itemInfo.push({
978
1116
  content: line,
979
1117
  level: 0
980
- //+10
981
1118
  });
982
1119
  mul_mode = "para";
983
1120
  }
@@ -1212,6 +1349,16 @@ const abc_title2listdata = ABConvert.factory({
1212
1349
  return ListProcess.title2data(content);
1213
1350
  }
1214
1351
  });
1352
+ ABConvert.factory({
1353
+ id: "mdit2listdata",
1354
+ name: "mdit到listdata",
1355
+ process_param: ABConvert_IOEnum.text,
1356
+ process_return: ABConvert_IOEnum.list_stream,
1357
+ detail: "mdit到listdata",
1358
+ process: (el, header, content) => {
1359
+ return ListProcess.mdit2data(content);
1360
+ }
1361
+ });
1215
1362
  ABConvert.factory({
1216
1363
  id: "listdata2list",
1217
1364
  name: "listdata到列表",
@@ -2207,6 +2354,1086 @@ ABConvert.factory({
2207
2354
  return newContent;
2208
2355
  }
2209
2356
  });
2357
+ /*! @license DOMPurify 3.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.3/LICENSE */
2358
+ function _arrayLikeToArray(r, a) {
2359
+ (null == a || a > r.length) && (a = r.length);
2360
+ for (var e = 0, n2 = Array(a); e < a; e++) n2[e] = r[e];
2361
+ return n2;
2362
+ }
2363
+ function _arrayWithHoles(r) {
2364
+ if (Array.isArray(r)) return r;
2365
+ }
2366
+ function _iterableToArrayLimit(r, l2) {
2367
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2368
+ if (null != t) {
2369
+ var e, n2, i, u, a = [], f = true, o = false;
2370
+ try {
2371
+ if (i = (t = t.call(r)).next, 0 === l2) ;
2372
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l2); f = true) ;
2373
+ } catch (r2) {
2374
+ o = true, n2 = r2;
2375
+ } finally {
2376
+ try {
2377
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
2378
+ } finally {
2379
+ if (o) throw n2;
2380
+ }
2381
+ }
2382
+ return a;
2383
+ }
2384
+ }
2385
+ function _nonIterableRest() {
2386
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2387
+ }
2388
+ function _slicedToArray(r, e) {
2389
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
2390
+ }
2391
+ function _unsupportedIterableToArray(r, a) {
2392
+ if (r) {
2393
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
2394
+ var t = {}.toString.call(r).slice(8, -1);
2395
+ 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;
2396
+ }
2397
+ }
2398
+ const entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2399
+ let freeze = Object.freeze, seal = Object.seal, create = Object.create;
2400
+ let _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
2401
+ if (!freeze) {
2402
+ freeze = function freeze2(x) {
2403
+ return x;
2404
+ };
2405
+ }
2406
+ if (!seal) {
2407
+ seal = function seal2(x) {
2408
+ return x;
2409
+ };
2410
+ }
2411
+ if (!apply) {
2412
+ apply = function apply2(func, thisArg) {
2413
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2414
+ args[_key - 2] = arguments[_key];
2415
+ }
2416
+ return func.apply(thisArg, args);
2417
+ };
2418
+ }
2419
+ if (!construct) {
2420
+ construct = function construct2(Func) {
2421
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2422
+ args[_key2 - 1] = arguments[_key2];
2423
+ }
2424
+ return new Func(...args);
2425
+ };
2426
+ }
2427
+ const arrayForEach = unapply(Array.prototype.forEach);
2428
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
2429
+ const arrayPop = unapply(Array.prototype.pop);
2430
+ const arrayPush = unapply(Array.prototype.push);
2431
+ const arraySplice = unapply(Array.prototype.splice);
2432
+ const arrayIsArray = Array.isArray;
2433
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
2434
+ const stringToString = unapply(String.prototype.toString);
2435
+ const stringMatch = unapply(String.prototype.match);
2436
+ const stringReplace = unapply(String.prototype.replace);
2437
+ const stringIndexOf = unapply(String.prototype.indexOf);
2438
+ const stringTrim = unapply(String.prototype.trim);
2439
+ const numberToString = unapply(Number.prototype.toString);
2440
+ const booleanToString = unapply(Boolean.prototype.toString);
2441
+ const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
2442
+ const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
2443
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
2444
+ const objectToString = unapply(Object.prototype.toString);
2445
+ const regExpTest = unapply(RegExp.prototype.test);
2446
+ const typeErrorCreate = unconstruct(TypeError);
2447
+ function unapply(func) {
2448
+ return function(thisArg) {
2449
+ if (thisArg instanceof RegExp) {
2450
+ thisArg.lastIndex = 0;
2451
+ }
2452
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
2453
+ args[_key3 - 1] = arguments[_key3];
2454
+ }
2455
+ return apply(func, thisArg, args);
2456
+ };
2457
+ }
2458
+ function unconstruct(Func) {
2459
+ return function() {
2460
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2461
+ args[_key4] = arguments[_key4];
2462
+ }
2463
+ return construct(Func, args);
2464
+ };
2465
+ }
2466
+ function addToSet(set2, array) {
2467
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
2468
+ if (setPrototypeOf) {
2469
+ setPrototypeOf(set2, null);
2470
+ }
2471
+ if (!arrayIsArray(array)) {
2472
+ return set2;
2473
+ }
2474
+ let l2 = array.length;
2475
+ while (l2--) {
2476
+ let element = array[l2];
2477
+ if (typeof element === "string") {
2478
+ const lcElement = transformCaseFunc(element);
2479
+ if (lcElement !== element) {
2480
+ if (!isFrozen(array)) {
2481
+ array[l2] = lcElement;
2482
+ }
2483
+ element = lcElement;
2484
+ }
2485
+ }
2486
+ set2[element] = true;
2487
+ }
2488
+ return set2;
2489
+ }
2490
+ function cleanArray(array) {
2491
+ for (let index2 = 0; index2 < array.length; index2++) {
2492
+ const isPropertyExist = objectHasOwnProperty(array, index2);
2493
+ if (!isPropertyExist) {
2494
+ array[index2] = null;
2495
+ }
2496
+ }
2497
+ return array;
2498
+ }
2499
+ function clone$3(object) {
2500
+ const newObject = create(null);
2501
+ for (const _ref2 of entries(object)) {
2502
+ var _ref3 = _slicedToArray(_ref2, 2);
2503
+ const property = _ref3[0];
2504
+ const value = _ref3[1];
2505
+ const isPropertyExist = objectHasOwnProperty(object, property);
2506
+ if (isPropertyExist) {
2507
+ if (arrayIsArray(value)) {
2508
+ newObject[property] = cleanArray(value);
2509
+ } else if (value && typeof value === "object" && value.constructor === Object) {
2510
+ newObject[property] = clone$3(value);
2511
+ } else {
2512
+ newObject[property] = value;
2513
+ }
2514
+ }
2515
+ }
2516
+ return newObject;
2517
+ }
2518
+ function stringifyValue(value) {
2519
+ switch (typeof value) {
2520
+ case "string": {
2521
+ return value;
2522
+ }
2523
+ case "number": {
2524
+ return numberToString(value);
2525
+ }
2526
+ case "boolean": {
2527
+ return booleanToString(value);
2528
+ }
2529
+ case "bigint": {
2530
+ return bigintToString ? bigintToString(value) : "0";
2531
+ }
2532
+ case "symbol": {
2533
+ return symbolToString ? symbolToString(value) : "Symbol()";
2534
+ }
2535
+ case "undefined": {
2536
+ return objectToString(value);
2537
+ }
2538
+ case "function":
2539
+ case "object": {
2540
+ if (value === null) {
2541
+ return objectToString(value);
2542
+ }
2543
+ const valueAsRecord = value;
2544
+ const valueToString = lookupGetter(valueAsRecord, "toString");
2545
+ if (typeof valueToString === "function") {
2546
+ const stringified = valueToString(valueAsRecord);
2547
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
2548
+ }
2549
+ return objectToString(value);
2550
+ }
2551
+ default: {
2552
+ return objectToString(value);
2553
+ }
2554
+ }
2555
+ }
2556
+ function lookupGetter(object, prop2) {
2557
+ while (object !== null) {
2558
+ const desc = getOwnPropertyDescriptor(object, prop2);
2559
+ if (desc) {
2560
+ if (desc.get) {
2561
+ return unapply(desc.get);
2562
+ }
2563
+ if (typeof desc.value === "function") {
2564
+ return unapply(desc.value);
2565
+ }
2566
+ }
2567
+ object = getPrototypeOf(object);
2568
+ }
2569
+ function fallbackValue() {
2570
+ return null;
2571
+ }
2572
+ return fallbackValue;
2573
+ }
2574
+ function isRegex(value) {
2575
+ try {
2576
+ regExpTest(value, "");
2577
+ return true;
2578
+ } catch (_unused) {
2579
+ return false;
2580
+ }
2581
+ }
2582
+ 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"]);
2583
+ 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"]);
2584
+ 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"]);
2585
+ 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"]);
2586
+ 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"]);
2587
+ const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
2588
+ const text$2 = freeze(["#text"]);
2589
+ 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"]);
2590
+ 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"]);
2591
+ 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"]);
2592
+ const xml$1 = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
2593
+ const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
2594
+ const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
2595
+ const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
2596
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
2597
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
2598
+ const IS_ALLOWED_URI = seal(
2599
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
2600
+ // eslint-disable-line no-useless-escape
2601
+ );
2602
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
2603
+ const ATTR_WHITESPACE = seal(
2604
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
2605
+ // eslint-disable-line no-control-regex
2606
+ );
2607
+ const DOCTYPE_NAME = seal(/^html$/i);
2608
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
2609
+ const NODE_TYPE$1 = {
2610
+ element: 1,
2611
+ text: 3,
2612
+ // Deprecated
2613
+ progressingInstruction: 7,
2614
+ comment: 8,
2615
+ document: 9
2616
+ };
2617
+ const getGlobal = function getGlobal2() {
2618
+ return typeof window === "undefined" ? null : window;
2619
+ };
2620
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
2621
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
2622
+ return null;
2623
+ }
2624
+ let suffix = null;
2625
+ const ATTR_NAME = "data-tt-policy-suffix";
2626
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
2627
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
2628
+ }
2629
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
2630
+ try {
2631
+ return trustedTypes.createPolicy(policyName, {
2632
+ createHTML(html2) {
2633
+ return html2;
2634
+ },
2635
+ createScriptURL(scriptUrl) {
2636
+ return scriptUrl;
2637
+ }
2638
+ });
2639
+ } catch (_) {
2640
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
2641
+ return null;
2642
+ }
2643
+ };
2644
+ const _createHooksMap = function _createHooksMap2() {
2645
+ return {
2646
+ afterSanitizeAttributes: [],
2647
+ afterSanitizeElements: [],
2648
+ afterSanitizeShadowDOM: [],
2649
+ beforeSanitizeAttributes: [],
2650
+ beforeSanitizeElements: [],
2651
+ beforeSanitizeShadowDOM: [],
2652
+ uponSanitizeAttribute: [],
2653
+ uponSanitizeElement: [],
2654
+ uponSanitizeShadowNode: []
2655
+ };
2656
+ };
2657
+ function createDOMPurify() {
2658
+ let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
2659
+ const DOMPurify = (root2) => createDOMPurify(root2);
2660
+ DOMPurify.version = "3.4.3";
2661
+ DOMPurify.removed = [];
2662
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE$1.document || !window2.Element) {
2663
+ DOMPurify.isSupported = false;
2664
+ return DOMPurify;
2665
+ }
2666
+ let document2 = window2.document;
2667
+ const originalDocument = document2;
2668
+ const currentScript = originalDocument.currentScript;
2669
+ 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;
2670
+ const ElementPrototype = Element2.prototype;
2671
+ const cloneNode2 = lookupGetter(ElementPrototype, "cloneNode");
2672
+ const remove2 = lookupGetter(ElementPrototype, "remove");
2673
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
2674
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
2675
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
2676
+ if (typeof HTMLTemplateElement === "function") {
2677
+ const template = document2.createElement("template");
2678
+ if (template.content && template.content.ownerDocument) {
2679
+ document2 = template.content.ownerDocument;
2680
+ }
2681
+ }
2682
+ let trustedTypesPolicy;
2683
+ let emptyHTML = "";
2684
+ const _document = document2, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName2 = _document.getElementsByTagName;
2685
+ const importNode = originalDocument.importNode;
2686
+ let hooks = _createHooksMap();
2687
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
2688
+ 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;
2689
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
2690
+ let ALLOWED_TAGS = null;
2691
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text$2]);
2692
+ let ALLOWED_ATTR = null;
2693
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html$2, ...svg, ...mathMl, ...xml$1]);
2694
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
2695
+ tagNameCheck: {
2696
+ writable: true,
2697
+ configurable: false,
2698
+ enumerable: true,
2699
+ value: null
2700
+ },
2701
+ attributeNameCheck: {
2702
+ writable: true,
2703
+ configurable: false,
2704
+ enumerable: true,
2705
+ value: null
2706
+ },
2707
+ allowCustomizedBuiltInElements: {
2708
+ writable: true,
2709
+ configurable: false,
2710
+ enumerable: true,
2711
+ value: false
2712
+ }
2713
+ }));
2714
+ let FORBID_TAGS = null;
2715
+ let FORBID_ATTR = null;
2716
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
2717
+ tagCheck: {
2718
+ writable: true,
2719
+ configurable: false,
2720
+ enumerable: true,
2721
+ value: null
2722
+ },
2723
+ attributeCheck: {
2724
+ writable: true,
2725
+ configurable: false,
2726
+ enumerable: true,
2727
+ value: null
2728
+ }
2729
+ }));
2730
+ let ALLOW_ARIA_ATTR = true;
2731
+ let ALLOW_DATA_ATTR = true;
2732
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
2733
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
2734
+ let SAFE_FOR_TEMPLATES = false;
2735
+ let SAFE_FOR_XML = true;
2736
+ let WHOLE_DOCUMENT = false;
2737
+ let SET_CONFIG = false;
2738
+ let FORCE_BODY = false;
2739
+ let RETURN_DOM = false;
2740
+ let RETURN_DOM_FRAGMENT = false;
2741
+ let RETURN_TRUSTED_TYPE = false;
2742
+ let SANITIZE_DOM = true;
2743
+ let SANITIZE_NAMED_PROPS = false;
2744
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
2745
+ let KEEP_CONTENT = true;
2746
+ let IN_PLACE = false;
2747
+ let USE_PROFILES = {};
2748
+ let FORBID_CONTENTS = null;
2749
+ 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"]);
2750
+ let DATA_URI_TAGS = null;
2751
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
2752
+ let URI_SAFE_ATTRIBUTES = null;
2753
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
2754
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
2755
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
2756
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
2757
+ let NAMESPACE = HTML_NAMESPACE;
2758
+ let IS_EMPTY_INPUT = false;
2759
+ let ALLOWED_NAMESPACES = null;
2760
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
2761
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
2762
+ let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
2763
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
2764
+ let PARSER_MEDIA_TYPE = null;
2765
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
2766
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
2767
+ let transformCaseFunc = null;
2768
+ let CONFIG = null;
2769
+ const formElement = document2.createElement("form");
2770
+ const isRegexOrFunction = function isRegexOrFunction2(testValue) {
2771
+ return testValue instanceof RegExp || testValue instanceof Function;
2772
+ };
2773
+ const _parseConfig = function _parseConfig2() {
2774
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2775
+ if (CONFIG && CONFIG === cfg) {
2776
+ return;
2777
+ }
2778
+ if (!cfg || typeof cfg !== "object") {
2779
+ cfg = {};
2780
+ }
2781
+ cfg = clone$3(cfg);
2782
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
2783
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
2784
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
2785
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
2786
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
2787
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
2788
+ 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;
2789
+ 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;
2790
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
2791
+ FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone$3({});
2792
+ FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone$3({});
2793
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone$3(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
2794
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
2795
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
2796
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
2797
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
2798
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
2799
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
2800
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
2801
+ RETURN_DOM = cfg.RETURN_DOM || false;
2802
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
2803
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
2804
+ FORCE_BODY = cfg.FORCE_BODY || false;
2805
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
2806
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
2807
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
2808
+ IN_PLACE = cfg.IN_PLACE || false;
2809
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
2810
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
2811
+ 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"]);
2812
+ 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"]);
2813
+ 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);
2814
+ CUSTOM_ELEMENT_HANDLING = create(null);
2815
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
2816
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
2817
+ }
2818
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
2819
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
2820
+ }
2821
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
2822
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
2823
+ }
2824
+ if (SAFE_FOR_TEMPLATES) {
2825
+ ALLOW_DATA_ATTR = false;
2826
+ }
2827
+ if (RETURN_DOM_FRAGMENT) {
2828
+ RETURN_DOM = true;
2829
+ }
2830
+ if (USE_PROFILES) {
2831
+ ALLOWED_TAGS = addToSet({}, text$2);
2832
+ ALLOWED_ATTR = create(null);
2833
+ if (USE_PROFILES.html === true) {
2834
+ addToSet(ALLOWED_TAGS, html$1$1);
2835
+ addToSet(ALLOWED_ATTR, html$2);
2836
+ }
2837
+ if (USE_PROFILES.svg === true) {
2838
+ addToSet(ALLOWED_TAGS, svg$1);
2839
+ addToSet(ALLOWED_ATTR, svg);
2840
+ addToSet(ALLOWED_ATTR, xml$1);
2841
+ }
2842
+ if (USE_PROFILES.svgFilters === true) {
2843
+ addToSet(ALLOWED_TAGS, svgFilters);
2844
+ addToSet(ALLOWED_ATTR, svg);
2845
+ addToSet(ALLOWED_ATTR, xml$1);
2846
+ }
2847
+ if (USE_PROFILES.mathMl === true) {
2848
+ addToSet(ALLOWED_TAGS, mathMl$1);
2849
+ addToSet(ALLOWED_ATTR, mathMl);
2850
+ addToSet(ALLOWED_ATTR, xml$1);
2851
+ }
2852
+ }
2853
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
2854
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
2855
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
2856
+ if (typeof cfg.ADD_TAGS === "function") {
2857
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
2858
+ } else if (arrayIsArray(cfg.ADD_TAGS)) {
2859
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
2860
+ ALLOWED_TAGS = clone$3(ALLOWED_TAGS);
2861
+ }
2862
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
2863
+ }
2864
+ }
2865
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
2866
+ if (typeof cfg.ADD_ATTR === "function") {
2867
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
2868
+ } else if (arrayIsArray(cfg.ADD_ATTR)) {
2869
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
2870
+ ALLOWED_ATTR = clone$3(ALLOWED_ATTR);
2871
+ }
2872
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
2873
+ }
2874
+ }
2875
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
2876
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
2877
+ }
2878
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
2879
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
2880
+ FORBID_CONTENTS = clone$3(FORBID_CONTENTS);
2881
+ }
2882
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
2883
+ }
2884
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
2885
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
2886
+ FORBID_CONTENTS = clone$3(FORBID_CONTENTS);
2887
+ }
2888
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
2889
+ }
2890
+ if (KEEP_CONTENT) {
2891
+ ALLOWED_TAGS["#text"] = true;
2892
+ }
2893
+ if (WHOLE_DOCUMENT) {
2894
+ addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
2895
+ }
2896
+ if (ALLOWED_TAGS.table) {
2897
+ addToSet(ALLOWED_TAGS, ["tbody"]);
2898
+ delete FORBID_TAGS.tbody;
2899
+ }
2900
+ if (cfg.TRUSTED_TYPES_POLICY) {
2901
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
2902
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2903
+ }
2904
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
2905
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2906
+ }
2907
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
2908
+ emptyHTML = trustedTypesPolicy.createHTML("");
2909
+ } else {
2910
+ if (trustedTypesPolicy === void 0) {
2911
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
2912
+ }
2913
+ if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
2914
+ emptyHTML = trustedTypesPolicy.createHTML("");
2915
+ }
2916
+ }
2917
+ if (freeze) {
2918
+ freeze(cfg);
2919
+ }
2920
+ CONFIG = cfg;
2921
+ };
2922
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
2923
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
2924
+ const _checkValidNamespace = function _checkValidNamespace2(element) {
2925
+ let parent2 = getParentNode(element);
2926
+ if (!parent2 || !parent2.tagName) {
2927
+ parent2 = {
2928
+ namespaceURI: NAMESPACE,
2929
+ tagName: "template"
2930
+ };
2931
+ }
2932
+ const tagName = stringToLowerCase(element.tagName);
2933
+ const parentTagName = stringToLowerCase(parent2.tagName);
2934
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
2935
+ return false;
2936
+ }
2937
+ if (element.namespaceURI === SVG_NAMESPACE) {
2938
+ if (parent2.namespaceURI === HTML_NAMESPACE) {
2939
+ return tagName === "svg";
2940
+ }
2941
+ if (parent2.namespaceURI === MATHML_NAMESPACE) {
2942
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
2943
+ }
2944
+ return Boolean(ALL_SVG_TAGS[tagName]);
2945
+ }
2946
+ if (element.namespaceURI === MATHML_NAMESPACE) {
2947
+ if (parent2.namespaceURI === HTML_NAMESPACE) {
2948
+ return tagName === "math";
2949
+ }
2950
+ if (parent2.namespaceURI === SVG_NAMESPACE) {
2951
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
2952
+ }
2953
+ return Boolean(ALL_MATHML_TAGS[tagName]);
2954
+ }
2955
+ if (element.namespaceURI === HTML_NAMESPACE) {
2956
+ if (parent2.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
2957
+ return false;
2958
+ }
2959
+ if (parent2.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
2960
+ return false;
2961
+ }
2962
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
2963
+ }
2964
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
2965
+ return true;
2966
+ }
2967
+ return false;
2968
+ };
2969
+ const _forceRemove = function _forceRemove2(node) {
2970
+ arrayPush(DOMPurify.removed, {
2971
+ element: node
2972
+ });
2973
+ try {
2974
+ getParentNode(node).removeChild(node);
2975
+ } catch (_) {
2976
+ remove2(node);
2977
+ }
2978
+ };
2979
+ const _removeAttribute = function _removeAttribute2(name2, element) {
2980
+ try {
2981
+ arrayPush(DOMPurify.removed, {
2982
+ attribute: element.getAttributeNode(name2),
2983
+ from: element
2984
+ });
2985
+ } catch (_) {
2986
+ arrayPush(DOMPurify.removed, {
2987
+ attribute: null,
2988
+ from: element
2989
+ });
2990
+ }
2991
+ element.removeAttribute(name2);
2992
+ if (name2 === "is") {
2993
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
2994
+ try {
2995
+ _forceRemove(element);
2996
+ } catch (_) {
2997
+ }
2998
+ } else {
2999
+ try {
3000
+ element.setAttribute(name2, "");
3001
+ } catch (_) {
3002
+ }
3003
+ }
3004
+ }
3005
+ };
3006
+ const _initDocument = function _initDocument2(dirty) {
3007
+ let doc = null;
3008
+ let leadingWhitespace = null;
3009
+ if (FORCE_BODY) {
3010
+ dirty = "<remove></remove>" + dirty;
3011
+ } else {
3012
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
3013
+ leadingWhitespace = matches && matches[0];
3014
+ }
3015
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
3016
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
3017
+ }
3018
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
3019
+ if (NAMESPACE === HTML_NAMESPACE) {
3020
+ try {
3021
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
3022
+ } catch (_) {
3023
+ }
3024
+ }
3025
+ if (!doc || !doc.documentElement) {
3026
+ doc = implementation.createDocument(NAMESPACE, "template", null);
3027
+ try {
3028
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
3029
+ } catch (_) {
3030
+ }
3031
+ }
3032
+ const body = doc.body || doc.documentElement;
3033
+ if (dirty && leadingWhitespace) {
3034
+ body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
3035
+ }
3036
+ if (NAMESPACE === HTML_NAMESPACE) {
3037
+ return getElementsByTagName2.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
3038
+ }
3039
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
3040
+ };
3041
+ const _createNodeIterator = function _createNodeIterator2(root2) {
3042
+ return createNodeIterator.call(
3043
+ root2.ownerDocument || root2,
3044
+ root2,
3045
+ // eslint-disable-next-line no-bitwise
3046
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
3047
+ null
3048
+ );
3049
+ };
3050
+ const _isClobbered = function _isClobbered2(element) {
3051
+ 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");
3052
+ };
3053
+ const _isNode = function _isNode2(value) {
3054
+ return typeof Node3 === "function" && value instanceof Node3;
3055
+ };
3056
+ function _executeHooks(hooks2, currentNode, data2) {
3057
+ arrayForEach(hooks2, (hook) => {
3058
+ hook.call(DOMPurify, currentNode, data2, CONFIG);
3059
+ });
3060
+ }
3061
+ const _sanitizeElements = function _sanitizeElements2(currentNode) {
3062
+ let content = null;
3063
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
3064
+ if (_isClobbered(currentNode)) {
3065
+ _forceRemove(currentNode);
3066
+ return true;
3067
+ }
3068
+ const tagName = transformCaseFunc(currentNode.nodeName);
3069
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
3070
+ tagName,
3071
+ allowedTags: ALLOWED_TAGS
3072
+ });
3073
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
3074
+ _forceRemove(currentNode);
3075
+ return true;
3076
+ }
3077
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
3078
+ _forceRemove(currentNode);
3079
+ return true;
3080
+ }
3081
+ if (currentNode.nodeType === NODE_TYPE$1.progressingInstruction) {
3082
+ _forceRemove(currentNode);
3083
+ return true;
3084
+ }
3085
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE$1.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
3086
+ _forceRemove(currentNode);
3087
+ return true;
3088
+ }
3089
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
3090
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
3091
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
3092
+ return false;
3093
+ }
3094
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
3095
+ return false;
3096
+ }
3097
+ }
3098
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
3099
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
3100
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
3101
+ if (childNodes && parentNode) {
3102
+ const childCount = childNodes.length;
3103
+ for (let i = childCount - 1; i >= 0; --i) {
3104
+ const childClone = cloneNode2(childNodes[i], true);
3105
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
3106
+ }
3107
+ }
3108
+ }
3109
+ _forceRemove(currentNode);
3110
+ return true;
3111
+ }
3112
+ if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
3113
+ _forceRemove(currentNode);
3114
+ return true;
3115
+ }
3116
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
3117
+ _forceRemove(currentNode);
3118
+ return true;
3119
+ }
3120
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE$1.text) {
3121
+ content = currentNode.textContent;
3122
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3123
+ content = stringReplace(content, expr, " ");
3124
+ });
3125
+ if (currentNode.textContent !== content) {
3126
+ arrayPush(DOMPurify.removed, {
3127
+ element: currentNode.cloneNode()
3128
+ });
3129
+ currentNode.textContent = content;
3130
+ }
3131
+ }
3132
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
3133
+ return false;
3134
+ };
3135
+ const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
3136
+ if (FORBID_ATTR[lcName]) {
3137
+ return false;
3138
+ }
3139
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
3140
+ return false;
3141
+ }
3142
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
3143
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ;
3144
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;
3145
+ else if (!nameIsPermitted || FORBID_ATTR[lcName]) {
3146
+ if (
3147
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
3148
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
3149
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
3150
+ _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
3151
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
3152
+ 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))
3153
+ ) ;
3154
+ else {
3155
+ return false;
3156
+ }
3157
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
3158
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
3159
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
3160
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
3161
+ else if (value) {
3162
+ return false;
3163
+ } else ;
3164
+ return true;
3165
+ };
3166
+ 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"]);
3167
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
3168
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
3169
+ };
3170
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
3171
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
3172
+ const attributes2 = currentNode.attributes;
3173
+ if (!attributes2 || _isClobbered(currentNode)) {
3174
+ return;
3175
+ }
3176
+ const hookEvent = {
3177
+ attrName: "",
3178
+ attrValue: "",
3179
+ keepAttr: true,
3180
+ allowedAttributes: ALLOWED_ATTR,
3181
+ forceKeepAttr: void 0
3182
+ };
3183
+ let l2 = attributes2.length;
3184
+ while (l2--) {
3185
+ const attr2 = attributes2[l2];
3186
+ const name2 = attr2.name, namespaceURI = attr2.namespaceURI, attrValue = attr2.value;
3187
+ const lcName = transformCaseFunc(name2);
3188
+ const initValue = attrValue;
3189
+ let value = name2 === "value" ? initValue : stringTrim(initValue);
3190
+ hookEvent.attrName = lcName;
3191
+ hookEvent.attrValue = value;
3192
+ hookEvent.keepAttr = true;
3193
+ hookEvent.forceKeepAttr = void 0;
3194
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
3195
+ value = hookEvent.attrValue;
3196
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
3197
+ _removeAttribute(name2, currentNode);
3198
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
3199
+ }
3200
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
3201
+ _removeAttribute(name2, currentNode);
3202
+ continue;
3203
+ }
3204
+ if (lcName === "attributename" && stringMatch(value, "href")) {
3205
+ _removeAttribute(name2, currentNode);
3206
+ continue;
3207
+ }
3208
+ if (hookEvent.forceKeepAttr) {
3209
+ continue;
3210
+ }
3211
+ if (!hookEvent.keepAttr) {
3212
+ _removeAttribute(name2, currentNode);
3213
+ continue;
3214
+ }
3215
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
3216
+ _removeAttribute(name2, currentNode);
3217
+ continue;
3218
+ }
3219
+ if (SAFE_FOR_TEMPLATES) {
3220
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3221
+ value = stringReplace(value, expr, " ");
3222
+ });
3223
+ }
3224
+ const lcTag = transformCaseFunc(currentNode.nodeName);
3225
+ if (!_isValidAttribute(lcTag, lcName, value)) {
3226
+ _removeAttribute(name2, currentNode);
3227
+ continue;
3228
+ }
3229
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
3230
+ if (namespaceURI) ;
3231
+ else {
3232
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
3233
+ case "TrustedHTML": {
3234
+ value = trustedTypesPolicy.createHTML(value);
3235
+ break;
3236
+ }
3237
+ case "TrustedScriptURL": {
3238
+ value = trustedTypesPolicy.createScriptURL(value);
3239
+ break;
3240
+ }
3241
+ }
3242
+ }
3243
+ }
3244
+ if (value !== initValue) {
3245
+ try {
3246
+ if (namespaceURI) {
3247
+ currentNode.setAttributeNS(namespaceURI, name2, value);
3248
+ } else {
3249
+ currentNode.setAttribute(name2, value);
3250
+ }
3251
+ if (_isClobbered(currentNode)) {
3252
+ _forceRemove(currentNode);
3253
+ } else {
3254
+ arrayPop(DOMPurify.removed);
3255
+ }
3256
+ } catch (_) {
3257
+ _removeAttribute(name2, currentNode);
3258
+ }
3259
+ }
3260
+ }
3261
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
3262
+ };
3263
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
3264
+ let shadowNode = null;
3265
+ const shadowIterator = _createNodeIterator(fragment);
3266
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
3267
+ while (shadowNode = shadowIterator.nextNode()) {
3268
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
3269
+ _sanitizeElements(shadowNode);
3270
+ _sanitizeAttributes(shadowNode);
3271
+ if (shadowNode.content instanceof DocumentFragment) {
3272
+ _sanitizeShadowDOM2(shadowNode.content);
3273
+ }
3274
+ }
3275
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
3276
+ };
3277
+ const _sanitizeAttachedShadowRoots2 = function _sanitizeAttachedShadowRoots(root2) {
3278
+ if (root2.nodeType === NODE_TYPE$1.element && root2.shadowRoot instanceof DocumentFragment) {
3279
+ const sr = root2.shadowRoot;
3280
+ _sanitizeAttachedShadowRoots2(sr);
3281
+ _sanitizeShadowDOM2(sr);
3282
+ }
3283
+ const childNodes = root2.childNodes;
3284
+ if (!childNodes) {
3285
+ return;
3286
+ }
3287
+ const snapshot = [];
3288
+ arrayForEach(childNodes, (child) => {
3289
+ arrayPush(snapshot, child);
3290
+ });
3291
+ for (const child of snapshot) {
3292
+ _sanitizeAttachedShadowRoots2(child);
3293
+ }
3294
+ };
3295
+ DOMPurify.sanitize = function(dirty) {
3296
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3297
+ let body = null;
3298
+ let importedNode = null;
3299
+ let currentNode = null;
3300
+ let returnNode = null;
3301
+ IS_EMPTY_INPUT = !dirty;
3302
+ if (IS_EMPTY_INPUT) {
3303
+ dirty = "<!-->";
3304
+ }
3305
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
3306
+ dirty = stringifyValue(dirty);
3307
+ if (typeof dirty !== "string") {
3308
+ throw typeErrorCreate("dirty is not a string, aborting");
3309
+ }
3310
+ }
3311
+ if (!DOMPurify.isSupported) {
3312
+ return dirty;
3313
+ }
3314
+ if (!SET_CONFIG) {
3315
+ _parseConfig(cfg);
3316
+ }
3317
+ DOMPurify.removed = [];
3318
+ if (typeof dirty === "string") {
3319
+ IN_PLACE = false;
3320
+ }
3321
+ if (IN_PLACE) {
3322
+ const nn = dirty.nodeName;
3323
+ if (typeof nn === "string") {
3324
+ const tagName = transformCaseFunc(nn);
3325
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
3326
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
3327
+ }
3328
+ }
3329
+ _sanitizeAttachedShadowRoots2(dirty);
3330
+ } else if (dirty instanceof Node3) {
3331
+ body = _initDocument("<!---->");
3332
+ importedNode = body.ownerDocument.importNode(dirty, true);
3333
+ if (importedNode.nodeType === NODE_TYPE$1.element && importedNode.nodeName === "BODY") {
3334
+ body = importedNode;
3335
+ } else if (importedNode.nodeName === "HTML") {
3336
+ body = importedNode;
3337
+ } else {
3338
+ body.appendChild(importedNode);
3339
+ }
3340
+ _sanitizeAttachedShadowRoots2(importedNode);
3341
+ } else {
3342
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
3343
+ dirty.indexOf("<") === -1) {
3344
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
3345
+ }
3346
+ body = _initDocument(dirty);
3347
+ if (!body) {
3348
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
3349
+ }
3350
+ }
3351
+ if (body && FORCE_BODY) {
3352
+ _forceRemove(body.firstChild);
3353
+ }
3354
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
3355
+ while (currentNode = nodeIterator.nextNode()) {
3356
+ _sanitizeElements(currentNode);
3357
+ _sanitizeAttributes(currentNode);
3358
+ if (currentNode.content instanceof DocumentFragment) {
3359
+ _sanitizeShadowDOM2(currentNode.content);
3360
+ }
3361
+ }
3362
+ if (IN_PLACE) {
3363
+ return dirty;
3364
+ }
3365
+ if (RETURN_DOM) {
3366
+ if (SAFE_FOR_TEMPLATES) {
3367
+ body.normalize();
3368
+ let html2 = body.innerHTML;
3369
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3370
+ html2 = stringReplace(html2, expr, " ");
3371
+ });
3372
+ body.innerHTML = html2;
3373
+ }
3374
+ if (RETURN_DOM_FRAGMENT) {
3375
+ returnNode = createDocumentFragment.call(body.ownerDocument);
3376
+ while (body.firstChild) {
3377
+ returnNode.appendChild(body.firstChild);
3378
+ }
3379
+ } else {
3380
+ returnNode = body;
3381
+ }
3382
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
3383
+ returnNode = importNode.call(originalDocument, returnNode, true);
3384
+ }
3385
+ return returnNode;
3386
+ }
3387
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
3388
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
3389
+ serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
3390
+ }
3391
+ if (SAFE_FOR_TEMPLATES) {
3392
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
3393
+ serializedHTML = stringReplace(serializedHTML, expr, " ");
3394
+ });
3395
+ }
3396
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
3397
+ };
3398
+ DOMPurify.setConfig = function() {
3399
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3400
+ _parseConfig(cfg);
3401
+ SET_CONFIG = true;
3402
+ };
3403
+ DOMPurify.clearConfig = function() {
3404
+ CONFIG = null;
3405
+ SET_CONFIG = false;
3406
+ };
3407
+ DOMPurify.isValidAttribute = function(tag, attr2, value) {
3408
+ if (!CONFIG) {
3409
+ _parseConfig({});
3410
+ }
3411
+ const lcTag = transformCaseFunc(tag);
3412
+ const lcName = transformCaseFunc(attr2);
3413
+ return _isValidAttribute(lcTag, lcName, value);
3414
+ };
3415
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
3416
+ if (typeof hookFunction !== "function") {
3417
+ return;
3418
+ }
3419
+ arrayPush(hooks[entryPoint], hookFunction);
3420
+ };
3421
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
3422
+ if (hookFunction !== void 0) {
3423
+ const index2 = arrayLastIndexOf(hooks[entryPoint], hookFunction);
3424
+ return index2 === -1 ? void 0 : arraySplice(hooks[entryPoint], index2, 1)[0];
3425
+ }
3426
+ return arrayPop(hooks[entryPoint]);
3427
+ };
3428
+ DOMPurify.removeHooks = function(entryPoint) {
3429
+ hooks[entryPoint] = [];
3430
+ };
3431
+ DOMPurify.removeAllHooks = function() {
3432
+ hooks = _createHooksMap();
3433
+ };
3434
+ return DOMPurify;
3435
+ }
3436
+ var purify = createDOMPurify();
2210
3437
  ABConvert.factory({
2211
3438
  id: "md",
2212
3439
  name: "md",
@@ -2226,7 +3453,7 @@ ABConvert.factory({
2226
3453
  process_param: ABConvert_IOEnum.text,
2227
3454
  process_return: ABConvert_IOEnum.el,
2228
3455
  process: (el, header, content) => {
2229
- el.innerHTML = `<p>${content.replace(/ /g, "&nbsp;").split("\n").join("<br/>")}</p>`;
3456
+ el.innerHTML = purify.sanitize(`<p>${content.replace(/ /g, "&nbsp;").split("\n").join("<br/>")}</p>`);
2230
3457
  return el;
2231
3458
  }
2232
3459
  });
@@ -14824,7 +16051,7 @@ ABConvert.factory({
14824
16051
  async function render_pumlText(text2, div) {
14825
16052
  var encoded = plantumlEncoder.encode(text2);
14826
16053
  let url = "http://www.plantuml.com/plantuml/img/" + encoded;
14827
- div.innerHTML = `<img src="${url}">`;
16054
+ div.innerHTML = purify.sanitize(`<img src="${url}">`);
14828
16055
  return div;
14829
16056
  }
14830
16057
  function getID(length = 16) {
@@ -15001,207 +16228,18 @@ async function data2mindmap(list_itemInfo, div) {
15001
16228
  async function render_mermaidText(mermaidText, div) {
15002
16229
  if (ABCSetting.env.startsWith("obsidian") && ABCSetting.obsidian.mermaid) {
15003
16230
  ABCSetting.obsidian.mermaid.then(async (mermaid) => {
15004
- const { svg } = await mermaid.render("ab-mermaid-" + getID(), mermaidText);
16231
+ const { svg: svg2 } = await mermaid.render("ab-mermaid-" + getID(), mermaidText);
15005
16232
  const div_mermaid = document.createElement("div");
15006
16233
  div.appendChild(div_mermaid);
15007
16234
  div_mermaid.classList.add("mermaid");
15008
- div_mermaid.innerHTML = svg;
16235
+ div_mermaid.innerHTML = svg2;
15009
16236
  });
15010
16237
  } else {
15011
16238
  div.classList.add("ab-raw");
15012
- div.innerHTML = `<div class="ab-raw-data" type-data="mermaid" content-data='${mermaidText}'></div>`;
16239
+ div.innerHTML = purify.sanitize(`<div class="ab-raw-data" type-data="mermaid" content-data='${mermaidText}'></div>`);
15013
16240
  }
15014
16241
  return div;
15015
16242
  }
15016
- function abConvertEvent(d, isCycle = false) {
15017
- if (d.querySelector(".ab-super-width")) {
15018
- const els_note = d.querySelectorAll(".ab-note");
15019
- for (const el_note of els_note) {
15020
- if (el_note.classList.contains("ab-super-width") || el_note.querySelector(".ab-super-width")) {
15021
- const el_replace = el_note.parentNode;
15022
- if (el_replace && el_replace.classList.contains("ab-replace")) {
15023
- el_replace.classList.add("ab-super-width-p");
15024
- }
15025
- }
15026
- }
15027
- const els_view = document.querySelectorAll(".app-container .workspace-leaf");
15028
- for (const el_view of els_view) {
15029
- el_view.style.setProperty("--ab-width-outer", (el_view.offsetWidth - 40).toString() + "px");
15030
- }
15031
- }
15032
- if (d.querySelector(".ab-nodes-node")) {
15033
- const els_min = document.querySelectorAll(".ab-nodes.min .ab-nodes-node");
15034
- const list_children = d.querySelectorAll(".ab-nodes-node");
15035
- for (const children2 of list_children) {
15036
- const el_content = children2.querySelector(".ab-nodes-content");
15037
- if (!el_content) continue;
15038
- const el_child = children2.querySelector(".ab-nodes-children");
15039
- if (!el_child) continue;
15040
- const el_bracket = el_child.querySelector(".ab-nodes-bracket");
15041
- if (!el_bracket) continue;
15042
- const el_bracket2 = el_child.querySelector(".ab-nodes-bracket2");
15043
- if (!el_bracket2) continue;
15044
- const els_child = el_child.childNodes;
15045
- if (els_child.length < 3) {
15046
- el_bracket.style.setProperty("display", "none");
15047
- el_bracket2.style.setProperty("display", "none");
15048
- continue;
15049
- }
15050
- const el_child_first = els_child[2];
15051
- const el_child_last = els_child[els_child.length - 1];
15052
- const el_child_first_content = el_child_first.querySelector(".ab-nodes-content");
15053
- const el_child_last_content = el_child_last.querySelector(".ab-nodes-content");
15054
- let height = 0;
15055
- let heightToReduce = (el_child_first.offsetHeight + el_child_last.offsetHeight) / 2;
15056
- if (els_child.length == 3) {
15057
- height = el_child_first_content.offsetHeight - 20 > 20 ? el_child_first_content.offsetHeight - 20 : 20;
15058
- el_bracket2.style.cssText = `
15059
- height: ${height}px;
15060
- top: calc(50% - ${height / 2}px);
15061
- `;
15062
- } else {
15063
- el_bracket2.style.cssText = `
15064
- height: calc(100% - ${heightToReduce}px);
15065
- top: ${el_child_first.offsetHeight / 2}px;
15066
- `;
15067
- }
15068
- if (Array.prototype.includes.call(els_min, children2)) {
15069
- if (els_child.length == 3) {
15070
- el_bracket.style.cssText = `
15071
- display: block;
15072
- top: calc(50% + ${el_content.offsetHeight / 2}px - 3px);
15073
- clip-path: circle(40% at 50% 40%);
15074
- `;
15075
- } else {
15076
- el_bracket.setAttribute("display", "none");
15077
- }
15078
- if (els_child.length == 3 && el_content.offsetHeight == el_child_first_content.offsetHeight) {
15079
- el_bracket2.style.cssText = `
15080
- height: 1px;
15081
- top: calc(50% + ${el_content.offsetHeight / 2}px - 1px);
15082
- width: 18px; /* 可以溢出点 */
15083
- border-radius: 0;
15084
- border: none;
15085
- border-bottom: 1px solid var(--node-color);
15086
- `;
15087
- } else {
15088
- if (els_child.length == 3) {
15089
- height = el_child_last_content.offsetHeight / 2 - el_content.offsetHeight / 2;
15090
- el_bracket2.style.setProperty("height", `${height}px`);
15091
- el_bracket2.style.setProperty("top", `calc(50% + ${el_content.offsetHeight / 2}px)`);
15092
- el_bracket2.style.setProperty("border-radius", `0 0 0 10px`);
15093
- el_bracket2.style.setProperty("border-top", `0`);
15094
- } else {
15095
- heightToReduce = el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 + el_child_last.offsetHeight / 2 - el_child_last_content.offsetHeight / 2;
15096
- el_bracket2.style.setProperty("height", `calc(100% - ${heightToReduce}px + 1px)`);
15097
- el_bracket2.style.setProperty("top", `${el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 - 1}px`);
15098
- }
15099
- el_bracket2.style.setProperty("width", "20px");
15100
- }
15101
- }
15102
- }
15103
- }
15104
- if (d.querySelector(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)")) {
15105
- const root_el_list = d.querySelectorAll(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)");
15106
- for (const root_el of root_el_list) {
15107
- root_el.classList.add("js-waterfall");
15108
- const list_children = root_el.querySelectorAll(".ab-items-item");
15109
- const columnCountTmp = parseInt(window.getComputedStyle(root_el).getPropertyValue("column-count"));
15110
- let columnCount;
15111
- if (columnCountTmp && !isNaN(columnCountTmp) && columnCountTmp > 0) {
15112
- columnCount = columnCountTmp;
15113
- } else if (root_el.classList.contains("ab-col-auto") && list_children.length <= 4) {
15114
- columnCount = list_children.length;
15115
- root_el.classList.add("ab-col" + columnCount);
15116
- } else {
15117
- columnCount = 4;
15118
- root_el.classList.add("ab-col" + columnCount);
15119
- }
15120
- const height_cache = [];
15121
- const el_cache = [];
15122
- for (let i = 0; i < columnCount; i++) {
15123
- height_cache.push(0);
15124
- el_cache.push([]);
15125
- }
15126
- for (const children2 of list_children) {
15127
- const minValue = Math.min.apply(null, height_cache);
15128
- const minIndex = height_cache.indexOf(minValue);
15129
- const heightTmp = parseInt(window.getComputedStyle(children2).getPropertyValue("height"));
15130
- height_cache[minIndex] += heightTmp && !isNaN(heightTmp) && heightTmp > 0 ? heightTmp : 10;
15131
- el_cache[minIndex].push(children2);
15132
- }
15133
- const fillNumber = columnCount - list_children.length % columnCount;
15134
- if (fillNumber != 4) {
15135
- for (let i = 0; i < fillNumber; i++) {
15136
- const children2 = document.createElement("div");
15137
- children2.classList.add(".ab-items-item.placeholder");
15138
- children2.setAttribute("style", "height: 20px");
15139
- const minValue = Math.min.apply(null, height_cache);
15140
- const minIndex = height_cache.indexOf(minValue);
15141
- height_cache[minIndex] += 20;
15142
- el_cache[minIndex].push(children2);
15143
- }
15144
- }
15145
- root_el.innerHTML = "";
15146
- for (let i = 0; i < columnCount; i++) {
15147
- for (const j of el_cache[i]) {
15148
- root_el.appendChild(j);
15149
- }
15150
- }
15151
- }
15152
- }
15153
- if (!isCycle && d.querySelector(".ab-markmap-div")) {
15154
- const divEl = d;
15155
- let markmapId = "";
15156
- if (divEl.tagName === "DIV") {
15157
- markmapId = divEl.querySelector(".ab-markmap-div")?.id || "";
15158
- }
15159
- let mindmaps;
15160
- if (markmapId) {
15161
- mindmaps = document.querySelectorAll("#" + markmapId);
15162
- } else {
15163
- mindmaps = document.querySelectorAll(".ab-markmap-div");
15164
- }
15165
- for (const el_div of mindmaps) {
15166
- const el_svg = el_div.querySelector("svg");
15167
- const el_g = el_svg?.querySelector("g");
15168
- if (el_svg && el_g) {
15169
- const scale_new = el_g.getBBox().height / el_div.offsetWidth;
15170
- el_svg.setAttribute("style", `height:${el_g.getBBox().height * scale_new + 40}px`);
15171
- markmap_event(d);
15172
- }
15173
- }
15174
- }
15175
- }
15176
- function markmap_event(d) {
15177
- if (d.querySelector(".ab-markmap-svg")) {
15178
- console.log(" - markmap_event");
15179
- let script_el = document.querySelector('script[script-id="ab-markmap-script"]');
15180
- if (script_el) script_el.remove();
15181
- const divEl = d;
15182
- let markmapId = "";
15183
- if (divEl.tagName === "DIV") {
15184
- markmapId = divEl.querySelector(".ab-markmap-svg")?.id || "";
15185
- }
15186
- script_el = document.createElement("script");
15187
- document.head.appendChild(script_el);
15188
- script_el.type = "module";
15189
- script_el.setAttribute("script-id", "ab-markmap-script");
15190
- script_el.textContent = `
15191
- import { Markmap, } from 'https://jspm.dev/markmap-view';
15192
- const markmapId = "${markmapId || ""}";
15193
- let mindmaps;
15194
- if (markmapId) {
15195
- mindmaps = document.querySelectorAll('#' + markmapId);
15196
- } else {
15197
- mindmaps = document.querySelectorAll('.ab-markmap-svg'); // 注意一下这里的选择器
15198
- }
15199
- for(const mindmap of mindmaps) {
15200
- mindmap.innerHTML = "";
15201
- Markmap.create(mindmap,null,JSON.parse(mindmap.getAttribute('data-json')));
15202
- }`;
15203
- }
15204
- }
15205
16243
  const testPath = "npm2url/dist/index.cjs";
15206
16244
  const defaultProviders = {
15207
16245
  jsdelivr: (path) => `https://cdn.jsdelivr.net/npm/${path}`,
@@ -40791,8 +41829,8 @@ var katex$1 = { exports: {} };
40791
41829
  var _functions = {};
40792
41830
  var _htmlGroupBuilders = {};
40793
41831
  var _mathmlGroupBuilders = {};
40794
- function defineFunction(_ref) {
40795
- var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder;
41832
+ function defineFunction(_ref2) {
41833
+ var type = _ref2.type, names = _ref2.names, props = _ref2.props, handler = _ref2.handler, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder;
40796
41834
  var data2 = {
40797
41835
  type,
40798
41836
  numArgs: props.numArgs,
@@ -41790,8 +42828,8 @@ var katex$1 = { exports: {} };
41790
42828
  props: {
41791
42829
  numArgs: 1
41792
42830
  },
41793
- handler: function handler(_ref, args) {
41794
- var parser = _ref.parser, funcName = _ref.funcName;
42831
+ handler: function handler(_ref2, args) {
42832
+ var parser = _ref2.parser, funcName = _ref2.funcName;
41795
42833
  var base = args[0];
41796
42834
  return {
41797
42835
  type: "accentUnder",
@@ -41866,8 +42904,8 @@ var katex$1 = { exports: {} };
41866
42904
  numArgs: 1,
41867
42905
  numOptionalArgs: 1
41868
42906
  },
41869
- handler: function handler(_ref, args, optArgs) {
41870
- var parser = _ref.parser, funcName = _ref.funcName;
42907
+ handler: function handler(_ref2, args, optArgs) {
42908
+ var parser = _ref2.parser, funcName = _ref2.funcName;
41871
42909
  return {
41872
42910
  type: "xArrow",
41873
42911
  mode: parser.mode,
@@ -41959,8 +42997,8 @@ var katex$1 = { exports: {} };
41959
42997
  numArgs: 1,
41960
42998
  allowedInText: true
41961
42999
  },
41962
- handler: function handler(_ref, args) {
41963
- var parser = _ref.parser;
43000
+ handler: function handler(_ref2, args) {
43001
+ var parser = _ref2.parser;
41964
43002
  var arg = assertNodeType(args[0], "ordgroup");
41965
43003
  var group = arg.body;
41966
43004
  var number = "";
@@ -41998,8 +43036,8 @@ var katex$1 = { exports: {} };
41998
43036
  greediness: 3,
41999
43037
  argTypes: ["color", "original"]
42000
43038
  },
42001
- handler: function handler(_ref, args) {
42002
- var parser = _ref.parser;
43039
+ handler: function handler(_ref2, args) {
43040
+ var parser = _ref2.parser;
42003
43041
  var color = assertNodeType(args[0], "color-token").color;
42004
43042
  var body = args[1];
42005
43043
  return {
@@ -42045,8 +43083,8 @@ var katex$1 = { exports: {} };
42045
43083
  argTypes: ["size"],
42046
43084
  allowedInText: true
42047
43085
  },
42048
- handler: function handler(_ref, args, optArgs) {
42049
- var parser = _ref.parser, funcName = _ref.funcName;
43086
+ handler: function handler(_ref2, args, optArgs) {
43087
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42050
43088
  var size = optArgs[0];
42051
43089
  var newRow = funcName === "\\cr";
42052
43090
  var newLine = false;
@@ -42139,8 +43177,8 @@ var katex$1 = { exports: {} };
42139
43177
  numArgs: 0,
42140
43178
  allowedInText: true
42141
43179
  },
42142
- handler: function handler(_ref) {
42143
- var parser = _ref.parser, funcName = _ref.funcName;
43180
+ handler: function handler(_ref2) {
43181
+ var parser = _ref2.parser, funcName = _ref2.funcName;
42144
43182
  parser.consumeSpaces();
42145
43183
  var token = parser.fetch();
42146
43184
  if (globalMap[token.text]) {
@@ -42474,14 +43512,14 @@ var katex$1 = { exports: {} };
42474
43512
  var delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) {
42475
43513
  var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight);
42476
43514
  var pathNode = new domTree_PathNode(sqrtName, path);
42477
- var svg = new SvgNode([pathNode], {
43515
+ var svg2 = new SvgNode([pathNode], {
42478
43516
  // Note: 1000:1 ratio of viewBox to document em width.
42479
43517
  "width": "400em",
42480
43518
  "height": height + "em",
42481
43519
  "viewBox": "0 0 400000 " + viewBoxHeight,
42482
43520
  "preserveAspectRatio": "xMinYMin slice"
42483
43521
  });
42484
- return buildCommon.makeSvgSpan(["hide-tail"], [svg], options);
43522
+ return buildCommon.makeSvgSpan(["hide-tail"], [svg2], options);
42485
43523
  };
42486
43524
  var makeSqrtImage = function makeSqrtImage2(height, options) {
42487
43525
  var newOptions = options.havingBaseSizing();
@@ -43091,8 +44129,8 @@ var katex$1 = { exports: {} };
43091
44129
  greediness: 3,
43092
44130
  argTypes: ["color", "text"]
43093
44131
  },
43094
- handler: function handler(_ref, args, optArgs) {
43095
- var parser = _ref.parser, funcName = _ref.funcName;
44132
+ handler: function handler(_ref2, args, optArgs) {
44133
+ var parser = _ref2.parser, funcName = _ref2.funcName;
43096
44134
  var color = assertNodeType(args[0], "color-token").color;
43097
44135
  var body = args[1];
43098
44136
  return {
@@ -43170,8 +44208,8 @@ var katex$1 = { exports: {} };
43170
44208
  mathmlBuilder: enclose_mathmlBuilder
43171
44209
  });
43172
44210
  var _environments = {};
43173
- function defineEnvironment(_ref) {
43174
- var type = _ref.type, names = _ref.names, props = _ref.props, handler = _ref.handler, htmlBuilder = _ref.htmlBuilder, mathmlBuilder = _ref.mathmlBuilder;
44211
+ function defineEnvironment(_ref2) {
44212
+ var type = _ref2.type, names = _ref2.names, props = _ref2.props, handler = _ref2.handler, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder;
43175
44213
  var data2 = {
43176
44214
  type,
43177
44215
  numArgs: props.numArgs || 0,
@@ -43202,8 +44240,8 @@ var katex$1 = { exports: {} };
43202
44240
  }
43203
44241
  return hlineInfo;
43204
44242
  }
43205
- function parseArray(parser, _ref, style) {
43206
- var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, addJot = _ref.addJot, cols = _ref.cols, arraystretch = _ref.arraystretch, colSeparationType = _ref.colSeparationType;
44243
+ function parseArray(parser, _ref2, style) {
44244
+ var hskipBeforeAndAfter = _ref2.hskipBeforeAndAfter, addJot = _ref2.addJot, cols = _ref2.cols, arraystretch = _ref2.arraystretch, colSeparationType = _ref2.colSeparationType;
43207
44245
  parser.gullet.beginGroup();
43208
44246
  parser.gullet.macros.set("\\\\", "\\cr");
43209
44247
  if (!arraystretch) {
@@ -43842,8 +44880,8 @@ var katex$1 = { exports: {} };
43842
44880
  numArgs: 1,
43843
44881
  argTypes: ["text"]
43844
44882
  },
43845
- handler: function handler(_ref, args) {
43846
- var parser = _ref.parser, funcName = _ref.funcName;
44883
+ handler: function handler(_ref2, args) {
44884
+ var parser = _ref2.parser, funcName = _ref2.funcName;
43847
44885
  var nameGroup = args[0];
43848
44886
  if (nameGroup.type !== "ordgroup") {
43849
44887
  throw new src_ParseError("Invalid environment name", nameGroup);
@@ -43923,8 +44961,8 @@ var katex$1 = { exports: {} };
43923
44961
  props: {
43924
44962
  numArgs: 1
43925
44963
  },
43926
- handler: function handler(_ref, args) {
43927
- var parser = _ref.parser, funcName = _ref.funcName;
44964
+ handler: function handler(_ref2, args) {
44965
+ var parser = _ref2.parser, funcName = _ref2.funcName;
43928
44966
  var body = args[0];
43929
44967
  return {
43930
44968
  type: "mclass",
@@ -44047,8 +45085,8 @@ var katex$1 = { exports: {} };
44047
45085
  numArgs: 1,
44048
45086
  greediness: 2
44049
45087
  },
44050
- handler: function handler(_ref, args) {
44051
- var parser = _ref.parser, funcName = _ref.funcName;
45088
+ handler: function handler(_ref2, args) {
45089
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44052
45090
  var body = args[0];
44053
45091
  var func = funcName;
44054
45092
  if (func in fontAliases) {
@@ -44302,8 +45340,8 @@ var katex$1 = { exports: {} };
44302
45340
  numArgs: 2,
44303
45341
  greediness: 2
44304
45342
  },
44305
- handler: function handler(_ref, args) {
44306
- var parser = _ref.parser, funcName = _ref.funcName;
45343
+ handler: function handler(_ref2, args) {
45344
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44307
45345
  var numer = args[0];
44308
45346
  var denom = args[1];
44309
45347
  var hasBarLine;
@@ -44604,8 +45642,8 @@ var katex$1 = { exports: {} };
44604
45642
  props: {
44605
45643
  numArgs: 1
44606
45644
  },
44607
- handler: function handler(_ref, args) {
44608
- var parser = _ref.parser, funcName = _ref.funcName;
45645
+ handler: function handler(_ref2, args) {
45646
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44609
45647
  return {
44610
45648
  type: "horizBrace",
44611
45649
  mode: parser.mode,
@@ -44625,8 +45663,8 @@ var katex$1 = { exports: {} };
44625
45663
  argTypes: ["url", "original"],
44626
45664
  allowedInText: true
44627
45665
  },
44628
- handler: function handler(_ref, args) {
44629
- var parser = _ref.parser;
45666
+ handler: function handler(_ref2, args) {
45667
+ var parser = _ref2.parser;
44630
45668
  var body = args[1];
44631
45669
  var href = assertNodeType(args[0], "url").url;
44632
45670
  if (!parser.settings.isTrusted({
@@ -44706,9 +45744,9 @@ var katex$1 = { exports: {} };
44706
45744
  argTypes: ["raw", "original"],
44707
45745
  allowedInText: true
44708
45746
  },
44709
- handler: function handler(_ref, args) {
44710
- var parser = _ref.parser, funcName = _ref.funcName;
44711
- _ref.token;
45747
+ handler: function handler(_ref2, args) {
45748
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45749
+ _ref2.token;
44712
45750
  var value = assertNodeType(args[0], "raw").string;
44713
45751
  var body = args[1];
44714
45752
  if (parser.settings.strict) {
@@ -44791,8 +45829,8 @@ var katex$1 = { exports: {} };
44791
45829
  numArgs: 2,
44792
45830
  allowedInText: true
44793
45831
  },
44794
- handler: function handler(_ref, args) {
44795
- var parser = _ref.parser;
45832
+ handler: function handler(_ref2, args) {
45833
+ var parser = _ref2.parser;
44796
45834
  return {
44797
45835
  type: "htmlmathml",
44798
45836
  mode: parser.mode,
@@ -44839,8 +45877,8 @@ var katex$1 = { exports: {} };
44839
45877
  argTypes: ["raw", "url"],
44840
45878
  allowedInText: false
44841
45879
  },
44842
- handler: function handler(_ref, args, optArgs) {
44843
- var parser = _ref.parser;
45880
+ handler: function handler(_ref2, args, optArgs) {
45881
+ var parser = _ref2.parser;
44844
45882
  var width = {
44845
45883
  number: 0,
44846
45884
  unit: "em"
@@ -44954,8 +45992,8 @@ var katex$1 = { exports: {} };
44954
45992
  argTypes: ["size"],
44955
45993
  allowedInText: true
44956
45994
  },
44957
- handler: function handler(_ref, args) {
44958
- var parser = _ref.parser, funcName = _ref.funcName;
45995
+ handler: function handler(_ref2, args) {
45996
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44959
45997
  var size = assertNodeType(args[0], "size");
44960
45998
  if (parser.settings.strict) {
44961
45999
  var mathFunction = funcName[1] === "m";
@@ -44994,8 +46032,8 @@ var katex$1 = { exports: {} };
44994
46032
  numArgs: 1,
44995
46033
  allowedInText: true
44996
46034
  },
44997
- handler: function handler(_ref, args) {
44998
- var parser = _ref.parser, funcName = _ref.funcName;
46035
+ handler: function handler(_ref2, args) {
46036
+ var parser = _ref2.parser, funcName = _ref2.funcName;
44999
46037
  var body = args[0];
45000
46038
  return {
45001
46039
  type: "lap",
@@ -45039,8 +46077,8 @@ var katex$1 = { exports: {} };
45039
46077
  allowedInText: true,
45040
46078
  allowedInMath: false
45041
46079
  },
45042
- handler: function handler(_ref, args) {
45043
- var funcName = _ref.funcName, parser = _ref.parser;
46080
+ handler: function handler(_ref2, args) {
46081
+ var funcName = _ref2.funcName, parser = _ref2.parser;
45044
46082
  var outerMode = parser.mode;
45045
46083
  parser.switchMode("math");
45046
46084
  var close = funcName === "\\(" ? "\\)" : "$";
@@ -45088,8 +46126,8 @@ var katex$1 = { exports: {} };
45088
46126
  props: {
45089
46127
  numArgs: 4
45090
46128
  },
45091
- handler: function handler(_ref, args) {
45092
- var parser = _ref.parser;
46129
+ handler: function handler(_ref2, args) {
46130
+ var parser = _ref2.parser;
45093
46131
  return {
45094
46132
  type: "mathchoice",
45095
46133
  mode: parser.mode,
@@ -45321,8 +46359,8 @@ var katex$1 = { exports: {} };
45321
46359
  props: {
45322
46360
  numArgs: 0
45323
46361
  },
45324
- handler: function handler(_ref, args) {
45325
- var parser = _ref.parser, funcName = _ref.funcName;
46362
+ handler: function handler(_ref2, args) {
46363
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45326
46364
  var fName = funcName;
45327
46365
  if (fName.length === 1) {
45328
46366
  fName = singleCharBigOps[fName];
@@ -45527,8 +46565,8 @@ var katex$1 = { exports: {} };
45527
46565
  props: {
45528
46566
  numArgs: 1
45529
46567
  },
45530
- handler: function handler(_ref, args) {
45531
- var parser = _ref.parser, funcName = _ref.funcName;
46568
+ handler: function handler(_ref2, args) {
46569
+ var parser = _ref2.parser, funcName = _ref2.funcName;
45532
46570
  var body = args[0];
45533
46571
  return {
45534
46572
  type: "operatorname",
@@ -45560,8 +46598,8 @@ var katex$1 = { exports: {} };
45560
46598
  props: {
45561
46599
  numArgs: 1
45562
46600
  },
45563
- handler: function handler(_ref, args) {
45564
- var parser = _ref.parser;
46601
+ handler: function handler(_ref2, args) {
46602
+ var parser = _ref2.parser;
45565
46603
  var body = args[0];
45566
46604
  return {
45567
46605
  type: "overline",
@@ -45606,8 +46644,8 @@ var katex$1 = { exports: {} };
45606
46644
  numArgs: 1,
45607
46645
  allowedInText: true
45608
46646
  },
45609
- handler: function handler(_ref, args) {
45610
- var parser = _ref.parser;
46647
+ handler: function handler(_ref2, args) {
46648
+ var parser = _ref2.parser;
45611
46649
  var body = args[0];
45612
46650
  return {
45613
46651
  type: "phantom",
@@ -45705,8 +46743,8 @@ var katex$1 = { exports: {} };
45705
46743
  argTypes: ["size", "hbox"],
45706
46744
  allowedInText: true
45707
46745
  },
45708
- handler: function handler(_ref, args) {
45709
- var parser = _ref.parser;
46746
+ handler: function handler(_ref2, args) {
46747
+ var parser = _ref2.parser;
45710
46748
  var amount = assertNodeType(args[0], "size").value;
45711
46749
  var body = args[1];
45712
46750
  return {
@@ -45743,8 +46781,8 @@ var katex$1 = { exports: {} };
45743
46781
  numOptionalArgs: 1,
45744
46782
  argTypes: ["size", "size", "size"]
45745
46783
  },
45746
- handler: function handler(_ref, args, optArgs) {
45747
- var parser = _ref.parser;
46784
+ handler: function handler(_ref2, args, optArgs) {
46785
+ var parser = _ref2.parser;
45748
46786
  var shift = optArgs[0];
45749
46787
  var width = assertNodeType(args[0], "size");
45750
46788
  var height = assertNodeType(args[1], "size");
@@ -45817,8 +46855,8 @@ var katex$1 = { exports: {} };
45817
46855
  numArgs: 0,
45818
46856
  allowedInText: true
45819
46857
  },
45820
- handler: function handler(_ref, args) {
45821
- var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser;
46858
+ handler: function handler(_ref2, args) {
46859
+ var breakOnTokenText = _ref2.breakOnTokenText, funcName = _ref2.funcName, parser = _ref2.parser;
45822
46860
  var body = parser.parseExpression(false, breakOnTokenText);
45823
46861
  return {
45824
46862
  type: "sizing",
@@ -45845,8 +46883,8 @@ var katex$1 = { exports: {} };
45845
46883
  numOptionalArgs: 1,
45846
46884
  allowedInText: true
45847
46885
  },
45848
- handler: function handler(_ref, args, optArgs) {
45849
- var parser = _ref.parser;
46886
+ handler: function handler(_ref2, args, optArgs) {
46887
+ var parser = _ref2.parser;
45850
46888
  var smashHeight = false;
45851
46889
  var smashDepth = false;
45852
46890
  var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
@@ -45926,8 +46964,8 @@ var katex$1 = { exports: {} };
45926
46964
  numArgs: 1,
45927
46965
  numOptionalArgs: 1
45928
46966
  },
45929
- handler: function handler(_ref, args, optArgs) {
45930
- var parser = _ref.parser;
46967
+ handler: function handler(_ref2, args, optArgs) {
46968
+ var parser = _ref2.parser;
45931
46969
  var index2 = optArgs[0];
45932
46970
  var body = args[0];
45933
46971
  return {
@@ -46011,8 +47049,8 @@ var katex$1 = { exports: {} };
46011
47049
  numArgs: 0,
46012
47050
  allowedInText: true
46013
47051
  },
46014
- handler: function handler(_ref, args) {
46015
- var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser = _ref.parser;
47052
+ handler: function handler(_ref2, args) {
47053
+ var breakOnTokenText = _ref2.breakOnTokenText, funcName = _ref2.funcName, parser = _ref2.parser;
46016
47054
  var body = parser.parseExpression(true, breakOnTokenText);
46017
47055
  var style = funcName.slice(1, funcName.length - 5);
46018
47056
  return {
@@ -46397,8 +47435,8 @@ var katex$1 = { exports: {} };
46397
47435
  greediness: 2,
46398
47436
  allowedInText: true
46399
47437
  },
46400
- handler: function handler(_ref, args) {
46401
- var parser = _ref.parser, funcName = _ref.funcName;
47438
+ handler: function handler(_ref2, args) {
47439
+ var parser = _ref2.parser, funcName = _ref2.funcName;
46402
47440
  var body = args[0];
46403
47441
  return {
46404
47442
  type: "text",
@@ -46424,8 +47462,8 @@ var katex$1 = { exports: {} };
46424
47462
  numArgs: 1,
46425
47463
  allowedInText: true
46426
47464
  },
46427
- handler: function handler(_ref, args) {
46428
- var parser = _ref.parser;
47465
+ handler: function handler(_ref2, args) {
47466
+ var parser = _ref2.parser;
46429
47467
  return {
46430
47468
  type: "underline",
46431
47469
  mode: parser.mode,
@@ -49286,7 +50324,7 @@ ABConvert.factory({
49286
50324
  process_return: ABConvert_IOEnum.el,
49287
50325
  process: (el, header, content) => {
49288
50326
  list2markmap(content, el);
49289
- markmap_event(el);
50327
+ ABCSetting.obsidian.markmap_event?.(el);
49290
50328
  return el;
49291
50329
  }
49292
50330
  });
@@ -49302,13 +50340,46 @@ function list2markmap(markdown, div) {
49302
50340
  svg_div.classList.add("ab-markmap-div");
49303
50341
  svg_div.id = "ab-markmap-div-" + id;
49304
50342
  const html_str = `<svg class="ab-markmap-svg" id="ab-markmap-${id}" data-json='${JSON.stringify(root2)}' style="height:${height_adapt}px"></svg>`;
49305
- svg_div.innerHTML = html_str;
50343
+ svg_div.innerHTML = purify.sanitize(html_str, {
50344
+ USE_PROFILES: { svg: true }
50345
+ });
49306
50346
  } else {
49307
50347
  div.classList.add("ab-raw");
49308
- div.innerHTML = `<div class="ab-raw-data" type-data="markmap" content-data='${markdown}'></div>`;
50348
+ div.innerHTML = purify.sanitize(`<div class="ab-raw-data" type-data="markmap" content-data='${markdown}'></div>`);
49309
50349
  }
49310
50350
  return div;
49311
50351
  }
50352
+ async function markmap_event(d) {
50353
+ if (ABCSetting.env == "obsidian-min") return;
50354
+ if (d.querySelector(".ab-markmap-svg")) {
50355
+ console.log(" - markmap_event");
50356
+ let script_el = document.querySelector('script[script-id="ab-markmap-script"]');
50357
+ if (script_el) script_el.remove();
50358
+ const divEl = d;
50359
+ let markmapId = "";
50360
+ if (divEl.tagName === "DIV") {
50361
+ markmapId = divEl.querySelector(".ab-markmap-svg")?.id || "";
50362
+ }
50363
+ script_el = document.createElement("script");
50364
+ document.head.appendChild(script_el);
50365
+ script_el.type = "module";
50366
+ script_el.setAttribute("script-id", "ab-markmap-script");
50367
+ script_el.textContent = `
50368
+ import { Markmap, } from 'https://jspm.dev/markmap-view';
50369
+ const markmapId = "${markmapId || ""}";
50370
+ let mindmaps;
50371
+ if (markmapId) {
50372
+ mindmaps = document.querySelectorAll('#' + markmapId);
50373
+ } else {
50374
+ mindmaps = document.querySelectorAll('.ab-markmap-svg'); // 注意一下这里的选择器
50375
+ }
50376
+ for(const mindmap of mindmaps) {
50377
+ mindmap.innerHTML = "";
50378
+ Markmap.create(mindmap,null,JSON.parse(mindmap.getAttribute('data-json')));
50379
+ }`;
50380
+ }
50381
+ }
50382
+ ABCSetting.obsidian.markmap_event = markmap_event;
49312
50383
  const jsdom_api = {
49313
50384
  jsdom_enable: () => {
49314
50385
  },
@@ -49579,10 +50650,170 @@ function ab_mdit_client(md, options) {
49579
50650
  md.use(abSelector_squareInline);
49580
50651
  md.use(abSelector_container);
49581
50652
  }
50653
+ function abConvertEvent(d, isCycle = false) {
50654
+ if (d.querySelector(".ab-super-width")) {
50655
+ const els_note = d.querySelectorAll(".ab-note");
50656
+ for (const el_note of els_note) {
50657
+ if (el_note.classList.contains("ab-super-width") || el_note.querySelector(".ab-super-width")) {
50658
+ const el_replace = el_note.parentNode;
50659
+ if (el_replace && el_replace.classList.contains("ab-replace")) {
50660
+ el_replace.classList.add("ab-super-width-p");
50661
+ }
50662
+ }
50663
+ }
50664
+ const els_view = document.querySelectorAll(".app-container .workspace-leaf");
50665
+ for (const el_view of els_view) {
50666
+ el_view.style.setProperty("--ab-width-outer", (el_view.offsetWidth - 40).toString() + "px");
50667
+ }
50668
+ }
50669
+ if (d.querySelector(".ab-nodes-node")) {
50670
+ const els_min = document.querySelectorAll(".ab-nodes.min .ab-nodes-node");
50671
+ const list_children = d.querySelectorAll(".ab-nodes-node");
50672
+ for (const children2 of list_children) {
50673
+ const el_content = children2.querySelector(".ab-nodes-content");
50674
+ if (!el_content) continue;
50675
+ const el_child = children2.querySelector(".ab-nodes-children");
50676
+ if (!el_child) continue;
50677
+ const el_bracket = el_child.querySelector(".ab-nodes-bracket");
50678
+ if (!el_bracket) continue;
50679
+ const el_bracket2 = el_child.querySelector(".ab-nodes-bracket2");
50680
+ if (!el_bracket2) continue;
50681
+ const els_child = el_child.childNodes;
50682
+ if (els_child.length < 3) {
50683
+ el_bracket.style.setProperty("display", "none");
50684
+ el_bracket2.style.setProperty("display", "none");
50685
+ continue;
50686
+ }
50687
+ const el_child_first = els_child[2];
50688
+ const el_child_last = els_child[els_child.length - 1];
50689
+ const el_child_first_content = el_child_first.querySelector(".ab-nodes-content");
50690
+ const el_child_last_content = el_child_last.querySelector(".ab-nodes-content");
50691
+ let height = 0;
50692
+ let heightToReduce = (el_child_first.offsetHeight + el_child_last.offsetHeight) / 2;
50693
+ if (els_child.length == 3) {
50694
+ height = el_child_first_content.offsetHeight - 20 > 20 ? el_child_first_content.offsetHeight - 20 : 20;
50695
+ el_bracket2.style.cssText = `
50696
+ height: ${height}px;
50697
+ top: calc(50% - ${height / 2}px);
50698
+ `;
50699
+ } else {
50700
+ el_bracket2.style.cssText = `
50701
+ height: calc(100% - ${heightToReduce}px);
50702
+ top: ${el_child_first.offsetHeight / 2}px;
50703
+ `;
50704
+ }
50705
+ if (Array.prototype.includes.call(els_min, children2)) {
50706
+ if (els_child.length == 3) {
50707
+ el_bracket.style.cssText = `
50708
+ display: block;
50709
+ top: calc(50% + ${el_content.offsetHeight / 2}px - 3px);
50710
+ clip-path: circle(40% at 50% 40%);
50711
+ `;
50712
+ } else {
50713
+ el_bracket.setAttribute("display", "none");
50714
+ }
50715
+ if (els_child.length == 3 && el_content.offsetHeight == el_child_first_content.offsetHeight) {
50716
+ el_bracket2.style.cssText = `
50717
+ height: 1px;
50718
+ top: calc(50% + ${el_content.offsetHeight / 2}px - 1px);
50719
+ width: 18px; /* 可以溢出点 */
50720
+ border-radius: 0;
50721
+ border: none;
50722
+ border-bottom: 1px solid var(--node-color);
50723
+ `;
50724
+ } else {
50725
+ if (els_child.length == 3) {
50726
+ height = el_child_last_content.offsetHeight / 2 - el_content.offsetHeight / 2;
50727
+ el_bracket2.style.setProperty("height", `${height}px`);
50728
+ el_bracket2.style.setProperty("top", `calc(50% + ${el_content.offsetHeight / 2}px)`);
50729
+ el_bracket2.style.setProperty("border-radius", `0 0 0 10px`);
50730
+ el_bracket2.style.setProperty("border-top", `0`);
50731
+ } else {
50732
+ heightToReduce = el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 + el_child_last.offsetHeight / 2 - el_child_last_content.offsetHeight / 2;
50733
+ el_bracket2.style.setProperty("height", `calc(100% - ${heightToReduce}px + 1px)`);
50734
+ el_bracket2.style.setProperty("top", `${el_child_first.offsetHeight / 2 + el_child_first_content.offsetHeight / 2 - 1}px`);
50735
+ }
50736
+ el_bracket2.style.setProperty("width", "20px");
50737
+ }
50738
+ }
50739
+ }
50740
+ }
50741
+ if (d.querySelector(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)")) {
50742
+ const root_el_list = d.querySelectorAll(".ab-items.ab-lay-vfall:not(.js-waterfall):not(.ab-lay-hfall):not(.ab-lay-grid)");
50743
+ for (const root_el of root_el_list) {
50744
+ root_el.classList.add("js-waterfall");
50745
+ const list_children = root_el.querySelectorAll(".ab-items-item");
50746
+ const columnCountTmp = parseInt(window.getComputedStyle(root_el).getPropertyValue("column-count"));
50747
+ let columnCount;
50748
+ if (columnCountTmp && !isNaN(columnCountTmp) && columnCountTmp > 0) {
50749
+ columnCount = columnCountTmp;
50750
+ } else if (root_el.classList.contains("ab-col-auto") && list_children.length <= 4) {
50751
+ columnCount = list_children.length;
50752
+ root_el.classList.add("ab-col" + columnCount);
50753
+ } else {
50754
+ columnCount = 4;
50755
+ root_el.classList.add("ab-col" + columnCount);
50756
+ }
50757
+ const height_cache = [];
50758
+ const el_cache = [];
50759
+ for (let i = 0; i < columnCount; i++) {
50760
+ height_cache.push(0);
50761
+ el_cache.push([]);
50762
+ }
50763
+ for (const children2 of list_children) {
50764
+ const minValue = Math.min.apply(null, height_cache);
50765
+ const minIndex = height_cache.indexOf(minValue);
50766
+ const heightTmp = parseInt(window.getComputedStyle(children2).getPropertyValue("height"));
50767
+ height_cache[minIndex] += heightTmp && !isNaN(heightTmp) && heightTmp > 0 ? heightTmp : 10;
50768
+ el_cache[minIndex].push(children2);
50769
+ }
50770
+ const fillNumber = columnCount - list_children.length % columnCount;
50771
+ if (fillNumber != 4) {
50772
+ for (let i = 0; i < fillNumber; i++) {
50773
+ const children2 = document.createElement("div");
50774
+ children2.classList.add(".ab-items-item.placeholder");
50775
+ children2.setAttribute("style", "height: 20px");
50776
+ const minValue = Math.min.apply(null, height_cache);
50777
+ const minIndex = height_cache.indexOf(minValue);
50778
+ height_cache[minIndex] += 20;
50779
+ el_cache[minIndex].push(children2);
50780
+ }
50781
+ }
50782
+ root_el.innerHTML = "";
50783
+ for (let i = 0; i < columnCount; i++) {
50784
+ for (const j of el_cache[i]) {
50785
+ root_el.appendChild(j);
50786
+ }
50787
+ }
50788
+ }
50789
+ }
50790
+ if (!isCycle && d.querySelector(".ab-markmap-div")) {
50791
+ const divEl = d;
50792
+ let markmapId = "";
50793
+ if (divEl.tagName === "DIV") {
50794
+ markmapId = divEl.querySelector(".ab-markmap-div")?.id || "";
50795
+ }
50796
+ let mindmaps;
50797
+ if (markmapId) {
50798
+ mindmaps = document.querySelectorAll("#" + markmapId);
50799
+ } else {
50800
+ mindmaps = document.querySelectorAll(".ab-markmap-div");
50801
+ }
50802
+ for (const el_div of mindmaps) {
50803
+ const el_svg = el_div.querySelector("svg");
50804
+ const el_g = el_svg?.querySelector("g");
50805
+ if (el_svg && el_g) {
50806
+ const scale_new = el_g.getBBox().height / el_div.offsetWidth;
50807
+ el_svg.setAttribute("style", `height:${el_g.getBBox().height * scale_new + 40}px`);
50808
+ ABCSetting.obsidian.markmap_event?.(d);
50809
+ }
50810
+ }
50811
+ }
50812
+ }
49582
50813
  exports.ABConvertManager = ABConvertManager;
49583
50814
  exports.ABReg = ABReg;
49584
50815
  exports.abConvertEvent = abConvertEvent;
49585
50816
  exports.ab_mdit = ab_mdit;
49586
50817
  exports.ab_mdit_client = ab_mdit_client;
49587
50818
  exports.jsdom_api = jsdom_api;
49588
- //# sourceMappingURL=index_mdit-CE73u7cg.cjs.map
50819
+ //# sourceMappingURL=ABConvertEvent-npBaIgYL.cjs.map