dsh-plugin-capabilities 0.3.3 → 0.3.5

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.
package/lib/client.js CHANGED
@@ -23,15 +23,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
23
23
  var index_exports = {};
24
24
  __export(index_exports, {
25
25
  NS: () => NS,
26
- apply: () => apply,
26
+ apply: () => apply2,
27
27
  inject: () => inject,
28
28
  name: () => name
29
29
  });
30
30
  module.exports = __toCommonJS(index_exports);
31
- var import_react5 = require("react");
31
+ var import_react6 = require("react");
32
32
 
33
33
  // src/client/CapabilitiesSection.tsx
34
- var import_react4 = require("react");
34
+ var import_react5 = require("react");
35
35
 
36
36
  // src/client/css.ts
37
37
  var CSS = `
@@ -94,6 +94,21 @@ var CSS = `
94
94
  .dpc-modalForm.dpc-modalForm{width:min(760px,100%)}
95
95
  .dpc-modalScroll.dpc-modalScroll{max-height:calc(100vh - 160px);overflow-y:auto}
96
96
  .dpc-mdPreview{min-height:320px;max-height:60vh;overflow-y:auto;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:8px 12px;background:var(--dsw-alias-bg-layer-1);font-size:13px}
97
+ /* Rendered-markdown body (bundled marked + DOMPurify). */
98
+ .dpc-mdBody h1,.dpc-mdBody h2,.dpc-mdBody h3,.dpc-mdBody h4{margin:14px 0 6px;color:var(--dsw-alias-label-primary);line-height:1.4}
99
+ .dpc-mdBody h1{font-size:18px}.dpc-mdBody h2{font-size:16px}.dpc-mdBody h3{font-size:14px}.dpc-mdBody h4{font-size:13px}
100
+ .dpc-mdBody p{margin:6px 0;line-height:20px}
101
+ .dpc-mdBody ul,.dpc-mdBody ol{margin:6px 0;padding-left:20px}
102
+ .dpc-mdBody li{margin:2px 0;line-height:19px}
103
+ .dpc-mdBody code{font-family:var(--ds-font-family-code);font-size:12px;background:var(--dsw-alias-bg-layer-3);border-radius:4px;padding:1px 5px}
104
+ .dpc-mdBody pre{margin:8px 0;padding:10px 12px;overflow-x:auto;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-3)}
105
+ .dpc-mdBody pre code{padding:0;background:transparent;font-size:12px;line-height:18px}
106
+ .dpc-mdBody a{color:var(--dsw-alias-state-business-primary)}
107
+ .dpc-mdBody blockquote{margin:8px 0;padding:2px 12px;border-left:3px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary)}
108
+ .dpc-mdBody table{border-collapse:collapse;margin:8px 0}
109
+ .dpc-mdBody th,.dpc-mdBody td{border:1px solid var(--dsw-alias-border-l2);padding:4px 10px;font-size:12px;line-height:18px}
110
+ .dpc-mdBody hr{border:0;border-top:1px solid var(--dsw-alias-border-l2);margin:12px 0}
111
+ .dpc-mdBody>*:first-child{margin-top:0}
97
112
  .dpc-importScroll{display:flex;flex-direction:column;gap:14px;max-height:min(400px,52vh);overflow-y:auto;padding:2px 4px 2px 2px}
98
113
  .dpc-importGroup{display:flex;flex-direction:column;gap:8px}
99
114
  .dpc-importHead{display:flex;align-items:center;gap:8px;padding:0 2px}
