@alan-ai/alan-sdk-web 1.8.119 → 1.8.121

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/dist/alan_lib.js CHANGED
@@ -25853,6 +25853,1092 @@
25853
25853
  }
25854
25854
  });
25855
25855
 
25856
+ // node_modules/dompurify/dist/purify.cjs.js
25857
+ var require_purify_cjs = __commonJS({
25858
+ "node_modules/dompurify/dist/purify.cjs.js"(exports, module) {
25859
+ "use strict";
25860
+ var {
25861
+ entries,
25862
+ setPrototypeOf,
25863
+ isFrozen,
25864
+ getPrototypeOf,
25865
+ getOwnPropertyDescriptor
25866
+ } = Object;
25867
+ var {
25868
+ freeze,
25869
+ seal,
25870
+ create
25871
+ } = Object;
25872
+ var {
25873
+ apply,
25874
+ construct
25875
+ } = typeof Reflect !== "undefined" && Reflect;
25876
+ if (!freeze) {
25877
+ freeze = function freeze2(x) {
25878
+ return x;
25879
+ };
25880
+ }
25881
+ if (!seal) {
25882
+ seal = function seal2(x) {
25883
+ return x;
25884
+ };
25885
+ }
25886
+ if (!apply) {
25887
+ apply = function apply2(func, thisArg) {
25888
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
25889
+ args[_key - 2] = arguments[_key];
25890
+ }
25891
+ return func.apply(thisArg, args);
25892
+ };
25893
+ }
25894
+ if (!construct) {
25895
+ construct = function construct2(Func) {
25896
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
25897
+ args[_key2 - 1] = arguments[_key2];
25898
+ }
25899
+ return new Func(...args);
25900
+ };
25901
+ }
25902
+ var arrayForEach = unapply(Array.prototype.forEach);
25903
+ var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
25904
+ var arrayPop = unapply(Array.prototype.pop);
25905
+ var arrayPush = unapply(Array.prototype.push);
25906
+ var arraySplice = unapply(Array.prototype.splice);
25907
+ var arrayIsArray = Array.isArray;
25908
+ var stringToLowerCase = unapply(String.prototype.toLowerCase);
25909
+ var stringToString = unapply(String.prototype.toString);
25910
+ var stringMatch = unapply(String.prototype.match);
25911
+ var stringReplace = unapply(String.prototype.replace);
25912
+ var stringIndexOf = unapply(String.prototype.indexOf);
25913
+ var stringTrim = unapply(String.prototype.trim);
25914
+ var numberToString = unapply(Number.prototype.toString);
25915
+ var booleanToString = unapply(Boolean.prototype.toString);
25916
+ var bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
25917
+ var symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
25918
+ var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
25919
+ var objectToString = unapply(Object.prototype.toString);
25920
+ var regExpTest = unapply(RegExp.prototype.test);
25921
+ var typeErrorCreate = unconstruct(TypeError);
25922
+ function unapply(func) {
25923
+ return function(thisArg) {
25924
+ if (thisArg instanceof RegExp) {
25925
+ thisArg.lastIndex = 0;
25926
+ }
25927
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
25928
+ args[_key3 - 1] = arguments[_key3];
25929
+ }
25930
+ return apply(func, thisArg, args);
25931
+ };
25932
+ }
25933
+ function unconstruct(Func) {
25934
+ return function() {
25935
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
25936
+ args[_key4] = arguments[_key4];
25937
+ }
25938
+ return construct(Func, args);
25939
+ };
25940
+ }
25941
+ function addToSet(set, array) {
25942
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
25943
+ if (setPrototypeOf) {
25944
+ setPrototypeOf(set, null);
25945
+ }
25946
+ if (!arrayIsArray(array)) {
25947
+ return set;
25948
+ }
25949
+ let l = array.length;
25950
+ while (l--) {
25951
+ let element = array[l];
25952
+ if (typeof element === "string") {
25953
+ const lcElement = transformCaseFunc(element);
25954
+ if (lcElement !== element) {
25955
+ if (!isFrozen(array)) {
25956
+ array[l] = lcElement;
25957
+ }
25958
+ element = lcElement;
25959
+ }
25960
+ }
25961
+ set[element] = true;
25962
+ }
25963
+ return set;
25964
+ }
25965
+ function cleanArray(array) {
25966
+ for (let index3 = 0; index3 < array.length; index3++) {
25967
+ const isPropertyExist = objectHasOwnProperty(array, index3);
25968
+ if (!isPropertyExist) {
25969
+ array[index3] = null;
25970
+ }
25971
+ }
25972
+ return array;
25973
+ }
25974
+ function clone3(object) {
25975
+ const newObject = create(null);
25976
+ for (const [property, value] of entries(object)) {
25977
+ const isPropertyExist = objectHasOwnProperty(object, property);
25978
+ if (isPropertyExist) {
25979
+ if (arrayIsArray(value)) {
25980
+ newObject[property] = cleanArray(value);
25981
+ } else if (value && typeof value === "object" && value.constructor === Object) {
25982
+ newObject[property] = clone3(value);
25983
+ } else {
25984
+ newObject[property] = value;
25985
+ }
25986
+ }
25987
+ }
25988
+ return newObject;
25989
+ }
25990
+ function stringifyValue(value) {
25991
+ switch (typeof value) {
25992
+ case "string": {
25993
+ return value;
25994
+ }
25995
+ case "number": {
25996
+ return numberToString(value);
25997
+ }
25998
+ case "boolean": {
25999
+ return booleanToString(value);
26000
+ }
26001
+ case "bigint": {
26002
+ return bigintToString ? bigintToString(value) : "0";
26003
+ }
26004
+ case "symbol": {
26005
+ return symbolToString ? symbolToString(value) : "Symbol()";
26006
+ }
26007
+ case "undefined": {
26008
+ return objectToString(value);
26009
+ }
26010
+ case "function":
26011
+ case "object": {
26012
+ if (value === null) {
26013
+ return objectToString(value);
26014
+ }
26015
+ const valueAsRecord = value;
26016
+ const valueToString = lookupGetter(valueAsRecord, "toString");
26017
+ if (typeof valueToString === "function") {
26018
+ const stringified = valueToString(valueAsRecord);
26019
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
26020
+ }
26021
+ return objectToString(value);
26022
+ }
26023
+ default: {
26024
+ return objectToString(value);
26025
+ }
26026
+ }
26027
+ }
26028
+ function lookupGetter(object, prop3) {
26029
+ while (object !== null) {
26030
+ const desc = getOwnPropertyDescriptor(object, prop3);
26031
+ if (desc) {
26032
+ if (desc.get) {
26033
+ return unapply(desc.get);
26034
+ }
26035
+ if (typeof desc.value === "function") {
26036
+ return unapply(desc.value);
26037
+ }
26038
+ }
26039
+ object = getPrototypeOf(object);
26040
+ }
26041
+ function fallbackValue() {
26042
+ return null;
26043
+ }
26044
+ return fallbackValue;
26045
+ }
26046
+ function isRegex(value) {
26047
+ try {
26048
+ regExpTest(value, "");
26049
+ return true;
26050
+ } catch (_unused) {
26051
+ return false;
26052
+ }
26053
+ }
26054
+ 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"]);
26055
+ 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"]);
26056
+ 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"]);
26057
+ 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"]);
26058
+ 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"]);
26059
+ var mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
26060
+ var text5 = freeze(["#text"]);
26061
+ var html5 = 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"]);
26062
+ 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", "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"]);
26063
+ 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"]);
26064
+ var xml3 = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
26065
+ var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
26066
+ var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
26067
+ var TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
26068
+ var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
26069
+ var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
26070
+ var IS_ALLOWED_URI = seal(
26071
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
26072
+ // eslint-disable-line no-useless-escape
26073
+ );
26074
+ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
26075
+ var ATTR_WHITESPACE = seal(
26076
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
26077
+ // eslint-disable-line no-control-regex
26078
+ );
26079
+ var DOCTYPE_NAME = seal(/^html$/i);
26080
+ var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
26081
+ var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
26082
+ __proto__: null,
26083
+ ARIA_ATTR,
26084
+ ATTR_WHITESPACE,
26085
+ CUSTOM_ELEMENT,
26086
+ DATA_ATTR,
26087
+ DOCTYPE_NAME,
26088
+ ERB_EXPR,
26089
+ IS_ALLOWED_URI,
26090
+ IS_SCRIPT_OR_DATA,
26091
+ MUSTACHE_EXPR,
26092
+ TMPLIT_EXPR
26093
+ });
26094
+ var NODE_TYPE = {
26095
+ element: 1,
26096
+ text: 3,
26097
+ // Deprecated
26098
+ progressingInstruction: 7,
26099
+ comment: 8,
26100
+ document: 9
26101
+ };
26102
+ var getGlobal = function getGlobal2() {
26103
+ return typeof window === "undefined" ? null : window;
26104
+ };
26105
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
26106
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
26107
+ return null;
26108
+ }
26109
+ let suffix = null;
26110
+ const ATTR_NAME = "data-tt-policy-suffix";
26111
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
26112
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
26113
+ }
26114
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
26115
+ try {
26116
+ return trustedTypes.createPolicy(policyName, {
26117
+ createHTML(html6) {
26118
+ return html6;
26119
+ },
26120
+ createScriptURL(scriptUrl) {
26121
+ return scriptUrl;
26122
+ }
26123
+ });
26124
+ } catch (_) {
26125
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
26126
+ return null;
26127
+ }
26128
+ };
26129
+ var _createHooksMap = function _createHooksMap2() {
26130
+ return {
26131
+ afterSanitizeAttributes: [],
26132
+ afterSanitizeElements: [],
26133
+ afterSanitizeShadowDOM: [],
26134
+ beforeSanitizeAttributes: [],
26135
+ beforeSanitizeElements: [],
26136
+ beforeSanitizeShadowDOM: [],
26137
+ uponSanitizeAttribute: [],
26138
+ uponSanitizeElement: [],
26139
+ uponSanitizeShadowNode: []
26140
+ };
26141
+ };
26142
+ function createDOMPurify() {
26143
+ let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
26144
+ const DOMPurify2 = (root3) => createDOMPurify(root3);
26145
+ DOMPurify2.version = "3.4.1";
26146
+ DOMPurify2.removed = [];
26147
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
26148
+ DOMPurify2.isSupported = false;
26149
+ return DOMPurify2;
26150
+ }
26151
+ let {
26152
+ document: document2
26153
+ } = window2;
26154
+ const originalDocument = document2;
26155
+ const currentScript = originalDocument.currentScript;
26156
+ const {
26157
+ DocumentFragment,
26158
+ HTMLTemplateElement,
26159
+ Node: Node5,
26160
+ Element: Element2,
26161
+ NodeFilter,
26162
+ NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
26163
+ HTMLFormElement,
26164
+ DOMParser: DOMParser2,
26165
+ trustedTypes
26166
+ } = window2;
26167
+ const ElementPrototype = Element2.prototype;
26168
+ const cloneNode2 = lookupGetter(ElementPrototype, "cloneNode");
26169
+ const remove3 = lookupGetter(ElementPrototype, "remove");
26170
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
26171
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
26172
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
26173
+ if (typeof HTMLTemplateElement === "function") {
26174
+ const template = document2.createElement("template");
26175
+ if (template.content && template.content.ownerDocument) {
26176
+ document2 = template.content.ownerDocument;
26177
+ }
26178
+ }
26179
+ let trustedTypesPolicy;
26180
+ let emptyHTML = "";
26181
+ const {
26182
+ implementation,
26183
+ createNodeIterator,
26184
+ createDocumentFragment,
26185
+ getElementsByTagName: getElementsByTagName2
26186
+ } = document2;
26187
+ const {
26188
+ importNode
26189
+ } = originalDocument;
26190
+ let hooks = _createHooksMap();
26191
+ DOMPurify2.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
26192
+ const {
26193
+ MUSTACHE_EXPR: MUSTACHE_EXPR2,
26194
+ ERB_EXPR: ERB_EXPR2,
26195
+ TMPLIT_EXPR: TMPLIT_EXPR2,
26196
+ DATA_ATTR: DATA_ATTR2,
26197
+ ARIA_ATTR: ARIA_ATTR2,
26198
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
26199
+ ATTR_WHITESPACE: ATTR_WHITESPACE2,
26200
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT2
26201
+ } = EXPRESSIONS;
26202
+ let {
26203
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
26204
+ } = EXPRESSIONS;
26205
+ let ALLOWED_TAGS = null;
26206
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text5]);
26207
+ let ALLOWED_ATTR = null;
26208
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html5, ...svg, ...mathMl, ...xml3]);
26209
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
26210
+ tagNameCheck: {
26211
+ writable: true,
26212
+ configurable: false,
26213
+ enumerable: true,
26214
+ value: null
26215
+ },
26216
+ attributeNameCheck: {
26217
+ writable: true,
26218
+ configurable: false,
26219
+ enumerable: true,
26220
+ value: null
26221
+ },
26222
+ allowCustomizedBuiltInElements: {
26223
+ writable: true,
26224
+ configurable: false,
26225
+ enumerable: true,
26226
+ value: false
26227
+ }
26228
+ }));
26229
+ let FORBID_TAGS = null;
26230
+ let FORBID_ATTR = null;
26231
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
26232
+ tagCheck: {
26233
+ writable: true,
26234
+ configurable: false,
26235
+ enumerable: true,
26236
+ value: null
26237
+ },
26238
+ attributeCheck: {
26239
+ writable: true,
26240
+ configurable: false,
26241
+ enumerable: true,
26242
+ value: null
26243
+ }
26244
+ }));
26245
+ let ALLOW_ARIA_ATTR = true;
26246
+ let ALLOW_DATA_ATTR = true;
26247
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
26248
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
26249
+ let SAFE_FOR_TEMPLATES = false;
26250
+ let SAFE_FOR_XML = true;
26251
+ let WHOLE_DOCUMENT = false;
26252
+ let SET_CONFIG = false;
26253
+ let FORCE_BODY = false;
26254
+ let RETURN_DOM = false;
26255
+ let RETURN_DOM_FRAGMENT = false;
26256
+ let RETURN_TRUSTED_TYPE = false;
26257
+ let SANITIZE_DOM = true;
26258
+ let SANITIZE_NAMED_PROPS = false;
26259
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
26260
+ let KEEP_CONTENT = true;
26261
+ let IN_PLACE = false;
26262
+ let USE_PROFILES = {};
26263
+ let FORBID_CONTENTS = null;
26264
+ 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"]);
26265
+ let DATA_URI_TAGS = null;
26266
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
26267
+ let URI_SAFE_ATTRIBUTES = null;
26268
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
26269
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
26270
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
26271
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
26272
+ let NAMESPACE = HTML_NAMESPACE;
26273
+ let IS_EMPTY_INPUT = false;
26274
+ let ALLOWED_NAMESPACES = null;
26275
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
26276
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
26277
+ let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
26278
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
26279
+ let PARSER_MEDIA_TYPE = null;
26280
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
26281
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
26282
+ let transformCaseFunc = null;
26283
+ let CONFIG = null;
26284
+ const formElement = document2.createElement("form");
26285
+ const isRegexOrFunction = function isRegexOrFunction2(testValue) {
26286
+ return testValue instanceof RegExp || testValue instanceof Function;
26287
+ };
26288
+ const _parseConfig = function _parseConfig2() {
26289
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
26290
+ if (CONFIG && CONFIG === cfg) {
26291
+ return;
26292
+ }
26293
+ if (!cfg || typeof cfg !== "object") {
26294
+ cfg = {};
26295
+ }
26296
+ cfg = clone3(cfg);
26297
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
26298
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
26299
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
26300
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
26301
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
26302
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
26303
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone3(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
26304
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone3(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
26305
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
26306
+ FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone3({});
26307
+ FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone3({});
26308
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone3(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
26309
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
26310
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
26311
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
26312
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
26313
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
26314
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
26315
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
26316
+ RETURN_DOM = cfg.RETURN_DOM || false;
26317
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
26318
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
26319
+ FORCE_BODY = cfg.FORCE_BODY || false;
26320
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
26321
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
26322
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
26323
+ IN_PLACE = cfg.IN_PLACE || false;
26324
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
26325
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
26326
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone3(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
26327
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone3(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
26328
+ const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone3(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
26329
+ CUSTOM_ELEMENT_HANDLING = create(null);
26330
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
26331
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
26332
+ }
26333
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
26334
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
26335
+ }
26336
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
26337
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
26338
+ }
26339
+ if (SAFE_FOR_TEMPLATES) {
26340
+ ALLOW_DATA_ATTR = false;
26341
+ }
26342
+ if (RETURN_DOM_FRAGMENT) {
26343
+ RETURN_DOM = true;
26344
+ }
26345
+ if (USE_PROFILES) {
26346
+ ALLOWED_TAGS = addToSet({}, text5);
26347
+ ALLOWED_ATTR = create(null);
26348
+ if (USE_PROFILES.html === true) {
26349
+ addToSet(ALLOWED_TAGS, html$1);
26350
+ addToSet(ALLOWED_ATTR, html5);
26351
+ }
26352
+ if (USE_PROFILES.svg === true) {
26353
+ addToSet(ALLOWED_TAGS, svg$1);
26354
+ addToSet(ALLOWED_ATTR, svg);
26355
+ addToSet(ALLOWED_ATTR, xml3);
26356
+ }
26357
+ if (USE_PROFILES.svgFilters === true) {
26358
+ addToSet(ALLOWED_TAGS, svgFilters);
26359
+ addToSet(ALLOWED_ATTR, svg);
26360
+ addToSet(ALLOWED_ATTR, xml3);
26361
+ }
26362
+ if (USE_PROFILES.mathMl === true) {
26363
+ addToSet(ALLOWED_TAGS, mathMl$1);
26364
+ addToSet(ALLOWED_ATTR, mathMl);
26365
+ addToSet(ALLOWED_ATTR, xml3);
26366
+ }
26367
+ }
26368
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
26369
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
26370
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
26371
+ if (typeof cfg.ADD_TAGS === "function") {
26372
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
26373
+ } else if (arrayIsArray(cfg.ADD_TAGS)) {
26374
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
26375
+ ALLOWED_TAGS = clone3(ALLOWED_TAGS);
26376
+ }
26377
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
26378
+ }
26379
+ }
26380
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
26381
+ if (typeof cfg.ADD_ATTR === "function") {
26382
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
26383
+ } else if (arrayIsArray(cfg.ADD_ATTR)) {
26384
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
26385
+ ALLOWED_ATTR = clone3(ALLOWED_ATTR);
26386
+ }
26387
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
26388
+ }
26389
+ }
26390
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
26391
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
26392
+ }
26393
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
26394
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
26395
+ FORBID_CONTENTS = clone3(FORBID_CONTENTS);
26396
+ }
26397
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
26398
+ }
26399
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
26400
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
26401
+ FORBID_CONTENTS = clone3(FORBID_CONTENTS);
26402
+ }
26403
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
26404
+ }
26405
+ if (KEEP_CONTENT) {
26406
+ ALLOWED_TAGS["#text"] = true;
26407
+ }
26408
+ if (WHOLE_DOCUMENT) {
26409
+ addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
26410
+ }
26411
+ if (ALLOWED_TAGS.table) {
26412
+ addToSet(ALLOWED_TAGS, ["tbody"]);
26413
+ delete FORBID_TAGS.tbody;
26414
+ }
26415
+ if (cfg.TRUSTED_TYPES_POLICY) {
26416
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
26417
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
26418
+ }
26419
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
26420
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
26421
+ }
26422
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
26423
+ emptyHTML = trustedTypesPolicy.createHTML("");
26424
+ } else {
26425
+ if (trustedTypesPolicy === void 0) {
26426
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
26427
+ }
26428
+ if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
26429
+ emptyHTML = trustedTypesPolicy.createHTML("");
26430
+ }
26431
+ }
26432
+ if (freeze) {
26433
+ freeze(cfg);
26434
+ }
26435
+ CONFIG = cfg;
26436
+ };
26437
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
26438
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
26439
+ const _checkValidNamespace = function _checkValidNamespace2(element) {
26440
+ let parent3 = getParentNode(element);
26441
+ if (!parent3 || !parent3.tagName) {
26442
+ parent3 = {
26443
+ namespaceURI: NAMESPACE,
26444
+ tagName: "template"
26445
+ };
26446
+ }
26447
+ const tagName = stringToLowerCase(element.tagName);
26448
+ const parentTagName = stringToLowerCase(parent3.tagName);
26449
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
26450
+ return false;
26451
+ }
26452
+ if (element.namespaceURI === SVG_NAMESPACE) {
26453
+ if (parent3.namespaceURI === HTML_NAMESPACE) {
26454
+ return tagName === "svg";
26455
+ }
26456
+ if (parent3.namespaceURI === MATHML_NAMESPACE) {
26457
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
26458
+ }
26459
+ return Boolean(ALL_SVG_TAGS[tagName]);
26460
+ }
26461
+ if (element.namespaceURI === MATHML_NAMESPACE) {
26462
+ if (parent3.namespaceURI === HTML_NAMESPACE) {
26463
+ return tagName === "math";
26464
+ }
26465
+ if (parent3.namespaceURI === SVG_NAMESPACE) {
26466
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
26467
+ }
26468
+ return Boolean(ALL_MATHML_TAGS[tagName]);
26469
+ }
26470
+ if (element.namespaceURI === HTML_NAMESPACE) {
26471
+ if (parent3.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
26472
+ return false;
26473
+ }
26474
+ if (parent3.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
26475
+ return false;
26476
+ }
26477
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
26478
+ }
26479
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
26480
+ return true;
26481
+ }
26482
+ return false;
26483
+ };
26484
+ const _forceRemove = function _forceRemove2(node) {
26485
+ arrayPush(DOMPurify2.removed, {
26486
+ element: node
26487
+ });
26488
+ try {
26489
+ getParentNode(node).removeChild(node);
26490
+ } catch (_) {
26491
+ remove3(node);
26492
+ }
26493
+ };
26494
+ const _removeAttribute = function _removeAttribute2(name, element) {
26495
+ try {
26496
+ arrayPush(DOMPurify2.removed, {
26497
+ attribute: element.getAttributeNode(name),
26498
+ from: element
26499
+ });
26500
+ } catch (_) {
26501
+ arrayPush(DOMPurify2.removed, {
26502
+ attribute: null,
26503
+ from: element
26504
+ });
26505
+ }
26506
+ element.removeAttribute(name);
26507
+ if (name === "is") {
26508
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
26509
+ try {
26510
+ _forceRemove(element);
26511
+ } catch (_) {
26512
+ }
26513
+ } else {
26514
+ try {
26515
+ element.setAttribute(name, "");
26516
+ } catch (_) {
26517
+ }
26518
+ }
26519
+ }
26520
+ };
26521
+ const _initDocument = function _initDocument2(dirty) {
26522
+ let doc2 = null;
26523
+ let leadingWhitespace = null;
26524
+ if (FORCE_BODY) {
26525
+ dirty = "<remove></remove>" + dirty;
26526
+ } else {
26527
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
26528
+ leadingWhitespace = matches && matches[0];
26529
+ }
26530
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
26531
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
26532
+ }
26533
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
26534
+ if (NAMESPACE === HTML_NAMESPACE) {
26535
+ try {
26536
+ doc2 = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
26537
+ } catch (_) {
26538
+ }
26539
+ }
26540
+ if (!doc2 || !doc2.documentElement) {
26541
+ doc2 = implementation.createDocument(NAMESPACE, "template", null);
26542
+ try {
26543
+ doc2.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
26544
+ } catch (_) {
26545
+ }
26546
+ }
26547
+ const body = doc2.body || doc2.documentElement;
26548
+ if (dirty && leadingWhitespace) {
26549
+ body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
26550
+ }
26551
+ if (NAMESPACE === HTML_NAMESPACE) {
26552
+ return getElementsByTagName2.call(doc2, WHOLE_DOCUMENT ? "html" : "body")[0];
26553
+ }
26554
+ return WHOLE_DOCUMENT ? doc2.documentElement : body;
26555
+ };
26556
+ const _createNodeIterator = function _createNodeIterator2(root3) {
26557
+ return createNodeIterator.call(
26558
+ root3.ownerDocument || root3,
26559
+ root3,
26560
+ // eslint-disable-next-line no-bitwise
26561
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
26562
+ null
26563
+ );
26564
+ };
26565
+ const _isClobbered = function _isClobbered2(element) {
26566
+ 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");
26567
+ };
26568
+ const _isNode = function _isNode2(value) {
26569
+ return typeof Node5 === "function" && value instanceof Node5;
26570
+ };
26571
+ function _executeHooks(hooks2, currentNode, data4) {
26572
+ arrayForEach(hooks2, (hook) => {
26573
+ hook.call(DOMPurify2, currentNode, data4, CONFIG);
26574
+ });
26575
+ }
26576
+ const _sanitizeElements = function _sanitizeElements2(currentNode) {
26577
+ let content = null;
26578
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
26579
+ if (_isClobbered(currentNode)) {
26580
+ _forceRemove(currentNode);
26581
+ return true;
26582
+ }
26583
+ const tagName = transformCaseFunc(currentNode.nodeName);
26584
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
26585
+ tagName,
26586
+ allowedTags: ALLOWED_TAGS
26587
+ });
26588
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
26589
+ _forceRemove(currentNode);
26590
+ return true;
26591
+ }
26592
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
26593
+ _forceRemove(currentNode);
26594
+ return true;
26595
+ }
26596
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
26597
+ _forceRemove(currentNode);
26598
+ return true;
26599
+ }
26600
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
26601
+ _forceRemove(currentNode);
26602
+ return true;
26603
+ }
26604
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
26605
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
26606
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
26607
+ return false;
26608
+ }
26609
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
26610
+ return false;
26611
+ }
26612
+ }
26613
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
26614
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
26615
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
26616
+ if (childNodes && parentNode) {
26617
+ const childCount = childNodes.length;
26618
+ for (let i = childCount - 1; i >= 0; --i) {
26619
+ const childClone = cloneNode2(childNodes[i], true);
26620
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
26621
+ }
26622
+ }
26623
+ }
26624
+ _forceRemove(currentNode);
26625
+ return true;
26626
+ }
26627
+ if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
26628
+ _forceRemove(currentNode);
26629
+ return true;
26630
+ }
26631
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
26632
+ _forceRemove(currentNode);
26633
+ return true;
26634
+ }
26635
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
26636
+ content = currentNode.textContent;
26637
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
26638
+ content = stringReplace(content, expr, " ");
26639
+ });
26640
+ if (currentNode.textContent !== content) {
26641
+ arrayPush(DOMPurify2.removed, {
26642
+ element: currentNode.cloneNode()
26643
+ });
26644
+ currentNode.textContent = content;
26645
+ }
26646
+ }
26647
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
26648
+ return false;
26649
+ };
26650
+ const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
26651
+ if (FORBID_ATTR[lcName]) {
26652
+ return false;
26653
+ }
26654
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
26655
+ return false;
26656
+ }
26657
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
26658
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
26659
+ else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ;
26660
+ else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
26661
+ if (
26662
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
26663
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
26664
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
26665
+ _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
26666
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
26667
+ 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))
26668
+ ) ;
26669
+ else {
26670
+ return false;
26671
+ }
26672
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
26673
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
26674
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
26675
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
26676
+ else if (value) {
26677
+ return false;
26678
+ } else ;
26679
+ return true;
26680
+ };
26681
+ 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"]);
26682
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
26683
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT2, tagName);
26684
+ };
26685
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
26686
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
26687
+ const {
26688
+ attributes: attributes2
26689
+ } = currentNode;
26690
+ if (!attributes2 || _isClobbered(currentNode)) {
26691
+ return;
26692
+ }
26693
+ const hookEvent = {
26694
+ attrName: "",
26695
+ attrValue: "",
26696
+ keepAttr: true,
26697
+ allowedAttributes: ALLOWED_ATTR,
26698
+ forceKeepAttr: void 0
26699
+ };
26700
+ let l = attributes2.length;
26701
+ while (l--) {
26702
+ const attr3 = attributes2[l];
26703
+ const {
26704
+ name,
26705
+ namespaceURI,
26706
+ value: attrValue
26707
+ } = attr3;
26708
+ const lcName = transformCaseFunc(name);
26709
+ const initValue = attrValue;
26710
+ let value = name === "value" ? initValue : stringTrim(initValue);
26711
+ hookEvent.attrName = lcName;
26712
+ hookEvent.attrValue = value;
26713
+ hookEvent.keepAttr = true;
26714
+ hookEvent.forceKeepAttr = void 0;
26715
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
26716
+ value = hookEvent.attrValue;
26717
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
26718
+ _removeAttribute(name, currentNode);
26719
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
26720
+ }
26721
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
26722
+ _removeAttribute(name, currentNode);
26723
+ continue;
26724
+ }
26725
+ if (lcName === "attributename" && stringMatch(value, "href")) {
26726
+ _removeAttribute(name, currentNode);
26727
+ continue;
26728
+ }
26729
+ if (hookEvent.forceKeepAttr) {
26730
+ continue;
26731
+ }
26732
+ if (!hookEvent.keepAttr) {
26733
+ _removeAttribute(name, currentNode);
26734
+ continue;
26735
+ }
26736
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
26737
+ _removeAttribute(name, currentNode);
26738
+ continue;
26739
+ }
26740
+ if (SAFE_FOR_TEMPLATES) {
26741
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
26742
+ value = stringReplace(value, expr, " ");
26743
+ });
26744
+ }
26745
+ const lcTag = transformCaseFunc(currentNode.nodeName);
26746
+ if (!_isValidAttribute(lcTag, lcName, value)) {
26747
+ _removeAttribute(name, currentNode);
26748
+ continue;
26749
+ }
26750
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
26751
+ if (namespaceURI) ;
26752
+ else {
26753
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
26754
+ case "TrustedHTML": {
26755
+ value = trustedTypesPolicy.createHTML(value);
26756
+ break;
26757
+ }
26758
+ case "TrustedScriptURL": {
26759
+ value = trustedTypesPolicy.createScriptURL(value);
26760
+ break;
26761
+ }
26762
+ }
26763
+ }
26764
+ }
26765
+ if (value !== initValue) {
26766
+ try {
26767
+ if (namespaceURI) {
26768
+ currentNode.setAttributeNS(namespaceURI, name, value);
26769
+ } else {
26770
+ currentNode.setAttribute(name, value);
26771
+ }
26772
+ if (_isClobbered(currentNode)) {
26773
+ _forceRemove(currentNode);
26774
+ } else {
26775
+ arrayPop(DOMPurify2.removed);
26776
+ }
26777
+ } catch (_) {
26778
+ _removeAttribute(name, currentNode);
26779
+ }
26780
+ }
26781
+ }
26782
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
26783
+ };
26784
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
26785
+ let shadowNode = null;
26786
+ const shadowIterator = _createNodeIterator(fragment);
26787
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
26788
+ while (shadowNode = shadowIterator.nextNode()) {
26789
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
26790
+ _sanitizeElements(shadowNode);
26791
+ _sanitizeAttributes(shadowNode);
26792
+ if (shadowNode.content instanceof DocumentFragment) {
26793
+ _sanitizeShadowDOM2(shadowNode.content);
26794
+ }
26795
+ }
26796
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
26797
+ };
26798
+ DOMPurify2.sanitize = function(dirty) {
26799
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
26800
+ let body = null;
26801
+ let importedNode = null;
26802
+ let currentNode = null;
26803
+ let returnNode = null;
26804
+ IS_EMPTY_INPUT = !dirty;
26805
+ if (IS_EMPTY_INPUT) {
26806
+ dirty = "<!-->";
26807
+ }
26808
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
26809
+ dirty = stringifyValue(dirty);
26810
+ if (typeof dirty !== "string") {
26811
+ throw typeErrorCreate("dirty is not a string, aborting");
26812
+ }
26813
+ }
26814
+ if (!DOMPurify2.isSupported) {
26815
+ return dirty;
26816
+ }
26817
+ if (!SET_CONFIG) {
26818
+ _parseConfig(cfg);
26819
+ }
26820
+ DOMPurify2.removed = [];
26821
+ if (typeof dirty === "string") {
26822
+ IN_PLACE = false;
26823
+ }
26824
+ if (IN_PLACE) {
26825
+ const nn = dirty.nodeName;
26826
+ if (typeof nn === "string") {
26827
+ const tagName = transformCaseFunc(nn);
26828
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
26829
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
26830
+ }
26831
+ }
26832
+ } else if (dirty instanceof Node5) {
26833
+ body = _initDocument("<!---->");
26834
+ importedNode = body.ownerDocument.importNode(dirty, true);
26835
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
26836
+ body = importedNode;
26837
+ } else if (importedNode.nodeName === "HTML") {
26838
+ body = importedNode;
26839
+ } else {
26840
+ body.appendChild(importedNode);
26841
+ }
26842
+ } else {
26843
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
26844
+ dirty.indexOf("<") === -1) {
26845
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
26846
+ }
26847
+ body = _initDocument(dirty);
26848
+ if (!body) {
26849
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
26850
+ }
26851
+ }
26852
+ if (body && FORCE_BODY) {
26853
+ _forceRemove(body.firstChild);
26854
+ }
26855
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
26856
+ while (currentNode = nodeIterator.nextNode()) {
26857
+ _sanitizeElements(currentNode);
26858
+ _sanitizeAttributes(currentNode);
26859
+ if (currentNode.content instanceof DocumentFragment) {
26860
+ _sanitizeShadowDOM2(currentNode.content);
26861
+ }
26862
+ }
26863
+ if (IN_PLACE) {
26864
+ return dirty;
26865
+ }
26866
+ if (RETURN_DOM) {
26867
+ if (SAFE_FOR_TEMPLATES) {
26868
+ body.normalize();
26869
+ let html6 = body.innerHTML;
26870
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
26871
+ html6 = stringReplace(html6, expr, " ");
26872
+ });
26873
+ body.innerHTML = html6;
26874
+ }
26875
+ if (RETURN_DOM_FRAGMENT) {
26876
+ returnNode = createDocumentFragment.call(body.ownerDocument);
26877
+ while (body.firstChild) {
26878
+ returnNode.appendChild(body.firstChild);
26879
+ }
26880
+ } else {
26881
+ returnNode = body;
26882
+ }
26883
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
26884
+ returnNode = importNode.call(originalDocument, returnNode, true);
26885
+ }
26886
+ return returnNode;
26887
+ }
26888
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
26889
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
26890
+ serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
26891
+ }
26892
+ if (SAFE_FOR_TEMPLATES) {
26893
+ arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
26894
+ serializedHTML = stringReplace(serializedHTML, expr, " ");
26895
+ });
26896
+ }
26897
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
26898
+ };
26899
+ DOMPurify2.setConfig = function() {
26900
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
26901
+ _parseConfig(cfg);
26902
+ SET_CONFIG = true;
26903
+ };
26904
+ DOMPurify2.clearConfig = function() {
26905
+ CONFIG = null;
26906
+ SET_CONFIG = false;
26907
+ };
26908
+ DOMPurify2.isValidAttribute = function(tag, attr3, value) {
26909
+ if (!CONFIG) {
26910
+ _parseConfig({});
26911
+ }
26912
+ const lcTag = transformCaseFunc(tag);
26913
+ const lcName = transformCaseFunc(attr3);
26914
+ return _isValidAttribute(lcTag, lcName, value);
26915
+ };
26916
+ DOMPurify2.addHook = function(entryPoint, hookFunction) {
26917
+ if (typeof hookFunction !== "function") {
26918
+ return;
26919
+ }
26920
+ arrayPush(hooks[entryPoint], hookFunction);
26921
+ };
26922
+ DOMPurify2.removeHook = function(entryPoint, hookFunction) {
26923
+ if (hookFunction !== void 0) {
26924
+ const index3 = arrayLastIndexOf(hooks[entryPoint], hookFunction);
26925
+ return index3 === -1 ? void 0 : arraySplice(hooks[entryPoint], index3, 1)[0];
26926
+ }
26927
+ return arrayPop(hooks[entryPoint]);
26928
+ };
26929
+ DOMPurify2.removeHooks = function(entryPoint) {
26930
+ hooks[entryPoint] = [];
26931
+ };
26932
+ DOMPurify2.removeAllHooks = function() {
26933
+ hooks = _createHooksMap();
26934
+ };
26935
+ return DOMPurify2;
26936
+ }
26937
+ var purify = createDOMPurify();
26938
+ module.exports = purify;
26939
+ }
26940
+ });
26941
+
25856
26942
  // node_modules/markdown-it-for-inline/dist/index.cjs.js
