wrec 0.19.0 → 0.19.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/dist/wrec.es.js +380 -369
- package/dist/wrec.js +24 -14
- package/dist/wrec.js.map +1 -1
- package/dist/wrec.min.js +1 -1
- package/dist/wrec.umd.js +5 -5
- package/package.json +1 -1
package/dist/wrec.es.js
CHANGED
|
@@ -8,10 +8,10 @@ const {
|
|
|
8
8
|
let {
|
|
9
9
|
freeze: L,
|
|
10
10
|
seal: I,
|
|
11
|
-
create:
|
|
11
|
+
create: qt
|
|
12
12
|
} = Object, {
|
|
13
|
-
apply:
|
|
14
|
-
construct:
|
|
13
|
+
apply: Kt,
|
|
14
|
+
construct: Zt
|
|
15
15
|
} = typeof Reflect < "u" && Reflect;
|
|
16
16
|
L || (L = function(t) {
|
|
17
17
|
return t;
|
|
@@ -19,41 +19,41 @@ L || (L = function(t) {
|
|
|
19
19
|
I || (I = function(t) {
|
|
20
20
|
return t;
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
for (var
|
|
22
|
+
Kt || (Kt = function(t, e) {
|
|
23
|
+
for (var n = arguments.length, i = new Array(n > 2 ? n - 2 : 0), r = 2; r < n; r++)
|
|
24
24
|
i[r - 2] = arguments[r];
|
|
25
25
|
return t.apply(e, i);
|
|
26
26
|
});
|
|
27
|
-
|
|
28
|
-
for (var e = arguments.length,
|
|
29
|
-
|
|
30
|
-
return new t(...
|
|
27
|
+
Zt || (Zt = function(t) {
|
|
28
|
+
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++)
|
|
29
|
+
n[i - 1] = arguments[i];
|
|
30
|
+
return new t(...n);
|
|
31
31
|
});
|
|
32
|
-
const Et = M(Array.prototype.forEach), hn = M(Array.prototype.lastIndexOf), Ce = M(Array.prototype.pop), nt = M(Array.prototype.push), dn = M(Array.prototype.splice), _t = M(String.prototype.toLowerCase),
|
|
32
|
+
const Et = M(Array.prototype.forEach), hn = M(Array.prototype.lastIndexOf), Ce = M(Array.prototype.pop), nt = M(Array.prototype.push), dn = M(Array.prototype.splice), _t = M(String.prototype.toLowerCase), Ht = M(String.prototype.toString), zt = M(String.prototype.match), ot = M(String.prototype.replace), Tn = M(String.prototype.indexOf), En = M(String.prototype.trim), P = M(Object.prototype.hasOwnProperty), O = M(RegExp.prototype.test), it = gn(TypeError);
|
|
33
33
|
function M(s) {
|
|
34
34
|
return function(t) {
|
|
35
35
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
36
|
-
for (var e = arguments.length,
|
|
37
|
-
|
|
38
|
-
return
|
|
36
|
+
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++)
|
|
37
|
+
n[i - 1] = arguments[i];
|
|
38
|
+
return Kt(s, t, n);
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function gn(s) {
|
|
42
42
|
return function() {
|
|
43
|
-
for (var t = arguments.length, e = new Array(t),
|
|
44
|
-
e[
|
|
45
|
-
return
|
|
43
|
+
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
44
|
+
e[n] = arguments[n];
|
|
45
|
+
return Zt(s, e);
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
function m(s, t) {
|
|
49
49
|
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _t;
|
|
50
50
|
Re && Re(s, null);
|
|
51
|
-
let
|
|
52
|
-
for (;
|
|
53
|
-
let i = t[
|
|
51
|
+
let n = t.length;
|
|
52
|
+
for (; n--; ) {
|
|
53
|
+
let i = t[n];
|
|
54
54
|
if (typeof i == "string") {
|
|
55
55
|
const r = e(i);
|
|
56
|
-
r !== i && (un(t) || (t[
|
|
56
|
+
r !== i && (un(t) || (t[n] = r), i = r);
|
|
57
57
|
}
|
|
58
58
|
s[i] = !0;
|
|
59
59
|
}
|
|
@@ -65,19 +65,19 @@ function An(s) {
|
|
|
65
65
|
return s;
|
|
66
66
|
}
|
|
67
67
|
function k(s) {
|
|
68
|
-
const t =
|
|
69
|
-
for (const [e,
|
|
70
|
-
P(s, e) && (Array.isArray(
|
|
68
|
+
const t = qt(null);
|
|
69
|
+
for (const [e, n] of Pe(s))
|
|
70
|
+
P(s, e) && (Array.isArray(n) ? t[e] = An(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = k(n) : t[e] = n);
|
|
71
71
|
return t;
|
|
72
72
|
}
|
|
73
73
|
function st(s, t) {
|
|
74
74
|
for (; s !== null; ) {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
if (
|
|
78
|
-
return M(
|
|
79
|
-
if (typeof
|
|
80
|
-
return M(
|
|
75
|
+
const n = mn(s, t);
|
|
76
|
+
if (n) {
|
|
77
|
+
if (n.get)
|
|
78
|
+
return M(n.get);
|
|
79
|
+
if (typeof n.value == "function")
|
|
80
|
+
return M(n.value);
|
|
81
81
|
}
|
|
82
82
|
s = pn(s);
|
|
83
83
|
}
|
|
@@ -86,7 +86,7 @@ function st(s, t) {
|
|
|
86
86
|
}
|
|
87
87
|
return e;
|
|
88
88
|
}
|
|
89
|
-
const Ne = L(["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"]),
|
|
89
|
+
const Ne = L(["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"]), Gt = L(["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"]), $t = L(["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"]), _n = L(["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"]), Bt = L(["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"]), bn = L(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Oe = L(["#text"]), Le = L(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Wt = L(["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"]), Me = L(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), gt = L(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Sn = I(/\{\{[\w\W]*|[\w\W]*\}\}/gm), yn = I(/<%[\w\W]*|[\w\W]*%>/gm), Rn = I(/\$\{[\w\W]*/gm), Cn = I(/^data-[\-\w.\u00B7-\uFFFF]+$/), Nn = I(/^aria-[\-\w]+$/), ve = I(
|
|
90
90
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
91
91
|
// eslint-disable-line no-useless-escape
|
|
92
92
|
), On = I(/^(?:\w+script|data):/i), Ln = I(
|
|
@@ -118,17 +118,17 @@ const rt = {
|
|
|
118
118
|
}, Dn = function(t, e) {
|
|
119
119
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
120
120
|
return null;
|
|
121
|
-
let
|
|
121
|
+
let n = null;
|
|
122
122
|
const i = "data-tt-policy-suffix";
|
|
123
|
-
e && e.hasAttribute(i) && (
|
|
124
|
-
const r = "dompurify" + (
|
|
123
|
+
e && e.hasAttribute(i) && (n = e.getAttribute(i));
|
|
124
|
+
const r = "dompurify" + (n ? "#" + n : "");
|
|
125
125
|
try {
|
|
126
126
|
return t.createPolicy(r, {
|
|
127
|
-
createHTML(
|
|
128
|
-
return
|
|
127
|
+
createHTML(c) {
|
|
128
|
+
return c;
|
|
129
129
|
},
|
|
130
|
-
createScriptURL(
|
|
131
|
-
return
|
|
130
|
+
createScriptURL(c) {
|
|
131
|
+
return c;
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
} catch {
|
|
@@ -155,9 +155,9 @@ function ke() {
|
|
|
155
155
|
let {
|
|
156
156
|
document: e
|
|
157
157
|
} = s;
|
|
158
|
-
const
|
|
158
|
+
const n = e, i = n.currentScript, {
|
|
159
159
|
DocumentFragment: r,
|
|
160
|
-
HTMLTemplateElement:
|
|
160
|
+
HTMLTemplateElement: c,
|
|
161
161
|
Node: h,
|
|
162
162
|
Element: u,
|
|
163
163
|
NodeFilter: p,
|
|
@@ -165,26 +165,26 @@ function ke() {
|
|
|
165
165
|
HTMLFormElement: b,
|
|
166
166
|
DOMParser: G,
|
|
167
167
|
trustedTypes: F
|
|
168
|
-
} = s, $ = u.prototype, We = st($, "cloneNode"), je = st($, "remove"), Ye = st($, "nextSibling"), Ve = st($, "childNodes"),
|
|
169
|
-
if (typeof
|
|
168
|
+
} = s, $ = u.prototype, We = st($, "cloneNode"), je = st($, "remove"), Ye = st($, "nextSibling"), Ve = st($, "childNodes"), lt = st($, "parentNode");
|
|
169
|
+
if (typeof c == "function") {
|
|
170
170
|
const f = e.createElement("template");
|
|
171
171
|
f.content && f.content.ownerDocument && (e = f.content.ownerDocument);
|
|
172
172
|
}
|
|
173
173
|
let C, J = "";
|
|
174
174
|
const {
|
|
175
|
-
implementation:
|
|
175
|
+
implementation: yt,
|
|
176
176
|
createNodeIterator: Xe,
|
|
177
177
|
createDocumentFragment: qe,
|
|
178
178
|
getElementsByTagName: Ke
|
|
179
179
|
} = e, {
|
|
180
180
|
importNode: Ze
|
|
181
|
-
} =
|
|
181
|
+
} = n;
|
|
182
182
|
let N = De();
|
|
183
|
-
t.isSupported = typeof Pe == "function" && typeof
|
|
183
|
+
t.isSupported = typeof Pe == "function" && typeof lt == "function" && yt && yt.createHTMLDocument !== void 0;
|
|
184
184
|
const {
|
|
185
|
-
MUSTACHE_EXPR:
|
|
186
|
-
ERB_EXPR:
|
|
187
|
-
TMPLIT_EXPR:
|
|
185
|
+
MUSTACHE_EXPR: Rt,
|
|
186
|
+
ERB_EXPR: Ct,
|
|
187
|
+
TMPLIT_EXPR: Nt,
|
|
188
188
|
DATA_ATTR: Je,
|
|
189
189
|
ARIA_ATTR: Qe,
|
|
190
190
|
IS_SCRIPT_OR_DATA: tn,
|
|
@@ -194,10 +194,10 @@ function ke() {
|
|
|
194
194
|
let {
|
|
195
195
|
IS_ALLOWED_URI: ee
|
|
196
196
|
} = we, _ = null;
|
|
197
|
-
const ne = m({}, [...Ne, ...
|
|
197
|
+
const ne = m({}, [...Ne, ...Gt, ...$t, ...Bt, ...Oe]);
|
|
198
198
|
let S = null;
|
|
199
|
-
const oe = m({}, [...Le, ...
|
|
200
|
-
let E = Object.seal(
|
|
199
|
+
const oe = m({}, [...Le, ...Wt, ...Me, ...gt]);
|
|
200
|
+
let E = Object.seal(qt(null, {
|
|
201
201
|
tagNameCheck: {
|
|
202
202
|
writable: !0,
|
|
203
203
|
configurable: !1,
|
|
@@ -216,8 +216,8 @@ function ke() {
|
|
|
216
216
|
enumerable: !0,
|
|
217
217
|
value: !1
|
|
218
218
|
}
|
|
219
|
-
})), Q = null,
|
|
220
|
-
const j = Object.seal(
|
|
219
|
+
})), Q = null, Ot = null;
|
|
220
|
+
const j = Object.seal(qt(null, {
|
|
221
221
|
tagCheck: {
|
|
222
222
|
writable: !0,
|
|
223
223
|
configurable: !1,
|
|
@@ -231,58 +231,58 @@ function ke() {
|
|
|
231
231
|
value: null
|
|
232
232
|
}
|
|
233
233
|
}));
|
|
234
|
-
let ie = !0,
|
|
234
|
+
let ie = !0, Lt = !0, se = !1, re = !0, Y = !1, ft = !0, B = !1, Mt = !1, wt = !1, V = !1, ut = !1, pt = !1, ae = !0, ce = !1;
|
|
235
235
|
const nn = "user-content-";
|
|
236
|
-
let
|
|
237
|
-
const
|
|
238
|
-
let
|
|
236
|
+
let Dt = !0, tt = !1, X = {}, v = null;
|
|
237
|
+
const It = m({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
238
|
+
let le = null;
|
|
239
239
|
const fe = m({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
240
|
-
let
|
|
240
|
+
let Pt = null;
|
|
241
241
|
const ue = m({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), mt = "http://www.w3.org/1998/Math/MathML", ht = "http://www.w3.org/2000/svg", U = "http://www.w3.org/1999/xhtml";
|
|
242
|
-
let q = U,
|
|
243
|
-
const on = m({}, [mt, ht, U],
|
|
242
|
+
let q = U, vt = !1, xt = null;
|
|
243
|
+
const on = m({}, [mt, ht, U], Ht);
|
|
244
244
|
let dt = m({}, ["mi", "mo", "mn", "ms", "mtext"]), Tt = m({}, ["annotation-xml"]);
|
|
245
245
|
const sn = m({}, ["title", "style", "font", "a", "script"]);
|
|
246
246
|
let et = null;
|
|
247
247
|
const rn = ["application/xhtml+xml", "text/html"], an = "text/html";
|
|
248
248
|
let A = null, K = null;
|
|
249
|
-
const
|
|
250
|
-
return
|
|
251
|
-
},
|
|
252
|
-
let
|
|
253
|
-
if (!(K && K ===
|
|
254
|
-
if ((!
|
|
255
|
-
rn.indexOf(
|
|
256
|
-
if (typeof
|
|
249
|
+
const cn = e.createElement("form"), pe = function(o) {
|
|
250
|
+
return o instanceof RegExp || o instanceof Function;
|
|
251
|
+
}, kt = function() {
|
|
252
|
+
let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
253
|
+
if (!(K && K === o)) {
|
|
254
|
+
if ((!o || typeof o != "object") && (o = {}), o = k(o), et = // eslint-disable-next-line unicorn/prefer-includes
|
|
255
|
+
rn.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? an : o.PARSER_MEDIA_TYPE, A = et === "application/xhtml+xml" ? Ht : _t, _ = P(o, "ALLOWED_TAGS") ? m({}, o.ALLOWED_TAGS, A) : ne, S = P(o, "ALLOWED_ATTR") ? m({}, o.ALLOWED_ATTR, A) : oe, xt = P(o, "ALLOWED_NAMESPACES") ? m({}, o.ALLOWED_NAMESPACES, Ht) : on, Pt = P(o, "ADD_URI_SAFE_ATTR") ? m(k(ue), o.ADD_URI_SAFE_ATTR, A) : ue, le = P(o, "ADD_DATA_URI_TAGS") ? m(k(fe), o.ADD_DATA_URI_TAGS, A) : fe, v = P(o, "FORBID_CONTENTS") ? m({}, o.FORBID_CONTENTS, A) : It, Q = P(o, "FORBID_TAGS") ? m({}, o.FORBID_TAGS, A) : k({}), Ot = P(o, "FORBID_ATTR") ? m({}, o.FORBID_ATTR, A) : k({}), X = P(o, "USE_PROFILES") ? o.USE_PROFILES : !1, ie = o.ALLOW_ARIA_ATTR !== !1, Lt = o.ALLOW_DATA_ATTR !== !1, se = o.ALLOW_UNKNOWN_PROTOCOLS || !1, re = o.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Y = o.SAFE_FOR_TEMPLATES || !1, ft = o.SAFE_FOR_XML !== !1, B = o.WHOLE_DOCUMENT || !1, V = o.RETURN_DOM || !1, ut = o.RETURN_DOM_FRAGMENT || !1, pt = o.RETURN_TRUSTED_TYPE || !1, wt = o.FORCE_BODY || !1, ae = o.SANITIZE_DOM !== !1, ce = o.SANITIZE_NAMED_PROPS || !1, Dt = o.KEEP_CONTENT !== !1, tt = o.IN_PLACE || !1, ee = o.ALLOWED_URI_REGEXP || ve, q = o.NAMESPACE || U, dt = o.MATHML_TEXT_INTEGRATION_POINTS || dt, Tt = o.HTML_INTEGRATION_POINTS || Tt, E = o.CUSTOM_ELEMENT_HANDLING || {}, o.CUSTOM_ELEMENT_HANDLING && pe(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (E.tagNameCheck = o.CUSTOM_ELEMENT_HANDLING.tagNameCheck), o.CUSTOM_ELEMENT_HANDLING && pe(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (E.attributeNameCheck = o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), o.CUSTOM_ELEMENT_HANDLING && typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (E.allowCustomizedBuiltInElements = o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Y && (Lt = !1), ut && (V = !0), X && (_ = m({}, Oe), S = [], X.html === !0 && (m(_, Ne), m(S, Le)), X.svg === !0 && (m(_, Gt), m(S, Wt), m(S, gt)), X.svgFilters === !0 && (m(_, $t), m(S, Wt), m(S, gt)), X.mathMl === !0 && (m(_, Bt), m(S, Me), m(S, gt))), o.ADD_TAGS && (typeof o.ADD_TAGS == "function" ? j.tagCheck = o.ADD_TAGS : (_ === ne && (_ = k(_)), m(_, o.ADD_TAGS, A))), o.ADD_ATTR && (typeof o.ADD_ATTR == "function" ? j.attributeCheck = o.ADD_ATTR : (S === oe && (S = k(S)), m(S, o.ADD_ATTR, A))), o.ADD_URI_SAFE_ATTR && m(Pt, o.ADD_URI_SAFE_ATTR, A), o.FORBID_CONTENTS && (v === It && (v = k(v)), m(v, o.FORBID_CONTENTS, A)), o.ADD_FORBID_CONTENTS && (v === It && (v = k(v)), m(v, o.ADD_FORBID_CONTENTS, A)), Dt && (_["#text"] = !0), B && m(_, ["html", "head", "body"]), _.table && (m(_, ["tbody"]), delete Q.tbody), o.TRUSTED_TYPES_POLICY) {
|
|
256
|
+
if (typeof o.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
257
257
|
throw it('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
258
|
-
if (typeof
|
|
258
|
+
if (typeof o.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
259
259
|
throw it('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
260
|
-
C =
|
|
260
|
+
C = o.TRUSTED_TYPES_POLICY, J = C.createHTML("");
|
|
261
261
|
} else
|
|
262
262
|
C === void 0 && (C = Dn(F, i)), C !== null && typeof J == "string" && (J = C.createHTML(""));
|
|
263
|
-
L && L(
|
|
263
|
+
L && L(o), K = o;
|
|
264
264
|
}
|
|
265
|
-
}, me = m({}, [...
|
|
266
|
-
let a =
|
|
265
|
+
}, me = m({}, [...Gt, ...$t, ..._n]), he = m({}, [...Bt, ...bn]), ln = function(o) {
|
|
266
|
+
let a = lt(o);
|
|
267
267
|
(!a || !a.tagName) && (a = {
|
|
268
268
|
namespaceURI: q,
|
|
269
269
|
tagName: "template"
|
|
270
270
|
});
|
|
271
|
-
const
|
|
272
|
-
return
|
|
273
|
-
}, x = function(
|
|
271
|
+
const l = _t(o.tagName), T = _t(a.tagName);
|
|
272
|
+
return xt[o.namespaceURI] ? o.namespaceURI === ht ? a.namespaceURI === U ? l === "svg" : a.namespaceURI === mt ? l === "svg" && (T === "annotation-xml" || dt[T]) : !!me[l] : o.namespaceURI === mt ? a.namespaceURI === U ? l === "math" : a.namespaceURI === ht ? l === "math" && Tt[T] : !!he[l] : o.namespaceURI === U ? a.namespaceURI === ht && !Tt[T] || a.namespaceURI === mt && !dt[T] ? !1 : !he[l] && (sn[l] || !me[l]) : !!(et === "application/xhtml+xml" && xt[o.namespaceURI]) : !1;
|
|
273
|
+
}, x = function(o) {
|
|
274
274
|
nt(t.removed, {
|
|
275
|
-
element:
|
|
275
|
+
element: o
|
|
276
276
|
});
|
|
277
277
|
try {
|
|
278
|
-
|
|
278
|
+
lt(o).removeChild(o);
|
|
279
279
|
} catch {
|
|
280
|
-
je(
|
|
280
|
+
je(o);
|
|
281
281
|
}
|
|
282
|
-
}, W = function(
|
|
282
|
+
}, W = function(o, a) {
|
|
283
283
|
try {
|
|
284
284
|
nt(t.removed, {
|
|
285
|
-
attribute: a.getAttributeNode(
|
|
285
|
+
attribute: a.getAttributeNode(o),
|
|
286
286
|
from: a
|
|
287
287
|
});
|
|
288
288
|
} catch {
|
|
@@ -291,7 +291,7 @@ function ke() {
|
|
|
291
291
|
from: a
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
|
-
if (a.removeAttribute(
|
|
294
|
+
if (a.removeAttribute(o), o === "is")
|
|
295
295
|
if (V || ut)
|
|
296
296
|
try {
|
|
297
297
|
x(a);
|
|
@@ -299,101 +299,101 @@ function ke() {
|
|
|
299
299
|
}
|
|
300
300
|
else
|
|
301
301
|
try {
|
|
302
|
-
a.setAttribute(
|
|
302
|
+
a.setAttribute(o, "");
|
|
303
303
|
} catch {
|
|
304
304
|
}
|
|
305
|
-
}, de = function(
|
|
306
|
-
let a = null,
|
|
307
|
-
if (
|
|
308
|
-
|
|
305
|
+
}, de = function(o) {
|
|
306
|
+
let a = null, l = null;
|
|
307
|
+
if (wt)
|
|
308
|
+
o = "<remove></remove>" + o;
|
|
309
309
|
else {
|
|
310
|
-
const g =
|
|
311
|
-
|
|
310
|
+
const g = zt(o, /^[\r\n\t ]+/);
|
|
311
|
+
l = g && g[0];
|
|
312
312
|
}
|
|
313
|
-
et === "application/xhtml+xml" && q === U && (
|
|
314
|
-
const T = C ? C.createHTML(
|
|
313
|
+
et === "application/xhtml+xml" && q === U && (o = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + o + "</body></html>");
|
|
314
|
+
const T = C ? C.createHTML(o) : o;
|
|
315
315
|
if (q === U)
|
|
316
316
|
try {
|
|
317
317
|
a = new G().parseFromString(T, et);
|
|
318
318
|
} catch {
|
|
319
319
|
}
|
|
320
320
|
if (!a || !a.documentElement) {
|
|
321
|
-
a =
|
|
321
|
+
a = yt.createDocument(q, "template", null);
|
|
322
322
|
try {
|
|
323
|
-
a.documentElement.innerHTML =
|
|
323
|
+
a.documentElement.innerHTML = vt ? J : T;
|
|
324
324
|
} catch {
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
const R = a.body || a.documentElement;
|
|
328
|
-
return
|
|
329
|
-
}, Te = function(
|
|
328
|
+
return o && l && R.insertBefore(e.createTextNode(l), R.childNodes[0] || null), q === U ? Ke.call(a, B ? "html" : "body")[0] : B ? a.documentElement : R;
|
|
329
|
+
}, Te = function(o) {
|
|
330
330
|
return Xe.call(
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
o.ownerDocument || o,
|
|
332
|
+
o,
|
|
333
333
|
// eslint-disable-next-line no-bitwise
|
|
334
334
|
p.SHOW_ELEMENT | p.SHOW_COMMENT | p.SHOW_TEXT | p.SHOW_PROCESSING_INSTRUCTION | p.SHOW_CDATA_SECTION,
|
|
335
335
|
null
|
|
336
336
|
);
|
|
337
|
-
},
|
|
338
|
-
return
|
|
339
|
-
}, Ee = function(
|
|
340
|
-
return typeof h == "function" &&
|
|
337
|
+
}, Ft = function(o) {
|
|
338
|
+
return o instanceof b && (typeof o.nodeName != "string" || typeof o.textContent != "string" || typeof o.removeChild != "function" || !(o.attributes instanceof d) || typeof o.removeAttribute != "function" || typeof o.setAttribute != "function" || typeof o.namespaceURI != "string" || typeof o.insertBefore != "function" || typeof o.hasChildNodes != "function");
|
|
339
|
+
}, Ee = function(o) {
|
|
340
|
+
return typeof h == "function" && o instanceof h;
|
|
341
341
|
};
|
|
342
|
-
function H(f,
|
|
343
|
-
Et(f, (
|
|
344
|
-
|
|
342
|
+
function H(f, o, a) {
|
|
343
|
+
Et(f, (l) => {
|
|
344
|
+
l.call(t, o, a, K);
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
-
const ge = function(
|
|
347
|
+
const ge = function(o) {
|
|
348
348
|
let a = null;
|
|
349
|
-
if (H(N.beforeSanitizeElements,
|
|
350
|
-
return x(
|
|
351
|
-
const
|
|
352
|
-
if (H(N.uponSanitizeElement,
|
|
353
|
-
tagName:
|
|
349
|
+
if (H(N.beforeSanitizeElements, o, null), Ft(o))
|
|
350
|
+
return x(o), !0;
|
|
351
|
+
const l = A(o.nodeName);
|
|
352
|
+
if (H(N.uponSanitizeElement, o, {
|
|
353
|
+
tagName: l,
|
|
354
354
|
allowedTags: _
|
|
355
|
-
}), ft &&
|
|
356
|
-
return x(
|
|
357
|
-
if (!(j.tagCheck instanceof Function && j.tagCheck(
|
|
358
|
-
if (!Q[
|
|
355
|
+
}), ft && o.hasChildNodes() && !Ee(o.firstElementChild) && O(/<[/\w!]/g, o.innerHTML) && O(/<[/\w!]/g, o.textContent) || o.nodeType === rt.progressingInstruction || ft && o.nodeType === rt.comment && O(/<[/\w]/g, o.data))
|
|
356
|
+
return x(o), !0;
|
|
357
|
+
if (!(j.tagCheck instanceof Function && j.tagCheck(l)) && (!_[l] || Q[l])) {
|
|
358
|
+
if (!Q[l] && _e(l) && (E.tagNameCheck instanceof RegExp && O(E.tagNameCheck, l) || E.tagNameCheck instanceof Function && E.tagNameCheck(l)))
|
|
359
359
|
return !1;
|
|
360
|
-
if (
|
|
361
|
-
const T =
|
|
360
|
+
if (Dt && !v[l]) {
|
|
361
|
+
const T = lt(o) || o.parentNode, R = Ve(o) || o.childNodes;
|
|
362
362
|
if (R && T) {
|
|
363
363
|
const g = R.length;
|
|
364
364
|
for (let w = g - 1; w >= 0; --w) {
|
|
365
365
|
const z = We(R[w], !0);
|
|
366
|
-
z.__removalCount = (
|
|
366
|
+
z.__removalCount = (o.__removalCount || 0) + 1, T.insertBefore(z, Ye(o));
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
return x(
|
|
370
|
+
return x(o), !0;
|
|
371
371
|
}
|
|
372
|
-
return
|
|
372
|
+
return o instanceof u && !ln(o) || (l === "noscript" || l === "noembed" || l === "noframes") && O(/<\/no(script|embed|frames)/i, o.innerHTML) ? (x(o), !0) : (Y && o.nodeType === rt.text && (a = o.textContent, Et([Rt, Ct, Nt], (T) => {
|
|
373
373
|
a = ot(a, T, " ");
|
|
374
|
-
}),
|
|
375
|
-
element:
|
|
376
|
-
}),
|
|
377
|
-
}, Ae = function(
|
|
378
|
-
if (ae && (a === "id" || a === "name") && (
|
|
374
|
+
}), o.textContent !== a && (nt(t.removed, {
|
|
375
|
+
element: o.cloneNode()
|
|
376
|
+
}), o.textContent = a)), H(N.afterSanitizeElements, o, null), !1);
|
|
377
|
+
}, Ae = function(o, a, l) {
|
|
378
|
+
if (ae && (a === "id" || a === "name") && (l in e || l in cn))
|
|
379
379
|
return !1;
|
|
380
|
-
if (!(
|
|
380
|
+
if (!(Lt && !Ot[a] && O(Je, a))) {
|
|
381
381
|
if (!(ie && O(Qe, a))) {
|
|
382
|
-
if (!(j.attributeCheck instanceof Function && j.attributeCheck(a,
|
|
383
|
-
if (!S[a] ||
|
|
382
|
+
if (!(j.attributeCheck instanceof Function && j.attributeCheck(a, o))) {
|
|
383
|
+
if (!S[a] || Ot[a]) {
|
|
384
384
|
if (
|
|
385
385
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
386
386
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
387
387
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
388
|
-
!(_e(
|
|
388
|
+
!(_e(o) && (E.tagNameCheck instanceof RegExp && O(E.tagNameCheck, o) || E.tagNameCheck instanceof Function && E.tagNameCheck(o)) && (E.attributeNameCheck instanceof RegExp && O(E.attributeNameCheck, a) || E.attributeNameCheck instanceof Function && E.attributeNameCheck(a, o)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
389
389
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
390
|
-
a === "is" && E.allowCustomizedBuiltInElements && (E.tagNameCheck instanceof RegExp && O(E.tagNameCheck,
|
|
390
|
+
a === "is" && E.allowCustomizedBuiltInElements && (E.tagNameCheck instanceof RegExp && O(E.tagNameCheck, l) || E.tagNameCheck instanceof Function && E.tagNameCheck(l)))
|
|
391
391
|
) return !1;
|
|
392
|
-
} else if (!
|
|
393
|
-
if (!O(ee, ot(
|
|
394
|
-
if (!((a === "src" || a === "xlink:href" || a === "href") &&
|
|
395
|
-
if (!(se && !O(tn, ot(
|
|
396
|
-
if (
|
|
392
|
+
} else if (!Pt[a]) {
|
|
393
|
+
if (!O(ee, ot(l, te, ""))) {
|
|
394
|
+
if (!((a === "src" || a === "xlink:href" || a === "href") && o !== "script" && Tn(l, "data:") === 0 && le[o])) {
|
|
395
|
+
if (!(se && !O(tn, ot(l, te, "")))) {
|
|
396
|
+
if (l)
|
|
397
397
|
return !1;
|
|
398
398
|
}
|
|
399
399
|
}
|
|
@@ -403,16 +403,16 @@ function ke() {
|
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
return !0;
|
|
406
|
-
}, _e = function(
|
|
407
|
-
return
|
|
408
|
-
}, be = function(
|
|
409
|
-
H(N.beforeSanitizeAttributes,
|
|
406
|
+
}, _e = function(o) {
|
|
407
|
+
return o !== "annotation-xml" && zt(o, en);
|
|
408
|
+
}, be = function(o) {
|
|
409
|
+
H(N.beforeSanitizeAttributes, o, null);
|
|
410
410
|
const {
|
|
411
411
|
attributes: a
|
|
412
|
-
} =
|
|
413
|
-
if (!a ||
|
|
412
|
+
} = o;
|
|
413
|
+
if (!a || Ft(o))
|
|
414
414
|
return;
|
|
415
|
-
const
|
|
415
|
+
const l = {
|
|
416
416
|
attrName: "",
|
|
417
417
|
attrValue: "",
|
|
418
418
|
keepAttr: !0,
|
|
@@ -425,32 +425,32 @@ function ke() {
|
|
|
425
425
|
name: g,
|
|
426
426
|
namespaceURI: w,
|
|
427
427
|
value: z
|
|
428
|
-
} = R, Z = A(g),
|
|
429
|
-
let y = g === "value" ?
|
|
430
|
-
if (
|
|
431
|
-
W(g,
|
|
428
|
+
} = R, Z = A(g), Ut = z;
|
|
429
|
+
let y = g === "value" ? Ut : En(Ut);
|
|
430
|
+
if (l.attrName = Z, l.attrValue = y, l.keepAttr = !0, l.forceKeepAttr = void 0, H(N.uponSanitizeAttribute, o, l), y = l.attrValue, ce && (Z === "id" || Z === "name") && (W(g, o), y = nn + y), ft && O(/((--!?|])>)|<\/(style|title|textarea)/i, y)) {
|
|
431
|
+
W(g, o);
|
|
432
432
|
continue;
|
|
433
433
|
}
|
|
434
|
-
if (Z === "attributename" &&
|
|
435
|
-
W(g,
|
|
434
|
+
if (Z === "attributename" && zt(y, "href")) {
|
|
435
|
+
W(g, o);
|
|
436
436
|
continue;
|
|
437
437
|
}
|
|
438
|
-
if (
|
|
438
|
+
if (l.forceKeepAttr)
|
|
439
439
|
continue;
|
|
440
|
-
if (!
|
|
441
|
-
W(g,
|
|
440
|
+
if (!l.keepAttr) {
|
|
441
|
+
W(g, o);
|
|
442
442
|
continue;
|
|
443
443
|
}
|
|
444
444
|
if (!re && O(/\/>/i, y)) {
|
|
445
|
-
W(g,
|
|
445
|
+
W(g, o);
|
|
446
446
|
continue;
|
|
447
447
|
}
|
|
448
|
-
Y && Et([
|
|
448
|
+
Y && Et([Rt, Ct, Nt], (ye) => {
|
|
449
449
|
y = ot(y, ye, " ");
|
|
450
450
|
});
|
|
451
|
-
const Se = A(
|
|
451
|
+
const Se = A(o.nodeName);
|
|
452
452
|
if (!Ae(Se, Z, y)) {
|
|
453
|
-
W(g,
|
|
453
|
+
W(g, o);
|
|
454
454
|
continue;
|
|
455
455
|
}
|
|
456
456
|
if (C && typeof F == "object" && typeof F.getAttributeType == "function" && !w)
|
|
@@ -464,24 +464,24 @@ function ke() {
|
|
|
464
464
|
break;
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
if (y !==
|
|
467
|
+
if (y !== Ut)
|
|
468
468
|
try {
|
|
469
|
-
w ?
|
|
469
|
+
w ? o.setAttributeNS(w, g, y) : o.setAttribute(g, y), Ft(o) ? x(o) : Ce(t.removed);
|
|
470
470
|
} catch {
|
|
471
|
-
W(g,
|
|
471
|
+
W(g, o);
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
H(N.afterSanitizeAttributes,
|
|
475
|
-
}, fn = function f(
|
|
474
|
+
H(N.afterSanitizeAttributes, o, null);
|
|
475
|
+
}, fn = function f(o) {
|
|
476
476
|
let a = null;
|
|
477
|
-
const
|
|
478
|
-
for (H(N.beforeSanitizeShadowDOM,
|
|
477
|
+
const l = Te(o);
|
|
478
|
+
for (H(N.beforeSanitizeShadowDOM, o, null); a = l.nextNode(); )
|
|
479
479
|
H(N.uponSanitizeShadowNode, a, null), ge(a), be(a), a.content instanceof r && f(a.content);
|
|
480
|
-
H(N.afterSanitizeShadowDOM,
|
|
480
|
+
H(N.afterSanitizeShadowDOM, o, null);
|
|
481
481
|
};
|
|
482
482
|
return t.sanitize = function(f) {
|
|
483
|
-
let
|
|
484
|
-
if (
|
|
483
|
+
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, l = null, T = null, R = null;
|
|
484
|
+
if (vt = !f, vt && (f = "<!-->"), typeof f != "string" && !Ee(f))
|
|
485
485
|
if (typeof f.toString == "function") {
|
|
486
486
|
if (f = f.toString(), typeof f != "string")
|
|
487
487
|
throw it("dirty is not a string, aborting");
|
|
@@ -489,14 +489,14 @@ function ke() {
|
|
|
489
489
|
throw it("toString is not a function");
|
|
490
490
|
if (!t.isSupported)
|
|
491
491
|
return f;
|
|
492
|
-
if (
|
|
492
|
+
if (Mt || kt(o), t.removed = [], typeof f == "string" && (tt = !1), tt) {
|
|
493
493
|
if (f.nodeName) {
|
|
494
494
|
const z = A(f.nodeName);
|
|
495
495
|
if (!_[z] || Q[z])
|
|
496
496
|
throw it("root node is forbidden and cannot be sanitized in-place");
|
|
497
497
|
}
|
|
498
498
|
} else if (f instanceof h)
|
|
499
|
-
a = de("<!---->"),
|
|
499
|
+
a = de("<!---->"), l = a.ownerDocument.importNode(f, !0), l.nodeType === rt.element && l.nodeName === "BODY" || l.nodeName === "HTML" ? a = l : a.appendChild(l);
|
|
500
500
|
else {
|
|
501
501
|
if (!V && !Y && !B && // eslint-disable-next-line unicorn/prefer-includes
|
|
502
502
|
f.indexOf("<") === -1)
|
|
@@ -504,7 +504,7 @@ function ke() {
|
|
|
504
504
|
if (a = de(f), !a)
|
|
505
505
|
return V ? null : pt ? J : "";
|
|
506
506
|
}
|
|
507
|
-
a &&
|
|
507
|
+
a && wt && x(a.firstChild);
|
|
508
508
|
const g = Te(tt ? f : a);
|
|
509
509
|
for (; T = g.nextNode(); )
|
|
510
510
|
ge(T), be(T), T.content instanceof r && fn(T.content);
|
|
@@ -516,27 +516,27 @@ function ke() {
|
|
|
516
516
|
R.appendChild(a.firstChild);
|
|
517
517
|
else
|
|
518
518
|
R = a;
|
|
519
|
-
return (S.shadowroot || S.shadowrootmode) && (R = Ze.call(
|
|
519
|
+
return (S.shadowroot || S.shadowrootmode) && (R = Ze.call(n, R, !0)), R;
|
|
520
520
|
}
|
|
521
521
|
let w = B ? a.outerHTML : a.innerHTML;
|
|
522
522
|
return B && _["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && O(xe, a.ownerDocument.doctype.name) && (w = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
|
|
523
|
-
` + w), Y && Et([
|
|
523
|
+
` + w), Y && Et([Rt, Ct, Nt], (z) => {
|
|
524
524
|
w = ot(w, z, " ");
|
|
525
525
|
}), C && pt ? C.createHTML(w) : w;
|
|
526
526
|
}, t.setConfig = function() {
|
|
527
527
|
let f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
528
|
-
|
|
528
|
+
kt(f), Mt = !0;
|
|
529
529
|
}, t.clearConfig = function() {
|
|
530
|
-
K = null,
|
|
531
|
-
}, t.isValidAttribute = function(f,
|
|
532
|
-
K ||
|
|
533
|
-
const
|
|
534
|
-
return Ae(
|
|
535
|
-
}, t.addHook = function(f,
|
|
536
|
-
typeof
|
|
537
|
-
}, t.removeHook = function(f,
|
|
538
|
-
if (
|
|
539
|
-
const a = hn(N[f],
|
|
530
|
+
K = null, Mt = !1;
|
|
531
|
+
}, t.isValidAttribute = function(f, o, a) {
|
|
532
|
+
K || kt({});
|
|
533
|
+
const l = A(f), T = A(o);
|
|
534
|
+
return Ae(l, T, a);
|
|
535
|
+
}, t.addHook = function(f, o) {
|
|
536
|
+
typeof o == "function" && nt(N[f], o);
|
|
537
|
+
}, t.removeHook = function(f, o) {
|
|
538
|
+
if (o !== void 0) {
|
|
539
|
+
const a = hn(N[f], o);
|
|
540
540
|
return a === -1 ? void 0 : dn(N[f], a, 1)[0];
|
|
541
541
|
}
|
|
542
542
|
return Ce(N[f]);
|
|
@@ -549,15 +549,15 @@ function ke() {
|
|
|
549
549
|
var Fe = ke();
|
|
550
550
|
function Ie(s, t) {
|
|
551
551
|
let e = s;
|
|
552
|
-
for (const
|
|
553
|
-
e = e[
|
|
552
|
+
for (const n of t.split("."))
|
|
553
|
+
e = e[n];
|
|
554
554
|
return e;
|
|
555
555
|
}
|
|
556
556
|
function In(s, t, e) {
|
|
557
|
-
const
|
|
557
|
+
const n = t.split("."), i = n.length - 1;
|
|
558
558
|
let r = s;
|
|
559
|
-
|
|
560
|
-
h === i ? r[
|
|
559
|
+
n.forEach((c, h) => {
|
|
560
|
+
h === i ? r[c] = e : r = r[c];
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
const Pn = /* @__PURE__ */ new Set([
|
|
@@ -571,35 +571,35 @@ const Pn = /* @__PURE__ */ new Set([
|
|
|
571
571
|
"onsubmit"
|
|
572
572
|
]);
|
|
573
573
|
Fe.addHook("uponSanitizeAttribute", (s, t) => {
|
|
574
|
-
const { attrName: e } = t,
|
|
575
|
-
Pn.has(
|
|
574
|
+
const { attrName: e } = t, n = e.toLowerCase();
|
|
575
|
+
Pn.has(n) && (t.forceKeepAttr = !0);
|
|
576
576
|
});
|
|
577
577
|
class bt extends Error {
|
|
578
578
|
}
|
|
579
|
-
const vn = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, Ue = "a-zA-Z_$", xn = Ue + "0-9",
|
|
579
|
+
const vn = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, Ue = "a-zA-Z_$", xn = Ue + "0-9", ct = `[${Ue}][${xn}]*`, kn = /<!--\s*(.*?)\s*-->/, Fn = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, jt = new RegExp(`^this\\.${ct}$`), Yt = new RegExp(`this\\.${ct}(\\.${ct})*`, "g"), He = new RegExp(`this\\.${ct}(\\.${ct})*`), Un = /* @__PURE__ */ new Set(["class", "style"]), ze = 5;
|
|
580
580
|
function Hn(s) {
|
|
581
581
|
return s instanceof HTMLButtonElement || s instanceof HTMLFieldSetElement || s instanceof HTMLInputElement || s instanceof HTMLSelectElement || s instanceof HTMLTextAreaElement || s instanceof D;
|
|
582
582
|
}
|
|
583
|
-
function
|
|
584
|
-
const
|
|
583
|
+
function Wn(s, t, e) {
|
|
584
|
+
const n = document.createElement(s);
|
|
585
585
|
if (t)
|
|
586
586
|
for (const [i, r] of Object.entries(t))
|
|
587
|
-
|
|
588
|
-
return e && (
|
|
587
|
+
n.setAttribute(i, r);
|
|
588
|
+
return e && (n.innerHTML = e), n;
|
|
589
589
|
}
|
|
590
590
|
const zn = (s) => s === String ? "" : s === Number ? 0 : s === Boolean ? !1 : s === Array ? [] : s === Object ? {} : void 0;
|
|
591
|
-
function
|
|
591
|
+
function St(s) {
|
|
592
592
|
const t = [];
|
|
593
593
|
let e = s.firstElementChild;
|
|
594
594
|
for (; e; )
|
|
595
|
-
t.push(e), e.shadowRoot && t.push(...
|
|
595
|
+
t.push(e), e.shadowRoot && t.push(...St(e.shadowRoot)), e.firstElementChild && t.push(...St(e)), e = e.nextElementSibling;
|
|
596
596
|
return t;
|
|
597
597
|
}
|
|
598
598
|
const At = (s) => s.substring(ze).split(".")[0];
|
|
599
599
|
function Ge(s, t) {
|
|
600
600
|
let e = s[0];
|
|
601
|
-
return t.forEach((
|
|
602
|
-
e +=
|
|
601
|
+
return t.forEach((n, i) => {
|
|
602
|
+
e += n + s[i + 1];
|
|
603
603
|
}), e;
|
|
604
604
|
}
|
|
605
605
|
function Jt(s) {
|
|
@@ -614,47 +614,56 @@ function Qt(s) {
|
|
|
614
614
|
return t === "input" || t === "select";
|
|
615
615
|
}
|
|
616
616
|
const Gn = (s) => s.replace(/<!--[\s\S]*?-->/g, "");
|
|
617
|
-
function $e(s, t, e,
|
|
618
|
-
return s.slice(0, t) +
|
|
617
|
+
function $e(s, t, e, n) {
|
|
618
|
+
return s.slice(0, t) + n + s.slice(t + e);
|
|
619
619
|
}
|
|
620
620
|
function $n(s) {
|
|
621
621
|
let t = s.trim(), e = null;
|
|
622
622
|
/^\s*<tr[\s>]/i.test(t) ? (t = `<table><tbody>${t}</tbody></table>`, e = "tbody") : /^\s*<(td|th)[\s>]/i.test(t) ? (t = `<table><tbody><tr>${t}</tr></tbody></table>`, e = "tr") : /^\s*<option[\s>]/i.test(t) ? (t = `<select>${t}</select>`, e = "select") : /^\s*<col[\s>]/i.test(t) && (t = `<table><colgroup>${t}</colgroup></table>`, e = "colgroup");
|
|
623
|
-
const
|
|
623
|
+
const n = Fe.sanitize(t, {
|
|
624
624
|
ADD_TAGS: ["#comment"],
|
|
625
625
|
ALLOW_UNKNOWN_PROTOCOLS: !0,
|
|
626
626
|
RETURN_DOM_FRAGMENT: !0
|
|
627
627
|
});
|
|
628
628
|
if (e) {
|
|
629
|
-
const i =
|
|
629
|
+
const i = n.querySelector(e);
|
|
630
630
|
if (i) return i.childNodes;
|
|
631
631
|
}
|
|
632
|
-
return
|
|
632
|
+
return n.childNodes;
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function Vt(s) {
|
|
635
635
|
const t = Number(s);
|
|
636
636
|
if (isNaN(t)) throw new bt(`can't convert "${s}" to a number`);
|
|
637
637
|
return t;
|
|
638
638
|
}
|
|
639
639
|
function Be(s, t, e) {
|
|
640
|
-
const [
|
|
640
|
+
const [n, i] = t.split(":");
|
|
641
641
|
if (Jt(e))
|
|
642
642
|
if (typeof e == "boolean") {
|
|
643
|
-
e ? s.setAttribute(
|
|
644
|
-
const r = D.getPropName(
|
|
643
|
+
e ? s.setAttribute(n, n) : s.removeAttribute(n);
|
|
644
|
+
const r = D.getPropName(n);
|
|
645
645
|
s[r] = e;
|
|
646
646
|
} else {
|
|
647
|
-
const r = s.getAttribute(t),
|
|
648
|
-
r !==
|
|
647
|
+
const r = s.getAttribute(t), c = String(e);
|
|
648
|
+
r !== c && (s.setAttribute(n, c), n === "value" && Qt(s) && (s.value = c));
|
|
649
649
|
}
|
|
650
650
|
else {
|
|
651
651
|
const r = D.getPropName(t);
|
|
652
652
|
s[r] = e;
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
|
-
function
|
|
656
|
-
const [
|
|
657
|
-
s instanceof CSSStyleRule ? s.style.setProperty(
|
|
655
|
+
function Xt(s, t, e) {
|
|
656
|
+
const [n, i] = t.split(":");
|
|
657
|
+
s instanceof CSSStyleRule ? s.style.setProperty(n, e) : (Be(s, n, e), n === "value" && Qt(s) && (s.value = e));
|
|
658
|
+
}
|
|
659
|
+
function Bn(s) {
|
|
660
|
+
const t = /* @__PURE__ */ new Set();
|
|
661
|
+
for (const n of St(s)) {
|
|
662
|
+
const { localName: i } = n;
|
|
663
|
+
i.includes("-") && t.add(i);
|
|
664
|
+
}
|
|
665
|
+
const e = [...t].map((n) => customElements.whenDefined(n));
|
|
666
|
+
return Promise.all(e);
|
|
658
667
|
}
|
|
659
668
|
class D extends HTMLElement {
|
|
660
669
|
// This is used to lookup the camelCase property name
|
|
@@ -696,13 +705,13 @@ class D extends HTMLElement {
|
|
|
696
705
|
// attribute values, and CSS property values.
|
|
697
706
|
// Each component instance needs its own map.
|
|
698
707
|
#n = /* @__PURE__ */ new Map();
|
|
699
|
-
#
|
|
708
|
+
#c = {};
|
|
700
709
|
#i;
|
|
701
710
|
// For components that set `formAssociated` to true,
|
|
702
711
|
// this stores in the initial value of each property
|
|
703
712
|
// in the formAssociatedCallback method
|
|
704
713
|
// so they can be restored in the formResetCallback method.
|
|
705
|
-
#
|
|
714
|
+
#l = {};
|
|
706
715
|
#f = null;
|
|
707
716
|
// This is a map from properties in this web component
|
|
708
717
|
// to corresponding properties in a parent web component.
|
|
@@ -717,70 +726,71 @@ class D extends HTMLElement {
|
|
|
717
726
|
const t = this.#t;
|
|
718
727
|
t.properties || (t.properties = {}), t.propToComputedMap || (t.propToComputedMap = /* @__PURE__ */ new Map()), t.propToExprsMap || (t.propToExprsMap = /* @__PURE__ */ new Map());
|
|
719
728
|
}
|
|
720
|
-
attributeChangedCallback(t, e,
|
|
729
|
+
attributeChangedCallback(t, e, n) {
|
|
721
730
|
t === "disabled" && this.#d();
|
|
722
731
|
const i = D.getPropName(t);
|
|
723
732
|
if (this.#s(i)) {
|
|
724
|
-
const r = this.#b(i, String(
|
|
733
|
+
const r = this.#b(i, String(n));
|
|
725
734
|
this[i] = r;
|
|
726
|
-
const
|
|
727
|
-
|
|
735
|
+
const c = this.#c[i];
|
|
736
|
+
c && this.setFormValue(c, String(r)), this.propertyChangedCallback(i, e, n);
|
|
728
737
|
}
|
|
729
738
|
}
|
|
730
|
-
#R() {
|
|
731
|
-
if (!this.shadowRoot) return;
|
|
739
|
+
async #R() {
|
|
732
740
|
const t = this.#t;
|
|
733
741
|
let { template: e } = t;
|
|
734
742
|
if (!e) {
|
|
735
743
|
e = t.template = document.createElement("template");
|
|
736
|
-
let
|
|
744
|
+
let n = `<style>
|
|
737
745
|
:host([hidden]) { display: none; }`;
|
|
738
|
-
t.css && (
|
|
746
|
+
t.css && (n += t.css), n += `</style>
|
|
739
747
|
`;
|
|
740
748
|
let i = t.html.trim();
|
|
741
|
-
i.startsWith("<") || (i = `<span><!--${i}--></span>`), e.innerHTML =
|
|
749
|
+
i.startsWith("<") || (i = `<span><!--${i}--></span>`), e.innerHTML = n + i;
|
|
742
750
|
}
|
|
743
|
-
this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
|
|
751
|
+
await Bn(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
|
|
744
752
|
}
|
|
745
|
-
changed(t, e,
|
|
746
|
-
this[e] =
|
|
753
|
+
changed(t, e, n) {
|
|
754
|
+
this[e] = n;
|
|
747
755
|
}
|
|
748
756
|
connectedCallback() {
|
|
749
|
-
this.#x(), this.#N(), this.#R()
|
|
750
|
-
this.
|
|
757
|
+
this.#x(), this.#N(), this.#R().then(() => {
|
|
758
|
+
this.hasAttribute("disabled") && this.#d(), requestAnimationFrame(() => {
|
|
759
|
+
this.#y(this.shadowRoot), this.#T(this.shadowRoot), this.#C();
|
|
760
|
+
});
|
|
751
761
|
});
|
|
752
762
|
}
|
|
753
763
|
#C() {
|
|
754
764
|
const t = this.#t, { properties: e } = t;
|
|
755
|
-
for (const [
|
|
756
|
-
i && (this[
|
|
765
|
+
for (const [n, { computed: i }] of Object.entries(e))
|
|
766
|
+
i && (this[n] = this.#o(i));
|
|
757
767
|
}
|
|
758
768
|
#N() {
|
|
759
|
-
const t = this.#t, { observedAttributes: e, properties:
|
|
760
|
-
for (const [i, r] of Object.entries(
|
|
769
|
+
const t = this.#t, { observedAttributes: e, properties: n } = t;
|
|
770
|
+
for (const [i, r] of Object.entries(n))
|
|
761
771
|
this.#O(i, r, e);
|
|
762
772
|
}
|
|
763
|
-
#O(t, e,
|
|
773
|
+
#O(t, e, n) {
|
|
764
774
|
const i = D.getAttrName(t), r = this.hasAttribute(i);
|
|
765
775
|
e.required && !r && this.#e(this, t, "is a required attribute");
|
|
766
|
-
let
|
|
767
|
-
this.hasOwnProperty(t) && (
|
|
768
|
-
const { type: h } = e, u = h === Boolean ?
|
|
776
|
+
let c = e.value;
|
|
777
|
+
this.hasOwnProperty(t) && (c = this[t], delete this[t]);
|
|
778
|
+
const { type: h } = e, u = h === Boolean ? c || r : n.includes(i) && r ? this.#_(t, i) : c || zn(h), p = "#" + t;
|
|
769
779
|
this[p] = u, e.computed && this.#D(t, e), Object.defineProperty(this, t, {
|
|
770
780
|
enumerable: !0,
|
|
771
781
|
get() {
|
|
772
782
|
return this[p];
|
|
773
783
|
},
|
|
774
784
|
set(d) {
|
|
775
|
-
h === Number && typeof d == "string" && (d =
|
|
785
|
+
h === Number && typeof d == "string" && (d = Vt(d));
|
|
776
786
|
const b = this[p];
|
|
777
787
|
if (d === b) return;
|
|
778
788
|
this.#F(t, h, d), this[p] = d;
|
|
779
789
|
const { state: G, stateProp: F } = this.#t.properties[t];
|
|
780
790
|
F && In(G, F, d), this.#P(t), this.#I(t, h, d, i), this.#A(t), this.#v(t, d);
|
|
781
|
-
const $ = this.#
|
|
791
|
+
const $ = this.#c[t];
|
|
782
792
|
$ && this.setFormValue($, String(d)), this.propertyChangedCallback(t, b, d), e.dispatch && this.dispatch("change", {
|
|
783
|
-
|
|
793
|
+
tagName: this.localName,
|
|
784
794
|
property: t,
|
|
785
795
|
oldValue: b,
|
|
786
796
|
value: d
|
|
@@ -789,12 +799,12 @@ class D extends HTMLElement {
|
|
|
789
799
|
});
|
|
790
800
|
}
|
|
791
801
|
#d() {
|
|
792
|
-
const t = this.hasAttribute("disabled"), e =
|
|
793
|
-
for (const
|
|
794
|
-
Hn(
|
|
802
|
+
const t = this.hasAttribute("disabled"), e = St(this.shadowRoot);
|
|
803
|
+
for (const n of e)
|
|
804
|
+
Hn(n) && (n.disabled = t);
|
|
795
805
|
}
|
|
796
806
|
disconnectedCallback() {
|
|
797
|
-
this.#n.clear(), this.#
|
|
807
|
+
this.#n.clear(), this.#l.clear(), this.#u.clear();
|
|
798
808
|
}
|
|
799
809
|
dispatch(t, e) {
|
|
800
810
|
this.dispatchEvent(
|
|
@@ -817,18 +827,18 @@ class D extends HTMLElement {
|
|
|
817
827
|
}
|
|
818
828
|
#L(t) {
|
|
819
829
|
const e = t instanceof D;
|
|
820
|
-
for (const
|
|
821
|
-
const i = t.getAttribute(
|
|
830
|
+
for (const n of t.getAttributeNames()) {
|
|
831
|
+
const i = t.getAttribute(n), r = this.#g(t, i);
|
|
822
832
|
if (r) {
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
let [h, u] =
|
|
826
|
-
h === "value" && (u ? (t["on" + u] === void 0 && this.#e(t,
|
|
833
|
+
const c = this[r];
|
|
834
|
+
c === void 0 && this.#a(t, n, r), t[r] = c;
|
|
835
|
+
let [h, u] = n.split(":");
|
|
836
|
+
h === "value" && (u ? (t["on" + u] === void 0 && this.#e(t, n, "refers to an unsupported event name"), t.setAttribute(h, this[r])) : u = "change"), e && t.#u.set(
|
|
827
837
|
D.getPropName(h),
|
|
828
838
|
r
|
|
829
839
|
);
|
|
830
840
|
}
|
|
831
|
-
this.#r(i, t,
|
|
841
|
+
this.#r(i, t, n);
|
|
832
842
|
}
|
|
833
843
|
}
|
|
834
844
|
#o(t) {
|
|
@@ -838,31 +848,31 @@ class D extends HTMLElement {
|
|
|
838
848
|
#M(t) {
|
|
839
849
|
const { localName: e } = t;
|
|
840
850
|
if (e === "style") {
|
|
841
|
-
const { sheet:
|
|
842
|
-
for (const
|
|
843
|
-
if (
|
|
844
|
-
const h = Array.from(
|
|
851
|
+
const { sheet: n } = t, i = n?.cssRules ?? [], r = Array.from(i);
|
|
852
|
+
for (const c of r)
|
|
853
|
+
if (c.constructor === CSSStyleRule) {
|
|
854
|
+
const h = Array.from(c.style);
|
|
845
855
|
for (const u of h)
|
|
846
856
|
if (u.startsWith("--")) {
|
|
847
|
-
const p =
|
|
848
|
-
this.#r(p,
|
|
857
|
+
const p = c.style.getPropertyValue(u);
|
|
858
|
+
this.#r(p, c, u);
|
|
849
859
|
}
|
|
850
860
|
}
|
|
851
861
|
} else {
|
|
852
|
-
let
|
|
862
|
+
let n = "";
|
|
853
863
|
if (at(t)) {
|
|
854
864
|
this.#r(t.textContent, t);
|
|
855
865
|
const i = t.textContent?.match(kn);
|
|
856
|
-
i && (
|
|
866
|
+
i && (n = i[1]);
|
|
857
867
|
} else {
|
|
858
868
|
const i = Array.from(t.childNodes).find(
|
|
859
869
|
(r) => r.nodeType === Node.COMMENT_NODE
|
|
860
870
|
);
|
|
861
|
-
i && (
|
|
871
|
+
i && (n = i.textContent?.trim() ?? "");
|
|
862
872
|
}
|
|
863
|
-
if (
|
|
864
|
-
const i = this.#g(t,
|
|
865
|
-
i && at(t) ? t.textContent = this[i] : this.#r(
|
|
873
|
+
if (n) {
|
|
874
|
+
const i = this.#g(t, n);
|
|
875
|
+
i && at(t) ? t.textContent = this[i] : this.#r(n, t);
|
|
866
876
|
}
|
|
867
877
|
}
|
|
868
878
|
}
|
|
@@ -873,30 +883,30 @@ class D extends HTMLElement {
|
|
|
873
883
|
formAssociatedCallback() {
|
|
874
884
|
let t = this.getAttribute("form-assoc");
|
|
875
885
|
if (!t) {
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
886
|
+
const c = this.getAttribute("name");
|
|
887
|
+
if (c)
|
|
878
888
|
if (this.#s("value"))
|
|
879
|
-
t = `value:${
|
|
889
|
+
t = `value:${c}`;
|
|
880
890
|
else
|
|
881
891
|
return;
|
|
882
892
|
else
|
|
883
893
|
return;
|
|
884
894
|
}
|
|
885
|
-
const e = {},
|
|
886
|
-
for (const
|
|
887
|
-
const [h, u] =
|
|
895
|
+
const e = {}, n = t.split(",");
|
|
896
|
+
for (const c of n) {
|
|
897
|
+
const [h, u] = c.split(":");
|
|
888
898
|
e[h.trim()] = u.trim();
|
|
889
899
|
}
|
|
890
|
-
this.#
|
|
891
|
-
const i = Object.keys(this.#t.properties), r = this.#
|
|
892
|
-
for (const
|
|
893
|
-
r[
|
|
900
|
+
this.#c = e, this.#i = new FormData(), this.#f = this.attachInternals(), this.#f.setFormValue(this.#i);
|
|
901
|
+
const i = Object.keys(this.#t.properties), r = this.#l;
|
|
902
|
+
for (const c of i)
|
|
903
|
+
r[c] = this[c];
|
|
894
904
|
}
|
|
895
905
|
formResetCallback() {
|
|
896
|
-
const t = this.#
|
|
906
|
+
const t = this.#l;
|
|
897
907
|
for (const e of Object.keys(t)) {
|
|
898
|
-
let
|
|
899
|
-
|
|
908
|
+
let n = t[e];
|
|
909
|
+
jt.test(n) && (n = this.#o(n)), this[e] = n;
|
|
900
910
|
}
|
|
901
911
|
}
|
|
902
912
|
static getAttrName(t) {
|
|
@@ -905,22 +915,22 @@ class D extends HTMLElement {
|
|
|
905
915
|
}
|
|
906
916
|
static getPropName(t) {
|
|
907
917
|
let e = D.#m.get(t);
|
|
908
|
-
return e || (e = t.replace(/-([a-z])/g, (
|
|
918
|
+
return e || (e = t.replace(/-([a-z])/g, (n, i) => i.toUpperCase()), D.#m.set(t, e)), e;
|
|
909
919
|
}
|
|
910
|
-
#w(t, e,
|
|
911
|
-
if (
|
|
912
|
-
const [i] =
|
|
913
|
-
if (!
|
|
920
|
+
#w(t, e, n) {
|
|
921
|
+
if (n.length !== 1) return;
|
|
922
|
+
const [i] = n;
|
|
923
|
+
if (!jt.test(i)) return;
|
|
914
924
|
const r = Qt(t) || at(t);
|
|
915
|
-
let [
|
|
916
|
-
if (!(r &&
|
|
925
|
+
let [c, h] = (e ?? "").split(":");
|
|
926
|
+
if (!(r && c === "value" || at(t))) return;
|
|
917
927
|
h ? t["on" + h] === void 0 && this.#e(t, e, "refers to an unsupported event name") : h = "change";
|
|
918
928
|
const p = At(i);
|
|
919
929
|
t.addEventListener(h, (d) => {
|
|
920
930
|
const { target: b } = d;
|
|
921
931
|
if (!b) return;
|
|
922
932
|
const G = b.value, { type: F } = this.#t.properties[p];
|
|
923
|
-
this[p] = F === Number ?
|
|
933
|
+
this[p] = F === Number ? Vt(G) : G, this.#A(p);
|
|
924
934
|
});
|
|
925
935
|
}
|
|
926
936
|
#s(t) {
|
|
@@ -928,8 +938,8 @@ class D extends HTMLElement {
|
|
|
928
938
|
}
|
|
929
939
|
#T(t) {
|
|
930
940
|
const e = Array.from(t.querySelectorAll("*"));
|
|
931
|
-
for (const
|
|
932
|
-
this.#L(
|
|
941
|
+
for (const n of e)
|
|
942
|
+
this.#L(n), n.firstElementChild || this.#M(n);
|
|
933
943
|
}
|
|
934
944
|
// formAssociated is only needed when the component is inside a form.
|
|
935
945
|
#E() {
|
|
@@ -944,24 +954,24 @@ class D extends HTMLElement {
|
|
|
944
954
|
return t.includes("disabled") || t.push("disabled"), t;
|
|
945
955
|
}
|
|
946
956
|
// Subclasses can override this to add functionality.
|
|
947
|
-
propertyChangedCallback(t, e,
|
|
957
|
+
propertyChangedCallback(t, e, n) {
|
|
948
958
|
}
|
|
949
959
|
#g(t, e) {
|
|
950
|
-
if (!e || !
|
|
951
|
-
const
|
|
952
|
-
return this[
|
|
960
|
+
if (!e || !jt.test(e)) return;
|
|
961
|
+
const n = At(e);
|
|
962
|
+
return this[n] === void 0 && this.#a(t, "", n), n;
|
|
953
963
|
}
|
|
954
964
|
#A(t) {
|
|
955
965
|
const i = this.#t.propToExprsMap.get(t) || [];
|
|
956
966
|
for (const r of i) {
|
|
957
|
-
let
|
|
967
|
+
let c = this.#o(r);
|
|
958
968
|
const h = this.#n.get(r) ?? [];
|
|
959
969
|
for (const u of h)
|
|
960
970
|
if (u instanceof HTMLElement)
|
|
961
|
-
this.#S(u,
|
|
971
|
+
this.#S(u, c);
|
|
962
972
|
else if (!(u instanceof CSSStyleRule)) {
|
|
963
973
|
const { element: p, attrName: d } = u;
|
|
964
|
-
p instanceof CSSStyleRule ? p.style.setProperty(d,
|
|
974
|
+
p instanceof CSSStyleRule ? p.style.setProperty(d, c) : Xt(p, d, c);
|
|
965
975
|
}
|
|
966
976
|
}
|
|
967
977
|
}
|
|
@@ -970,28 +980,28 @@ class D extends HTMLElement {
|
|
|
970
980
|
customElements.get(t) || customElements.define(t, this);
|
|
971
981
|
}
|
|
972
982
|
#D(t, e) {
|
|
973
|
-
const { computed:
|
|
974
|
-
function
|
|
983
|
+
const { computed: n, uses: i } = e, r = this.#t.propToComputedMap;
|
|
984
|
+
function c(u, p) {
|
|
975
985
|
let d = r.get(u);
|
|
976
986
|
d || (d = [], r.set(u, d)), d.push([t, p]);
|
|
977
987
|
}
|
|
978
|
-
const h =
|
|
988
|
+
const h = n.match(Yt) || [];
|
|
979
989
|
for (const u of h) {
|
|
980
990
|
const p = u.substring(ze);
|
|
981
|
-
this[p] === void 0 && this.#a(null, t, p), typeof this[p] != "function" &&
|
|
991
|
+
this[p] === void 0 && this.#a(null, t, p), typeof this[p] != "function" && c(p, n);
|
|
982
992
|
}
|
|
983
993
|
if (i)
|
|
984
994
|
for (const u of i.split(","))
|
|
985
|
-
|
|
995
|
+
c(u, n);
|
|
986
996
|
}
|
|
987
997
|
// WARNING: Do not place untrusted JavaScript expressions
|
|
988
998
|
// in attribute values or the text content of elements!
|
|
989
|
-
#r(t, e,
|
|
999
|
+
#r(t, e, n = void 0) {
|
|
990
1000
|
if (!t) return;
|
|
991
|
-
const i = this.#p(e,
|
|
1001
|
+
const i = this.#p(e, n, t);
|
|
992
1002
|
if (!i) {
|
|
993
1003
|
const u = t.replaceAll("this..", "this.");
|
|
994
|
-
|
|
1004
|
+
n ? Xt(e, n, u) : "textContent" in e && (e.textContent = u);
|
|
995
1005
|
return;
|
|
996
1006
|
}
|
|
997
1007
|
const r = this.#t;
|
|
@@ -1010,10 +1020,10 @@ class D extends HTMLElement {
|
|
|
1010
1020
|
p.filter((G) => G !== d)
|
|
1011
1021
|
);
|
|
1012
1022
|
}
|
|
1013
|
-
let
|
|
1014
|
-
|
|
1023
|
+
let c = this.#n.get(t);
|
|
1024
|
+
c || (c = [], this.#n.set(t, c)), c.push(n ? { element: e, attrName: n } : e), e instanceof HTMLElement && this.#w(e, n, i);
|
|
1015
1025
|
const h = this.#o(t);
|
|
1016
|
-
|
|
1026
|
+
n ? Xt(e, n, h) : this.#S(e, h);
|
|
1017
1027
|
}
|
|
1018
1028
|
// This follows the best practice
|
|
1019
1029
|
// "Do not override author-set, global attributes."
|
|
@@ -1023,23 +1033,23 @@ class D extends HTMLElement {
|
|
|
1023
1033
|
setFormValue(t, e) {
|
|
1024
1034
|
!this.#i || !Jt(e) || (this.#i.set(t, e), this.#f?.setFormValue(this.#i));
|
|
1025
1035
|
}
|
|
1026
|
-
#e(t, e,
|
|
1036
|
+
#e(t, e, n) {
|
|
1027
1037
|
const i = this.#t, r = t instanceof HTMLElement ? t.localName : "CSS rule";
|
|
1028
1038
|
throw new bt(
|
|
1029
|
-
`component ${i.elementName()}` + (t ? `, element "${r}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${
|
|
1039
|
+
`component ${i.elementName()}` + (t ? `, element "${r}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${n}`
|
|
1030
1040
|
);
|
|
1031
1041
|
}
|
|
1032
|
-
#a(t, e,
|
|
1033
|
-
this.#e(t, e, `refers to missing property "${
|
|
1042
|
+
#a(t, e, n) {
|
|
1043
|
+
this.#e(t, e, `refers to missing property "${n}"`);
|
|
1034
1044
|
}
|
|
1035
1045
|
#_(t, e) {
|
|
1036
1046
|
return this.#b(t, this.getAttribute(e));
|
|
1037
1047
|
}
|
|
1038
1048
|
#b(t, e) {
|
|
1039
|
-
if (e?.match(
|
|
1040
|
-
const
|
|
1049
|
+
if (e?.match(Yt)) return e;
|
|
1050
|
+
const n = this.#t, { type: i } = n.properties[t];
|
|
1041
1051
|
if (i || this.#e(null, t, "does not specify its type"), i === String) return e;
|
|
1042
|
-
if (i === Number) return
|
|
1052
|
+
if (i === Number) return Vt(e);
|
|
1043
1053
|
if (i === Boolean)
|
|
1044
1054
|
return e === "true" ? !0 : e === "false" || e === "null" ? !1 : (e && e !== t && this.#e(
|
|
1045
1055
|
null,
|
|
@@ -1049,44 +1059,44 @@ class D extends HTMLElement {
|
|
|
1049
1059
|
}
|
|
1050
1060
|
// Updates the matching attribute for a property if there is one.
|
|
1051
1061
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1052
|
-
#I(t, e,
|
|
1053
|
-
if (Jt(
|
|
1062
|
+
#I(t, e, n, i) {
|
|
1063
|
+
if (Jt(n) && this.hasAttribute(i)) {
|
|
1054
1064
|
const r = e === Boolean ? this.hasAttribute(i) : this.#_(t, i);
|
|
1055
|
-
|
|
1065
|
+
n !== r && Be(this, t, n);
|
|
1056
1066
|
}
|
|
1057
1067
|
}
|
|
1058
1068
|
// Updates all computed properties that reference this property.
|
|
1059
1069
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1060
1070
|
#P(t) {
|
|
1061
|
-
const
|
|
1062
|
-
for (const [i, r] of
|
|
1071
|
+
const n = this.#t.propToComputedMap.get(t) || [];
|
|
1072
|
+
for (const [i, r] of n)
|
|
1063
1073
|
this[i] = this.#o(r);
|
|
1064
1074
|
}
|
|
1065
1075
|
#S(t, e) {
|
|
1066
1076
|
if (e === void 0) return;
|
|
1067
|
-
const
|
|
1077
|
+
const n = t instanceof HTMLElement, i = typeof e;
|
|
1068
1078
|
if (i !== "string" && i !== "number" && this.#e(
|
|
1069
1079
|
t,
|
|
1070
1080
|
void 0,
|
|
1071
1081
|
" computed content is not a string or number"
|
|
1072
1082
|
), t instanceof HTMLElement && at(t))
|
|
1073
1083
|
t.value = e;
|
|
1074
|
-
else if (
|
|
1084
|
+
else if (n && i === "string" && e.trim().startsWith("<")) {
|
|
1075
1085
|
const r = $n(e);
|
|
1076
1086
|
t.replaceChildren(...r), this.#y(t), this.#T(t);
|
|
1077
|
-
} else
|
|
1087
|
+
} else n && (t.textContent = e);
|
|
1078
1088
|
}
|
|
1079
1089
|
// Update corresponding parent web component property if bound to one.
|
|
1080
1090
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1081
1091
|
#v(t, e) {
|
|
1082
|
-
const
|
|
1083
|
-
if (!
|
|
1092
|
+
const n = this.#u.get(t);
|
|
1093
|
+
if (!n) return;
|
|
1084
1094
|
const i = this.getRootNode();
|
|
1085
1095
|
if (!(i instanceof ShadowRoot)) return;
|
|
1086
1096
|
const { host: r } = i;
|
|
1087
1097
|
if (!r) return;
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1098
|
+
const c = r;
|
|
1099
|
+
c[n] = e;
|
|
1090
1100
|
}
|
|
1091
1101
|
/**
|
|
1092
1102
|
* @param state - WrecState object
|
|
@@ -1096,55 +1106,55 @@ class D extends HTMLElement {
|
|
|
1096
1106
|
useState(t, e) {
|
|
1097
1107
|
if (!e) {
|
|
1098
1108
|
e = {};
|
|
1099
|
-
for (const
|
|
1100
|
-
e[
|
|
1109
|
+
for (const n of Object.keys(t))
|
|
1110
|
+
e[n] = n;
|
|
1101
1111
|
}
|
|
1102
1112
|
this.#k(t, e);
|
|
1103
|
-
for (const [
|
|
1113
|
+
for (const [n, i] of Object.entries(e))
|
|
1104
1114
|
if (this.#s(i)) {
|
|
1105
|
-
const r = Ie(t,
|
|
1115
|
+
const r = Ie(t, n);
|
|
1106
1116
|
r !== void 0 && (this[i] = r);
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1117
|
+
const c = this.#t.properties[i];
|
|
1118
|
+
c.state = t, c.stateProp = n;
|
|
1109
1119
|
}
|
|
1110
1120
|
t.addListener(this, e);
|
|
1111
1121
|
}
|
|
1112
1122
|
#x() {
|
|
1113
1123
|
const t = this.#t, e = new Set(Object.keys(t.properties));
|
|
1114
|
-
for (const
|
|
1115
|
-
Un.has(
|
|
1124
|
+
for (const n of e)
|
|
1125
|
+
Un.has(n) && this.#e(
|
|
1116
1126
|
null,
|
|
1117
1127
|
"",
|
|
1118
|
-
`property "${
|
|
1128
|
+
`property "${n}" is not allowed because it is a reserved attribute`
|
|
1119
1129
|
);
|
|
1120
|
-
for (const
|
|
1121
|
-
if (
|
|
1122
|
-
if (
|
|
1130
|
+
for (const n of this.getAttributeNames())
|
|
1131
|
+
if (n !== "class" && n !== "id" && n !== "disabled" && !n.startsWith("on")) {
|
|
1132
|
+
if (n === "form-assoc") {
|
|
1123
1133
|
this.#E();
|
|
1124
1134
|
continue;
|
|
1125
1135
|
}
|
|
1126
|
-
if (!e.has(D.getPropName(
|
|
1127
|
-
if (
|
|
1136
|
+
if (!e.has(D.getPropName(n))) {
|
|
1137
|
+
if (n === "name") {
|
|
1128
1138
|
this.#E();
|
|
1129
1139
|
continue;
|
|
1130
1140
|
}
|
|
1131
|
-
this.#e(null,
|
|
1141
|
+
this.#e(null, n, "is not a supported attribute");
|
|
1132
1142
|
}
|
|
1133
1143
|
}
|
|
1134
1144
|
}
|
|
1135
|
-
#p(t, e,
|
|
1136
|
-
const i =
|
|
1145
|
+
#p(t, e, n) {
|
|
1146
|
+
const i = n.match(Yt);
|
|
1137
1147
|
if (i)
|
|
1138
1148
|
return i.forEach((r) => {
|
|
1139
|
-
const
|
|
1140
|
-
this[
|
|
1149
|
+
const c = At(r);
|
|
1150
|
+
this[c] === void 0 && this.#a(t, e, c);
|
|
1141
1151
|
}), i;
|
|
1142
1152
|
}
|
|
1143
1153
|
#k(t, e) {
|
|
1144
|
-
for (const [
|
|
1145
|
-
let r = Ie(t,
|
|
1154
|
+
for (const [n, i] of Object.entries(e)) {
|
|
1155
|
+
let r = Ie(t, n);
|
|
1146
1156
|
if (r === void 0)
|
|
1147
|
-
throw new bt(`invalid state path "${
|
|
1157
|
+
throw new bt(`invalid state path "${n}"`);
|
|
1148
1158
|
r = this[i], this.#s(i) || this.#e(
|
|
1149
1159
|
null,
|
|
1150
1160
|
i,
|
|
@@ -1153,11 +1163,12 @@ class D extends HTMLElement {
|
|
|
1153
1163
|
}
|
|
1154
1164
|
}
|
|
1155
1165
|
// When type is an array, this can't validate the type of the array elements.
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1166
|
+
// This is called by #defineProp.
|
|
1167
|
+
#F(t, e, n) {
|
|
1168
|
+
if (n instanceof e) return;
|
|
1169
|
+
let i = typeof n;
|
|
1159
1170
|
if (i === "object") {
|
|
1160
|
-
const { constructor: r } =
|
|
1171
|
+
const { constructor: r } = n;
|
|
1161
1172
|
i = r.name, r !== e && this.#e(
|
|
1162
1173
|
null,
|
|
1163
1174
|
t,
|
|
@@ -1172,57 +1183,57 @@ class D extends HTMLElement {
|
|
|
1172
1183
|
}
|
|
1173
1184
|
#y(t) {
|
|
1174
1185
|
const e = Array.from(t.querySelectorAll("*"));
|
|
1175
|
-
for (const
|
|
1186
|
+
for (const n of e) {
|
|
1176
1187
|
const i = [];
|
|
1177
|
-
for (const r of Array.from(
|
|
1178
|
-
const
|
|
1179
|
-
if (
|
|
1180
|
-
let h =
|
|
1188
|
+
for (const r of Array.from(n.attributes)) {
|
|
1189
|
+
const c = r.name;
|
|
1190
|
+
if (c.startsWith("on")) {
|
|
1191
|
+
let h = c.slice(2);
|
|
1181
1192
|
h = h[0].toLowerCase() + h.slice(1).toLowerCase();
|
|
1182
1193
|
const u = r.value;
|
|
1183
|
-
this.#p(
|
|
1194
|
+
this.#p(n, c, u);
|
|
1184
1195
|
let p;
|
|
1185
|
-
typeof this[u] == "function" ? p = (d) => this[u](d) : (this.#p(
|
|
1196
|
+
typeof this[u] == "function" ? p = (d) => this[u](d) : (this.#p(n, c, u), p = () => this.#o(u)), n.addEventListener(h, p), i.push(c);
|
|
1186
1197
|
}
|
|
1187
1198
|
}
|
|
1188
1199
|
for (const r of i)
|
|
1189
|
-
|
|
1200
|
+
n.removeAttribute(r);
|
|
1190
1201
|
}
|
|
1191
1202
|
}
|
|
1192
1203
|
}
|
|
1193
|
-
function
|
|
1204
|
+
function jn(s, ...t) {
|
|
1194
1205
|
let e = Ge(s, t);
|
|
1195
1206
|
for (; ; ) {
|
|
1196
|
-
const
|
|
1197
|
-
if (!
|
|
1198
|
-
const i =
|
|
1207
|
+
const n = vn.exec(e);
|
|
1208
|
+
if (!n) break;
|
|
1209
|
+
const i = n[2];
|
|
1199
1210
|
if (He.test(i)) {
|
|
1200
|
-
const r =
|
|
1211
|
+
const r = n[1];
|
|
1201
1212
|
if (!r.startsWith("--")) {
|
|
1202
|
-
const
|
|
1213
|
+
const c = `--${r}: ${i};
|
|
1203
1214
|
${r}: var(--${r})`;
|
|
1204
|
-
e = $e(e,
|
|
1215
|
+
e = $e(e, n.index, n[0].length, c);
|
|
1205
1216
|
}
|
|
1206
1217
|
}
|
|
1207
1218
|
}
|
|
1208
1219
|
return e;
|
|
1209
1220
|
}
|
|
1210
|
-
function
|
|
1221
|
+
function Yn(s, ...t) {
|
|
1211
1222
|
let e = Ge(s, t);
|
|
1212
1223
|
for (; ; ) {
|
|
1213
|
-
const
|
|
1214
|
-
if (!
|
|
1215
|
-
const i = Gn(
|
|
1224
|
+
const n = Fn.exec(e);
|
|
1225
|
+
if (!n || n[1] === "style") break;
|
|
1226
|
+
const i = Gn(n[2]);
|
|
1216
1227
|
if (He.test(i)) {
|
|
1217
|
-
const r = `<!-- ${i.trim()} -->`,
|
|
1218
|
-
e = $e(e,
|
|
1228
|
+
const r = `<!-- ${i.trim()} -->`, c = n.index + n[0].indexOf(">") + 1;
|
|
1229
|
+
e = $e(e, c, i.length, r);
|
|
1219
1230
|
}
|
|
1220
1231
|
}
|
|
1221
1232
|
return e;
|
|
1222
1233
|
}
|
|
1223
1234
|
export {
|
|
1224
1235
|
D as Wrec,
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1236
|
+
Wn as createElement,
|
|
1237
|
+
jn as css,
|
|
1238
|
+
Yn as html
|
|
1228
1239
|
};
|