@@ -441,12 +456,12 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
441
456
  function importGroups(items) {
442
457
  const label = (agent) => agent === "claude-code" ? "Claude Code" : agent === "codex" ? "Codex" : agent;
443
458
  const order = ["claude-code", "codex"];
444
- const agents = [...new Set(items.map((item) => item.server.agent))].sort((a, b) => {
459
+ const agents = [...new Set(items.map((item) => item.server.agent))].sort((a, b2) => {
445
460
  const rank = (agent) => {
446
- const at = order.indexOf(agent);
447
- return at === -1 ? order.length : at;
461
+ const at2 = order.indexOf(agent);
462
+ return at2 === -1 ? order.length : at2;
448
463
  };
449
- return rank(a) - rank(b) || a.localeCompare(b);
464
+ return rank(a) - rank(b2) || a.localeCompare(b2);
450
465
  });
451
466
  return agents.map((agent) => ({
452
467
  agent,
@@ -454,14 +469,14 @@ function importGroups(items) {
454
469
  items: items.map((item, index) => ({ item, index })).filter(({ item }) => item.server.agent === agent)
455
470
  }));
456
471
  }
457
- function parsePairs(text, separator) {
472
+ function parsePairs(text2, separator) {
458
473
  const map = {};
459
- for (const line of text.split(/\r?\n/)) {
474
+ for (const line of text2.split(/\r?\n/)) {
460
475
  const trimmed = line.trim();
461
476
  if (trimmed === "" || trimmed.startsWith("#")) continue;
462
- const at = trimmed.indexOf(separator);
463
- if (at <= 0) continue;
464
- map[trimmed.slice(0, at).trim()] = trimmed.slice(at + 1).trim();
477
+ const at2 = trimmed.indexOf(separator);
478
+ if (at2 <= 0) continue;
479
+ map[trimmed.slice(0, at2).trim()] = trimmed.slice(at2 + 1).trim();
465
480
  }
466
481
  return map;
467
482
  }
@@ -516,10 +531,10 @@ function mcpJsonExample(transport) {
516
531
  };
517
532
  return JSON.stringify({ mcpServers: { "server-name": entry } }, null, 2);
518
533
  }
519
- function parseMcpJson(text) {
534
+ function parseMcpJson(text2) {
520
535
  let parsed;
521
536
  try {
522
- parsed = JSON.parse(text);
537
+ parsed = JSON.parse(text2);
523
538
  } catch {
524
539
  return { error: "not valid JSON" };
525
540
  }
@@ -1019,240 +1034,3030 @@ function McpTab(props) {
1019
1034
  }
1020
1035
 
1021
1036
  // src/client/SkillsTab.tsx
1022
- var import_react3 = require("react");
1037
+ var import_react4 = require("react");
1023
1038
  var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
1024
- var import_jsx_runtime3 = require("react/jsx-runtime");
1025
- var SOURCE_KEYS = {
1026
- "project-dsh": "sourceProjectDsh",
1027
- "project-agents": "sourceProjectAgents",
1028
- "user-dsh": "sourceUserDsh",
1029
- "user-agents": "sourceUserAgents",
1030
- runtime: "sourceRuntime",
1031
- bundled: "sourceBundled",
1032
- custom: "sourceCustom"
1033
- };
1034
- function policyTag(skill) {
1035
- const { modelInvocable, userInvocable } = skill.invocation;
1036
- if (!modelInvocable && !userInvocable) return { key: "skillDisabled", off: true };
1037
- if (!modelInvocable) return { key: "skillUserOnly", off: false };
1038
- if (!userInvocable) return { key: "skillModelOnly", off: false };
1039
- return { off: false };
1039
+
1040
+ // src/client/MarkdownPreview.tsx
1041
+ var import_react3 = require("react");
1042
+
1043
+ // node_modules/.pnpm/dompurify@3.4.13/node_modules/dompurify/dist/purify.es.mjs
1044
+ function _arrayLikeToArray(r, a) {
1045
+ (null == a || a > r.length) && (a = r.length);
1046
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
1047
+ return n;
1040
1048
  }
1041
- function SkillsTab(props) {
1042
- const { t, injected } = props;
1043
- const [skills, setSkills] = (0, import_react3.useState)(null);
1044
- const [editor, setEditor] = (0, import_react3.useState)(null);
1045
- const [preview, setPreview] = (0, import_react3.useState)(false);
1046
- const [confirmName, setConfirmName] = (0, import_react3.useState)(null);
1047
- const [busy, setBusy] = (0, import_react3.useState)(false);
1048
- const [outcome, setOutcome] = (0, import_react3.useState)(null);
1049
- const [formError, setFormError] = (0, import_react3.useState)(null);
1050
- const [reload, setReload] = (0, import_react3.useState)(0);
1051
- const [query, setQuery] = (0, import_react3.useState)("");
1052
- const [sourceFilter, setSourceFilter] = (0, import_react3.useState)("all");
1053
- const [roots, setRoots] = (0, import_react3.useState)(null);
1054
- const [addRoot, setAddRoot] = (0, import_react3.useState)(null);
1055
- const [rootBusy, setRootBusy] = (0, import_react3.useState)(false);
1056
- const [confirmRootId, setConfirmRootId] = (0, import_react3.useState)(null);
1057
- (0, import_react3.useEffect)(() => {
1058
- let current = true;
1059
- void injected.list().then(
1060
- (body) => {
1061
- if (current) setSkills(body.skills);
1062
- },
1063
- (error) => {
1064
- if (current) {
1065
- setSkills([]);
1066
- setOutcome({ ok: false, text: `${t("failed")}: ${String(error.message ?? error)}` });
1067
- }
1068
- }
1069
- );
1070
- void injected.roots().then(
1071
- (body) => {
1072
- if (current) setRoots(body.roots);
1073
- },
1074
- () => {
1075
- if (current) setRoots([]);
1076
- }
1077
- );
1078
- return () => {
1079
- current = false;
1080
- };
1081
- }, [injected, reload, t]);
1082
- const openCreate = () => {
1083
- setFormError(null);
1084
- setPreview(false);
1085
- setEditor({ mode: "create", name: "", description: "", whenToUse: "", modelInvocable: true, userInvocable: true, content: "" });
1086
- };
1087
- const openExisting = async (skill) => {
1088
- setBusy(true);
1089
- setFormError(null);
1049
+ function _arrayWithHoles(r) {
1050
+ if (Array.isArray(r)) return r;
1051
+ }
1052
+ function _iterableToArrayLimit(r, l3) {
1053
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1054
+ if (null != t) {
1055
+ var e, n, i, u, a = [], f2 = true, o = false;
1090
1056
  try {
1091
- const body = await injected.get(skill.name);
1092
- setPreview(!skill.editable);
1093
- setEditor({
1094
- mode: skill.editable ? "edit" : "view",
1095
- name: skill.name,
1096
- description: skill.description,
1097
- whenToUse: skill.whenToUse ?? "",
1098
- modelInvocable: skill.invocation.modelInvocable,
1099
- userInvocable: skill.invocation.userInvocable,
1100
- content: body.content
1101
- });
1102
- } catch (error) {
1103
- setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
1057
+ if (i = (t = t.call(r)).next, 0 === l3) ;
1058
+ else for (; !(f2 = (e = i.call(t)).done) && (a.push(e.value), a.length !== l3); f2 = true) ;
1059
+ } catch (r2) {
1060
+ o = true, n = r2;
1104
1061
  } finally {
1105
- setBusy(false);
1062
+ try {
1063
+ if (!f2 && null != t.return && (u = t.return(), Object(u) !== u)) return;
1064
+ } finally {
1065
+ if (o) throw n;
1066
+ }
1106
1067
  }
1068
+ return a;
1069
+ }
1070
+ }
1071
+ function _nonIterableRest() {
1072
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1073
+ }
1074
+ function _slicedToArray(r, e) {
1075
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
1076
+ }
1077
+ function _unsupportedIterableToArray(r, a) {
1078
+ if (r) {
1079
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
1080
+ var t = {}.toString.call(r).slice(8, -1);
1081
+ 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;
1082
+ }
1083
+ }
1084
+ var entries = Object.entries;
1085
+ var setPrototypeOf = Object.setPrototypeOf;
1086
+ var isFrozen = Object.isFrozen;
1087
+ var getPrototypeOf = Object.getPrototypeOf;
1088
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1089
+ var freeze = Object.freeze;
1090
+ var seal = Object.seal;
1091
+ var create = Object.create;
1092
+ var _ref = typeof Reflect !== "undefined" && Reflect;
1093
+ var apply = _ref.apply;
1094
+ var construct = _ref.construct;
1095
+ if (!freeze) {
1096
+ freeze = function freeze2(x2) {
1097
+ return x2;
1107
1098
  };
1108
- const refreshUntil = (predicate, timeoutMs = 1e4) => {
1109
- const deadline = Date.now() + timeoutMs;
1110
- const tick = () => {
1111
- if (Date.now() > deadline) return;
1112
- setTimeout(() => {
1113
- void injected.list().then(
1114
- (body) => {
1115
- setSkills(body.skills);
1116
- if (!predicate(body.skills)) tick();
1117
- },
1118
- () => tick()
1119
- );
1120
- }, 1e3);
1121
- };
1122
- tick();
1099
+ }
1100
+ if (!seal) {
1101
+ seal = function seal2(x2) {
1102
+ return x2;
1123
1103
  };
1124
- const doSave = async () => {
1125
- if (editor === null) return;
1126
- setBusy(true);
1127
- setFormError(null);
1128
- try {
1129
- const name2 = editor.name.trim();
1130
- await injected.save({
1131
- name: name2,
1132
- description: editor.description,
1133
- whenToUse: editor.whenToUse.trim() === "" ? void 0 : editor.whenToUse,
1134
- modelInvocable: editor.modelInvocable,
1135
- userInvocable: editor.userInvocable,
1136
- content: editor.content
1137
- });
1138
- setOutcome({ ok: true, text: t("saved") });
1139
- setEditor(null);
1140
- refreshUntil((skills2) => skills2.some((skill) => skill.name === name2));
1141
- } catch (error) {
1142
- setFormError(String(error instanceof Error ? error.message : error));
1143
- } finally {
1144
- setBusy(false);
1104
+ }
1105
+ if (!apply) {
1106
+ apply = function apply3(func, thisArg) {
1107
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1108
+ args[_key - 2] = arguments[_key];
1145
1109
  }
1110
+ return func.apply(thisArg, args);
1146
1111
  };
1147
- const doDelete = async () => {
1148
- if (confirmName === null) return;
1149
- const name2 = confirmName;
1150
- setBusy(true);
1151
- try {
1152
- await injected.remove(name2);
1153
- setOutcome({ ok: true, text: t("saved") });
1154
- refreshUntil((skills2) => !skills2.some((skill) => skill.name === name2));
1155
- } catch (error) {
1156
- setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
1157
- } finally {
1158
- setBusy(false);
1159
- setConfirmName(null);
1112
+ }
1113
+ if (!construct) {
1114
+ construct = function construct2(Func) {
1115
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1116
+ args[_key2 - 1] = arguments[_key2];
1160
1117
  }
1118
+ return new Func(...args);
1161
1119
  };
1162
- const doToggle = async (skill) => {
1163
- const enabled = skill.invocation.modelInvocable || skill.invocation.userInvocable;
1164
- setBusy(true);
1165
- try {
1166
- await injected.policy(skill.name, !enabled);
1167
- setOutcome({ ok: true, text: !enabled ? t("skillEnabled") : t("skillDisabledMsg") });
1168
- refreshUntil((list) => {
1169
- const row = list.find((item) => item.name === skill.name);
1170
- return row !== void 0 && row.invocation.modelInvocable === !enabled && row.invocation.userInvocable === !enabled;
1171
- });
1172
- } catch (error) {
1173
- setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
1174
- } finally {
1175
- setBusy(false);
1120
+ }
1121
+ var arrayForEach = unapply(Array.prototype.forEach);
1122
+ var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
1123
+ var arrayPop = unapply(Array.prototype.pop);
1124
+ var arrayPush = unapply(Array.prototype.push);
1125
+ var arraySplice = unapply(Array.prototype.splice);
1126
+ var arrayIsArray = Array.isArray;
1127
+ var stringToLowerCase = unapply(String.prototype.toLowerCase);
1128
+ var stringToString = unapply(String.prototype.toString);
1129
+ var stringMatch = unapply(String.prototype.match);
1130
+ var stringReplace = unapply(String.prototype.replace);
1131
+ var stringIndexOf = unapply(String.prototype.indexOf);
1132
+ var stringTrim = unapply(String.prototype.trim);
1133
+ var numberToString = unapply(Number.prototype.toString);
1134
+ var booleanToString = unapply(Boolean.prototype.toString);
1135
+ var bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
1136
+ var symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
1137
+ var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
1138
+ var objectToString = unapply(Object.prototype.toString);
1139
+ var regExpTest = unapply(RegExp.prototype.test);
1140
+ var typeErrorCreate = unconstruct(TypeError);
1141
+ function unapply(func) {
1142
+ return function(thisArg) {
1143
+ if (thisArg instanceof RegExp) {
1144
+ thisArg.lastIndex = 0;
1176
1145
  }
1146
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
1147
+ args[_key3 - 1] = arguments[_key3];
1148
+ }
1149
+ return apply(func, thisArg, args);
1177
1150
  };
1178
- const doOpen = async (target) => {
1179
- try {
1180
- await injected.open(target);
1181
- } catch (error) {
1182
- setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
1151
+ }
1152
+ function unconstruct(Func) {
1153
+ return function() {
1154
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1155
+ args[_key4] = arguments[_key4];
1183
1156
  }
1157
+ return construct(Func, args);
1184
1158
  };
1185
- const doAddRoot = async () => {
1186
- if (addRoot === null || addRoot.value.trim() === "") return;
1187
- setRootBusy(true);
1188
- setFormError(null);
1189
- try {
1190
- await injected.addRoot(addRoot.kind === "local" ? { kind: "local", path: addRoot.value.trim() } : { kind: "git", url: addRoot.value.trim() });
1191
- setOutcome({ ok: true, text: t("rootAdded") });
1192
- setAddRoot(null);
1193
- void injected.roots().then(
1194
- (body) => setRoots(body.roots),
1195
- () => setRoots([])
1196
- );
1197
- for (let tick = 0; tick < 4; tick++) {
1198
- await new Promise((resolve) => setTimeout(resolve, 1500));
1199
- void injected.list().then(
1200
- (body) => setSkills(body.skills),
1201
- () => void 0
1202
- );
1159
+ }
1160
+ function addToSet(set, array) {
1161
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
1162
+ if (setPrototypeOf) {
1163
+ setPrototypeOf(set, null);
1164
+ }
1165
+ if (!arrayIsArray(array)) {
1166
+ return set;
1167
+ }
1168
+ let l3 = array.length;
1169
+ while (l3--) {
1170
+ let element = array[l3];
1171
+ if (typeof element === "string") {
1172
+ const lcElement = transformCaseFunc(element);
1173
+ if (lcElement !== element) {
1174
+ if (!isFrozen(array)) {
1175
+ array[l3] = lcElement;
1176
+ }
1177
+ element = lcElement;
1203
1178
  }
1204
- } catch (error) {
1205
- setFormError(String(error instanceof Error ? error.message : error));
1179
+ }
1180
+ set[element] = true;
1181
+ }
1182
+ return set;
1183
+ }
1184
+ function cleanArray(array) {
1185
+ for (let index = 0; index < array.length; index++) {
1186
+ const isPropertyExist = objectHasOwnProperty(array, index);
1187
+ if (!isPropertyExist) {
1188
+ array[index] = null;
1189
+ }
1190
+ }
1191
+ return array;
1192
+ }
1193
+ function clone(object) {
1194
+ const newObject = create(null);
1195
+ for (const _ref2 of entries(object)) {
1196
+ var _ref3 = _slicedToArray(_ref2, 2);
1197
+ const property = _ref3[0];
1198
+ const value = _ref3[1];
1199
+ const isPropertyExist = objectHasOwnProperty(object, property);
1200
+ if (isPropertyExist) {
1201
+ if (arrayIsArray(value)) {
1202
+ newObject[property] = cleanArray(value);
1203
+ } else if (value && typeof value === "object" && value.constructor === Object) {
1204
+ newObject[property] = clone(value);
1205
+ } else {
1206
+ newObject[property] = value;
1207
+ }
1208
+ }
1209
+ }
1210
+ return newObject;
1211
+ }
1212
+ function stringifyValue(value) {
1213
+ switch (typeof value) {
1214
+ case "string": {
1215
+ return value;
1216
+ }
1217
+ case "number": {
1218
+ return numberToString(value);
1219
+ }
1220
+ case "boolean": {
1221
+ return booleanToString(value);
1222
+ }
1223
+ case "bigint": {
1224
+ return bigintToString ? bigintToString(value) : "0";
1225
+ }
1226
+ case "symbol": {
1227
+ return symbolToString ? symbolToString(value) : "Symbol()";
1228
+ }
1229
+ case "undefined": {
1230
+ return objectToString(value);
1231
+ }
1232
+ case "function":
1233
+ case "object": {
1234
+ if (value === null) {
1235
+ return objectToString(value);
1236
+ }
1237
+ const valueAsRecord = value;
1238
+ const valueToString = lookupGetter(valueAsRecord, "toString");
1239
+ if (typeof valueToString === "function") {
1240
+ const stringified = valueToString(valueAsRecord);
1241
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
1242
+ }
1243
+ return objectToString(value);
1244
+ }
1245
+ default: {
1246
+ return objectToString(value);
1247
+ }
1248
+ }
1249
+ }
1250
+ function lookupGetter(object, prop) {
1251
+ while (object !== null) {
1252
+ const desc = getOwnPropertyDescriptor(object, prop);
1253
+ if (desc) {
1254
+ if (desc.get) {
1255
+ return unapply(desc.get);
1256
+ }
1257
+ if (typeof desc.value === "function") {
1258
+ return unapply(desc.value);
1259
+ }
1260
+ }
1261
+ object = getPrototypeOf(object);
1262
+ }
1263
+ function fallbackValue() {
1264
+ return null;
1265
+ }
1266
+ return fallbackValue;
1267
+ }
1268
+ function isRegex(value) {
1269
+ try {
1270
+ regExpTest(value, "");
1271
+ return true;
1272
+ } catch (_unused) {
1273
+ return false;
1274
+ }
1275
+ }
1276
+ var html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
1277
+ var 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"]);
1278
+ var 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"]);
1279
+ var 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"]);
1280
+ var 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"]);
1281
+ var mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
1282
+ var text = freeze(["#text"]);
1283
+ var html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]);
1284
+ var svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dominant-baseline", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-orientation", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "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"]);
1285
+ var 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"]);
1286
+ var xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
1287
+ var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
1288
+ var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
1289
+ var TMPLIT_EXPR = seal(/\${[\w\W]*/g);
1290
+ var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
1291
+ var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
1292
+ var IS_ALLOWED_URI = seal(
1293
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
1294
+ // eslint-disable-line no-useless-escape
1295
+ );
1296
+ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
1297
+ var ATTR_WHITESPACE = seal(
1298
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
1299
+ // eslint-disable-line no-control-regex
1300
+ );
1301
+ var DOCTYPE_NAME = seal(/^html$/i);
1302
+ var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
1303
+ var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
1304
+ var COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
1305
+ var FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
1306
+ var SELF_CLOSING_TAG = seal(/\/>/i);
1307
+ var NODE_TYPE = {
1308
+ element: 1,
1309
+ attribute: 2,
1310
+ text: 3,
1311
+ cdataSection: 4,
1312
+ entityReference: 5,
1313
+ // Deprecated
1314
+ entityNode: 6,
1315
+ // Deprecated
1316
+ processingInstruction: 7,
1317
+ comment: 8,
1318
+ document: 9,
1319
+ documentType: 10,
1320
+ documentFragment: 11,
1321
+ notation: 12
1322
+ // Deprecated
1323
+ };
1324
+ var getGlobal = function getGlobal2() {
1325
+ return typeof window === "undefined" ? null : window;
1326
+ };
1327
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
1328
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
1329
+ return null;
1330
+ }
1331
+ let suffix = null;
1332
+ const ATTR_NAME = "data-tt-policy-suffix";
1333
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
1334
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
1335
+ }
1336
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
1337
+ try {
1338
+ return trustedTypes.createPolicy(policyName, {
1339
+ createHTML(html2) {
1340
+ return html2;
1341
+ },
1342
+ createScriptURL(scriptUrl) {
1343
+ return scriptUrl;
1344
+ }
1345
+ });
1346
+ } catch (_2) {
1347
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
1348
+ return null;
1349
+ }
1350
+ };
1351
+ var _createHooksMap = function _createHooksMap2() {
1352
+ return {
1353
+ afterSanitizeAttributes: [],
1354
+ afterSanitizeElements: [],
1355
+ afterSanitizeShadowDOM: [],
1356
+ beforeSanitizeAttributes: [],
1357
+ beforeSanitizeElements: [],
1358
+ beforeSanitizeShadowDOM: [],
1359
+ uponSanitizeAttribute: [],
1360
+ uponSanitizeElement: [],
1361
+ uponSanitizeShadowNode: []
1362
+ };
1363
+ };
1364
+ var _resolveSetOption = function _resolveSetOption2(cfg, key, fallback, options) {
1365
+ return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
1366
+ };
1367
+ function createDOMPurify() {
1368
+ let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
1369
+ const DOMPurify = (root) => createDOMPurify(root);
1370
+ DOMPurify.version = "3.4.13";
1371
+ DOMPurify.removed = [];
1372
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
1373
+ DOMPurify.isSupported = false;
1374
+ return DOMPurify;
1375
+ }
1376
+ let document = window2.document;
1377
+ const originalDocument = document;
1378
+ const currentScript = originalDocument.currentScript;
1379
+ window2.DocumentFragment;
1380
+ const HTMLTemplateElement = window2.HTMLTemplateElement, Node = window2.Node, Element = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap;
1381
+ _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap;
1382
+ window2.HTMLFormElement;
1383
+ const DOMParser = window2.DOMParser, trustedTypes = window2.trustedTypes;
1384
+ const ElementPrototype = Element.prototype;
1385
+ const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
1386
+ const remove = lookupGetter(ElementPrototype, "remove");
1387
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
1388
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
1389
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
1390
+ const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
1391
+ const getAttributes = lookupGetter(ElementPrototype, "attributes");
1392
+ const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
1393
+ const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
1394
+ const getOwnerDocument = Node && Node.prototype ? lookupGetter(Node.prototype, "ownerDocument") : null;
1395
+ if (typeof HTMLTemplateElement === "function") {
1396
+ const template = document.createElement("template");
1397
+ if (template.content && template.content.ownerDocument) {
1398
+ document = template.content.ownerDocument;
1399
+ }
1400
+ }
1401
+ let trustedTypesPolicy;
1402
+ let emptyHTML = "";
1403
+ let defaultTrustedTypesPolicy;
1404
+ let defaultTrustedTypesPolicyResolved = false;
1405
+ let IN_TRUSTED_TYPES_POLICY = 0;
1406
+ const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy2() {
1407
+ if (IN_TRUSTED_TYPES_POLICY > 0) {
1408
+ throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
1409
+ }
1410
+ };
1411
+ const _createTrustedHTML = function _createTrustedHTML2(html2) {
1412
+ _assertNotInTrustedTypesPolicy();
1413
+ IN_TRUSTED_TYPES_POLICY++;
1414
+ try {
1415
+ return trustedTypesPolicy.createHTML(html2);
1206
1416
  } finally {
1207
- setRootBusy(false);
1417
+ IN_TRUSTED_TYPES_POLICY--;
1208
1418
  }
1209
1419
  };
1210
- const doRemoveRoot = async () => {
1211
- if (confirmRootId === null) return;
1212
- setRootBusy(true);
1420
+ const _createTrustedScriptURL = function _createTrustedScriptURL2(scriptUrl) {
1421
+ _assertNotInTrustedTypesPolicy();
1422
+ IN_TRUSTED_TYPES_POLICY++;
1213
1423
  try {
1214
- await injected.removeRoot(confirmRootId);
1215
- setOutcome({ ok: true, text: t("rootRemoved") });
1216
- setRoots(null);
1217
- void injected.roots().then(
1218
- (body) => setRoots(body.roots),
1219
- () => setRoots([])
1220
- );
1221
- setReload((value) => value + 1);
1222
- } catch (error) {
1223
- setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
1424
+ return trustedTypesPolicy.createScriptURL(scriptUrl);
1224
1425
  } finally {
1225
- setRootBusy(false);
1226
- setConfirmRootId(null);
1426
+ IN_TRUSTED_TYPES_POLICY--;
1227
1427
  }
1228
1428
  };
1229
- const readOnly = editor?.mode === "view";
1230
- const needle = query.trim().toLowerCase();
1231
- const filtered = skills === null ? [] : skills.filter((skill) => (sourceFilter === "all" || skill.source === sourceFilter) && (needle === "" || skill.name.toLowerCase().includes(needle) || skill.description.toLowerCase().includes(needle)));
1232
- const sources = skills === null ? [] : [...new Set(skills.map((skill) => skill.source))];
1233
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-section", children: [
1234
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: CSS }),
1235
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-head", children: [
1236
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.IconSkillOutline16, { "aria-hidden": "true" }),
1237
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: t("skillsTitle") }),
1238
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-spacer" }),
1239
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", onClick: () => void doOpen({ target: "user-skills" }), children: t("openUserSkills") }),
1240
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", size: "sm", onClick: openCreate, children: t("newSkill") })
1241
- ] }),
1242
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-intro", children: t("skillsIntro") }),
1243
- outcome !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-banner", "data-kind": outcome.ok ? "ok" : "error", role: "status", children: [
1244
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.StateDot, { state: outcome.ok ? "done" : "error", size: 10 }),
1245
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dpc-bannerBody", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: outcome.text }) })
1246
- ] }),
1247
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-listHead", children: [
1248
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: t("skillsTab") }),
1249
- skills !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "dpc-count", children: [
1250
- filtered.length,
1251
- "/",
1252
- skills.length
1429
+ const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy2() {
1430
+ if (!defaultTrustedTypesPolicyResolved) {
1431
+ defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
1432
+ defaultTrustedTypesPolicyResolved = true;
1433
+ }
1434
+ return defaultTrustedTypesPolicy;
1435
+ };
1436
+ const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
1437
+ const importNode = originalDocument.importNode;
1438
+ let hooks = _createHooksMap();
1439
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
1440
+ 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;
1441
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
1442
+ let ALLOWED_TAGS = null;
1443
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
1444
+ let ALLOWED_ATTR = null;
1445
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
1446
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
1447
+ tagNameCheck: {
1448
+ writable: true,
1449
+ configurable: false,
1450
+ enumerable: true,
1451
+ value: null
1452
+ },
1453
+ attributeNameCheck: {
1454
+ writable: true,
1455
+ configurable: false,
1456
+ enumerable: true,
1457
+ value: null
1458
+ },
1459
+ allowCustomizedBuiltInElements: {
1460
+ writable: true,
1461
+ configurable: false,
1462
+ enumerable: true,
1463
+ value: false
1464
+ }
1465
+ }));
1466
+ let FORBID_TAGS = null;
1467
+ let FORBID_ATTR = null;
1468
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
1469
+ tagCheck: {
1470
+ writable: true,
1471
+ configurable: false,
1472
+ enumerable: true,
1473
+ value: null
1474
+ },
1475
+ attributeCheck: {
1476
+ writable: true,
1477
+ configurable: false,
1478
+ enumerable: true,
1479
+ value: null
1480
+ }
1481
+ }));
1482
+ let ALLOW_ARIA_ATTR = true;
1483
+ let ALLOW_DATA_ATTR = true;
1484
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
1485
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
1486
+ let SAFE_FOR_TEMPLATES = false;
1487
+ let SAFE_FOR_XML = true;
1488
+ let WHOLE_DOCUMENT = false;
1489
+ let SET_CONFIG = false;
1490
+ let SET_CONFIG_ALLOWED_TAGS = null;
1491
+ let SET_CONFIG_ALLOWED_ATTR = null;
1492
+ let FORCE_BODY = false;
1493
+ let RETURN_DOM = false;
1494
+ let RETURN_DOM_FRAGMENT = false;
1495
+ let RETURN_TRUSTED_TYPE = false;
1496
+ let SANITIZE_DOM = true;
1497
+ let SANITIZE_NAMED_PROPS = false;
1498
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
1499
+ let KEEP_CONTENT = true;
1500
+ let IN_PLACE = false;
1501
+ let USE_PROFILES = {};
1502
+ let FORBID_CONTENTS = null;
1503
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, [
1504
+ "annotation-xml",
1505
+ "audio",
1506
+ "colgroup",
1507
+ "desc",
1508
+ "foreignobject",
1509
+ "head",
1510
+ "iframe",
1511
+ "math",
1512
+ "mi",
1513
+ "mn",
1514
+ "mo",
1515
+ "ms",
1516
+ "mtext",
1517
+ "noembed",
1518
+ "noframes",
1519
+ "noscript",
1520
+ "plaintext",
1521
+ "script",
1522
+ // <selectedcontent> mirrors the selected <option>'s subtree, cloned by
1523
+ // the UA (customizable <select>) — including any on* handlers — and the
1524
+ // engine re-mirrors synchronously whenever a removal changes which
1525
+ // option/selectedcontent is current, even inside DOMPurify's inert
1526
+ // DOMParser document. Hoisting its children on removal re-inserts a fresh
1527
+ // mirror target ahead of the walk, which the engine refills, looping
1528
+ // forever (DoS) and amplifying output. Dropping its content on removal
1529
+ // (rather than hoisting) breaks that cascade; the content is a duplicate
1530
+ // of the option, which is sanitized on its own. See campaign-3 F1/F6.
1531
+ "selectedcontent",
1532
+ "style",
1533
+ "svg",
1534
+ "template",
1535
+ "thead",
1536
+ "title",
1537
+ "video",
1538
+ "xmp"
1539
+ ]);
1540
+ let DATA_URI_TAGS = null;
1541
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
1542
+ let URI_SAFE_ATTRIBUTES = null;
1543
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
1544
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
1545
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
1546
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
1547
+ let NAMESPACE = HTML_NAMESPACE;
1548
+ let IS_EMPTY_INPUT = false;
1549
+ let ALLOWED_NAMESPACES = null;
1550
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
1551
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze(["mi", "mo", "mn", "ms", "mtext"]);
1552
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
1553
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
1554
+ let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
1555
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
1556
+ let PARSER_MEDIA_TYPE = null;
1557
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
1558
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
1559
+ let transformCaseFunc = null;
1560
+ let CONFIG = null;
1561
+ const formElement = document.createElement("form");
1562
+ const isRegexOrFunction = function isRegexOrFunction2(testValue) {
1563
+ return testValue instanceof RegExp || testValue instanceof Function;
1564
+ };
1565
+ const _parseConfig = function _parseConfig2() {
1566
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1567
+ if (CONFIG && CONFIG === cfg) {
1568
+ return;
1569
+ }
1570
+ if (!cfg || typeof cfg !== "object") {
1571
+ cfg = {};
1572
+ }
1573
+ cfg = clone(cfg);
1574
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
1575
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
1576
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
1577
+ ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, {
1578
+ transform: transformCaseFunc
1579
+ });
1580
+ ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, {
1581
+ transform: transformCaseFunc
1582
+ });
1583
+ ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, {
1584
+ transform: stringToString
1585
+ });
1586
+ URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
1587
+ transform: transformCaseFunc,
1588
+ base: DEFAULT_URI_SAFE_ATTRIBUTES
1589
+ });
1590
+ DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
1591
+ transform: transformCaseFunc,
1592
+ base: DEFAULT_DATA_URI_TAGS
1593
+ });
1594
+ FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, {
1595
+ transform: transformCaseFunc
1596
+ });
1597
+ FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), {
1598
+ transform: transformCaseFunc
1599
+ });
1600
+ FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), {
1601
+ transform: transformCaseFunc
1602
+ });
1603
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
1604
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
1605
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
1606
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
1607
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
1608
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
1609
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
1610
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
1611
+ RETURN_DOM = cfg.RETURN_DOM || false;
1612
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
1613
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
1614
+ FORCE_BODY = cfg.FORCE_BODY || false;
1615
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
1616
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
1617
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
1618
+ IN_PLACE = cfg.IN_PLACE || false;
1619
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
1620
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
1621
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
1622
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
1623
+ const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
1624
+ CUSTOM_ELEMENT_HANDLING = create(null);
1625
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
1626
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
1627
+ }
1628
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
1629
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
1630
+ }
1631
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
1632
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
1633
+ }
1634
+ seal(CUSTOM_ELEMENT_HANDLING);
1635
+ if (SAFE_FOR_TEMPLATES) {
1636
+ ALLOW_DATA_ATTR = false;
1637
+ }
1638
+ if (RETURN_DOM_FRAGMENT) {
1639
+ RETURN_DOM = true;
1640
+ }
1641
+ if (USE_PROFILES) {
1642
+ ALLOWED_TAGS = addToSet({}, text);
1643
+ ALLOWED_ATTR = create(null);
1644
+ if (USE_PROFILES.html === true) {
1645
+ addToSet(ALLOWED_TAGS, html$1);
1646
+ addToSet(ALLOWED_ATTR, html);
1647
+ }
1648
+ if (USE_PROFILES.svg === true) {
1649
+ addToSet(ALLOWED_TAGS, svg$1);
1650
+ addToSet(ALLOWED_ATTR, svg);
1651
+ addToSet(ALLOWED_ATTR, xml);
1652
+ }
1653
+ if (USE_PROFILES.svgFilters === true) {
1654
+ addToSet(ALLOWED_TAGS, svgFilters);
1655
+ addToSet(ALLOWED_ATTR, svg);
1656
+ addToSet(ALLOWED_ATTR, xml);
1657
+ }
1658
+ if (USE_PROFILES.mathMl === true) {
1659
+ addToSet(ALLOWED_TAGS, mathMl$1);
1660
+ addToSet(ALLOWED_ATTR, mathMl);
1661
+ addToSet(ALLOWED_ATTR, xml);
1662
+ }
1663
+ }
1664
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
1665
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
1666
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
1667
+ if (typeof cfg.ADD_TAGS === "function") {
1668
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
1669
+ } else if (arrayIsArray(cfg.ADD_TAGS)) {
1670
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
1671
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
1672
+ }
1673
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
1674
+ }
1675
+ }
1676
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
1677
+ if (typeof cfg.ADD_ATTR === "function") {
1678
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
1679
+ } else if (arrayIsArray(cfg.ADD_ATTR)) {
1680
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
1681
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
1682
+ }
1683
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
1684
+ }
1685
+ }
1686
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
1687
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
1688
+ }
1689
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
1690
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
1691
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
1692
+ }
1693
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
1694
+ }
1695
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
1696
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
1697
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
1698
+ }
1699
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
1700
+ }
1701
+ if (KEEP_CONTENT) {
1702
+ ALLOWED_TAGS["#text"] = true;
1703
+ }
1704
+ if (WHOLE_DOCUMENT) {
1705
+ addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
1706
+ }
1707
+ if (ALLOWED_TAGS.table) {
1708
+ addToSet(ALLOWED_TAGS, ["tbody"]);
1709
+ delete FORBID_TAGS.tbody;
1710
+ }
1711
+ if (cfg.TRUSTED_TYPES_POLICY) {
1712
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
1713
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
1714
+ }
1715
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
1716
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
1717
+ }
1718
+ const previousTrustedTypesPolicy = trustedTypesPolicy;
1719
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
1720
+ try {
1721
+ emptyHTML = _createTrustedHTML("");
1722
+ } catch (error) {
1723
+ trustedTypesPolicy = previousTrustedTypesPolicy;
1724
+ throw error;
1725
+ }
1726
+ } else if (cfg.TRUSTED_TYPES_POLICY === null) {
1727
+ trustedTypesPolicy = void 0;
1728
+ emptyHTML = "";
1729
+ } else {
1730
+ if (trustedTypesPolicy === void 0) {
1731
+ trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
1732
+ }
1733
+ if (trustedTypesPolicy && typeof emptyHTML === "string") {
1734
+ emptyHTML = _createTrustedHTML("");
1735
+ }
1736
+ }
1737
+ if (freeze) {
1738
+ freeze(cfg);
1739
+ }
1740
+ CONFIG = cfg;
1741
+ };
1742
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
1743
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
1744
+ const _checkSvgNamespace = function _checkSvgNamespace2(tagName, parent, parentTagName) {
1745
+ if (parent.namespaceURI === HTML_NAMESPACE) {
1746
+ return tagName === "svg";
1747
+ }
1748
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
1749
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
1750
+ }
1751
+ return Boolean(ALL_SVG_TAGS[tagName]);
1752
+ };
1753
+ const _checkMathMlNamespace = function _checkMathMlNamespace2(tagName, parent, parentTagName) {
1754
+ if (parent.namespaceURI === HTML_NAMESPACE) {
1755
+ return tagName === "math";
1756
+ }
1757
+ if (parent.namespaceURI === SVG_NAMESPACE) {
1758
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
1759
+ }
1760
+ return Boolean(ALL_MATHML_TAGS[tagName]);
1761
+ };
1762
+ const _checkHtmlNamespace = function _checkHtmlNamespace2(tagName, parent, parentTagName) {
1763
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
1764
+ return false;
1765
+ }
1766
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
1767
+ return false;
1768
+ }
1769
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
1770
+ };
1771
+ const _checkValidNamespace = function _checkValidNamespace2(element) {
1772
+ let parent = getParentNode(element);
1773
+ if (!parent || !parent.tagName) {
1774
+ parent = {
1775
+ namespaceURI: NAMESPACE,
1776
+ tagName: "template"
1777
+ };
1778
+ }
1779
+ const tagName = stringToLowerCase(element.tagName);
1780
+ const parentTagName = stringToLowerCase(parent.tagName);
1781
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
1782
+ return false;
1783
+ }
1784
+ if (element.namespaceURI === SVG_NAMESPACE) {
1785
+ return _checkSvgNamespace(tagName, parent, parentTagName);
1786
+ }
1787
+ if (element.namespaceURI === MATHML_NAMESPACE) {
1788
+ return _checkMathMlNamespace(tagName, parent, parentTagName);
1789
+ }
1790
+ if (element.namespaceURI === HTML_NAMESPACE) {
1791
+ return _checkHtmlNamespace(tagName, parent, parentTagName);
1792
+ }
1793
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
1794
+ return true;
1795
+ }
1796
+ return false;
1797
+ };
1798
+ const _forceRemove = function _forceRemove2(node) {
1799
+ arrayPush(DOMPurify.removed, {
1800
+ element: node
1801
+ });
1802
+ try {
1803
+ getParentNode(node).removeChild(node);
1804
+ } catch (_2) {
1805
+ remove(node);
1806
+ if (!getParentNode(node)) {
1807
+ throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
1808
+ }
1809
+ }
1810
+ };
1811
+ const _neutralizeRoot = function _neutralizeRoot2(root) {
1812
+ _neutralizeSubtree(root);
1813
+ const childNodes = getChildNodes(root);
1814
+ if (childNodes) {
1815
+ const snapshot = [];
1816
+ arrayForEach(childNodes, (child) => {
1817
+ arrayPush(snapshot, child);
1818
+ });
1819
+ arrayForEach(snapshot, (child) => {
1820
+ try {
1821
+ remove(child);
1822
+ } catch (_2) {
1823
+ }
1824
+ });
1825
+ }
1826
+ const attributes = getAttributes(root);
1827
+ if (attributes) {
1828
+ for (let i = attributes.length - 1; i >= 0; --i) {
1829
+ const attribute = attributes[i];
1830
+ const name2 = attribute && attribute.name;
1831
+ if (typeof name2 === "string") {
1832
+ try {
1833
+ root.removeAttribute(name2);
1834
+ } catch (_2) {
1835
+ }
1836
+ }
1837
+ }
1838
+ }
1839
+ };
1840
+ const _removeAttribute = function _removeAttribute2(name2, element) {
1841
+ try {
1842
+ arrayPush(DOMPurify.removed, {
1843
+ attribute: element.getAttributeNode(name2),
1844
+ from: element
1845
+ });
1846
+ } catch (_2) {
1847
+ arrayPush(DOMPurify.removed, {
1848
+ attribute: null,
1849
+ from: element
1850
+ });
1851
+ }
1852
+ element.removeAttribute(name2);
1853
+ if (name2 === "is") {
1854
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
1855
+ try {
1856
+ _forceRemove(element);
1857
+ } catch (_2) {
1858
+ }
1859
+ } else {
1860
+ try {
1861
+ element.setAttribute(name2, "");
1862
+ } catch (_2) {
1863
+ }
1864
+ }
1865
+ }
1866
+ };
1867
+ const _stripDisallowedAttributes = function _stripDisallowedAttributes2(element) {
1868
+ const attributes = getAttributes(element);
1869
+ if (!attributes) {
1870
+ return;
1871
+ }
1872
+ for (let i = attributes.length - 1; i >= 0; --i) {
1873
+ const attribute = attributes[i];
1874
+ const name2 = attribute && attribute.name;
1875
+ if (typeof name2 !== "string" || ALLOWED_ATTR[transformCaseFunc(name2)]) {
1876
+ continue;
1877
+ }
1878
+ try {
1879
+ element.removeAttribute(name2);
1880
+ } catch (_2) {
1881
+ }
1882
+ }
1883
+ };
1884
+ const _neutralizeSubtree = function _neutralizeSubtree2(root) {
1885
+ const stack = [root];
1886
+ while (stack.length > 0) {
1887
+ const node = stack.pop();
1888
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
1889
+ if (nodeType === NODE_TYPE.element) {
1890
+ _stripDisallowedAttributes(node);
1891
+ }
1892
+ const childNodes = getChildNodes(node);
1893
+ if (childNodes) {
1894
+ for (let i = childNodes.length - 1; i >= 0; --i) {
1895
+ stack.push(childNodes[i]);
1896
+ }
1897
+ }
1898
+ }
1899
+ };
1900
+ const _neutralizePatchLinkage = function _neutralizePatchLinkage2(root) {
1901
+ if (!SAFE_FOR_XML) {
1902
+ return;
1903
+ }
1904
+ const stack = [root];
1905
+ while (stack.length > 0) {
1906
+ const node = stack.pop();
1907
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
1908
+ if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
1909
+ try {
1910
+ remove(node);
1911
+ } catch (_2) {
1912
+ }
1913
+ continue;
1914
+ }
1915
+ if (nodeType === NODE_TYPE.element) {
1916
+ const element = node;
1917
+ const lcTag = transformCaseFunc(getNodeName ? getNodeName(node) : node.nodeName);
1918
+ try {
1919
+ if (element.hasAttribute && element.hasAttribute("patchsrc")) {
1920
+ element.removeAttribute("patchsrc");
1921
+ }
1922
+ if (element.hasAttribute && element.hasAttribute("for") && lcTag !== "label" && lcTag !== "output") {
1923
+ element.removeAttribute("for");
1924
+ }
1925
+ } catch (_2) {
1926
+ }
1927
+ }
1928
+ const childNodes = getChildNodes(node);
1929
+ if (childNodes) {
1930
+ for (let i = childNodes.length - 1; i >= 0; --i) {
1931
+ stack.push(childNodes[i]);
1932
+ }
1933
+ }
1934
+ }
1935
+ };
1936
+ const _initDocument = function _initDocument2(dirty) {
1937
+ let doc = null;
1938
+ let leadingWhitespace = null;
1939
+ if (FORCE_BODY) {
1940
+ dirty = "<remove></remove>" + dirty;
1941
+ } else {
1942
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
1943
+ leadingWhitespace = matches && matches[0];
1944
+ }
1945
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
1946
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
1947
+ }
1948
+ const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
1949
+ if (NAMESPACE === HTML_NAMESPACE) {
1950
+ try {
1951
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1952
+ } catch (_2) {
1953
+ }
1954
+ }
1955
+ if (!doc || !doc.documentElement) {
1956
+ doc = implementation.createDocument(NAMESPACE, "template", null);
1957
+ try {
1958
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
1959
+ } catch (_2) {
1960
+ }
1961
+ }
1962
+ const body = doc.body || doc.documentElement;
1963
+ if (dirty && leadingWhitespace) {
1964
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1965
+ }
1966
+ if (NAMESPACE === HTML_NAMESPACE) {
1967
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
1968
+ }
1969
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
1970
+ };
1971
+ const _createNodeIterator = function _createNodeIterator2(root) {
1972
+ const doc = getOwnerDocument ? getOwnerDocument(root) : root.ownerDocument;
1973
+ return createNodeIterator.call(
1974
+ doc || root,
1975
+ root,
1976
+ // eslint-disable-next-line no-bitwise
1977
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
1978
+ null
1979
+ );
1980
+ };
1981
+ const _stripTemplateExpressions = function _stripTemplateExpressions2(value) {
1982
+ value = stringReplace(value, MUSTACHE_EXPR$1, " ");
1983
+ value = stringReplace(value, ERB_EXPR$1, " ");
1984
+ value = stringReplace(value, TMPLIT_EXPR$1, " ");
1985
+ return value;
1986
+ };
1987
+ const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
1988
+ var _node$querySelectorAl;
1989
+ node.normalize();
1990
+ const doc = getOwnerDocument ? getOwnerDocument(node) : node.ownerDocument;
1991
+ const walker = createNodeIterator.call(
1992
+ doc || node,
1993
+ node,
1994
+ // eslint-disable-next-line no-bitwise
1995
+ NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION,
1996
+ null
1997
+ );
1998
+ let currentNode = walker.nextNode();
1999
+ while (currentNode) {
2000
+ currentNode.data = _stripTemplateExpressions(currentNode.data);
2001
+ currentNode = walker.nextNode();
2002
+ }
2003
+ const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
2004
+ if (templates) {
2005
+ arrayForEach(templates, (tmpl) => {
2006
+ if (_isDocumentFragment(tmpl.content)) {
2007
+ _scrubTemplateExpressions2(tmpl.content);
2008
+ }
2009
+ });
2010
+ }
2011
+ };
2012
+ const _isClobbered = function _isClobbered2(element) {
2013
+ const realTagName = getNodeName ? getNodeName(element) : null;
2014
+ if (typeof realTagName !== "string") {
2015
+ return false;
2016
+ }
2017
+ if (transformCaseFunc(realTagName) !== "form") {
2018
+ return false;
2019
+ }
2020
+ return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || // Realm-safe NamedNodeMap detection: equality against the cached
2021
+ // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
2022
+ // makes the direct read diverge from the cached read; a clean form
2023
+ // (same-realm OR foreign-realm) has both reads pointing at the same
2024
+ // canonical NamedNodeMap.
2025
+ element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
2026
+ // returns the integer 1 for any Element regardless of realm; direct
2027
+ // read on a clobbered form (e.g. <input name="nodeType">) returns
2028
+ // the named child element. Cheap addition — nodeType is read from
2029
+ // an internal slot, no serialization cost — and removes a residual
2030
+ // clobbering surface used by several mXSS / PI / comment branches
2031
+ // in _sanitizeElements that compare currentNode.nodeType directly.
2032
+ element.nodeType !== getNodeType(element) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
2033
+ // "childNodes" shadows the prototype getter. Direct reads of
2034
+ // form.childNodes from a clobbered form return the named child
2035
+ // instead of the real NodeList, so any walk that reads it directly
2036
+ // skips the form's real children. Compare the direct read to the
2037
+ // cached Node.prototype getter — when the form's named-property
2038
+ // getter intercepts the read, the two values differ and we flag
2039
+ // the form. This catches every clobbering child type (input,
2040
+ // select, etc.) regardless of whether the named child happens to
2041
+ // carry a numeric .length, which a typeof-based probe would miss
2042
+ // (e.g. HTMLSelectElement.length is a defined unsigned-long).
2043
+ element.childNodes !== getChildNodes(element);
2044
+ };
2045
+ const _isDocumentFragment = function _isDocumentFragment2(value) {
2046
+ if (!getNodeType || typeof value !== "object" || value === null) {
2047
+ return false;
2048
+ }
2049
+ try {
2050
+ return getNodeType(value) === NODE_TYPE.documentFragment;
2051
+ } catch (_2) {
2052
+ return false;
2053
+ }
2054
+ };
2055
+ const _isNode = function _isNode2(value) {
2056
+ if (!getNodeType || typeof value !== "object" || value === null) {
2057
+ return false;
2058
+ }
2059
+ try {
2060
+ return typeof getNodeType(value) === "number";
2061
+ } catch (_2) {
2062
+ return false;
2063
+ }
2064
+ };
2065
+ function _executeHooks(hooks2, currentNode, data) {
2066
+ if (hooks2.length === 0) {
2067
+ return;
2068
+ }
2069
+ arrayForEach(hooks2, (hook) => {
2070
+ hook.call(DOMPurify, currentNode, data, CONFIG);
2071
+ });
2072
+ }
2073
+ const _isUnsafeNode = function _isUnsafeNode2(currentNode, tagName) {
2074
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) {
2075
+ return true;
2076
+ }
2077
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
2078
+ return true;
2079
+ }
2080
+ if (currentNode.nodeType === NODE_TYPE.processingInstruction) {
2081
+ return true;
2082
+ }
2083
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) {
2084
+ return true;
2085
+ }
2086
+ return false;
2087
+ };
2088
+ const _sanitizeDisallowedNode = function _sanitizeDisallowedNode2(currentNode, tagName, root) {
2089
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
2090
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
2091
+ return false;
2092
+ }
2093
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
2094
+ return false;
2095
+ }
2096
+ }
2097
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
2098
+ const parentNode = getParentNode(currentNode);
2099
+ const childNodes = getChildNodes(currentNode);
2100
+ if (childNodes && parentNode) {
2101
+ const childCount = childNodes.length;
2102
+ for (let i = childCount - 1; i >= 0; --i) {
2103
+ const hoisted = currentNode === root ? cloneNode(childNodes[i], true) : childNodes[i];
2104
+ parentNode.insertBefore(hoisted, getNextSibling(currentNode));
2105
+ }
2106
+ }
2107
+ }
2108
+ _forceRemove(currentNode);
2109
+ return true;
2110
+ };
2111
+ const _forkSharedAllowlist = function _forkSharedAllowlist2(hookList, set, defaultSet, setConfigSet) {
2112
+ if (hookList.length === 0) {
2113
+ return set;
2114
+ }
2115
+ return set === defaultSet || set === setConfigSet ? clone(set) : set;
2116
+ };
2117
+ const _sanitizeElements = function _sanitizeElements2(currentNode, root) {
2118
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
2119
+ if (currentNode !== root && getParentNode(currentNode) === null) {
2120
+ if (IN_PLACE) {
2121
+ _neutralizeSubtree(currentNode);
2122
+ }
2123
+ return true;
2124
+ }
2125
+ if (_isClobbered(currentNode)) {
2126
+ _forceRemove(currentNode);
2127
+ return true;
2128
+ }
2129
+ const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
2130
+ ALLOWED_TAGS = _forkSharedAllowlist(hooks.uponSanitizeElement, ALLOWED_TAGS, DEFAULT_ALLOWED_TAGS, SET_CONFIG_ALLOWED_TAGS);
2131
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
2132
+ tagName,
2133
+ allowedTags: ALLOWED_TAGS
2134
+ });
2135
+ if (currentNode !== root && getParentNode(currentNode) === null) {
2136
+ if (IN_PLACE) {
2137
+ _neutralizeSubtree(currentNode);
2138
+ }
2139
+ return true;
2140
+ }
2141
+ if (_isUnsafeNode(currentNode, tagName)) {
2142
+ _forceRemove(currentNode);
2143
+ return true;
2144
+ }
2145
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
2146
+ const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
2147
+ if (removed === false) {
2148
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
2149
+ }
2150
+ return removed;
2151
+ }
2152
+ const nt2 = getNodeType ? getNodeType(currentNode) : currentNode.nodeType;
2153
+ if (nt2 === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
2154
+ _forceRemove(currentNode);
2155
+ return true;
2156
+ }
2157
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
2158
+ _forceRemove(currentNode);
2159
+ return true;
2160
+ }
2161
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
2162
+ const content = _stripTemplateExpressions(currentNode.textContent);
2163
+ if (currentNode.textContent !== content) {
2164
+ arrayPush(DOMPurify.removed, {
2165
+ element: currentNode.cloneNode()
2166
+ });
2167
+ currentNode.textContent = content;
2168
+ }
2169
+ }
2170
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
2171
+ return false;
2172
+ };
2173
+ const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
2174
+ if (FORBID_ATTR[lcName]) {
2175
+ return false;
2176
+ }
2177
+ if (SAFE_FOR_XML && lcName === "patchsrc") {
2178
+ return false;
2179
+ }
2180
+ if (SAFE_FOR_XML && lcName === "for" && lcTag !== "label" && lcTag !== "output") {
2181
+ return false;
2182
+ }
2183
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) {
2184
+ return false;
2185
+ }
2186
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
2187
+ if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) ;
2188
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;
2189
+ else if (!nameIsPermitted) {
2190
+ if (
2191
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
2192
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2193
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
2194
+ _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
2195
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2196
+ 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))
2197
+ ) ;
2198
+ else {
2199
+ return false;
2200
+ }
2201
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
2202
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
2203
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
2204
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
2205
+ else if (value) {
2206
+ return false;
2207
+ } else ;
2208
+ return true;
2209
+ };
2210
+ 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"]);
2211
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
2212
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
2213
+ };
2214
+ const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute2(lcTag, lcName, namespaceURI, value) {
2215
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) {
2216
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
2217
+ case "TrustedHTML": {
2218
+ return _createTrustedHTML(value);
2219
+ }
2220
+ case "TrustedScriptURL": {
2221
+ return _createTrustedScriptURL(value);
2222
+ }
2223
+ }
2224
+ }
2225
+ return value;
2226
+ };
2227
+ const _setAttributeValue = function _setAttributeValue2(currentNode, name2, namespaceURI, value) {
2228
+ try {
2229
+ if (namespaceURI) {
2230
+ currentNode.setAttributeNS(namespaceURI, name2, value);
2231
+ } else {
2232
+ currentNode.setAttribute(name2, value);
2233
+ }
2234
+ if (_isClobbered(currentNode)) {
2235
+ _forceRemove(currentNode);
2236
+ } else {
2237
+ arrayPop(DOMPurify.removed);
2238
+ }
2239
+ } catch (_2) {
2240
+ _removeAttribute(name2, currentNode);
2241
+ }
2242
+ };
2243
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
2244
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
2245
+ const attributes = currentNode.attributes;
2246
+ if (!attributes || _isClobbered(currentNode)) {
2247
+ return;
2248
+ }
2249
+ ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
2250
+ const hookEvent = {
2251
+ attrName: "",
2252
+ attrValue: "",
2253
+ keepAttr: true,
2254
+ allowedAttributes: ALLOWED_ATTR,
2255
+ forceKeepAttr: void 0
2256
+ };
2257
+ let l3 = attributes.length;
2258
+ const lcTag = transformCaseFunc(currentNode.nodeName);
2259
+ while (l3--) {
2260
+ const attr = attributes[l3];
2261
+ const name2 = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
2262
+ const lcName = transformCaseFunc(name2);
2263
+ const initValue = attrValue;
2264
+ let value = name2 === "value" ? initValue : stringTrim(initValue);
2265
+ hookEvent.attrName = lcName;
2266
+ hookEvent.attrValue = value;
2267
+ hookEvent.keepAttr = true;
2268
+ hookEvent.forceKeepAttr = void 0;
2269
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
2270
+ value = hookEvent.attrValue;
2271
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
2272
+ _removeAttribute(name2, currentNode);
2273
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
2274
+ }
2275
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
2276
+ _removeAttribute(name2, currentNode);
2277
+ continue;
2278
+ }
2279
+ if (lcName === "attributename" && stringMatch(value, "href")) {
2280
+ _removeAttribute(name2, currentNode);
2281
+ continue;
2282
+ }
2283
+ if (hookEvent.forceKeepAttr) {
2284
+ continue;
2285
+ }
2286
+ if (!hookEvent.keepAttr) {
2287
+ _removeAttribute(name2, currentNode);
2288
+ continue;
2289
+ }
2290
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
2291
+ _removeAttribute(name2, currentNode);
2292
+ continue;
2293
+ }
2294
+ if (SAFE_FOR_TEMPLATES) {
2295
+ value = _stripTemplateExpressions(value);
2296
+ }
2297
+ if (!_isValidAttribute(lcTag, lcName, value)) {
2298
+ _removeAttribute(name2, currentNode);
2299
+ continue;
2300
+ }
2301
+ value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
2302
+ if (value !== initValue) {
2303
+ _setAttributeValue(currentNode, name2, namespaceURI, value);
2304
+ }
2305
+ }
2306
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
2307
+ };
2308
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
2309
+ let shadowNode = null;
2310
+ const shadowIterator = _createNodeIterator(fragment);
2311
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
2312
+ while (shadowNode = shadowIterator.nextNode()) {
2313
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
2314
+ _sanitizeElements(shadowNode, fragment);
2315
+ _sanitizeAttributes(shadowNode);
2316
+ if (_isDocumentFragment(shadowNode.content)) {
2317
+ _sanitizeShadowDOM2(shadowNode.content);
2318
+ }
2319
+ const shadowNodeType = getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType;
2320
+ if (shadowNodeType === NODE_TYPE.element) {
2321
+ const innerSr = getShadowRoot(shadowNode);
2322
+ if (_isDocumentFragment(innerSr)) {
2323
+ _sanitizeAttachedShadowRoots(innerSr);
2324
+ _sanitizeShadowDOM2(innerSr);
2325
+ }
2326
+ }
2327
+ }
2328
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
2329
+ };
2330
+ const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots2(root) {
2331
+ const stack = [{
2332
+ node: root,
2333
+ shadow: null
2334
+ }];
2335
+ while (stack.length > 0) {
2336
+ const item = stack.pop();
2337
+ if (item.shadow) {
2338
+ _sanitizeShadowDOM2(item.shadow);
2339
+ continue;
2340
+ }
2341
+ const node = item.node;
2342
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
2343
+ const isElement = nodeType === NODE_TYPE.element;
2344
+ const childNodes = getChildNodes(node);
2345
+ if (childNodes) {
2346
+ for (let i = childNodes.length - 1; i >= 0; --i) {
2347
+ stack.push({
2348
+ node: childNodes[i],
2349
+ shadow: null
2350
+ });
2351
+ }
2352
+ }
2353
+ if (isElement) {
2354
+ const rootName = getNodeName ? getNodeName(node) : null;
2355
+ if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
2356
+ const content = node.content;
2357
+ if (_isDocumentFragment(content)) {
2358
+ stack.push({
2359
+ node: content,
2360
+ shadow: null
2361
+ });
2362
+ }
2363
+ }
2364
+ }
2365
+ if (isElement) {
2366
+ const sr = getShadowRoot(node);
2367
+ if (_isDocumentFragment(sr)) {
2368
+ stack.push({
2369
+ node: null,
2370
+ shadow: sr
2371
+ }, {
2372
+ node: sr,
2373
+ shadow: null
2374
+ });
2375
+ }
2376
+ }
2377
+ }
2378
+ };
2379
+ DOMPurify.sanitize = function(dirty) {
2380
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2381
+ let body = null;
2382
+ let importedNode = null;
2383
+ let currentNode = null;
2384
+ let returnNode = null;
2385
+ IS_EMPTY_INPUT = !dirty;
2386
+ if (IS_EMPTY_INPUT) {
2387
+ dirty = "<!-->";
2388
+ }
2389
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
2390
+ dirty = stringifyValue(dirty);
2391
+ if (typeof dirty !== "string") {
2392
+ throw typeErrorCreate("dirty is not a string, aborting");
2393
+ }
2394
+ }
2395
+ if (!DOMPurify.isSupported) {
2396
+ return dirty;
2397
+ }
2398
+ if (SET_CONFIG) {
2399
+ ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
2400
+ ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
2401
+ } else {
2402
+ _parseConfig(cfg);
2403
+ }
2404
+ if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) {
2405
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
2406
+ }
2407
+ if (hooks.uponSanitizeAttribute.length > 0) {
2408
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
2409
+ }
2410
+ DOMPurify.removed = [];
2411
+ const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
2412
+ if (inPlace) {
2413
+ _neutralizePatchLinkage(dirty);
2414
+ const nn2 = getNodeName ? getNodeName(dirty) : dirty.nodeName;
2415
+ if (typeof nn2 === "string") {
2416
+ const tagName = transformCaseFunc(nn2);
2417
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
2418
+ _neutralizeRoot(dirty);
2419
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
2420
+ }
2421
+ }
2422
+ if (_isClobbered(dirty)) {
2423
+ _neutralizeRoot(dirty);
2424
+ throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
2425
+ }
2426
+ try {
2427
+ _sanitizeAttachedShadowRoots(dirty);
2428
+ } catch (error) {
2429
+ _neutralizeRoot(dirty);
2430
+ throw error;
2431
+ }
2432
+ } else if (_isNode(dirty)) {
2433
+ body = _initDocument("<!---->");
2434
+ importedNode = body.ownerDocument.importNode(dirty, true);
2435
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
2436
+ body = importedNode;
2437
+ } else if (importedNode.nodeName === "HTML") {
2438
+ body = importedNode;
2439
+ } else {
2440
+ body.appendChild(importedNode);
2441
+ }
2442
+ _sanitizeAttachedShadowRoots(importedNode);
2443
+ } else {
2444
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
2445
+ dirty.indexOf("<") === -1) {
2446
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
2447
+ }
2448
+ body = _initDocument(dirty);
2449
+ if (!body) {
2450
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
2451
+ }
2452
+ }
2453
+ if (body && FORCE_BODY) {
2454
+ _forceRemove(body.firstChild);
2455
+ }
2456
+ const walkRoot = inPlace ? dirty : body;
2457
+ try {
2458
+ const nodeIterator = _createNodeIterator(walkRoot);
2459
+ while (currentNode = nodeIterator.nextNode()) {
2460
+ _sanitizeElements(currentNode, walkRoot);
2461
+ _sanitizeAttributes(currentNode);
2462
+ if (_isDocumentFragment(currentNode.content)) {
2463
+ _sanitizeShadowDOM2(currentNode.content);
2464
+ }
2465
+ }
2466
+ } catch (error) {
2467
+ if (inPlace) {
2468
+ _neutralizeRoot(dirty);
2469
+ arrayForEach(DOMPurify.removed, (entry) => {
2470
+ if (entry.element) {
2471
+ _neutralizeSubtree(entry.element);
2472
+ }
2473
+ });
2474
+ }
2475
+ throw error;
2476
+ }
2477
+ if (inPlace) {
2478
+ arrayForEach(DOMPurify.removed, (entry) => {
2479
+ if (entry.element) {
2480
+ _neutralizeSubtree(entry.element);
2481
+ }
2482
+ });
2483
+ if (SAFE_FOR_TEMPLATES) {
2484
+ _scrubTemplateExpressions2(dirty);
2485
+ }
2486
+ return dirty;
2487
+ }
2488
+ if (RETURN_DOM) {
2489
+ if (SAFE_FOR_TEMPLATES) {
2490
+ _scrubTemplateExpressions2(body);
2491
+ }
2492
+ if (RETURN_DOM_FRAGMENT) {
2493
+ returnNode = createDocumentFragment.call(body.ownerDocument);
2494
+ while (body.firstChild) {
2495
+ returnNode.appendChild(body.firstChild);
2496
+ }
2497
+ } else {
2498
+ returnNode = body;
2499
+ }
2500
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
2501
+ returnNode = importNode.call(originalDocument, returnNode, true);
2502
+ }
2503
+ return returnNode;
2504
+ }
2505
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
2506
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
2507
+ serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
2508
+ }
2509
+ if (SAFE_FOR_TEMPLATES) {
2510
+ serializedHTML = _stripTemplateExpressions(serializedHTML);
2511
+ }
2512
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
2513
+ };
2514
+ DOMPurify.setConfig = function() {
2515
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2516
+ _parseConfig(cfg);
2517
+ SET_CONFIG = true;
2518
+ SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
2519
+ SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
2520
+ };
2521
+ DOMPurify.clearConfig = function() {
2522
+ CONFIG = null;
2523
+ SET_CONFIG = false;
2524
+ SET_CONFIG_ALLOWED_TAGS = null;
2525
+ SET_CONFIG_ALLOWED_ATTR = null;
2526
+ trustedTypesPolicy = defaultTrustedTypesPolicy;
2527
+ emptyHTML = "";
2528
+ };
2529
+ DOMPurify.isValidAttribute = function(tag, attr, value) {
2530
+ if (!CONFIG) {
2531
+ _parseConfig({});
2532
+ }
2533
+ const lcTag = transformCaseFunc(tag);
2534
+ const lcName = transformCaseFunc(attr);
2535
+ return _isValidAttribute(lcTag, lcName, value);
2536
+ };
2537
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
2538
+ if (typeof hookFunction !== "function") {
2539
+ return;
2540
+ }
2541
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
2542
+ return;
2543
+ }
2544
+ arrayPush(hooks[entryPoint], hookFunction);
2545
+ };
2546
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
2547
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
2548
+ return void 0;
2549
+ }
2550
+ if (hookFunction !== void 0) {
2551
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
2552
+ return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
2553
+ }
2554
+ return arrayPop(hooks[entryPoint]);
2555
+ };
2556
+ DOMPurify.removeHooks = function(entryPoint) {
2557
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
2558
+ return;
2559
+ }
2560
+ hooks[entryPoint] = [];
2561
+ };
2562
+ DOMPurify.removeAllHooks = function() {
2563
+ hooks = _createHooksMap();
2564
+ };
2565
+ return DOMPurify;
2566
+ }
2567
+ var purify = createDOMPurify();
2568
+
2569
+ // node_modules/.pnpm/marked@18.0.10/node_modules/marked/lib/marked.esm.js
2570
+ function C() {
2571
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
2572
+ }
2573
+ var R = C();
2574
+ function j(l3) {
2575
+ R = l3;
2576
+ }
2577
+ var z = { exec: () => null };
2578
+ function A(l3) {
2579
+ let e = [];
2580
+ return (t) => {
2581
+ let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
2582
+ return s || (s = l3(n), e[n] = s), s;
2583
+ };
2584
+ }
2585
+ function d(l3, e = "") {
2586
+ let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (s, r) => {
2587
+ let i = typeof r == "string" ? r : r.source;
2588
+ return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n;
2589
+ }, getRegex: () => new RegExp(t, e) };
2590
+ return n;
2591
+ }
2592
+ var Te = ((l3 = "") => {
2593
+ try {
2594
+ return !!new RegExp("(?<=1)(?<!1)" + l3);
2595
+ } catch {
2596
+ return false;
2597
+ }
2598
+ })();
2599
+ var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: A((l3) => new RegExp(`^ {0,${l3}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: A((l3) => new RegExp(`^ {0,${l3}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: A((l3) => new RegExp(`^ {0,${l3}}(?:\`\`\`|~~~)`)), headingBeginRegex: A((l3) => new RegExp(`^ {0,${l3}}#`)), htmlBeginRegex: A((l3) => new RegExp(`^ {0,${l3}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: A((l3) => new RegExp(`^ {0,${l3}}>`)) };
2600
+ var Oe = /^(?:[ \t]*(?:\n|$))+/;
2601
+ var we = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
2602
+ var ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
2603
+ var q = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
2604
+ var Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
2605
+ var U = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
2606
+ var oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
2607
+ var ae = d(oe).replace(/bull/g, U).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
2608
+ var Se = d(oe).replace(/bull/g, U).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
2609
+ var K = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
2610
+ var _e = /^[^\n]+/;
2611
+ var W = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
2612
+ var $e = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", W).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
2613
+ var Le = d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, U).getRegex();
2614
+ var Q = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
2615
+ var X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
2616
+ var Me = d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", X).replace("tag", Q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
2617
+ var le = (l3) => d(K).replace("hr", q).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", l3).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Q).getRegex();
2618
+ var ze = le(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
2619
+ var Ee = le(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
2620
+ var Ce = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ee).getRegex();
2621
+ var J = { blockquote: Ce, code: we, def: $e, fences: ye, heading: Pe, hr: q, html: Me, lheading: ae, list: Le, newline: Oe, paragraph: ze, table: z, text: _e };
2622
+ var se = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", q).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Q).getRegex();
2623
+ var Ae = { ...J, lheading: Se, table: se, paragraph: d(K).replace("hr", q).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Q).getRegex() };
2624
+ var Ie = { ...J, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", X).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: z, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(K).replace("hr", q).replace("heading", ` *#{1,6} *[^
2625
+ ]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
2626
+ var Be = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
2627
+ var De = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
2628
+ var pe = /^( {2,}|\\)\n(?!\s*$)/;
2629
+ var qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
2630
+ var _ = /[\p{P}\p{S}]/u;
2631
+ var I = /[\s\p{P}\p{S}]/u;
2632
+ var v = /[^\s\p{P}\p{S}]/u;
2633
+ var ve = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, I).getRegex();
2634
+ var He = /[\p{Pi}\p{Ps}"']/u;
2635
+ var ue = /(?!~)[\p{P}\p{S}]/u;
2636
+ var Ze = /(?!~)[\s\p{P}\p{S}]/u;
2637
+ var Ge = /(?:[^\s\p{P}\p{S}]|~)/u;
2638
+ var Qe = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
2639
+ var ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
2640
+ var Ne = d(ce, "u").replace(/punct/g, _).getRegex();
2641
+ var je = d(ce, "u").replace(/punct/g, ue).getRegex();
2642
+ var Fe = /^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/;
2643
+ var Ue = d(Fe, "u").replace(/openQuote/g, He).replace(/punct/g, _).getRegex();
2644
+ var he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
2645
+ var Ke = d(he, "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2646
+ var We = d(he, "gu").replace(/notPunctSpace/g, Ge).replace(/punctSpace/g, Ze).replace(/punct/g, ue).getRegex();
2647
+ var Xe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)";
2648
+ var Je = d(Xe, "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2649
+ var Ve = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2650
+ var Ye = "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)";
2651
+ var et = d(Ye, "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2652
+ var tt = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, _).getRegex();
2653
+ var nt = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
2654
+ var rt = d(nt, "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2655
+ var st = d(/\\(punct)/, "gu").replace(/punct/g, _).getRegex();
2656
+ var it = d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
2657
+ var ot = d(X).replace("(?:-->|$)", "-->").getRegex();
2658
+ var at = d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ot).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
2659
+ var G = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/;
2660
+ var lt = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", G).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
2661
+ var de = d(/^!?\[(label)\]\[(ref)\]/).replace("label", G).replace("ref", W).getRegex();
2662
+ var ke = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", W).getRegex();
2663
+ var pt = d("reflink|nolink(?!\\()", "g").replace("reflink", de).replace("nolink", ke).getRegex();
2664
+ var ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
2665
+ var V = { _backpedal: z, anyPunctuation: st, autolink: it, blockSkip: Qe, br: pe, code: De, del: z, delLDelim: z, delRDelim: z, emStrongLDelim: Ne, emStrongRDelimAst: Ke, emStrongRDelimUnd: Ve, escape: Be, link: lt, nolink: ke, punctuation: ve, reflink: de, reflinkSearch: pt, tag: at, text: qe, url: z };
2666
+ var ut = { ...V, emStrongLDelim: Ue, emStrongRDelimAst: Je, emStrongRDelimUnd: et, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", G).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", G).getRegex() };
2667
+ var F = { ...V, emStrongRDelimAst: We, emStrongLDelim: je, delLDelim: tt, delRDelim: rt, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ie).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: d(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex() };
2668
+ var ct = { ...F, br: d(pe).replace("{2,}", "*").getRegex(), text: d(F.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
2669
+ var H = { normal: J, gfm: Ae, pedantic: Ie };
2670
+ var B = { normal: V, gfm: F, breaks: ct, pedantic: ut };
2671
+ var ht = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
2672
+ var ge = (l3) => ht[l3];
2673
+ function O(l3, e) {
2674
+ if (e) {
2675
+ if (m.escapeTest.test(l3)) return l3.replace(m.escapeReplace, ge);
2676
+ } else if (m.escapeTestNoEncode.test(l3)) return l3.replace(m.escapeReplaceNoEncode, ge);
2677
+ return l3;
2678
+ }
2679
+ function Y(l3) {
2680
+ try {
2681
+ l3 = encodeURI(l3).replace(m.percentDecode, "%");
2682
+ } catch {
2683
+ return null;
2684
+ }
2685
+ return l3;
2686
+ }
2687
+ function ee(l3, e) {
2688
+ let t = l3.replace(m.findPipe, (r, i, o) => {
2689
+ let p = false, a = i;
2690
+ for (; --a >= 0 && o[a] === "\\"; ) p = !p;
2691
+ return p ? "|" : " |";
2692
+ }), n = t.split(m.splitPipe), s = 0;
2693
+ if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
2694
+ else for (; n.length < e; ) n.push("");
2695
+ for (; s < n.length; s++) n[s] = n[s].trim().replace(m.slashPipe, "|");
2696
+ return n;
2697
+ }
2698
+ function $(l3, e, t) {
2699
+ let n = l3.length;
2700
+ if (n === 0) return "";
2701
+ let s = 0;
2702
+ for (; s < n; ) {
2703
+ let r = l3.charAt(n - s - 1);
2704
+ if (r === e && !t) s++;
2705
+ else if (r !== e && t) s++;
2706
+ else break;
2707
+ }
2708
+ return l3.slice(0, n - s);
2709
+ }
2710
+ function te(l3) {
2711
+ let e = l3.split(`
2712
+ `), t = e.length - 1;
2713
+ for (; t >= 0 && m.blankLine.test(e[t]); ) t--;
2714
+ return e.length - t <= 2 ? l3 : e.slice(0, t + 1).join(`
2715
+ `);
2716
+ }
2717
+ function fe(l3, e) {
2718
+ if (l3.indexOf(e[1]) === -1) return -1;
2719
+ let t = 0;
2720
+ for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
2721
+ else if (l3[n] === e[0]) t++;
2722
+ else if (l3[n] === e[1] && (t--, t < 0)) return n;
2723
+ return t > 0 ? -2 : -1;
2724
+ }
2725
+ function me(l3, e = 0) {
2726
+ let t = e, n = "";
2727
+ for (let s of l3) if (s === " ") {
2728
+ let r = 4 - t % 4;
2729
+ n += " ".repeat(r), t += r;
2730
+ } else n += s, t++;
2731
+ return n;
2732
+ }
2733
+ function xe(l3, e, t, n, s) {
2734
+ let r = e.href, i = e.title || null, o = l3[1].replace(s.other.outputLinkReplace, "$1");
2735
+ n.state.inLink = true;
2736
+ let p = { type: l3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: r, title: i, text: o, tokens: n.inlineTokens(o) };
2737
+ return n.state.inLink = false, p;
2738
+ }
2739
+ function dt(l3, e, t) {
2740
+ let n = l3.match(t.other.indentCodeCompensation);
2741
+ if (n === null) return e;
2742
+ let s = n[1];
2743
+ return e.split(`
2744
+ `).map((r) => {
2745
+ let i = r.match(t.other.beginningSpace);
2746
+ if (i === null) return r;
2747
+ let [o] = i;
2748
+ return o.length >= s.length ? r.slice(s.length) : r;
2749
+ }).join(`
2750
+ `);
2751
+ }
2752
+ var y = class {
2753
+ options;
2754
+ rules;
2755
+ lexer;
2756
+ constructor(e) {
2757
+ this.options = e || R;
2758
+ }
2759
+ space(e) {
2760
+ let t = this.rules.block.newline.exec(e);
2761
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
2762
+ }
2763
+ code(e) {
2764
+ let t = this.rules.block.code.exec(e);
2765
+ if (t) {
2766
+ let n = this.options.pedantic ? t[0] : te(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
2767
+ return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
2768
+ }
2769
+ }
2770
+ fences(e) {
2771
+ let t = this.rules.block.fences.exec(e);
2772
+ if (t) {
2773
+ let n = t[0], s = dt(n, t[3] || "", this.rules);
2774
+ return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
2775
+ }
2776
+ }
2777
+ heading(e) {
2778
+ let t = this.rules.block.heading.exec(e);
2779
+ if (t) {
2780
+ let n = t[2].trim();
2781
+ if (this.rules.other.endingHash.test(n)) {
2782
+ let s = $(n, "#");
2783
+ (this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
2784
+ }
2785
+ return { type: "heading", raw: $(t[0], `
2786
+ `), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
2787
+ }
2788
+ }
2789
+ hr(e) {
2790
+ let t = this.rules.block.hr.exec(e);
2791
+ if (t) return { type: "hr", raw: $(t[0], `
2792
+ `) };
2793
+ }
2794
+ blockquote(e) {
2795
+ let t = this.rules.block.blockquote.exec(e);
2796
+ if (t) {
2797
+ let n = $(t[0], `
2798
+ `).split(`
2799
+ `), s = "", r = "", i = [];
2800
+ for (; n.length > 0; ) {
2801
+ let o = false, p = [], a;
2802
+ for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) p.push(n[a]), o = true;
2803
+ else if (!o) p.push(n[a]);
2804
+ else break;
2805
+ n = n.slice(a);
2806
+ let u = p.join(`
2807
+ `), c = u.replace(this.rules.other.blockquoteSetextReplace, `
2808
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
2809
+ s = s ? `${s}
2810
+ ${u}` : u, r = r ? `${r}
2811
+ ${c}` : c;
2812
+ let h2 = this.lexer.state.top;
2813
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, i, true), this.lexer.state.top = h2, n.length === 0) break;
2814
+ let k = i.at(-1);
2815
+ if (k?.type === "code") break;
2816
+ if (k?.type === "blockquote") {
2817
+ let T = k, g = n.join(`
2818
+ `), w = T.raw + `
2819
+ ` + g.replace(this.rules.other.blockquoteSetextReplace2, ""), M = this.blockquote(w);
2820
+ i[i.length - 1] = M, s = `${s}
2821
+ ${g}`, r = r.substring(0, r.length - T.text.length) + M.text;
2822
+ break;
2823
+ } else if (k?.type === "list") {
2824
+ let T = k, g = T.raw + `
2825
+ ` + n.join(`
2826
+ `), w = this.list(g);
2827
+ i[i.length - 1] = w, s = s.substring(0, s.length - k.raw.length) + w.raw, r = r.substring(0, r.length - T.raw.length) + w.raw, n = g.substring(i.at(-1).raw.length).split(`
2828
+ `);
2829
+ continue;
2830
+ }
2831
+ }
2832
+ return { type: "blockquote", raw: s, tokens: i, text: r };
2833
+ }
2834
+ }
2835
+ list(e) {
2836
+ let t = this.rules.block.list.exec(e);
2837
+ if (t) {
2838
+ let n = t[1].trim(), s = n.length > 1, r = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: false, items: [] };
2839
+ n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
2840
+ let i = this.rules.other.listItemRegex(n), o = false;
2841
+ for (; e; ) {
2842
+ let a = false, u = "", c = "";
2843
+ if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
2844
+ u = t[0], e = e.substring(u.length);
2845
+ let h2 = me(t[2].split(`
2846
+ `, 1)[0], t[1].length), k = e.split(`
2847
+ `, 1)[0], T = !h2.trim(), g = 0;
2848
+ if (this.options.pedantic ? (g = 2, c = h2.trimStart()) : T ? g = t[1].length + 1 : (g = h2.search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, c = h2.slice(g), g += t[1].length), T && this.rules.other.blankLine.test(k) && (u += k + `
2849
+ `, e = e.substring(k.length + 1), a = true), !a) {
2850
+ let w = this.rules.other.nextBulletRegex(g), M = this.rules.other.hrRegex(g), ne = this.rules.other.fencesBeginRegex(g), re = this.rules.other.headingBeginRegex(g), be = this.rules.other.htmlBeginRegex(g), Re = this.rules.other.blockquoteBeginRegex(g);
2851
+ for (; e; ) {
2852
+ let N = e.split(`
2853
+ `, 1)[0], D;
2854
+ if (k = N, this.options.pedantic ? (k = k.replace(this.rules.other.listReplaceNesting, " "), D = k) : D = k.replace(this.rules.other.tabCharGlobal, " "), ne.test(k) || re.test(k) || be.test(k) || Re.test(k) || w.test(k) || M.test(k)) break;
2855
+ if (D.search(this.rules.other.nonSpaceChar) >= g || !k.trim()) c += `
2856
+ ` + D.slice(g);
2857
+ else {
2858
+ if (T || h2.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(h2) || re.test(h2) || M.test(h2)) break;
2859
+ c += `
2860
+ ` + k;
2861
+ }
2862
+ T = !k.trim(), u += N + `
2863
+ `, e = e.substring(N.length + 1), h2 = D.slice(g);
2864
+ }
2865
+ }
2866
+ r.loose || (o ? r.loose = true : this.rules.other.doubleBlankLine.test(u) && (o = true)), r.items.push({ type: "list_item", raw: u, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), r.raw += u;
2867
+ }
2868
+ let p = r.items.at(-1);
2869
+ if (p) p.raw = p.raw.trimEnd(), p.text = p.text.trimEnd();
2870
+ else return;
2871
+ r.raw = r.raw.trimEnd();
2872
+ for (let a of r.items) if (this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []), !r.loose) {
2873
+ let u = a.tokens.filter((h2) => h2.type === "space"), c = u.length > 0 && u.some((h2) => this.rules.other.anyLine.test(h2.raw));
2874
+ r.loose = c;
2875
+ }
2876
+ for (let a of r.items) {
2877
+ let u = a.tokens[0];
2878
+ if (a.task && (u?.type === "text" || u?.type === "paragraph")) {
2879
+ a.text = a.text.replace(this.rules.other.listReplaceTask, ""), u.raw = u.raw.replace(this.rules.other.listReplaceTask, ""), u.text = u.text.replace(this.rules.other.listReplaceTask, "");
2880
+ for (let h2 = this.lexer.inlineQueue.length - 1; h2 >= 0; h2--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[h2].src)) {
2881
+ this.lexer.inlineQueue[h2].src = this.lexer.inlineQueue[h2].src.replace(this.rules.other.listReplaceTask, "");
2882
+ break;
2883
+ }
2884
+ let c = this.rules.other.listTaskCheckbox.exec(a.raw);
2885
+ if (c) {
2886
+ let h2 = { type: "checkbox", raw: c[0] + " ", checked: c[0] !== "[ ]" };
2887
+ a.checked = h2.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = h2.raw + a.tokens[0].raw, a.tokens[0].text = h2.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(h2)) : a.tokens.unshift({ type: "paragraph", raw: h2.raw, text: h2.raw, tokens: [h2] }) : a.tokens.unshift(h2);
2888
+ }
2889
+ } else a.task && (a.task = false);
2890
+ }
2891
+ if (r.loose) for (let a of r.items) {
2892
+ a.loose = true;
2893
+ for (let u of a.tokens) u.type === "text" && (u.type = "paragraph");
2894
+ }
2895
+ return r;
2896
+ }
2897
+ }
2898
+ html(e) {
2899
+ let t = this.rules.block.html.exec(e);
2900
+ if (t) {
2901
+ let n = te(t[0]);
2902
+ return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
2903
+ }
2904
+ }
2905
+ def(e) {
2906
+ let t = this.rules.block.def.exec(e);
2907
+ if (t) {
2908
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
2909
+ return { type: "def", tag: n, raw: $(t[0], `
2910
+ `), href: s, title: r };
2911
+ }
2912
+ }
2913
+ table(e) {
2914
+ let t = this.rules.block.table.exec(e);
2915
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
2916
+ let n = ee(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
2917
+ `) : [], i = { type: "table", raw: $(t[0], `
2918
+ `), header: [], align: [], rows: [] };
2919
+ if (n.length === s.length) {
2920
+ for (let o of s) this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
2921
+ for (let o = 0; o < n.length; o++) i.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: true, align: i.align[o] });
2922
+ for (let o of r) i.rows.push(ee(o, i.header.length).map((p, a) => ({ text: p, tokens: this.lexer.inline(p), header: false, align: i.align[a] })));
2923
+ return i;
2924
+ }
2925
+ }
2926
+ lheading(e) {
2927
+ let t = this.rules.block.lheading.exec(e);
2928
+ if (t) {
2929
+ let n = t[1].trim();
2930
+ return { type: "heading", raw: $(t[0], `
2931
+ `), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
2932
+ }
2933
+ }
2934
+ paragraph(e) {
2935
+ let t = this.rules.block.paragraph.exec(e);
2936
+ if (t) {
2937
+ let n = t[1].charAt(t[1].length - 1) === `
2938
+ ` ? t[1].slice(0, -1) : t[1];
2939
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
2940
+ }
2941
+ }
2942
+ text(e) {
2943
+ let t = this.rules.block.text.exec(e);
2944
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
2945
+ }
2946
+ escape(e) {
2947
+ let t = this.rules.inline.escape.exec(e);
2948
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
2949
+ }
2950
+ tag(e) {
2951
+ let t = this.rules.inline.tag.exec(e);
2952
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
2953
+ }
2954
+ link(e) {
2955
+ let t = this.rules.inline.link.exec(e);
2956
+ if (t) {
2957
+ let n = t[2].trim();
2958
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
2959
+ if (!this.rules.other.endAngleBracket.test(n)) return;
2960
+ let i = $(n.slice(0, -1), "\\");
2961
+ if ((n.length - i.length) % 2 === 0) return;
2962
+ } else {
2963
+ let i = fe(t[2], "()");
2964
+ if (i === -2) return;
2965
+ if (i > -1) {
2966
+ let p = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
2967
+ t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, p).trim(), t[3] = "";
2968
+ }
2969
+ }
2970
+ let s = t[2], r = "";
2971
+ if (this.options.pedantic) {
2972
+ let i = this.rules.other.pedanticHrefTitle.exec(s);
2973
+ i && (s = i[1], r = i[3]);
2974
+ } else r = t[3] ? t[3].slice(1, -1) : "";
2975
+ return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), xe(t, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
2976
+ }
2977
+ }
2978
+ reflink(e, t) {
2979
+ let n;
2980
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
2981
+ let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[s.toLowerCase()];
2982
+ if (!r) {
2983
+ let i = n[0].charAt(0);
2984
+ return { type: "text", raw: i, text: i };
2985
+ }
2986
+ return xe(n, r, n[0], this.lexer, this.rules);
2987
+ }
2988
+ }
2989
+ emStrong(e, t, n = "") {
2990
+ let s = this.rules.inline.emStrongLDelim.exec(e);
2991
+ if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
2992
+ if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
2993
+ let i = [...s[0]].length - 1, o, p, a = i, u = 0, c = s[0][0], h2 = n === c, k = c === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
2994
+ for (k.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = k.exec(t)) !== null; ) {
2995
+ if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o) continue;
2996
+ if (p = [...o].length, s[3] || s[4]) {
2997
+ a += p;
2998
+ continue;
2999
+ } else if (s[5] || s[6]) {
3000
+ if (i % 3 && !((i + p) % 3)) {
3001
+ u += p;
3002
+ continue;
3003
+ }
3004
+ if (h2) break;
3005
+ }
3006
+ if (a -= p, a > 0) continue;
3007
+ p = Math.min(p, p + a + u);
3008
+ let T = [...s[0]][0].length, g = e.slice(0, i + s.index + T + p);
3009
+ if (Math.min(i, p) % 2) {
3010
+ let M = g.slice(1, -1);
3011
+ return { type: "em", raw: g, text: M, tokens: this.lexer.inlineTokens(M) };
3012
+ }
3013
+ let w = g.slice(2, -2);
3014
+ return { type: "strong", raw: g, text: w, tokens: this.lexer.inlineTokens(w) };
3015
+ }
3016
+ }
3017
+ }
3018
+ codespan(e) {
3019
+ let t = this.rules.inline.code.exec(e);
3020
+ if (t) {
3021
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
3022
+ return s && r && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
3023
+ }
3024
+ }
3025
+ br(e) {
3026
+ let t = this.rules.inline.br.exec(e);
3027
+ if (t) return { type: "br", raw: t[0] };
3028
+ }
3029
+ del(e, t, n = "") {
3030
+ let s = this.rules.inline.delLDelim.exec(e);
3031
+ if (!s) return;
3032
+ if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
3033
+ let i = [...s[0]].length - 1, o, p, a = i, u = this.rules.inline.delRDelim;
3034
+ for (u.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = u.exec(t)) !== null; ) {
3035
+ if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (p = [...o].length, p !== i)) continue;
3036
+ if (s[3] || s[4]) {
3037
+ a += p;
3038
+ continue;
3039
+ }
3040
+ if (a -= p, a > 0) continue;
3041
+ p = Math.min(p, p + a);
3042
+ let c = [...s[0]][0].length, h2 = e.slice(0, i + s.index + c + p), k = h2.slice(i, -i);
3043
+ return { type: "del", raw: h2, text: k, tokens: this.lexer.inlineTokens(k) };
3044
+ }
3045
+ }
3046
+ }
3047
+ autolink(e) {
3048
+ let t = this.rules.inline.autolink.exec(e);
3049
+ if (t) {
3050
+ let n, s;
3051
+ return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
3052
+ }
3053
+ }
3054
+ url(e) {
3055
+ let t;
3056
+ if (t = this.rules.inline.url.exec(e)) {
3057
+ let n, s;
3058
+ if (t[2] === "@") n = t[0], s = "mailto:" + n;
3059
+ else {
3060
+ let r;
3061
+ do
3062
+ r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
3063
+ while (r !== t[0]);
3064
+ n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
3065
+ }
3066
+ return { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
3067
+ }
3068
+ }
3069
+ inlineText(e) {
3070
+ let t = this.rules.inline.text.exec(e);
3071
+ if (t) {
3072
+ let n = this.lexer.state.inRawBlock;
3073
+ return { type: "text", raw: t[0], text: t[0], escaped: n };
3074
+ }
3075
+ }
3076
+ };
3077
+ var x = class l {
3078
+ tokens;
3079
+ options;
3080
+ state;
3081
+ inlineQueue;
3082
+ tokenizer;
3083
+ constructor(e) {
3084
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || R, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
3085
+ let t = { other: m, block: H.normal, inline: B.normal };
3086
+ this.options.pedantic ? (t.block = H.pedantic, t.inline = B.pedantic) : this.options.gfm && (t.block = H.gfm, this.options.breaks ? t.inline = B.breaks : t.inline = B.gfm), this.tokenizer.rules = t;
3087
+ }
3088
+ static get rules() {
3089
+ return { block: H, inline: B };
3090
+ }
3091
+ static lex(e, t) {
3092
+ return new l(t).lex(e);
3093
+ }
3094
+ static lexInline(e, t) {
3095
+ return new l(t).inlineTokens(e);
3096
+ }
3097
+ lex(e) {
3098
+ e = e.replace(m.carriageReturn, `
3099
+ `), this.blockTokens(e, this.tokens);
3100
+ for (let t = 0; t < this.inlineQueue.length; t++) {
3101
+ let n = this.inlineQueue[t];
3102
+ this.inlineTokens(n.src, n.tokens);
3103
+ }
3104
+ return this.inlineQueue = [], this.tokens;
3105
+ }
3106
+ blockTokens(e, t = [], n = false) {
3107
+ this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, ""));
3108
+ let s = 1 / 0;
3109
+ for (; e; ) {
3110
+ if (e.length < s) s = e.length;
3111
+ else {
3112
+ this.infiniteLoopError(e.charCodeAt(0));
3113
+ break;
3114
+ }
3115
+ let r;
3116
+ if (this.options.extensions?.block?.some((o) => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
3117
+ if (r = this.tokenizer.space(e)) {
3118
+ e = e.substring(r.raw.length);
3119
+ let o = t.at(-1);
3120
+ r.raw.length === 1 && o !== void 0 ? o.raw += `
3121
+ ` : t.push(r);
3122
+ continue;
3123
+ }
3124
+ if (r = this.tokenizer.code(e)) {
3125
+ e = e.substring(r.raw.length);
3126
+ let o = t.at(-1);
3127
+ o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
3128
+ `) ? "" : `
3129
+ `) + r.raw, o.text += `
3130
+ ` + r.text, this.inlineQueue.at(-1).src = o.text) : t.push(r);
3131
+ continue;
3132
+ }
3133
+ if (r = this.tokenizer.fences(e)) {
3134
+ e = e.substring(r.raw.length), t.push(r);
3135
+ continue;
3136
+ }
3137
+ if (r = this.tokenizer.heading(e)) {
3138
+ e = e.substring(r.raw.length), t.push(r);
3139
+ continue;
3140
+ }
3141
+ if (r = this.tokenizer.hr(e)) {
3142
+ e = e.substring(r.raw.length), t.push(r);
3143
+ continue;
3144
+ }
3145
+ if (r = this.tokenizer.blockquote(e)) {
3146
+ e = e.substring(r.raw.length), t.push(r);
3147
+ continue;
3148
+ }
3149
+ if (r = this.tokenizer.list(e)) {
3150
+ e = e.substring(r.raw.length), t.push(r);
3151
+ continue;
3152
+ }
3153
+ if (r = this.tokenizer.html(e)) {
3154
+ e = e.substring(r.raw.length), t.push(r);
3155
+ continue;
3156
+ }
3157
+ if (r = this.tokenizer.def(e)) {
3158
+ e = e.substring(r.raw.length);
3159
+ let o = t.at(-1);
3160
+ o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
3161
+ `) ? "" : `
3162
+ `) + r.raw, o.text += `
3163
+ ` + r.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
3164
+ continue;
3165
+ }
3166
+ if (r = this.tokenizer.table(e)) {
3167
+ e = e.substring(r.raw.length), t.push(r);
3168
+ continue;
3169
+ }
3170
+ if (r = this.tokenizer.lheading(e)) {
3171
+ e = e.substring(r.raw.length), t.push(r);
3172
+ continue;
3173
+ }
3174
+ let i = e;
3175
+ if (this.options.extensions?.startBlock) {
3176
+ let o = 1 / 0, p = e.slice(1), a;
3177
+ this.options.extensions.startBlock.forEach((u) => {
3178
+ a = u.call({ lexer: this }, p), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
3179
+ }), o < 1 / 0 && o >= 0 && (i = e.substring(0, o + 1));
3180
+ }
3181
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
3182
+ let o = t.at(-1);
3183
+ n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
3184
+ `) ? "" : `
3185
+ `) + r.raw, o.text += `
3186
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
3187
+ continue;
3188
+ }
3189
+ if (r = this.tokenizer.text(e)) {
3190
+ e = e.substring(r.raw.length);
3191
+ let o = t.at(-1);
3192
+ o?.type === "text" ? (o.raw += (o.raw.endsWith(`
3193
+ `) ? "" : `
3194
+ `) + r.raw, o.text += `
3195
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r);
3196
+ continue;
3197
+ }
3198
+ if (e) {
3199
+ this.infiniteLoopError(e.charCodeAt(0));
3200
+ break;
3201
+ }
3202
+ }
3203
+ return this.state.top = true, t;
3204
+ }
3205
+ inline(e, t = []) {
3206
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
3207
+ }
3208
+ inlineTokens(e, t = []) {
3209
+ this.tokenizer.lexer = this;
3210
+ let n = e;
3211
+ if (this.tokens.links) {
3212
+ let o = Object.keys(this.tokens.links);
3213
+ o.length > 0 && (n = n.replace(this.tokenizer.rules.inline.reflinkSearch, (p) => o.includes(p.slice(p.lastIndexOf("[") + 1, -1)) ? "[" + "a".repeat(p.length - 2) + "]" : p));
3214
+ }
3215
+ n = n.replace(this.tokenizer.rules.inline.anyPunctuation, (o) => "+".repeat(o.length)), n = n.replace(this.tokenizer.rules.inline.blockSkip, (o, p, a) => {
3216
+ let u = a ? a.length : 0;
3217
+ return o.slice(0, u) + "[" + "a".repeat(o.length - u - 2) + "]";
3218
+ }), n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
3219
+ let s = false, r = "", i = 1 / 0;
3220
+ for (; e; ) {
3221
+ if (e.length < i) i = e.length;
3222
+ else {
3223
+ this.infiniteLoopError(e.charCodeAt(0));
3224
+ break;
3225
+ }
3226
+ s || (r = ""), s = false;
3227
+ let o;
3228
+ if (this.options.extensions?.inline?.some((a) => (o = a.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
3229
+ if (o = this.tokenizer.escape(e)) {
3230
+ e = e.substring(o.raw.length), t.push(o);
3231
+ continue;
3232
+ }
3233
+ if (o = this.tokenizer.tag(e)) {
3234
+ e = e.substring(o.raw.length), t.push(o);
3235
+ continue;
3236
+ }
3237
+ if (o = this.tokenizer.link(e)) {
3238
+ e = e.substring(o.raw.length), t.push(o);
3239
+ continue;
3240
+ }
3241
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
3242
+ e = e.substring(o.raw.length);
3243
+ let a = t.at(-1);
3244
+ o.type === "text" && a?.type === "text" ? (a.raw += o.raw, a.text += o.text) : t.push(o);
3245
+ continue;
3246
+ }
3247
+ if (o = this.tokenizer.emStrong(e, n, r)) {
3248
+ e = e.substring(o.raw.length), t.push(o);
3249
+ continue;
3250
+ }
3251
+ if (o = this.tokenizer.codespan(e)) {
3252
+ e = e.substring(o.raw.length), t.push(o);
3253
+ continue;
3254
+ }
3255
+ if (o = this.tokenizer.br(e)) {
3256
+ e = e.substring(o.raw.length), t.push(o);
3257
+ continue;
3258
+ }
3259
+ if (o = this.tokenizer.del(e, n, r)) {
3260
+ e = e.substring(o.raw.length), t.push(o);
3261
+ continue;
3262
+ }
3263
+ if (o = this.tokenizer.autolink(e)) {
3264
+ e = e.substring(o.raw.length), t.push(o);
3265
+ continue;
3266
+ }
3267
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
3268
+ e = e.substring(o.raw.length), t.push(o);
3269
+ continue;
3270
+ }
3271
+ let p = e;
3272
+ if (this.options.extensions?.startInline) {
3273
+ let a = 1 / 0, u = e.slice(1), c;
3274
+ this.options.extensions.startInline.forEach((h2) => {
3275
+ c = h2.call({ lexer: this }, u), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
3276
+ }), a < 1 / 0 && a >= 0 && (p = e.substring(0, a + 1));
3277
+ }
3278
+ if (o = this.tokenizer.inlineText(p)) {
3279
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (r = o.raw.slice(-1)), s = true;
3280
+ let a = t.at(-1);
3281
+ a?.type === "text" ? (a.raw += o.raw, a.text += o.text) : t.push(o);
3282
+ continue;
3283
+ }
3284
+ if (e) {
3285
+ this.infiniteLoopError(e.charCodeAt(0));
3286
+ break;
3287
+ }
3288
+ }
3289
+ return t;
3290
+ }
3291
+ infiniteLoopError(e) {
3292
+ let t = "Infinite loop on byte: " + e;
3293
+ if (this.options.silent) console.error(t);
3294
+ else throw new Error(t);
3295
+ }
3296
+ };
3297
+ var P = class {
3298
+ options;
3299
+ parser;
3300
+ constructor(e) {
3301
+ this.options = e || R;
3302
+ }
3303
+ space(e) {
3304
+ return "";
3305
+ }
3306
+ code({ text: e, lang: t, escaped: n }) {
3307
+ let s = (t || "").match(m.notSpaceStart)?.[0], r = e.replace(m.endingNewline, "") + `
3308
+ `;
3309
+ return s ? '<pre><code class="language-' + O(s) + '">' + (n ? r : O(r, true)) + `</code></pre>
3310
+ ` : "<pre><code>" + (n ? r : O(r, true)) + `</code></pre>
3311
+ `;
3312
+ }
3313
+ blockquote({ tokens: e }) {
3314
+ return `<blockquote>
3315
+ ${this.parser.parse(e)}</blockquote>
3316
+ `;
3317
+ }
3318
+ html({ text: e }) {
3319
+ return e;
3320
+ }
3321
+ def(e) {
3322
+ return "";
3323
+ }
3324
+ heading({ tokens: e, depth: t }) {
3325
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
3326
+ `;
3327
+ }
3328
+ hr(e) {
3329
+ return `<hr>
3330
+ `;
3331
+ }
3332
+ list(e) {
3333
+ let t = e.ordered, n = e.start, s = "";
3334
+ for (let o = 0; o < e.items.length; o++) {
3335
+ let p = e.items[o];
3336
+ s += this.listitem(p);
3337
+ }
3338
+ let r = t ? "ol" : "ul", i = t && n !== 1 ? ' start="' + n + '"' : "";
3339
+ return "<" + r + i + `>
3340
+ ` + s + "</" + r + `>
3341
+ `;
3342
+ }
3343
+ listitem(e) {
3344
+ return `<li>${this.parser.parse(e.tokens)}</li>
3345
+ `;
3346
+ }
3347
+ checkbox({ checked: e }) {
3348
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
3349
+ }
3350
+ paragraph({ tokens: e }) {
3351
+ return `<p>${this.parser.parseInline(e)}</p>
3352
+ `;
3353
+ }
3354
+ table(e) {
3355
+ let t = "", n = "";
3356
+ for (let r = 0; r < e.header.length; r++) n += this.tablecell(e.header[r]);
3357
+ t += this.tablerow({ text: n });
3358
+ let s = "";
3359
+ for (let r = 0; r < e.rows.length; r++) {
3360
+ let i = e.rows[r];
3361
+ n = "";
3362
+ for (let o = 0; o < i.length; o++) n += this.tablecell(i[o]);
3363
+ s += this.tablerow({ text: n });
3364
+ }
3365
+ return s && (s = `<tbody>${s}</tbody>`), `<table>
3366
+ <thead>
3367
+ ` + t + `</thead>
3368
+ ` + s + `</table>
3369
+ `;
3370
+ }
3371
+ tablerow({ text: e }) {
3372
+ return `<tr>
3373
+ ${e}</tr>
3374
+ `;
3375
+ }
3376
+ tablecell(e) {
3377
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
3378
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
3379
+ `;
3380
+ }
3381
+ strong({ tokens: e }) {
3382
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
3383
+ }
3384
+ em({ tokens: e }) {
3385
+ return `<em>${this.parser.parseInline(e)}</em>`;
3386
+ }
3387
+ codespan({ text: e }) {
3388
+ return `<code>${O(e, true)}</code>`;
3389
+ }
3390
+ br(e) {
3391
+ return "<br>";
3392
+ }
3393
+ del({ tokens: e }) {
3394
+ return `<del>${this.parser.parseInline(e)}</del>`;
3395
+ }
3396
+ link({ href: e, title: t, tokens: n }) {
3397
+ let s = this.parser.parseInline(n), r = Y(e);
3398
+ if (r === null) return s;
3399
+ e = r;
3400
+ let i = '<a href="' + e + '"';
3401
+ return t && (i += ' title="' + O(t) + '"'), i += ">" + s + "</a>", i;
3402
+ }
3403
+ image({ href: e, title: t, text: n, tokens: s }) {
3404
+ s && (n = this.parser.parseInline(s, this.parser.textRenderer));
3405
+ let r = Y(e);
3406
+ if (r === null) return O(n);
3407
+ e = r;
3408
+ let i = `<img src="${e}" alt="${O(n)}"`;
3409
+ return t && (i += ` title="${O(t)}"`), i += ">", i;
3410
+ }
3411
+ text(e) {
3412
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
3413
+ }
3414
+ };
3415
+ var L = class {
3416
+ strong({ text: e }) {
3417
+ return e;
3418
+ }
3419
+ em({ text: e }) {
3420
+ return e;
3421
+ }
3422
+ codespan({ text: e }) {
3423
+ return e;
3424
+ }
3425
+ del({ text: e }) {
3426
+ return e;
3427
+ }
3428
+ html({ text: e }) {
3429
+ return e;
3430
+ }
3431
+ text({ text: e }) {
3432
+ return e;
3433
+ }
3434
+ link({ text: e }) {
3435
+ return "" + e;
3436
+ }
3437
+ image({ text: e }) {
3438
+ return "" + e;
3439
+ }
3440
+ br() {
3441
+ return "";
3442
+ }
3443
+ checkbox({ raw: e }) {
3444
+ return e;
3445
+ }
3446
+ };
3447
+ var b = class l2 {
3448
+ options;
3449
+ renderer;
3450
+ textRenderer;
3451
+ constructor(e) {
3452
+ this.options = e || R, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L();
3453
+ }
3454
+ static parse(e, t) {
3455
+ return new l2(t).parse(e);
3456
+ }
3457
+ static parseInline(e, t) {
3458
+ return new l2(t).parseInline(e);
3459
+ }
3460
+ parse(e) {
3461
+ this.renderer.parser = this;
3462
+ let t = "";
3463
+ for (let n = 0; n < e.length; n++) {
3464
+ let s = e[n];
3465
+ if (this.options.extensions?.renderers?.[s.type]) {
3466
+ let i = s, o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
3467
+ if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "checkbox", "html", "def", "paragraph", "text"].includes(i.type)) {
3468
+ t += o || "";
3469
+ continue;
3470
+ }
3471
+ }
3472
+ let r = s;
3473
+ switch (r.type) {
3474
+ case "space": {
3475
+ t += this.renderer.space(r);
3476
+ break;
3477
+ }
3478
+ case "hr": {
3479
+ t += this.renderer.hr(r);
3480
+ break;
3481
+ }
3482
+ case "heading": {
3483
+ t += this.renderer.heading(r);
3484
+ break;
3485
+ }
3486
+ case "code": {
3487
+ t += this.renderer.code(r);
3488
+ break;
3489
+ }
3490
+ case "table": {
3491
+ t += this.renderer.table(r);
3492
+ break;
3493
+ }
3494
+ case "blockquote": {
3495
+ t += this.renderer.blockquote(r);
3496
+ break;
3497
+ }
3498
+ case "list": {
3499
+ t += this.renderer.list(r);
3500
+ break;
3501
+ }
3502
+ case "checkbox": {
3503
+ t += this.renderer.checkbox(r);
3504
+ break;
3505
+ }
3506
+ case "html": {
3507
+ t += this.renderer.html(r);
3508
+ break;
3509
+ }
3510
+ case "def": {
3511
+ t += this.renderer.def(r);
3512
+ break;
3513
+ }
3514
+ case "paragraph": {
3515
+ t += this.renderer.paragraph(r);
3516
+ break;
3517
+ }
3518
+ case "text": {
3519
+ t += this.renderer.text(r);
3520
+ break;
3521
+ }
3522
+ default: {
3523
+ let i = 'Token with "' + r.type + '" type was not found.';
3524
+ if (this.options.silent) return console.error(i), "";
3525
+ throw new Error(i);
3526
+ }
3527
+ }
3528
+ }
3529
+ return t;
3530
+ }
3531
+ parseInline(e, t = this.renderer) {
3532
+ this.renderer.parser = this;
3533
+ let n = "";
3534
+ for (let s = 0; s < e.length; s++) {
3535
+ let r = e[s];
3536
+ if (this.options.extensions?.renderers?.[r.type]) {
3537
+ let o = this.options.extensions.renderers[r.type].call({ parser: this }, r);
3538
+ if (o !== false || !["escape", "html", "link", "image", "checkbox", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
3539
+ n += o || "";
3540
+ continue;
3541
+ }
3542
+ }
3543
+ let i = r;
3544
+ switch (i.type) {
3545
+ case "escape": {
3546
+ n += t.text(i);
3547
+ break;
3548
+ }
3549
+ case "html": {
3550
+ n += t.html(i);
3551
+ break;
3552
+ }
3553
+ case "link": {
3554
+ n += t.link(i);
3555
+ break;
3556
+ }
3557
+ case "image": {
3558
+ n += t.image(i);
3559
+ break;
3560
+ }
3561
+ case "checkbox": {
3562
+ n += t.checkbox(i);
3563
+ break;
3564
+ }
3565
+ case "strong": {
3566
+ n += t.strong(i);
3567
+ break;
3568
+ }
3569
+ case "em": {
3570
+ n += t.em(i);
3571
+ break;
3572
+ }
3573
+ case "codespan": {
3574
+ n += t.codespan(i);
3575
+ break;
3576
+ }
3577
+ case "br": {
3578
+ n += t.br(i);
3579
+ break;
3580
+ }
3581
+ case "del": {
3582
+ n += t.del(i);
3583
+ break;
3584
+ }
3585
+ case "text": {
3586
+ n += t.text(i);
3587
+ break;
3588
+ }
3589
+ default: {
3590
+ let o = 'Token with "' + i.type + '" type was not found.';
3591
+ if (this.options.silent) return console.error(o), "";
3592
+ throw new Error(o);
3593
+ }
3594
+ }
3595
+ }
3596
+ return n;
3597
+ }
3598
+ };
3599
+ var S = class {
3600
+ options;
3601
+ block;
3602
+ constructor(e) {
3603
+ this.options = e || R;
3604
+ }
3605
+ static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
3606
+ static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
3607
+ preprocess(e) {
3608
+ return e;
3609
+ }
3610
+ postprocess(e) {
3611
+ return e;
3612
+ }
3613
+ processAllTokens(e) {
3614
+ return e;
3615
+ }
3616
+ emStrongMask(e) {
3617
+ return e;
3618
+ }
3619
+ provideLexer(e = this.block) {
3620
+ return e ? x.lex : x.lexInline;
3621
+ }
3622
+ provideParser(e = this.block) {
3623
+ return e ? b.parse : b.parseInline;
3624
+ }
3625
+ };
3626
+ var Z = class {
3627
+ defaults = C();
3628
+ options = this.setOptions;
3629
+ parse = this.parseMarkdown(true);
3630
+ parseInline = this.parseMarkdown(false);
3631
+ Parser = b;
3632
+ Renderer = P;
3633
+ TextRenderer = L;
3634
+ Lexer = x;
3635
+ Tokenizer = y;
3636
+ Hooks = S;
3637
+ constructor(...e) {
3638
+ this.use(...e);
3639
+ }
3640
+ walkTokens(e, t) {
3641
+ let n = [];
3642
+ for (let s of e) switch (n = n.concat(t.call(this, s)), s.type) {
3643
+ case "table": {
3644
+ let r = s;
3645
+ for (let i of r.header) n = n.concat(this.walkTokens(i.tokens, t));
3646
+ for (let i of r.rows) for (let o of i) n = n.concat(this.walkTokens(o.tokens, t));
3647
+ break;
3648
+ }
3649
+ case "list": {
3650
+ let r = s;
3651
+ n = n.concat(this.walkTokens(r.items, t));
3652
+ break;
3653
+ }
3654
+ default: {
3655
+ let r = s;
3656
+ this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((i) => {
3657
+ let o = r[i].flat(1 / 0);
3658
+ n = n.concat(this.walkTokens(o, t));
3659
+ }) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
3660
+ }
3661
+ }
3662
+ return n;
3663
+ }
3664
+ use(...e) {
3665
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
3666
+ return e.forEach((n) => {
3667
+ let s = { ...n };
3668
+ if (s.async = this.defaults.async || s.async || false, n.extensions && (n.extensions.forEach((r) => {
3669
+ if (!r.name) throw new Error("extension name required");
3670
+ if ("renderer" in r) {
3671
+ let i = t.renderers[r.name];
3672
+ i ? t.renderers[r.name] = function(...o) {
3673
+ let p = r.renderer.apply(this, o);
3674
+ return p === false && (p = i.apply(this, o)), p;
3675
+ } : t.renderers[r.name] = r.renderer;
3676
+ }
3677
+ if ("tokenizer" in r) {
3678
+ if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
3679
+ let i = t[r.level];
3680
+ i ? i.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
3681
+ }
3682
+ "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
3683
+ }), s.extensions = t), n.renderer) {
3684
+ let r = this.defaults.renderer || new P(this.defaults);
3685
+ for (let i in n.renderer) {
3686
+ if (!(i in r)) throw new Error(`renderer '${i}' does not exist`);
3687
+ if (["options", "parser"].includes(i)) continue;
3688
+ let o = i, p = n.renderer[o], a = r[o];
3689
+ r[o] = (...u) => {
3690
+ let c = p.apply(r, u);
3691
+ return c === false && (c = a.apply(r, u)), c || "";
3692
+ };
3693
+ }
3694
+ s.renderer = r;
3695
+ }
3696
+ if (n.tokenizer) {
3697
+ let r = this.defaults.tokenizer || new y(this.defaults);
3698
+ for (let i in n.tokenizer) {
3699
+ if (!(i in r)) throw new Error(`tokenizer '${i}' does not exist`);
3700
+ if (["options", "rules", "lexer"].includes(i)) continue;
3701
+ let o = i, p = n.tokenizer[o], a = r[o];
3702
+ r[o] = (...u) => {
3703
+ let c = p.apply(r, u);
3704
+ return c === false && (c = a.apply(r, u)), c;
3705
+ };
3706
+ }
3707
+ s.tokenizer = r;
3708
+ }
3709
+ if (n.hooks) {
3710
+ let r = this.defaults.hooks || new S();
3711
+ for (let i in n.hooks) {
3712
+ if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
3713
+ if (["options", "block"].includes(i)) continue;
3714
+ let o = i, p = n.hooks[o], a = r[o];
3715
+ S.passThroughHooks.has(i) ? r[o] = (u) => {
3716
+ if (this.defaults.async && S.passThroughHooksRespectAsync.has(i)) return (async () => {
3717
+ let h2 = await p.call(r, u);
3718
+ return a.call(r, h2);
3719
+ })();
3720
+ let c = p.call(r, u);
3721
+ return a.call(r, c);
3722
+ } : r[o] = (...u) => {
3723
+ if (this.defaults.async) return (async () => {
3724
+ let h2 = await p.apply(r, u);
3725
+ return h2 === false && (h2 = await a.apply(r, u)), h2;
3726
+ })();
3727
+ let c = p.apply(r, u);
3728
+ return c === false && (c = a.apply(r, u)), c;
3729
+ };
3730
+ }
3731
+ s.hooks = r;
3732
+ }
3733
+ if (n.walkTokens) {
3734
+ let r = this.defaults.walkTokens, i = n.walkTokens;
3735
+ s.walkTokens = function(o) {
3736
+ let p = [];
3737
+ return p.push(i.call(this, o)), r && (p = p.concat(r.call(this, o))), p;
3738
+ };
3739
+ }
3740
+ this.defaults = { ...this.defaults, ...s };
3741
+ }), this;
3742
+ }
3743
+ setOptions(e) {
3744
+ return this.defaults = { ...this.defaults, ...e }, this;
3745
+ }
3746
+ lexer(e, t) {
3747
+ return x.lex(e, t ?? this.defaults);
3748
+ }
3749
+ parser(e, t) {
3750
+ return b.parse(e, t ?? this.defaults);
3751
+ }
3752
+ parseMarkdown(e) {
3753
+ return (n, s) => {
3754
+ let r = { ...s }, i = { ...this.defaults, ...r }, o = this.onError(!!i.silent, !!i.async);
3755
+ if (this.defaults.async === true && r.async === false) return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
3756
+ if (typeof n > "u" || n === null) return o(new Error("marked(): input parameter is undefined or null"));
3757
+ if (typeof n != "string") return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
3758
+ if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
3759
+ let p = i.hooks ? await i.hooks.preprocess(n) : n, u = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(p, i), c = i.hooks ? await i.hooks.processAllTokens(u) : u;
3760
+ i.walkTokens && await Promise.all(this.walkTokens(c, i.walkTokens));
3761
+ let k = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(c, i);
3762
+ return i.hooks ? await i.hooks.postprocess(k) : k;
3763
+ })().catch(o);
3764
+ try {
3765
+ i.hooks && (n = i.hooks.preprocess(n));
3766
+ let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
3767
+ i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
3768
+ let c = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
3769
+ return i.hooks && (c = i.hooks.postprocess(c)), c;
3770
+ } catch (p) {
3771
+ return o(p);
3772
+ }
3773
+ };
3774
+ }
3775
+ onError(e, t) {
3776
+ return (n) => {
3777
+ if (n.message += `
3778
+ Please report this to https://github.com/markedjs/marked.`, e) {
3779
+ let s = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
3780
+ return t ? Promise.resolve(s) : s;
3781
+ }
3782
+ if (t) return Promise.reject(n);
3783
+ throw n;
3784
+ };
3785
+ }
3786
+ };
3787
+ var E = new Z();
3788
+ function f(l3, e) {
3789
+ return E.parse(l3, e);
3790
+ }
3791
+ f.options = f.setOptions = function(l3) {
3792
+ return E.setOptions(l3), f.defaults = E.defaults, j(f.defaults), f;
3793
+ };
3794
+ f.getDefaults = C;
3795
+ f.defaults = R;
3796
+ function kt(...l3) {
3797
+ return E.use(...l3), f.defaults = E.defaults, j(f.defaults), f;
3798
+ }
3799
+ f.use = kt;
3800
+ f.walkTokens = function(l3, e) {
3801
+ return E.walkTokens(l3, e);
3802
+ };
3803
+ f.parseInline = E.parseInline;
3804
+ f.Parser = b;
3805
+ f.parser = b.parse;
3806
+ f.Renderer = P;
3807
+ f.TextRenderer = L;
3808
+ f.Lexer = x;
3809
+ f.lexer = x.lex;
3810
+ f.Tokenizer = y;
3811
+ f.Hooks = S;
3812
+ f.parse = f;
3813
+ var nn = f.options;
3814
+ var rn = f.setOptions;
3815
+ var sn = f.walkTokens;
3816
+ var on = f.parseInline;
3817
+ var ln = b.parse;
3818
+ var pn = x.lex;
3819
+
3820
+ // src/client/MarkdownPreview.tsx
3821
+ var import_jsx_runtime3 = require("react/jsx-runtime");
3822
+ var parse = (text2) => purify.sanitize(f.parse(text2, { async: false, gfm: true, breaks: false }));
3823
+ function MarkdownPreview(props) {
3824
+ const html2 = (0, import_react3.useMemo)(() => parse(props.text), [props.text]);
3825
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dpc-mdBody", dangerouslySetInnerHTML: { __html: html2 } });
3826
+ }
3827
+
3828
+ // src/client/SkillsTab.tsx
3829
+ var import_jsx_runtime4 = require("react/jsx-runtime");
3830
+ var SOURCE_KEYS = {
3831
+ "project-dsh": "sourceProjectDsh",
3832
+ "project-agents": "sourceProjectAgents",
3833
+ "user-dsh": "sourceUserDsh",
3834
+ "user-agents": "sourceUserAgents",
3835
+ runtime: "sourceRuntime",
3836
+ bundled: "sourceBundled",
3837
+ custom: "sourceCustom"
3838
+ };
3839
+ function policyTag(skill) {
3840
+ const { modelInvocable, userInvocable } = skill.invocation;
3841
+ if (!modelInvocable && !userInvocable) return { key: "skillDisabled", off: true };
3842
+ if (!modelInvocable) return { key: "skillUserOnly", off: false };
3843
+ if (!userInvocable) return { key: "skillModelOnly", off: false };
3844
+ return { off: false };
3845
+ }
3846
+ function SkillsTab(props) {
3847
+ const { t, injected } = props;
3848
+ const [skills, setSkills] = (0, import_react4.useState)(null);
3849
+ const [editor, setEditor] = (0, import_react4.useState)(null);
3850
+ const [preview, setPreview] = (0, import_react4.useState)(false);
3851
+ const [confirmName, setConfirmName] = (0, import_react4.useState)(null);
3852
+ const [busy, setBusy] = (0, import_react4.useState)(false);
3853
+ const [outcome, setOutcome] = (0, import_react4.useState)(null);
3854
+ const [formError, setFormError] = (0, import_react4.useState)(null);
3855
+ const [reload, setReload] = (0, import_react4.useState)(0);
3856
+ const [query, setQuery] = (0, import_react4.useState)("");
3857
+ const [sourceFilter, setSourceFilter] = (0, import_react4.useState)("all");
3858
+ const [roots, setRoots] = (0, import_react4.useState)(null);
3859
+ const [addRoot, setAddRoot] = (0, import_react4.useState)(null);
3860
+ const [rootBusy, setRootBusy] = (0, import_react4.useState)(false);
3861
+ const [confirmRootId, setConfirmRootId] = (0, import_react4.useState)(null);
3862
+ (0, import_react4.useEffect)(() => {
3863
+ let current = true;
3864
+ void injected.list().then(
3865
+ (body) => {
3866
+ if (current) setSkills(body.skills);
3867
+ },
3868
+ (error) => {
3869
+ if (current) {
3870
+ setSkills([]);
3871
+ setOutcome({ ok: false, text: `${t("failed")}: ${String(error.message ?? error)}` });
3872
+ }
3873
+ }
3874
+ );
3875
+ void injected.roots().then(
3876
+ (body) => {
3877
+ if (current) setRoots(body.roots);
3878
+ },
3879
+ () => {
3880
+ if (current) setRoots([]);
3881
+ }
3882
+ );
3883
+ return () => {
3884
+ current = false;
3885
+ };
3886
+ }, [injected, reload, t]);
3887
+ const openCreate = () => {
3888
+ setFormError(null);
3889
+ setPreview(false);
3890
+ setEditor({ mode: "create", name: "", description: "", whenToUse: "", modelInvocable: true, userInvocable: true, content: "" });
3891
+ };
3892
+ const openExisting = async (skill) => {
3893
+ setBusy(true);
3894
+ setFormError(null);
3895
+ try {
3896
+ const body = await injected.get(skill.name);
3897
+ setPreview(!skill.editable);
3898
+ setEditor({
3899
+ mode: skill.editable ? "edit" : "view",
3900
+ name: skill.name,
3901
+ description: skill.description,
3902
+ whenToUse: skill.whenToUse ?? "",
3903
+ modelInvocable: skill.invocation.modelInvocable,
3904
+ userInvocable: skill.invocation.userInvocable,
3905
+ content: body.content
3906
+ });
3907
+ } catch (error) {
3908
+ setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
3909
+ } finally {
3910
+ setBusy(false);
3911
+ }
3912
+ };
3913
+ const refreshUntil = (predicate, timeoutMs = 1e4) => {
3914
+ const deadline = Date.now() + timeoutMs;
3915
+ const tick = () => {
3916
+ if (Date.now() > deadline) return;
3917
+ setTimeout(() => {
3918
+ void injected.list().then(
3919
+ (body) => {
3920
+ setSkills(body.skills);
3921
+ if (!predicate(body.skills)) tick();
3922
+ },
3923
+ () => tick()
3924
+ );
3925
+ }, 1e3);
3926
+ };
3927
+ tick();
3928
+ };
3929
+ const doSave = async () => {
3930
+ if (editor === null) return;
3931
+ setBusy(true);
3932
+ setFormError(null);
3933
+ try {
3934
+ const name2 = editor.name.trim();
3935
+ await injected.save({
3936
+ name: name2,
3937
+ description: editor.description,
3938
+ whenToUse: editor.whenToUse.trim() === "" ? void 0 : editor.whenToUse,
3939
+ modelInvocable: editor.modelInvocable,
3940
+ userInvocable: editor.userInvocable,
3941
+ content: editor.content
3942
+ });
3943
+ setOutcome({ ok: true, text: t("saved") });
3944
+ setEditor(null);
3945
+ refreshUntil((skills2) => skills2.some((skill) => skill.name === name2));
3946
+ } catch (error) {
3947
+ setFormError(String(error instanceof Error ? error.message : error));
3948
+ } finally {
3949
+ setBusy(false);
3950
+ }
3951
+ };
3952
+ const doDelete = async () => {
3953
+ if (confirmName === null) return;
3954
+ const name2 = confirmName;
3955
+ setBusy(true);
3956
+ try {
3957
+ await injected.remove(name2);
3958
+ setOutcome({ ok: true, text: t("saved") });
3959
+ refreshUntil((skills2) => !skills2.some((skill) => skill.name === name2));
3960
+ } catch (error) {
3961
+ setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
3962
+ } finally {
3963
+ setBusy(false);
3964
+ setConfirmName(null);
3965
+ }
3966
+ };
3967
+ const doToggle = async (skill) => {
3968
+ const enabled = skill.invocation.modelInvocable || skill.invocation.userInvocable;
3969
+ setBusy(true);
3970
+ try {
3971
+ await injected.policy(skill.name, !enabled);
3972
+ setOutcome({ ok: true, text: !enabled ? t("skillEnabled") : t("skillDisabledMsg") });
3973
+ refreshUntil((list) => {
3974
+ const row = list.find((item) => item.name === skill.name);
3975
+ return row !== void 0 && row.invocation.modelInvocable === !enabled && row.invocation.userInvocable === !enabled;
3976
+ });
3977
+ } catch (error) {
3978
+ setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
3979
+ } finally {
3980
+ setBusy(false);
3981
+ }
3982
+ };
3983
+ const doOpen = async (target) => {
3984
+ try {
3985
+ await injected.open(target);
3986
+ } catch (error) {
3987
+ setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
3988
+ }
3989
+ };
3990
+ const doAddRoot = async () => {
3991
+ if (addRoot === null || addRoot.value.trim() === "") return;
3992
+ setRootBusy(true);
3993
+ setFormError(null);
3994
+ try {
3995
+ await injected.addRoot(addRoot.kind === "local" ? { kind: "local", path: addRoot.value.trim() } : { kind: "git", url: addRoot.value.trim() });
3996
+ setOutcome({ ok: true, text: t("rootAdded") });
3997
+ setAddRoot(null);
3998
+ void injected.roots().then(
3999
+ (body) => setRoots(body.roots),
4000
+ () => setRoots([])
4001
+ );
4002
+ for (let tick = 0; tick < 4; tick++) {
4003
+ await new Promise((resolve) => setTimeout(resolve, 1500));
4004
+ void injected.list().then(
4005
+ (body) => setSkills(body.skills),
4006
+ () => void 0
4007
+ );
4008
+ }
4009
+ } catch (error) {
4010
+ setFormError(String(error instanceof Error ? error.message : error));
4011
+ } finally {
4012
+ setRootBusy(false);
4013
+ }
4014
+ };
4015
+ const doRemoveRoot = async () => {
4016
+ if (confirmRootId === null) return;
4017
+ setRootBusy(true);
4018
+ try {
4019
+ await injected.removeRoot(confirmRootId);
4020
+ setOutcome({ ok: true, text: t("rootRemoved") });
4021
+ setRoots(null);
4022
+ void injected.roots().then(
4023
+ (body) => setRoots(body.roots),
4024
+ () => setRoots([])
4025
+ );
4026
+ setReload((value) => value + 1);
4027
+ } catch (error) {
4028
+ setOutcome({ ok: false, text: `${t("failed")}: ${String(error instanceof Error ? error.message : error)}` });
4029
+ } finally {
4030
+ setRootBusy(false);
4031
+ setConfirmRootId(null);
4032
+ }
4033
+ };
4034
+ const readOnly = editor?.mode === "view";
4035
+ const needle = query.trim().toLowerCase();
4036
+ const filtered = skills === null ? [] : skills.filter((skill) => (sourceFilter === "all" || skill.source === sourceFilter) && (needle === "" || skill.name.toLowerCase().includes(needle) || skill.description.toLowerCase().includes(needle)));
4037
+ const sources = skills === null ? [] : [...new Set(skills.map((skill) => skill.source))];
4038
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-section", children: [
4039
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: CSS }),
4040
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-head", children: [
4041
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconSkillOutline16, { "aria-hidden": "true" }),
4042
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t("skillsTitle") }),
4043
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-spacer" }),
4044
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", onClick: () => void doOpen({ target: "user-skills" }), children: t("openUserSkills") }),
4045
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", size: "sm", onClick: openCreate, children: t("newSkill") })
4046
+ ] }),
4047
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-intro", children: t("skillsIntro") }),
4048
+ outcome !== null && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-banner", "data-kind": outcome.ok ? "ok" : "error", role: "status", children: [
4049
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.StateDot, { state: outcome.ok ? "done" : "error", size: 10 }),
4050
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "dpc-bannerBody", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: outcome.text }) })
4051
+ ] }),
4052
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-listHead", children: [
4053
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t("skillsTab") }),
4054
+ skills !== null && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "dpc-count", children: [
4055
+ filtered.length,
4056
+ "/",
4057
+ skills.length
1253
4058
  ] }),