25857
26943
  var require_index_cjs = __commonJS({
25858
26944
  "node_modules/markdown-it-for-inline/dist/index.cjs.js"(exports, module) {
@@ -96393,6 +97479,18 @@
96393
97479
  reqId: msg.reqId
96394
97480
  };
96395
97481
  }
97482
+ if (msg.type === "response" && isFinalMessage(msg)) {
97483
+ const lastRequestWithoutResIdIndex = (0, import_lodash.findLastIndex)(messages, (m) => m.type === "response" && m?.ctx?.resId === msg?.ctx?.resId);
97484
+ if (lastRequestWithoutResIdIndex > -1) {
97485
+ messages[lastRequestWithoutResIdIndex] = {
97486
+ ...messages[lastRequestWithoutResIdIndex],
97487
+ ctx: {
97488
+ ...messages[lastRequestWithoutResIdIndex].ctx,
97489
+ tsFinal: msg?.ctx?.tsFinal
97490
+ }
97491
+ };
97492
+ }
97493
+ }
96396
97494
  if (isNew) {
96397
97495
  messages.push({ ...msg });
96398
97496
  return {
@@ -96526,7 +97624,6 @@
96526
97624
  }
96527
97625
  }
96528
97626
  const rawHtml = bubbleToCopy.outerHTML;
96529
- console.info("CSS for copy:", rawHtml);
96530
97627
  let css3 = document.querySelector("style").innerHTML;
96531
97628
  css3 += `
96532
97629
  table {
@@ -97477,6 +98574,8 @@
97477
98574
  const requestBubbleLabelEnabled = uiState7?.textChat?.options?.bubbles?.request?.label?.enabled === true;
97478
98575
  const requestBubbleTimestampFontSize = getNumPropVal(textChatOptions?.bubbles?.request?.timestamp?.fontSize, 12);
97479
98576
  const requestBubbleTimestampPaddingLeft = getNumPropVal(textChatOptions?.bubbles?.request?.timestamp?.padding?.left, 5);
98577
+ const requestBubbleTimestampColor = textChatOptions?.bubbles?.request?.timestamp?.color || `#999999`;
98578
+ const requestBubbleTimestampEnabled = uiState7?.textChat?.options?.bubbles?.request?.timestamp?.enabled === true;
97480
98579
  const responseBubbleLabelTopPadding = getNumPropVal(textChatOptions?.bubbles?.response?.label?.padding?.top, 0);
97481
98580
  const responseBubbleLabelRightPadding = getNumPropVal(textChatOptions?.bubbles?.response?.label?.padding?.right, 0);
97482
98581
  const responseBubbleLabelBottomPadding = getNumPropVal(textChatOptions?.bubbles?.response?.label?.padding?.bottom, 4);
@@ -97486,6 +98585,8 @@
97486
98585
  const responseBubbleLabelEnabled = uiState7?.textChat?.options?.bubbles?.response?.label?.enabled === true;
97487
98586
  const responseBubbleTimestampFontSize = getNumPropVal(textChatOptions?.bubbles?.response?.timestamp?.fontSize, 12);
97488
98587
  const responseBubbleTimestampPaddingLeft = getNumPropVal(textChatOptions?.bubbles?.response?.timestamp?.padding?.left, 5);
98588
+ const responseBubbleTimestampColor = textChatOptions?.bubbles?.response?.timestamp?.color || `#999999`;
98589
+ const responseBubbleTimestampEnabled = uiState7?.textChat?.options?.bubbles?.response?.timestamp?.enabled === true;
97489
98590
  const btnAlignment = textChatOptions?.buttons?.alignment?.default || "right";
97490
98591
  const btnAlignmentFullscreen = textChatOptions?.buttons?.alignment?.fullScreen || "right";
97491
98592
  const textChatAppearAnimationMs = uiState7.textChat.defaults.appearAnimationMs;
@@ -98537,6 +99638,8 @@
98537
99638
  keyFrames += getStyleSheetMarker() + `.alan-btn__chat-request-timestamp-text {
98538
99639
  padding-left: ${requestBubbleTimestampPaddingLeft}px;
98539
99640
  font-size: ${requestBubbleTimestampFontSize}px;
99641
+ color: ${requestBubbleTimestampColor};
99642
+ display: ${requestBubbleTimestampEnabled ? "block" : "none"};
98540
99643
  }`;
98541
99644
  keyFrames += getStyleSheetMarker() + `.alan-btn_text-chat-full-screen .alan-btn__chat-request-label {
98542
99645
  text-align: left;
@@ -98620,6 +99723,8 @@
98620
99723
  keyFrames += getStyleSheetMarker() + `.alan-btn__chat-response-timestamp-text {
98621
99724
  padding-left: ${responseBubbleTimestampPaddingLeft}px;
98622
99725
  font-size: ${responseBubbleTimestampFontSize}px;
99726
+ color: ${responseBubbleTimestampColor};
99727
+ display: ${responseBubbleTimestampEnabled ? "block" : "none"};
98623
99728
  }`;
98624
99729
  keyFrames += getStyleSheetMarker() + `.alan-btn_text-chat-full-screen .alan-btn__chat-response-label {
98625
99730
  text-align: left;
@@ -99852,6 +100957,149 @@
99852
100957
  "\\exp"
99853
100958
  ];
99854
100959
 
100960
+ // alan_btn/src/textChat/sanitization.ts
100961
+ var DOMPurify = require_purify_cjs();
100962
+ function sanitizeHtml(html5) {
100963
+ if (!html5) return "";
100964
+ return DOMPurify.sanitize(html5);
100965
+ }
100966
+ function encodeHtmlEntity(text5) {
100967
+ if (!text5) return "";
100968
+ const div = document.createElement("div");
100969
+ div.textContent = text5;
100970
+ return div.innerHTML;
100971
+ }
100972
+ function encodeHtmlAttribute(text5) {
100973
+ if (!text5) return "";
100974
+ return text5.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
100975
+ }
100976
+ function encodeUrl(url, allowDataUri = true) {
100977
+ if (!url) return "";
100978
+ const trimmed = url.trim().toLowerCase();
100979
+ if (trimmed.startsWith("http://") || trimmed.startsWith("https://") || trimmed.startsWith("mailto:") || trimmed.startsWith("tel:")) {
100980
+ return encodeURI(url);
100981
+ }
100982
+ if (allowDataUri && trimmed.startsWith("data:image/")) {
100983
+ return url;
100984
+ }
100985
+ if (trimmed.startsWith("/") || trimmed.startsWith("#") || trimmed.startsWith(".")) {
100986
+ return encodeURI(url);
100987
+ }
100988
+ return "";
100989
+ }
100990
+ var CHAT_ALLOWED_TAGS = [
100991
+ "iframe",
100992
+ "details",
100993
+ "summary",
100994
+ "img",
100995
+ "a",
100996
+ "table",
100997
+ "thead",
100998
+ "tbody",
100999
+ "tr",
101000
+ "th",
101001
+ "td",
101002
+ "caption",
101003
+ "colgroup",
101004
+ "col",
101005
+ "code",
101006
+ "pre",
101007
+ "blockquote",
101008
+ "p",
101009
+ "br",
101010
+ "hr",
101011
+ "ul",
101012
+ "ol",
101013
+ "li",
101014
+ "dl",
101015
+ "dt",
101016
+ "dd",
101017
+ "h1",
101018
+ "h2",
101019
+ "h3",
101020
+ "h4",
101021
+ "h5",
101022
+ "h6",
101023
+ "strong",
101024
+ "em",
101025
+ "b",
101026
+ "i",
101027
+ "u",
101028
+ "s",
101029
+ "del",
101030
+ "ins",
101031
+ "mark",
101032
+ "span",
101033
+ "div",
101034
+ "section",
101035
+ "article",
101036
+ "header",
101037
+ "footer",
101038
+ "sup",
101039
+ "sub",
101040
+ "small",
101041
+ "abbr",
101042
+ "cite",
101043
+ "q",
101044
+ "figure",
101045
+ "figcaption"
101046
+ ];
101047
+ var CHAT_ALLOWED_ATTR = [
101048
+ "href",
101049
+ "src",
101050
+ "alt",
101051
+ "title",
101052
+ "class",
101053
+ "id",
101054
+ "target",
101055
+ "rel",
101056
+ "loading",
101057
+ "decoding",
101058
+ "width",
101059
+ "height",
101060
+ "frameborder",
101061
+ "scrolling",
101062
+ "allowfullscreen",
101063
+ "allow",
101064
+ "sandbox",
101065
+ "referrerpolicy",
101066
+ "open",
101067
+ "colspan",
101068
+ "rowspan",
101069
+ "scope",
101070
+ "headers",
101071
+ "data-*"
101072
+ ];
101073
+ var _chatHooksRegistered = false;
101074
+ function registerChatHooks() {
101075
+ if (_chatHooksRegistered) return;
101076
+ _chatHooksRegistered = true;
101077
+ DOMPurify.addHook("afterSanitizeAttributes", (node) => {
101078
+ if (node.tagName === "IFRAME") {
101079
+ if (!node.hasAttribute("sandbox")) {
101080
+ node.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");
101081
+ }
101082
+ node.setAttribute("referrerpolicy", "no-referrer");
101083
+ }
101084
+ if (node.tagName === "A") {
101085
+ node.setAttribute("rel", "noopener noreferrer");
101086
+ const href = node.getAttribute("href") || "";
101087
+ if (/^javascript:/i.test(href.trim())) {
101088
+ node.removeAttribute("href");
101089
+ }
101090
+ }
101091
+ });
101092
+ }
101093
+ function sanitizeMarkdownHtml(html5) {
101094
+ if (!html5) return "";
101095
+ registerChatHooks();
101096
+ const cleanedHtml = html5.replace(/<iframe([^>]*)>[\s\S]*?<\/iframe>/gi, "<iframe$1></iframe>");
101097
+ return DOMPurify.sanitize(cleanedHtml, {
101098
+ ADD_TAGS: CHAT_ALLOWED_TAGS,
101099
+ ADD_ATTR: CHAT_ALLOWED_ATTR
101100
+ });
101101
+ }
101102
+
99855
101103
  // alan_btn/src/textChat/alanMarkdown.ts
99856
101104
  var iterator = require_index_cjs();
99857
101105
  var markdownItScrollTable = require_markdown_it_scrolltable();
@@ -99870,15 +101118,15 @@
99870
101118
  "YES": '<span class="alan-special-markdown-tag-hl-green">YES</span></div>',
99871
101119
  "NO": '<span class="alan-special-markdown-tag-hl-red">NO</span></div>'
99872
101120
  };
