@orca-pt/orca-components 1.0.4 → 1.0.6

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.
@@ -71,8 +71,8 @@ function getGroupedButtons(buttons) {
71
71
  function generateMapId(index) {
72
72
  return `map-container-${index}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
73
73
  }
74
- function cleanOrcaMarkers(text) {
75
- return text.replace(/\[orca\..*?\]/g, "").trim();
74
+ function cleanOrcaMarkers(text2) {
75
+ return text2.replace(/\[orca\..*?\]/g, "").trim();
76
76
  }
77
77
  function hasLoadingMarkers(content) {
78
78
  return /\[orca\.(?:loading|image\.loading|loading\.image)\.start\]/.test(
@@ -460,9 +460,21 @@ function useContentParser(description) {
460
460
  return parseContent(content || "");
461
461
  });
462
462
  }
463
+ function stripIncompleteMarkers(content) {
464
+ let result = content;
465
+ for (const marker of MARKERS) {
466
+ const startIdx = result.lastIndexOf(marker.start);
467
+ if (startIdx === -1) continue;
468
+ const afterStart = result.substring(startIdx + marker.start.length);
469
+ if (!afterStart.includes(marker.end)) {
470
+ result = result.substring(0, startIdx);
471
+ }
472
+ }
473
+ return result;
474
+ }
463
475
  function parseContent(content) {
464
476
  const parts = [];
465
- let remainingContent = content;
477
+ let remainingContent = stripIncompleteMarkers(content);
466
478
  let iteration = 0;
467
479
  const MAX_ITERATIONS = 100;
468
480
  while (remainingContent.length > 0 && iteration < MAX_ITERATIONS) {
@@ -483,8 +495,8 @@ function parseContent(content) {
483
495
  }
484
496
  return parts;
485
497
  }
486
- function addCleanTextIfExists(parts, text) {
487
- const cleanText = removeCompleteMarkers(text).trim();
498
+ function addCleanTextIfExists(parts, text2) {
499
+ const cleanText = removeCompleteMarkers(text2).trim();
488
500
  if (cleanText) {
489
501
  parts.push({ type: "text", content: cleanText });
490
502
  }
@@ -739,9 +751,9 @@ const EXPAND_ICON = `
739
751
  <span style="color: rgb(var(--v-theme-on-surface)); font-feature-settings: 'liga' off, 'clig' off; font-family: Inter; font-size: 12px; font-style: normal; font-weight: 400; line-height: 24px;"> Expand</span>
740
752
  </div>
741
753
  `;
742
- async function copyToClipboard(text, button) {
754
+ async function copyToClipboard(text2, button) {
743
755
  try {
744
- await navigator.clipboard.writeText(text);
756
+ await navigator.clipboard.writeText(text2);
745
757
  button.innerHTML = COPIED_ICON;
746
758
  setTimeout(() => {
747
759
  button.innerHTML = COPY_ICON;
@@ -852,6 +864,1015 @@ const LOADING_CONTENT_TYPES = [
852
864
  function isLoadingType(type) {
853
865
  return LOADING_CONTENT_TYPES.includes(type);
854
866
  }
867
+ /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
868
+ const {
869
+ entries,
870
+ setPrototypeOf,
871
+ isFrozen,
872
+ getPrototypeOf,
873
+ getOwnPropertyDescriptor
874
+ } = Object;
875
+ let {
876
+ freeze,
877
+ seal,
878
+ create
879
+ } = Object;
880
+ let {
881
+ apply,
882
+ construct
883
+ } = typeof Reflect !== "undefined" && Reflect;
884
+ if (!freeze) {
885
+ freeze = function freeze2(x) {
886
+ return x;
887
+ };
888
+ }
889
+ if (!seal) {
890
+ seal = function seal2(x) {
891
+ return x;
892
+ };
893
+ }
894
+ if (!apply) {
895
+ apply = function apply2(func, thisArg) {
896
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
897
+ args[_key - 2] = arguments[_key];
898
+ }
899
+ return func.apply(thisArg, args);
900
+ };
901
+ }
902
+ if (!construct) {
903
+ construct = function construct2(Func) {
904
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
905
+ args[_key2 - 1] = arguments[_key2];
906
+ }
907
+ return new Func(...args);
908
+ };
909
+ }
910
+ const arrayForEach = unapply(Array.prototype.forEach);
911
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
912
+ const arrayPop = unapply(Array.prototype.pop);
913
+ const arrayPush = unapply(Array.prototype.push);
914
+ const arraySplice = unapply(Array.prototype.splice);
915
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
916
+ const stringToString = unapply(String.prototype.toString);
917
+ const stringMatch = unapply(String.prototype.match);
918
+ const stringReplace = unapply(String.prototype.replace);
919
+ const stringIndexOf = unapply(String.prototype.indexOf);
920
+ const stringTrim = unapply(String.prototype.trim);
921
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
922
+ const regExpTest = unapply(RegExp.prototype.test);
923
+ const typeErrorCreate = unconstruct(TypeError);
924
+ function unapply(func) {
925
+ return function(thisArg) {
926
+ if (thisArg instanceof RegExp) {
927
+ thisArg.lastIndex = 0;
928
+ }
929
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
930
+ args[_key3 - 1] = arguments[_key3];
931
+ }
932
+ return apply(func, thisArg, args);
933
+ };
934
+ }
935
+ function unconstruct(Func) {
936
+ return function() {
937
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
938
+ args[_key4] = arguments[_key4];
939
+ }
940
+ return construct(Func, args);
941
+ };
942
+ }
943
+ function addToSet(set, array) {
944
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
945
+ if (setPrototypeOf) {
946
+ setPrototypeOf(set, null);
947
+ }
948
+ let l = array.length;
949
+ while (l--) {
950
+ let element = array[l];
951
+ if (typeof element === "string") {
952
+ const lcElement = transformCaseFunc(element);
953
+ if (lcElement !== element) {
954
+ if (!isFrozen(array)) {
955
+ array[l] = lcElement;
956
+ }
957
+ element = lcElement;
958
+ }
959
+ }
960
+ set[element] = true;
961
+ }
962
+ return set;
963
+ }
964
+ function cleanArray(array) {
965
+ for (let index = 0; index < array.length; index++) {
966
+ const isPropertyExist = objectHasOwnProperty(array, index);
967
+ if (!isPropertyExist) {
968
+ array[index] = null;
969
+ }
970
+ }
971
+ return array;
972
+ }
973
+ function clone(object) {
974
+ const newObject = create(null);
975
+ for (const [property, value] of entries(object)) {
976
+ const isPropertyExist = objectHasOwnProperty(object, property);
977
+ if (isPropertyExist) {
978
+ if (Array.isArray(value)) {
979
+ newObject[property] = cleanArray(value);
980
+ } else if (value && typeof value === "object" && value.constructor === Object) {
981
+ newObject[property] = clone(value);
982
+ } else {
983
+ newObject[property] = value;
984
+ }
985
+ }
986
+ }
987
+ return newObject;
988
+ }
989
+ function lookupGetter(object, prop) {
990
+ while (object !== null) {
991
+ const desc = getOwnPropertyDescriptor(object, prop);
992
+ if (desc) {
993
+ if (desc.get) {
994
+ return unapply(desc.get);
995
+ }
996
+ if (typeof desc.value === "function") {
997
+ return unapply(desc.value);
998
+ }
999
+ }
1000
+ object = getPrototypeOf(object);
1001
+ }
1002
+ function fallbackValue() {
1003
+ return null;
1004
+ }
1005
+ return fallbackValue;
1006
+ }
1007
+ const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
1008
+ const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
1009
+ const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
1010
+ const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
1011
+ const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
1012
+ const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
1013
+ const text = freeze(["#text"]);
1014
+ const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
1015
+ const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
1016
+ const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "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"]);
1017
+ const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
1018
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
1019
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
1020
+ const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
1021
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
1022
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
1023
+ const IS_ALLOWED_URI = seal(
1024
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
1025
+ // eslint-disable-line no-useless-escape
1026
+ );
1027
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
1028
+ const ATTR_WHITESPACE = seal(
1029
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
1030
+ // eslint-disable-line no-control-regex
1031
+ );
1032
+ const DOCTYPE_NAME = seal(/^html$/i);
1033
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
1034
+ var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
1035
+ __proto__: null,
1036
+ ARIA_ATTR,
1037
+ ATTR_WHITESPACE,
1038
+ CUSTOM_ELEMENT,
1039
+ DATA_ATTR,
1040
+ DOCTYPE_NAME,
1041
+ ERB_EXPR,
1042
+ IS_ALLOWED_URI,
1043
+ IS_SCRIPT_OR_DATA,
1044
+ MUSTACHE_EXPR,
1045
+ TMPLIT_EXPR
1046
+ });
1047
+ const NODE_TYPE = {
1048
+ element: 1,
1049
+ text: 3,
1050
+ // Deprecated
1051
+ progressingInstruction: 7,
1052
+ comment: 8,
1053
+ document: 9
1054
+ };
1055
+ const getGlobal = function getGlobal2() {
1056
+ return typeof window === "undefined" ? null : window;
1057
+ };
1058
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
1059
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
1060
+ return null;
1061
+ }
1062
+ let suffix = null;
1063
+ const ATTR_NAME = "data-tt-policy-suffix";
1064
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
1065
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
1066
+ }
1067
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
1068
+ try {
1069
+ return trustedTypes.createPolicy(policyName, {
1070
+ createHTML(html2) {
1071
+ return html2;
1072
+ },
1073
+ createScriptURL(scriptUrl) {
1074
+ return scriptUrl;
1075
+ }
1076
+ });
1077
+ } catch (_) {
1078
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
1079
+ return null;
1080
+ }
1081
+ };
1082
+ const _createHooksMap = function _createHooksMap2() {
1083
+ return {
1084
+ afterSanitizeAttributes: [],
1085
+ afterSanitizeElements: [],
1086
+ afterSanitizeShadowDOM: [],
1087
+ beforeSanitizeAttributes: [],
1088
+ beforeSanitizeElements: [],
1089
+ beforeSanitizeShadowDOM: [],
1090
+ uponSanitizeAttribute: [],
1091
+ uponSanitizeElement: [],
1092
+ uponSanitizeShadowNode: []
1093
+ };
1094
+ };
1095
+ function createDOMPurify() {
1096
+ let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
1097
+ const DOMPurify = (root) => createDOMPurify(root);
1098
+ DOMPurify.version = "3.3.1";
1099
+ DOMPurify.removed = [];
1100
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
1101
+ DOMPurify.isSupported = false;
1102
+ return DOMPurify;
1103
+ }
1104
+ let {
1105
+ document: document2
1106
+ } = window2;
1107
+ const originalDocument = document2;
1108
+ const currentScript = originalDocument.currentScript;
1109
+ const {
1110
+ DocumentFragment,
1111
+ HTMLTemplateElement,
1112
+ Node,
1113
+ Element,
1114
+ NodeFilter,
1115
+ NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
1116
+ HTMLFormElement,
1117
+ DOMParser,
1118
+ trustedTypes
1119
+ } = window2;
1120
+ const ElementPrototype = Element.prototype;
1121
+ const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
1122
+ const remove = lookupGetter(ElementPrototype, "remove");
1123
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
1124
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
1125
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
1126
+ if (typeof HTMLTemplateElement === "function") {
1127
+ const template = document2.createElement("template");
1128
+ if (template.content && template.content.ownerDocument) {
1129
+ document2 = template.content.ownerDocument;
1130
+ }
1131
+ }
1132
+ let trustedTypesPolicy;
1133
+ let emptyHTML = "";
1134
+ const {
1135
+ implementation,
1136
+ createNodeIterator,
1137
+ createDocumentFragment,
1138
+ getElementsByTagName
1139
+ } = document2;
1140
+ const {
1141
+ importNode
1142
+ } = originalDocument;
1143
+ let hooks = _createHooksMap();
1144
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
1145
+ const {
1146
+ MUSTACHE_EXPR: MUSTACHE_EXPR2,
1147
+ ERB_EXPR: ERB_EXPR2,
1148
+ TMPLIT_EXPR: TMPLIT_EXPR2,
1149
+ DATA_ATTR: DATA_ATTR2,
1150
+ ARIA_ATTR: ARIA_ATTR2,
1151
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
1152
+ ATTR_WHITESPACE: ATTR_WHITESPACE2,
1153
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT2
1154
+ } = EXPRESSIONS;
1155
+ let {
1156
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
1157
+ } = EXPRESSIONS;
1158
+ let ALLOWED_TAGS = null;
1159
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
1160
+ let ALLOWED_ATTR = null;
1161
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
1162
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
1163
+ tagNameCheck: {
1164
+ writable: true,
1165
+ configurable: false,
1166
+ enumerable: true,
1167
+ value: null
1168
+ },
1169
+ attributeNameCheck: {
1170
+ writable: true,
1171
+ configurable: false,
1172
+ enumerable: true,
1173
+ value: null
1174
+ },
1175
+ allowCustomizedBuiltInElements: {
1176
+ writable: true,
1177
+ configurable: false,
1178
+ enumerable: true,
1179
+ value: false
1180
+ }
1181
+ }));
1182
+ let FORBID_TAGS = null;
1183
+ let FORBID_ATTR = null;
1184
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
1185
+ tagCheck: {
1186
+ writable: true,
1187
+ configurable: false,
1188
+ enumerable: true,
1189
+ value: null
1190
+ },
1191
+ attributeCheck: {
1192
+ writable: true,
1193
+ configurable: false,
1194
+ enumerable: true,
1195
+ value: null
1196
+ }
1197
+ }));
1198
+ let ALLOW_ARIA_ATTR = true;
1199
+ let ALLOW_DATA_ATTR = true;
1200
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
1201
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
1202
+ let SAFE_FOR_TEMPLATES = false;
1203
+ let SAFE_FOR_XML = true;
1204
+ let WHOLE_DOCUMENT = false;
1205
+ let SET_CONFIG = false;
1206
+ let FORCE_BODY = false;
1207
+ let RETURN_DOM = false;
1208
+ let RETURN_DOM_FRAGMENT = false;
1209
+ let RETURN_TRUSTED_TYPE = false;
1210
+ let SANITIZE_DOM = true;
1211
+ let SANITIZE_NAMED_PROPS = false;
1212
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
1213
+ let KEEP_CONTENT = true;
1214
+ let IN_PLACE = false;
1215
+ let USE_PROFILES = {};
1216
+ let FORBID_CONTENTS = null;
1217
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
1218
+ let DATA_URI_TAGS = null;
1219
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
1220
+ let URI_SAFE_ATTRIBUTES = null;
1221
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
1222
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
1223
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
1224
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
1225
+ let NAMESPACE = HTML_NAMESPACE;
1226
+ let IS_EMPTY_INPUT = false;
1227
+ let ALLOWED_NAMESPACES = null;
1228
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
1229
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
1230
+ let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
1231
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
1232
+ let PARSER_MEDIA_TYPE = null;
1233
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
1234
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
1235
+ let transformCaseFunc = null;
1236
+ let CONFIG = null;
1237
+ const formElement = document2.createElement("form");
1238
+ const isRegexOrFunction = function isRegexOrFunction2(testValue) {
1239
+ return testValue instanceof RegExp || testValue instanceof Function;
1240
+ };
1241
+ const _parseConfig = function _parseConfig2() {
1242
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1243
+ if (CONFIG && CONFIG === cfg) {
1244
+ return;
1245
+ }
1246
+ if (!cfg || typeof cfg !== "object") {
1247
+ cfg = {};
1248
+ }
1249
+ cfg = clone(cfg);
1250
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
1251
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
1252
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
1253
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
1254
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
1255
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
1256
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
1257
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
1258
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
1259
+ FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
1260
+ FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
1261
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
1262
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
1263
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
1264
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
1265
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
1266
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
1267
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
1268
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
1269
+ RETURN_DOM = cfg.RETURN_DOM || false;
1270
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
1271
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
1272
+ FORCE_BODY = cfg.FORCE_BODY || false;
1273
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
1274
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
1275
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
1276
+ IN_PLACE = cfg.IN_PLACE || false;
1277
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
1278
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
1279
+ MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
1280
+ HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
1281
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
1282
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
1283
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
1284
+ }
1285
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
1286
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
1287
+ }
1288
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
1289
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
1290
+ }
1291
+ if (SAFE_FOR_TEMPLATES) {
1292
+ ALLOW_DATA_ATTR = false;
1293
+ }
1294
+ if (RETURN_DOM_FRAGMENT) {
1295
+ RETURN_DOM = true;
1296
+ }
1297
+ if (USE_PROFILES) {
1298
+ ALLOWED_TAGS = addToSet({}, text);
1299
+ ALLOWED_ATTR = [];
1300
+ if (USE_PROFILES.html === true) {
1301
+ addToSet(ALLOWED_TAGS, html$1);
1302
+ addToSet(ALLOWED_ATTR, html);
1303
+ }
1304
+ if (USE_PROFILES.svg === true) {
1305
+ addToSet(ALLOWED_TAGS, svg$1);
1306
+ addToSet(ALLOWED_ATTR, svg);
1307
+ addToSet(ALLOWED_ATTR, xml);
1308
+ }
1309
+ if (USE_PROFILES.svgFilters === true) {
1310
+ addToSet(ALLOWED_TAGS, svgFilters);
1311
+ addToSet(ALLOWED_ATTR, svg);
1312
+ addToSet(ALLOWED_ATTR, xml);
1313
+ }
1314
+ if (USE_PROFILES.mathMl === true) {
1315
+ addToSet(ALLOWED_TAGS, mathMl$1);
1316
+ addToSet(ALLOWED_ATTR, mathMl);
1317
+ addToSet(ALLOWED_ATTR, xml);
1318
+ }
1319
+ }
1320
+ if (cfg.ADD_TAGS) {
1321
+ if (typeof cfg.ADD_TAGS === "function") {
1322
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
1323
+ } else {
1324
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
1325
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
1326
+ }
1327
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
1328
+ }
1329
+ }
1330
+ if (cfg.ADD_ATTR) {
1331
+ if (typeof cfg.ADD_ATTR === "function") {
1332
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
1333
+ } else {
1334
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
1335
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
1336
+ }
1337
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
1338
+ }
1339
+ }
1340
+ if (cfg.ADD_URI_SAFE_ATTR) {
1341
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
1342
+ }
1343
+ if (cfg.FORBID_CONTENTS) {
1344
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
1345
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
1346
+ }
1347
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
1348
+ }
1349
+ if (cfg.ADD_FORBID_CONTENTS) {
1350
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
1351
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
1352
+ }
1353
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
1354
+ }
1355
+ if (KEEP_CONTENT) {
1356
+ ALLOWED_TAGS["#text"] = true;
1357
+ }
1358
+ if (WHOLE_DOCUMENT) {
1359
+ addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
1360
+ }
1361
+ if (ALLOWED_TAGS.table) {
1362
+ addToSet(ALLOWED_TAGS, ["tbody"]);
1363
+ delete FORBID_TAGS.tbody;
1364
+ }
1365
+ if (cfg.TRUSTED_TYPES_POLICY) {
1366
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
1367
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
1368
+ }
1369
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
1370
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
1371
+ }
1372
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
1373
+ emptyHTML = trustedTypesPolicy.createHTML("");
1374
+ } else {
1375
+ if (trustedTypesPolicy === void 0) {
1376
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
1377
+ }
1378
+ if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
1379
+ emptyHTML = trustedTypesPolicy.createHTML("");
1380
+ }
1381
+ }
1382
+ if (freeze) {
1383
+ freeze(cfg);
1384
+ }
1385
+ CONFIG = cfg;
1386
+ };
1387
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
1388
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
1389
+ const _checkValidNamespace = function _checkValidNamespace2(element) {
1390
+ let parent = getParentNode(element);
1391
+ if (!parent || !parent.tagName) {
1392
+ parent = {
1393
+ namespaceURI: NAMESPACE,
1394
+ tagName: "template"
1395
+ };
1396
+ }
1397
+ const tagName = stringToLowerCase(element.tagName);
1398
+ const parentTagName = stringToLowerCase(parent.tagName);
1399
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
1400
+ return false;
1401
+ }
1402
+ if (element.namespaceURI === SVG_NAMESPACE) {
1403
+ if (parent.namespaceURI === HTML_NAMESPACE) {
1404
+ return tagName === "svg";
1405
+ }
1406
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
1407
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
1408
+ }
1409
+ return Boolean(ALL_SVG_TAGS[tagName]);
1410
+ }
1411
+ if (element.namespaceURI === MATHML_NAMESPACE) {
1412
+ if (parent.namespaceURI === HTML_NAMESPACE) {
1413
+ return tagName === "math";
1414
+ }
1415
+ if (parent.namespaceURI === SVG_NAMESPACE) {
1416
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
1417
+ }
1418
+ return Boolean(ALL_MATHML_TAGS[tagName]);
1419
+ }
1420
+ if (element.namespaceURI === HTML_NAMESPACE) {
1421
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
1422
+ return false;
1423
+ }
1424
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
1425
+ return false;
1426
+ }
1427
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
1428
+ }
1429
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
1430
+ return true;
1431
+ }
1432
+ return false;
1433
+ };
1434
+ const _forceRemove = function _forceRemove2(node) {
1435
+ arrayPush(DOMPurify.removed, {
1436
+ element: node
1437
+ });
1438
+ try {
1439
+ getParentNode(node).removeChild(node);
1440
+ } catch (_) {
1441
+ remove(node);
1442
+ }
1443
+ };
1444
+ const _removeAttribute = function _removeAttribute2(name, element) {
1445
+ try {
1446
+ arrayPush(DOMPurify.removed, {
1447
+ attribute: element.getAttributeNode(name),
1448
+ from: element
1449
+ });
1450
+ } catch (_) {
1451
+ arrayPush(DOMPurify.removed, {
1452
+ attribute: null,
1453
+ from: element
1454
+ });
1455
+ }
1456
+ element.removeAttribute(name);
1457
+ if (name === "is") {
1458
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
1459
+ try {
1460
+ _forceRemove(element);
1461
+ } catch (_) {
1462
+ }
1463
+ } else {
1464
+ try {
1465
+ element.setAttribute(name, "");
1466
+ } catch (_) {
1467
+ }
1468
+ }
1469
+ }
1470
+ };
1471
+ const _initDocument = function _initDocument2(dirty) {
1472
+ let doc = null;
1473
+ let leadingWhitespace = null;
1474
+ if (FORCE_BODY) {
1475
+ dirty = "<remove></remove>" + dirty;
1476
+ } else {
1477
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
1478
+ leadingWhitespace = matches && matches[0];
1479
+ }
1480
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
1481
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
1482
+ }
1483
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
1484
+ if (NAMESPACE === HTML_NAMESPACE) {
1485
+ try {
1486
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1487
+ } catch (_) {
1488
+ }
1489
+ }
1490
+ if (!doc || !doc.documentElement) {
1491
+ doc = implementation.createDocument(NAMESPACE, "template", null);
1492
+ try {
1493
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
1494
+ } catch (_) {
1495
+ }
1496
+ }
1497
+ const body = doc.body || doc.documentElement;
1498
+ if (dirty && leadingWhitespace) {
1499
+ body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1500
+ }
1501
+ if (NAMESPACE === HTML_NAMESPACE) {
1502
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
1503
+ }
1504
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
1505
+ };
1506
+ const _createNodeIterator = function _createNodeIterator2(root) {
1507
+ return createNodeIterator.call(
1508
+ root.ownerDocument || root,
1509
+ root,
1510
+ // eslint-disable-next-line no-bitwise
1511
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
1512
+ null
1513
+ );
1514
+ };
1515
+ const _isClobbered = function _isClobbered2(element) {
1516
+ return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
1517
+ };
1518
+ const _isNode = function _isNode2(value) {
1519
+ return typeof Node === "function" && value instanceof Node;
1520
+ };
1521
+ function _executeHooks(hooks2, currentNode, data) {
1522
+ arrayForEach(hooks2, (hook) => {
1523
+ hook.call(DOMPurify, currentNode, data, CONFIG);
1524
+ });
1525
+ }
1526
+ const _sanitizeElements = function _sanitizeElements2(currentNode) {
1527
+ let content = null;
1528
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1529
+ if (_isClobbered(currentNode)) {
1530
+ _forceRemove(currentNode);
1531
+ return true;
1532
+ }
1533
+ const tagName = transformCaseFunc(currentNode.nodeName);
1534
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
1535
+ tagName,
1536
+ allowedTags: ALLOWED_TAGS
1537
+ });
1538
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
1539
+ _forceRemove(currentNode);
1540
+ return true;
1541
+ }
1542
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
1543
+ _forceRemove(currentNode);
1544
+ return true;
1545
+ }
1546
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
1547
+ _forceRemove(currentNode);
1548
+ return true;
1549
+ }
1550
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
1551
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1552
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1553
+ return false;
1554
+ }
1555
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
1556
+ return false;
1557
+ }
1558
+ }
1559
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1560
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
1561
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1562
+ if (childNodes && parentNode) {
1563
+ const childCount = childNodes.length;
1564
+ for (let i = childCount - 1; i >= 0; --i) {
1565
+ const childClone = cloneNode(childNodes[i], true);
1566
+ childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
1567
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
1568
+ }
1569
+ }
1570
+ }
1571
+ _forceRemove(currentNode);
1572
+ return true;
1573
+ }
1574
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1575
+ _forceRemove(currentNode);
1576
+ return true;
1577
+ }
1578
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
1579
+ _forceRemove(currentNode);
1580
+ return true;
1581
+ }
1582
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1583
+ content = currentNode.textContent;
1584
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
1585
+ content = stringReplace(content, expr, " ");
1586
+ });
1587
+ if (currentNode.textContent !== content) {
1588
+ arrayPush(DOMPurify.removed, {
1589
+ element: currentNode.cloneNode()
1590
+ });
1591
+ currentNode.textContent = content;
1592
+ }
1593
+ }
1594
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1595
+ return false;
1596
+ };
1597
+ const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
1598
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
1599
+ return false;
1600
+ }
1601
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
1602
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
1603
+ else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ;
1604
+ else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1605
+ if (
1606
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1607
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1608
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1609
+ _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
1610
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1611
+ 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))
1612
+ ) ;
1613
+ else {
1614
+ return false;
1615
+ }
1616
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
1617
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
1618
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
1619
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
1620
+ else if (value) {
1621
+ return false;
1622
+ } else ;
1623
+ return true;
1624
+ };
1625
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
1626
+ return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
1627
+ };
1628
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
1629
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1630
+ const {
1631
+ attributes
1632
+ } = currentNode;
1633
+ if (!attributes || _isClobbered(currentNode)) {
1634
+ return;
1635
+ }
1636
+ const hookEvent = {
1637
+ attrName: "",
1638
+ attrValue: "",
1639
+ keepAttr: true,
1640
+ allowedAttributes: ALLOWED_ATTR,
1641
+ forceKeepAttr: void 0
1642
+ };
1643
+ let l = attributes.length;
1644
+ while (l--) {
1645
+ const attr = attributes[l];
1646
+ const {
1647
+ name,
1648
+ namespaceURI,
1649
+ value: attrValue
1650
+ } = attr;
1651
+ const lcName = transformCaseFunc(name);
1652
+ const initValue = attrValue;
1653
+ let value = name === "value" ? initValue : stringTrim(initValue);
1654
+ hookEvent.attrName = lcName;
1655
+ hookEvent.attrValue = value;
1656
+ hookEvent.keepAttr = true;
1657
+ hookEvent.forceKeepAttr = void 0;
1658
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1659
+ value = hookEvent.attrValue;
1660
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
1661
+ _removeAttribute(name, currentNode);
1662
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1663
+ }
1664
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
1665
+ _removeAttribute(name, currentNode);
1666
+ continue;
1667
+ }
1668
+ if (lcName === "attributename" && stringMatch(value, "href")) {
1669
+ _removeAttribute(name, currentNode);
1670
+ continue;
1671
+ }
1672
+ if (hookEvent.forceKeepAttr) {
1673
+ continue;
1674
+ }
1675
+ if (!hookEvent.keepAttr) {
1676
+ _removeAttribute(name, currentNode);
1677
+ continue;
1678
+ }
1679
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1680
+ _removeAttribute(name, currentNode);
1681
+ continue;
1682
+ }
1683
+ if (SAFE_FOR_TEMPLATES) {
1684
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
1685
+ value = stringReplace(value, expr, " ");
1686
+ });
1687
+ }
1688
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1689
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1690
+ _removeAttribute(name, currentNode);
1691
+ continue;
1692
+ }
1693
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
1694
+ if (namespaceURI) ;
1695
+ else {
1696
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1697
+ case "TrustedHTML": {
1698
+ value = trustedTypesPolicy.createHTML(value);
1699
+ break;
1700
+ }
1701
+ case "TrustedScriptURL": {
1702
+ value = trustedTypesPolicy.createScriptURL(value);
1703
+ break;
1704
+ }
1705
+ }
1706
+ }
1707
+ }
1708
+ if (value !== initValue) {
1709
+ try {
1710
+ if (namespaceURI) {
1711
+ currentNode.setAttributeNS(namespaceURI, name, value);
1712
+ } else {
1713
+ currentNode.setAttribute(name, value);
1714
+ }
1715
+ if (_isClobbered(currentNode)) {
1716
+ _forceRemove(currentNode);
1717
+ } else {
1718
+ arrayPop(DOMPurify.removed);
1719
+ }
1720
+ } catch (_) {
1721
+ _removeAttribute(name, currentNode);
1722
+ }
1723
+ }
1724
+ }
1725
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1726
+ };
1727
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
1728
+ let shadowNode = null;
1729
+ const shadowIterator = _createNodeIterator(fragment);
1730
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1731
+ while (shadowNode = shadowIterator.nextNode()) {
1732
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1733
+ _sanitizeElements(shadowNode);
1734
+ _sanitizeAttributes(shadowNode);
1735
+ if (shadowNode.content instanceof DocumentFragment) {
1736
+ _sanitizeShadowDOM2(shadowNode.content);
1737
+ }
1738
+ }
1739
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1740
+ };
1741
+ DOMPurify.sanitize = function(dirty) {
1742
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1743
+ let body = null;
1744
+ let importedNode = null;
1745
+ let currentNode = null;
1746
+ let returnNode = null;
1747
+ IS_EMPTY_INPUT = !dirty;
1748
+ if (IS_EMPTY_INPUT) {
1749
+ dirty = "<!-->";
1750
+ }
1751
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
1752
+ if (typeof dirty.toString === "function") {
1753
+ dirty = dirty.toString();
1754
+ if (typeof dirty !== "string") {
1755
+ throw typeErrorCreate("dirty is not a string, aborting");
1756
+ }
1757
+ } else {
1758
+ throw typeErrorCreate("toString is not a function");
1759
+ }
1760
+ }
1761
+ if (!DOMPurify.isSupported) {
1762
+ return dirty;
1763
+ }
1764
+ if (!SET_CONFIG) {
1765
+ _parseConfig(cfg);
1766
+ }
1767
+ DOMPurify.removed = [];
1768
+ if (typeof dirty === "string") {
1769
+ IN_PLACE = false;
1770
+ }
1771
+ if (IN_PLACE) {
1772
+ if (dirty.nodeName) {
1773
+ const tagName = transformCaseFunc(dirty.nodeName);
1774
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1775
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
1776
+ }
1777
+ }
1778
+ } else if (dirty instanceof Node) {
1779
+ body = _initDocument("<!---->");
1780
+ importedNode = body.ownerDocument.importNode(dirty, true);
1781
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
1782
+ body = importedNode;
1783
+ } else if (importedNode.nodeName === "HTML") {
1784
+ body = importedNode;
1785
+ } else {
1786
+ body.appendChild(importedNode);
1787
+ }
1788
+ } else {
1789
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
1790
+ dirty.indexOf("<") === -1) {
1791
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1792
+ }
1793
+ body = _initDocument(dirty);
1794
+ if (!body) {
1795
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
1796
+ }
1797
+ }
1798
+ if (body && FORCE_BODY) {
1799
+ _forceRemove(body.firstChild);
1800
+ }
1801
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
1802
+ while (currentNode = nodeIterator.nextNode()) {
1803
+ _sanitizeElements(currentNode);
1804
+ _sanitizeAttributes(currentNode);
1805
+ if (currentNode.content instanceof DocumentFragment) {
1806
+ _sanitizeShadowDOM(currentNode.content);
1807
+ }
1808
+ }
1809
+ if (IN_PLACE) {
1810
+ return dirty;
1811
+ }
1812
+ if (RETURN_DOM) {
1813
+ if (RETURN_DOM_FRAGMENT) {
1814
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1815
+ while (body.firstChild) {
1816
+ returnNode.appendChild(body.firstChild);
1817
+ }
1818
+ } else {
1819
+ returnNode = body;
1820
+ }
1821
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1822
+ returnNode = importNode.call(originalDocument, returnNode, true);
1823
+ }
1824
+ return returnNode;
1825
+ }
1826
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1827
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1828
+ serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
1829
+ }
1830
+ if (SAFE_FOR_TEMPLATES) {
1831
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
1832
+ serializedHTML = stringReplace(serializedHTML, expr, " ");
1833
+ });
1834
+ }
1835
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1836
+ };
1837
+ DOMPurify.setConfig = function() {
1838
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1839
+ _parseConfig(cfg);
1840
+ SET_CONFIG = true;
1841
+ };
1842
+ DOMPurify.clearConfig = function() {
1843
+ CONFIG = null;
1844
+ SET_CONFIG = false;
1845
+ };
1846
+ DOMPurify.isValidAttribute = function(tag, attr, value) {
1847
+ if (!CONFIG) {
1848
+ _parseConfig({});
1849
+ }
1850
+ const lcTag = transformCaseFunc(tag);
1851
+ const lcName = transformCaseFunc(attr);
1852
+ return _isValidAttribute(lcTag, lcName, value);
1853
+ };
1854
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
1855
+ if (typeof hookFunction !== "function") {
1856
+ return;
1857
+ }
1858
+ arrayPush(hooks[entryPoint], hookFunction);
1859
+ };
1860
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
1861
+ if (hookFunction !== void 0) {
1862
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1863
+ return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
1864
+ }
1865
+ return arrayPop(hooks[entryPoint]);
1866
+ };
1867
+ DOMPurify.removeHooks = function(entryPoint) {
1868
+ hooks[entryPoint] = [];
1869
+ };
1870
+ DOMPurify.removeAllHooks = function() {
1871
+ hooks = _createHooksMap();
1872
+ };
1873
+ return DOMPurify;
1874
+ }
1875
+ var purify = createDOMPurify();
855
1876
  const escapeCodeHtml = (value) => {
856
1877
  const map = {
857
1878
  "&": "&amp;",
@@ -863,7 +1884,7 @@ const escapeCodeHtml = (value) => {
863
1884
  return value.replace(/[&<>"']/g, (m) => map[m]);
864
1885
  };
865
1886
  const md = new MarkdownIt({
866
- html: false,
1887
+ html: true,
867
1888
  linkify: true,
868
1889
  typographer: true,
869
1890
  highlight: (str, lang) => {
@@ -883,9 +1904,13 @@ const md = new MarkdownIt({
883
1904
  }
884
1905
  });
885
1906
  function useMarkdown() {
886
- const render = (text) => {
887
- const cleanText = text.replace(/\[orca\..*?\]/g, "").trim();
888
- return cleanText ? md.render(cleanText) : "";
1907
+ const render = (text2) => {
1908
+ const cleanText = text2.replace(/\[orca\..*?\]/g, "").trim();
1909
+ if (!cleanText) return "";
1910
+ const rawHtml = md.render(cleanText);
1911
+ return purify.sanitize(rawHtml, {
1912
+ ADD_ATTR: ["style"]
1913
+ });
889
1914
  };
890
1915
  return { render };
891
1916
  }