1254
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-spacer" }),
1255
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4059
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-spacer" }),
4060
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1256
4061
  "input",
1257
4062
  {
1258
4063
  className: "dpc-search",
@@ -1263,9 +4068,9 @@ function SkillsTab(props) {
1263
4068
  onChange: (event) => setQuery(event.target.value)
1264
4069
  }
1265
4070
  ),
1266
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dpc-refresh", "aria-label": t("refresh"), title: t("refresh"), disabled: busy, onClick: () => setReload((value) => value + 1), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.IconRefreshOutline14, { size: 14, "aria-hidden": "true" }) })
4071
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "dpc-refresh", "aria-label": t("refresh"), title: t("refresh"), disabled: busy, onClick: () => setReload((value) => value + 1), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.IconRefreshOutline14, { size: 14, "aria-hidden": "true" }) })
1267
4072
  ] }),
1268
- sources.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dpc-chips", role: "group", "aria-label": t("source"), children: [{ id: "all", label: t("filterAll") }, ...sources.map((source) => ({ id: source, label: t(SOURCE_KEYS[source] ?? "sourceCustom") }))].map((chip) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4073
+ sources.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "dpc-chips", role: "group", "aria-label": t("source"), children: [{ id: "all", label: t("filterAll") }, ...sources.map((source) => ({ id: source, label: t(SOURCE_KEYS[source] ?? "sourceCustom") }))].map((chip) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1269
4074
  "button",
1270
4075
  {
1271
4076
  type: "button",
@@ -1276,19 +4081,19 @@ function SkillsTab(props) {
1276
4081
  },
1277
4082
  chip.id
1278
4083
  )) }),