99873
- function alanMarkdown(str = "") {
101121
+ function alanMarkdown(str = "", options = { html: true, breaks: true }) {
99874
101122
  const source = str || "";
99875
101123
  const sanitizedInput = sanitizeCustomTags(source);
99876
- var md = require_index_cjs5()({ html: true, breaks: true }).use(require_index_cjs6()).use(markdownItScrollTable).use(iterator, "url_new_win", "link_open", function(tokens, idx) {
101124
+ var md = require_index_cjs5()(options).use(require_index_cjs6()).use(markdownItScrollTable).use(iterator, "url_new_win", "link_open", function(tokens, idx) {
99877
101125
  tokens[idx].attrSet("target", "_blank");
99878
101126
  });
99879
101127
  const rendered = md.render(sanitizedInput);
99880
101128
  const upgraded = wrapPotentialMathDelimiters(rendered);
99881
- return sanitize(upgraded);
101129
+ return sanitizeMarkdownHtml(upgraded);
99882
101130
  }
99883
101131
  function sanitizeCustomTags(str) {
99884
101132
  let result = str;
@@ -99888,38 +101136,6 @@
99888
101136
  }
99889
101137
  return result;
99890
101138
  }
99891
- function sanitize(str) {
99892
- let tag = "";
99893
- let result = "";
99894
- let i = 0;
99895
- while (i < str.length) {
99896
- if (str[i] === "<") {
99897
- if (str.substring(i, i + 4) === "&lt;") {
99898
- result += str[i];
99899
- i++;
99900
- continue;
99901
- }
99902
- tag = "";
99903
- while (i < str.length) {
99904
- tag += str[i];
99905
- i++;
99906
- if (str[i - 1] === ">" || i >= str.length) {
99907
- break;
99908
- }
99909
- if (str[i] === " ") {
99910
- tag += str[i];
99911
- i++;
99912
- break;
99913
- }
99914
- }
99915
- result += tag;
99916
- } else {
99917
- result += str[i];
99918
- i++;
99919
- }
99920
- }
99921
- return result;
99922
- }
99923
101139
 
99924
101140
  // alan_btn/src/textChat/helpers/getLinkIcon.ts
99925
101141
  function getLinkIcon(link) {
@@ -99950,9 +101166,12 @@
99950
101166
  for (let i = 0; i < links?.length; i++) {
99951
101167
  const curLink = links[i];
99952
101168
  const target = getLinkTarget(curLink);
99953
- linksHtml += `<a class="alan-btn__chat-response-link" href="${curLink.href}" target="${target}">
101169
+ const sanitizedHref = encodeUrl(curLink.href);
101170
+ const sanitizedTitle = encodeHtmlEntity(curLink.title || curLink.href);
101171
+ const rel = target === "_blank" ? ' rel="noopener noreferrer"' : "";
101172
+ linksHtml += `<a class="alan-btn__chat-response-link" href="${sanitizedHref}" target="${target}"${rel}>
99954
101173
  <span class="alan-btn__chat-response-link-icon-wrapper">${getLinkIcon(curLink)}</span>
99955
- <span class="alan-btn__chat-response-link-title">${curLink.title || curLink.href}</span>
101174
+ <span class="alan-btn__chat-response-link-title">${sanitizedTitle}</span>
99956
101175
  </a>`;
99957
101176
  }
99958
101177
  if (links?.length) {
@@ -100983,10 +102202,10 @@ code.hljs {
100983
102202
  function renderButtons(buttons) {
100984
102203
  return `<div class="alan-btn__chat-buttons">
100985
102204
  ${buttons?.map((button) => {
100986
- const btnLabel = button.label || "";
102205
+ const btnLabel = encodeHtmlAttribute(button.label || "");
100987
102206
  let resultBtn = `<div class="alan-chat__chat-btn" data-alan-button-label="${btnLabel}"`;
100988
102207
  if (button.sendText) {
100989
- resultBtn += ` data-alan-button-send-text="${button.sendText}" `;
102208
+ resultBtn += ` data-alan-button-send-text="${encodeHtmlAttribute(button.sendText)}" `;
100990
102209
  }
100991
102210
  if (button.callProjectApi?.method) {
100992
102211
  resultBtn += ` data-alan-button-call-project-api="${button.callProjectApi?.method}" `;
@@ -100997,7 +102216,7 @@ code.hljs {
100997
102216
  if (button.setVisualState) {
100998
102217
  resultBtn += ` data-alan-button-set-visual-state="${encodeValueForHtmlAttr(button.setVisualState)}" `;
100999
102218
  }
101000
- resultBtn += ` >${button.html || button.label}</div>`;
102219
+ resultBtn += ` >${sanitizeHtml(button.html || button.label || "")}</div>`;
101001
102220
  return resultBtn;
101002
102221
  }).join("") || ""}</div>`;
101003
102222
  }
@@ -101181,13 +102400,13 @@ code.hljs {
101181
102400
  }, IFRAME_CONTENT_TIMEOUT_MS);
101182
102401
  });
101183
102402
  }
101184
- function replaceIframesWithSrcDoc(page, iframeContents) {
102403
+ function replaceIframesWithSrcDoc(page, iframeContents, visibilityMap) {
101185
102404
  const contentMap = new Map(iframeContents.map((item) => [item.id, item.html]));
101186
102405
  const iframes = page.querySelectorAll("iframe.act-embed");
101187
102406
  iframes.forEach((iframe) => {
101188
102407
  const iframeId = iframe.id;
101189
102408
  const html5 = contentMap.get(iframeId);
101190
- if (html5) {
102409
+ if (html5 && visibilityMap.get(iframeId)) {
101191
102410
  iframe.removeAttribute("src");
101192
102411
  iframe.setAttribute("srcdoc", html5);
101193
102412
  }
@@ -101197,16 +102416,24 @@ code.hljs {
101197
102416
  const rect = element.getBoundingClientRect();
101198
102417
  const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
101199
102418
  const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
101200
- return rect.top < viewportHeight && rect.bottom > 0 && rect.left < viewportWidth && rect.right > 0;
101201
- }
101202
- function markIframeVisibility(page) {
101203
- const liveIframes = Array.from(document.querySelectorAll("iframe"));
101204
- const visibilityMap = /* @__PURE__ */ new Map();
101205
- liveIframes.forEach((iframe) => {
101206
- if (iframe.id) {
101207
- visibilityMap.set(iframe.id, isElementVisibleInViewport(iframe));
102419
+ if (rect.bottom <= 0 || rect.top >= viewportHeight || rect.right <= 0 || rect.left >= viewportWidth) {
102420
+ return false;
102421
+ }
102422
+ let parent3 = element.parentElement;
102423
+ while (parent3) {
102424
+ const style = window.getComputedStyle(parent3);
102425
+ const overflow = style.overflow + style.overflowX + style.overflowY;
102426
+ if (/(auto|scroll|hidden)/.test(overflow)) {
102427
+ const parentRect = parent3.getBoundingClientRect();
102428
+ if (rect.bottom <= parentRect.top || rect.top >= parentRect.bottom || rect.right <= parentRect.left || rect.left >= parentRect.right) {
102429
+ return false;
102430
+ }
101208
102431
  }
101209
- });
102432
+ parent3 = parent3.parentElement;
102433
+ }
102434
+ return true;
102435
+ }
102436
+ function markIframeVisibility(page, visibilityMap) {
101210
102437
  const pageIframes = page.querySelectorAll("iframe");
101211
102438
  pageIframes.forEach((iframe) => {
101212
102439
  const isVisible = visibilityMap.get(iframe.id) || false;
@@ -101299,10 +102526,17 @@ code.hljs {
101299
102526
  }
101300
102527
  const pageContent = page.outerHTML;
101301
102528
  const iframeContents = await collectIframeContent();
102529
+ const liveIframes = Array.from(document.querySelectorAll("iframe"));
102530
+ const visibilityMap = /* @__PURE__ */ new Map();
102531
+ liveIframes.forEach((iframe) => {
102532
+ if (iframe.id) {
102533
+ visibilityMap.set(iframe.id, isElementVisibleInViewport(iframe));
102534
+ }
102535
+ });
101302
102536
  if (iframeContents.length > 0) {
101303
- replaceIframesWithSrcDoc(page, iframeContents);
102537
+ replaceIframesWithSrcDoc(page, iframeContents, visibilityMap);
101304
102538
  }
101305
- markIframeVisibility(page);
102539
+ markIframeVisibility(page, visibilityMap);
101306
102540
  if (onSendCb) {
101307
102541
  onSendCb();
101308
102542
  }
@@ -101331,7 +102565,7 @@ code.hljs {
101331
102565
  }
101332
102566
  if (uiState10.pageState?.screenshot?.enabled) {
101333
102567
  params.screenshot_data = {
101334
- baseHref: window.location.origin,
102568
+ baseHref: document.baseURI,
101335
102569
  width: window.innerWidth,
101336
102570
  height: window.innerHeight,
101337
102571
  scrollStates: collectScrollableElementStates()
@@ -108380,7 +109614,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
108380
109614
  .replace(/'/g, "&#039;");
108381
109615
  }
108382
109616
 
108383
- var logs = ${JSON.stringify(outputPhrases)};
109617
+ var logs = ${escapeJsonForScriptTag(JSON.stringify(outputPhrases))};
108384
109618
 
108385
109619
  logs = logs.map(el => ({
108386
109620
  ...el,
@@ -108594,7 +109828,8 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
108594
109828
  var codePart;
108595
109829
 
108596
109830
  if (typeof detailsData.value === 'object' && detailsData.value !== null) {
108597
- codePart = JSON.stringify(detailsData.value, null, 2);
109831
+ // HTML-encode JSON output to prevent XSS when inserted via innerHTML
109832
+ codePart = escapeHtml(JSON.stringify(detailsData.value, null, 2));
108598
109833
  } else {
108599
109834
  if (detailsData.type === 'javascript') {
108600
109835
  codePart = prepareJavascriptCode(detailsData.value);
@@ -108717,8 +109952,11 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
108717
109952
  };
108718
109953
  <\/script>
108719
109954
  `;
108720
- const txtMessages = data4?.textChatMessages ? JSON.stringify(data4?.textChatMessages, null, 2) : '"no-provided"';
108721
- const socketMessages = data4?.socketMessages ? JSON.stringify(data4?.socketMessages, null, 2) : '"no-provided"';
109955
+ function escapeJsonForScriptTag(json) {
109956
+ return json.replace(/<\//g, "<\\/").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
109957
+ }
109958
+ const txtMessages = data4?.textChatMessages ? escapeJsonForScriptTag(JSON.stringify(data4?.textChatMessages, null, 2)) : '"no-provided"';
109959
+ const socketMessages = data4?.socketMessages ? escapeJsonForScriptTag(JSON.stringify(data4?.socketMessages, null, 2)) : '"no-provided"';
108722
109960
  let inlinedLibraries = "";
108723
109961
  try {
108724
109962
  inlinedLibraries = getInlineLibrariesHtml();
@@ -108731,7 +109969,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
108731
109969
  <html lang="en">
108732
109970
  <head>
108733
109971
  <meta charset="UTF-8">
108734
- <title>${chatName} Chat History</title>
109972
+ <title>${encodeHtmlEntity(chatName)} Chat History</title>
108735
109973
  ${inlinedLibraries}
108736
109974
  ${headContent ? headContent : ""}
108737
109975
 
@@ -108947,7 +110185,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
108947
110185
  </head>
108948
110186
  <body class="alan-btn__history-body">
108949
110187
  <script>
108950
- var imgData = ${JSON.stringify(imgData)};
110188
+ var imgData = ${escapeJsonForScriptTag(JSON.stringify(imgData))};
108951
110189
 
108952
110190
  document.addEventListener('click', (e) => {
108953
110191
  const clickedEl = e.target;
@@ -109032,7 +110270,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
109032
110270
 
109033
110271
  <div class="alan-history-content ${alanMainClass}">
109034
110272
  <div class="alan-btn__history-chat-header">
109035
- <h1>${chatName} Chat History</h1>
110273
+ <h1>${encodeHtmlEntity(chatName)} Chat History</h1>
109036
110274
  </div>
109037
110275
  <div class="alan-btn__history-chat alan-history-inner-content">
109038
110276
  ${chatConteiner.outerHTML}
@@ -109454,16 +110692,17 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
109454
110692
  return `<div class="alan-btn__chat-suggestions">
109455
110693
  ${suggestions?.map((suggestion) => {
109456
110694
  const { textToAsk, label } = getSuggestionMetadata(suggestion);
109457
- return `<div class="alan-chat__suggestion" data-alan-button-send-text="${textToAsk}">${label}</div>`;
110695
+ const sanitizedTextToAsk = encodeHtmlAttribute(textToAsk);
110696
+ return `<div class="alan-chat__suggestion" data-alan-button-send-text="${sanitizedTextToAsk}">${label}</div>`;
109458
110697
  }).join("") || ""}</div>`;
109459
110698
  }
109460
110699
  function getSuggestionMetadata(suggestion) {
109461
110700
  const { text: text5, markdown } = suggestion;
109462
110701
  let label = "";
109463
110702
  if (markdown) {
109464
- label = alanMarkdown(markdown || "");
110703
+ label = sanitizeHtml(alanMarkdown(markdown || ""));
109465
110704
  } else {
109466
- label = text5 || "";
110705
+ label = encodeHtmlEntity(text5 || "");
109467
110706
  }
109468
110707
  const textToAsk = (text5 || label?.replace(/<\/?[^>]+(>|$)/g, "")).replace(/\n/g, " ").trim();
109469
110708
  return {
@@ -109539,18 +110778,13 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
109539
110778
 
109540
110779
  // alan_btn/src/textChat/helpers/getMessageTimestamp.ts
109541
110780
  var dayjs = require_dayjs_min();
109542
- function getTimestampFromReqId(reqId) {
109543
- if (!reqId) return null;
109544
- const ts = Number(reqId.split("/")[0]);
109545
- return ts || null;
109546
- }
109547
110781
  var DEFAULT_FORMAT = {
109548
- today: "[Today], HH:mm:ss",
109549
- yesterday: "[Yesterday], HH:mm:ss",
109550
- other: "MMM DD, YYYY, HH:mm:ss"
110782
+ today: "[Today], h:mm:ss A",
110783
+ yesterday: "[Yesterday], h:mm:ss A",
110784
+ other: "MMM DD, YYYY, h:mm:ss A"
109551
110785
  };
109552
110786
  function getMessageTimestamp(msg, timestampFormat) {
109553
- const tsMs = (msg?.type === "request" ? getTimestampFromReqId(msg?.reqId) : null) ?? msg?.ctx?.ts0 ?? msg?.ts;
110787
+ const tsMs = msg?.type === "request" ? msg?.tsInit : msg?.ctx?.tsResponseStart || msg?.ctx?.tsFinal;
109554
110788
  if (!tsMs) return "";
109555
110789
  const fmt = { ...DEFAULT_FORMAT, ...timestampFormat };
109556
110790
  const msgDate = dayjs(tsMs);
@@ -109565,7 +110799,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
109565
110799
  // alan_btn/alan_btn.ts
109566
110800
  (function(ns) {
109567
110801
  const uiState10 = getUIState();
109568
- const version2 = "alan-version.1.8.119".replace("alan-version.", "");
110802
+ const version2 = "alan-version.1.8.121".replace("alan-version.", "");
109569
110803
  uiState10.lib.version = version2;
109570
110804
  window.alanLib = { version: version2 };
109571
110805
  if (window.alanBtn) {
@@ -111108,10 +112342,10 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
111108
112342
  if (!popupOptions.html) {
111109
112343
  if (message) {
111110
112344
  popup.classList.add("alan-btn-lib__default-popup");
111111
- popup.innerHTML = '<div class="alan-overlay-popup__body">' + message + "</div>";
112345
+ popup.innerHTML = '<div class="alan-overlay-popup__body">' + sanitizeHtml(message) + "</div>";
111112
112346
  }
111113
112347
  } else {
111114
- popup.innerHTML = popupOptions.html;
112348
+ popup.innerHTML = sanitizeHtml(popupOptions.html);
111115
112349
  }
111116
112350
  var closeIconImg = document.createElement("div");
111117
112351
  closeIconImg.id = "alan-overlay-ok-btn";
@@ -111208,7 +112442,7 @@ var hljs=function(){"use strict";function e(n){return n instanceof Map?n.clear=n
111208
112442
  if (recognisedText.length > 200) {
111209
112443
  recognisedText = recognisedText.substr(0, 200);
111210
112444
  }
111211
- recognisedTextContent.innerHTML = recognisedText;
112445
+ recognisedTextContent.textContent = recognisedText;
111212
112446
  }
111213
112447
  if (recognisedTextHolder.classList.contains("alan-btn-lib__absolute-positioned")) {
111214
112448
  if (recognisedText.length < 33) {
@@ -111543,7 +112777,7 @@ ${curDialogId}`);
111543
112777
  btn.style.zIndex = maxZIndex.toString();
111544
112778
  overlay.style.zIndex = (maxZIndex - 3).toString();
111545
112779
  alertPopup.style.zIndex = (maxZIndex - 2).toString();
111546
- alertPopup.innerHTML = msg;
112780
+ alertPopup.innerHTML = sanitizeHtml(msg);
111547
112781
  var closeIconImg = document.createElement("div");
111548
112782
  closeIconImg.id = "alan-alert-popup-close-btn";
111549
112783
  closeIconImg.classList.add("alan-alert-popup__close-btn");
@@ -112045,7 +113279,7 @@ ${curDialogId}`);
112045
113279
  } else {
112046
113280
  result = escapeHtml(msg.text);
112047
113281
  }
112048
- const wrapContentForRerender = getMessageParser(msg);
113282
+ const wrapContentForRerender = createWrapContentForRerender();
112049
113283
  result = wrapContentForRerender(result).map((el) => {
112050
113284
  return el.type === "text" ? `<span>${el.value}</span>` : el.value;
112051
113285
  }).join("");
@@ -112157,10 +113391,8 @@ ${curDialogId}`);
112157
113391
  const isResponse = msg.type === "response";
112158
113392
  const requestLabel = uiState10?.textChat?.options?.bubbles?.request?.label?.text ?? "Me";
112159
113393
  const responseLabel = uiState10?.textChat?.options?.bubbles?.response?.label?.text ?? "Alan";
112160
- const requestTsEnabled = uiState10?.textChat?.options?.bubbles?.request?.timestamp?.enabled ?? false;
112161
- const responseTsEnabled = uiState10?.textChat?.options?.bubbles?.response?.timestamp?.enabled ?? false;
112162
- const requestTs = requestTsEnabled ? getMessageTimestamp(msg, options?.textChat?.timestampFormat) : "";
112163
- const responseTs = responseTsEnabled ? getMessageTimestamp(msg, options?.textChat?.timestampFormat) : "";
113394
+ const requestTs = getMessageTimestamp(msg, options?.textChat?.timestampFormat);
113395
+ const responseTs = getMessageTimestamp(msg, options?.textChat?.timestampFormat);
112164
113396
  const msgLabel = `<div class="alan-btn__chat-${msg.type}-label">
112165
113397
  ${isResponse ? `<span class="alan-btn__chat-${msg.type}-label-icon"></span>` : ""}
112166
113398
  <span class="alan-btn__chat-${msg.type}-label-and-ts-holder">
@@ -112225,11 +113457,11 @@ ${curDialogId}`);
112225
113457
  } else if (msg.type === "connection-separator") {
112226
113458
  msgHtml = `<div class="alan-btn__chat-connection-separator"></div>`;
112227
113459
  } else if (msg.type === "chat") {
112228
- msgHtml = `<div class="alan-btn__chat-popup">${msg.html}</div>`;
113460
+ msgHtml = `<div class="alan-btn__chat-popup">${sanitizeHtml(msg.html)}</div>`;
112229
113461
  } else {
112230
113462
  if (msg.name === "text" || msg.name === "parsed" || msg.name === "recognized") {
112231
113463
  if (msg.type === "request") {
112232
- innerMsgPart = alanMarkdown(escapeHtml(msg.text) || "");
113464
+ innerMsgPart = alanMarkdown(msg.text || "", { html: false, breaks: true });
112233
113465
  } else {
112234
113466
  if (withDetailedStatuses && msg?.queryProgress?.length > 0) {
112235
113467
  innerMsgPart = `${getMsgLoaderStatuses(uiState10.textChat.options, msg, true, true)} ${buildMsgContent(msg)}`;
@@ -112308,10 +113540,10 @@ ${curDialogId}`);
112308
113540
  highlightCode(document.getElementById("chatMessages"));
112309
113541
  }
112310
113542
  } else {
112311
- const msgEl = document.getElementById("msg-" + msgInd);
112312
- if (msgEl) {
113543
+ const msgEl2 = document.getElementById("msg-" + msgInd);
113544
+ if (msgEl2) {
112313
113545
  if (replaceLoader) {
112314
- const innerEl = msgEl.querySelector(".alan-btn__chat-inner-msg");
113546
+ const innerEl = msgEl2.querySelector(".alan-btn__chat-inner-msg");
112315
113547
  if (innerEl) {
112316
113548
  if (innerEl.classList.contains("alan-hidden-loader")) {
112317
113549
  innerEl.classList.remove("alan-hidden-loader");
@@ -112330,9 +113562,9 @@ ${curDialogId}`);
112330
113562
  }
112331
113563
  innerEl.classList.remove("alan-incoming-msg");
112332
113564
  innerEl.id = "";
112333
- const chatHolder = innerEl.closest(".alan-btn__chat-bubble-holder");
112334
- if (chatHolder) {
112335
- chatHolder.insertAdjacentHTML("beforebegin", getMsgBubbleLabel(msg));
113565
+ const bubbleHolder = innerEl.closest(".alan-btn__chat-bubble-holder");
113566
+ if (bubbleHolder) {
113567
+ bubbleHolder.insertAdjacentHTML("beforebegin", getMsgBubbleLabel(msg));
112336
113568
  }
112337
113569
  if (msg.type === "response" && msg.images?.length > 0) {
112338
113570
  innerEl.classList.add("with-images");
@@ -112346,7 +113578,7 @@ ${curDialogId}`);
112346
113578
  scrollTextChat(msgsScrollableContainer, "smooth");
112347
113579
  }
112348
113580
  } else if (updateExistingResponse && msg.type !== "chat") {
112349
- let innerEl = msgEl.querySelector(".alan-btn__chat-inner-msg");
113581
+ let innerEl = msgEl2.querySelector(".alan-btn__chat-inner-msg");
112350
113582
  if (innerEl) {
112351
113583
  if (innerEl.classList.contains("alan-hidden-loader")) {
112352
113584
  innerEl.classList.remove("alan-hidden-loader");
@@ -112362,6 +113594,13 @@ ${curDialogId}`);
112362
113594
  if (updatedMsg.type !== "chat" && updatedMsg.images?.length > 0) {
112363
113595
  innerEl.classList.add("with-images");
112364
113596
  }
113597
+ const msgHolder2 = innerEl.closest(".alan-btn__chat-msg-holder");
113598
+ if (msgHolder2) {
113599
+ const labelHolderEl = msgHolder2.querySelector(".alan-btn__chat-response-label");
113600
+ if (labelHolderEl) {
113601
+ labelHolderEl.innerHTML = getMsgBubbleLabel(msg);
113602
+ }
113603
+ }
112365
113604
  const loaderWrapper = innerEl.querySelector(".alan-btn__chat-incomming-msg-main-wrapper");
112366
113605
  if (loaderWrapper) {
112367
113606
  if (isFinalMessage(updatedMsg)) {
@@ -112409,16 +113648,16 @@ ${curDialogId}`);
112409
113648
  }
112410
113649
  } else {
112411
113650
  if (msg.name === "loading" && msg.type === "response") {
112412
- const loaderContentEl = msgEl.querySelector(".alan-btn__chat-incomming-msg-wrapper");
112413
- const loaderStatusContentEl = msgEl.querySelector(".alan-btn__chat-incomming-msg-loader-label");
113651
+ const loaderContentEl = msgEl2.querySelector(".alan-btn__chat-incomming-msg-wrapper");
113652
+ const loaderStatusContentEl = msgEl2.querySelector(".alan-btn__chat-incomming-msg-loader-label");
112414
113653
  if (!loaderContentEl) {
112415
- msgEl.innerHTML = msgHtml;
113654
+ msgEl2.innerHTML = msgHtml;
112416
113655
  }
112417
113656
  if (!progressUpdateIntervalId && loaderStatusContentEl) {
112418
113657
  progressUpdateIntervalId = updateMessageProgressStatus(msgInd, loaderStatusContentEl, withDetailedStatuses);
112419
113658
  }
112420
113659
  } else {
112421
- msgEl.innerHTML = msgHtml;
113660
+ msgEl2.innerHTML = msgHtml;
112422
113661
  }
112423
113662
  setTimeout(() => {
112424
113663
  scrollTextChat(msgsScrollableContainer);
@@ -112430,6 +113669,13 @@ ${curDialogId}`);
112430
113669
  highlightCode(document.getElementById("chatMessages"));
112431
113670
  }
112432
113671
  }
113672
+ const msgEl = document.getElementById("msg-" + msgInd);
113673
+ if (msgEl) {
113674
+ const labelHolderEl = msgEl.querySelector(".alan-btn__chat-response-label");
113675
+ if (labelHolderEl) {
113676
+ labelHolderEl.innerHTML = getMsgBubbleLabel(msg);
113677
+ }
113678
+ }
112433
113679
  saveMessageHistory();
112434
113680
  if (uiState10.textChat.available && textChatIsHidden) {
112435
113681
  showChatNotifications();
@@ -112550,6 +113796,7 @@ ${curDialogId}`);
112550
113796
  uiState10.socketMessages = [];
112551
113797
  manageSaveChatHistoryBtn();
112552
113798
  connectToNewDialog();
113799
+ clearChatAutocomplete(true);
112553
113800
  }
112554
113801
  function connectToNewDialog() {
112555
113802
  clearDialogId();
@@ -112642,11 +113889,16 @@ ${curDialogId}`);
112642
113889
  }
112643
113890
  async function _sendText(text5) {
112644
113891
  manageAutocompeteInChat();
113892
+ var maxChars = uiState10.textChat.maxCharactersCount || 2e4;
113893
+ if (text5?.length > maxChars) {
113894
+ console.warn("Alan: message cannot be sent: maximum message limit exceeded.");
113895
+ return;
113896
+ }
112645
113897
  if (!canMsgBeSent()) {
112646
113898
  console.warn("Alan: message cannot be sent. Model is not ready or connection is not established.");
112647
113899
  return;
112648
113900
  }
112649
- var msg = { text: text5, type: "request", name: "text" };
113901
+ var msg = { text: text5, type: "request", name: "text", tsInit: Date.now() };
112650
113902
  sentMessageInd = null;
112651
113903
  clearMessageProgressStatusInterval();
112652
113904
  var res = await sendText(text5);
@@ -112693,7 +113945,12 @@ ${curDialogId}`);
112693
113945
  var textareaHolderEl = document.getElementById("textarea-holder");
112694
113946
  var text5 = textareaEl.value;
112695
113947
  var maxChars = uiState10.textChat.maxCharactersCount || 2e4;
112696
- if (lastSendMsgTs || text5?.length > maxChars) {
113948
+ if (lastSendMsgTs) {
113949
+ console.warn("Alan: message cannot be sent: you are sending messages too fast. Please wait a moment before sending another message.");
113950
+ return;
113951
+ }
113952
+ if (text5?.length > maxChars) {
113953
+ console.warn("Alan: message cannot be sent: maximum message limit exceeded.");
112697
113954
  return;
112698
113955
  }
112699
113956
  if (!canMsgBeSent()) {
@@ -112771,8 +114028,8 @@ ${curDialogId}`);
112771
114028
  manageSendButtonAvailability();
112772
114029
  }
112773
114030
  function manageAutocompeteInChat() {
114031
+ clearChatAutocomplete(false);
112774
114032
  if (!isModelReady) {
112775
- clearChatAutocomplete(false);
112776
114033
  return;
112777
114034
  }
112778
114035
  if (uiState10.textChat?.autocomplete?.enabled === true) {
@@ -114662,6 +115919,9 @@ juice/lib/utils.js:
114662
115919
  * @param {String} selectorText from mensch
114663
115920
  * @api public
114664
115921
  *)
115922
+
115923
+ dompurify/dist/purify.cjs.js:
115924
+ (*! @license DOMPurify 3.4.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.4.1/LICENSE *)
114665
115925
  */
114666
115926
 
114667
115927
  return alanBtn;