wrec 0.20.2 → 0.20.4
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.d.ts +72 -41
- package/dist/wrec.es.js +529 -681
- package/dist/wrec.umd.js +4 -4
- package/package.json +5 -4
package/dist/wrec.es.js
CHANGED
|
@@ -1,131 +1,126 @@
|
|
|
1
|
-
var Ue = (i) => {
|
|
2
|
-
throw TypeError(i);
|
|
3
|
-
};
|
|
4
|
-
var Zt = (i, t, e) => t.has(i) || Ue("Cannot " + e);
|
|
5
|
-
var R = (i, t, e) => (Zt(i, t, "read from private field"), e ? e.call(i) : t.get(i)), j = (i, t, e) => t.has(i) ? Ue("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), ot = (i, t, e, n) => (Zt(i, t, "write to private field"), n ? n.call(i, e) : t.set(i, e), e), He = (i, t, e) => (Zt(i, t, "access private method"), e);
|
|
6
1
|
const {
|
|
7
|
-
entries:
|
|
8
|
-
setPrototypeOf:
|
|
9
|
-
isFrozen:
|
|
10
|
-
getPrototypeOf:
|
|
11
|
-
getOwnPropertyDescriptor:
|
|
2
|
+
entries: Pe,
|
|
3
|
+
setPrototypeOf: Re,
|
|
4
|
+
isFrozen: un,
|
|
5
|
+
getPrototypeOf: pn,
|
|
6
|
+
getOwnPropertyDescriptor: mn
|
|
12
7
|
} = Object;
|
|
13
8
|
let {
|
|
14
|
-
freeze:
|
|
15
|
-
seal:
|
|
16
|
-
create:
|
|
9
|
+
freeze: N,
|
|
10
|
+
seal: D,
|
|
11
|
+
create: qt
|
|
17
12
|
} = Object, {
|
|
18
|
-
apply:
|
|
19
|
-
construct:
|
|
13
|
+
apply: Kt,
|
|
14
|
+
construct: Zt
|
|
20
15
|
} = typeof Reflect < "u" && Reflect;
|
|
21
|
-
|
|
16
|
+
N || (N = function(t) {
|
|
22
17
|
return t;
|
|
23
18
|
});
|
|
24
|
-
|
|
19
|
+
D || (D = function(t) {
|
|
25
20
|
return t;
|
|
26
21
|
});
|
|
27
|
-
|
|
28
|
-
for (var n = arguments.length,
|
|
29
|
-
|
|
30
|
-
return t.apply(e,
|
|
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
|
+
i[r - 2] = arguments[r];
|
|
25
|
+
return t.apply(e, i);
|
|
31
26
|
});
|
|
32
|
-
|
|
33
|
-
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0),
|
|
34
|
-
n[
|
|
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];
|
|
35
30
|
return new t(...n);
|
|
36
31
|
});
|
|
37
|
-
const
|
|
38
|
-
function
|
|
32
|
+
const gt = w(Array.prototype.forEach), hn = w(Array.prototype.lastIndexOf), Ce = w(Array.prototype.pop), ot = w(Array.prototype.push), dn = w(Array.prototype.splice), bt = w(String.prototype.toLowerCase), Ht = w(String.prototype.toString), zt = w(String.prototype.match), it = w(String.prototype.replace), Tn = w(String.prototype.indexOf), En = w(String.prototype.trim), I = w(Object.prototype.hasOwnProperty), O = w(RegExp.prototype.test), st = gn(TypeError);
|
|
33
|
+
function w(s) {
|
|
39
34
|
return function(t) {
|
|
40
35
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
41
|
-
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0),
|
|
42
|
-
n[
|
|
43
|
-
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);
|
|
44
39
|
};
|
|
45
40
|
}
|
|
46
|
-
function
|
|
41
|
+
function gn(s) {
|
|
47
42
|
return function() {
|
|
48
43
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
49
44
|
e[n] = arguments[n];
|
|
50
|
-
return
|
|
45
|
+
return Zt(s, e);
|
|
51
46
|
};
|
|
52
47
|
}
|
|
53
|
-
function
|
|
54
|
-
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
55
|
-
|
|
48
|
+
function m(s, t) {
|
|
49
|
+
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : bt;
|
|
50
|
+
Re && Re(s, null);
|
|
56
51
|
let n = t.length;
|
|
57
52
|
for (; n--; ) {
|
|
58
|
-
let
|
|
59
|
-
if (typeof
|
|
60
|
-
const r = e(
|
|
61
|
-
r !==
|
|
53
|
+
let i = t[n];
|
|
54
|
+
if (typeof i == "string") {
|
|
55
|
+
const r = e(i);
|
|
56
|
+
r !== i && (un(t) || (t[n] = r), i = r);
|
|
62
57
|
}
|
|
63
|
-
i
|
|
58
|
+
s[i] = !0;
|
|
64
59
|
}
|
|
65
|
-
return
|
|
60
|
+
return s;
|
|
66
61
|
}
|
|
67
|
-
function
|
|
68
|
-
for (let t = 0; t <
|
|
69
|
-
|
|
70
|
-
return
|
|
62
|
+
function An(s) {
|
|
63
|
+
for (let t = 0; t < s.length; t++)
|
|
64
|
+
I(s, t) || (s[t] = null);
|
|
65
|
+
return s;
|
|
71
66
|
}
|
|
72
|
-
function
|
|
73
|
-
const t =
|
|
74
|
-
for (const [e, n] of
|
|
75
|
-
|
|
67
|
+
function v(s) {
|
|
68
|
+
const t = qt(null);
|
|
69
|
+
for (const [e, n] of Pe(s))
|
|
70
|
+
I(s, e) && (Array.isArray(n) ? t[e] = An(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = v(n) : t[e] = n);
|
|
76
71
|
return t;
|
|
77
72
|
}
|
|
78
|
-
function
|
|
79
|
-
for (;
|
|
80
|
-
const n =
|
|
73
|
+
function rt(s, t) {
|
|
74
|
+
for (; s !== null; ) {
|
|
75
|
+
const n = mn(s, t);
|
|
81
76
|
if (n) {
|
|
82
77
|
if (n.get)
|
|
83
|
-
return
|
|
78
|
+
return w(n.get);
|
|
84
79
|
if (typeof n.value == "function")
|
|
85
|
-
return
|
|
80
|
+
return w(n.value);
|
|
86
81
|
}
|
|
87
|
-
|
|
82
|
+
s = pn(s);
|
|
88
83
|
}
|
|
89
84
|
function e() {
|
|
90
85
|
return null;
|
|
91
86
|
}
|
|
92
87
|
return e;
|
|
93
88
|
}
|
|
94
|
-
const
|
|
89
|
+
const Me = N(["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 = N(["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 = N(["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 = N(["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"]), Wt = N(["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 = N(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Oe = N(["#text"]), Ne = N(["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"]), Bt = N(["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"]), we = N(["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"]), At = N(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Sn = D(/\{\{[\w\W]*|[\w\W]*\}\}/gm), yn = D(/<%[\w\W]*|[\w\W]*%>/gm), Rn = D(/\$\{[\w\W]*/gm), Cn = D(/^data-[\-\w.\u00B7-\uFFFF]+$/), Mn = D(/^aria-[\-\w]+$/), xe = D(
|
|
95
90
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
96
91
|
// eslint-disable-line no-useless-escape
|
|
97
|
-
),
|
|
92
|
+
), On = D(/^(?:\w+script|data):/i), Nn = D(
|
|
98
93
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
99
94
|
// eslint-disable-line no-control-regex
|
|
100
|
-
),
|
|
101
|
-
var
|
|
95
|
+
), ve = D(/^html$/i), wn = D(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
96
|
+
var Le = /* @__PURE__ */ Object.freeze({
|
|
102
97
|
__proto__: null,
|
|
103
|
-
ARIA_ATTR:
|
|
104
|
-
ATTR_WHITESPACE:
|
|
105
|
-
CUSTOM_ELEMENT:
|
|
106
|
-
DATA_ATTR:
|
|
107
|
-
DOCTYPE_NAME:
|
|
108
|
-
ERB_EXPR:
|
|
109
|
-
IS_ALLOWED_URI:
|
|
110
|
-
IS_SCRIPT_OR_DATA:
|
|
111
|
-
MUSTACHE_EXPR:
|
|
112
|
-
TMPLIT_EXPR:
|
|
98
|
+
ARIA_ATTR: Mn,
|
|
99
|
+
ATTR_WHITESPACE: Nn,
|
|
100
|
+
CUSTOM_ELEMENT: wn,
|
|
101
|
+
DATA_ATTR: Cn,
|
|
102
|
+
DOCTYPE_NAME: ve,
|
|
103
|
+
ERB_EXPR: yn,
|
|
104
|
+
IS_ALLOWED_URI: xe,
|
|
105
|
+
IS_SCRIPT_OR_DATA: On,
|
|
106
|
+
MUSTACHE_EXPR: Sn,
|
|
107
|
+
TMPLIT_EXPR: Rn
|
|
113
108
|
});
|
|
114
|
-
const
|
|
109
|
+
const at = {
|
|
115
110
|
element: 1,
|
|
116
111
|
text: 3,
|
|
117
112
|
// Deprecated
|
|
118
113
|
progressingInstruction: 7,
|
|
119
114
|
comment: 8,
|
|
120
115
|
document: 9
|
|
121
|
-
},
|
|
116
|
+
}, Ln = function() {
|
|
122
117
|
return typeof window > "u" ? null : window;
|
|
123
|
-
},
|
|
118
|
+
}, Dn = function(t, e) {
|
|
124
119
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
125
120
|
return null;
|
|
126
121
|
let n = null;
|
|
127
|
-
const
|
|
128
|
-
e && e.hasAttribute(
|
|
122
|
+
const i = "data-tt-policy-suffix";
|
|
123
|
+
e && e.hasAttribute(i) && (n = e.getAttribute(i));
|
|
129
124
|
const r = "dompurify" + (n ? "#" + n : "");
|
|
130
125
|
try {
|
|
131
126
|
return t.createPolicy(r, {
|
|
@@ -139,7 +134,7 @@ const mt = {
|
|
|
139
134
|
} catch {
|
|
140
135
|
return console.warn("TrustedTypes policy " + r + " could not be created."), null;
|
|
141
136
|
}
|
|
142
|
-
},
|
|
137
|
+
}, De = function() {
|
|
143
138
|
return {
|
|
144
139
|
afterSanitizeAttributes: [],
|
|
145
140
|
afterSanitizeElements: [],
|
|
@@ -152,57 +147,57 @@ const mt = {
|
|
|
152
147
|
uponSanitizeShadowNode: []
|
|
153
148
|
};
|
|
154
149
|
};
|
|
155
|
-
function
|
|
156
|
-
let
|
|
157
|
-
const t = (f) =>
|
|
158
|
-
if (t.version = "3.3.1", t.removed = [], !
|
|
150
|
+
function ke() {
|
|
151
|
+
let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Ln();
|
|
152
|
+
const t = (f) => ke(f);
|
|
153
|
+
if (t.version = "3.3.1", t.removed = [], !s || !s.document || s.document.nodeType !== at.document || !s.Element)
|
|
159
154
|
return t.isSupported = !1, t;
|
|
160
155
|
let {
|
|
161
156
|
document: e
|
|
162
|
-
} =
|
|
163
|
-
const n = e,
|
|
157
|
+
} = s;
|
|
158
|
+
const n = e, i = n.currentScript, {
|
|
164
159
|
DocumentFragment: r,
|
|
165
160
|
HTMLTemplateElement: c,
|
|
166
|
-
Node:
|
|
167
|
-
Element:
|
|
168
|
-
NodeFilter:
|
|
169
|
-
NamedNodeMap:
|
|
161
|
+
Node: h,
|
|
162
|
+
Element: u,
|
|
163
|
+
NodeFilter: p,
|
|
164
|
+
NamedNodeMap: d = s.NamedNodeMap || s.MozNamedAttrMap,
|
|
170
165
|
HTMLFormElement: b,
|
|
171
166
|
DOMParser: G,
|
|
172
|
-
trustedTypes:
|
|
173
|
-
} =
|
|
167
|
+
trustedTypes: F
|
|
168
|
+
} = s, $ = u.prototype, Be = rt($, "cloneNode"), je = rt($, "remove"), Ye = rt($, "nextSibling"), Ve = rt($, "childNodes"), ft = rt($, "parentNode");
|
|
174
169
|
if (typeof c == "function") {
|
|
175
170
|
const f = e.createElement("template");
|
|
176
171
|
f.content && f.content.ownerDocument && (e = f.content.ownerDocument);
|
|
177
172
|
}
|
|
178
|
-
let
|
|
173
|
+
let C, Q = "";
|
|
179
174
|
const {
|
|
180
|
-
implementation:
|
|
181
|
-
createNodeIterator:
|
|
182
|
-
createDocumentFragment:
|
|
183
|
-
getElementsByTagName:
|
|
175
|
+
implementation: yt,
|
|
176
|
+
createNodeIterator: Xe,
|
|
177
|
+
createDocumentFragment: qe,
|
|
178
|
+
getElementsByTagName: Ke
|
|
184
179
|
} = e, {
|
|
185
|
-
importNode:
|
|
180
|
+
importNode: Ze
|
|
186
181
|
} = n;
|
|
187
|
-
let
|
|
188
|
-
t.isSupported = typeof
|
|
182
|
+
let M = De();
|
|
183
|
+
t.isSupported = typeof Pe == "function" && typeof ft == "function" && yt && yt.createHTMLDocument !== void 0;
|
|
189
184
|
const {
|
|
190
|
-
MUSTACHE_EXPR:
|
|
191
|
-
ERB_EXPR:
|
|
192
|
-
TMPLIT_EXPR:
|
|
193
|
-
DATA_ATTR:
|
|
194
|
-
ARIA_ATTR:
|
|
195
|
-
IS_SCRIPT_OR_DATA:
|
|
196
|
-
ATTR_WHITESPACE:
|
|
197
|
-
CUSTOM_ELEMENT:
|
|
198
|
-
} =
|
|
185
|
+
MUSTACHE_EXPR: Rt,
|
|
186
|
+
ERB_EXPR: Ct,
|
|
187
|
+
TMPLIT_EXPR: Mt,
|
|
188
|
+
DATA_ATTR: Je,
|
|
189
|
+
ARIA_ATTR: Qe,
|
|
190
|
+
IS_SCRIPT_OR_DATA: tn,
|
|
191
|
+
ATTR_WHITESPACE: te,
|
|
192
|
+
CUSTOM_ELEMENT: en
|
|
193
|
+
} = Le;
|
|
199
194
|
let {
|
|
200
|
-
IS_ALLOWED_URI:
|
|
201
|
-
} =
|
|
202
|
-
const
|
|
195
|
+
IS_ALLOWED_URI: ee
|
|
196
|
+
} = Le, _ = null;
|
|
197
|
+
const ne = m({}, [...Me, ...Gt, ...$t, ...Wt, ...Oe]);
|
|
203
198
|
let S = null;
|
|
204
|
-
const
|
|
205
|
-
let E = Object.seal(
|
|
199
|
+
const oe = m({}, [...Ne, ...Bt, ...we, ...At]);
|
|
200
|
+
let E = Object.seal(qt(null, {
|
|
206
201
|
tagNameCheck: {
|
|
207
202
|
writable: !0,
|
|
208
203
|
configurable: !1,
|
|
@@ -221,8 +216,8 @@ function Qe() {
|
|
|
221
216
|
enumerable: !0,
|
|
222
217
|
value: !1
|
|
223
218
|
}
|
|
224
|
-
})),
|
|
225
|
-
const
|
|
219
|
+
})), tt = null, Ot = null;
|
|
220
|
+
const j = Object.seal(qt(null, {
|
|
226
221
|
tagCheck: {
|
|
227
222
|
writable: !0,
|
|
228
223
|
configurable: !1,
|
|
@@ -236,68 +231,68 @@ function Qe() {
|
|
|
236
231
|
value: null
|
|
237
232
|
}
|
|
238
233
|
}));
|
|
239
|
-
let
|
|
240
|
-
const
|
|
241
|
-
let
|
|
242
|
-
const
|
|
243
|
-
let
|
|
244
|
-
const
|
|
245
|
-
let
|
|
246
|
-
const
|
|
247
|
-
let
|
|
248
|
-
const
|
|
249
|
-
let
|
|
250
|
-
const
|
|
251
|
-
let
|
|
252
|
-
const
|
|
253
|
-
let A = null,
|
|
254
|
-
const
|
|
234
|
+
let ie = !0, Nt = !0, se = !1, re = !0, Y = !1, ut = !0, W = !1, wt = !1, Lt = !1, V = !1, pt = !1, mt = !1, ae = !0, ce = !1;
|
|
235
|
+
const nn = "user-content-";
|
|
236
|
+
let Dt = !0, et = !1, X = {}, P = 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
|
+
const fe = m({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
240
|
+
let Pt = null;
|
|
241
|
+
const ue = m({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ht = "http://www.w3.org/1998/Math/MathML", dt = "http://www.w3.org/2000/svg", U = "http://www.w3.org/1999/xhtml";
|
|
242
|
+
let q = U, xt = !1, vt = null;
|
|
243
|
+
const on = m({}, [ht, dt, U], Ht);
|
|
244
|
+
let Tt = m({}, ["mi", "mo", "mn", "ms", "mtext"]), Et = m({}, ["annotation-xml"]);
|
|
245
|
+
const sn = m({}, ["title", "style", "font", "a", "script"]);
|
|
246
|
+
let nt = null;
|
|
247
|
+
const rn = ["application/xhtml+xml", "text/html"], an = "text/html";
|
|
248
|
+
let A = null, K = null;
|
|
249
|
+
const cn = e.createElement("form"), pe = function(o) {
|
|
255
250
|
return o instanceof RegExp || o instanceof Function;
|
|
256
|
-
},
|
|
251
|
+
}, kt = function() {
|
|
257
252
|
let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
258
|
-
if (!(
|
|
259
|
-
if ((!o || typeof o != "object") && (o = {}), o =
|
|
260
|
-
|
|
253
|
+
if (!(K && K === o)) {
|
|
254
|
+
if ((!o || typeof o != "object") && (o = {}), o = v(o), nt = // eslint-disable-next-line unicorn/prefer-includes
|
|
255
|
+
rn.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? an : o.PARSER_MEDIA_TYPE, A = nt === "application/xhtml+xml" ? Ht : bt, _ = I(o, "ALLOWED_TAGS") ? m({}, o.ALLOWED_TAGS, A) : ne, S = I(o, "ALLOWED_ATTR") ? m({}, o.ALLOWED_ATTR, A) : oe, vt = I(o, "ALLOWED_NAMESPACES") ? m({}, o.ALLOWED_NAMESPACES, Ht) : on, Pt = I(o, "ADD_URI_SAFE_ATTR") ? m(v(ue), o.ADD_URI_SAFE_ATTR, A) : ue, le = I(o, "ADD_DATA_URI_TAGS") ? m(v(fe), o.ADD_DATA_URI_TAGS, A) : fe, P = I(o, "FORBID_CONTENTS") ? m({}, o.FORBID_CONTENTS, A) : It, tt = I(o, "FORBID_TAGS") ? m({}, o.FORBID_TAGS, A) : v({}), Ot = I(o, "FORBID_ATTR") ? m({}, o.FORBID_ATTR, A) : v({}), X = I(o, "USE_PROFILES") ? o.USE_PROFILES : !1, ie = o.ALLOW_ARIA_ATTR !== !1, Nt = 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, ut = o.SAFE_FOR_XML !== !1, W = o.WHOLE_DOCUMENT || !1, V = o.RETURN_DOM || !1, pt = o.RETURN_DOM_FRAGMENT || !1, mt = o.RETURN_TRUSTED_TYPE || !1, Lt = o.FORCE_BODY || !1, ae = o.SANITIZE_DOM !== !1, ce = o.SANITIZE_NAMED_PROPS || !1, Dt = o.KEEP_CONTENT !== !1, et = o.IN_PLACE || !1, ee = o.ALLOWED_URI_REGEXP || xe, q = o.NAMESPACE || U, Tt = o.MATHML_TEXT_INTEGRATION_POINTS || Tt, Et = o.HTML_INTEGRATION_POINTS || Et, 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 && (Nt = !1), pt && (V = !0), X && (_ = m({}, Oe), S = [], X.html === !0 && (m(_, Me), m(S, Ne)), X.svg === !0 && (m(_, Gt), m(S, Bt), m(S, At)), X.svgFilters === !0 && (m(_, $t), m(S, Bt), m(S, At)), X.mathMl === !0 && (m(_, Wt), m(S, we), m(S, At))), o.ADD_TAGS && (typeof o.ADD_TAGS == "function" ? j.tagCheck = o.ADD_TAGS : (_ === ne && (_ = v(_)), m(_, o.ADD_TAGS, A))), o.ADD_ATTR && (typeof o.ADD_ATTR == "function" ? j.attributeCheck = o.ADD_ATTR : (S === oe && (S = v(S)), m(S, o.ADD_ATTR, A))), o.ADD_URI_SAFE_ATTR && m(Pt, o.ADD_URI_SAFE_ATTR, A), o.FORBID_CONTENTS && (P === It && (P = v(P)), m(P, o.FORBID_CONTENTS, A)), o.ADD_FORBID_CONTENTS && (P === It && (P = v(P)), m(P, o.ADD_FORBID_CONTENTS, A)), Dt && (_["#text"] = !0), W && m(_, ["html", "head", "body"]), _.table && (m(_, ["tbody"]), delete tt.tbody), o.TRUSTED_TYPES_POLICY) {
|
|
261
256
|
if (typeof o.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
262
|
-
throw
|
|
257
|
+
throw st('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
263
258
|
if (typeof o.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
264
|
-
throw
|
|
265
|
-
|
|
259
|
+
throw st('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
260
|
+
C = o.TRUSTED_TYPES_POLICY, Q = C.createHTML("");
|
|
266
261
|
} else
|
|
267
|
-
|
|
268
|
-
|
|
262
|
+
C === void 0 && (C = Dn(F, i)), C !== null && typeof Q == "string" && (Q = C.createHTML(""));
|
|
263
|
+
N && N(o), K = o;
|
|
269
264
|
}
|
|
270
|
-
},
|
|
271
|
-
let a =
|
|
265
|
+
}, me = m({}, [...Gt, ...$t, ..._n]), he = m({}, [...Wt, ...bn]), ln = function(o) {
|
|
266
|
+
let a = ft(o);
|
|
272
267
|
(!a || !a.tagName) && (a = {
|
|
273
|
-
namespaceURI:
|
|
268
|
+
namespaceURI: q,
|
|
274
269
|
tagName: "template"
|
|
275
270
|
});
|
|
276
|
-
const l =
|
|
277
|
-
return
|
|
271
|
+
const l = bt(o.tagName), T = bt(a.tagName);
|
|
272
|
+
return vt[o.namespaceURI] ? o.namespaceURI === dt ? a.namespaceURI === U ? l === "svg" : a.namespaceURI === ht ? l === "svg" && (T === "annotation-xml" || Tt[T]) : !!me[l] : o.namespaceURI === ht ? a.namespaceURI === U ? l === "math" : a.namespaceURI === dt ? l === "math" && Et[T] : !!he[l] : o.namespaceURI === U ? a.namespaceURI === dt && !Et[T] || a.namespaceURI === ht && !Tt[T] ? !1 : !he[l] && (sn[l] || !me[l]) : !!(nt === "application/xhtml+xml" && vt[o.namespaceURI]) : !1;
|
|
278
273
|
}, x = function(o) {
|
|
279
|
-
|
|
274
|
+
ot(t.removed, {
|
|
280
275
|
element: o
|
|
281
276
|
});
|
|
282
277
|
try {
|
|
283
|
-
|
|
278
|
+
ft(o).removeChild(o);
|
|
284
279
|
} catch {
|
|
285
|
-
|
|
280
|
+
je(o);
|
|
286
281
|
}
|
|
287
|
-
},
|
|
282
|
+
}, B = function(o, a) {
|
|
288
283
|
try {
|
|
289
|
-
|
|
284
|
+
ot(t.removed, {
|
|
290
285
|
attribute: a.getAttributeNode(o),
|
|
291
286
|
from: a
|
|
292
287
|
});
|
|
293
288
|
} catch {
|
|
294
|
-
|
|
289
|
+
ot(t.removed, {
|
|
295
290
|
attribute: null,
|
|
296
291
|
from: a
|
|
297
292
|
});
|
|
298
293
|
}
|
|
299
294
|
if (a.removeAttribute(o), o === "is")
|
|
300
|
-
if (
|
|
295
|
+
if (V || pt)
|
|
301
296
|
try {
|
|
302
297
|
x(a);
|
|
303
298
|
} catch {
|
|
@@ -307,97 +302,97 @@ function Qe() {
|
|
|
307
302
|
a.setAttribute(o, "");
|
|
308
303
|
} catch {
|
|
309
304
|
}
|
|
310
|
-
},
|
|
305
|
+
}, de = function(o) {
|
|
311
306
|
let a = null, l = null;
|
|
312
|
-
if (
|
|
307
|
+
if (Lt)
|
|
313
308
|
o = "<remove></remove>" + o;
|
|
314
309
|
else {
|
|
315
|
-
const g =
|
|
310
|
+
const g = zt(o, /^[\r\n\t ]+/);
|
|
316
311
|
l = g && g[0];
|
|
317
312
|
}
|
|
318
|
-
|
|
319
|
-
const T =
|
|
320
|
-
if (
|
|
313
|
+
nt === "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
|
+
if (q === U)
|
|
321
316
|
try {
|
|
322
|
-
a = new G().parseFromString(T,
|
|
317
|
+
a = new G().parseFromString(T, nt);
|
|
323
318
|
} catch {
|
|
324
319
|
}
|
|
325
320
|
if (!a || !a.documentElement) {
|
|
326
|
-
a =
|
|
321
|
+
a = yt.createDocument(q, "template", null);
|
|
327
322
|
try {
|
|
328
|
-
a.documentElement.innerHTML =
|
|
323
|
+
a.documentElement.innerHTML = xt ? Q : T;
|
|
329
324
|
} catch {
|
|
330
325
|
}
|
|
331
326
|
}
|
|
332
|
-
const
|
|
333
|
-
return o && l &&
|
|
334
|
-
},
|
|
335
|
-
return
|
|
327
|
+
const R = a.body || a.documentElement;
|
|
328
|
+
return o && l && R.insertBefore(e.createTextNode(l), R.childNodes[0] || null), q === U ? Ke.call(a, W ? "html" : "body")[0] : W ? a.documentElement : R;
|
|
329
|
+
}, Te = function(o) {
|
|
330
|
+
return Xe.call(
|
|
336
331
|
o.ownerDocument || o,
|
|
337
332
|
o,
|
|
338
333
|
// eslint-disable-next-line no-bitwise
|
|
339
|
-
|
|
334
|
+
p.SHOW_ELEMENT | p.SHOW_COMMENT | p.SHOW_TEXT | p.SHOW_PROCESSING_INSTRUCTION | p.SHOW_CDATA_SECTION,
|
|
340
335
|
null
|
|
341
336
|
);
|
|
342
|
-
},
|
|
343
|
-
return o instanceof b && (typeof o.nodeName != "string" || typeof o.textContent != "string" || typeof o.removeChild != "function" || !(o.attributes instanceof
|
|
344
|
-
},
|
|
345
|
-
return typeof
|
|
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;
|
|
346
341
|
};
|
|
347
|
-
function
|
|
348
|
-
|
|
349
|
-
l.call(t, o, a,
|
|
342
|
+
function H(f, o, a) {
|
|
343
|
+
gt(f, (l) => {
|
|
344
|
+
l.call(t, o, a, K);
|
|
350
345
|
});
|
|
351
346
|
}
|
|
352
|
-
const
|
|
347
|
+
const ge = function(o) {
|
|
353
348
|
let a = null;
|
|
354
|
-
if (
|
|
349
|
+
if (H(M.beforeSanitizeElements, o, null), Ft(o))
|
|
355
350
|
return x(o), !0;
|
|
356
351
|
const l = A(o.nodeName);
|
|
357
|
-
if (
|
|
352
|
+
if (H(M.uponSanitizeElement, o, {
|
|
358
353
|
tagName: l,
|
|
359
354
|
allowedTags: _
|
|
360
|
-
}),
|
|
355
|
+
}), ut && o.hasChildNodes() && !Ee(o.firstElementChild) && O(/<[/\w!]/g, o.innerHTML) && O(/<[/\w!]/g, o.textContent) || o.nodeType === at.progressingInstruction || ut && o.nodeType === at.comment && O(/<[/\w]/g, o.data))
|
|
361
356
|
return x(o), !0;
|
|
362
|
-
if (!(
|
|
363
|
-
if (!
|
|
357
|
+
if (!(j.tagCheck instanceof Function && j.tagCheck(l)) && (!_[l] || tt[l])) {
|
|
358
|
+
if (!tt[l] && _e(l) && (E.tagNameCheck instanceof RegExp && O(E.tagNameCheck, l) || E.tagNameCheck instanceof Function && E.tagNameCheck(l)))
|
|
364
359
|
return !1;
|
|
365
|
-
if (
|
|
366
|
-
const T =
|
|
367
|
-
if (
|
|
368
|
-
const g =
|
|
369
|
-
for (let
|
|
370
|
-
const
|
|
371
|
-
|
|
360
|
+
if (Dt && !P[l]) {
|
|
361
|
+
const T = ft(o) || o.parentNode, R = Ve(o) || o.childNodes;
|
|
362
|
+
if (R && T) {
|
|
363
|
+
const g = R.length;
|
|
364
|
+
for (let L = g - 1; L >= 0; --L) {
|
|
365
|
+
const z = Be(R[L], !0);
|
|
366
|
+
z.__removalCount = (o.__removalCount || 0) + 1, T.insertBefore(z, Ye(o));
|
|
372
367
|
}
|
|
373
368
|
}
|
|
374
369
|
}
|
|
375
370
|
return x(o), !0;
|
|
376
371
|
}
|
|
377
|
-
return o instanceof
|
|
378
|
-
a =
|
|
379
|
-
}), o.textContent !== a && (
|
|
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 === at.text && (a = o.textContent, gt([Rt, Ct, Mt], (T) => {
|
|
373
|
+
a = it(a, T, " ");
|
|
374
|
+
}), o.textContent !== a && (ot(t.removed, {
|
|
380
375
|
element: o.cloneNode()
|
|
381
|
-
}), o.textContent = a)),
|
|
382
|
-
},
|
|
383
|
-
if (
|
|
376
|
+
}), o.textContent = a)), H(M.afterSanitizeElements, o, null), !1);
|
|
377
|
+
}, Ae = function(o, a, l) {
|
|
378
|
+
if (ae && (a === "id" || a === "name") && (l in e || l in cn))
|
|
384
379
|
return !1;
|
|
385
|
-
if (!(
|
|
386
|
-
if (!(
|
|
387
|
-
if (!(
|
|
388
|
-
if (!S[a] ||
|
|
380
|
+
if (!(Nt && !Ot[a] && O(Je, a))) {
|
|
381
|
+
if (!(ie && O(Qe, a))) {
|
|
382
|
+
if (!(j.attributeCheck instanceof Function && j.attributeCheck(a, o))) {
|
|
383
|
+
if (!S[a] || Ot[a]) {
|
|
389
384
|
if (
|
|
390
385
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
391
386
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
392
387
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
393
|
-
!(
|
|
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
|
|
394
389
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
395
|
-
a === "is" && E.allowCustomizedBuiltInElements && (E.tagNameCheck instanceof RegExp &&
|
|
390
|
+
a === "is" && E.allowCustomizedBuiltInElements && (E.tagNameCheck instanceof RegExp && O(E.tagNameCheck, l) || E.tagNameCheck instanceof Function && E.tagNameCheck(l)))
|
|
396
391
|
) return !1;
|
|
397
|
-
} else if (!
|
|
398
|
-
if (!
|
|
399
|
-
if (!((a === "src" || a === "xlink:href" || a === "href") && o !== "script" &&
|
|
400
|
-
if (!(
|
|
392
|
+
} else if (!Pt[a]) {
|
|
393
|
+
if (!O(ee, it(l, te, ""))) {
|
|
394
|
+
if (!((a === "src" || a === "xlink:href" || a === "href") && o !== "script" && Tn(l, "data:") === 0 && le[o])) {
|
|
395
|
+
if (!(se && !O(tn, it(l, te, "")))) {
|
|
401
396
|
if (l)
|
|
402
397
|
return !1;
|
|
403
398
|
}
|
|
@@ -408,14 +403,14 @@ function Qe() {
|
|
|
408
403
|
}
|
|
409
404
|
}
|
|
410
405
|
return !0;
|
|
411
|
-
},
|
|
412
|
-
return o !== "annotation-xml" &&
|
|
413
|
-
},
|
|
414
|
-
|
|
406
|
+
}, _e = function(o) {
|
|
407
|
+
return o !== "annotation-xml" && zt(o, en);
|
|
408
|
+
}, be = function(o) {
|
|
409
|
+
H(M.beforeSanitizeAttributes, o, null);
|
|
415
410
|
const {
|
|
416
411
|
attributes: a
|
|
417
412
|
} = o;
|
|
418
|
-
if (!a ||
|
|
413
|
+
if (!a || Ft(o))
|
|
419
414
|
return;
|
|
420
415
|
const l = {
|
|
421
416
|
attrName: "",
|
|
@@ -426,292 +421,146 @@ function Qe() {
|
|
|
426
421
|
};
|
|
427
422
|
let T = a.length;
|
|
428
423
|
for (; T--; ) {
|
|
429
|
-
const
|
|
424
|
+
const R = a[T], {
|
|
430
425
|
name: g,
|
|
431
|
-
namespaceURI:
|
|
432
|
-
value:
|
|
433
|
-
} =
|
|
434
|
-
let y = g === "value" ?
|
|
435
|
-
if (l.attrName =
|
|
436
|
-
|
|
426
|
+
namespaceURI: L,
|
|
427
|
+
value: z
|
|
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(M.uponSanitizeAttribute, o, l), y = l.attrValue, ce && (Z === "id" || Z === "name") && (B(g, o), y = nn + y), ut && O(/((--!?|])>)|<\/(style|title|textarea)/i, y)) {
|
|
431
|
+
B(g, o);
|
|
437
432
|
continue;
|
|
438
433
|
}
|
|
439
|
-
if (
|
|
440
|
-
|
|
434
|
+
if (Z === "attributename" && zt(y, "href")) {
|
|
435
|
+
B(g, o);
|
|
441
436
|
continue;
|
|
442
437
|
}
|
|
443
438
|
if (l.forceKeepAttr)
|
|
444
439
|
continue;
|
|
445
440
|
if (!l.keepAttr) {
|
|
446
|
-
|
|
441
|
+
B(g, o);
|
|
447
442
|
continue;
|
|
448
443
|
}
|
|
449
|
-
if (!
|
|
450
|
-
|
|
444
|
+
if (!re && O(/\/>/i, y)) {
|
|
445
|
+
B(g, o);
|
|
451
446
|
continue;
|
|
452
447
|
}
|
|
453
|
-
|
|
454
|
-
y =
|
|
448
|
+
Y && gt([Rt, Ct, Mt], (ye) => {
|
|
449
|
+
y = it(y, ye, " ");
|
|
455
450
|
});
|
|
456
|
-
const
|
|
457
|
-
if (!
|
|
458
|
-
|
|
451
|
+
const Se = A(o.nodeName);
|
|
452
|
+
if (!Ae(Se, Z, y)) {
|
|
453
|
+
B(g, o);
|
|
459
454
|
continue;
|
|
460
455
|
}
|
|
461
|
-
if (
|
|
462
|
-
switch (
|
|
456
|
+
if (C && typeof F == "object" && typeof F.getAttributeType == "function" && !L)
|
|
457
|
+
switch (F.getAttributeType(Se, Z)) {
|
|
463
458
|
case "TrustedHTML": {
|
|
464
|
-
y =
|
|
459
|
+
y = C.createHTML(y);
|
|
465
460
|
break;
|
|
466
461
|
}
|
|
467
462
|
case "TrustedScriptURL": {
|
|
468
|
-
y =
|
|
463
|
+
y = C.createScriptURL(y);
|
|
469
464
|
break;
|
|
470
465
|
}
|
|
471
466
|
}
|
|
472
|
-
if (y !==
|
|
467
|
+
if (y !== Ut)
|
|
473
468
|
try {
|
|
474
|
-
|
|
469
|
+
L ? o.setAttributeNS(L, g, y) : o.setAttribute(g, y), Ft(o) ? x(o) : Ce(t.removed);
|
|
475
470
|
} catch {
|
|
476
|
-
|
|
471
|
+
B(g, o);
|
|
477
472
|
}
|
|
478
473
|
}
|
|
479
|
-
|
|
480
|
-
},
|
|
474
|
+
H(M.afterSanitizeAttributes, o, null);
|
|
475
|
+
}, fn = function f(o) {
|
|
481
476
|
let a = null;
|
|
482
|
-
const l =
|
|
483
|
-
for (
|
|
484
|
-
|
|
485
|
-
|
|
477
|
+
const l = Te(o);
|
|
478
|
+
for (H(M.beforeSanitizeShadowDOM, o, null); a = l.nextNode(); )
|
|
479
|
+
H(M.uponSanitizeShadowNode, a, null), ge(a), be(a), a.content instanceof r && f(a.content);
|
|
480
|
+
H(M.afterSanitizeShadowDOM, o, null);
|
|
486
481
|
};
|
|
487
482
|
return t.sanitize = function(f) {
|
|
488
|
-
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, l = null, T = null,
|
|
489
|
-
if (
|
|
483
|
+
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, l = null, T = null, R = null;
|
|
484
|
+
if (xt = !f, xt && (f = "<!-->"), typeof f != "string" && !Ee(f))
|
|
490
485
|
if (typeof f.toString == "function") {
|
|
491
486
|
if (f = f.toString(), typeof f != "string")
|
|
492
|
-
throw
|
|
487
|
+
throw st("dirty is not a string, aborting");
|
|
493
488
|
} else
|
|
494
|
-
throw
|
|
489
|
+
throw st("toString is not a function");
|
|
495
490
|
if (!t.isSupported)
|
|
496
491
|
return f;
|
|
497
|
-
if (
|
|
492
|
+
if (wt || kt(o), t.removed = [], typeof f == "string" && (et = !1), et) {
|
|
498
493
|
if (f.nodeName) {
|
|
499
|
-
const
|
|
500
|
-
if (!_[
|
|
501
|
-
throw
|
|
494
|
+
const z = A(f.nodeName);
|
|
495
|
+
if (!_[z] || tt[z])
|
|
496
|
+
throw st("root node is forbidden and cannot be sanitized in-place");
|
|
502
497
|
}
|
|
503
|
-
} else if (f instanceof
|
|
504
|
-
a =
|
|
498
|
+
} else if (f instanceof h)
|
|
499
|
+
a = de("<!---->"), l = a.ownerDocument.importNode(f, !0), l.nodeType === at.element && l.nodeName === "BODY" || l.nodeName === "HTML" ? a = l : a.appendChild(l);
|
|
505
500
|
else {
|
|
506
|
-
if (!
|
|
501
|
+
if (!V && !Y && !W && // eslint-disable-next-line unicorn/prefer-includes
|
|
507
502
|
f.indexOf("<") === -1)
|
|
508
|
-
return
|
|
509
|
-
if (a =
|
|
510
|
-
return
|
|
503
|
+
return C && mt ? C.createHTML(f) : f;
|
|
504
|
+
if (a = de(f), !a)
|
|
505
|
+
return V ? null : mt ? Q : "";
|
|
511
506
|
}
|
|
512
|
-
a &&
|
|
513
|
-
const g =
|
|
507
|
+
a && Lt && x(a.firstChild);
|
|
508
|
+
const g = Te(et ? f : a);
|
|
514
509
|
for (; T = g.nextNode(); )
|
|
515
|
-
|
|
516
|
-
if (
|
|
510
|
+
ge(T), be(T), T.content instanceof r && fn(T.content);
|
|
511
|
+
if (et)
|
|
517
512
|
return f;
|
|
518
|
-
if (
|
|
519
|
-
if (
|
|
520
|
-
for (
|
|
521
|
-
|
|
513
|
+
if (V) {
|
|
514
|
+
if (pt)
|
|
515
|
+
for (R = qe.call(a.ownerDocument); a.firstChild; )
|
|
516
|
+
R.appendChild(a.firstChild);
|
|
522
517
|
else
|
|
523
|
-
|
|
524
|
-
return (S.shadowroot || S.shadowrootmode) && (
|
|
518
|
+
R = a;
|
|
519
|
+
return (S.shadowroot || S.shadowrootmode) && (R = Ze.call(n, R, !0)), R;
|
|
525
520
|
}
|
|
526
|
-
let
|
|
527
|
-
return
|
|
528
|
-
` +
|
|
529
|
-
|
|
530
|
-
}),
|
|
521
|
+
let L = W ? a.outerHTML : a.innerHTML;
|
|
522
|
+
return W && _["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && O(ve, a.ownerDocument.doctype.name) && (L = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
|
|
523
|
+
` + L), Y && gt([Rt, Ct, Mt], (z) => {
|
|
524
|
+
L = it(L, z, " ");
|
|
525
|
+
}), C && mt ? C.createHTML(L) : L;
|
|
531
526
|
}, t.setConfig = function() {
|
|
532
527
|
let f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
533
|
-
|
|
528
|
+
kt(f), wt = !0;
|
|
534
529
|
}, t.clearConfig = function() {
|
|
535
|
-
|
|
530
|
+
K = null, wt = !1;
|
|
536
531
|
}, t.isValidAttribute = function(f, o, a) {
|
|
537
|
-
|
|
532
|
+
K || kt({});
|
|
538
533
|
const l = A(f), T = A(o);
|
|
539
|
-
return
|
|
534
|
+
return Ae(l, T, a);
|
|
540
535
|
}, t.addHook = function(f, o) {
|
|
541
|
-
typeof o == "function" &&
|
|
536
|
+
typeof o == "function" && ot(M[f], o);
|
|
542
537
|
}, t.removeHook = function(f, o) {
|
|
543
538
|
if (o !== void 0) {
|
|
544
|
-
const a =
|
|
545
|
-
return a === -1 ? void 0 :
|
|
539
|
+
const a = hn(M[f], o);
|
|
540
|
+
return a === -1 ? void 0 : dn(M[f], a, 1)[0];
|
|
546
541
|
}
|
|
547
|
-
return
|
|
542
|
+
return Ce(M[f]);
|
|
548
543
|
}, t.removeHooks = function(f) {
|
|
549
|
-
|
|
544
|
+
M[f] = [];
|
|
550
545
|
}, t.removeAllHooks = function() {
|
|
551
|
-
|
|
546
|
+
M = De();
|
|
552
547
|
}, t;
|
|
553
548
|
}
|
|
554
|
-
var
|
|
555
|
-
function
|
|
556
|
-
let e =
|
|
549
|
+
var Fe = ke();
|
|
550
|
+
function Ie(s, t) {
|
|
551
|
+
let e = s;
|
|
557
552
|
for (const n of t.split("."))
|
|
558
553
|
e = e[n];
|
|
559
554
|
return e;
|
|
560
555
|
}
|
|
561
|
-
function
|
|
562
|
-
const n = t.split("."),
|
|
563
|
-
let r =
|
|
564
|
-
n.forEach((c,
|
|
565
|
-
|
|
556
|
+
function In(s, t, e) {
|
|
557
|
+
const n = t.split("."), i = n.length - 1;
|
|
558
|
+
let r = s;
|
|
559
|
+
n.forEach((c, h) => {
|
|
560
|
+
h === i ? r[c] = e : r = r[c];
|
|
566
561
|
});
|
|
567
562
|
}
|
|
568
|
-
|
|
569
|
-
const n = /* @__PURE__ */ new WeakMap(), s = {
|
|
570
|
-
// Intercept property reads.
|
|
571
|
-
// This creates nested proxies lazily.
|
|
572
|
-
get(r, c) {
|
|
573
|
-
const u = Reflect.get(r, c);
|
|
574
|
-
if (u === null || typeof u != "object") return u;
|
|
575
|
-
const p = n.get(u);
|
|
576
|
-
if (p) return p;
|
|
577
|
-
const h = e ? `${e}.${c}` : c, m = en(u, t, h);
|
|
578
|
-
return n.set(u, m), m;
|
|
579
|
-
},
|
|
580
|
-
// Intercept property writes.
|
|
581
|
-
set(r, c, u) {
|
|
582
|
-
const p = Reflect.get(r, c);
|
|
583
|
-
if (p !== u) {
|
|
584
|
-
Reflect.set(r, c, u);
|
|
585
|
-
const h = e ? `${e}.${c}` : c;
|
|
586
|
-
t(h, p, u);
|
|
587
|
-
}
|
|
588
|
-
return !0;
|
|
589
|
-
}
|
|
590
|
-
};
|
|
591
|
-
return new Proxy(i, s);
|
|
592
|
-
}
|
|
593
|
-
function nn(i) {
|
|
594
|
-
const t = {};
|
|
595
|
-
for (const [e, n] of Object.entries(i)) {
|
|
596
|
-
const s = typeof n == "object" && n !== null;
|
|
597
|
-
t[e] = s ? nn(n) : n;
|
|
598
|
-
}
|
|
599
|
-
return t;
|
|
600
|
-
}
|
|
601
|
-
const Dt = typeof window < "u" && typeof window.document < "u";
|
|
602
|
-
let qe = class extends Error {
|
|
603
|
-
};
|
|
604
|
-
var q, Pt, F, Et, gt, Y, vt, on;
|
|
605
|
-
const it = class it {
|
|
606
|
-
constructor(t, e, n) {
|
|
607
|
-
j(this, vt);
|
|
608
|
-
j(this, Pt, /* @__PURE__ */ Symbol("objectId"));
|
|
609
|
-
// This cannot be replaced by a WeakMap<ChangeListener, Set<string>>
|
|
610
|
-
// because there is no way to iterate over the keys of a WeakMap.
|
|
611
|
-
j(this, F, []);
|
|
612
|
-
j(this, Et);
|
|
613
|
-
j(this, gt);
|
|
614
|
-
j(this, Y);
|
|
615
|
-
if (!t) throw new qe("name cannot be empty");
|
|
616
|
-
if (R(it, q).has(t))
|
|
617
|
-
throw new qe(`WrecState with name "${t}" already exists`);
|
|
618
|
-
if (ot(this, Et, t), ot(this, gt, e), ot(this, Y, en({}, He(this, vt, on).bind(this))), e && Dt) {
|
|
619
|
-
const s = sessionStorage.getItem("wrec-state-" + t), r = s ? JSON.parse(s) : void 0;
|
|
620
|
-
r && (n = r);
|
|
621
|
-
}
|
|
622
|
-
if (n)
|
|
623
|
-
for (const [s, r] of Object.entries(n))
|
|
624
|
-
this.addProperty(s, r);
|
|
625
|
-
R(it, q).set(t, this);
|
|
626
|
-
}
|
|
627
|
-
// This static method is useful for accessing a specific WrecState object
|
|
628
|
-
// from the DevTools console. For example:
|
|
629
|
-
// state = WrecState.get('vault');
|
|
630
|
-
//
|
|
631
|
-
// WrecState object properties are accessed via nested Proxy objects
|
|
632
|
-
// so all changes can be monitored.
|
|
633
|
-
//
|
|
634
|
-
// Properties can be directly modified as follows:
|
|
635
|
-
// state.color = 'blue';
|
|
636
|
-
// state.team.leader.name = 'Mark';
|
|
637
|
-
static get(t) {
|
|
638
|
-
return R(this, q).get(t);
|
|
639
|
-
}
|
|
640
|
-
/**
|
|
641
|
-
* @param listener - object that has a "changed" method
|
|
642
|
-
* @param map - map from state property paths to component properties
|
|
643
|
-
*/
|
|
644
|
-
addListener(t, e = {}) {
|
|
645
|
-
const n = R(this, F).find(
|
|
646
|
-
(s) => s.listenerRef.deref() === t
|
|
647
|
-
);
|
|
648
|
-
if (n) {
|
|
649
|
-
const { propertyMap: s } = n;
|
|
650
|
-
for (const [r, c] of Object.entries(e))
|
|
651
|
-
s[r] = c;
|
|
652
|
-
} else
|
|
653
|
-
R(this, F).push({
|
|
654
|
-
listenerRef: new WeakRef(t),
|
|
655
|
-
propertyMap: e
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
addProperty(t, e) {
|
|
659
|
-
Object.defineProperty(this, t, {
|
|
660
|
-
enumerable: !0,
|
|
661
|
-
get() {
|
|
662
|
-
return R(this, Y)[t];
|
|
663
|
-
},
|
|
664
|
-
set(n) {
|
|
665
|
-
R(this, Y)[t] = n;
|
|
666
|
-
}
|
|
667
|
-
}), R(this, Y)[t] = e;
|
|
668
|
-
}
|
|
669
|
-
get id() {
|
|
670
|
-
return R(this, Pt);
|
|
671
|
-
}
|
|
672
|
-
// This is useful for debugging from the DevTools console.
|
|
673
|
-
// For example: state.log()
|
|
674
|
-
log() {
|
|
675
|
-
console.log("WrecState:", R(this, Et));
|
|
676
|
-
for (const [t, e] of Object.entries(R(this, Y)))
|
|
677
|
-
console.log(` ${t} = ${JSON.stringify(e)}`);
|
|
678
|
-
}
|
|
679
|
-
removeListener(t) {
|
|
680
|
-
ot(this, F, R(this, F).filter((e) => e.listenerRef.deref() !== t));
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
q = new WeakMap(), Pt = new WeakMap(), F = new WeakMap(), Et = new WeakMap(), gt = new WeakMap(), Y = new WeakMap(), vt = new WeakSet(), on = function(t, e, n) {
|
|
684
|
-
const s = /* @__PURE__ */ new Set();
|
|
685
|
-
for (const r of R(this, F)) {
|
|
686
|
-
const c = r.listenerRef.deref();
|
|
687
|
-
if (!c)
|
|
688
|
-
s.add(r);
|
|
689
|
-
else if (Dt && c instanceof HTMLElement && !c.isConnected)
|
|
690
|
-
s.add(r);
|
|
691
|
-
else {
|
|
692
|
-
const { propertyMap: u } = r, p = Object.keys(u);
|
|
693
|
-
(p.length === 0 || p.includes(t)) && c.changed(
|
|
694
|
-
t,
|
|
695
|
-
u[t],
|
|
696
|
-
n,
|
|
697
|
-
e,
|
|
698
|
-
this
|
|
699
|
-
);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
ot(this, F, R(this, F).filter(
|
|
703
|
-
(r) => !s.has(r)
|
|
704
|
-
));
|
|
705
|
-
}, j(it, q, /* @__PURE__ */ new Map()), Dt && window.addEventListener("beforeunload", () => {
|
|
706
|
-
for (const [t, e] of R(it, q).entries())
|
|
707
|
-
if (R(e, gt)) {
|
|
708
|
-
const n = nn(e);
|
|
709
|
-
sessionStorage.setItem("wrec-state-" + t, JSON.stringify(n));
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
let ue = it;
|
|
713
|
-
Dt && process.env.NODE_ENV === "development" && (window.WrecState = ue);
|
|
714
|
-
const Qn = /* @__PURE__ */ new Set([
|
|
563
|
+
const Pn = /* @__PURE__ */ new Set([
|
|
715
564
|
"onblur",
|
|
716
565
|
"onchange",
|
|
717
566
|
"onclick",
|
|
@@ -721,100 +570,100 @@ const Qn = /* @__PURE__ */ new Set([
|
|
|
721
570
|
"onreset",
|
|
722
571
|
"onsubmit"
|
|
723
572
|
]);
|
|
724
|
-
|
|
573
|
+
Fe.addHook("uponSanitizeAttribute", (s, t) => {
|
|
725
574
|
const { attrName: e } = t, n = e.toLowerCase();
|
|
726
|
-
|
|
575
|
+
Pn.has(n) && (t.forceKeepAttr = !0);
|
|
727
576
|
});
|
|
728
|
-
class
|
|
577
|
+
class J extends Error {
|
|
729
578
|
}
|
|
730
|
-
const
|
|
731
|
-
function
|
|
732
|
-
return
|
|
579
|
+
const xn = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, Ue = "a-zA-Z_$", vn = Ue + "0-9", lt = `[${Ue}][${vn}]*`, kn = /<!--\s*(.*?)\s*-->/, Fn = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, jt = new RegExp(`^this\\.${lt}$`), Yt = new RegExp(`this\\.${lt}(\\.${lt})*`, "g"), He = new RegExp(`this\\.${lt}(\\.${lt})*`), Un = /* @__PURE__ */ new Set(["class", "style"]), ze = 5;
|
|
580
|
+
function Hn(s) {
|
|
581
|
+
return s instanceof HTMLButtonElement || s instanceof HTMLFieldSetElement || s instanceof HTMLInputElement || s instanceof HTMLSelectElement || s instanceof HTMLTextAreaElement || s instanceof k;
|
|
733
582
|
}
|
|
734
|
-
function
|
|
735
|
-
const n = document.createElement(
|
|
583
|
+
function Bn(s, t, e) {
|
|
584
|
+
const n = document.createElement(s);
|
|
736
585
|
if (t)
|
|
737
|
-
for (const [
|
|
738
|
-
n.setAttribute(
|
|
586
|
+
for (const [i, r] of Object.entries(t))
|
|
587
|
+
n.setAttribute(i, r);
|
|
739
588
|
return e && (n.innerHTML = e), n;
|
|
740
589
|
}
|
|
741
|
-
const
|
|
742
|
-
function
|
|
590
|
+
const zn = (s) => s === String ? "" : s === Number ? 0 : s === Boolean ? !1 : s === Array ? [] : s === Object ? {} : void 0;
|
|
591
|
+
function St(s) {
|
|
743
592
|
const t = [];
|
|
744
|
-
let e =
|
|
593
|
+
let e = s.firstElementChild;
|
|
745
594
|
for (; e; )
|
|
746
|
-
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;
|
|
747
596
|
return t;
|
|
748
597
|
}
|
|
749
|
-
const
|
|
750
|
-
function
|
|
751
|
-
let e =
|
|
752
|
-
return t.forEach((n,
|
|
753
|
-
e += n + i
|
|
598
|
+
const _t = (s) => s.substring(ze).split(".")[0];
|
|
599
|
+
function Ge(s, t) {
|
|
600
|
+
let e = s[0];
|
|
601
|
+
return t.forEach((n, i) => {
|
|
602
|
+
e += n + s[i + 1];
|
|
754
603
|
}), e;
|
|
755
604
|
}
|
|
756
|
-
function
|
|
757
|
-
const t = typeof
|
|
605
|
+
function Jt(s) {
|
|
606
|
+
const t = typeof s;
|
|
758
607
|
return t === "string" || t === "number" || t === "boolean";
|
|
759
608
|
}
|
|
760
|
-
function
|
|
761
|
-
return
|
|
609
|
+
function ct(s) {
|
|
610
|
+
return s.localName === "textarea";
|
|
762
611
|
}
|
|
763
|
-
function
|
|
764
|
-
const { localName: t } =
|
|
612
|
+
function Qt(s) {
|
|
613
|
+
const { localName: t } = s;
|
|
765
614
|
return t === "input" || t === "select";
|
|
766
615
|
}
|
|
767
|
-
const
|
|
768
|
-
function
|
|
769
|
-
return
|
|
616
|
+
const Gn = (s) => s.replace(/<!--[\s\S]*?-->/g, "");
|
|
617
|
+
function $e(s, t, e, n) {
|
|
618
|
+
return s.slice(0, t) + n + s.slice(t + e);
|
|
770
619
|
}
|
|
771
|
-
function
|
|
772
|
-
let t =
|
|
620
|
+
function $n(s) {
|
|
621
|
+
let t = s.trim(), e = null;
|
|
773
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");
|
|
774
|
-
const n =
|
|
623
|
+
const n = Fe.sanitize(t, {
|
|
775
624
|
ADD_TAGS: ["#comment"],
|
|
776
625
|
ALLOW_UNKNOWN_PROTOCOLS: !0,
|
|
777
626
|
RETURN_DOM_FRAGMENT: !0
|
|
778
627
|
});
|
|
779
628
|
if (e) {
|
|
780
|
-
const
|
|
781
|
-
if (
|
|
629
|
+
const i = n.querySelector(e);
|
|
630
|
+
if (i) return i.childNodes;
|
|
782
631
|
}
|
|
783
632
|
return n.childNodes;
|
|
784
633
|
}
|
|
785
|
-
function
|
|
786
|
-
const t = Number(
|
|
787
|
-
if (isNaN(t)) throw new
|
|
634
|
+
function Vt(s) {
|
|
635
|
+
const t = Number(s);
|
|
636
|
+
if (isNaN(t)) throw new J(`can't convert "${s}" to a number`);
|
|
788
637
|
return t;
|
|
789
638
|
}
|
|
790
|
-
function
|
|
791
|
-
const [n,
|
|
792
|
-
if (
|
|
639
|
+
function We(s, t, e) {
|
|
640
|
+
const [n, i] = t.split(":");
|
|
641
|
+
if (Jt(e))
|
|
793
642
|
if (typeof e == "boolean") {
|
|
794
|
-
e ?
|
|
795
|
-
const r =
|
|
796
|
-
|
|
643
|
+
e ? s.setAttribute(n, n) : s.removeAttribute(n);
|
|
644
|
+
const r = k.getPropName(n);
|
|
645
|
+
s[r] = e;
|
|
797
646
|
} else {
|
|
798
|
-
const r =
|
|
799
|
-
r !== c && (
|
|
647
|
+
const r = s.getAttribute(t), c = String(e);
|
|
648
|
+
r !== c && (s.setAttribute(n, c), n === "value" && Qt(s) && (s.value = c));
|
|
800
649
|
}
|
|
801
650
|
else {
|
|
802
|
-
const r =
|
|
803
|
-
|
|
651
|
+
const r = k.getPropName(t);
|
|
652
|
+
s[r] = e;
|
|
804
653
|
}
|
|
805
654
|
}
|
|
806
|
-
function
|
|
807
|
-
const [n,
|
|
808
|
-
|
|
655
|
+
function Xt(s, t, e) {
|
|
656
|
+
const [n, i] = t.split(":");
|
|
657
|
+
s instanceof CSSStyleRule ? s.style.setProperty(n, e) : (We(s, n, e), n === "value" && Qt(s) && (s.value = e));
|
|
809
658
|
}
|
|
810
|
-
async function
|
|
659
|
+
async function Wn(s) {
|
|
811
660
|
const t = /* @__PURE__ */ new Set();
|
|
812
|
-
for (const n of
|
|
813
|
-
const { localName:
|
|
814
|
-
|
|
661
|
+
for (const n of St(s.content)) {
|
|
662
|
+
const { localName: i } = n;
|
|
663
|
+
i.includes("-") && t.add(i);
|
|
815
664
|
}
|
|
816
665
|
function e(n) {
|
|
817
|
-
return new Promise((
|
|
666
|
+
return new Promise((i, r) => {
|
|
818
667
|
setTimeout(() => {
|
|
819
668
|
const c = `custom element <${n}> not defined`;
|
|
820
669
|
r(new Error(c));
|
|
@@ -827,7 +676,7 @@ async function lo(i) {
|
|
|
827
676
|
)
|
|
828
677
|
);
|
|
829
678
|
}
|
|
830
|
-
class
|
|
679
|
+
class k extends HTMLElement {
|
|
831
680
|
// There is one instance of `attrToPropMap`, `properties`, `propToAttrMap`,
|
|
832
681
|
// `propToComputedMap`, and `propToExprsMap` per Wrec subclass,
|
|
833
682
|
// not one for only the Wrec class.
|
|
@@ -871,7 +720,7 @@ class U extends HTMLElement {
|
|
|
871
720
|
// Each component instance needs its own map.
|
|
872
721
|
#n = /* @__PURE__ */ new Map();
|
|
873
722
|
#c = {};
|
|
874
|
-
#
|
|
723
|
+
#i;
|
|
875
724
|
// For components that set `formAssociated` to true,
|
|
876
725
|
// this stores in the initial value of each property
|
|
877
726
|
// in the formAssociatedCallback method
|
|
@@ -888,7 +737,7 @@ class U extends HTMLElement {
|
|
|
888
737
|
#u = /* @__PURE__ */ new Map();
|
|
889
738
|
static define(t) {
|
|
890
739
|
if (this.elementName = t, customElements.get(t))
|
|
891
|
-
throw new
|
|
740
|
+
throw new J(`custom element ${t} is already defined`);
|
|
892
741
|
customElements.define(t, this);
|
|
893
742
|
}
|
|
894
743
|
constructor() {
|
|
@@ -897,13 +746,13 @@ class U extends HTMLElement {
|
|
|
897
746
|
t.attrToPropMap || (t.attrToPropMap = /* @__PURE__ */ new Map()), t.properties || (t.properties = {}), t.propToAttrMap || (t.propToExprsMap = /* @__PURE__ */ new Map()), t.propToComputedMap || (t.propToComputedMap = /* @__PURE__ */ new Map()), t.propToExprsMap || (t.propToExprsMap = /* @__PURE__ */ new Map());
|
|
898
747
|
}
|
|
899
748
|
attributeChangedCallback(t, e, n) {
|
|
900
|
-
t === "disabled" && this.#
|
|
901
|
-
const
|
|
902
|
-
if (this.#i
|
|
903
|
-
const r = this.#A(
|
|
904
|
-
this[
|
|
905
|
-
const c = this.#c[
|
|
906
|
-
c && this.setFormValue(c, String(r)), this.propertyChangedCallback(
|
|
749
|
+
t === "disabled" && this.#m();
|
|
750
|
+
const i = k.getPropName(t);
|
|
751
|
+
if (this.#s(i)) {
|
|
752
|
+
const r = this.#A(i, String(n));
|
|
753
|
+
this[i] = r;
|
|
754
|
+
const c = this.#c[i];
|
|
755
|
+
c && this.setFormValue(c, String(r)), this.propertyChangedCallback(i, e, n);
|
|
907
756
|
}
|
|
908
757
|
}
|
|
909
758
|
async #S() {
|
|
@@ -915,62 +764,62 @@ class U extends HTMLElement {
|
|
|
915
764
|
:host([hidden]) { display: none; }`;
|
|
916
765
|
t.css && (n += t.css), n += `</style>
|
|
917
766
|
`;
|
|
918
|
-
let
|
|
919
|
-
if (!
|
|
920
|
-
|
|
767
|
+
let i = t.html.trim();
|
|
768
|
+
if (!i) throw new J("static property html must be set");
|
|
769
|
+
i.startsWith("<") || (i = `<span><!--${i}--></span>`), e.innerHTML = n + i;
|
|
921
770
|
}
|
|
922
|
-
await
|
|
771
|
+
await Wn(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
|
|
923
772
|
}
|
|
924
773
|
changed(t, e, n) {
|
|
925
774
|
this[e] = n;
|
|
926
775
|
}
|
|
927
776
|
connectedCallback() {
|
|
928
777
|
this.#P(), this.#R(), this.#S().then(() => {
|
|
929
|
-
this.hasAttribute("disabled") && this.#
|
|
778
|
+
this.hasAttribute("disabled") && this.#m(), this.#b(this.shadowRoot), this.#h(this.shadowRoot), this.#y();
|
|
930
779
|
});
|
|
931
780
|
}
|
|
932
781
|
#y() {
|
|
933
782
|
const t = this.#t, { properties: e } = t;
|
|
934
|
-
for (const [n, { computed:
|
|
935
|
-
|
|
783
|
+
for (const [n, { computed: i }] of Object.entries(e))
|
|
784
|
+
i && (this[n] = this.#o(i));
|
|
936
785
|
}
|
|
937
786
|
#R() {
|
|
938
787
|
const t = this.#t, { observedAttributes: e, properties: n } = t;
|
|
939
|
-
for (const [
|
|
940
|
-
this.#
|
|
788
|
+
for (const [i, r] of Object.entries(n))
|
|
789
|
+
this.#C(i, r, e);
|
|
941
790
|
}
|
|
942
|
-
#
|
|
943
|
-
const
|
|
791
|
+
#C(t, e, n) {
|
|
792
|
+
const i = k.getAttrName(t), r = this.hasAttribute(i);
|
|
944
793
|
e.required && !r && this.#e(this, t, "is a required attribute");
|
|
945
794
|
let c = e.value;
|
|
946
795
|
this.hasOwnProperty(t) && (c = this[t], delete this[t]);
|
|
947
|
-
const { type:
|
|
948
|
-
this[
|
|
796
|
+
const { type: h } = e, u = h === Boolean ? c || r : n.includes(i) && r ? this.#g(t, i) : c || zn(h), p = "#" + t;
|
|
797
|
+
this[p] = u, e.computed && this.#w(t, e), Object.defineProperty(this, t, {
|
|
949
798
|
enumerable: !0,
|
|
950
799
|
get() {
|
|
951
|
-
return this[
|
|
800
|
+
return this[p];
|
|
952
801
|
},
|
|
953
|
-
set(
|
|
954
|
-
|
|
955
|
-
const b = this[
|
|
956
|
-
if (
|
|
957
|
-
this.#
|
|
958
|
-
const { state: G, stateProp:
|
|
959
|
-
|
|
960
|
-
const
|
|
961
|
-
|
|
802
|
+
set(d) {
|
|
803
|
+
h === Number && typeof d == "string" && (d = Vt(d));
|
|
804
|
+
const b = this[p];
|
|
805
|
+
if (d === b) return;
|
|
806
|
+
this.#v(t, h, d), this[p] = d;
|
|
807
|
+
const { state: G, stateProp: F } = this.#t.properties[t];
|
|
808
|
+
F && In(G, F, d), this.#D(t), this.#L(t, h, d, i), this.#E(t), this.#I(t, d);
|
|
809
|
+
const $ = this.#c[t];
|
|
810
|
+
$ && this.setFormValue($, String(d)), this.propertyChangedCallback(t, b, d), e.dispatch && this.dispatch("change", {
|
|
962
811
|
tagName: this.localName,
|
|
963
812
|
property: t,
|
|
964
813
|
oldValue: b,
|
|
965
|
-
value:
|
|
814
|
+
value: d
|
|
966
815
|
});
|
|
967
816
|
}
|
|
968
817
|
});
|
|
969
818
|
}
|
|
970
|
-
#
|
|
971
|
-
const t = this.hasAttribute("disabled"), e =
|
|
819
|
+
#m() {
|
|
820
|
+
const t = this.hasAttribute("disabled"), e = St(this.shadowRoot);
|
|
972
821
|
for (const n of e)
|
|
973
|
-
|
|
822
|
+
Hn(n) && (n.disabled = t);
|
|
974
823
|
}
|
|
975
824
|
disconnectedCallback() {
|
|
976
825
|
this.#n.clear(), this.#l.clear(), this.#u.clear();
|
|
@@ -989,54 +838,54 @@ class U extends HTMLElement {
|
|
|
989
838
|
displayIfSet(t, e = "block") {
|
|
990
839
|
return `display: ${t ? e : "none"}`;
|
|
991
840
|
}
|
|
992
|
-
#
|
|
993
|
-
const e = t instanceof
|
|
841
|
+
#M(t) {
|
|
842
|
+
const e = t instanceof k;
|
|
994
843
|
for (const n of t.getAttributeNames()) {
|
|
995
|
-
const
|
|
844
|
+
const i = t.getAttribute(n), r = this.#T(t, i);
|
|
996
845
|
if (r) {
|
|
997
846
|
const c = this[r];
|
|
998
847
|
c === void 0 && this.#a(t, n, r), t[r] = c;
|
|
999
|
-
let [
|
|
1000
|
-
|
|
1001
|
-
|
|
848
|
+
let [h, u] = n.split(":");
|
|
849
|
+
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(
|
|
850
|
+
k.getPropName(h),
|
|
1002
851
|
r
|
|
1003
852
|
);
|
|
1004
853
|
}
|
|
1005
|
-
this.#r(
|
|
854
|
+
this.#r(i, t, n);
|
|
1006
855
|
}
|
|
1007
856
|
}
|
|
1008
857
|
#o(t) {
|
|
1009
858
|
const e = new Function("return " + t).call(this);
|
|
1010
859
|
return Array.isArray(e) ? e.join("") : e;
|
|
1011
860
|
}
|
|
1012
|
-
#
|
|
861
|
+
#O(t) {
|
|
1013
862
|
const { localName: e } = t;
|
|
1014
863
|
if (e === "style") {
|
|
1015
|
-
const { sheet: n } = t,
|
|
864
|
+
const { sheet: n } = t, i = n?.cssRules ?? [], r = Array.from(i);
|
|
1016
865
|
for (const c of r)
|
|
1017
866
|
if (c.constructor === CSSStyleRule) {
|
|
1018
|
-
const
|
|
1019
|
-
for (const
|
|
1020
|
-
if (
|
|
1021
|
-
const
|
|
1022
|
-
this.#r(
|
|
867
|
+
const h = Array.from(c.style);
|
|
868
|
+
for (const u of h)
|
|
869
|
+
if (u.startsWith("--")) {
|
|
870
|
+
const p = c.style.getPropertyValue(u);
|
|
871
|
+
this.#r(p, c, u);
|
|
1023
872
|
}
|
|
1024
873
|
}
|
|
1025
874
|
} else {
|
|
1026
875
|
let n = "";
|
|
1027
|
-
if (
|
|
876
|
+
if (ct(t)) {
|
|
1028
877
|
this.#r(t.textContent, t);
|
|
1029
|
-
const
|
|
1030
|
-
|
|
878
|
+
const i = t.textContent?.match(kn);
|
|
879
|
+
i && (n = i[1]);
|
|
1031
880
|
} else {
|
|
1032
|
-
const
|
|
881
|
+
const i = Array.from(t.childNodes).find(
|
|
1033
882
|
(r) => r.nodeType === Node.COMMENT_NODE
|
|
1034
883
|
);
|
|
1035
|
-
|
|
884
|
+
i && (n = i.textContent?.trim() ?? "");
|
|
1036
885
|
}
|
|
1037
886
|
if (n) {
|
|
1038
|
-
const
|
|
1039
|
-
|
|
887
|
+
const i = this.#T(t, n);
|
|
888
|
+
i && ct(t) ? t.textContent = this[i] : this.#r(n, t);
|
|
1040
889
|
}
|
|
1041
890
|
}
|
|
1042
891
|
}
|
|
@@ -1049,7 +898,7 @@ class U extends HTMLElement {
|
|
|
1049
898
|
if (!t) {
|
|
1050
899
|
const c = this.getAttribute("name");
|
|
1051
900
|
if (c)
|
|
1052
|
-
if (this.#
|
|
901
|
+
if (this.#s("value"))
|
|
1053
902
|
t = `value:${c}`;
|
|
1054
903
|
else
|
|
1055
904
|
return;
|
|
@@ -1058,19 +907,19 @@ class U extends HTMLElement {
|
|
|
1058
907
|
}
|
|
1059
908
|
const e = {}, n = t.split(",");
|
|
1060
909
|
for (const c of n) {
|
|
1061
|
-
const [
|
|
1062
|
-
e[
|
|
910
|
+
const [h, u] = c.split(":");
|
|
911
|
+
e[h.trim()] = u.trim();
|
|
1063
912
|
}
|
|
1064
|
-
this.#c = e, this.#
|
|
1065
|
-
const
|
|
1066
|
-
for (const c of
|
|
913
|
+
this.#c = e, this.#i = new FormData(), this.#f = this.attachInternals(), this.#f.setFormValue(this.#i);
|
|
914
|
+
const i = Object.keys(this.#t.properties), r = this.#l;
|
|
915
|
+
for (const c of i)
|
|
1067
916
|
r[c] = this[c];
|
|
1068
917
|
}
|
|
1069
918
|
formResetCallback() {
|
|
1070
919
|
const t = this.#l;
|
|
1071
920
|
for (const e of Object.keys(t)) {
|
|
1072
921
|
let n = t[e];
|
|
1073
|
-
|
|
922
|
+
jt.test(n) && (n = this.#o(n)), this[e] = n;
|
|
1074
923
|
}
|
|
1075
924
|
}
|
|
1076
925
|
static getAttrName(t) {
|
|
@@ -1079,43 +928,43 @@ class U extends HTMLElement {
|
|
|
1079
928
|
}
|
|
1080
929
|
static getPropName(t) {
|
|
1081
930
|
let e = this.attrToPropMap.get(t);
|
|
1082
|
-
return e || (e = t.replace(/-([a-z])/g, (n,
|
|
931
|
+
return e || (e = t.replace(/-([a-z])/g, (n, i) => i.toUpperCase()), this.attrToPropMap.set(t, e)), e;
|
|
1083
932
|
}
|
|
1084
|
-
#
|
|
933
|
+
#N(t, e, n) {
|
|
1085
934
|
if (n.length !== 1) return;
|
|
1086
|
-
const [
|
|
1087
|
-
if (!
|
|
1088
|
-
const r =
|
|
1089
|
-
let [c,
|
|
1090
|
-
if (!(r && c === "value" ||
|
|
1091
|
-
|
|
1092
|
-
const
|
|
1093
|
-
t.addEventListener(
|
|
1094
|
-
const { target: b } =
|
|
935
|
+
const [i] = n;
|
|
936
|
+
if (!jt.test(i)) return;
|
|
937
|
+
const r = Qt(t) || ct(t);
|
|
938
|
+
let [c, h] = (e ?? "").split(":");
|
|
939
|
+
if (!(r && c === "value" || ct(t))) return;
|
|
940
|
+
h ? t["on" + h] === void 0 && this.#e(t, e, "refers to an unsupported event name") : h = "change";
|
|
941
|
+
const p = _t(i);
|
|
942
|
+
t.addEventListener(h, (d) => {
|
|
943
|
+
const { target: b } = d;
|
|
1095
944
|
if (!b) return;
|
|
1096
|
-
const G = b.value, { type:
|
|
1097
|
-
this[
|
|
945
|
+
const G = b.value, { type: F } = this.#t.properties[p];
|
|
946
|
+
this[p] = F === Number ? Vt(G) : G, this.#E(p);
|
|
1098
947
|
});
|
|
1099
948
|
}
|
|
1100
|
-
#
|
|
949
|
+
#s(t) {
|
|
1101
950
|
return !!this.#t.properties[t];
|
|
1102
951
|
}
|
|
1103
|
-
#
|
|
952
|
+
#h(t) {
|
|
1104
953
|
const e = Array.from(t.querySelectorAll("*"));
|
|
1105
954
|
for (const n of e)
|
|
1106
|
-
this.#
|
|
955
|
+
this.#M(n), n.firstElementChild || this.#O(n);
|
|
1107
956
|
}
|
|
1108
957
|
// formAssociated is only needed when the component is inside a form.
|
|
1109
958
|
#d() {
|
|
1110
959
|
if (this.#t.formAssociated || this.closest("form") === null) return;
|
|
1111
960
|
const t = this.#t.name;
|
|
1112
|
-
throw new
|
|
961
|
+
throw new J(
|
|
1113
962
|
`inside form, class ${t} requires "static formAssociated = true;"`
|
|
1114
963
|
);
|
|
1115
964
|
}
|
|
1116
965
|
static get observedAttributes() {
|
|
1117
966
|
const t = Object.keys(this.properties || {}).map(
|
|
1118
|
-
(e) =>
|
|
967
|
+
(e) => k.getAttrName(e)
|
|
1119
968
|
);
|
|
1120
969
|
return t.includes("disabled") || t.push("disabled"), t;
|
|
1121
970
|
}
|
|
@@ -1123,69 +972,69 @@ class U extends HTMLElement {
|
|
|
1123
972
|
propertyChangedCallback(t, e, n) {
|
|
1124
973
|
}
|
|
1125
974
|
#T(t, e) {
|
|
1126
|
-
if (!e || !
|
|
1127
|
-
const n =
|
|
975
|
+
if (!e || !jt.test(e)) return;
|
|
976
|
+
const n = _t(e);
|
|
1128
977
|
return this[n] === void 0 && this.#a(t, "", n), n;
|
|
1129
978
|
}
|
|
1130
979
|
#E(t) {
|
|
1131
|
-
const
|
|
1132
|
-
for (const r of
|
|
980
|
+
const i = this.#t.propToExprsMap.get(t) || [];
|
|
981
|
+
for (const r of i) {
|
|
1133
982
|
let c = this.#o(r);
|
|
1134
|
-
const
|
|
1135
|
-
for (const
|
|
1136
|
-
if (
|
|
1137
|
-
this.#_(
|
|
1138
|
-
else if (!(
|
|
1139
|
-
const { element:
|
|
1140
|
-
|
|
983
|
+
const h = this.#n.get(r) ?? [];
|
|
984
|
+
for (const u of h)
|
|
985
|
+
if (u instanceof HTMLElement)
|
|
986
|
+
this.#_(u, c);
|
|
987
|
+
else if (!(u instanceof CSSStyleRule)) {
|
|
988
|
+
const { element: p, attrName: d } = u;
|
|
989
|
+
p instanceof CSSStyleRule ? p.style.setProperty(d, c) : Xt(p, d, c);
|
|
1141
990
|
}
|
|
1142
991
|
}
|
|
1143
992
|
}
|
|
1144
|
-
#
|
|
1145
|
-
const { computed: n, uses:
|
|
1146
|
-
function c(
|
|
1147
|
-
let
|
|
1148
|
-
|
|
993
|
+
#w(t, e) {
|
|
994
|
+
const { computed: n, uses: i } = e, r = this.#t.propToComputedMap;
|
|
995
|
+
function c(u, p) {
|
|
996
|
+
let d = r.get(u);
|
|
997
|
+
d || (d = [], r.set(u, d)), d.push([t, p]);
|
|
1149
998
|
}
|
|
1150
|
-
const
|
|
1151
|
-
for (const
|
|
1152
|
-
const
|
|
1153
|
-
this[
|
|
999
|
+
const h = n.match(Yt) || [];
|
|
1000
|
+
for (const u of h) {
|
|
1001
|
+
const p = u.substring(ze);
|
|
1002
|
+
this[p] === void 0 && this.#a(null, t, p), typeof this[p] != "function" && c(p, n);
|
|
1154
1003
|
}
|
|
1155
|
-
if (
|
|
1156
|
-
for (const
|
|
1157
|
-
c(
|
|
1004
|
+
if (i)
|
|
1005
|
+
for (const u of i.split(","))
|
|
1006
|
+
c(u, n);
|
|
1158
1007
|
}
|
|
1159
1008
|
// WARNING: Do not place untrusted JavaScript expressions
|
|
1160
1009
|
// in attribute values or the text content of elements!
|
|
1161
1010
|
#r(t, e, n = void 0) {
|
|
1162
1011
|
if (!t) return;
|
|
1163
|
-
const
|
|
1164
|
-
if (!
|
|
1165
|
-
const
|
|
1166
|
-
n ?
|
|
1012
|
+
const i = this.#p(e, n, t);
|
|
1013
|
+
if (!i) {
|
|
1014
|
+
const u = t.replaceAll("this..", "this.");
|
|
1015
|
+
n ? Xt(e, n, u) : "textContent" in e && (e.textContent = u);
|
|
1167
1016
|
return;
|
|
1168
1017
|
}
|
|
1169
1018
|
const r = this.#t;
|
|
1170
|
-
|
|
1171
|
-
const
|
|
1172
|
-
if (typeof this[
|
|
1173
|
-
const
|
|
1174
|
-
let b =
|
|
1175
|
-
b || (b = [],
|
|
1019
|
+
i.forEach((u) => {
|
|
1020
|
+
const p = _t(u);
|
|
1021
|
+
if (typeof this[p] == "function") return;
|
|
1022
|
+
const d = r.propToExprsMap;
|
|
1023
|
+
let b = d.get(p);
|
|
1024
|
+
b || (b = [], d.set(p, b)), b.includes(t) || b.push(t);
|
|
1176
1025
|
});
|
|
1177
|
-
for (const [
|
|
1178
|
-
for (const
|
|
1179
|
-
const b =
|
|
1026
|
+
for (const [u, p] of this.#n.entries())
|
|
1027
|
+
for (const d of p) {
|
|
1028
|
+
const b = d instanceof HTMLElement || d instanceof CSSStyleRule ? d : d.element;
|
|
1180
1029
|
b instanceof CSSStyleRule || b.isConnected || this.#n.set(
|
|
1181
|
-
|
|
1182
|
-
|
|
1030
|
+
u,
|
|
1031
|
+
p.filter((G) => G !== d)
|
|
1183
1032
|
);
|
|
1184
1033
|
}
|
|
1185
1034
|
let c = this.#n.get(t);
|
|
1186
|
-
c || (c = [], this.#n.set(t, c)), c.push(n ? { element: e, attrName: n } : e), e instanceof HTMLElement && this.#
|
|
1187
|
-
const
|
|
1188
|
-
n ?
|
|
1035
|
+
c || (c = [], this.#n.set(t, c)), c.push(n ? { element: e, attrName: n } : e), e instanceof HTMLElement && this.#N(e, n, i);
|
|
1036
|
+
const h = this.#o(t);
|
|
1037
|
+
n ? Xt(e, n, h) : this.#_(e, h);
|
|
1189
1038
|
}
|
|
1190
1039
|
// This follows the best practice
|
|
1191
1040
|
// "Do not override author-set, global attributes."
|
|
@@ -1193,12 +1042,12 @@ class U extends HTMLElement {
|
|
|
1193
1042
|
this.hasAttribute(t) || this.setAttribute(t, e);
|
|
1194
1043
|
}
|
|
1195
1044
|
setFormValue(t, e) {
|
|
1196
|
-
!this.#
|
|
1045
|
+
!this.#i || !Jt(e) || (this.#i.set(t, e), this.#f?.setFormValue(this.#i));
|
|
1197
1046
|
}
|
|
1198
1047
|
#e(t, e, n) {
|
|
1199
|
-
const
|
|
1200
|
-
throw new
|
|
1201
|
-
`component ${this.#t.elementName}` + (t ? `, element "${
|
|
1048
|
+
const i = t instanceof HTMLElement ? t.localName : "CSS rule";
|
|
1049
|
+
throw new J(
|
|
1050
|
+
`component ${this.#t.elementName}` + (t ? `, element "${i}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${n}`
|
|
1202
1051
|
);
|
|
1203
1052
|
}
|
|
1204
1053
|
#a(t, e, n) {
|
|
@@ -1208,11 +1057,11 @@ class U extends HTMLElement {
|
|
|
1208
1057
|
return this.#A(t, this.getAttribute(e));
|
|
1209
1058
|
}
|
|
1210
1059
|
#A(t, e) {
|
|
1211
|
-
if (e?.match(
|
|
1212
|
-
const n = this.#t, { type:
|
|
1213
|
-
if (
|
|
1214
|
-
if (
|
|
1215
|
-
if (
|
|
1060
|
+
if (e?.match(Yt)) return e;
|
|
1061
|
+
const n = this.#t, { type: i } = n.properties[t];
|
|
1062
|
+
if (i || this.#e(null, t, "does not specify its type"), i === String) return e;
|
|
1063
|
+
if (i === Number) return Vt(e);
|
|
1064
|
+
if (i === Boolean)
|
|
1216
1065
|
return e === "true" ? !0 : e === "false" || e === "null" ? !1 : (e && e !== t && this.#e(
|
|
1217
1066
|
null,
|
|
1218
1067
|
t,
|
|
@@ -1221,31 +1070,31 @@ class U extends HTMLElement {
|
|
|
1221
1070
|
}
|
|
1222
1071
|
// Updates the matching attribute for a property if there is one.
|
|
1223
1072
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1224
|
-
#
|
|
1225
|
-
if (
|
|
1226
|
-
const r = e === Boolean ? this.hasAttribute(
|
|
1227
|
-
n !== r &&
|
|
1073
|
+
#L(t, e, n, i) {
|
|
1074
|
+
if (Jt(n) && this.hasAttribute(i)) {
|
|
1075
|
+
const r = e === Boolean ? this.hasAttribute(i) : this.#g(t, i);
|
|
1076
|
+
n !== r && We(this, t, n);
|
|
1228
1077
|
}
|
|
1229
1078
|
}
|
|
1230
1079
|
// Updates all computed properties that reference this property.
|
|
1231
1080
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1232
1081
|
#D(t) {
|
|
1233
1082
|
const n = this.#t.propToComputedMap.get(t) || [];
|
|
1234
|
-
for (const [
|
|
1235
|
-
this[
|
|
1083
|
+
for (const [i, r] of n)
|
|
1084
|
+
this[i] = this.#o(r);
|
|
1236
1085
|
}
|
|
1237
1086
|
#_(t, e) {
|
|
1238
1087
|
if (e === void 0) return;
|
|
1239
|
-
const n = t instanceof HTMLElement,
|
|
1240
|
-
if (
|
|
1088
|
+
const n = t instanceof HTMLElement, i = typeof e;
|
|
1089
|
+
if (i !== "string" && i !== "number" && this.#e(
|
|
1241
1090
|
t,
|
|
1242
1091
|
void 0,
|
|
1243
1092
|
" computed content is not a string or number"
|
|
1244
|
-
), t instanceof HTMLElement &&
|
|
1093
|
+
), t instanceof HTMLElement && ct(t))
|
|
1245
1094
|
t.value = e;
|
|
1246
|
-
else if (n &&
|
|
1247
|
-
const r =
|
|
1248
|
-
t.replaceChildren(...r), this.#b(t), this.#
|
|
1095
|
+
else if (n && i === "string" && e.trim().startsWith("<")) {
|
|
1096
|
+
const r = $n(e);
|
|
1097
|
+
t.replaceChildren(...r), this.#b(t), this.#h(t);
|
|
1249
1098
|
} else n && (t.textContent = e);
|
|
1250
1099
|
}
|
|
1251
1100
|
// Update corresponding parent web component property if bound to one.
|
|
@@ -1253,9 +1102,9 @@ class U extends HTMLElement {
|
|
|
1253
1102
|
#I(t, e) {
|
|
1254
1103
|
const n = this.#u.get(t);
|
|
1255
1104
|
if (!n) return;
|
|
1256
|
-
const
|
|
1257
|
-
if (!(
|
|
1258
|
-
const { host: r } =
|
|
1105
|
+
const i = this.getRootNode();
|
|
1106
|
+
if (!(i instanceof ShadowRoot)) return;
|
|
1107
|
+
const { host: r } = i;
|
|
1259
1108
|
if (!r) return;
|
|
1260
1109
|
const c = r;
|
|
1261
1110
|
c[n] = e;
|
|
@@ -1271,12 +1120,12 @@ class U extends HTMLElement {
|
|
|
1271
1120
|
for (const n of Object.keys(t))
|
|
1272
1121
|
e[n] = n;
|
|
1273
1122
|
}
|
|
1274
|
-
this.#
|
|
1275
|
-
for (const [n,
|
|
1276
|
-
if (this.#i
|
|
1277
|
-
const r =
|
|
1278
|
-
r !== void 0 && (this[
|
|
1279
|
-
const c = this.#t.properties[
|
|
1123
|
+
this.#x(t, e);
|
|
1124
|
+
for (const [n, i] of Object.entries(e))
|
|
1125
|
+
if (this.#s(i)) {
|
|
1126
|
+
const r = Ie(t, n);
|
|
1127
|
+
r !== void 0 && (this[i] = r);
|
|
1128
|
+
const c = this.#t.properties[i];
|
|
1280
1129
|
c.state = t, c.stateProp = n;
|
|
1281
1130
|
}
|
|
1282
1131
|
t.addListener(this, e);
|
|
@@ -1284,7 +1133,7 @@ class U extends HTMLElement {
|
|
|
1284
1133
|
#P() {
|
|
1285
1134
|
const t = this.#t, e = new Set(Object.keys(t.properties));
|
|
1286
1135
|
for (const n of e)
|
|
1287
|
-
|
|
1136
|
+
Un.has(n) && this.#e(
|
|
1288
1137
|
null,
|
|
1289
1138
|
"",
|
|
1290
1139
|
`property "${n}" is not allowed because it is a reserved attribute`
|
|
@@ -1295,7 +1144,7 @@ class U extends HTMLElement {
|
|
|
1295
1144
|
this.#d();
|
|
1296
1145
|
continue;
|
|
1297
1146
|
}
|
|
1298
|
-
if (!e.has(
|
|
1147
|
+
if (!e.has(k.getPropName(n))) {
|
|
1299
1148
|
if (n === "name") {
|
|
1300
1149
|
this.#d();
|
|
1301
1150
|
continue;
|
|
@@ -1305,98 +1154,97 @@ class U extends HTMLElement {
|
|
|
1305
1154
|
}
|
|
1306
1155
|
}
|
|
1307
1156
|
#p(t, e, n) {
|
|
1308
|
-
const
|
|
1309
|
-
if (
|
|
1310
|
-
return
|
|
1311
|
-
const c =
|
|
1157
|
+
const i = n.match(Yt);
|
|
1158
|
+
if (i)
|
|
1159
|
+
return i.forEach((r) => {
|
|
1160
|
+
const c = _t(r);
|
|
1312
1161
|
this[c] === void 0 && this.#a(t, e, c);
|
|
1313
|
-
}),
|
|
1162
|
+
}), i;
|
|
1314
1163
|
}
|
|
1315
|
-
#
|
|
1316
|
-
for (const [n,
|
|
1317
|
-
let r =
|
|
1164
|
+
#x(t, e) {
|
|
1165
|
+
for (const [n, i] of Object.entries(e)) {
|
|
1166
|
+
let r = Ie(t, n);
|
|
1318
1167
|
if (r === void 0)
|
|
1319
|
-
throw new
|
|
1320
|
-
r = this[
|
|
1168
|
+
throw new J(`invalid state path "${n}"`);
|
|
1169
|
+
r = this[i], this.#s(i) || this.#e(
|
|
1321
1170
|
null,
|
|
1322
|
-
|
|
1171
|
+
i,
|
|
1323
1172
|
"refers to missing property in useState map"
|
|
1324
1173
|
);
|
|
1325
1174
|
}
|
|
1326
1175
|
}
|
|
1327
1176
|
// When type is an array, this can't validate the type of the array elements.
|
|
1328
1177
|
// This is called by #defineProp.
|
|
1329
|
-
#
|
|
1178
|
+
#v(t, e, n) {
|
|
1330
1179
|
if (n instanceof e) return;
|
|
1331
|
-
let
|
|
1332
|
-
if (
|
|
1180
|
+
let i = typeof n;
|
|
1181
|
+
if (i === "object") {
|
|
1333
1182
|
const { constructor: r } = n;
|
|
1334
|
-
|
|
1183
|
+
i = r.name, r !== e && this.#e(
|
|
1335
1184
|
null,
|
|
1336
1185
|
t,
|
|
1337
|
-
`was set to a ${
|
|
1186
|
+
`was set to a ${i}, but must be a ${e.name}`
|
|
1338
1187
|
);
|
|
1339
1188
|
}
|
|
1340
|
-
|
|
1189
|
+
i !== e.name.toLowerCase() && this.#e(
|
|
1341
1190
|
null,
|
|
1342
1191
|
t,
|
|
1343
|
-
`was set to a ${
|
|
1192
|
+
`was set to a ${i}, but must be a ${e.name}`
|
|
1344
1193
|
);
|
|
1345
1194
|
}
|
|
1346
1195
|
#b(t) {
|
|
1347
1196
|
const e = Array.from(t.querySelectorAll("*"));
|
|
1348
1197
|
for (const n of e) {
|
|
1349
|
-
const
|
|
1198
|
+
const i = [];
|
|
1350
1199
|
for (const r of Array.from(n.attributes)) {
|
|
1351
1200
|
const c = r.name;
|
|
1352
1201
|
if (c.startsWith("on")) {
|
|
1353
|
-
let
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1356
|
-
this.#p(n, c,
|
|
1357
|
-
let
|
|
1358
|
-
typeof this[
|
|
1202
|
+
let h = c.slice(2);
|
|
1203
|
+
h = h[0].toLowerCase() + h.slice(1).toLowerCase();
|
|
1204
|
+
const u = r.value;
|
|
1205
|
+
this.#p(n, c, u);
|
|
1206
|
+
let p;
|
|
1207
|
+
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);
|
|
1359
1208
|
}
|
|
1360
1209
|
}
|
|
1361
|
-
for (const r of
|
|
1210
|
+
for (const r of i)
|
|
1362
1211
|
n.removeAttribute(r);
|
|
1363
1212
|
}
|
|
1364
1213
|
}
|
|
1365
1214
|
}
|
|
1366
|
-
function
|
|
1367
|
-
let e =
|
|
1215
|
+
function jn(s, ...t) {
|
|
1216
|
+
let e = Ge(s, t);
|
|
1368
1217
|
for (; ; ) {
|
|
1369
|
-
const n =
|
|
1218
|
+
const n = xn.exec(e);
|
|
1370
1219
|
if (!n) break;
|
|
1371
|
-
const
|
|
1372
|
-
if (
|
|
1220
|
+
const i = n[2];
|
|
1221
|
+
if (He.test(i)) {
|
|
1373
1222
|
const r = n[1];
|
|
1374
1223
|
if (!r.startsWith("--")) {
|
|
1375
|
-
const c = `--${r}: ${
|
|
1224
|
+
const c = `--${r}: ${i};
|
|
1376
1225
|
${r}: var(--${r})`;
|
|
1377
|
-
e =
|
|
1226
|
+
e = $e(e, n.index, n[0].length, c);
|
|
1378
1227
|
}
|
|
1379
1228
|
}
|
|
1380
1229
|
}
|
|
1381
1230
|
return e;
|
|
1382
1231
|
}
|
|
1383
|
-
function
|
|
1384
|
-
let e =
|
|
1232
|
+
function Yn(s, ...t) {
|
|
1233
|
+
let e = Ge(s, t);
|
|
1385
1234
|
for (; ; ) {
|
|
1386
|
-
const n =
|
|
1235
|
+
const n = Fn.exec(e);
|
|
1387
1236
|
if (!n || n[1] === "style") break;
|
|
1388
|
-
const
|
|
1389
|
-
if (
|
|
1390
|
-
const r = `<!-- ${
|
|
1391
|
-
e =
|
|
1237
|
+
const i = Gn(n[2]);
|
|
1238
|
+
if (He.test(i)) {
|
|
1239
|
+
const r = `<!-- ${i.trim()} -->`, c = n.index + n[0].indexOf(">") + 1;
|
|
1240
|
+
e = $e(e, c, i.length, r);
|
|
1392
1241
|
}
|
|
1393
1242
|
}
|
|
1394
1243
|
return e;
|
|
1395
1244
|
}
|
|
1396
1245
|
export {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
mo as html
|
|
1246
|
+
k as Wrec,
|
|
1247
|
+
Bn as createElement,
|
|
1248
|
+
jn as css,
|
|
1249
|
+
Yn as html
|
|
1402
1250
|
};
|