1279
- skills === null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-empty", children: t("loading") }),
1280
- skills !== null && filtered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-empty", children: skills.length === 0 ? t("emptySkills") : t("noMatch") }),
1281
- skills !== null && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "dpc-cards", children: filtered.map((skill) => {
4084
+ skills === null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-empty", children: t("loading") }),
4085
+ skills !== null && filtered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-empty", children: skills.length === 0 ? t("emptySkills") : t("noMatch") }),
4086
+ skills !== null && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "dpc-cards", children: filtered.map((skill) => {
1282
4087
  const tag = policyTag(skill);
1283
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: "dpc-card", children: [
1284
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-cardTop", children: [
1285
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { className: "dpc-cardTitle", title: skill.name, children: skill.name }),
1286
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-tag", "data-kind": "source", children: t(SOURCE_KEYS[skill.source] ?? "sourceCustom") }),
1287
- tag.key !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-tag", "data-kind": tag.off ? "off" : void 0, children: t(tag.key) })
4088
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { className: "dpc-card", children: [
4089
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-cardTop", children: [
4090
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { className: "dpc-cardTitle", title: skill.name, children: skill.name }),
4091
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-tag", "data-kind": "source", children: t(SOURCE_KEYS[skill.source] ?? "sourceCustom") }),
4092
+ tag.key !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-tag", "data-kind": tag.off ? "off" : void 0, children: t(tag.key) })
1288
4093
  ] }),
1289
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-cardDesc", title: skill.description, children: skill.description }),
1290
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-cardRow", children: [
1291
- skill.policyEditable && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4094
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-cardDesc", title: skill.description, children: skill.description }),
4095
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-cardRow", children: [
4096
+ skill.policyEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1292
4097
  "button",
1293
4098
  {
1294
4099
  type: "button",
@@ -1299,37 +4104,37 @@ function SkillsTab(props) {
1299
4104
  title: t("toggleSkillHint"),
1300
4105
  disabled: busy,
1301
4106
  onClick: () => void doToggle(skill),
1302
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-switchKnob" })
4107
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-switchKnob" })
1303
4108
  }
1304
4109
  ),
1305
- skill.dir !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dpc-link", onClick: () => void doOpen({ target: "skill", name: skill.name }), children: t("openFolder") }),
1306
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-spacer" }),
1307
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => void openExisting(skill), children: skill.editable ? t("edit") : t("view") }),
1308
- skill.editable && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => setConfirmName(skill.name), children: t("delete") })
4110
+ skill.dir !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "dpc-link", onClick: () => void doOpen({ target: "skill", name: skill.name }), children: t("openFolder") }),
4111
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-spacer" }),
4112
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => void openExisting(skill), children: skill.editable ? t("edit") : t("view") }),
4113
+ skill.removable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => setConfirmName(skill.name), children: t("delete") })
1309
4114
  ] })
