@returningai/widget-sdk 1.5.1 → 1.6.1
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/CHANGELOG.md +48 -4
- package/README.md +90 -0
- package/dist/rai-banner.iife.js +3 -0
- package/dist/rai-banner.js +1964 -0
- package/dist/rai-widget.iife.js +3 -1
- package/dist/rai-widget.js +1979 -62
- package/dist/types/BaseWidget.d.ts +10 -0
- package/dist/types/banner/BannerRuntime.d.ts +32 -0
- package/dist/types/banner/api.d.ts +33 -0
- package/dist/types/banner/render.d.ts +12 -0
- package/dist/types/banner/sanitize.d.ts +9 -0
- package/dist/types/banner/session.d.ts +9 -0
- package/dist/types/banner/track.d.ts +7 -0
- package/dist/types/banner/types.d.ts +64 -0
- package/dist/types/banner-index.d.ts +2 -0
- package/package.json +7 -2
package/dist/rai-widget.js
CHANGED
|
@@ -2183,7 +2183,7 @@ var lottie_light = { exports: {} };
|
|
|
2183
2183
|
}
|
|
2184
2184
|
}
|
|
2185
2185
|
}
|
|
2186
|
-
function
|
|
2186
|
+
function freeze2() {
|
|
2187
2187
|
_isFrozen = true;
|
|
2188
2188
|
}
|
|
2189
2189
|
function unfreeze() {
|
|
@@ -2220,7 +2220,7 @@ var lottie_light = { exports: {} };
|
|
|
2220
2220
|
moduleOb.resize = resize;
|
|
2221
2221
|
moduleOb.goToAndStop = goToAndStop;
|
|
2222
2222
|
moduleOb.destroy = destroy;
|
|
2223
|
-
moduleOb.freeze =
|
|
2223
|
+
moduleOb.freeze = freeze2;
|
|
2224
2224
|
moduleOb.unfreeze = unfreeze;
|
|
2225
2225
|
moduleOb.setVolume = setVolume;
|
|
2226
2226
|
moduleOb.mute = mute;
|
|
@@ -2382,17 +2382,17 @@ var lottie_light = { exports: {} };
|
|
|
2382
2382
|
};
|
|
2383
2383
|
}();
|
|
2384
2384
|
var bezierLengthPool = function() {
|
|
2385
|
-
function
|
|
2385
|
+
function create2() {
|
|
2386
2386
|
return {
|
|
2387
2387
|
addedLength: 0,
|
|
2388
2388
|
percents: createTypedArray("float32", getDefaultCurveSegments()),
|
|
2389
2389
|
lengths: createTypedArray("float32", getDefaultCurveSegments())
|
|
2390
2390
|
};
|
|
2391
2391
|
}
|
|
2392
|
-
return poolFactory(8,
|
|
2392
|
+
return poolFactory(8, create2);
|
|
2393
2393
|
}();
|
|
2394
2394
|
var segmentsLengthPool = function() {
|
|
2395
|
-
function
|
|
2395
|
+
function create2() {
|
|
2396
2396
|
return {
|
|
2397
2397
|
lengths: [],
|
|
2398
2398
|
totalLength: 0
|
|
@@ -2406,7 +2406,7 @@ var lottie_light = { exports: {} };
|
|
|
2406
2406
|
}
|
|
2407
2407
|
element.lengths.length = 0;
|
|
2408
2408
|
}
|
|
2409
|
-
return poolFactory(8,
|
|
2409
|
+
return poolFactory(8, create2, release);
|
|
2410
2410
|
}();
|
|
2411
2411
|
function bezFunction() {
|
|
2412
2412
|
var math = Math;
|
|
@@ -3108,10 +3108,10 @@ var lottie_light = { exports: {} };
|
|
|
3108
3108
|
}
|
|
3109
3109
|
};
|
|
3110
3110
|
var pointPool = function() {
|
|
3111
|
-
function
|
|
3111
|
+
function create2() {
|
|
3112
3112
|
return createTypedArray("float32", 2);
|
|
3113
3113
|
}
|
|
3114
|
-
return poolFactory(8,
|
|
3114
|
+
return poolFactory(8, create2);
|
|
3115
3115
|
}();
|
|
3116
3116
|
function ShapePath() {
|
|
3117
3117
|
this.c = false;
|
|
@@ -3199,7 +3199,7 @@ var lottie_light = { exports: {} };
|
|
|
3199
3199
|
return this._length;
|
|
3200
3200
|
};
|
|
3201
3201
|
var shapePool = function() {
|
|
3202
|
-
function
|
|
3202
|
+
function create2() {
|
|
3203
3203
|
return new ShapePath();
|
|
3204
3204
|
}
|
|
3205
3205
|
function release(shapePath) {
|
|
@@ -3216,7 +3216,7 @@ var lottie_light = { exports: {} };
|
|
|
3216
3216
|
shapePath._length = 0;
|
|
3217
3217
|
shapePath.c = false;
|
|
3218
3218
|
}
|
|
3219
|
-
function
|
|
3219
|
+
function clone2(shape) {
|
|
3220
3220
|
var cloned = factory.newElement();
|
|
3221
3221
|
var i;
|
|
3222
3222
|
var len = shape._length === void 0 ? shape.v.length : shape._length;
|
|
@@ -3227,8 +3227,8 @@ var lottie_light = { exports: {} };
|
|
|
3227
3227
|
}
|
|
3228
3228
|
return cloned;
|
|
3229
3229
|
}
|
|
3230
|
-
var factory = poolFactory(4,
|
|
3231
|
-
factory.clone =
|
|
3230
|
+
var factory = poolFactory(4, create2, release);
|
|
3231
|
+
factory.clone = clone2;
|
|
3232
3232
|
return factory;
|
|
3233
3233
|
}();
|
|
3234
3234
|
function ShapeCollection() {
|
|
@@ -3946,7 +3946,7 @@ var lottie_light = { exports: {} };
|
|
|
3946
3946
|
}
|
|
3947
3947
|
return true;
|
|
3948
3948
|
}
|
|
3949
|
-
function
|
|
3949
|
+
function clone2(matr) {
|
|
3950
3950
|
var i;
|
|
3951
3951
|
for (i = 0; i < 16; i += 1) {
|
|
3952
3952
|
matr.props[i] = this.props[i];
|
|
@@ -4098,7 +4098,7 @@ var lottie_light = { exports: {} };
|
|
|
4098
4098
|
this.applyToPointStringified = applyToPointStringified;
|
|
4099
4099
|
this.toCSS = toCSS;
|
|
4100
4100
|
this.to2dCSS = to2dCSS;
|
|
4101
|
-
this.clone =
|
|
4101
|
+
this.clone = clone2;
|
|
4102
4102
|
this.cloneFromProps = cloneFromProps;
|
|
4103
4103
|
this.equals = equals;
|
|
4104
4104
|
this.inversePoints = inversePoints;
|
|
@@ -5910,12 +5910,12 @@ var lottie_light = { exports: {} };
|
|
|
5910
5910
|
tCanvasHelper.font = fontProps.style + " " + fontProps.weight + " 100px " + fontData.fFamily;
|
|
5911
5911
|
helper = tCanvasHelper;
|
|
5912
5912
|
}
|
|
5913
|
-
function measure(
|
|
5913
|
+
function measure(text2) {
|
|
5914
5914
|
if (engine === "svg") {
|
|
5915
|
-
helper.textContent =
|
|
5915
|
+
helper.textContent = text2;
|
|
5916
5916
|
return helper.getComputedTextLength();
|
|
5917
5917
|
}
|
|
5918
|
-
return helper.measureText(
|
|
5918
|
+
return helper.measureText(text2).width;
|
|
5919
5919
|
}
|
|
5920
5920
|
return {
|
|
5921
5921
|
measureText: measure
|
|
@@ -6112,22 +6112,22 @@ var lottie_light = { exports: {} };
|
|
|
6112
6112
|
function isCombinedCharacter(_char3) {
|
|
6113
6113
|
return combinedCharacters.indexOf(_char3) !== -1;
|
|
6114
6114
|
}
|
|
6115
|
-
function isRegionalFlag(
|
|
6116
|
-
var codePoint = getCodePoint(
|
|
6115
|
+
function isRegionalFlag(text2, index2) {
|
|
6116
|
+
var codePoint = getCodePoint(text2.substr(index2, 2));
|
|
6117
6117
|
if (codePoint !== BLACK_FLAG_CODE_POINT) {
|
|
6118
6118
|
return false;
|
|
6119
6119
|
}
|
|
6120
6120
|
var count = 0;
|
|
6121
6121
|
index2 += 2;
|
|
6122
6122
|
while (count < 5) {
|
|
6123
|
-
codePoint = getCodePoint(
|
|
6123
|
+
codePoint = getCodePoint(text2.substr(index2, 2));
|
|
6124
6124
|
if (codePoint < A_TAG_CODE_POINT || codePoint > Z_TAG_CODE_POINT) {
|
|
6125
6125
|
return false;
|
|
6126
6126
|
}
|
|
6127
6127
|
count += 1;
|
|
6128
6128
|
index2 += 2;
|
|
6129
6129
|
}
|
|
6130
|
-
return getCodePoint(
|
|
6130
|
+
return getCodePoint(text2.substr(index2, 2)) === CANCEL_TAG_CODE_POINT;
|
|
6131
6131
|
}
|
|
6132
6132
|
function setIsLoaded() {
|
|
6133
6133
|
this.isLoaded = true;
|
|
@@ -8532,10 +8532,10 @@ var lottie_light = { exports: {} };
|
|
|
8532
8532
|
}
|
|
8533
8533
|
return this.data.d.k[this.keysIndex].s;
|
|
8534
8534
|
};
|
|
8535
|
-
TextProperty.prototype.buildFinalText = function(
|
|
8535
|
+
TextProperty.prototype.buildFinalText = function(text2) {
|
|
8536
8536
|
var charactersArray = [];
|
|
8537
8537
|
var i = 0;
|
|
8538
|
-
var len =
|
|
8538
|
+
var len = text2.length;
|
|
8539
8539
|
var charCode;
|
|
8540
8540
|
var secondCharCode;
|
|
8541
8541
|
var shouldCombine = false;
|
|
@@ -8544,28 +8544,28 @@ var lottie_light = { exports: {} };
|
|
|
8544
8544
|
while (i < len) {
|
|
8545
8545
|
shouldCombine = shouldCombineNext;
|
|
8546
8546
|
shouldCombineNext = false;
|
|
8547
|
-
charCode =
|
|
8548
|
-
currentChars =
|
|
8547
|
+
charCode = text2.charCodeAt(i);
|
|
8548
|
+
currentChars = text2.charAt(i);
|
|
8549
8549
|
if (FontManager.isCombinedCharacter(charCode)) {
|
|
8550
8550
|
shouldCombine = true;
|
|
8551
8551
|
} else if (charCode >= 55296 && charCode <= 56319) {
|
|
8552
|
-
if (FontManager.isRegionalFlag(
|
|
8553
|
-
currentChars =
|
|
8552
|
+
if (FontManager.isRegionalFlag(text2, i)) {
|
|
8553
|
+
currentChars = text2.substr(i, 14);
|
|
8554
8554
|
} else {
|
|
8555
|
-
secondCharCode =
|
|
8555
|
+
secondCharCode = text2.charCodeAt(i + 1);
|
|
8556
8556
|
if (secondCharCode >= 56320 && secondCharCode <= 57343) {
|
|
8557
8557
|
if (FontManager.isModifier(charCode, secondCharCode)) {
|
|
8558
|
-
currentChars =
|
|
8558
|
+
currentChars = text2.substr(i, 2);
|
|
8559
8559
|
shouldCombine = true;
|
|
8560
|
-
} else if (FontManager.isFlagEmoji(
|
|
8561
|
-
currentChars =
|
|
8560
|
+
} else if (FontManager.isFlagEmoji(text2.substr(i, 4))) {
|
|
8561
|
+
currentChars = text2.substr(i, 4);
|
|
8562
8562
|
} else {
|
|
8563
|
-
currentChars =
|
|
8563
|
+
currentChars = text2.substr(i, 2);
|
|
8564
8564
|
}
|
|
8565
8565
|
}
|
|
8566
8566
|
}
|
|
8567
8567
|
} else if (charCode > 56319) {
|
|
8568
|
-
secondCharCode =
|
|
8568
|
+
secondCharCode = text2.charCodeAt(i + 1);
|
|
8569
8569
|
if (FontManager.isVariationSelector(charCode)) {
|
|
8570
8570
|
shouldCombine = true;
|
|
8571
8571
|
}
|
|
@@ -10884,6 +10884,1807 @@ class WidgetCallbackRegistry {
|
|
|
10884
10884
|
return { ...this.registeredCallbacks };
|
|
10885
10885
|
}
|
|
10886
10886
|
}
|
|
10887
|
+
async function fetchEligibleBanner(apiUrl, request) {
|
|
10888
|
+
try {
|
|
10889
|
+
const res = await fetch(`${apiUrl}/v2/api/banner-sdk/eligible`, {
|
|
10890
|
+
method: "POST",
|
|
10891
|
+
headers: { "Content-Type": "application/json" },
|
|
10892
|
+
body: JSON.stringify(request)
|
|
10893
|
+
});
|
|
10894
|
+
const json = await res.json();
|
|
10895
|
+
if (json && json.meta && json.meta.status === "success") {
|
|
10896
|
+
return json.data || { banner: null };
|
|
10897
|
+
}
|
|
10898
|
+
return { banner: null, reason: json && json.detail || "request_failed" };
|
|
10899
|
+
} catch {
|
|
10900
|
+
return { banner: null, reason: "network_error" };
|
|
10901
|
+
}
|
|
10902
|
+
}
|
|
10903
|
+
/*! @license DOMPurify 3.4.9 | (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.9/LICENSE */
|
|
10904
|
+
function _arrayLikeToArray(r, a) {
|
|
10905
|
+
(null == a || a > r.length) && (a = r.length);
|
|
10906
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
10907
|
+
return n;
|
|
10908
|
+
}
|
|
10909
|
+
function _arrayWithHoles(r) {
|
|
10910
|
+
if (Array.isArray(r)) return r;
|
|
10911
|
+
}
|
|
10912
|
+
function _iterableToArrayLimit(r, l) {
|
|
10913
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
10914
|
+
if (null != t) {
|
|
10915
|
+
var e, n, i, u, a = [], f = true, o = false;
|
|
10916
|
+
try {
|
|
10917
|
+
if (i = (t = t.call(r)).next, 0 === l) ;
|
|
10918
|
+
else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
|
|
10919
|
+
} catch (r2) {
|
|
10920
|
+
o = true, n = r2;
|
|
10921
|
+
} finally {
|
|
10922
|
+
try {
|
|
10923
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
10924
|
+
} finally {
|
|
10925
|
+
if (o) throw n;
|
|
10926
|
+
}
|
|
10927
|
+
}
|
|
10928
|
+
return a;
|
|
10929
|
+
}
|
|
10930
|
+
}
|
|
10931
|
+
function _nonIterableRest() {
|
|
10932
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10933
|
+
}
|
|
10934
|
+
function _slicedToArray(r, e) {
|
|
10935
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
10936
|
+
}
|
|
10937
|
+
function _unsupportedIterableToArray(r, a) {
|
|
10938
|
+
if (r) {
|
|
10939
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
10940
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
10941
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
10942
|
+
}
|
|
10943
|
+
}
|
|
10944
|
+
const entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
10945
|
+
let freeze = Object.freeze, seal = Object.seal, create = Object.create;
|
|
10946
|
+
let _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
|
|
10947
|
+
if (!freeze) {
|
|
10948
|
+
freeze = function freeze2(x) {
|
|
10949
|
+
return x;
|
|
10950
|
+
};
|
|
10951
|
+
}
|
|
10952
|
+
if (!seal) {
|
|
10953
|
+
seal = function seal2(x) {
|
|
10954
|
+
return x;
|
|
10955
|
+
};
|
|
10956
|
+
}
|
|
10957
|
+
if (!apply) {
|
|
10958
|
+
apply = function apply2(func, thisArg) {
|
|
10959
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
10960
|
+
args[_key - 2] = arguments[_key];
|
|
10961
|
+
}
|
|
10962
|
+
return func.apply(thisArg, args);
|
|
10963
|
+
};
|
|
10964
|
+
}
|
|
10965
|
+
if (!construct) {
|
|
10966
|
+
construct = function construct2(Func) {
|
|
10967
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
10968
|
+
args[_key2 - 1] = arguments[_key2];
|
|
10969
|
+
}
|
|
10970
|
+
return new Func(...args);
|
|
10971
|
+
};
|
|
10972
|
+
}
|
|
10973
|
+
const arrayForEach = unapply(Array.prototype.forEach);
|
|
10974
|
+
const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
10975
|
+
const arrayPop = unapply(Array.prototype.pop);
|
|
10976
|
+
const arrayPush = unapply(Array.prototype.push);
|
|
10977
|
+
const arraySplice = unapply(Array.prototype.splice);
|
|
10978
|
+
const arrayIsArray = Array.isArray;
|
|
10979
|
+
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
10980
|
+
const stringToString = unapply(String.prototype.toString);
|
|
10981
|
+
const stringMatch = unapply(String.prototype.match);
|
|
10982
|
+
const stringReplace = unapply(String.prototype.replace);
|
|
10983
|
+
const stringIndexOf = unapply(String.prototype.indexOf);
|
|
10984
|
+
const stringTrim = unapply(String.prototype.trim);
|
|
10985
|
+
const numberToString = unapply(Number.prototype.toString);
|
|
10986
|
+
const booleanToString = unapply(Boolean.prototype.toString);
|
|
10987
|
+
const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
|
|
10988
|
+
const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
|
|
10989
|
+
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
10990
|
+
const objectToString = unapply(Object.prototype.toString);
|
|
10991
|
+
const regExpTest = unapply(RegExp.prototype.test);
|
|
10992
|
+
const typeErrorCreate = unconstruct(TypeError);
|
|
10993
|
+
function unapply(func) {
|
|
10994
|
+
return function(thisArg) {
|
|
10995
|
+
if (thisArg instanceof RegExp) {
|
|
10996
|
+
thisArg.lastIndex = 0;
|
|
10997
|
+
}
|
|
10998
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
10999
|
+
args[_key3 - 1] = arguments[_key3];
|
|
11000
|
+
}
|
|
11001
|
+
return apply(func, thisArg, args);
|
|
11002
|
+
};
|
|
11003
|
+
}
|
|
11004
|
+
function unconstruct(Func) {
|
|
11005
|
+
return function() {
|
|
11006
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
11007
|
+
args[_key4] = arguments[_key4];
|
|
11008
|
+
}
|
|
11009
|
+
return construct(Func, args);
|
|
11010
|
+
};
|
|
11011
|
+
}
|
|
11012
|
+
function addToSet(set, array) {
|
|
11013
|
+
let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
|
|
11014
|
+
if (setPrototypeOf) {
|
|
11015
|
+
setPrototypeOf(set, null);
|
|
11016
|
+
}
|
|
11017
|
+
if (!arrayIsArray(array)) {
|
|
11018
|
+
return set;
|
|
11019
|
+
}
|
|
11020
|
+
let l = array.length;
|
|
11021
|
+
while (l--) {
|
|
11022
|
+
let element = array[l];
|
|
11023
|
+
if (typeof element === "string") {
|
|
11024
|
+
const lcElement = transformCaseFunc(element);
|
|
11025
|
+
if (lcElement !== element) {
|
|
11026
|
+
if (!isFrozen(array)) {
|
|
11027
|
+
array[l] = lcElement;
|
|
11028
|
+
}
|
|
11029
|
+
element = lcElement;
|
|
11030
|
+
}
|
|
11031
|
+
}
|
|
11032
|
+
set[element] = true;
|
|
11033
|
+
}
|
|
11034
|
+
return set;
|
|
11035
|
+
}
|
|
11036
|
+
function cleanArray(array) {
|
|
11037
|
+
for (let index = 0; index < array.length; index++) {
|
|
11038
|
+
const isPropertyExist = objectHasOwnProperty(array, index);
|
|
11039
|
+
if (!isPropertyExist) {
|
|
11040
|
+
array[index] = null;
|
|
11041
|
+
}
|
|
11042
|
+
}
|
|
11043
|
+
return array;
|
|
11044
|
+
}
|
|
11045
|
+
function clone(object) {
|
|
11046
|
+
const newObject = create(null);
|
|
11047
|
+
for (const _ref2 of entries(object)) {
|
|
11048
|
+
var _ref3 = _slicedToArray(_ref2, 2);
|
|
11049
|
+
const property = _ref3[0];
|
|
11050
|
+
const value = _ref3[1];
|
|
11051
|
+
const isPropertyExist = objectHasOwnProperty(object, property);
|
|
11052
|
+
if (isPropertyExist) {
|
|
11053
|
+
if (arrayIsArray(value)) {
|
|
11054
|
+
newObject[property] = cleanArray(value);
|
|
11055
|
+
} else if (value && typeof value === "object" && value.constructor === Object) {
|
|
11056
|
+
newObject[property] = clone(value);
|
|
11057
|
+
} else {
|
|
11058
|
+
newObject[property] = value;
|
|
11059
|
+
}
|
|
11060
|
+
}
|
|
11061
|
+
}
|
|
11062
|
+
return newObject;
|
|
11063
|
+
}
|
|
11064
|
+
function stringifyValue(value) {
|
|
11065
|
+
switch (typeof value) {
|
|
11066
|
+
case "string": {
|
|
11067
|
+
return value;
|
|
11068
|
+
}
|
|
11069
|
+
case "number": {
|
|
11070
|
+
return numberToString(value);
|
|
11071
|
+
}
|
|
11072
|
+
case "boolean": {
|
|
11073
|
+
return booleanToString(value);
|
|
11074
|
+
}
|
|
11075
|
+
case "bigint": {
|
|
11076
|
+
return bigintToString ? bigintToString(value) : "0";
|
|
11077
|
+
}
|
|
11078
|
+
case "symbol": {
|
|
11079
|
+
return symbolToString ? symbolToString(value) : "Symbol()";
|
|
11080
|
+
}
|
|
11081
|
+
case "undefined": {
|
|
11082
|
+
return objectToString(value);
|
|
11083
|
+
}
|
|
11084
|
+
case "function":
|
|
11085
|
+
case "object": {
|
|
11086
|
+
if (value === null) {
|
|
11087
|
+
return objectToString(value);
|
|
11088
|
+
}
|
|
11089
|
+
const valueAsRecord = value;
|
|
11090
|
+
const valueToString = lookupGetter(valueAsRecord, "toString");
|
|
11091
|
+
if (typeof valueToString === "function") {
|
|
11092
|
+
const stringified = valueToString(valueAsRecord);
|
|
11093
|
+
return typeof stringified === "string" ? stringified : objectToString(stringified);
|
|
11094
|
+
}
|
|
11095
|
+
return objectToString(value);
|
|
11096
|
+
}
|
|
11097
|
+
default: {
|
|
11098
|
+
return objectToString(value);
|
|
11099
|
+
}
|
|
11100
|
+
}
|
|
11101
|
+
}
|
|
11102
|
+
function lookupGetter(object, prop) {
|
|
11103
|
+
while (object !== null) {
|
|
11104
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
11105
|
+
if (desc) {
|
|
11106
|
+
if (desc.get) {
|
|
11107
|
+
return unapply(desc.get);
|
|
11108
|
+
}
|
|
11109
|
+
if (typeof desc.value === "function") {
|
|
11110
|
+
return unapply(desc.value);
|
|
11111
|
+
}
|
|
11112
|
+
}
|
|
11113
|
+
object = getPrototypeOf(object);
|
|
11114
|
+
}
|
|
11115
|
+
function fallbackValue() {
|
|
11116
|
+
return null;
|
|
11117
|
+
}
|
|
11118
|
+
return fallbackValue;
|
|
11119
|
+
}
|
|
11120
|
+
function isRegex(value) {
|
|
11121
|
+
try {
|
|
11122
|
+
regExpTest(value, "");
|
|
11123
|
+
return true;
|
|
11124
|
+
} catch (_unused) {
|
|
11125
|
+
return false;
|
|
11126
|
+
}
|
|
11127
|
+
}
|
|
11128
|
+
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"]);
|
|
11129
|
+
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"]);
|
|
11130
|
+
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"]);
|
|
11131
|
+
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"]);
|
|
11132
|
+
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"]);
|
|
11133
|
+
const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
|
|
11134
|
+
const text = freeze(["#text"]);
|
|
11135
|
+
const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]);
|
|
11136
|
+
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"]);
|
|
11137
|
+
const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
|
|
11138
|
+
const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
|
|
11139
|
+
const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
|
|
11140
|
+
const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
|
|
11141
|
+
const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
|
|
11142
|
+
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
|
|
11143
|
+
const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
|
11144
|
+
const IS_ALLOWED_URI = seal(
|
|
11145
|
+
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
11146
|
+
// eslint-disable-line no-useless-escape
|
|
11147
|
+
);
|
|
11148
|
+
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
11149
|
+
const ATTR_WHITESPACE = seal(
|
|
11150
|
+
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
11151
|
+
// eslint-disable-line no-control-regex
|
|
11152
|
+
);
|
|
11153
|
+
const DOCTYPE_NAME = seal(/^html$/i);
|
|
11154
|
+
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
11155
|
+
const NODE_TYPE = {
|
|
11156
|
+
element: 1,
|
|
11157
|
+
attribute: 2,
|
|
11158
|
+
text: 3,
|
|
11159
|
+
cdataSection: 4,
|
|
11160
|
+
entityReference: 5,
|
|
11161
|
+
// Deprecated
|
|
11162
|
+
entityNode: 6,
|
|
11163
|
+
// Deprecated
|
|
11164
|
+
progressingInstruction: 7,
|
|
11165
|
+
comment: 8,
|
|
11166
|
+
document: 9,
|
|
11167
|
+
documentType: 10,
|
|
11168
|
+
documentFragment: 11,
|
|
11169
|
+
notation: 12
|
|
11170
|
+
// Deprecated
|
|
11171
|
+
};
|
|
11172
|
+
const getGlobal = function getGlobal2() {
|
|
11173
|
+
return typeof window === "undefined" ? null : window;
|
|
11174
|
+
};
|
|
11175
|
+
const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
|
|
11176
|
+
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
|
|
11177
|
+
return null;
|
|
11178
|
+
}
|
|
11179
|
+
let suffix = null;
|
|
11180
|
+
const ATTR_NAME = "data-tt-policy-suffix";
|
|
11181
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
|
|
11182
|
+
suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
11183
|
+
}
|
|
11184
|
+
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
|
11185
|
+
try {
|
|
11186
|
+
return trustedTypes.createPolicy(policyName, {
|
|
11187
|
+
createHTML(html2) {
|
|
11188
|
+
return html2;
|
|
11189
|
+
},
|
|
11190
|
+
createScriptURL(scriptUrl) {
|
|
11191
|
+
return scriptUrl;
|
|
11192
|
+
}
|
|
11193
|
+
});
|
|
11194
|
+
} catch (_) {
|
|
11195
|
+
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
|
11196
|
+
return null;
|
|
11197
|
+
}
|
|
11198
|
+
};
|
|
11199
|
+
const _createHooksMap = function _createHooksMap2() {
|
|
11200
|
+
return {
|
|
11201
|
+
afterSanitizeAttributes: [],
|
|
11202
|
+
afterSanitizeElements: [],
|
|
11203
|
+
afterSanitizeShadowDOM: [],
|
|
11204
|
+
beforeSanitizeAttributes: [],
|
|
11205
|
+
beforeSanitizeElements: [],
|
|
11206
|
+
beforeSanitizeShadowDOM: [],
|
|
11207
|
+
uponSanitizeAttribute: [],
|
|
11208
|
+
uponSanitizeElement: [],
|
|
11209
|
+
uponSanitizeShadowNode: []
|
|
11210
|
+
};
|
|
11211
|
+
};
|
|
11212
|
+
function createDOMPurify() {
|
|
11213
|
+
let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
11214
|
+
const DOMPurify = (root) => createDOMPurify(root);
|
|
11215
|
+
DOMPurify.version = "3.4.9";
|
|
11216
|
+
DOMPurify.removed = [];
|
|
11217
|
+
if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
|
|
11218
|
+
DOMPurify.isSupported = false;
|
|
11219
|
+
return DOMPurify;
|
|
11220
|
+
}
|
|
11221
|
+
let document2 = window2.document;
|
|
11222
|
+
const originalDocument = document2;
|
|
11223
|
+
const currentScript = originalDocument.currentScript;
|
|
11224
|
+
window2.DocumentFragment;
|
|
11225
|
+
const HTMLTemplateElement = window2.HTMLTemplateElement, Node = window2.Node, Element = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap;
|
|
11226
|
+
_window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap;
|
|
11227
|
+
window2.HTMLFormElement;
|
|
11228
|
+
const DOMParser2 = window2.DOMParser, trustedTypes = window2.trustedTypes;
|
|
11229
|
+
const ElementPrototype = Element.prototype;
|
|
11230
|
+
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
|
11231
|
+
const remove = lookupGetter(ElementPrototype, "remove");
|
|
11232
|
+
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
11233
|
+
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
11234
|
+
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
11235
|
+
const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
|
|
11236
|
+
const getAttributes = lookupGetter(ElementPrototype, "attributes");
|
|
11237
|
+
const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
|
|
11238
|
+
const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
|
|
11239
|
+
if (typeof HTMLTemplateElement === "function") {
|
|
11240
|
+
const template = document2.createElement("template");
|
|
11241
|
+
if (template.content && template.content.ownerDocument) {
|
|
11242
|
+
document2 = template.content.ownerDocument;
|
|
11243
|
+
}
|
|
11244
|
+
}
|
|
11245
|
+
let trustedTypesPolicy;
|
|
11246
|
+
let emptyHTML = "";
|
|
11247
|
+
let defaultTrustedTypesPolicy;
|
|
11248
|
+
let defaultTrustedTypesPolicyResolved = false;
|
|
11249
|
+
let IN_TRUSTED_TYPES_POLICY = 0;
|
|
11250
|
+
const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy2() {
|
|
11251
|
+
if (IN_TRUSTED_TYPES_POLICY > 0) {
|
|
11252
|
+
throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
|
|
11253
|
+
}
|
|
11254
|
+
};
|
|
11255
|
+
const _createTrustedHTML = function _createTrustedHTML2(html2) {
|
|
11256
|
+
_assertNotInTrustedTypesPolicy();
|
|
11257
|
+
IN_TRUSTED_TYPES_POLICY++;
|
|
11258
|
+
try {
|
|
11259
|
+
return trustedTypesPolicy.createHTML(html2);
|
|
11260
|
+
} finally {
|
|
11261
|
+
IN_TRUSTED_TYPES_POLICY--;
|
|
11262
|
+
}
|
|
11263
|
+
};
|
|
11264
|
+
const _createTrustedScriptURL = function _createTrustedScriptURL2(scriptUrl) {
|
|
11265
|
+
_assertNotInTrustedTypesPolicy();
|
|
11266
|
+
IN_TRUSTED_TYPES_POLICY++;
|
|
11267
|
+
try {
|
|
11268
|
+
return trustedTypesPolicy.createScriptURL(scriptUrl);
|
|
11269
|
+
} finally {
|
|
11270
|
+
IN_TRUSTED_TYPES_POLICY--;
|
|
11271
|
+
}
|
|
11272
|
+
};
|
|
11273
|
+
const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy2() {
|
|
11274
|
+
if (!defaultTrustedTypesPolicyResolved) {
|
|
11275
|
+
defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
11276
|
+
defaultTrustedTypesPolicyResolved = true;
|
|
11277
|
+
}
|
|
11278
|
+
return defaultTrustedTypesPolicy;
|
|
11279
|
+
};
|
|
11280
|
+
const _document = document2, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
|
|
11281
|
+
const importNode = originalDocument.importNode;
|
|
11282
|
+
let hooks = _createHooksMap();
|
|
11283
|
+
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
|
|
11284
|
+
const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
|
|
11285
|
+
let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
|
|
11286
|
+
let ALLOWED_TAGS = null;
|
|
11287
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
|
11288
|
+
let ALLOWED_ATTR = null;
|
|
11289
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
|
|
11290
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
11291
|
+
tagNameCheck: {
|
|
11292
|
+
writable: true,
|
|
11293
|
+
configurable: false,
|
|
11294
|
+
enumerable: true,
|
|
11295
|
+
value: null
|
|
11296
|
+
},
|
|
11297
|
+
attributeNameCheck: {
|
|
11298
|
+
writable: true,
|
|
11299
|
+
configurable: false,
|
|
11300
|
+
enumerable: true,
|
|
11301
|
+
value: null
|
|
11302
|
+
},
|
|
11303
|
+
allowCustomizedBuiltInElements: {
|
|
11304
|
+
writable: true,
|
|
11305
|
+
configurable: false,
|
|
11306
|
+
enumerable: true,
|
|
11307
|
+
value: false
|
|
11308
|
+
}
|
|
11309
|
+
}));
|
|
11310
|
+
let FORBID_TAGS = null;
|
|
11311
|
+
let FORBID_ATTR = null;
|
|
11312
|
+
const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
11313
|
+
tagCheck: {
|
|
11314
|
+
writable: true,
|
|
11315
|
+
configurable: false,
|
|
11316
|
+
enumerable: true,
|
|
11317
|
+
value: null
|
|
11318
|
+
},
|
|
11319
|
+
attributeCheck: {
|
|
11320
|
+
writable: true,
|
|
11321
|
+
configurable: false,
|
|
11322
|
+
enumerable: true,
|
|
11323
|
+
value: null
|
|
11324
|
+
}
|
|
11325
|
+
}));
|
|
11326
|
+
let ALLOW_ARIA_ATTR = true;
|
|
11327
|
+
let ALLOW_DATA_ATTR = true;
|
|
11328
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
11329
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
11330
|
+
let SAFE_FOR_TEMPLATES = false;
|
|
11331
|
+
let SAFE_FOR_XML = true;
|
|
11332
|
+
let WHOLE_DOCUMENT = false;
|
|
11333
|
+
let SET_CONFIG = false;
|
|
11334
|
+
let FORCE_BODY = false;
|
|
11335
|
+
let RETURN_DOM = false;
|
|
11336
|
+
let RETURN_DOM_FRAGMENT = false;
|
|
11337
|
+
let RETURN_TRUSTED_TYPE = false;
|
|
11338
|
+
let SANITIZE_DOM = true;
|
|
11339
|
+
let SANITIZE_NAMED_PROPS = false;
|
|
11340
|
+
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
|
11341
|
+
let KEEP_CONTENT = true;
|
|
11342
|
+
let IN_PLACE = false;
|
|
11343
|
+
let USE_PROFILES = {};
|
|
11344
|
+
let FORBID_CONTENTS = null;
|
|
11345
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, [
|
|
11346
|
+
"annotation-xml",
|
|
11347
|
+
"audio",
|
|
11348
|
+
"colgroup",
|
|
11349
|
+
"desc",
|
|
11350
|
+
"foreignobject",
|
|
11351
|
+
"head",
|
|
11352
|
+
"iframe",
|
|
11353
|
+
"math",
|
|
11354
|
+
"mi",
|
|
11355
|
+
"mn",
|
|
11356
|
+
"mo",
|
|
11357
|
+
"ms",
|
|
11358
|
+
"mtext",
|
|
11359
|
+
"noembed",
|
|
11360
|
+
"noframes",
|
|
11361
|
+
"noscript",
|
|
11362
|
+
"plaintext",
|
|
11363
|
+
"script",
|
|
11364
|
+
// <selectedcontent> mirrors the selected <option>'s subtree, cloned by
|
|
11365
|
+
// the UA (customizable <select>) — including any on* handlers — and the
|
|
11366
|
+
// engine re-mirrors synchronously whenever a removal changes which
|
|
11367
|
+
// option/selectedcontent is current, even inside DOMPurify's inert
|
|
11368
|
+
// DOMParser document. Hoisting its children on removal re-inserts a fresh
|
|
11369
|
+
// mirror target ahead of the walk, which the engine refills, looping
|
|
11370
|
+
// forever (DoS) and amplifying output. Dropping its content on removal
|
|
11371
|
+
// (rather than hoisting) breaks that cascade; the content is a duplicate
|
|
11372
|
+
// of the option, which is sanitized on its own. See campaign-3 F1/F6.
|
|
11373
|
+
"selectedcontent",
|
|
11374
|
+
"style",
|
|
11375
|
+
"svg",
|
|
11376
|
+
"template",
|
|
11377
|
+
"thead",
|
|
11378
|
+
"title",
|
|
11379
|
+
"video",
|
|
11380
|
+
"xmp"
|
|
11381
|
+
]);
|
|
11382
|
+
let DATA_URI_TAGS = null;
|
|
11383
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
11384
|
+
let URI_SAFE_ATTRIBUTES = null;
|
|
11385
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
|
|
11386
|
+
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
11387
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
11388
|
+
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
11389
|
+
let NAMESPACE = HTML_NAMESPACE;
|
|
11390
|
+
let IS_EMPTY_INPUT = false;
|
|
11391
|
+
let ALLOWED_NAMESPACES = null;
|
|
11392
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
11393
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
|
|
11394
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
|
|
11395
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
|
|
11396
|
+
let PARSER_MEDIA_TYPE = null;
|
|
11397
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
|
|
11398
|
+
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
11399
|
+
let transformCaseFunc = null;
|
|
11400
|
+
let CONFIG = null;
|
|
11401
|
+
const formElement = document2.createElement("form");
|
|
11402
|
+
const isRegexOrFunction = function isRegexOrFunction2(testValue) {
|
|
11403
|
+
return testValue instanceof RegExp || testValue instanceof Function;
|
|
11404
|
+
};
|
|
11405
|
+
const _parseConfig = function _parseConfig2() {
|
|
11406
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
11407
|
+
if (CONFIG && CONFIG === cfg) {
|
|
11408
|
+
return;
|
|
11409
|
+
}
|
|
11410
|
+
if (!cfg || typeof cfg !== "object") {
|
|
11411
|
+
cfg = {};
|
|
11412
|
+
}
|
|
11413
|
+
cfg = clone(cfg);
|
|
11414
|
+
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
|
|
11415
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
11416
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
|
|
11417
|
+
ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
11418
|
+
ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
11419
|
+
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
11420
|
+
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
11421
|
+
DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
11422
|
+
FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
11423
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
|
|
11424
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
|
|
11425
|
+
USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
|
|
11426
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
|
|
11427
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
|
|
11428
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
|
|
11429
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
|
|
11430
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
|
|
11431
|
+
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
|
|
11432
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
|
|
11433
|
+
RETURN_DOM = cfg.RETURN_DOM || false;
|
|
11434
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
|
|
11435
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
|
|
11436
|
+
FORCE_BODY = cfg.FORCE_BODY || false;
|
|
11437
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
|
|
11438
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
|
|
11439
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
|
|
11440
|
+
IN_PLACE = cfg.IN_PLACE || false;
|
|
11441
|
+
IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
|
|
11442
|
+
NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
|
|
11443
|
+
MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
|
|
11444
|
+
HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
|
|
11445
|
+
const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
|
|
11446
|
+
CUSTOM_ELEMENT_HANDLING = create(null);
|
|
11447
|
+
if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
|
|
11448
|
+
CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
|
|
11449
|
+
}
|
|
11450
|
+
if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
|
|
11451
|
+
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
|
|
11452
|
+
}
|
|
11453
|
+
if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
|
|
11454
|
+
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
|
|
11455
|
+
}
|
|
11456
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
11457
|
+
ALLOW_DATA_ATTR = false;
|
|
11458
|
+
}
|
|
11459
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
11460
|
+
RETURN_DOM = true;
|
|
11461
|
+
}
|
|
11462
|
+
if (USE_PROFILES) {
|
|
11463
|
+
ALLOWED_TAGS = addToSet({}, text);
|
|
11464
|
+
ALLOWED_ATTR = create(null);
|
|
11465
|
+
if (USE_PROFILES.html === true) {
|
|
11466
|
+
addToSet(ALLOWED_TAGS, html$1);
|
|
11467
|
+
addToSet(ALLOWED_ATTR, html);
|
|
11468
|
+
}
|
|
11469
|
+
if (USE_PROFILES.svg === true) {
|
|
11470
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
|
11471
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
11472
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
11473
|
+
}
|
|
11474
|
+
if (USE_PROFILES.svgFilters === true) {
|
|
11475
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
|
11476
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
11477
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
11478
|
+
}
|
|
11479
|
+
if (USE_PROFILES.mathMl === true) {
|
|
11480
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
11481
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
|
11482
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
11483
|
+
}
|
|
11484
|
+
}
|
|
11485
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
11486
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
11487
|
+
if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
|
|
11488
|
+
if (typeof cfg.ADD_TAGS === "function") {
|
|
11489
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
11490
|
+
} else if (arrayIsArray(cfg.ADD_TAGS)) {
|
|
11491
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
11492
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
11493
|
+
}
|
|
11494
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
11495
|
+
}
|
|
11496
|
+
}
|
|
11497
|
+
if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
|
|
11498
|
+
if (typeof cfg.ADD_ATTR === "function") {
|
|
11499
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
11500
|
+
} else if (arrayIsArray(cfg.ADD_ATTR)) {
|
|
11501
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
11502
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
11503
|
+
}
|
|
11504
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
11505
|
+
}
|
|
11506
|
+
}
|
|
11507
|
+
if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
|
|
11508
|
+
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
11509
|
+
}
|
|
11510
|
+
if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
|
|
11511
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
11512
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
11513
|
+
}
|
|
11514
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
11515
|
+
}
|
|
11516
|
+
if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
|
|
11517
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
11518
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
11519
|
+
}
|
|
11520
|
+
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
11521
|
+
}
|
|
11522
|
+
if (KEEP_CONTENT) {
|
|
11523
|
+
ALLOWED_TAGS["#text"] = true;
|
|
11524
|
+
}
|
|
11525
|
+
if (WHOLE_DOCUMENT) {
|
|
11526
|
+
addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
|
|
11527
|
+
}
|
|
11528
|
+
if (ALLOWED_TAGS.table) {
|
|
11529
|
+
addToSet(ALLOWED_TAGS, ["tbody"]);
|
|
11530
|
+
delete FORBID_TAGS.tbody;
|
|
11531
|
+
}
|
|
11532
|
+
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
11533
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
|
|
11534
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
11535
|
+
}
|
|
11536
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
|
|
11537
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
11538
|
+
}
|
|
11539
|
+
const previousTrustedTypesPolicy = trustedTypesPolicy;
|
|
11540
|
+
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
11541
|
+
try {
|
|
11542
|
+
emptyHTML = _createTrustedHTML("");
|
|
11543
|
+
} catch (error) {
|
|
11544
|
+
trustedTypesPolicy = previousTrustedTypesPolicy;
|
|
11545
|
+
throw error;
|
|
11546
|
+
}
|
|
11547
|
+
} else if (cfg.TRUSTED_TYPES_POLICY === null) {
|
|
11548
|
+
trustedTypesPolicy = void 0;
|
|
11549
|
+
emptyHTML = "";
|
|
11550
|
+
} else {
|
|
11551
|
+
if (trustedTypesPolicy === void 0) {
|
|
11552
|
+
trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
|
|
11553
|
+
}
|
|
11554
|
+
if (trustedTypesPolicy && typeof emptyHTML === "string") {
|
|
11555
|
+
emptyHTML = _createTrustedHTML("");
|
|
11556
|
+
}
|
|
11557
|
+
}
|
|
11558
|
+
if ((hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) && ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
11559
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
11560
|
+
}
|
|
11561
|
+
if (hooks.uponSanitizeAttribute.length > 0 && ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
11562
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
11563
|
+
}
|
|
11564
|
+
if (freeze) {
|
|
11565
|
+
freeze(cfg);
|
|
11566
|
+
}
|
|
11567
|
+
CONFIG = cfg;
|
|
11568
|
+
};
|
|
11569
|
+
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
11570
|
+
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
11571
|
+
const _checkValidNamespace = function _checkValidNamespace2(element) {
|
|
11572
|
+
let parent = getParentNode(element);
|
|
11573
|
+
if (!parent || !parent.tagName) {
|
|
11574
|
+
parent = {
|
|
11575
|
+
namespaceURI: NAMESPACE,
|
|
11576
|
+
tagName: "template"
|
|
11577
|
+
};
|
|
11578
|
+
}
|
|
11579
|
+
const tagName = stringToLowerCase(element.tagName);
|
|
11580
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
|
11581
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
11582
|
+
return false;
|
|
11583
|
+
}
|
|
11584
|
+
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
11585
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
11586
|
+
return tagName === "svg";
|
|
11587
|
+
}
|
|
11588
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
11589
|
+
return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
11590
|
+
}
|
|
11591
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
11592
|
+
}
|
|
11593
|
+
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
11594
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
11595
|
+
return tagName === "math";
|
|
11596
|
+
}
|
|
11597
|
+
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
11598
|
+
return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
|
|
11599
|
+
}
|
|
11600
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
11601
|
+
}
|
|
11602
|
+
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
11603
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
11604
|
+
return false;
|
|
11605
|
+
}
|
|
11606
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
11607
|
+
return false;
|
|
11608
|
+
}
|
|
11609
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
11610
|
+
}
|
|
11611
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
11612
|
+
return true;
|
|
11613
|
+
}
|
|
11614
|
+
return false;
|
|
11615
|
+
};
|
|
11616
|
+
const _forceRemove = function _forceRemove2(node) {
|
|
11617
|
+
arrayPush(DOMPurify.removed, {
|
|
11618
|
+
element: node
|
|
11619
|
+
});
|
|
11620
|
+
try {
|
|
11621
|
+
getParentNode(node).removeChild(node);
|
|
11622
|
+
} catch (_) {
|
|
11623
|
+
remove(node);
|
|
11624
|
+
if (!getParentNode(node)) {
|
|
11625
|
+
throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
11626
|
+
}
|
|
11627
|
+
}
|
|
11628
|
+
};
|
|
11629
|
+
const _neutralizeRoot = function _neutralizeRoot2(root) {
|
|
11630
|
+
const childNodes = getChildNodes ? getChildNodes(root) : root.childNodes;
|
|
11631
|
+
if (childNodes) {
|
|
11632
|
+
const snapshot = [];
|
|
11633
|
+
arrayForEach(childNodes, (child) => {
|
|
11634
|
+
arrayPush(snapshot, child);
|
|
11635
|
+
});
|
|
11636
|
+
arrayForEach(snapshot, (child) => {
|
|
11637
|
+
try {
|
|
11638
|
+
remove(child);
|
|
11639
|
+
} catch (_) {
|
|
11640
|
+
}
|
|
11641
|
+
});
|
|
11642
|
+
}
|
|
11643
|
+
const attributes = getAttributes ? getAttributes(root) : null;
|
|
11644
|
+
if (attributes) {
|
|
11645
|
+
for (let i = attributes.length - 1; i >= 0; --i) {
|
|
11646
|
+
const attribute = attributes[i];
|
|
11647
|
+
const name = attribute && attribute.name;
|
|
11648
|
+
if (typeof name === "string") {
|
|
11649
|
+
try {
|
|
11650
|
+
root.removeAttribute(name);
|
|
11651
|
+
} catch (_) {
|
|
11652
|
+
}
|
|
11653
|
+
}
|
|
11654
|
+
}
|
|
11655
|
+
}
|
|
11656
|
+
};
|
|
11657
|
+
const _removeAttribute = function _removeAttribute2(name, element) {
|
|
11658
|
+
try {
|
|
11659
|
+
arrayPush(DOMPurify.removed, {
|
|
11660
|
+
attribute: element.getAttributeNode(name),
|
|
11661
|
+
from: element
|
|
11662
|
+
});
|
|
11663
|
+
} catch (_) {
|
|
11664
|
+
arrayPush(DOMPurify.removed, {
|
|
11665
|
+
attribute: null,
|
|
11666
|
+
from: element
|
|
11667
|
+
});
|
|
11668
|
+
}
|
|
11669
|
+
element.removeAttribute(name);
|
|
11670
|
+
if (name === "is") {
|
|
11671
|
+
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
11672
|
+
try {
|
|
11673
|
+
_forceRemove(element);
|
|
11674
|
+
} catch (_) {
|
|
11675
|
+
}
|
|
11676
|
+
} else {
|
|
11677
|
+
try {
|
|
11678
|
+
element.setAttribute(name, "");
|
|
11679
|
+
} catch (_) {
|
|
11680
|
+
}
|
|
11681
|
+
}
|
|
11682
|
+
}
|
|
11683
|
+
};
|
|
11684
|
+
const _stripDisallowedAttributes = function _stripDisallowedAttributes2(element) {
|
|
11685
|
+
const attributes = getAttributes ? getAttributes(element) : element.attributes;
|
|
11686
|
+
if (!attributes) {
|
|
11687
|
+
return;
|
|
11688
|
+
}
|
|
11689
|
+
for (let i = attributes.length - 1; i >= 0; --i) {
|
|
11690
|
+
const attribute = attributes[i];
|
|
11691
|
+
const name = attribute && attribute.name;
|
|
11692
|
+
if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) {
|
|
11693
|
+
continue;
|
|
11694
|
+
}
|
|
11695
|
+
try {
|
|
11696
|
+
element.removeAttribute(name);
|
|
11697
|
+
} catch (_) {
|
|
11698
|
+
}
|
|
11699
|
+
}
|
|
11700
|
+
};
|
|
11701
|
+
const _neutralizeSubtree = function _neutralizeSubtree2(root) {
|
|
11702
|
+
const stack = [root];
|
|
11703
|
+
while (stack.length > 0) {
|
|
11704
|
+
const node = stack.pop();
|
|
11705
|
+
const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
|
|
11706
|
+
if (nodeType === NODE_TYPE.element) {
|
|
11707
|
+
_stripDisallowedAttributes(node);
|
|
11708
|
+
}
|
|
11709
|
+
const childNodes = getChildNodes ? getChildNodes(node) : node.childNodes;
|
|
11710
|
+
if (childNodes) {
|
|
11711
|
+
for (let i = childNodes.length - 1; i >= 0; --i) {
|
|
11712
|
+
stack.push(childNodes[i]);
|
|
11713
|
+
}
|
|
11714
|
+
}
|
|
11715
|
+
}
|
|
11716
|
+
};
|
|
11717
|
+
const _initDocument = function _initDocument2(dirty) {
|
|
11718
|
+
let doc = null;
|
|
11719
|
+
let leadingWhitespace = null;
|
|
11720
|
+
if (FORCE_BODY) {
|
|
11721
|
+
dirty = "<remove></remove>" + dirty;
|
|
11722
|
+
} else {
|
|
11723
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
11724
|
+
leadingWhitespace = matches && matches[0];
|
|
11725
|
+
}
|
|
11726
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
|
|
11727
|
+
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
|
|
11728
|
+
}
|
|
11729
|
+
const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
|
|
11730
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
11731
|
+
try {
|
|
11732
|
+
doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
11733
|
+
} catch (_) {
|
|
11734
|
+
}
|
|
11735
|
+
}
|
|
11736
|
+
if (!doc || !doc.documentElement) {
|
|
11737
|
+
doc = implementation.createDocument(NAMESPACE, "template", null);
|
|
11738
|
+
try {
|
|
11739
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
11740
|
+
} catch (_) {
|
|
11741
|
+
}
|
|
11742
|
+
}
|
|
11743
|
+
const body = doc.body || doc.documentElement;
|
|
11744
|
+
if (dirty && leadingWhitespace) {
|
|
11745
|
+
body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
11746
|
+
}
|
|
11747
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
11748
|
+
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
11749
|
+
}
|
|
11750
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
11751
|
+
};
|
|
11752
|
+
const _createNodeIterator = function _createNodeIterator2(root) {
|
|
11753
|
+
return createNodeIterator.call(
|
|
11754
|
+
root.ownerDocument || root,
|
|
11755
|
+
root,
|
|
11756
|
+
// eslint-disable-next-line no-bitwise
|
|
11757
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
|
|
11758
|
+
null
|
|
11759
|
+
);
|
|
11760
|
+
};
|
|
11761
|
+
const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
|
|
11762
|
+
var _node$querySelectorAl, _node$querySelectorAl2;
|
|
11763
|
+
node.normalize();
|
|
11764
|
+
const walker = createNodeIterator.call(
|
|
11765
|
+
node.ownerDocument || node,
|
|
11766
|
+
node,
|
|
11767
|
+
// eslint-disable-next-line no-bitwise
|
|
11768
|
+
NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION,
|
|
11769
|
+
null
|
|
11770
|
+
);
|
|
11771
|
+
let currentNode = walker.nextNode();
|
|
11772
|
+
while (currentNode) {
|
|
11773
|
+
let data = currentNode.data;
|
|
11774
|
+
arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
|
|
11775
|
+
data = stringReplace(data, expr, " ");
|
|
11776
|
+
});
|
|
11777
|
+
currentNode.data = data;
|
|
11778
|
+
currentNode = walker.nextNode();
|
|
11779
|
+
}
|
|
11780
|
+
const templates = (_node$querySelectorAl = (_node$querySelectorAl2 = node.querySelectorAll) === null || _node$querySelectorAl2 === void 0 ? void 0 : _node$querySelectorAl2.call(node, "template")) !== null && _node$querySelectorAl !== void 0 ? _node$querySelectorAl : [];
|
|
11781
|
+
arrayForEach(Array.from(templates), (tmpl) => {
|
|
11782
|
+
if (_isDocumentFragment(tmpl.content)) {
|
|
11783
|
+
_scrubTemplateExpressions2(tmpl.content);
|
|
11784
|
+
}
|
|
11785
|
+
});
|
|
11786
|
+
};
|
|
11787
|
+
const _isClobbered = function _isClobbered2(element) {
|
|
11788
|
+
const realTagName = getNodeName ? getNodeName(element) : null;
|
|
11789
|
+
if (typeof realTagName !== "string") {
|
|
11790
|
+
return false;
|
|
11791
|
+
}
|
|
11792
|
+
if (transformCaseFunc(realTagName) !== "form") {
|
|
11793
|
+
return false;
|
|
11794
|
+
}
|
|
11795
|
+
return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || // Realm-safe NamedNodeMap detection: equality against the cached
|
|
11796
|
+
// prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
|
|
11797
|
+
// makes the direct read diverge from the cached read; a clean form
|
|
11798
|
+
// (same-realm OR foreign-realm) has both reads pointing at the same
|
|
11799
|
+
// canonical NamedNodeMap.
|
|
11800
|
+
element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
|
|
11801
|
+
// returns the integer 1 for any Element regardless of realm; direct
|
|
11802
|
+
// read on a clobbered form (e.g. <input name="nodeType">) returns
|
|
11803
|
+
// the named child element. Cheap addition — nodeType is read from
|
|
11804
|
+
// an internal slot, no serialization cost — and removes a residual
|
|
11805
|
+
// clobbering surface used by several mXSS / PI / comment branches
|
|
11806
|
+
// in _sanitizeElements that compare currentNode.nodeType directly.
|
|
11807
|
+
element.nodeType !== getNodeType(element) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
|
|
11808
|
+
// "childNodes" shadows the prototype getter. Direct reads of
|
|
11809
|
+
// form.childNodes from a clobbered form return the named child
|
|
11810
|
+
// instead of the real NodeList, so any walk that reads it directly
|
|
11811
|
+
// skips the form's real children. Compare the direct read to the
|
|
11812
|
+
// cached Node.prototype getter — when the form's named-property
|
|
11813
|
+
// getter intercepts the read, the two values differ and we flag
|
|
11814
|
+
// the form. This catches every clobbering child type (input,
|
|
11815
|
+
// select, etc.) regardless of whether the named child happens to
|
|
11816
|
+
// carry a numeric .length, which a typeof-based probe would miss
|
|
11817
|
+
// (e.g. HTMLSelectElement.length is a defined unsigned-long).
|
|
11818
|
+
element.childNodes !== getChildNodes(element);
|
|
11819
|
+
};
|
|
11820
|
+
const _isDocumentFragment = function _isDocumentFragment2(value) {
|
|
11821
|
+
if (!getNodeType || typeof value !== "object" || value === null) {
|
|
11822
|
+
return false;
|
|
11823
|
+
}
|
|
11824
|
+
try {
|
|
11825
|
+
return getNodeType(value) === NODE_TYPE.documentFragment;
|
|
11826
|
+
} catch (_) {
|
|
11827
|
+
return false;
|
|
11828
|
+
}
|
|
11829
|
+
};
|
|
11830
|
+
const _isNode = function _isNode2(value) {
|
|
11831
|
+
if (!getNodeType || typeof value !== "object" || value === null) {
|
|
11832
|
+
return false;
|
|
11833
|
+
}
|
|
11834
|
+
try {
|
|
11835
|
+
return typeof getNodeType(value) === "number";
|
|
11836
|
+
} catch (_) {
|
|
11837
|
+
return false;
|
|
11838
|
+
}
|
|
11839
|
+
};
|
|
11840
|
+
function _executeHooks(hooks2, currentNode, data) {
|
|
11841
|
+
arrayForEach(hooks2, (hook) => {
|
|
11842
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
11843
|
+
});
|
|
11844
|
+
}
|
|
11845
|
+
const _sanitizeElements = function _sanitizeElements2(currentNode) {
|
|
11846
|
+
let content = null;
|
|
11847
|
+
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
11848
|
+
if (_isClobbered(currentNode)) {
|
|
11849
|
+
_forceRemove(currentNode);
|
|
11850
|
+
return true;
|
|
11851
|
+
}
|
|
11852
|
+
const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
|
|
11853
|
+
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
11854
|
+
tagName,
|
|
11855
|
+
allowedTags: ALLOWED_TAGS
|
|
11856
|
+
});
|
|
11857
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
|
|
11858
|
+
_forceRemove(currentNode);
|
|
11859
|
+
return true;
|
|
11860
|
+
}
|
|
11861
|
+
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
|
|
11862
|
+
_forceRemove(currentNode);
|
|
11863
|
+
return true;
|
|
11864
|
+
}
|
|
11865
|
+
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
11866
|
+
_forceRemove(currentNode);
|
|
11867
|
+
return true;
|
|
11868
|
+
}
|
|
11869
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
|
11870
|
+
_forceRemove(currentNode);
|
|
11871
|
+
return true;
|
|
11872
|
+
}
|
|
11873
|
+
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
11874
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
11875
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
11876
|
+
return false;
|
|
11877
|
+
}
|
|
11878
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
|
|
11879
|
+
return false;
|
|
11880
|
+
}
|
|
11881
|
+
}
|
|
11882
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
11883
|
+
const parentNode = getParentNode(currentNode);
|
|
11884
|
+
const childNodes = getChildNodes(currentNode);
|
|
11885
|
+
if (childNodes && parentNode) {
|
|
11886
|
+
const childCount = childNodes.length;
|
|
11887
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
11888
|
+
const hoisted = IN_PLACE ? childNodes[i] : cloneNode(childNodes[i], true);
|
|
11889
|
+
parentNode.insertBefore(hoisted, getNextSibling(currentNode));
|
|
11890
|
+
}
|
|
11891
|
+
}
|
|
11892
|
+
}
|
|
11893
|
+
_forceRemove(currentNode);
|
|
11894
|
+
return true;
|
|
11895
|
+
}
|
|
11896
|
+
const nt = getNodeType ? getNodeType(currentNode) : currentNode.nodeType;
|
|
11897
|
+
if (nt === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
11898
|
+
_forceRemove(currentNode);
|
|
11899
|
+
return true;
|
|
11900
|
+
}
|
|
11901
|
+
if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
|
11902
|
+
_forceRemove(currentNode);
|
|
11903
|
+
return true;
|
|
11904
|
+
}
|
|
11905
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
11906
|
+
content = currentNode.textContent;
|
|
11907
|
+
arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
|
|
11908
|
+
content = stringReplace(content, expr, " ");
|
|
11909
|
+
});
|
|
11910
|
+
if (currentNode.textContent !== content) {
|
|
11911
|
+
arrayPush(DOMPurify.removed, {
|
|
11912
|
+
element: currentNode.cloneNode()
|
|
11913
|
+
});
|
|
11914
|
+
currentNode.textContent = content;
|
|
11915
|
+
}
|
|
11916
|
+
}
|
|
11917
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
11918
|
+
return false;
|
|
11919
|
+
};
|
|
11920
|
+
const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
|
|
11921
|
+
if (FORBID_ATTR[lcName]) {
|
|
11922
|
+
return false;
|
|
11923
|
+
}
|
|
11924
|
+
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
|
|
11925
|
+
return false;
|
|
11926
|
+
}
|
|
11927
|
+
const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
|
|
11928
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ;
|
|
11929
|
+
else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;
|
|
11930
|
+
else if (!nameIsPermitted || FORBID_ATTR[lcName]) {
|
|
11931
|
+
if (
|
|
11932
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
11933
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
11934
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
11935
|
+
_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
|
|
11936
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
11937
|
+
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))
|
|
11938
|
+
) ;
|
|
11939
|
+
else {
|
|
11940
|
+
return false;
|
|
11941
|
+
}
|
|
11942
|
+
} else if (URI_SAFE_ATTRIBUTES[lcName]) ;
|
|
11943
|
+
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
|
|
11944
|
+
else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
|
|
11945
|
+
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
|
|
11946
|
+
else if (value) {
|
|
11947
|
+
return false;
|
|
11948
|
+
} else ;
|
|
11949
|
+
return true;
|
|
11950
|
+
};
|
|
11951
|
+
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"]);
|
|
11952
|
+
const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
|
|
11953
|
+
return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
|
|
11954
|
+
};
|
|
11955
|
+
const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
|
|
11956
|
+
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
11957
|
+
const attributes = currentNode.attributes;
|
|
11958
|
+
if (!attributes || _isClobbered(currentNode)) {
|
|
11959
|
+
return;
|
|
11960
|
+
}
|
|
11961
|
+
const hookEvent = {
|
|
11962
|
+
attrName: "",
|
|
11963
|
+
attrValue: "",
|
|
11964
|
+
keepAttr: true,
|
|
11965
|
+
allowedAttributes: ALLOWED_ATTR,
|
|
11966
|
+
forceKeepAttr: void 0
|
|
11967
|
+
};
|
|
11968
|
+
let l = attributes.length;
|
|
11969
|
+
while (l--) {
|
|
11970
|
+
const attr = attributes[l];
|
|
11971
|
+
const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
|
|
11972
|
+
const lcName = transformCaseFunc(name);
|
|
11973
|
+
const initValue = attrValue;
|
|
11974
|
+
let value = name === "value" ? initValue : stringTrim(initValue);
|
|
11975
|
+
hookEvent.attrName = lcName;
|
|
11976
|
+
hookEvent.attrValue = value;
|
|
11977
|
+
hookEvent.keepAttr = true;
|
|
11978
|
+
hookEvent.forceKeepAttr = void 0;
|
|
11979
|
+
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
11980
|
+
value = hookEvent.attrValue;
|
|
11981
|
+
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
|
|
11982
|
+
_removeAttribute(name, currentNode);
|
|
11983
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
11984
|
+
}
|
|
11985
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
11986
|
+
_removeAttribute(name, currentNode);
|
|
11987
|
+
continue;
|
|
11988
|
+
}
|
|
11989
|
+
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
11990
|
+
_removeAttribute(name, currentNode);
|
|
11991
|
+
continue;
|
|
11992
|
+
}
|
|
11993
|
+
if (hookEvent.forceKeepAttr) {
|
|
11994
|
+
continue;
|
|
11995
|
+
}
|
|
11996
|
+
if (!hookEvent.keepAttr) {
|
|
11997
|
+
_removeAttribute(name, currentNode);
|
|
11998
|
+
continue;
|
|
11999
|
+
}
|
|
12000
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
12001
|
+
_removeAttribute(name, currentNode);
|
|
12002
|
+
continue;
|
|
12003
|
+
}
|
|
12004
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
12005
|
+
arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
|
|
12006
|
+
value = stringReplace(value, expr, " ");
|
|
12007
|
+
});
|
|
12008
|
+
}
|
|
12009
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
12010
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
12011
|
+
_removeAttribute(name, currentNode);
|
|
12012
|
+
continue;
|
|
12013
|
+
}
|
|
12014
|
+
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
|
|
12015
|
+
if (namespaceURI) ;
|
|
12016
|
+
else {
|
|
12017
|
+
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
12018
|
+
case "TrustedHTML": {
|
|
12019
|
+
value = _createTrustedHTML(value);
|
|
12020
|
+
break;
|
|
12021
|
+
}
|
|
12022
|
+
case "TrustedScriptURL": {
|
|
12023
|
+
value = _createTrustedScriptURL(value);
|
|
12024
|
+
break;
|
|
12025
|
+
}
|
|
12026
|
+
}
|
|
12027
|
+
}
|
|
12028
|
+
}
|
|
12029
|
+
if (value !== initValue) {
|
|
12030
|
+
try {
|
|
12031
|
+
if (namespaceURI) {
|
|
12032
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
12033
|
+
} else {
|
|
12034
|
+
currentNode.setAttribute(name, value);
|
|
12035
|
+
}
|
|
12036
|
+
if (_isClobbered(currentNode)) {
|
|
12037
|
+
_forceRemove(currentNode);
|
|
12038
|
+
} else {
|
|
12039
|
+
arrayPop(DOMPurify.removed);
|
|
12040
|
+
}
|
|
12041
|
+
} catch (_) {
|
|
12042
|
+
_removeAttribute(name, currentNode);
|
|
12043
|
+
}
|
|
12044
|
+
}
|
|
12045
|
+
}
|
|
12046
|
+
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
12047
|
+
};
|
|
12048
|
+
const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
|
|
12049
|
+
let shadowNode = null;
|
|
12050
|
+
const shadowIterator = _createNodeIterator(fragment);
|
|
12051
|
+
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
12052
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
|
12053
|
+
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
12054
|
+
_sanitizeElements(shadowNode);
|
|
12055
|
+
_sanitizeAttributes(shadowNode);
|
|
12056
|
+
if (_isDocumentFragment(shadowNode.content)) {
|
|
12057
|
+
_sanitizeShadowDOM2(shadowNode.content);
|
|
12058
|
+
}
|
|
12059
|
+
const shadowNodeType = getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType;
|
|
12060
|
+
if (shadowNodeType === NODE_TYPE.element) {
|
|
12061
|
+
const innerSr = getShadowRoot ? getShadowRoot(shadowNode) : shadowNode.shadowRoot;
|
|
12062
|
+
if (_isDocumentFragment(innerSr)) {
|
|
12063
|
+
_sanitizeAttachedShadowRoots(innerSr);
|
|
12064
|
+
_sanitizeShadowDOM2(innerSr);
|
|
12065
|
+
}
|
|
12066
|
+
}
|
|
12067
|
+
}
|
|
12068
|
+
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
12069
|
+
};
|
|
12070
|
+
const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots2(root) {
|
|
12071
|
+
const stack = [{
|
|
12072
|
+
node: root,
|
|
12073
|
+
shadow: null
|
|
12074
|
+
}];
|
|
12075
|
+
while (stack.length > 0) {
|
|
12076
|
+
const item = stack.pop();
|
|
12077
|
+
if (item.shadow) {
|
|
12078
|
+
_sanitizeShadowDOM2(item.shadow);
|
|
12079
|
+
continue;
|
|
12080
|
+
}
|
|
12081
|
+
const node = item.node;
|
|
12082
|
+
const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
|
|
12083
|
+
const isElement = nodeType === NODE_TYPE.element;
|
|
12084
|
+
const childNodes = getChildNodes ? getChildNodes(node) : node.childNodes;
|
|
12085
|
+
if (childNodes) {
|
|
12086
|
+
for (let i = childNodes.length - 1; i >= 0; --i) {
|
|
12087
|
+
stack.push({
|
|
12088
|
+
node: childNodes[i],
|
|
12089
|
+
shadow: null
|
|
12090
|
+
});
|
|
12091
|
+
}
|
|
12092
|
+
}
|
|
12093
|
+
if (isElement) {
|
|
12094
|
+
const rootName = getNodeName ? getNodeName(node) : null;
|
|
12095
|
+
if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
|
|
12096
|
+
const content = node.content;
|
|
12097
|
+
if (_isDocumentFragment(content)) {
|
|
12098
|
+
stack.push({
|
|
12099
|
+
node: content,
|
|
12100
|
+
shadow: null
|
|
12101
|
+
});
|
|
12102
|
+
}
|
|
12103
|
+
}
|
|
12104
|
+
}
|
|
12105
|
+
if (isElement) {
|
|
12106
|
+
const sr = getShadowRoot ? getShadowRoot(node) : node.shadowRoot;
|
|
12107
|
+
if (_isDocumentFragment(sr)) {
|
|
12108
|
+
stack.push({
|
|
12109
|
+
node: null,
|
|
12110
|
+
shadow: sr
|
|
12111
|
+
}, {
|
|
12112
|
+
node: sr,
|
|
12113
|
+
shadow: null
|
|
12114
|
+
});
|
|
12115
|
+
}
|
|
12116
|
+
}
|
|
12117
|
+
}
|
|
12118
|
+
};
|
|
12119
|
+
DOMPurify.sanitize = function(dirty) {
|
|
12120
|
+
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
12121
|
+
let body = null;
|
|
12122
|
+
let importedNode = null;
|
|
12123
|
+
let currentNode = null;
|
|
12124
|
+
let returnNode = null;
|
|
12125
|
+
IS_EMPTY_INPUT = !dirty;
|
|
12126
|
+
if (IS_EMPTY_INPUT) {
|
|
12127
|
+
dirty = "<!-->";
|
|
12128
|
+
}
|
|
12129
|
+
if (typeof dirty !== "string" && !_isNode(dirty)) {
|
|
12130
|
+
dirty = stringifyValue(dirty);
|
|
12131
|
+
if (typeof dirty !== "string") {
|
|
12132
|
+
throw typeErrorCreate("dirty is not a string, aborting");
|
|
12133
|
+
}
|
|
12134
|
+
}
|
|
12135
|
+
if (!DOMPurify.isSupported) {
|
|
12136
|
+
return dirty;
|
|
12137
|
+
}
|
|
12138
|
+
if (!SET_CONFIG) {
|
|
12139
|
+
_parseConfig(cfg);
|
|
12140
|
+
}
|
|
12141
|
+
DOMPurify.removed = [];
|
|
12142
|
+
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
12143
|
+
if (inPlace) {
|
|
12144
|
+
const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
|
|
12145
|
+
if (typeof nn === "string") {
|
|
12146
|
+
const tagName = transformCaseFunc(nn);
|
|
12147
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
12148
|
+
throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
12149
|
+
}
|
|
12150
|
+
}
|
|
12151
|
+
if (_isClobbered(dirty)) {
|
|
12152
|
+
throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
|
|
12153
|
+
}
|
|
12154
|
+
try {
|
|
12155
|
+
_sanitizeAttachedShadowRoots(dirty);
|
|
12156
|
+
} catch (error) {
|
|
12157
|
+
_neutralizeRoot(dirty);
|
|
12158
|
+
throw error;
|
|
12159
|
+
}
|
|
12160
|
+
} else if (_isNode(dirty)) {
|
|
12161
|
+
body = _initDocument("<!---->");
|
|
12162
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
12163
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
|
|
12164
|
+
body = importedNode;
|
|
12165
|
+
} else if (importedNode.nodeName === "HTML") {
|
|
12166
|
+
body = importedNode;
|
|
12167
|
+
} else {
|
|
12168
|
+
body.appendChild(importedNode);
|
|
12169
|
+
}
|
|
12170
|
+
_sanitizeAttachedShadowRoots(importedNode);
|
|
12171
|
+
} else {
|
|
12172
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
|
|
12173
|
+
dirty.indexOf("<") === -1) {
|
|
12174
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
|
|
12175
|
+
}
|
|
12176
|
+
body = _initDocument(dirty);
|
|
12177
|
+
if (!body) {
|
|
12178
|
+
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
|
|
12179
|
+
}
|
|
12180
|
+
}
|
|
12181
|
+
if (body && FORCE_BODY) {
|
|
12182
|
+
_forceRemove(body.firstChild);
|
|
12183
|
+
}
|
|
12184
|
+
const nodeIterator = _createNodeIterator(inPlace ? dirty : body);
|
|
12185
|
+
try {
|
|
12186
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
12187
|
+
_sanitizeElements(currentNode);
|
|
12188
|
+
_sanitizeAttributes(currentNode);
|
|
12189
|
+
if (_isDocumentFragment(currentNode.content)) {
|
|
12190
|
+
_sanitizeShadowDOM2(currentNode.content);
|
|
12191
|
+
}
|
|
12192
|
+
}
|
|
12193
|
+
} catch (error) {
|
|
12194
|
+
if (inPlace) {
|
|
12195
|
+
_neutralizeRoot(dirty);
|
|
12196
|
+
}
|
|
12197
|
+
throw error;
|
|
12198
|
+
}
|
|
12199
|
+
if (inPlace) {
|
|
12200
|
+
arrayForEach(DOMPurify.removed, (entry) => {
|
|
12201
|
+
if (entry.element) {
|
|
12202
|
+
_neutralizeSubtree(entry.element);
|
|
12203
|
+
}
|
|
12204
|
+
});
|
|
12205
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
12206
|
+
_scrubTemplateExpressions2(dirty);
|
|
12207
|
+
}
|
|
12208
|
+
return dirty;
|
|
12209
|
+
}
|
|
12210
|
+
if (RETURN_DOM) {
|
|
12211
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
12212
|
+
_scrubTemplateExpressions2(body);
|
|
12213
|
+
}
|
|
12214
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
12215
|
+
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
12216
|
+
while (body.firstChild) {
|
|
12217
|
+
returnNode.appendChild(body.firstChild);
|
|
12218
|
+
}
|
|
12219
|
+
} else {
|
|
12220
|
+
returnNode = body;
|
|
12221
|
+
}
|
|
12222
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
|
|
12223
|
+
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
12224
|
+
}
|
|
12225
|
+
return returnNode;
|
|
12226
|
+
}
|
|
12227
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
12228
|
+
if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
|
12229
|
+
serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
|
12230
|
+
}
|
|
12231
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
12232
|
+
arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
|
|
12233
|
+
serializedHTML = stringReplace(serializedHTML, expr, " ");
|
|
12234
|
+
});
|
|
12235
|
+
}
|
|
12236
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
|
|
12237
|
+
};
|
|
12238
|
+
DOMPurify.setConfig = function() {
|
|
12239
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
12240
|
+
_parseConfig(cfg);
|
|
12241
|
+
SET_CONFIG = true;
|
|
12242
|
+
};
|
|
12243
|
+
DOMPurify.clearConfig = function() {
|
|
12244
|
+
CONFIG = null;
|
|
12245
|
+
SET_CONFIG = false;
|
|
12246
|
+
trustedTypesPolicy = defaultTrustedTypesPolicy;
|
|
12247
|
+
emptyHTML = "";
|
|
12248
|
+
};
|
|
12249
|
+
DOMPurify.isValidAttribute = function(tag, attr, value) {
|
|
12250
|
+
if (!CONFIG) {
|
|
12251
|
+
_parseConfig({});
|
|
12252
|
+
}
|
|
12253
|
+
const lcTag = transformCaseFunc(tag);
|
|
12254
|
+
const lcName = transformCaseFunc(attr);
|
|
12255
|
+
return _isValidAttribute(lcTag, lcName, value);
|
|
12256
|
+
};
|
|
12257
|
+
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
|
12258
|
+
if (typeof hookFunction !== "function") {
|
|
12259
|
+
return;
|
|
12260
|
+
}
|
|
12261
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
|
12262
|
+
};
|
|
12263
|
+
DOMPurify.removeHook = function(entryPoint, hookFunction) {
|
|
12264
|
+
if (hookFunction !== void 0) {
|
|
12265
|
+
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
12266
|
+
return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
12267
|
+
}
|
|
12268
|
+
return arrayPop(hooks[entryPoint]);
|
|
12269
|
+
};
|
|
12270
|
+
DOMPurify.removeHooks = function(entryPoint) {
|
|
12271
|
+
hooks[entryPoint] = [];
|
|
12272
|
+
};
|
|
12273
|
+
DOMPurify.removeAllHooks = function() {
|
|
12274
|
+
hooks = _createHooksMap();
|
|
12275
|
+
};
|
|
12276
|
+
return DOMPurify;
|
|
12277
|
+
}
|
|
12278
|
+
var purify = createDOMPurify();
|
|
12279
|
+
purify.addHook("afterSanitizeAttributes", (node) => {
|
|
12280
|
+
if (node.tagName === "A" && node.getAttribute("target") === "_blank") {
|
|
12281
|
+
node.setAttribute("rel", "noopener noreferrer");
|
|
12282
|
+
}
|
|
12283
|
+
});
|
|
12284
|
+
function sanitizeBannerHtml(html2) {
|
|
12285
|
+
if (!html2) return "";
|
|
12286
|
+
return purify.sanitize(html2, {
|
|
12287
|
+
ALLOWED_TAGS: ["p", "strong", "em", "u", "img", "span", "div", "a", "br"],
|
|
12288
|
+
ALLOWED_ATTR: ["style", "src", "class", "href", "target", "alt", "width", "height"],
|
|
12289
|
+
ADD_ATTR: ["target"],
|
|
12290
|
+
ALLOW_DATA_ATTR: false
|
|
12291
|
+
});
|
|
12292
|
+
}
|
|
12293
|
+
function resolveCssToken(token) {
|
|
12294
|
+
const normalizedToken = token.startsWith("--") ? token : `--${token}`;
|
|
12295
|
+
const candidates = [
|
|
12296
|
+
document.documentElement,
|
|
12297
|
+
document.body,
|
|
12298
|
+
...Array.from(
|
|
12299
|
+
document.querySelectorAll(
|
|
12300
|
+
[
|
|
12301
|
+
"rai-widget",
|
|
12302
|
+
"rai-custom-widget",
|
|
12303
|
+
"rai-channel-widget",
|
|
12304
|
+
"rai-store-widget",
|
|
12305
|
+
"rai-milestone-widget",
|
|
12306
|
+
"rai-social-widget",
|
|
12307
|
+
"rai-currency-widget",
|
|
12308
|
+
"rai-referral-widget",
|
|
12309
|
+
".rai-widget-root",
|
|
12310
|
+
'[data-rai-widget-root="true"]'
|
|
12311
|
+
].join(",")
|
|
12312
|
+
)
|
|
12313
|
+
)
|
|
12314
|
+
].filter(Boolean);
|
|
12315
|
+
for (const node of candidates) {
|
|
12316
|
+
const value = getComputedStyle(node).getPropertyValue(normalizedToken).trim();
|
|
12317
|
+
if (value) return value;
|
|
12318
|
+
}
|
|
12319
|
+
for (const node of Array.from(document.querySelectorAll("*"))) {
|
|
12320
|
+
const value = getComputedStyle(node).getPropertyValue(normalizedToken).trim();
|
|
12321
|
+
if (value) return value;
|
|
12322
|
+
}
|
|
12323
|
+
return void 0;
|
|
12324
|
+
}
|
|
12325
|
+
const safeColor = (v) => {
|
|
12326
|
+
if (!v) return void 0;
|
|
12327
|
+
const value = v.trim();
|
|
12328
|
+
if (/^(#|rgb|hsl)/i.test(value)) return value;
|
|
12329
|
+
if (/^(--)?[a-z0-9-]+$/i.test(value)) {
|
|
12330
|
+
const resolved = resolveCssToken(value);
|
|
12331
|
+
return resolved;
|
|
12332
|
+
}
|
|
12333
|
+
const varMatch = value.match(/^var\((--[a-z0-9-]+)\)$/i);
|
|
12334
|
+
if (varMatch) {
|
|
12335
|
+
const token = varMatch[1];
|
|
12336
|
+
const resolved = resolveCssToken(token);
|
|
12337
|
+
return resolved;
|
|
12338
|
+
}
|
|
12339
|
+
return void 0;
|
|
12340
|
+
};
|
|
12341
|
+
function el(tag, styles, attrs) {
|
|
12342
|
+
const node = document.createElement(tag);
|
|
12343
|
+
Object.assign(node.style, styles);
|
|
12344
|
+
if (attrs) {
|
|
12345
|
+
for (const k of Object.keys(attrs)) node.setAttribute(k, attrs[k]);
|
|
12346
|
+
}
|
|
12347
|
+
return node;
|
|
12348
|
+
}
|
|
12349
|
+
function ctaAlign(pos) {
|
|
12350
|
+
if (pos === "left") return "flex-start";
|
|
12351
|
+
if (pos === "right") return "flex-end";
|
|
12352
|
+
return "center";
|
|
12353
|
+
}
|
|
12354
|
+
function isImageBanner(banner) {
|
|
12355
|
+
var _a, _b;
|
|
12356
|
+
return banner.type === "image" && Boolean(((_a = banner.image) == null ? void 0 : _a.desktopUrl) || ((_b = banner.image) == null ? void 0 : _b.mobileUrl));
|
|
12357
|
+
}
|
|
12358
|
+
function imageAlign(pos) {
|
|
12359
|
+
if (pos === "left" || pos === "top") return "flex-start";
|
|
12360
|
+
if (pos === "right" || pos === "bottom") return "flex-end";
|
|
12361
|
+
return "center";
|
|
12362
|
+
}
|
|
12363
|
+
function imageObjectPosition(horizontal, vertical) {
|
|
12364
|
+
const x = horizontal === "left" ? "left" : horizontal === "right" ? "right" : "center";
|
|
12365
|
+
const y = vertical === "top" ? "top" : vertical === "bottom" ? "bottom" : "center";
|
|
12366
|
+
return `${x} ${y}`;
|
|
12367
|
+
}
|
|
12368
|
+
function getCtaStyleValue(banner, keys) {
|
|
12369
|
+
var _a;
|
|
12370
|
+
const sources = [(_a = banner.cta) == null ? void 0 : _a.style, banner.cta, banner.ctaStyle];
|
|
12371
|
+
for (const source of sources) {
|
|
12372
|
+
for (const key of keys) {
|
|
12373
|
+
const value = source == null ? void 0 : source[key];
|
|
12374
|
+
if (value) return value;
|
|
12375
|
+
}
|
|
12376
|
+
}
|
|
12377
|
+
return void 0;
|
|
12378
|
+
}
|
|
12379
|
+
function styleRichText(container) {
|
|
12380
|
+
container.querySelectorAll("p").forEach((p) => {
|
|
12381
|
+
p.style.margin = "0";
|
|
12382
|
+
p.style.whiteSpace = "normal";
|
|
12383
|
+
p.style.overflowWrap = "anywhere";
|
|
12384
|
+
});
|
|
12385
|
+
container.querySelectorAll("strong").forEach((strong) => {
|
|
12386
|
+
strong.style.fontWeight = "700";
|
|
12387
|
+
strong.style.whiteSpace = "normal";
|
|
12388
|
+
});
|
|
12389
|
+
container.querySelectorAll("em").forEach((em) => {
|
|
12390
|
+
em.style.fontStyle = "italic";
|
|
12391
|
+
em.style.whiteSpace = "normal";
|
|
12392
|
+
});
|
|
12393
|
+
container.querySelectorAll("u").forEach((u) => {
|
|
12394
|
+
u.style.textDecoration = "underline";
|
|
12395
|
+
u.style.whiteSpace = "normal";
|
|
12396
|
+
});
|
|
12397
|
+
container.querySelectorAll("a").forEach((a) => {
|
|
12398
|
+
a.style.color = "#3b82f6";
|
|
12399
|
+
a.style.textDecoration = "underline";
|
|
12400
|
+
a.style.whiteSpace = "normal";
|
|
12401
|
+
a.style.overflowWrap = "anywhere";
|
|
12402
|
+
if (a.getAttribute("target") === "_blank") {
|
|
12403
|
+
a.setAttribute("rel", "noopener noreferrer");
|
|
12404
|
+
}
|
|
12405
|
+
});
|
|
12406
|
+
container.querySelectorAll("img").forEach((img) => {
|
|
12407
|
+
img.style.maxWidth = "100%";
|
|
12408
|
+
img.style.height = "auto";
|
|
12409
|
+
});
|
|
12410
|
+
}
|
|
12411
|
+
function readTextAlign(container) {
|
|
12412
|
+
const aligned = container.querySelector(
|
|
12413
|
+
'[style*="text-align"]'
|
|
12414
|
+
);
|
|
12415
|
+
const value = ((aligned == null ? void 0 : aligned.style.textAlign) || container.style.textAlign || "").toLowerCase().trim();
|
|
12416
|
+
if (value === "center" || value === "right" || value === "justify") return value;
|
|
12417
|
+
return "left";
|
|
12418
|
+
}
|
|
12419
|
+
function justifyFromTextAlign(align) {
|
|
12420
|
+
if (align === "center") return "center";
|
|
12421
|
+
if (align === "right") return "flex-end";
|
|
12422
|
+
return "flex-start";
|
|
12423
|
+
}
|
|
12424
|
+
function renderBanner(banner, handlers) {
|
|
12425
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
12426
|
+
const placement = banner.placement || {};
|
|
12427
|
+
const mode = placement.mode || "overlay";
|
|
12428
|
+
const position = placement.position || "top";
|
|
12429
|
+
const zIndex = String(placement.zIndex || 2147483e3);
|
|
12430
|
+
const imageBanner = isImageBanner(banner);
|
|
12431
|
+
const bg = imageBanner ? "transparent" : safeColor((_a = banner.style) == null ? void 0 : _a.backgroundColor) || "#1f2024";
|
|
12432
|
+
const color = safeColor((_b = banner.style) == null ? void 0 : _b.color) || "#ffffff";
|
|
12433
|
+
const isCard = mode === "overlay" || mode === "popup";
|
|
12434
|
+
const ctaPosition = getCtaStyleValue(banner, ["position"]) || "center";
|
|
12435
|
+
const imageHorizontal = imageAlign((_c = banner.image) == null ? void 0 : _c.horizontalAlignment);
|
|
12436
|
+
const imageVertical = imageAlign((_d = banner.image) == null ? void 0 : _d.verticalAlignment);
|
|
12437
|
+
const imageHorizontalPosition = ((_e = banner.image) == null ? void 0 : _e.horizontalAlignment) || "center";
|
|
12438
|
+
const imageVerticalPosition = ((_f = banner.image) == null ? void 0 : _f.verticalAlignment) || "center";
|
|
12439
|
+
const closeColor = imageBanner ? "#ffffff" : color;
|
|
12440
|
+
const root = el("div", {
|
|
12441
|
+
boxSizing: "border-box",
|
|
12442
|
+
fontFamily: "Roboto, sans-serif",
|
|
12443
|
+
fontSize: "14px",
|
|
12444
|
+
lineHeight: "1.35",
|
|
12445
|
+
background: bg,
|
|
12446
|
+
color,
|
|
12447
|
+
borderRadius: isCard && !imageBanner ? "6px" : "0",
|
|
12448
|
+
boxShadow: isCard && !imageBanner ? "0 8px 24px rgba(0,0,0,0.22)" : "none",
|
|
12449
|
+
padding: imageBanner ? "0" : isCard ? "12px 42px 12px 24px" : "8px 42px 8px 16px",
|
|
12450
|
+
display: "flex",
|
|
12451
|
+
alignItems: imageBanner ? imageVertical : "flex-start",
|
|
12452
|
+
justifyContent: "center",
|
|
12453
|
+
gap: imageBanner ? "0" : "16px"
|
|
12454
|
+
});
|
|
12455
|
+
root.setAttribute("role", isCard ? "dialog" : "region");
|
|
12456
|
+
root.setAttribute("aria-label", "community banner");
|
|
12457
|
+
root.setAttribute("data-renderer-version", "sdk-banner-preview-layout");
|
|
12458
|
+
if (isCard) {
|
|
12459
|
+
Object.assign(root.style, {
|
|
12460
|
+
position: "fixed",
|
|
12461
|
+
left: "50%",
|
|
12462
|
+
width: "fit-content",
|
|
12463
|
+
maxWidth: imageBanner ? "70vw" : "min(700px, 80vw)",
|
|
12464
|
+
height: "auto",
|
|
12465
|
+
minHeight: imageBanner ? "0" : "80px",
|
|
12466
|
+
maxHeight: imageBanner ? "70vh" : "calc(100vh - 300px)",
|
|
12467
|
+
overflowY: imageBanner ? "visible" : "auto",
|
|
12468
|
+
zIndex
|
|
12469
|
+
});
|
|
12470
|
+
if (imageBanner) {
|
|
12471
|
+
const translate = [];
|
|
12472
|
+
if (imageHorizontalPosition === "left") {
|
|
12473
|
+
root.style.left = "24px";
|
|
12474
|
+
} else if (imageHorizontalPosition === "right") {
|
|
12475
|
+
root.style.left = "";
|
|
12476
|
+
root.style.right = "24px";
|
|
12477
|
+
} else {
|
|
12478
|
+
root.style.left = "50%";
|
|
12479
|
+
translate.push("-50%");
|
|
12480
|
+
}
|
|
12481
|
+
if (imageVerticalPosition === "top") {
|
|
12482
|
+
root.style.top = "10px";
|
|
12483
|
+
} else if (imageVerticalPosition === "bottom") {
|
|
12484
|
+
root.style.bottom = "24px";
|
|
12485
|
+
} else {
|
|
12486
|
+
root.style.top = "50%";
|
|
12487
|
+
translate.push("-50%");
|
|
12488
|
+
}
|
|
12489
|
+
if (translate.length === 2) root.style.transform = `translate(${translate[0]}, ${translate[1]})`;
|
|
12490
|
+
else if (translate.length === 1 && imageHorizontalPosition === "center") root.style.transform = `translateX(${translate[0]})`;
|
|
12491
|
+
else if (translate.length === 1) root.style.transform = `translateY(${translate[0]})`;
|
|
12492
|
+
else root.style.transform = "";
|
|
12493
|
+
} else if (position === "bottom") {
|
|
12494
|
+
root.style.bottom = "24px";
|
|
12495
|
+
root.style.transform = "translateX(-50%)";
|
|
12496
|
+
} else if (position === "center") {
|
|
12497
|
+
root.style.top = "50%";
|
|
12498
|
+
root.style.transform = "translate(-50%, -50%)";
|
|
12499
|
+
} else {
|
|
12500
|
+
root.style.top = "10px";
|
|
12501
|
+
root.style.transform = "translateX(-50%)";
|
|
12502
|
+
}
|
|
12503
|
+
} else {
|
|
12504
|
+
Object.assign(root.style, { position: "relative", width: "100%", zIndex });
|
|
12505
|
+
}
|
|
12506
|
+
const contentWrap = el("div", {
|
|
12507
|
+
display: "flex",
|
|
12508
|
+
width: imageBanner || isCard ? "auto" : "100%",
|
|
12509
|
+
maxWidth: "100%",
|
|
12510
|
+
flexDirection: "column",
|
|
12511
|
+
gap: imageBanner ? "0" : "12px",
|
|
12512
|
+
overflow: "hidden"
|
|
12513
|
+
});
|
|
12514
|
+
const contentRow = el("div", {
|
|
12515
|
+
display: "flex",
|
|
12516
|
+
width: imageBanner || isCard ? "auto" : "100%",
|
|
12517
|
+
justifyContent: imageBanner ? imageHorizontal : "space-between",
|
|
12518
|
+
alignItems: imageBanner ? imageVertical : "flex-start",
|
|
12519
|
+
gap: "12px"
|
|
12520
|
+
});
|
|
12521
|
+
const content = el("div", {
|
|
12522
|
+
width: imageBanner || isCard ? "auto" : "100%",
|
|
12523
|
+
maxWidth: imageBanner ? "70vw" : isCard ? "calc(min(700px, 80vw) - 66px)" : "100%",
|
|
12524
|
+
overflow: "hidden",
|
|
12525
|
+
wordBreak: "normal",
|
|
12526
|
+
overflowWrap: "anywhere",
|
|
12527
|
+
whiteSpace: "normal",
|
|
12528
|
+
color
|
|
12529
|
+
});
|
|
12530
|
+
const imageUrl = ((_g = banner.image) == null ? void 0 : _g.desktopUrl) || ((_h = banner.image) == null ? void 0 : _h.mobileUrl);
|
|
12531
|
+
if (imageBanner && imageUrl) {
|
|
12532
|
+
const imageLinkUrl = (_i = banner.image) == null ? void 0 : _i.linkUrl;
|
|
12533
|
+
const imageOpenInNewTab = (_j = banner.image) == null ? void 0 : _j.openInNewTab;
|
|
12534
|
+
const img = el(
|
|
12535
|
+
"img",
|
|
12536
|
+
{
|
|
12537
|
+
display: "block",
|
|
12538
|
+
maxWidth: "70vw",
|
|
12539
|
+
maxHeight: "70vh",
|
|
12540
|
+
width: "auto",
|
|
12541
|
+
height: "auto",
|
|
12542
|
+
objectFit: "contain",
|
|
12543
|
+
objectPosition: imageObjectPosition(
|
|
12544
|
+
(_k = banner.image) == null ? void 0 : _k.horizontalAlignment,
|
|
12545
|
+
(_l = banner.image) == null ? void 0 : _l.verticalAlignment
|
|
12546
|
+
),
|
|
12547
|
+
cursor: imageLinkUrl ? "pointer" : "",
|
|
12548
|
+
borderRadius: ((_m = banner.image) == null ? void 0 : _m.cornerRadius) === "rounded" ? "8px" : "0"
|
|
12549
|
+
},
|
|
12550
|
+
{ src: imageUrl, alt: banner.title || "banner" }
|
|
12551
|
+
);
|
|
12552
|
+
if (imageLinkUrl) {
|
|
12553
|
+
img.addEventListener("click", () => {
|
|
12554
|
+
if (imageOpenInNewTab) {
|
|
12555
|
+
window.open(imageLinkUrl, "_blank", "noopener,noreferrer");
|
|
12556
|
+
} else {
|
|
12557
|
+
window.location.href = imageLinkUrl;
|
|
12558
|
+
}
|
|
12559
|
+
});
|
|
12560
|
+
}
|
|
12561
|
+
content.appendChild(img);
|
|
12562
|
+
} else {
|
|
12563
|
+
content.innerHTML = sanitizeBannerHtml(banner.text);
|
|
12564
|
+
styleRichText(content);
|
|
12565
|
+
const textAlign = readTextAlign(content);
|
|
12566
|
+
content.style.textAlign = textAlign;
|
|
12567
|
+
if (isCard) {
|
|
12568
|
+
contentRow.style.justifyContent = justifyFromTextAlign(textAlign);
|
|
12569
|
+
}
|
|
12570
|
+
}
|
|
12571
|
+
if (!imageBanner && ((_n = banner.cta) == null ? void 0 : _n.enabled)) {
|
|
12572
|
+
const ctaBg = safeColor(
|
|
12573
|
+
getCtaStyleValue(banner, ["backgroundColor", "buttonColor", "aColor"])
|
|
12574
|
+
) || "#2f6df6";
|
|
12575
|
+
const ctaColor = safeColor(getCtaStyleValue(banner, ["textColor", "color"])) || "#ffffff";
|
|
12576
|
+
const btn = el("button", {
|
|
12577
|
+
cursor: "pointer",
|
|
12578
|
+
border: "none",
|
|
12579
|
+
borderRadius: "6px",
|
|
12580
|
+
height: "36px",
|
|
12581
|
+
minHeight: "36px",
|
|
12582
|
+
padding: "0 16px",
|
|
12583
|
+
fontFamily: "Roboto, sans-serif",
|
|
12584
|
+
fontSize: "12px",
|
|
12585
|
+
fontWeight: "600",
|
|
12586
|
+
lineHeight: "20px",
|
|
12587
|
+
backgroundColor: ctaBg,
|
|
12588
|
+
color: ctaColor,
|
|
12589
|
+
boxSizing: "border-box",
|
|
12590
|
+
display: "inline-flex",
|
|
12591
|
+
alignItems: "center",
|
|
12592
|
+
justifyContent: "center"
|
|
12593
|
+
});
|
|
12594
|
+
btn.type = "button";
|
|
12595
|
+
btn.textContent = banner.cta.label || "CTA Button";
|
|
12596
|
+
btn.addEventListener("click", handlers.onCtaClick);
|
|
12597
|
+
if (ctaPosition === "inline") {
|
|
12598
|
+
contentRow.appendChild(content);
|
|
12599
|
+
const inlineWrap = el("div", {
|
|
12600
|
+
display: "flex",
|
|
12601
|
+
flexDirection: "column",
|
|
12602
|
+
alignItems: "flex-end",
|
|
12603
|
+
justifyContent: "center",
|
|
12604
|
+
flexShrink: "0"
|
|
12605
|
+
});
|
|
12606
|
+
inlineWrap.appendChild(btn);
|
|
12607
|
+
contentRow.appendChild(inlineWrap);
|
|
12608
|
+
contentWrap.appendChild(contentRow);
|
|
12609
|
+
} else {
|
|
12610
|
+
contentRow.appendChild(content);
|
|
12611
|
+
contentWrap.appendChild(contentRow);
|
|
12612
|
+
const wrap = el("div", {
|
|
12613
|
+
display: "flex",
|
|
12614
|
+
width: "100%",
|
|
12615
|
+
justifyContent: ctaAlign(ctaPosition)
|
|
12616
|
+
});
|
|
12617
|
+
wrap.appendChild(btn);
|
|
12618
|
+
contentWrap.appendChild(wrap);
|
|
12619
|
+
}
|
|
12620
|
+
} else {
|
|
12621
|
+
contentRow.appendChild(content);
|
|
12622
|
+
contentWrap.appendChild(contentRow);
|
|
12623
|
+
}
|
|
12624
|
+
root.appendChild(contentWrap);
|
|
12625
|
+
const close = el("button", {
|
|
12626
|
+
position: isCard ? "absolute" : "",
|
|
12627
|
+
top: isCard ? imageBanner ? "16px" : "12px" : "",
|
|
12628
|
+
right: isCard ? imageBanner ? "16px" : "12px" : "",
|
|
12629
|
+
marginTop: isCard ? "0" : "8px",
|
|
12630
|
+
width: "20px",
|
|
12631
|
+
minWidth: "20px",
|
|
12632
|
+
height: "20px",
|
|
12633
|
+
cursor: "pointer",
|
|
12634
|
+
border: "none",
|
|
12635
|
+
borderRadius: "50%",
|
|
12636
|
+
background: "rgba(0,0,0,0.25)",
|
|
12637
|
+
color: closeColor,
|
|
12638
|
+
fontSize: "16px",
|
|
12639
|
+
lineHeight: "1",
|
|
12640
|
+
display: "flex",
|
|
12641
|
+
alignItems: "center",
|
|
12642
|
+
justifyContent: "center",
|
|
12643
|
+
padding: "0",
|
|
12644
|
+
flexShrink: "0"
|
|
12645
|
+
});
|
|
12646
|
+
close.type = "button";
|
|
12647
|
+
close.setAttribute("aria-label", "dismiss banner");
|
|
12648
|
+
close.innerHTML = "×";
|
|
12649
|
+
close.addEventListener("click", handlers.onDismiss);
|
|
12650
|
+
root.appendChild(close);
|
|
12651
|
+
return root;
|
|
12652
|
+
}
|
|
12653
|
+
const VISITOR_KEY = "rai-banner-visitor";
|
|
12654
|
+
function uuid() {
|
|
12655
|
+
try {
|
|
12656
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
12657
|
+
return crypto.randomUUID();
|
|
12658
|
+
}
|
|
12659
|
+
} catch {
|
|
12660
|
+
}
|
|
12661
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
12662
|
+
const r = Math.random() * 16 | 0;
|
|
12663
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
12664
|
+
return v.toString(16);
|
|
12665
|
+
});
|
|
12666
|
+
}
|
|
12667
|
+
function getOrCreateVisitorId(communityId, storagePrefix) {
|
|
12668
|
+
const key = `${storagePrefix}-${VISITOR_KEY}-${communityId}`;
|
|
12669
|
+
try {
|
|
12670
|
+
let id = localStorage.getItem(key);
|
|
12671
|
+
if (!id) {
|
|
12672
|
+
id = uuid();
|
|
12673
|
+
localStorage.setItem(key, id);
|
|
12674
|
+
}
|
|
12675
|
+
return id;
|
|
12676
|
+
} catch {
|
|
12677
|
+
return uuid();
|
|
12678
|
+
}
|
|
12679
|
+
}
|
|
12680
|
+
function fireTracking(url) {
|
|
12681
|
+
if (!url) return;
|
|
12682
|
+
try {
|
|
12683
|
+
const img = new Image();
|
|
12684
|
+
img.src = url;
|
|
12685
|
+
} catch {
|
|
12686
|
+
}
|
|
12687
|
+
}
|
|
10887
12688
|
const widgetCSS = ':host{display:block;position:relative;width:100%;height:100%}.rai-loader{position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.75rem;width:100%;height:100%;background:var(--background-5, var(--rai-loader-bg, #ffffff));border-radius:8px;z-index:10;transition:opacity .3s ease-out;font-family:var(--rai-loader-font, "Roboto", system-ui, -apple-system, sans-serif)}.rai-loader.fade-out{opacity:0;pointer-events:none}.rai-loader-text{margin:.5rem 0 0;font-size:1.125rem;line-height:1.75rem;font-weight:400;letter-spacing:normal;color:var(--accent-1, var(--rai-accent, #000000));text-align:center}@media (min-width: 768px){.rai-loader-text{font-size:1.5rem;line-height:2rem}}.rai-error{display:none;position:absolute;top:0;left:0;width:100%;height:100%;align-items:center;justify-content:center;flex-direction:column;gap:12px;background:var(--rai-error-bg, #1a1a1a);border-radius:8px;padding:24px;box-sizing:border-box;text-align:center;color:var(--rai-error-text, #9ca3af);font-family:system-ui,-apple-system,sans-serif;z-index:10}.rai-error.visible{display:flex}iframe{display:block;border:none;opacity:0;transition:opacity .3s ease-in}iframe.loaded{opacity:1}.rai-lottie-loader{width:100px;height:100px}.rai-lottie-loader svg{width:100%!important;height:100%!important}.rai-lottie-spinner{width:32px;height:32px;margin:34px auto;border:3px solid var(--rai-text4, #6b7280);border-top-color:var(--rai-accent, #000000);border-radius:50%;animation:rai-spin .7s linear infinite}@keyframes rai-spin{to{transform:rotate(360deg)}}.rai-sdk-loader{position:relative;width:75px;height:100px}.rai-sdk-loader__bar{position:absolute;bottom:0;width:10px;height:50%;background:var(--rai-accent, #000000);transform-origin:center bottom;box-shadow:1px 1px #0003}.rai-sdk-loader__bar:nth-child(1){left:0;transform:scaleY(.2);animation:rai-sdk-barUp1 4s infinite}.rai-sdk-loader__bar:nth-child(2){left:15px;transform:scaleY(.4);animation:rai-sdk-barUp2 4s infinite}.rai-sdk-loader__bar:nth-child(3){left:30px;transform:scaleY(.6);animation:rai-sdk-barUp3 4s infinite}.rai-sdk-loader__bar:nth-child(4){left:45px;transform:scaleY(.8);animation:rai-sdk-barUp4 4s infinite}.rai-sdk-loader__bar:nth-child(5){left:60px;transform:scale(1);animation:rai-sdk-barUp5 4s infinite}.rai-sdk-loader__ball{position:absolute;bottom:10px;left:0;width:10px;height:10px;background:var(--rai-accent, #000000);border-radius:50%;animation:rai-sdk-ball 4s infinite}@keyframes rai-sdk-ball{0%{transform:translate(0)}5%{transform:translate(8px,-14px)}10%{transform:translate(15px,-10px)}17%{transform:translate(23px,-24px)}20%{transform:translate(30px,-20px)}27%{transform:translate(38px,-34px)}30%{transform:translate(45px,-30px)}37%{transform:translate(53px,-44px)}40%{transform:translate(60px,-40px)}50%{transform:translate(60px)}57%{transform:translate(53px,-14px)}60%{transform:translate(45px,-10px)}67%{transform:translate(37px,-24px)}70%{transform:translate(30px,-20px)}77%{transform:translate(22px,-34px)}80%{transform:translate(15px,-30px)}87%{transform:translate(7px,-44px)}90%{transform:translateY(-40px)}to{transform:translate(0)}}@keyframes rai-sdk-barUp1{0%{transform:scaleY(.2)}40%{transform:scaleY(.2)}50%{transform:scale(1)}90%{transform:scale(1)}to{transform:scaleY(.2)}}@keyframes rai-sdk-barUp2{0%{transform:scaleY(.4)}40%{transform:scaleY(.4)}50%{transform:scaleY(.8)}90%{transform:scaleY(.8)}to{transform:scaleY(.4)}}@keyframes rai-sdk-barUp3{0%{transform:scaleY(.6)}to{transform:scaleY(.6)}}@keyframes rai-sdk-barUp4{0%{transform:scaleY(.8)}40%{transform:scaleY(.8)}50%{transform:scaleY(.4)}90%{transform:scaleY(.4)}to{transform:scaleY(.8)}}@keyframes rai-sdk-barUp5{0%{transform:scale(1)}40%{transform:scale(1)}50%{transform:scaleY(.2)}90%{transform:scaleY(.2)}to{transform:scale(1)}}#loading-square{width:75px;aspect-ratio:1;display:flex;color:var(--rai-accent, #000000);background:linear-gradient(currentColor 0 0) right / 51% 100%,linear-gradient(currentColor 0 0) bottom / 100% 51%;background-repeat:no-repeat;animation:l16-0 2s infinite linear .25s}#loading-square>div{width:50%;height:50%;background:currentColor;animation:l16-1 .5s infinite linear}@keyframes l16-0{0%,12.49%{transform:rotate(0)}12.5%,37.49%{transform:rotate(90deg)}37.5%,62.49%{transform:rotate(180deg)}62.5%,87.49%{transform:rotate(270deg)}87.5%,to{transform:rotate(360deg)}}@keyframes l16-1{0%{transform:perspective(80px) rotate3d(-1,-1,0,0)}80%,to{transform:perspective(80px) rotate3d(-1,-1,0,-180deg)}}#loading-circle{width:75px;aspect-ratio:1;display:grid;grid:50%/50%;color:var(--rai-accent, #000000);border-radius:50%;--_g: no-repeat linear-gradient(currentColor 0 0);background:var(--_g),var(--_g),var(--_g);background-size:50.1% 50.1%;animation:l9-0 1.5s infinite steps(1) alternate,l9-0-0 3s infinite steps(1) alternate}#loading-circle>div{background:var(--rai-text4, #6b7280);border-top-left-radius:100px;transform:perspective(150px) rotateY(0) rotateX(0);transform-origin:bottom right;animation:l9-1 1.5s infinite linear alternate}@keyframes l9-0{0%{background-position:0 100%,100% 100%,100% 0}33%{background-position:100% 100%,100% 100%,100% 0}66%{background-position:100% 0,100% 0,100% 0}}@keyframes l9-0-0{0%{transform:scaleX(1) rotate(0)}50%{transform:scaleX(-1) rotate(-90deg)}}@keyframes l9-1{16.5%{transform:perspective(150px) rotateX(-90deg) rotateY(0) rotateX(0);filter:grayscale(.8)}33%{transform:perspective(150px) rotateX(-180deg) rotateY(0) rotateX(0)}66%{transform:perspective(150px) rotateX(-180deg) rotateY(-180deg) rotateX(0)}to{transform:perspective(150px) rotateX(-180deg) rotateY(-180deg) rotateX(-180deg);filter:grayscale(.8)}}.rai-custom-error{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10}.tiptap strong.tw-font-bold,.tiptap b.tw-font-bold{font-weight:700}.tiptap em.tw-font-italic,.tiptap i.tw-font-italic{font-style:italic}.tiptap a.tiptap-rich-text-link{color:#3b82f6;text-decoration:underline;position:relative;display:inline-block;width:fit-content}.tiptap a.tiptap-rich-text-link:hover{color:#3b82f6cc;text-decoration:none}.tiptap a.tiptap-rich-text-link:not([title=""]):before{content:attr(title);position:absolute;top:-2rem;left:50%;transform:translate(-50%);white-space:nowrap;border-radius:.25rem;background-color:#000;padding:.25rem .5rem;color:#fff;opacity:0;transition:opacity .2s;pointer-events:none}.tiptap a.tiptap-rich-text-link:not([title=""]):hover:before{opacity:1}.tiptap p[style*="text-align: left"]{text-align:left}.tiptap p[style*="text-align: center"]{text-align:center}.tiptap p[style*="text-align: right"]{text-align:right}.tiptap p[style*="text-align: justify"]{text-align:justify}.tiptap u{text-decoration:underline}.tiptap.ProseMirror{background-color:transparent;height:fit-content!important;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:"liga" 0;padding:0;width:100%;overflow-y:auto}.tiptap{line-height:1.6;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.tiptap p{margin:.5em 0}.tiptap p:first-child{margin-top:0}.tiptap p:last-child{margin-bottom:0}.tiptap img{max-width:100%;height:auto;display:block}.tiptap p[style*="text-align: left"] img{margin-left:0;margin-right:auto}.tiptap p[style*="text-align: center"] img{margin-left:auto;margin-right:auto}.tiptap p[style*="text-align: right"] img{margin-left:auto;margin-right:0}.rai-retry-btn{padding:8px 20px;border:none;border-radius:6px;background:var(--rai-accent, #000000);color:var(--rai-error-bg, #ffffff);font-size:14px;font-family:system-ui,-apple-system,sans-serif;cursor:pointer}.rai-retry-btn:hover{opacity:.85}';
|
|
10888
12689
|
const DEFINED_ATTRS = /* @__PURE__ */ new Set([
|
|
10889
12690
|
"community-id",
|
|
@@ -11015,26 +12816,26 @@ function ensureGoogleFontLoaded(family) {
|
|
|
11015
12816
|
}
|
|
11016
12817
|
const DANGEROUS_ELEMENTS = ["script", "iframe", "object", "embed"];
|
|
11017
12818
|
const URL_ATTRS = ["src", "href", "xlink:href"];
|
|
11018
|
-
function sanitizeLoaderHtml(
|
|
11019
|
-
const doc = new DOMParser().parseFromString(
|
|
11020
|
-
doc.body.querySelectorAll(DANGEROUS_ELEMENTS.join(",")).forEach((
|
|
11021
|
-
doc.body.querySelectorAll("*").forEach((
|
|
11022
|
-
Array.from(
|
|
12819
|
+
function sanitizeLoaderHtml(html2) {
|
|
12820
|
+
const doc = new DOMParser().parseFromString(html2, "text/html");
|
|
12821
|
+
doc.body.querySelectorAll(DANGEROUS_ELEMENTS.join(",")).forEach((el2) => el2.remove());
|
|
12822
|
+
doc.body.querySelectorAll("*").forEach((el2) => {
|
|
12823
|
+
Array.from(el2.attributes).forEach((attr) => {
|
|
11023
12824
|
const name = attr.name.toLowerCase();
|
|
11024
12825
|
if (name.startsWith("on")) {
|
|
11025
|
-
|
|
12826
|
+
el2.removeAttribute(attr.name);
|
|
11026
12827
|
return;
|
|
11027
12828
|
}
|
|
11028
12829
|
if (URL_ATTRS.includes(name)) {
|
|
11029
12830
|
const val = attr.value.trim().toLowerCase();
|
|
11030
|
-
if (val.startsWith("javascript:"))
|
|
12831
|
+
if (val.startsWith("javascript:")) el2.removeAttribute(attr.name);
|
|
11031
12832
|
}
|
|
11032
12833
|
});
|
|
11033
12834
|
});
|
|
11034
12835
|
return doc.body.innerHTML;
|
|
11035
12836
|
}
|
|
11036
|
-
function readConfig(
|
|
11037
|
-
const get = (name) =>
|
|
12837
|
+
function readConfig(el2, existingId) {
|
|
12838
|
+
const get = (name) => el2.getAttribute(name) ?? el2.getAttribute(`data-${name}`) ?? "";
|
|
11038
12839
|
const num = (name, def) => {
|
|
11039
12840
|
const v = parseInt(get(name), 10);
|
|
11040
12841
|
return Number.isFinite(v) && v >= 0 ? v : def;
|
|
@@ -11048,7 +12849,7 @@ function readConfig(el, existingId) {
|
|
|
11048
12849
|
if (channelId && !/^[a-zA-Z0-9_\-=]{8,}$/.test(channelId)) {
|
|
11049
12850
|
throw new Error(`[rai-widget] Invalid channel-id: "${channelId}"`);
|
|
11050
12851
|
}
|
|
11051
|
-
const widgetType = get("widget-type") || TAG_TO_TYPE[
|
|
12852
|
+
const widgetType = get("widget-type") || TAG_TO_TYPE[el2.tagName] || "store";
|
|
11052
12853
|
let widgetId;
|
|
11053
12854
|
if (usesExplicitIds) {
|
|
11054
12855
|
if (widgetType === "store") {
|
|
@@ -11082,7 +12883,7 @@ function readConfig(el, existingId) {
|
|
|
11082
12883
|
const domainKey = normalizeDomainKey(get("domain-key")) || inferDomainKeyFromUrl(explicitApiUrl) || inferDomainKeyFromUrl(explicitV2ApiUrl) || "PROD";
|
|
11083
12884
|
const container = get("container") || get("data-container") || `returning-ai-widget-${widgetId}`;
|
|
11084
12885
|
const userIdentifiers = {};
|
|
11085
|
-
Array.from(
|
|
12886
|
+
Array.from(el2.attributes).forEach((attr) => {
|
|
11086
12887
|
const name = attr.name.toLowerCase();
|
|
11087
12888
|
if (!name.startsWith("data-")) return;
|
|
11088
12889
|
const bare = name.slice(5);
|
|
@@ -11142,9 +12943,9 @@ function readConfig(el, existingId) {
|
|
|
11142
12943
|
// matches React WidgetLoadingPage default
|
|
11143
12944
|
firstPaintColors: (() => {
|
|
11144
12945
|
const bg = get("bg") || void 0;
|
|
11145
|
-
const
|
|
12946
|
+
const text2 = get("text") || void 0;
|
|
11146
12947
|
const accent = get("accent") || void 0;
|
|
11147
|
-
return bg ||
|
|
12948
|
+
return bg || text2 || accent ? { bg, text: text2, accent } : void 0;
|
|
11148
12949
|
})(),
|
|
11149
12950
|
firstPaintFont: get("font") || void 0
|
|
11150
12951
|
};
|
|
@@ -11196,6 +12997,7 @@ class BaseWidget extends HTMLElement {
|
|
|
11196
12997
|
__publicField(this, "initGeneration", 0);
|
|
11197
12998
|
__publicField(this, "lottieInstances", []);
|
|
11198
12999
|
__publicField(this, "callbackRegistry", new WidgetCallbackRegistry());
|
|
13000
|
+
__publicField(this, "bannerNode", null);
|
|
11199
13001
|
this.shadow = this.attachShadow({ mode: "closed" });
|
|
11200
13002
|
}
|
|
11201
13003
|
static get observedAttributes() {
|
|
@@ -11229,8 +13031,8 @@ class BaseWidget extends HTMLElement {
|
|
|
11229
13031
|
if (this.hasAttribute("eager")) {
|
|
11230
13032
|
this.init();
|
|
11231
13033
|
} else {
|
|
11232
|
-
this.intersectionObserver = new IntersectionObserver((
|
|
11233
|
-
if (
|
|
13034
|
+
this.intersectionObserver = new IntersectionObserver((entries2) => {
|
|
13035
|
+
if (entries2[0].isIntersecting) {
|
|
11234
13036
|
this.intersectionObserver.disconnect();
|
|
11235
13037
|
this.intersectionObserver = void 0;
|
|
11236
13038
|
this.init();
|
|
@@ -11246,6 +13048,7 @@ class BaseWidget extends HTMLElement {
|
|
|
11246
13048
|
(_c = this.identityAttributeObserver) == null ? void 0 : _c.disconnect();
|
|
11247
13049
|
this.teardownMountedWidget();
|
|
11248
13050
|
this.clearLottieInstances();
|
|
13051
|
+
this.removeBanner();
|
|
11249
13052
|
clearState(this.state);
|
|
11250
13053
|
}
|
|
11251
13054
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
@@ -11479,18 +13282,18 @@ class BaseWidget extends HTMLElement {
|
|
|
11479
13282
|
}
|
|
11480
13283
|
createPresetLoader(preset) {
|
|
11481
13284
|
if (preset === "square") {
|
|
11482
|
-
const
|
|
11483
|
-
|
|
13285
|
+
const el2 = document.createElement("div");
|
|
13286
|
+
el2.id = "loading-square";
|
|
11484
13287
|
const inner = document.createElement("div");
|
|
11485
|
-
|
|
11486
|
-
return
|
|
13288
|
+
el2.appendChild(inner);
|
|
13289
|
+
return el2;
|
|
11487
13290
|
}
|
|
11488
13291
|
if (preset === "circle") {
|
|
11489
|
-
const
|
|
11490
|
-
|
|
13292
|
+
const el2 = document.createElement("div");
|
|
13293
|
+
el2.id = "loading-circle";
|
|
11491
13294
|
const inner = document.createElement("div");
|
|
11492
|
-
|
|
11493
|
-
return
|
|
13295
|
+
el2.appendChild(inner);
|
|
13296
|
+
return el2;
|
|
11494
13297
|
}
|
|
11495
13298
|
return this.createDefaultLoader();
|
|
11496
13299
|
}
|
|
@@ -11599,6 +13402,102 @@ class BaseWidget extends HTMLElement {
|
|
|
11599
13402
|
errorContainer.appendChild(modal);
|
|
11600
13403
|
this.shadow.appendChild(errorContainer);
|
|
11601
13404
|
}
|
|
13405
|
+
// ── Banner SDK auto-integration ────────────────────────────────────────
|
|
13406
|
+
resolveBannerApiUrl() {
|
|
13407
|
+
if (this.config.v2ApiUrl) return this.config.v2ApiUrl.replace(/\/+$/, "");
|
|
13408
|
+
switch (this.config.domainKey) {
|
|
13409
|
+
case "SGTR":
|
|
13410
|
+
return "https://api-v2.genesiv.org";
|
|
13411
|
+
case "STG":
|
|
13412
|
+
return "https://staging-api-v2.genesiv.org";
|
|
13413
|
+
case "LOCAL":
|
|
13414
|
+
return "http://localhost:1335";
|
|
13415
|
+
default:
|
|
13416
|
+
return "https://api-v2.returning.ai";
|
|
13417
|
+
}
|
|
13418
|
+
}
|
|
13419
|
+
removeBanner() {
|
|
13420
|
+
var _a;
|
|
13421
|
+
if ((_a = this.bannerNode) == null ? void 0 : _a.parentNode) this.bannerNode.parentNode.removeChild(this.bannerNode);
|
|
13422
|
+
this.bannerNode = null;
|
|
13423
|
+
}
|
|
13424
|
+
/**
|
|
13425
|
+
* After the widget mounts, fetch + render any eligible sdk-surface banner
|
|
13426
|
+
* targeted at this widget type. Core widgets send their communityId + type;
|
|
13427
|
+
* custom widgets send the decoded widget id so the server resolves the precise
|
|
13428
|
+
* sub-type + community. Best-effort: never throws into the host page.
|
|
13429
|
+
*/
|
|
13430
|
+
async mountBannerForWidget() {
|
|
13431
|
+
var _a, _b;
|
|
13432
|
+
try {
|
|
13433
|
+
if (this.bannerNode) return;
|
|
13434
|
+
if (this.getAttribute("banner") === "off" || this.hasAttribute("no-banner")) return;
|
|
13435
|
+
const apiUrl = this.resolveBannerApiUrl();
|
|
13436
|
+
const isCustom = this.config.widgetType === "custom";
|
|
13437
|
+
let communityId;
|
|
13438
|
+
let widgetId;
|
|
13439
|
+
if (isCustom) {
|
|
13440
|
+
const isObjectId = (v) => /^[a-f0-9]{24}$/i.test(v);
|
|
13441
|
+
let decoded = "";
|
|
13442
|
+
try {
|
|
13443
|
+
decoded = atob(this.config.communityId);
|
|
13444
|
+
} catch {
|
|
13445
|
+
decoded = "";
|
|
13446
|
+
}
|
|
13447
|
+
if (isObjectId(decoded)) widgetId = decoded;
|
|
13448
|
+
else if (isObjectId(this.config.communityId)) widgetId = this.config.communityId;
|
|
13449
|
+
if (!widgetId) return;
|
|
13450
|
+
} else {
|
|
13451
|
+
communityId = this.config.communityId;
|
|
13452
|
+
}
|
|
13453
|
+
const sessionKey = this.config.communityId || widgetId || "rai";
|
|
13454
|
+
const visitorId = getOrCreateVisitorId(sessionKey, this.config.storagePrefix);
|
|
13455
|
+
const w = window.innerWidth;
|
|
13456
|
+
const device = w < 640 ? "mobile" : w < 1024 ? "tablet" : "desktop";
|
|
13457
|
+
const result = await fetchEligibleBanner(apiUrl, {
|
|
13458
|
+
communityId,
|
|
13459
|
+
surface: "sdk",
|
|
13460
|
+
widgetType: this.config.widgetType,
|
|
13461
|
+
widgetId,
|
|
13462
|
+
// Pass the embed token the widget authed with, so `access: 'domain' |
|
|
13463
|
+
// 'authenticated'` banners can be served/gated via its access key origins.
|
|
13464
|
+
embedToken: this.config.embedToken,
|
|
13465
|
+
page: {
|
|
13466
|
+
url: window.location.href,
|
|
13467
|
+
hostname: window.location.hostname,
|
|
13468
|
+
path: window.location.pathname
|
|
13469
|
+
},
|
|
13470
|
+
viewport: { width: window.innerWidth, height: window.innerHeight, device },
|
|
13471
|
+
identifier: { type: "anonymous_session", value: visitorId }
|
|
13472
|
+
});
|
|
13473
|
+
if (!this.isConnected) return;
|
|
13474
|
+
const banner = result.banner;
|
|
13475
|
+
if (!banner) return;
|
|
13476
|
+
if (((_a = banner.placement) == null ? void 0 : _a.mobileBehavior) === "hide" && device === "mobile") return;
|
|
13477
|
+
const node = renderBanner(banner, {
|
|
13478
|
+
onCtaClick: () => {
|
|
13479
|
+
var _a2, _b2, _c;
|
|
13480
|
+
fireTracking((_a2 = banner.tracking) == null ? void 0 : _a2.clickUrl);
|
|
13481
|
+
this.emit("rai-banner-click", { bannerId: banner.id });
|
|
13482
|
+
const url = (_b2 = banner.cta) == null ? void 0 : _b2.url;
|
|
13483
|
+
if (!url) return;
|
|
13484
|
+
if ((_c = banner.cta) == null ? void 0 : _c.openInNewTab) window.open(url, "_blank", "noopener,noreferrer");
|
|
13485
|
+
else window.location.href = url;
|
|
13486
|
+
},
|
|
13487
|
+
onDismiss: () => {
|
|
13488
|
+
var _a2;
|
|
13489
|
+
fireTracking((_a2 = banner.tracking) == null ? void 0 : _a2.dismissUrl);
|
|
13490
|
+
this.emit("rai-banner-dismiss", { bannerId: banner.id });
|
|
13491
|
+
this.removeBanner();
|
|
13492
|
+
}
|
|
13493
|
+
});
|
|
13494
|
+
this.bannerNode = node;
|
|
13495
|
+
document.body.appendChild(node);
|
|
13496
|
+
fireTracking((_b = banner.tracking) == null ? void 0 : _b.impressionUrl);
|
|
13497
|
+
this.emit("rai-banner-impression", { bannerId: banner.id });
|
|
13498
|
+
} catch {
|
|
13499
|
+
}
|
|
13500
|
+
}
|
|
11602
13501
|
// ── Initialization ─────────────────────────────────────────────────────
|
|
11603
13502
|
async init() {
|
|
11604
13503
|
const initId = ++this.initGeneration;
|
|
@@ -11613,7 +13512,20 @@ class BaseWidget extends HTMLElement {
|
|
|
11613
13512
|
var _a;
|
|
11614
13513
|
if (!this.isCurrentInit(initId)) return;
|
|
11615
13514
|
(_a = this.errorEl) == null ? void 0 : _a.classList.remove("visible");
|
|
11616
|
-
this.shadow.querySelectorAll(".rai-custom-error").forEach((
|
|
13515
|
+
this.shadow.querySelectorAll(".rai-custom-error").forEach((el2) => el2.remove());
|
|
13516
|
+
let bannerGated = false;
|
|
13517
|
+
let bannerGateTimer = 0;
|
|
13518
|
+
const mountBannerOnce = () => {
|
|
13519
|
+
if (bannerGated) return;
|
|
13520
|
+
bannerGated = true;
|
|
13521
|
+
window.clearTimeout(bannerGateTimer);
|
|
13522
|
+
this.removeEventListener("rai-mounted", mountBannerOnce);
|
|
13523
|
+
this.removeEventListener("rai-ready", mountBannerOnce);
|
|
13524
|
+
void this.mountBannerForWidget();
|
|
13525
|
+
};
|
|
13526
|
+
this.addEventListener("rai-mounted", mountBannerOnce);
|
|
13527
|
+
this.addEventListener("rai-ready", mountBannerOnce);
|
|
13528
|
+
bannerGateTimer = window.setTimeout(mountBannerOnce, 2500);
|
|
11617
13529
|
if (this.config.bundleUrl) {
|
|
11618
13530
|
this.mountWidget();
|
|
11619
13531
|
} else {
|
|
@@ -11695,9 +13607,9 @@ class BaseWidget extends HTMLElement {
|
|
|
11695
13607
|
this.state.syncTimer = null;
|
|
11696
13608
|
}
|
|
11697
13609
|
this.state.iframe = null;
|
|
11698
|
-
this.shadow.querySelectorAll("iframe").forEach((
|
|
13610
|
+
this.shadow.querySelectorAll("iframe").forEach((el2) => el2.remove());
|
|
11699
13611
|
this.querySelectorAll('[data-rai-widget-root="true"]').forEach(
|
|
11700
|
-
(
|
|
13612
|
+
(el2) => el2.remove()
|
|
11701
13613
|
);
|
|
11702
13614
|
}
|
|
11703
13615
|
createIframe() {
|
|
@@ -11739,6 +13651,7 @@ class BaseWidget extends HTMLElement {
|
|
|
11739
13651
|
}
|
|
11740
13652
|
// ── Bundle mode (no-iframe) ──────────────────────────────────────────
|
|
11741
13653
|
async mountWidget() {
|
|
13654
|
+
var _a;
|
|
11742
13655
|
try {
|
|
11743
13656
|
this.teardownMountedWidget();
|
|
11744
13657
|
const bundleApiUrl = this.config.v2ApiUrl || resolveV2ApiUrl(this.config.domainKey);
|
|
@@ -11760,8 +13673,10 @@ class BaseWidget extends HTMLElement {
|
|
|
11760
13673
|
if (this.state.loadingAnimation) {
|
|
11761
13674
|
window.loadingAnimation = this.state.loadingAnimation;
|
|
11762
13675
|
}
|
|
11763
|
-
await loadScript(this.config.bundleUrl);
|
|
11764
13676
|
const globalName = WIDGET_GLOBALS[this.config.widgetType];
|
|
13677
|
+
if (!((_a = window[globalName]) == null ? void 0 : _a.mount)) {
|
|
13678
|
+
await loadScript(this.config.bundleUrl);
|
|
13679
|
+
}
|
|
11765
13680
|
const widgetGlobal = window[globalName];
|
|
11766
13681
|
if (!(widgetGlobal == null ? void 0 : widgetGlobal.mount)) {
|
|
11767
13682
|
throw new Error(
|
|
@@ -11866,6 +13781,7 @@ class BaseWidget extends HTMLElement {
|
|
|
11866
13781
|
async logoutAndClear() {
|
|
11867
13782
|
await logout(this.config, this.state);
|
|
11868
13783
|
this.teardownMountedWidget();
|
|
13784
|
+
this.removeBanner();
|
|
11869
13785
|
this.emit("rai-logout");
|
|
11870
13786
|
}
|
|
11871
13787
|
// ── Public API ────────────────────────────────────────────────────────
|
|
@@ -11879,6 +13795,7 @@ class BaseWidget extends HTMLElement {
|
|
|
11879
13795
|
clearStorage(previousConfig);
|
|
11880
13796
|
clearStorage(this.config);
|
|
11881
13797
|
this.teardownMountedWidget();
|
|
13798
|
+
this.removeBanner();
|
|
11882
13799
|
clearState(this.state);
|
|
11883
13800
|
await this.init();
|
|
11884
13801
|
}
|
|
@@ -12000,7 +13917,7 @@ class CustomWidget extends BaseWidget {
|
|
|
12000
13917
|
}
|
|
12001
13918
|
}
|
|
12002
13919
|
}
|
|
12003
|
-
console.log(`[rai-widget] v${"1.
|
|
13920
|
+
console.log(`[rai-widget] v${"1.6.1"}`);
|
|
12004
13921
|
class StoreWidgetCompat extends StoreWidget {
|
|
12005
13922
|
}
|
|
12006
13923
|
const WIDGET_REGISTRY = [
|
|
@@ -12064,7 +13981,7 @@ function exposePublicApi() {
|
|
|
12064
13981
|
})();
|
|
12065
13982
|
const widget = container == null ? void 0 : container.querySelector(ALL_WIDGET_SELECTOR);
|
|
12066
13983
|
window.ReturningAIWidget = {
|
|
12067
|
-
version: "1.
|
|
13984
|
+
version: "1.6.1",
|
|
12068
13985
|
reload: () => (widget == null ? void 0 : widget.reload()) ?? Promise.resolve(),
|
|
12069
13986
|
logout: () => (widget == null ? void 0 : widget.logoutPublic()) ?? Promise.resolve(),
|
|
12070
13987
|
isAuthenticated: () => (widget == null ? void 0 : widget.isAuthenticated()) ?? false,
|