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