1310
4115
  ] }, `${skill.source}/${skill.name}`);
1311
4116
  }) }),
1312
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-listHead dpc-rootsHead", children: [
1313
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: t("rootsTitle") }),
1314
- roots !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-count", children: roots.length }),
1315
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-spacer" }),
1316
- addRoot === null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", onClick: () => setAddRoot({ kind: "git", value: "" }), children: t("addRoot") })
4117
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-listHead dpc-rootsHead", children: [
4118
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: t("rootsTitle") }),
4119
+ roots !== null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-count", children: roots.length }),
4120
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-spacer" }),
4121
+ addRoot === null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", onClick: () => setAddRoot({ kind: "git", value: "" }), children: t("addRoot") })
1317
4122
  ] }),
1318
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-intro", children: t("rootsIntro") }),
1319
- roots === null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-empty", children: t("loading") }),
1320
- roots !== null && roots.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-empty", children: t("emptyRoots") }),
1321
- roots !== null && roots.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "dpc-roots", children: roots.map((root) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { className: "dpc-root", children: [
1322
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-tag", "data-kind": "source", children: root.kind === "git" ? "GitHub" : t("rootLocal") }),
1323
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { className: "dpc-rootLabel", title: root.kind === "git" ? root.url : root.path, children: root.label }),
1324
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-rootPath", children: root.kind === "git" ? root.url : root.path }),
1325
- !root.live && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-tag", "data-kind": "off", children: t("rootStale") }),
1326
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-spacer" }),
1327
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dpc-link", onClick: () => void doOpen({ target: "root", id: root.id }), children: t("openFolder") }),
1328
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", disabled: rootBusy, onClick: () => setConfirmRootId(root.id), children: t("delete") })
4123
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-intro", children: t("rootsIntro") }),
4124
+ roots === null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-empty", children: t("loading") }),
4125
+ roots !== null && roots.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-empty", children: t("emptyRoots") }),
4126
+ roots !== null && roots.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "dpc-roots", children: roots.map((root) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("li", { className: "dpc-root", children: [
4127
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-tag", "data-kind": "source", children: root.kind === "git" ? "GitHub" : t("rootLocal") }),
4128
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { className: "dpc-rootLabel", title: root.kind === "git" ? root.url : root.path, children: root.label }),
4129
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-rootPath", children: root.kind === "git" ? root.url : root.path }),
4130
+ !root.live && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-tag", "data-kind": "off", children: t("rootStale") }),
4131
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-spacer" }),
4132
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "dpc-link", onClick: () => void doOpen({ target: "root", id: root.id }), children: t("openFolder") }),
4133
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", disabled: rootBusy, onClick: () => setConfirmRootId(root.id), children: t("delete") })
1329
4134
  ] }, root.id)) }),
1330
- addRoot !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-form dpc-addRoot", children: [
1331
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-addRootRow", children: [
1332
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4135
+ addRoot !== null && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-form dpc-addRoot", children: [
4136
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-addRootRow", children: [
4137
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1333
4138
  "select",
1334
4139
  {
1335
4140
  className: "dpc-select",
@@ -1337,12 +4142,12 @@ function SkillsTab(props) {
1337
4142
  value: addRoot.kind,
1338
4143
  onChange: (event) => setAddRoot({ ...addRoot, kind: event.target.value }),
1339
4144
  children: [
1340
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "git", children: "GitHub" }),
1341
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: "local", children: t("rootLocal") })
4145
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "git", children: "GitHub" }),
4146
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "local", children: t("rootLocal") })
1342
4147
  ]
1343
4148
  }
1344
4149
  ),
1345
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4150
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1346
4151
  "input",
1347
4152
  {
1348
4153
  className: "dpc-input",
@@ -1357,16 +4162,16 @@ function SkillsTab(props) {
1357
4162
  }
1358
4163
  }
1359
4164
  ),
1360
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", size: "sm", disabled: rootBusy || addRoot.value.trim() === "", onClick: () => void doAddRoot(), children: t("add") }),
1361
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", disabled: rootBusy, onClick: () => {
4165
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", size: "sm", disabled: rootBusy || addRoot.value.trim() === "", onClick: () => void doAddRoot(), children: t("add") }),
4166
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", disabled: rootBusy, onClick: () => {
1362
4167
  setAddRoot(null);
1363
4168
  setFormError(null);
1364
4169
  }, children: t("cancel") })
1365
4170
  ] }),
1366
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-intro", children: addRoot.kind === "git" ? t("rootGitHint") : t("rootLocalHint") }),
1367
- formError !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-formError", children: formError })
4171
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-intro", children: addRoot.kind === "git" ? t("rootGitHint") : t("rootLocalHint") }),
4172
+ formError !== null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-formError", children: formError })
1368
4173
  ] }),
1369
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4174
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1370
4175
  import_dsh_client_ui_primitives3.Modal,
1371
4176
  {
1372
4177
  open: editor !== null,
@@ -1374,10 +4179,10 @@ function SkillsTab(props) {
1374
4179
  title: editor === null ? "" : editor.mode === "create" ? t("newSkill") : editor.mode === "edit" ? t("editSkill") : t("viewSkill"),
1375
4180
  className: "dpc-modalForm",
1376
4181
  contentClassName: "dpc-modalScroll",
1377
- children: editor !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-form", children: [
1378
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "dpc-label", children: [
1379
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("skillName") }),
1380
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4182
+ children: editor !== null && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-form", children: [
4183
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "dpc-label", children: [
4184
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("skillName") }),
4185
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1381
4186
  "input",
1382
4187
  {
1383
4188
  className: "dpc-input",
@@ -1387,9 +4192,9 @@ function SkillsTab(props) {
1387
4192
  }
1388
4193
  )
1389
4194
  ] }),
1390
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "dpc-label", children: [
1391
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("skillDescription") }),
1392
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4195
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "dpc-label", children: [
4196
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("skillDescription") }),
4197
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1393
4198
  "input",
1394
4199
  {
1395
4200
  className: "dpc-input",
@@ -1399,9 +4204,9 @@ function SkillsTab(props) {
1399
4204
  }
1400
4205
  )
1401
4206
  ] }),
1402
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "dpc-label", children: [
1403
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("skillWhenToUse") }),
1404
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4207
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "dpc-label", children: [
4208
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("skillWhenToUse") }),
4209
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1405
4210
  "input",
1406
4211
  {
1407
4212
  className: "dpc-input",
@@ -1411,9 +4216,9 @@ function SkillsTab(props) {
1411
4216
  }
1412
4217
  )
1413
4218
  ] }),
1414
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-checks", children: [
1415
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { children: [
1416
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4219
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-checks", children: [
4220
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
4221
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1417
4222
  "input",
1418
4223
  {
1419
4224
  type: "checkbox",
@@ -1424,8 +4229,8 @@ function SkillsTab(props) {
1424
4229
  ),
1425
4230
  t("modelInvocable")
1426
4231
  ] }),
1427
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { children: [
1428
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4232
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
4233
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1429
4234
  "input",
1430
4235
  {
1431
4236
  type: "checkbox",
@@ -1437,16 +4242,16 @@ function SkillsTab(props) {
1437
4242
  t("userInvocable")
1438
4243
  ] })
1439
4244
  ] }),
1440
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-label", children: [
1441
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-cardRow", children: [
1442
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("skillContent") }),
1443
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-spacer" }),
1444
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-segments", role: "tablist", "aria-label": t("skillContent"), children: [
1445
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", role: "tab", "aria-selected": preview, className: "dpc-segment", "data-active": preview ? "true" : void 0, onClick: () => setPreview(true), children: t("skillPreview") }),
1446
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", role: "tab", "aria-selected": !preview, className: "dpc-segment", "data-active": !preview ? "true" : void 0, onClick: () => setPreview(false), children: readOnly ? t("skillPlainText") : t("edit") })
4245
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-label", children: [
4246
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-cardRow", children: [
4247
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("skillContent") }),
4248
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-spacer" }),
4249
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-segments", role: "tablist", "aria-label": t("skillContent"), children: [
4250
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", role: "tab", "aria-selected": preview, className: "dpc-segment", "data-active": preview ? "true" : void 0, onClick: () => setPreview(true), children: t("skillPreview") }),
4251
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", role: "tab", "aria-selected": !preview, className: "dpc-segment", "data-active": !preview ? "true" : void 0, onClick: () => setPreview(false), children: readOnly ? t("skillPlainText") : t("edit") })
1447
4252
  ] })
1448
4253
  ] }),
1449
- preview ? typeof import_dsh_client_ui_primitives3.MarkdownText === "function" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dpc-mdPreview", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: editor.content }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("textarea", { className: "dpc-textarea", value: editor.content, readOnly: true }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4254
+ preview ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "dpc-mdPreview", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MarkdownPreview, { text: editor.content }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1450
4255
  "textarea",
1451
4256
  {
1452
4257
  className: "dpc-textarea",
@@ -1456,71 +4261,71 @@ function SkillsTab(props) {
1456
4261
  }
1457
4262
  )
1458
4263
  ] }),
1459
- formError !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "dpc-formError", children: formError }),
1460
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-cardRow", children: [
1461
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-spacer" }),
1462
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", onClick: () => setEditor(null), children: readOnly ? t("close") : t("cancel") }),
1463
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", disabled: busy, onClick: () => void doSave(), children: t("save") })
4264
+ formError !== null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dpc-formError", children: formError }),
4265
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-cardRow", children: [
4266
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dpc-spacer" }),
4267
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", onClick: () => setEditor(null), children: readOnly ? t("close") : t("cancel") }),
4268
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", disabled: busy, onClick: () => void doSave(), children: t("save") })
1464
4269
  ] })
1465
4270
  ] })
1466
4271
  }
1467
4272
  ),
1468
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4273
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1469
4274
  import_dsh_client_ui_primitives3.Modal,
1470
4275
  {
1471
4276
  open: confirmName !== null,
1472
4277
  onClose: () => setConfirmName(null),
1473
4278
  title: t("confirmDelete"),
1474
4279
  description: confirmName ?? void 0,
1475
- footer: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1476
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", onClick: () => setConfirmName(null), children: t("cancel") }),
1477
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", disabled: busy, onClick: () => void doDelete(), children: t("delete") })
4280
+ footer: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
4281
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", onClick: () => setConfirmName(null), children: t("cancel") }),
4282
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", disabled: busy, onClick: () => void doDelete(), children: t("delete") })
1478
4283
  ] }),
1479
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("deleteWarn") })
4284
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: t("deleteWarn") })
1480
4285
  }
1481
4286
  ),
1482
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4287
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1483
4288
  import_dsh_client_ui_primitives3.Modal,
1484
4289
  {
1485
4290
  open: confirmRootId !== null,
1486
4291
  onClose: () => setConfirmRootId(null),
1487
4292
  title: t("confirmRemoveRoot"),
1488
4293
  description: roots?.find((root) => root.id === confirmRootId)?.label ?? void 0,
1489
- footer: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1490
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", onClick: () => setConfirmRootId(null), children: t("cancel") }),
1491
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", disabled: rootBusy, onClick: () => void doRemoveRoot(), children: t("delete") })
4294
+ footer: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
4295
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", onClick: () => setConfirmRootId(null), children: t("cancel") }),
4296
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "primary", disabled: rootBusy, onClick: () => void doRemoveRoot(), children: t("delete") })
1492
4297
  ] }),
1493
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("removeRootWarn") })
4298
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: t("removeRootWarn") })
1494
4299
  }
1495
4300
  )
1496
4301
  ] });
1497
4302
  }
1498
4303
 
1499
4304
  // src/client/CapabilitiesSection.tsx
1500
- var import_jsx_runtime4 = require("react/jsx-runtime");
4305
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1501
4306
  function CapabilitiesSection(props) {
1502
4307
  const { t, skills, mcp, market } = props;
1503
- const tabsId = (0, import_react4.useId)();
1504
- const tabRefs = (0, import_react4.useRef)([]);
4308
+ const tabsId = (0, import_react5.useId)();
4309
+ const tabRefs = (0, import_react5.useRef)([]);
1505
4310
  const rows = [
1506
4311
  { id: "skills", label: t("skillsTab") },
1507
4312
  { id: "mcp", label: t("mcpTab") },
1508
4313
  { id: "market", label: t("marketTab") }
1509
4314
  ];
1510
- const [activeId, setActiveId] = (0, import_react4.useState)("skills");
1511
- const [visitedIds, setVisitedIds] = (0, import_react4.useState)(() => /* @__PURE__ */ new Set(["skills"]));
1512
- (0, import_react4.useEffect)(() => {
4315
+ const [activeId, setActiveId] = (0, import_react5.useState)("skills");
4316
+ const [visitedIds, setVisitedIds] = (0, import_react5.useState)(() => /* @__PURE__ */ new Set(["skills"]));
4317
+ (0, import_react5.useEffect)(() => {
1513
4318
  setVisitedIds((previous) => {
1514
4319
  if (previous.has(activeId)) return previous;
1515
4320
  return /* @__PURE__ */ new Set([...previous, activeId]);
1516
4321
  });
1517
4322
  }, [activeId]);
1518
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dpc-section", children: [
1519
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: CSS }),
1520
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: "dpc-heading", children: t("sectionNav") }),
1521
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "dpc-tabs", role: "tablist", "aria-label": t("sectionNav"), children: rows.map((row, index) => {
4323
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dpc-section", children: [
4324
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("style", { children: CSS }),
4325
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "dpc-heading", children: t("sectionNav") }),
4326
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dpc-tabs", role: "tablist", "aria-label": t("sectionNav"), children: rows.map((row, index) => {
1522
4327
  const selected = row.id === activeId;
1523
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4328
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1524
4329
  "button",
1525
4330
  {
1526
4331
  ref: (element) => {
@@ -1566,7 +4371,7 @@ function CapabilitiesSection(props) {
1566
4371
  }) }),
1567
4372
  rows.filter((row) => row.id === activeId || visitedIds.has(row.id)).map((row) => {
1568
4373
  const selected = row.id === activeId;
1569
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4374
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1570
4375
  "div",
1571
4376
  {
1572
4377
  id: `${tabsId}-panel-${row.id}`,
@@ -1574,7 +4379,7 @@ function CapabilitiesSection(props) {
1574
4379
  role: "tabpanel",
1575
4380
  "aria-labelledby": `${tabsId}-tab-${row.id}`,
1576
4381
  hidden: !selected,
1577
- children: row.id === "skills" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkillsTab, { t, injected: skills }) : row.id === "mcp" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(McpTab, { t, injected: mcp }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MarketTab, { t, market, mcp })
4382
+ children: row.id === "skills" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkillsTab, { t, injected: skills }) : row.id === "mcp" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(McpTab, { t, injected: mcp }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MarketTab, { t, market, mcp })
1578
4383
  },
1579
4384
  row.id
1580
4385
  );
@@ -1589,7 +4394,7 @@ var zh = {
1589
4394
  mcpTab: "MCP",
1590
4395
  marketTab: "\u5E02\u573A",
1591
4396
  skillsTitle: "\u6280\u80FD\u7BA1\u7406",
1592
- skillsIntro: "\u67E5\u770B\u4E0E\u7F16\u8F91 dsh \u53D1\u73B0\u7684\u6280\u80FD\uFF1B\u7528\u6237\u7EA7\u6280\u80FD\uFF08DSH_HOME/skills\uFF09\u53EF\u5728\u6B64\u65B0\u5EFA\u3001\u4FEE\u6539\u3001\u5220\u9664\uFF0C\u6587\u4EF6\u88AB\u76D1\u542C\uFF0C\u4FDD\u5B58\u5373\u751F\u6548\u3002\u82E5\u5B58\u5728 ~/.claude/skills \u6216 ~/.codex/skills\uFF0C\u4F1A\u81EA\u52A8\u7EB3\u5165\u626B\u63CF\uFF08\u96F6\u62F7\u8D1D\u3001\u5B9E\u65F6\u540C\u6B65\uFF09\u3002\u5361\u7247\u4E0A\u7684\u5F00\u5173\u63A7\u5236\u662F\u5426\u52A0\u8F7D\uFF1A\u505C\u7528\u5373\u4ECE\u6A21\u578B\u4E0E\u7528\u6237\u76EE\u5F55\u540C\u65F6\u6458\u9664\uFF0C\u5F00\u542F\u6062\u590D\u9ED8\u8BA4\u3002",
4397
+ skillsIntro: "\u67E5\u770B\u4E0E\u7F16\u8F91 dsh \u53D1\u73B0\u7684\u6280\u80FD\uFF1B\u7528\u6237\u7EA7\u6280\u80FD\uFF08DSH_HOME/skills\uFF09\u53EF\u5728\u6B64\u65B0\u5EFA\u3001\u4FEE\u6539\u3001\u5220\u9664\uFF0C\u5E02\u573A/\u672C\u5730\u4ED3\u5E93\u5B89\u88C5\u7684\u6280\u80FD\u4E5F\u80FD\u5C31\u5730\u7F16\u8F91\uFF08\u5199\u56DE\u65F6\u4FDD\u7559\u6587\u4EF6\u91CC\u5176\u4F59 frontmatter \u952E\uFF09\uFF0C\u6587\u4EF6\u88AB\u76D1\u542C\uFF0C\u4FDD\u5B58\u5373\u751F\u6548\u3002\u82E5\u5B58\u5728 ~/.claude/skills \u6216 ~/.codex/skills\uFF0C\u4F1A\u81EA\u52A8\u7EB3\u5165\u626B\u63CF\uFF08\u96F6\u62F7\u8D1D\u3001\u5B9E\u65F6\u540C\u6B65\uFF09\u3002\u5361\u7247\u4E0A\u7684\u5F00\u5173\u63A7\u5236\u662F\u5426\u52A0\u8F7D\uFF1A\u505C\u7528\u5373\u4ECE\u6A21\u578B\u4E0E\u7528\u6237\u76EE\u5F55\u540C\u65F6\u6458\u9664\uFF0C\u5F00\u542F\u6062\u590D\u9ED8\u8BA4\u3002",
1593
4398
  newSkill: "\u65B0\u5EFA\u6280\u80FD",
1594
4399
  editSkill: "\u7F16\u8F91\u6280\u80FD",
1595
4400
  viewSkill: "\u67E5\u770B\u6280\u80FD",
@@ -1721,7 +4526,7 @@ var en = {
1721
4526
  mcpTab: "MCP",
1722
4527
  marketTab: "Market",
1723
4528
  skillsTitle: "Skills",
1724
- skillsIntro: "View and edit the skills dsh discovers; user-level skills (DSH_HOME/skills) can be created, edited, and deleted here \u2014 the directory is watched, saves apply without a restart. ~/.claude/skills and ~/.codex/skills are scanned too when present (zero-copy, live-synced). The switch on each card toggles loading: disabling removes the skill from both the model and user catalogs; enabling restores the default policy.",
4529
+ skillsIntro: "View and edit the skills dsh discovers; user-level skills (DSH_HOME/skills) can be created, edited, and deleted here, and skills installed from market/local repositories edit in place too (their other frontmatter keys survive the write). ~/.claude/skills and ~/.codex/skills are scanned too when present (zero-copy, live-synced). The switch on each card toggles loading: disabling removes the skill from both the model and user catalogs; enabling restores the default policy.",
1725
4530
  newSkill: "New skill",
1726
4531
  editSkill: "Edit skill",
1727
4532
  viewSkill: "View skill",
@@ -1859,7 +4664,7 @@ async function fetchJson(path, init) {
1859
4664
  var post = (path, body) => fetchJson(path, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) });
1860
4665
  var name = "dsh-plugin-capabilities";
1861
4666
  var inject = ["slots", "locale"];
1862
- function apply(ctx) {
4667
+ function apply2(ctx) {
1863
4668
  ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-plugin-capabilities: dictionaries");
1864
4669
  const t = ctx.locale.bind(NS);
1865
4670
  const skillsInjected = {
@@ -1906,9 +4711,14 @@ function apply(ctx) {
1906
4711
  order: 12,
1907
4712
  label: () => t("sectionNav"),
1908
4713
  locale: NS
1909
- }, () => (0, import_react5.createElement)(CapabilitiesSection, { t, skills: skillsInjected, mcp: mcpInjected, market: marketInjected }));
4714
+ }, () => (0, import_react6.createElement)(CapabilitiesSection, { t, skills: skillsInjected, mcp: mcpInjected, market: marketInjected }));
1910
4715
  });
1911
4716
  }
4717
+ /*! Bundled license information:
4718
+
4719
+ dompurify/dist/purify.es.mjs:
4720
+ (*! @license DOMPurify 3.4.13 | (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.13/LICENSE *)
4721
+ */
1912
4722
 
1913
4723
  return module.exports; } });
1914
4724
  //# sourceMappingURL=client.js.map