wrec 0.20.5 → 0.20.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wrec.es.js CHANGED
@@ -6,19 +6,19 @@ var R = (i, t, e) => (Zt(i, t, "read from private field"), e ? e.call(i) : t.get
6
6
  const {
7
7
  entries: Ke,
8
8
  setPrototypeOf: ze,
9
- isFrozen: Dn,
10
- getPrototypeOf: In,
11
- getOwnPropertyDescriptor: Pn
9
+ isFrozen: Ln,
10
+ getPrototypeOf: Dn,
11
+ getOwnPropertyDescriptor: In
12
12
  } = Object;
13
13
  let {
14
- freeze: L,
14
+ freeze: N,
15
15
  seal: I,
16
16
  create: ce
17
17
  } = Object, {
18
18
  apply: le,
19
19
  construct: fe
20
20
  } = typeof Reflect < "u" && Reflect;
21
- L || (L = function(t) {
21
+ N || (N = function(t) {
22
22
  return t;
23
23
  });
24
24
  I || (I = function(t) {
@@ -34,8 +34,8 @@ fe || (fe = function(t) {
34
34
  n[s - 1] = arguments[s];
35
35
  return new t(...n);
36
36
  });
37
- const Ct = N(Array.prototype.forEach), vn = N(Array.prototype.lastIndexOf), $e = N(Array.prototype.pop), ft = N(Array.prototype.push), xn = N(Array.prototype.splice), Nt = N(String.prototype.toLowerCase), Jt = N(String.prototype.toString), Qt = N(String.prototype.match), ut = N(String.prototype.replace), kn = N(String.prototype.indexOf), Fn = N(String.prototype.trim), P = N(Object.prototype.hasOwnProperty), M = N(RegExp.prototype.test), pt = Un(TypeError);
38
- function N(i) {
37
+ const Mt = L(Array.prototype.forEach), Pn = L(Array.prototype.lastIndexOf), $e = L(Array.prototype.pop), ft = L(Array.prototype.push), vn = L(Array.prototype.splice), Lt = L(String.prototype.toLowerCase), Jt = L(String.prototype.toString), Qt = L(String.prototype.match), ut = L(String.prototype.replace), xn = L(String.prototype.indexOf), kn = L(String.prototype.trim), P = L(Object.prototype.hasOwnProperty), M = L(RegExp.prototype.test), pt = Fn(TypeError);
38
+ function L(i) {
39
39
  return function(t) {
40
40
  t instanceof RegExp && (t.lastIndex = 0);
41
41
  for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
@@ -43,7 +43,7 @@ function N(i) {
43
43
  return le(i, t, n);
44
44
  };
45
45
  }
46
- function Un(i) {
46
+ function Fn(i) {
47
47
  return function() {
48
48
  for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
49
49
  e[n] = arguments[n];
@@ -51,20 +51,20 @@ function Un(i) {
51
51
  };
52
52
  }
53
53
  function d(i, t) {
54
- let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Nt;
54
+ let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Lt;
55
55
  ze && ze(i, null);
56
56
  let n = t.length;
57
57
  for (; n--; ) {
58
58
  let s = t[n];
59
59
  if (typeof s == "string") {
60
60
  const r = e(s);
61
- r !== s && (Dn(t) || (t[n] = r), s = r);
61
+ r !== s && (Ln(t) || (t[n] = r), s = r);
62
62
  }
63
63
  i[s] = !0;
64
64
  }
65
65
  return i;
66
66
  }
67
- function Hn(i) {
67
+ function Un(i) {
68
68
  for (let t = 0; t < i.length; t++)
69
69
  P(i, t) || (i[t] = null);
70
70
  return i;
@@ -72,44 +72,44 @@ function Hn(i) {
72
72
  function k(i) {
73
73
  const t = ce(null);
74
74
  for (const [e, n] of Ke(i))
75
- P(i, e) && (Array.isArray(n) ? t[e] = Hn(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = k(n) : t[e] = n);
75
+ P(i, e) && (Array.isArray(n) ? t[e] = Un(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = k(n) : t[e] = n);
76
76
  return t;
77
77
  }
78
78
  function ht(i, t) {
79
79
  for (; i !== null; ) {
80
- const n = Pn(i, t);
80
+ const n = In(i, t);
81
81
  if (n) {
82
82
  if (n.get)
83
- return N(n.get);
83
+ return L(n.get);
84
84
  if (typeof n.value == "function")
85
- return N(n.value);
85
+ return L(n.value);
86
86
  }
87
- i = In(i);
87
+ i = Dn(i);
88
88
  }
89
89
  function e() {
90
90
  return null;
91
91
  }
92
92
  return e;
93
93
  }
94
- const We = 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"]), Ge = 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"]), Mt = L(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Wn = I(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Gn = I(/<%[\w\W]*|[\w\W]*%>/gm), Bn = I(/\$\{[\w\W]*/gm), jn = I(/^data-[\-\w.\u00B7-\uFFFF]+$/), Yn = I(/^aria-[\-\w]+$/), Ze = I(
94
+ const We = 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"]), te = 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"]), ee = 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"]), Hn = 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"]), ne = 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"]), zn = N(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Ge = N(["#text"]), Be = 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"]), oe = 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"]), je = 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"]), Nt = N(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), $n = I(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Wn = I(/<%[\w\W]*|[\w\W]*%>/gm), Gn = I(/\$\{[\w\W]*/gm), Bn = I(/^data-[\-\w.\u00B7-\uFFFF]+$/), jn = I(/^aria-[\-\w]+$/), Ze = I(
95
95
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
96
96
  // eslint-disable-line no-useless-escape
97
- ), Vn = I(/^(?:\w+script|data):/i), Xn = I(
97
+ ), Yn = I(/^(?:\w+script|data):/i), Vn = I(
98
98
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
99
99
  // eslint-disable-line no-control-regex
100
- ), Je = I(/^html$/i), qn = I(/^[a-z][.\w]*(-[.\w]+)+$/i);
100
+ ), Je = I(/^html$/i), Xn = I(/^[a-z][.\w]*(-[.\w]+)+$/i);
101
101
  var Ye = /* @__PURE__ */ Object.freeze({
102
102
  __proto__: null,
103
- ARIA_ATTR: Yn,
104
- ATTR_WHITESPACE: Xn,
105
- CUSTOM_ELEMENT: qn,
106
- DATA_ATTR: jn,
103
+ ARIA_ATTR: jn,
104
+ ATTR_WHITESPACE: Vn,
105
+ CUSTOM_ELEMENT: Xn,
106
+ DATA_ATTR: Bn,
107
107
  DOCTYPE_NAME: Je,
108
- ERB_EXPR: Gn,
108
+ ERB_EXPR: Wn,
109
109
  IS_ALLOWED_URI: Ze,
110
- IS_SCRIPT_OR_DATA: Vn,
111
- MUSTACHE_EXPR: Wn,
112
- TMPLIT_EXPR: Bn
110
+ IS_SCRIPT_OR_DATA: Yn,
111
+ MUSTACHE_EXPR: $n,
112
+ TMPLIT_EXPR: Gn
113
113
  });
114
114
  const mt = {
115
115
  element: 1,
@@ -118,9 +118,9 @@ const mt = {
118
118
  progressingInstruction: 7,
119
119
  comment: 8,
120
120
  document: 9
121
- }, Kn = function() {
121
+ }, qn = function() {
122
122
  return typeof window > "u" ? null : window;
123
- }, Zn = function(t, e) {
123
+ }, Kn = function(t, e) {
124
124
  if (typeof t != "object" || typeof t.createPolicy != "function")
125
125
  return null;
126
126
  let n = null;
@@ -153,7 +153,7 @@ const mt = {
153
153
  };
154
154
  };
155
155
  function Qe() {
156
- let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Kn();
156
+ let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : qn();
157
157
  const t = (f) => Qe(f);
158
158
  if (t.version = "3.3.1", t.removed = [], !i || !i.document || i.document.nodeType !== mt.document || !i.Element)
159
159
  return t.isSupported = !1, t;
@@ -170,7 +170,7 @@ function Qe() {
170
170
  HTMLFormElement: b,
171
171
  DOMParser: G,
172
172
  trustedTypes: H
173
- } = i, B = p.prototype, un = ht(B, "cloneNode"), pn = ht(B, "remove"), hn = ht(B, "nextSibling"), mn = ht(B, "childNodes"), At = ht(B, "parentNode");
173
+ } = i, B = p.prototype, fn = ht(B, "cloneNode"), un = ht(B, "remove"), pn = ht(B, "nextSibling"), hn = ht(B, "childNodes"), _t = ht(B, "parentNode");
174
174
  if (typeof c == "function") {
175
175
  const f = e.createElement("template");
176
176
  f.content && f.content.ownerDocument && (e = f.content.ownerDocument);
@@ -178,30 +178,30 @@ function Qe() {
178
178
  let O, rt = "";
179
179
  const {
180
180
  implementation: xt,
181
- createNodeIterator: dn,
182
- createDocumentFragment: Tn,
183
- getElementsByTagName: En
181
+ createNodeIterator: mn,
182
+ createDocumentFragment: dn,
183
+ getElementsByTagName: Tn
184
184
  } = e, {
185
- importNode: gn
185
+ importNode: En
186
186
  } = n;
187
187
  let C = Ve();
188
- t.isSupported = typeof Ke == "function" && typeof At == "function" && xt && xt.createHTMLDocument !== void 0;
188
+ t.isSupported = typeof Ke == "function" && typeof _t == "function" && xt && xt.createHTMLDocument !== void 0;
189
189
  const {
190
190
  MUSTACHE_EXPR: kt,
191
191
  ERB_EXPR: Ft,
192
192
  TMPLIT_EXPR: Ut,
193
- DATA_ATTR: An,
194
- ARIA_ATTR: _n,
195
- IS_SCRIPT_OR_DATA: bn,
193
+ DATA_ATTR: gn,
194
+ ARIA_ATTR: An,
195
+ IS_SCRIPT_OR_DATA: _n,
196
196
  ATTR_WHITESPACE: me,
197
- CUSTOM_ELEMENT: Sn
197
+ CUSTOM_ELEMENT: bn
198
198
  } = Ye;
199
199
  let {
200
200
  IS_ALLOWED_URI: de
201
201
  } = Ye, _ = null;
202
202
  const Te = d({}, [...We, ...te, ...ee, ...ne, ...Ge]);
203
203
  let S = null;
204
- const Ee = d({}, [...Be, ...oe, ...je, ...Mt]);
204
+ const Ee = d({}, [...Be, ...oe, ...je, ...Nt]);
205
205
  let E = Object.seal(ce(null, {
206
206
  tagNameCheck: {
207
207
  writable: !0,
@@ -236,53 +236,53 @@ function Qe() {
236
236
  value: null
237
237
  }
238
238
  }));
239
- let ge = !0, zt = !0, Ae = !1, _e = !0, Z = !1, _t = !0, V = !1, $t = !1, Wt = !1, J = !1, bt = !1, St = !1, be = !0, Se = !1;
240
- const yn = "user-content-";
239
+ let ge = !0, zt = !0, Ae = !1, _e = !0, Z = !1, bt = !0, V = !1, $t = !1, Wt = !1, J = !1, St = !1, yt = !1, be = !0, Se = !1;
240
+ const Sn = "user-content-";
241
241
  let Gt = !0, ct = !1, Q = {}, v = null;
242
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
243
  let ye = null;
244
244
  const Re = d({}, ["audio", "video", "img", "source", "image", "track"]);
245
245
  let jt = null;
246
- const we = d({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), yt = "http://www.w3.org/1998/Math/MathML", Rt = "http://www.w3.org/2000/svg", z = "http://www.w3.org/1999/xhtml";
246
+ const we = d({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Rt = "http://www.w3.org/1998/Math/MathML", wt = "http://www.w3.org/2000/svg", z = "http://www.w3.org/1999/xhtml";
247
247
  let tt = z, Yt = !1, Vt = null;
248
- const Rn = d({}, [yt, Rt, z], Jt);
249
- let wt = d({}, ["mi", "mo", "mn", "ms", "mtext"]), Ot = d({}, ["annotation-xml"]);
250
- const wn = d({}, ["title", "style", "font", "a", "script"]);
248
+ const yn = d({}, [Rt, wt, z], Jt);
249
+ let Ot = d({}, ["mi", "mo", "mn", "ms", "mtext"]), Ct = d({}, ["annotation-xml"]);
250
+ const Rn = d({}, ["title", "style", "font", "a", "script"]);
251
251
  let lt = null;
252
- const On = ["application/xhtml+xml", "text/html"], Cn = "text/html";
252
+ const wn = ["application/xhtml+xml", "text/html"], On = "text/html";
253
253
  let A = null, et = null;
254
- const Mn = e.createElement("form"), Oe = function(o) {
254
+ const Cn = e.createElement("form"), Oe = function(o) {
255
255
  return o instanceof RegExp || o instanceof Function;
256
256
  }, Xt = function() {
257
257
  let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
258
258
  if (!(et && et === o)) {
259
259
  if ((!o || typeof o != "object") && (o = {}), o = k(o), lt = // eslint-disable-next-line unicorn/prefer-includes
260
- On.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? Cn : o.PARSER_MEDIA_TYPE, A = lt === "application/xhtml+xml" ? Jt : Nt, _ = P(o, "ALLOWED_TAGS") ? d({}, o.ALLOWED_TAGS, A) : Te, S = P(o, "ALLOWED_ATTR") ? d({}, o.ALLOWED_ATTR, A) : Ee, Vt = P(o, "ALLOWED_NAMESPACES") ? d({}, o.ALLOWED_NAMESPACES, Jt) : Rn, jt = P(o, "ADD_URI_SAFE_ATTR") ? d(k(we), o.ADD_URI_SAFE_ATTR, A) : we, ye = P(o, "ADD_DATA_URI_TAGS") ? d(k(Re), o.ADD_DATA_URI_TAGS, A) : Re, v = P(o, "FORBID_CONTENTS") ? d({}, o.FORBID_CONTENTS, A) : Bt, at = P(o, "FORBID_TAGS") ? d({}, o.FORBID_TAGS, A) : k({}), Ht = P(o, "FORBID_ATTR") ? d({}, o.FORBID_ATTR, A) : k({}), Q = P(o, "USE_PROFILES") ? o.USE_PROFILES : !1, ge = 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, _t = o.SAFE_FOR_XML !== !1, V = o.WHOLE_DOCUMENT || !1, J = o.RETURN_DOM || !1, bt = o.RETURN_DOM_FRAGMENT || !1, St = o.RETURN_TRUSTED_TYPE || !1, Wt = o.FORCE_BODY || !1, be = o.SANITIZE_DOM !== !1, Se = o.SANITIZE_NAMED_PROPS || !1, Gt = o.KEEP_CONTENT !== !1, ct = o.IN_PLACE || !1, de = o.ALLOWED_URI_REGEXP || Ze, tt = o.NAMESPACE || z, wt = o.MATHML_TEXT_INTEGRATION_POINTS || wt, Ot = o.HTML_INTEGRATION_POINTS || Ot, E = o.CUSTOM_ELEMENT_HANDLING || {}, o.CUSTOM_ELEMENT_HANDLING && Oe(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (E.tagNameCheck = o.CUSTOM_ELEMENT_HANDLING.tagNameCheck), o.CUSTOM_ELEMENT_HANDLING && Oe(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), Z && (zt = !1), bt && (J = !0), Q && (_ = d({}, Ge), S = [], Q.html === !0 && (d(_, We), d(S, Be)), Q.svg === !0 && (d(_, te), d(S, oe), d(S, Mt)), Q.svgFilters === !0 && (d(_, ee), d(S, oe), d(S, Mt)), Q.mathMl === !0 && (d(_, ne), d(S, je), d(S, Mt))), o.ADD_TAGS && (typeof o.ADD_TAGS == "function" ? K.tagCheck = o.ADD_TAGS : (_ === Te && (_ = k(_)), d(_, o.ADD_TAGS, A))), o.ADD_ATTR && (typeof o.ADD_ATTR == "function" ? K.attributeCheck = o.ADD_ATTR : (S === Ee && (S = k(S)), d(S, o.ADD_ATTR, A))), o.ADD_URI_SAFE_ATTR && d(jt, o.ADD_URI_SAFE_ATTR, A), o.FORBID_CONTENTS && (v === Bt && (v = k(v)), d(v, o.FORBID_CONTENTS, A)), o.ADD_FORBID_CONTENTS && (v === Bt && (v = k(v)), d(v, o.ADD_FORBID_CONTENTS, A)), Gt && (_["#text"] = !0), V && d(_, ["html", "head", "body"]), _.table && (d(_, ["tbody"]), delete at.tbody), o.TRUSTED_TYPES_POLICY) {
260
+ wn.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? On : o.PARSER_MEDIA_TYPE, A = lt === "application/xhtml+xml" ? Jt : Lt, _ = P(o, "ALLOWED_TAGS") ? d({}, o.ALLOWED_TAGS, A) : Te, S = P(o, "ALLOWED_ATTR") ? d({}, o.ALLOWED_ATTR, A) : Ee, Vt = P(o, "ALLOWED_NAMESPACES") ? d({}, o.ALLOWED_NAMESPACES, Jt) : yn, jt = P(o, "ADD_URI_SAFE_ATTR") ? d(k(we), o.ADD_URI_SAFE_ATTR, A) : we, ye = P(o, "ADD_DATA_URI_TAGS") ? d(k(Re), o.ADD_DATA_URI_TAGS, A) : Re, v = P(o, "FORBID_CONTENTS") ? d({}, o.FORBID_CONTENTS, A) : Bt, at = P(o, "FORBID_TAGS") ? d({}, o.FORBID_TAGS, A) : k({}), Ht = P(o, "FORBID_ATTR") ? d({}, o.FORBID_ATTR, A) : k({}), Q = P(o, "USE_PROFILES") ? o.USE_PROFILES : !1, ge = 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, bt = o.SAFE_FOR_XML !== !1, V = o.WHOLE_DOCUMENT || !1, J = o.RETURN_DOM || !1, St = o.RETURN_DOM_FRAGMENT || !1, yt = o.RETURN_TRUSTED_TYPE || !1, Wt = o.FORCE_BODY || !1, be = o.SANITIZE_DOM !== !1, Se = o.SANITIZE_NAMED_PROPS || !1, Gt = o.KEEP_CONTENT !== !1, ct = o.IN_PLACE || !1, de = o.ALLOWED_URI_REGEXP || Ze, tt = o.NAMESPACE || z, Ot = o.MATHML_TEXT_INTEGRATION_POINTS || Ot, Ct = o.HTML_INTEGRATION_POINTS || Ct, E = o.CUSTOM_ELEMENT_HANDLING || {}, o.CUSTOM_ELEMENT_HANDLING && Oe(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (E.tagNameCheck = o.CUSTOM_ELEMENT_HANDLING.tagNameCheck), o.CUSTOM_ELEMENT_HANDLING && Oe(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), Z && (zt = !1), St && (J = !0), Q && (_ = d({}, Ge), S = [], Q.html === !0 && (d(_, We), d(S, Be)), Q.svg === !0 && (d(_, te), d(S, oe), d(S, Nt)), Q.svgFilters === !0 && (d(_, ee), d(S, oe), d(S, Nt)), Q.mathMl === !0 && (d(_, ne), d(S, je), d(S, Nt))), o.ADD_TAGS && (typeof o.ADD_TAGS == "function" ? K.tagCheck = o.ADD_TAGS : (_ === Te && (_ = k(_)), d(_, o.ADD_TAGS, A))), o.ADD_ATTR && (typeof o.ADD_ATTR == "function" ? K.attributeCheck = o.ADD_ATTR : (S === Ee && (S = k(S)), d(S, o.ADD_ATTR, A))), o.ADD_URI_SAFE_ATTR && d(jt, o.ADD_URI_SAFE_ATTR, A), o.FORBID_CONTENTS && (v === Bt && (v = k(v)), d(v, o.FORBID_CONTENTS, A)), o.ADD_FORBID_CONTENTS && (v === Bt && (v = k(v)), d(v, o.ADD_FORBID_CONTENTS, A)), Gt && (_["#text"] = !0), V && d(_, ["html", "head", "body"]), _.table && (d(_, ["tbody"]), delete at.tbody), o.TRUSTED_TYPES_POLICY) {
261
261
  if (typeof o.TRUSTED_TYPES_POLICY.createHTML != "function")
262
262
  throw pt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
263
263
  if (typeof o.TRUSTED_TYPES_POLICY.createScriptURL != "function")
264
264
  throw pt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
265
265
  O = o.TRUSTED_TYPES_POLICY, rt = O.createHTML("");
266
266
  } else
267
- O === void 0 && (O = Zn(H, s)), O !== null && typeof rt == "string" && (rt = O.createHTML(""));
268
- L && L(o), et = o;
267
+ O === void 0 && (O = Kn(H, s)), O !== null && typeof rt == "string" && (rt = O.createHTML(""));
268
+ N && N(o), et = o;
269
269
  }
270
- }, Ce = d({}, [...te, ...ee, ...zn]), Me = d({}, [...ne, ...$n]), Ln = function(o) {
271
- let a = At(o);
270
+ }, Ce = d({}, [...te, ...ee, ...Hn]), Me = d({}, [...ne, ...zn]), Mn = function(o) {
271
+ let a = _t(o);
272
272
  (!a || !a.tagName) && (a = {
273
273
  namespaceURI: tt,
274
274
  tagName: "template"
275
275
  });
276
- const l = Nt(o.tagName), T = Nt(a.tagName);
277
- return Vt[o.namespaceURI] ? o.namespaceURI === Rt ? a.namespaceURI === z ? l === "svg" : a.namespaceURI === yt ? l === "svg" && (T === "annotation-xml" || wt[T]) : !!Ce[l] : o.namespaceURI === yt ? a.namespaceURI === z ? l === "math" : a.namespaceURI === Rt ? l === "math" && Ot[T] : !!Me[l] : o.namespaceURI === z ? a.namespaceURI === Rt && !Ot[T] || a.namespaceURI === yt && !wt[T] ? !1 : !Me[l] && (wn[l] || !Ce[l]) : !!(lt === "application/xhtml+xml" && Vt[o.namespaceURI]) : !1;
276
+ const l = Lt(o.tagName), T = Lt(a.tagName);
277
+ return Vt[o.namespaceURI] ? o.namespaceURI === wt ? a.namespaceURI === z ? l === "svg" : a.namespaceURI === Rt ? l === "svg" && (T === "annotation-xml" || Ot[T]) : !!Ce[l] : o.namespaceURI === Rt ? a.namespaceURI === z ? l === "math" : a.namespaceURI === wt ? l === "math" && Ct[T] : !!Me[l] : o.namespaceURI === z ? a.namespaceURI === wt && !Ct[T] || a.namespaceURI === Rt && !Ot[T] ? !1 : !Me[l] && (Rn[l] || !Ce[l]) : !!(lt === "application/xhtml+xml" && Vt[o.namespaceURI]) : !1;
278
278
  }, x = function(o) {
279
279
  ft(t.removed, {
280
280
  element: o
281
281
  });
282
282
  try {
283
- At(o).removeChild(o);
283
+ _t(o).removeChild(o);
284
284
  } catch {
285
- pn(o);
285
+ un(o);
286
286
  }
287
287
  }, X = function(o, a) {
288
288
  try {
@@ -297,7 +297,7 @@ function Qe() {
297
297
  });
298
298
  }
299
299
  if (a.removeAttribute(o), o === "is")
300
- if (J || bt)
300
+ if (J || St)
301
301
  try {
302
302
  x(a);
303
303
  } catch {
@@ -307,7 +307,7 @@ function Qe() {
307
307
  a.setAttribute(o, "");
308
308
  } catch {
309
309
  }
310
- }, Le = function(o) {
310
+ }, Ne = function(o) {
311
311
  let a = null, l = null;
312
312
  if (Wt)
313
313
  o = "<remove></remove>" + o;
@@ -330,9 +330,9 @@ function Qe() {
330
330
  }
331
331
  }
332
332
  const w = a.body || a.documentElement;
333
- return o && l && w.insertBefore(e.createTextNode(l), w.childNodes[0] || null), tt === z ? En.call(a, V ? "html" : "body")[0] : V ? a.documentElement : w;
334
- }, Ne = function(o) {
335
- return dn.call(
333
+ return o && l && w.insertBefore(e.createTextNode(l), w.childNodes[0] || null), tt === z ? Tn.call(a, V ? "html" : "body")[0] : V ? a.documentElement : w;
334
+ }, Le = function(o) {
335
+ return mn.call(
336
336
  o.ownerDocument || o,
337
337
  o,
338
338
  // eslint-disable-next-line no-bitwise
@@ -345,7 +345,7 @@ function Qe() {
345
345
  return typeof u == "function" && o instanceof u;
346
346
  };
347
347
  function $(f, o, a) {
348
- Ct(f, (l) => {
348
+ Mt(f, (l) => {
349
349
  l.call(t, o, a, et);
350
350
  });
351
351
  }
@@ -357,33 +357,33 @@ function Qe() {
357
357
  if ($(C.uponSanitizeElement, o, {
358
358
  tagName: l,
359
359
  allowedTags: _
360
- }), _t && o.hasChildNodes() && !De(o.firstElementChild) && M(/<[/\w!]/g, o.innerHTML) && M(/<[/\w!]/g, o.textContent) || o.nodeType === mt.progressingInstruction || _t && o.nodeType === mt.comment && M(/<[/\w]/g, o.data))
360
+ }), bt && o.hasChildNodes() && !De(o.firstElementChild) && M(/<[/\w!]/g, o.innerHTML) && M(/<[/\w!]/g, o.textContent) || o.nodeType === mt.progressingInstruction || bt && o.nodeType === mt.comment && M(/<[/\w]/g, o.data))
361
361
  return x(o), !0;
362
362
  if (!(K.tagCheck instanceof Function && K.tagCheck(l)) && (!_[l] || at[l])) {
363
363
  if (!at[l] && ve(l) && (E.tagNameCheck instanceof RegExp && M(E.tagNameCheck, l) || E.tagNameCheck instanceof Function && E.tagNameCheck(l)))
364
364
  return !1;
365
365
  if (Gt && !v[l]) {
366
- const T = At(o) || o.parentNode, w = mn(o) || o.childNodes;
366
+ const T = _t(o) || o.parentNode, w = hn(o) || o.childNodes;
367
367
  if (w && T) {
368
368
  const g = w.length;
369
369
  for (let D = g - 1; D >= 0; --D) {
370
- const W = un(w[D], !0);
371
- W.__removalCount = (o.__removalCount || 0) + 1, T.insertBefore(W, hn(o));
370
+ const W = fn(w[D], !0);
371
+ W.__removalCount = (o.__removalCount || 0) + 1, T.insertBefore(W, pn(o));
372
372
  }
373
373
  }
374
374
  }
375
375
  return x(o), !0;
376
376
  }
377
- return o instanceof p && !Ln(o) || (l === "noscript" || l === "noembed" || l === "noframes") && M(/<\/no(script|embed|frames)/i, o.innerHTML) ? (x(o), !0) : (Z && o.nodeType === mt.text && (a = o.textContent, Ct([kt, Ft, Ut], (T) => {
377
+ return o instanceof p && !Mn(o) || (l === "noscript" || l === "noembed" || l === "noframes") && M(/<\/no(script|embed|frames)/i, o.innerHTML) ? (x(o), !0) : (Z && o.nodeType === mt.text && (a = o.textContent, Mt([kt, Ft, Ut], (T) => {
378
378
  a = ut(a, T, " ");
379
379
  }), o.textContent !== a && (ft(t.removed, {
380
380
  element: o.cloneNode()
381
381
  }), o.textContent = a)), $(C.afterSanitizeElements, o, null), !1);
382
382
  }, Pe = function(o, a, l) {
383
- if (be && (a === "id" || a === "name") && (l in e || l in Mn))
383
+ if (be && (a === "id" || a === "name") && (l in e || l in Cn))
384
384
  return !1;
385
- if (!(zt && !Ht[a] && M(An, a))) {
386
- if (!(ge && M(_n, a))) {
385
+ if (!(zt && !Ht[a] && M(gn, a))) {
386
+ if (!(ge && M(An, a))) {
387
387
  if (!(K.attributeCheck instanceof Function && K.attributeCheck(a, o))) {
388
388
  if (!S[a] || Ht[a]) {
389
389
  if (
@@ -396,8 +396,8 @@ function Qe() {
396
396
  ) return !1;
397
397
  } else if (!jt[a]) {
398
398
  if (!M(de, ut(l, me, ""))) {
399
- if (!((a === "src" || a === "xlink:href" || a === "href") && o !== "script" && kn(l, "data:") === 0 && ye[o])) {
400
- if (!(Ae && !M(bn, ut(l, me, "")))) {
399
+ if (!((a === "src" || a === "xlink:href" || a === "href") && o !== "script" && xn(l, "data:") === 0 && ye[o])) {
400
+ if (!(Ae && !M(_n, ut(l, me, "")))) {
401
401
  if (l)
402
402
  return !1;
403
403
  }
@@ -409,7 +409,7 @@ function Qe() {
409
409
  }
410
410
  return !0;
411
411
  }, ve = function(o) {
412
- return o !== "annotation-xml" && Qt(o, Sn);
412
+ return o !== "annotation-xml" && Qt(o, bn);
413
413
  }, xe = function(o) {
414
414
  $(C.beforeSanitizeAttributes, o, null);
415
415
  const {
@@ -431,8 +431,8 @@ function Qe() {
431
431
  namespaceURI: D,
432
432
  value: W
433
433
  } = w, nt = A(g), Kt = W;
434
- let y = g === "value" ? Kt : Fn(Kt);
435
- if (l.attrName = nt, l.attrValue = y, l.keepAttr = !0, l.forceKeepAttr = void 0, $(C.uponSanitizeAttribute, o, l), y = l.attrValue, Se && (nt === "id" || nt === "name") && (X(g, o), y = yn + y), _t && M(/((--!?|])>)|<\/(style|title|textarea)/i, y)) {
434
+ let y = g === "value" ? Kt : kn(Kt);
435
+ if (l.attrName = nt, l.attrValue = y, l.keepAttr = !0, l.forceKeepAttr = void 0, $(C.uponSanitizeAttribute, o, l), y = l.attrValue, Se && (nt === "id" || nt === "name") && (X(g, o), y = Sn + y), bt && M(/((--!?|])>)|<\/(style|title|textarea)/i, y)) {
436
436
  X(g, o);
437
437
  continue;
438
438
  }
@@ -450,7 +450,7 @@ function Qe() {
450
450
  X(g, o);
451
451
  continue;
452
452
  }
453
- Z && Ct([kt, Ft, Ut], (Fe) => {
453
+ Z && Mt([kt, Ft, Ut], (Fe) => {
454
454
  y = ut(y, Fe, " ");
455
455
  });
456
456
  const ke = A(o.nodeName);
@@ -479,7 +479,7 @@ function Qe() {
479
479
  $(C.afterSanitizeAttributes, o, null);
480
480
  }, Nn = function f(o) {
481
481
  let a = null;
482
- const l = Ne(o);
482
+ const l = Le(o);
483
483
  for ($(C.beforeSanitizeShadowDOM, o, null); a = l.nextNode(); )
484
484
  $(C.uponSanitizeShadowNode, a, null), Ie(a), xe(a), a.content instanceof r && f(a.content);
485
485
  $(C.afterSanitizeShadowDOM, o, null);
@@ -501,33 +501,33 @@ function Qe() {
501
501
  throw pt("root node is forbidden and cannot be sanitized in-place");
502
502
  }
503
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);
504
+ a = Ne("<!---->"), l = a.ownerDocument.importNode(f, !0), l.nodeType === mt.element && l.nodeName === "BODY" || l.nodeName === "HTML" ? a = l : a.appendChild(l);
505
505
  else {
506
506
  if (!J && !Z && !V && // eslint-disable-next-line unicorn/prefer-includes
507
507
  f.indexOf("<") === -1)
508
- return O && St ? O.createHTML(f) : f;
509
- if (a = Le(f), !a)
510
- return J ? null : St ? rt : "";
508
+ return O && yt ? O.createHTML(f) : f;
509
+ if (a = Ne(f), !a)
510
+ return J ? null : yt ? rt : "";
511
511
  }
512
512
  a && Wt && x(a.firstChild);
513
- const g = Ne(ct ? f : a);
513
+ const g = Le(ct ? f : a);
514
514
  for (; T = g.nextNode(); )
515
515
  Ie(T), xe(T), T.content instanceof r && Nn(T.content);
516
516
  if (ct)
517
517
  return f;
518
518
  if (J) {
519
- if (bt)
520
- for (w = Tn.call(a.ownerDocument); a.firstChild; )
519
+ if (St)
520
+ for (w = dn.call(a.ownerDocument); a.firstChild; )
521
521
  w.appendChild(a.firstChild);
522
522
  else
523
523
  w = a;
524
- return (S.shadowroot || S.shadowrootmode) && (w = gn.call(n, w, !0)), w;
524
+ return (S.shadowroot || S.shadowrootmode) && (w = En.call(n, w, !0)), w;
525
525
  }
526
526
  let D = V ? a.outerHTML : a.innerHTML;
527
527
  return V && _["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && M(Je, a.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
528
- ` + D), Z && Ct([kt, Ft, Ut], (W) => {
528
+ ` + D), Z && Mt([kt, Ft, Ut], (W) => {
529
529
  D = ut(D, W, " ");
530
- }), O && St ? O.createHTML(D) : D;
530
+ }), O && yt ? O.createHTML(D) : D;
531
531
  }, t.setConfig = function() {
532
532
  let f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
533
533
  Xt(f), $t = !0;
@@ -541,8 +541,8 @@ function Qe() {
541
541
  typeof o == "function" && ft(C[f], o);
542
542
  }, t.removeHook = function(f, o) {
543
543
  if (o !== void 0) {
544
- const a = vn(C[f], o);
545
- return a === -1 ? void 0 : xn(C[f], a, 1)[0];
544
+ const a = Pn(C[f], o);
545
+ return a === -1 ? void 0 : vn(C[f], a, 1)[0];
546
546
  }
547
547
  return $e(C[f]);
548
548
  }, t.removeHooks = function(f) {
@@ -588,7 +588,7 @@ function nn(i) {
588
588
  const Dt = typeof window < "u" && typeof window.document < "u";
589
589
  let Xe = class extends Error {
590
590
  };
591
- var q, Pt, F, Et, gt, Y, vt, on;
591
+ var q, Pt, F, gt, At, Y, vt, on;
592
592
  const it = class it {
593
593
  constructor(t, e, n) {
594
594
  j(this, vt);
@@ -596,13 +596,13 @@ const it = class it {
596
596
  // This cannot be replaced by a WeakMap<ChangeListener, Set<string>>
597
597
  // because there is no way to iterate over the keys of a WeakMap.
598
598
  j(this, F, []);
599
- j(this, Et);
600
599
  j(this, gt);
600
+ j(this, At);
601
601
  j(this, Y);
602
602
  if (!t) throw new Xe("name cannot be empty");
603
603
  if (R(it, q).has(t))
604
604
  throw new Xe(`WrecState with name "${t}" already exists`);
605
- if (ot(this, Et, t), ot(this, gt, e), ot(this, Y, en({}, He(this, vt, on).bind(this))), e && Dt) {
605
+ if (ot(this, gt, t), ot(this, At, e), ot(this, Y, en({}, He(this, vt, on).bind(this))), e && Dt) {
606
606
  const s = sessionStorage.getItem("wrec-state-" + t), r = s ? JSON.parse(s) : void 0;
607
607
  r && (n = r);
608
608
  }
@@ -659,7 +659,7 @@ const it = class it {
659
659
  // This is useful for debugging from the DevTools console.
660
660
  // For example: state.log()
661
661
  log() {
662
- console.log("WrecState:", R(this, Et));
662
+ console.log("WrecState:", R(this, gt));
663
663
  for (const [t, e] of Object.entries(R(this, Y)))
664
664
  console.log(` ${t} = ${JSON.stringify(e)}`);
665
665
  }
@@ -667,7 +667,7 @@ const it = class it {
667
667
  ot(this, F, R(this, F).filter((e) => e.listenerRef.deref() !== t));
668
668
  }
669
669
  };
670
- 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) {
670
+ q = new WeakMap(), Pt = new WeakMap(), F = new WeakMap(), gt = new WeakMap(), At = new WeakMap(), Y = new WeakMap(), vt = new WeakSet(), on = function(t, e, n) {
671
671
  const s = /* @__PURE__ */ new Set();
672
672
  for (const r of R(this, F)) {
673
673
  const c = r.listenerRef.deref();
@@ -691,7 +691,7 @@ q = new WeakMap(), Pt = new WeakMap(), F = new WeakMap(), Et = new WeakMap(), gt
691
691
  ));
692
692
  }, j(it, q, /* @__PURE__ */ new Map()), Dt && window.addEventListener("beforeunload", () => {
693
693
  for (const [t, e] of R(it, q).entries())
694
- if (R(e, gt)) {
694
+ if (R(e, At)) {
695
695
  const n = nn(e);
696
696
  sessionStorage.setItem("wrec-state-" + t, JSON.stringify(n));
697
697
  }
@@ -704,14 +704,20 @@ function qe(i, t) {
704
704
  e = e[n];
705
705
  return e;
706
706
  }
707
- function Jn(i, t, e) {
707
+ function Zn(i, t, e) {
708
708
  const n = t.split("."), s = n.length - 1;
709
709
  let r = i;
710
710
  n.forEach((c, u) => {
711
711
  u === s ? r[c] = e : r = r[c];
712
712
  });
713
713
  }
714
- const Qn = /* @__PURE__ */ new Set([
714
+ const Jn = /* @__PURE__ */ new Set([
715
+ "class",
716
+ "hidden",
717
+ "id",
718
+ "disabled",
719
+ "title"
720
+ ]), Qn = /* @__PURE__ */ new Set([
715
721
  "onblur",
716
722
  "onchange",
717
723
  "onclick",
@@ -727,18 +733,18 @@ tn.addHook("uponSanitizeAttribute", (i, t) => {
727
733
  });
728
734
  class st extends Error {
729
735
  }
730
- const to = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, sn = "a-zA-Z_$", eo = sn + "0-9", Tt = `[${sn}][${eo}]*`, no = /<!--\s*(.*?)\s*-->/, oo = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, se = new RegExp(`^this\\.${Tt}$`), ie = new RegExp(`this\\.${Tt}(\\.${Tt})*`, "g"), rn = new RegExp(`this\\.${Tt}(\\.${Tt})*`), so = /* @__PURE__ */ new Set(["class", "style"]), an = 5;
731
- function io(i) {
736
+ const to = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, sn = "a-zA-Z_$", eo = sn + "0-9", Et = `[${sn}][${eo}]*`, no = /<!--\s*(.*?)\s*-->/, oo = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, se = new RegExp(`^this\\.${Et}$`), ie = new RegExp(`this\\.${Et}(\\.${Et})*`, "g"), rn = new RegExp(`this\\.${Et}(\\.${Et})*`), so = /* @__PURE__ */ new Set(["class", "style"]), io = 5;
737
+ function ro(i) {
732
738
  return i instanceof HTMLButtonElement || i instanceof HTMLFieldSetElement || i instanceof HTMLInputElement || i instanceof HTMLSelectElement || i instanceof HTMLTextAreaElement || i instanceof U;
733
739
  }
734
- function po(i, t, e) {
740
+ function ho(i, t, e) {
735
741
  const n = document.createElement(i);
736
742
  if (t)
737
743
  for (const [s, r] of Object.entries(t))
738
744
  n.setAttribute(s, r);
739
745
  return e && (n.innerHTML = e), n;
740
746
  }
741
- const ro = (i) => i === String ? "" : i === Number ? 0 : i === Boolean ? !1 : i === Array ? [] : i === Object ? {} : void 0;
747
+ const ao = (i) => i === String ? "" : i === Number ? 0 : i === Boolean ? !1 : i === Array ? [] : i === Object ? {} : void 0;
742
748
  function It(i) {
743
749
  const t = [];
744
750
  let e = i.firstElementChild;
@@ -746,8 +752,8 @@ function It(i) {
746
752
  t.push(e), e.shadowRoot && t.push(...It(e.shadowRoot)), e.firstElementChild && t.push(...It(e)), e = e.nextElementSibling;
747
753
  return t;
748
754
  }
749
- const Lt = (i) => i.substring(an).split(".")[0];
750
- function cn(i, t) {
755
+ const dt = (i) => i.substring(io).split(".")[0];
756
+ function an(i, t) {
751
757
  let e = i[0];
752
758
  return t.forEach((n, s) => {
753
759
  e += n + i[s + 1];
@@ -757,18 +763,18 @@ function pe(i) {
757
763
  const t = typeof i;
758
764
  return t === "string" || t === "number" || t === "boolean";
759
765
  }
760
- function dt(i) {
766
+ function Tt(i) {
761
767
  return i.localName === "textarea";
762
768
  }
763
769
  function he(i) {
764
770
  const { localName: t } = i;
765
771
  return t === "input" || t === "select";
766
772
  }
767
- const ao = (i) => i.replace(/<!--[\s\S]*?-->/g, "");
768
- function ln(i, t, e, n) {
773
+ const co = (i) => i.replace(/<!--[\s\S]*?-->/g, "");
774
+ function cn(i, t, e, n) {
769
775
  return i.slice(0, t) + n + i.slice(t + e);
770
776
  }
771
- function co(i) {
777
+ function lo(i) {
772
778
  let t = i.trim(), e = null;
773
779
  /^\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
780
  const n = tn.sanitize(t, {
@@ -787,7 +793,7 @@ function re(i) {
787
793
  if (isNaN(t)) throw new st(`can't convert "${i}" to a number`);
788
794
  return t;
789
795
  }
790
- function fn(i, t, e) {
796
+ function ln(i, t, e) {
791
797
  const [n, s] = t.split(":");
792
798
  if (pe(e))
793
799
  if (typeof e == "boolean") {
@@ -805,9 +811,9 @@ function fn(i, t, e) {
805
811
  }
806
812
  function ae(i, t, e) {
807
813
  const [n, s] = t.split(":");
808
- i instanceof CSSStyleRule ? i.style.setProperty(n, e) : (fn(i, n, e), n === "value" && he(i) && (i.value = e));
814
+ i instanceof CSSStyleRule ? i.style.setProperty(n, e) : (ln(i, n, e), n === "value" && he(i) && (i.value = e));
809
815
  }
810
- async function lo(i) {
816
+ async function fo(i) {
811
817
  const t = /* @__PURE__ */ new Set();
812
818
  for (const n of It(i.content)) {
813
819
  const { localName: s } = n;
@@ -897,16 +903,16 @@ class U extends HTMLElement {
897
903
  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
904
  }
899
905
  attributeChangedCallback(t, e, n) {
900
- t === "disabled" && this.#h();
906
+ t === "disabled" && this.#m();
901
907
  const s = U.getPropName(t);
902
908
  if (this.#i(s)) {
903
- const r = this.#A(s, String(n));
909
+ const r = this.#_(s, String(n));
904
910
  this[s] = r;
905
911
  const c = this.#c[s];
906
912
  c && this.setFormValue(c, String(r)), this.propertyChangedCallback(s, e, n);
907
913
  }
908
914
  }
909
- async #S() {
915
+ async #y() {
910
916
  const t = this.#t;
911
917
  let { template: e } = t;
912
918
  if (!e) {
@@ -919,33 +925,35 @@ class U extends HTMLElement {
919
925
  if (!s) throw new st("static property html must be set");
920
926
  s.startsWith("<") || (s = `<span><!--${s}--></span>`), e.innerHTML = n + s;
921
927
  }
922
- await lo(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
928
+ await fo(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
923
929
  }
924
930
  changed(t, e, n) {
925
931
  this[e] = n;
926
932
  }
927
933
  connectedCallback() {
928
- this.#P(), this.#R(), this.#S().then(() => {
929
- this.hasAttribute("disabled") && this.#h(), this.#b(this.shadowRoot), this.#m(this.shadowRoot), this.#y();
934
+ this.#P(), this.#w(), this.#y().then(() => {
935
+ this.hasAttribute("disabled") && this.#m(), this.#S(this.shadowRoot), this.#d(this.shadowRoot), this.#R();
930
936
  });
931
937
  }
932
- #y() {
938
+ #R() {
933
939
  const t = this.#t, { properties: e } = t;
934
940
  for (const [n, { computed: s }] of Object.entries(e))
935
941
  s && (this[n] = this.#o(s));
936
942
  }
937
- #R() {
943
+ #w() {
938
944
  const t = this.#t, { observedAttributes: e, properties: n } = t;
939
945
  for (const [s, r] of Object.entries(n))
940
- this.#w(s, r, e);
946
+ r.computed || this.#h(s, r, e);
947
+ for (const [s, r] of Object.entries(n))
948
+ r.computed && this.#h(s, r, e);
941
949
  }
942
- #w(t, e, n) {
950
+ #h(t, e, n) {
943
951
  const s = U.getAttrName(t), r = this.hasAttribute(s);
944
952
  e.required && !r && this.#e(this, t, "is a required attribute");
945
953
  let c = e.value;
946
954
  this.hasOwnProperty(t) && (c = this[t], delete this[t]);
947
- const { type: u } = e, p = u === Boolean ? c || r : n.includes(s) && r ? this.#g(t, s) : c || ro(u), h = "#" + t;
948
- this[h] = p, e.computed && this.#L(t, e), Object.defineProperty(this, t, {
955
+ const { type: u } = e, p = u === Boolean ? c || r : n.includes(s) && r ? this.#A(t, s) : c || ao(u), h = "#" + t;
956
+ this[h] = p, e.computed && this.#N(t, e), Object.defineProperty(this, t, {
949
957
  enumerable: !0,
950
958
  get() {
951
959
  return this[h];
@@ -956,7 +964,7 @@ class U extends HTMLElement {
956
964
  if (m === b) return;
957
965
  this.#x(t, u, m), this[h] = m;
958
966
  const { state: G, stateProp: H } = this.#t.properties[t];
959
- H && Jn(G, H, m), this.#D(t), this.#N(t, u, m, s), this.#E(t), this.#I(t, m);
967
+ H && Zn(G, H, m), this.#D(t), this.#L(t, u, m, s), this.#g(t), this.#I(t, m);
960
968
  const B = this.#c[t];
961
969
  B && this.setFormValue(B, String(m)), this.propertyChangedCallback(t, b, m), e.dispatch && this.dispatch("change", {
962
970
  tagName: this.localName,
@@ -967,10 +975,10 @@ class U extends HTMLElement {
967
975
  }
968
976
  });
969
977
  }
970
- #h() {
978
+ #m() {
971
979
  const t = this.hasAttribute("disabled"), e = It(this.shadowRoot);
972
980
  for (const n of e)
973
- io(n) && (n.disabled = t);
981
+ ro(n) && (n.disabled = t);
974
982
  }
975
983
  disconnectedCallback() {
976
984
  this.#n.clear(), this.#l.clear(), this.#u.clear();
@@ -992,7 +1000,7 @@ class U extends HTMLElement {
992
1000
  #O(t) {
993
1001
  const e = t instanceof U;
994
1002
  for (const n of t.getAttributeNames()) {
995
- const s = t.getAttribute(n), r = this.#T(t, s);
1003
+ const s = t.getAttribute(n), r = this.#E(t, s);
996
1004
  if (r) {
997
1005
  const c = this[r];
998
1006
  c === void 0 && this.#a(t, n, r), t[r] = c;
@@ -1006,8 +1014,7 @@ class U extends HTMLElement {
1006
1014
  }
1007
1015
  }
1008
1016
  #o(t) {
1009
- const e = new Function("return " + t).call(this);
1010
- return Array.isArray(e) ? e.join("") : e;
1017
+ return new Function("return " + t).call(this);
1011
1018
  }
1012
1019
  #C(t) {
1013
1020
  const { localName: e } = t;
@@ -1024,7 +1031,7 @@ class U extends HTMLElement {
1024
1031
  }
1025
1032
  } else {
1026
1033
  let n = "";
1027
- if (dt(t)) {
1034
+ if (Tt(t)) {
1028
1035
  this.#r(t.textContent, t);
1029
1036
  const s = t.textContent?.match(no);
1030
1037
  s && (n = s[1]);
@@ -1035,8 +1042,8 @@ class U extends HTMLElement {
1035
1042
  s && (n = s.textContent?.trim() ?? "");
1036
1043
  }
1037
1044
  if (n) {
1038
- const s = this.#T(t, n);
1039
- s && dt(t) ? t.textContent = this[s] : this.#r(n, t);
1045
+ const s = this.#E(t, n);
1046
+ s && Tt(t) ? t.textContent = this[s] : this.#r(n, t);
1040
1047
  }
1041
1048
  }
1042
1049
  }
@@ -1085,28 +1092,28 @@ class U extends HTMLElement {
1085
1092
  if (n.length !== 1) return;
1086
1093
  const [s] = n;
1087
1094
  if (!se.test(s)) return;
1088
- const r = he(t) || dt(t);
1095
+ const r = he(t) || Tt(t);
1089
1096
  let [c, u] = (e ?? "").split(":");
1090
- if (!(r && c === "value" || dt(t))) return;
1097
+ if (!(r && c === "value" || Tt(t))) return;
1091
1098
  u ? t["on" + u] === void 0 && this.#e(t, e, "refers to an unsupported event name") : u = "change";
1092
- const h = Lt(s);
1099
+ const h = dt(s);
1093
1100
  t.addEventListener(u, (m) => {
1094
1101
  const { target: b } = m;
1095
1102
  if (!b) return;
1096
1103
  const G = b.value, { type: H } = this.#t.properties[h];
1097
- this[h] = H === Number ? re(G) : G, this.#E(h);
1104
+ this[h] = H === Number ? re(G) : G, this.#g(h);
1098
1105
  });
1099
1106
  }
1100
1107
  #i(t) {
1101
1108
  return !!this.#t.properties[t];
1102
1109
  }
1103
- #m(t) {
1110
+ #d(t) {
1104
1111
  const e = Array.from(t.querySelectorAll("*"));
1105
1112
  for (const n of e)
1106
1113
  this.#O(n), n.firstElementChild || this.#C(n);
1107
1114
  }
1108
1115
  // formAssociated is only needed when the component is inside a form.
1109
- #d() {
1116
+ #T() {
1110
1117
  if (this.#t.formAssociated || this.closest("form") === null) return;
1111
1118
  const t = this.#t.name;
1112
1119
  throw new st(
@@ -1122,26 +1129,26 @@ class U extends HTMLElement {
1122
1129
  // Subclasses can override this to add functionality.
1123
1130
  propertyChangedCallback(t, e, n) {
1124
1131
  }
1125
- #T(t, e) {
1132
+ #E(t, e) {
1126
1133
  if (!e || !se.test(e)) return;
1127
- const n = Lt(e);
1134
+ const n = dt(e);
1128
1135
  return this[n] === void 0 && this.#a(t, "", n), n;
1129
1136
  }
1130
- #E(t) {
1137
+ #g(t) {
1131
1138
  const s = this.#t.propToExprsMap.get(t) || [];
1132
1139
  for (const r of s) {
1133
1140
  let c = this.#o(r);
1134
1141
  const u = this.#n.get(r) ?? [];
1135
1142
  for (const p of u)
1136
1143
  if (p instanceof HTMLElement)
1137
- this.#_(p, c);
1144
+ this.#b(p, c);
1138
1145
  else if (!(p instanceof CSSStyleRule)) {
1139
1146
  const { element: h, attrName: m } = p;
1140
1147
  h instanceof CSSStyleRule ? h.style.setProperty(m, c) : ae(h, m, c);
1141
1148
  }
1142
1149
  }
1143
1150
  }
1144
- #L(t, e) {
1151
+ #N(t, e) {
1145
1152
  const { computed: n, uses: s } = e, r = this.#t.propToComputedMap;
1146
1153
  function c(p, h) {
1147
1154
  let m = r.get(p);
@@ -1149,7 +1156,7 @@ class U extends HTMLElement {
1149
1156
  }
1150
1157
  const u = n.match(ie) || [];
1151
1158
  for (const p of u) {
1152
- const h = p.substring(an);
1159
+ const h = dt(p);
1153
1160
  this[h] === void 0 && this.#a(null, t, h), typeof this[h] != "function" && c(h, n);
1154
1161
  }
1155
1162
  if (s)
@@ -1168,7 +1175,7 @@ class U extends HTMLElement {
1168
1175
  }
1169
1176
  const r = this.#t;
1170
1177
  s.forEach((p) => {
1171
- const h = Lt(p);
1178
+ const h = dt(p);
1172
1179
  if (typeof this[h] == "function") return;
1173
1180
  const m = r.propToExprsMap;
1174
1181
  let b = m.get(h);
@@ -1185,7 +1192,7 @@ class U extends HTMLElement {
1185
1192
  let c = this.#n.get(t);
1186
1193
  c || (c = [], this.#n.set(t, c)), c.push(n ? { element: e, attrName: n } : e), e instanceof HTMLElement && this.#M(e, n, s);
1187
1194
  const u = this.#o(t);
1188
- n ? ae(e, n, u) : this.#_(e, u);
1195
+ n ? ae(e, n, u) : this.#b(e, u);
1189
1196
  }
1190
1197
  // This follows the best practice
1191
1198
  // "Do not override author-set, global attributes."
@@ -1204,10 +1211,10 @@ class U extends HTMLElement {
1204
1211
  #a(t, e, n) {
1205
1212
  this.#e(t, e, `refers to missing property "${n}"`);
1206
1213
  }
1207
- #g(t, e) {
1208
- return this.#A(t, this.getAttribute(e));
1209
- }
1210
1214
  #A(t, e) {
1215
+ return this.#_(t, this.getAttribute(e));
1216
+ }
1217
+ #_(t, e) {
1211
1218
  if (e?.match(ie)) return e;
1212
1219
  const n = this.#t, { type: s } = n.properties[t];
1213
1220
  if (s || this.#e(null, t, "does not specify its type"), s === String) return e;
@@ -1221,10 +1228,10 @@ class U extends HTMLElement {
1221
1228
  }
1222
1229
  // Updates the matching attribute for a property if there is one.
1223
1230
  // VS Code thinks this is never called, but it is called by #defineProp.
1224
- #N(t, e, n, s) {
1231
+ #L(t, e, n, s) {
1225
1232
  if (pe(n) && this.hasAttribute(s)) {
1226
- const r = e === Boolean ? this.hasAttribute(s) : this.#g(t, s);
1227
- n !== r && fn(this, t, n);
1233
+ const r = e === Boolean ? this.hasAttribute(s) : this.#A(t, s);
1234
+ n !== r && ln(this, t, n);
1228
1235
  }
1229
1236
  }
1230
1237
  // Updates all computed properties that reference this property.
@@ -1234,19 +1241,23 @@ class U extends HTMLElement {
1234
1241
  for (const [s, r] of n)
1235
1242
  this[s] = this.#o(r);
1236
1243
  }
1237
- #_(t, e) {
1244
+ #b(t, e) {
1238
1245
  if (e === void 0) return;
1239
- const n = t instanceof HTMLElement, s = typeof e;
1240
- if (s !== "string" && s !== "number" && this.#e(
1246
+ const n = t instanceof HTMLElement;
1247
+ Array.isArray(e) && (e = e.join(""));
1248
+ const s = typeof e;
1249
+ s !== "string" && s !== "number" && this.#e(
1241
1250
  t,
1242
1251
  void 0,
1243
1252
  " computed content is not a string or number"
1244
- ), t instanceof HTMLElement && dt(t))
1245
- t.value = e;
1246
- else if (n && s === "string" && e.trim().startsWith("<")) {
1247
- const r = co(e);
1248
- t.replaceChildren(...r), this.#b(t), this.#m(t);
1249
- } else n && (t.textContent = e);
1253
+ );
1254
+ const r = String(e);
1255
+ if (t instanceof HTMLElement && Tt(t))
1256
+ t.value = r;
1257
+ else if (n && s === "string" && r.trim().startsWith("<")) {
1258
+ const c = lo(r);
1259
+ t.replaceChildren(...c), this.#S(t), this.#d(t);
1260
+ } else n && (t.textContent = r);
1250
1261
  }
1251
1262
  // Update corresponding parent web component property if bound to one.
1252
1263
  // VS Code thinks this is never called, but it is called by #defineProp.
@@ -1290,14 +1301,14 @@ class U extends HTMLElement {
1290
1301
  `property "${n}" is not allowed because it is a reserved attribute`
1291
1302
  );
1292
1303
  for (const n of this.getAttributeNames())
1293
- if (n !== "class" && n !== "id" && n !== "disabled" && !n.startsWith("on")) {
1304
+ if (!Jn.has(n) && !n.startsWith("on")) {
1294
1305
  if (n === "form-assoc") {
1295
- this.#d();
1306
+ this.#T();
1296
1307
  continue;
1297
1308
  }
1298
1309
  if (!e.has(U.getPropName(n))) {
1299
1310
  if (n === "name") {
1300
- this.#d();
1311
+ this.#T();
1301
1312
  continue;
1302
1313
  }
1303
1314
  this.#e(null, n, "is not a supported attribute");
@@ -1308,7 +1319,7 @@ class U extends HTMLElement {
1308
1319
  const s = n.match(ie);
1309
1320
  if (s)
1310
1321
  return s.forEach((r) => {
1311
- const c = Lt(r);
1322
+ const c = dt(r);
1312
1323
  this[c] === void 0 && this.#a(t, e, c);
1313
1324
  }), s;
1314
1325
  }
@@ -1343,7 +1354,7 @@ class U extends HTMLElement {
1343
1354
  `was set to a ${s}, but must be a ${e.name}`
1344
1355
  );
1345
1356
  }
1346
- #b(t) {
1357
+ #S(t) {
1347
1358
  const e = Array.from(t.querySelectorAll("*"));
1348
1359
  for (const n of e) {
1349
1360
  const s = [];
@@ -1363,8 +1374,8 @@ class U extends HTMLElement {
1363
1374
  }
1364
1375
  }
1365
1376
  }
1366
- function ho(i, ...t) {
1367
- let e = cn(i, t);
1377
+ function mo(i, ...t) {
1378
+ let e = an(i, t);
1368
1379
  for (; ; ) {
1369
1380
  const n = to.exec(e);
1370
1381
  if (!n) break;
@@ -1374,21 +1385,21 @@ function ho(i, ...t) {
1374
1385
  if (!r.startsWith("--")) {
1375
1386
  const c = `--${r}: ${s};
1376
1387
  ${r}: var(--${r})`;
1377
- e = ln(e, n.index, n[0].length, c);
1388
+ e = cn(e, n.index, n[0].length, c);
1378
1389
  }
1379
1390
  }
1380
1391
  }
1381
1392
  return e;
1382
1393
  }
1383
- function mo(i, ...t) {
1384
- let e = cn(i, t);
1394
+ function To(i, ...t) {
1395
+ let e = an(i, t);
1385
1396
  for (; ; ) {
1386
1397
  const n = oo.exec(e);
1387
1398
  if (!n || n[1] === "style") break;
1388
- const s = ao(n[2]);
1399
+ const s = co(n[2]);
1389
1400
  if (rn.test(s)) {
1390
1401
  const r = `<!-- ${s.trim()} -->`, c = n.index + n[0].indexOf(">") + 1;
1391
- e = ln(e, c, s.length, r);
1402
+ e = cn(e, c, s.length, r);
1392
1403
  }
1393
1404
  }
1394
1405
  return e;
@@ -1396,7 +1407,7 @@ function mo(i, ...t) {
1396
1407
  export {
1397
1408
  U as Wrec,
1398
1409
  ue as WrecState,
1399
- po as createElement,
1400
- ho as css,
1401
- mo as html
1410
+ ho as createElement,
1411
+ mo as css,
1412
+ To as html
1402
1413
  };
package/dist/wrec.umd.js CHANGED
@@ -1,5 +1,5 @@
1
- (function(T,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(T=typeof globalThis<"u"?globalThis:T||self,g(T.wrec={}))})(this,(function(T){"use strict";var fn=T=>{throw TypeError(T)};var Ee=(T,g,M)=>g.has(T)||fn("Cannot "+M);var O=(T,g,M)=>(Ee(T,g,"read from private field"),M?M.call(T):g.get(T)),q=(T,g,M)=>g.has(T)?fn("Cannot add the same private member more than once"):g instanceof WeakSet?g.add(T):g.set(T,M),ct=(T,g,M,St)=>(Ee(T,g,"write to private field"),St?St.call(T,M):g.set(T,M),M),un=(T,g,M)=>(Ee(T,g,"access private method"),M);var K,Nt,H,Tt,Et,Y,Dt,pn;const{entries:g,setPrototypeOf:M,isFrozen:St,getPrototypeOf:hn,getOwnPropertyDescriptor:mn}=Object;let{freeze:L,seal:x,create:zt}=Object,{apply:$t,construct:Wt}=typeof Reflect<"u"&&Reflect;L||(L=function(t){return t}),x||(x=function(t){return t}),$t||($t=function(t,e){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(e,s)}),Wt||(Wt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return new t(...n)});const yt=D(Array.prototype.forEach),dn=D(Array.prototype.lastIndexOf),ge=D(Array.prototype.pop),lt=D(Array.prototype.push),Tn=D(Array.prototype.splice),Rt=D(String.prototype.toLowerCase),Gt=D(String.prototype.toString),Bt=D(String.prototype.match),ft=D(String.prototype.replace),En=D(String.prototype.indexOf),gn=D(String.prototype.trim),k=D(Object.prototype.hasOwnProperty),N=D(RegExp.prototype.test),ut=An(TypeError);function D(r){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return $t(r,t,n)}}function An(r){return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Wt(r,e)}}function d(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Rt;M&&M(r,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=e(s);i!==s&&(St(t)||(t[n]=i),s=i)}r[s]=!0}return r}function _n(r){for(let t=0;t<r.length;t++)k(r,t)||(r[t]=null);return r}function U(r){const t=zt(null);for(const[e,n]of g(r))k(r,e)&&(Array.isArray(n)?t[e]=_n(n):n&&typeof n=="object"&&n.constructor===Object?t[e]=U(n):t[e]=n);return t}function pt(r,t){for(;r!==null;){const n=mn(r,t);if(n){if(n.get)return D(n.get);if(typeof n.value=="function")return D(n.value)}r=hn(r)}function e(){return null}return e}const Ae=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"]),jt=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"]),Yt=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"]),bn=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"]),Vt=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"]),Sn=L(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_e=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"]),Xt=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"]),Se=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"]),yn=x(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Rn=x(/<%[\w\W]*|[\w\W]*%>/gm),wn=x(/\$\{[\w\W]*/gm),On=x(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cn=x(/^aria-[\-\w]+$/),ye=x(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Mn=x(/^(?:\w+script|data):/i),Ln=x(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Re=x(/^html$/i),Nn=x(/^[a-z][.\w]*(-[.\w]+)+$/i);var we=Object.freeze({__proto__:null,ARIA_ATTR:Cn,ATTR_WHITESPACE:Ln,CUSTOM_ELEMENT:Nn,DATA_ATTR:On,DOCTYPE_NAME:Re,ERB_EXPR:Rn,IS_ALLOWED_URI:ye,IS_SCRIPT_OR_DATA:Mn,MUSTACHE_EXPR:yn,TMPLIT_EXPR:wn});const ht={element:1,text:3,progressingInstruction:7,comment:8,document:9},Dn=function(){return typeof window>"u"?null:window},In=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(n=e.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Oe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ce(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Dn();const t=f=>Ce(f);if(t.version="3.3.1",t.removed=[],!r||!r.document||r.document.nodeType!==ht.document||!r.Element)return t.isSupported=!1,t;let{document:e}=r;const n=e,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:c,Node:u,Element:p,NodeFilter:h,NamedNodeMap:m=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:y,DOMParser:V,trustedTypes:W}=r,X=p.prototype,Xn=pt(X,"cloneNode"),qn=pt(X,"remove"),Kn=pt(X,"nextSibling"),Zn=pt(X,"childNodes"),It=pt(X,"parentNode");if(typeof c=="function"){const f=e.createElement("template");f.content&&f.content.ownerDocument&&(e=f.content.ownerDocument)}let I,gt="";const{implementation:ee,createNodeIterator:Jn,createDocumentFragment:Qn,getElementsByTagName:to}=e,{importNode:eo}=n;let P=Oe();t.isSupported=typeof g=="function"&&typeof It=="function"&&ee&&ee.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ne,ERB_EXPR:oe,TMPLIT_EXPR:se,DATA_ATTR:no,ARIA_ATTR:oo,IS_SCRIPT_OR_DATA:so,ATTR_WHITESPACE:He,CUSTOM_ELEMENT:io}=we;let{IS_ALLOWED_URI:ze}=we,S=null;const $e=d({},[...Ae,...jt,...Yt,...Vt,..._e]);let R=null;const We=d({},[...be,...Xt,...Se,...wt]);let A=Object.seal(zt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),At=null,ie=null;const et=Object.seal(zt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ge=!0,re=!0,Be=!1,je=!0,nt=!1,Pt=!0,Z=!1,ae=!1,ce=!1,ot=!1,vt=!1,xt=!1,Ye=!0,Ve=!1;const ro="user-content-";let le=!0,_t=!1,st={},z=null;const fe=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"]);let Xe=null;const qe=d({},["audio","video","img","source","image","track"]);let ue=null;const Ke=d({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",Ft="http://www.w3.org/2000/svg",G="http://www.w3.org/1999/xhtml";let it=G,pe=!1,he=null;const ao=d({},[kt,Ft,G],Gt);let Ut=d({},["mi","mo","mn","ms","mtext"]),Ht=d({},["annotation-xml"]);const co=d({},["title","style","font","a","script"]);let bt=null;const lo=["application/xhtml+xml","text/html"],fo="text/html";let b=null,rt=null;const uo=e.createElement("form"),Ze=function(o){return o instanceof RegExp||o instanceof Function},me=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rt&&rt===o)){if((!o||typeof o!="object")&&(o={}),o=U(o),bt=lo.indexOf(o.PARSER_MEDIA_TYPE)===-1?fo:o.PARSER_MEDIA_TYPE,b=bt==="application/xhtml+xml"?Gt:Rt,S=k(o,"ALLOWED_TAGS")?d({},o.ALLOWED_TAGS,b):$e,R=k(o,"ALLOWED_ATTR")?d({},o.ALLOWED_ATTR,b):We,he=k(o,"ALLOWED_NAMESPACES")?d({},o.ALLOWED_NAMESPACES,Gt):ao,ue=k(o,"ADD_URI_SAFE_ATTR")?d(U(Ke),o.ADD_URI_SAFE_ATTR,b):Ke,Xe=k(o,"ADD_DATA_URI_TAGS")?d(U(qe),o.ADD_DATA_URI_TAGS,b):qe,z=k(o,"FORBID_CONTENTS")?d({},o.FORBID_CONTENTS,b):fe,At=k(o,"FORBID_TAGS")?d({},o.FORBID_TAGS,b):U({}),ie=k(o,"FORBID_ATTR")?d({},o.FORBID_ATTR,b):U({}),st=k(o,"USE_PROFILES")?o.USE_PROFILES:!1,Ge=o.ALLOW_ARIA_ATTR!==!1,re=o.ALLOW_DATA_ATTR!==!1,Be=o.ALLOW_UNKNOWN_PROTOCOLS||!1,je=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,nt=o.SAFE_FOR_TEMPLATES||!1,Pt=o.SAFE_FOR_XML!==!1,Z=o.WHOLE_DOCUMENT||!1,ot=o.RETURN_DOM||!1,vt=o.RETURN_DOM_FRAGMENT||!1,xt=o.RETURN_TRUSTED_TYPE||!1,ce=o.FORCE_BODY||!1,Ye=o.SANITIZE_DOM!==!1,Ve=o.SANITIZE_NAMED_PROPS||!1,le=o.KEEP_CONTENT!==!1,_t=o.IN_PLACE||!1,ze=o.ALLOWED_URI_REGEXP||ye,it=o.NAMESPACE||G,Ut=o.MATHML_TEXT_INTEGRATION_POINTS||Ut,Ht=o.HTML_INTEGRATION_POINTS||Ht,A=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Ze(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(A.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Ze(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(A.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),nt&&(re=!1),vt&&(ot=!0),st&&(S=d({},_e),R=[],st.html===!0&&(d(S,Ae),d(R,be)),st.svg===!0&&(d(S,jt),d(R,Xt),d(R,wt)),st.svgFilters===!0&&(d(S,Yt),d(R,Xt),d(R,wt)),st.mathMl===!0&&(d(S,Vt),d(R,Se),d(R,wt))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?et.tagCheck=o.ADD_TAGS:(S===$e&&(S=U(S)),d(S,o.ADD_TAGS,b))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?et.attributeCheck=o.ADD_ATTR:(R===We&&(R=U(R)),d(R,o.ADD_ATTR,b))),o.ADD_URI_SAFE_ATTR&&d(ue,o.ADD_URI_SAFE_ATTR,b),o.FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.FORBID_CONTENTS,b)),o.ADD_FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.ADD_FORBID_CONTENTS,b)),le&&(S["#text"]=!0),Z&&d(S,["html","head","body"]),S.table&&(d(S,["tbody"]),delete At.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=o.TRUSTED_TYPES_POLICY,gt=I.createHTML("")}else I===void 0&&(I=In(W,s)),I!==null&&typeof gt=="string"&&(gt=I.createHTML(""));L&&L(o),rt=o}},Je=d({},[...jt,...Yt,...bn]),Qe=d({},[...Vt,...Sn]),po=function(o){let a=It(o);(!a||!a.tagName)&&(a={namespaceURI:it,tagName:"template"});const l=Rt(o.tagName),E=Rt(a.tagName);return he[o.namespaceURI]?o.namespaceURI===Ft?a.namespaceURI===G?l==="svg":a.namespaceURI===kt?l==="svg"&&(E==="annotation-xml"||Ut[E]):!!Je[l]:o.namespaceURI===kt?a.namespaceURI===G?l==="math":a.namespaceURI===Ft?l==="math"&&Ht[E]:!!Qe[l]:o.namespaceURI===G?a.namespaceURI===Ft&&!Ht[E]||a.namespaceURI===kt&&!Ut[E]?!1:!Qe[l]&&(co[l]||!Je[l]):!!(bt==="application/xhtml+xml"&&he[o.namespaceURI]):!1},$=function(o){lt(t.removed,{element:o});try{It(o).removeChild(o)}catch{qn(o)}},J=function(o,a){try{lt(t.removed,{attribute:a.getAttributeNode(o),from:a})}catch{lt(t.removed,{attribute:null,from:a})}if(a.removeAttribute(o),o==="is")if(ot||vt)try{$(a)}catch{}else try{a.setAttribute(o,"")}catch{}},tn=function(o){let a=null,l=null;if(ce)o="<remove></remove>"+o;else{const _=Bt(o,/^[\r\n\t ]+/);l=_&&_[0]}bt==="application/xhtml+xml"&&it===G&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");const E=I?I.createHTML(o):o;if(it===G)try{a=new V().parseFromString(E,bt)}catch{}if(!a||!a.documentElement){a=ee.createDocument(it,"template",null);try{a.documentElement.innerHTML=pe?gt:E}catch{}}const C=a.body||a.documentElement;return o&&l&&C.insertBefore(e.createTextNode(l),C.childNodes[0]||null),it===G?to.call(a,Z?"html":"body")[0]:Z?a.documentElement:C},en=function(o){return Jn.call(o.ownerDocument||o,o,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},de=function(o){return o instanceof y&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof m)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},nn=function(o){return typeof u=="function"&&o instanceof u};function B(f,o,a){yt(f,l=>{l.call(t,o,a,rt)})}const on=function(o){let a=null;if(B(P.beforeSanitizeElements,o,null),de(o))return $(o),!0;const l=b(o.nodeName);if(B(P.uponSanitizeElement,o,{tagName:l,allowedTags:S}),Pt&&o.hasChildNodes()&&!nn(o.firstElementChild)&&N(/<[/\w!]/g,o.innerHTML)&&N(/<[/\w!]/g,o.textContent)||o.nodeType===ht.progressingInstruction||Pt&&o.nodeType===ht.comment&&N(/<[/\w]/g,o.data))return $(o),!0;if(!(et.tagCheck instanceof Function&&et.tagCheck(l))&&(!S[l]||At[l])){if(!At[l]&&rn(l)&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l)))return!1;if(le&&!z[l]){const E=It(o)||o.parentNode,C=Zn(o)||o.childNodes;if(C&&E){const _=C.length;for(let v=_-1;v>=0;--v){const j=Xn(C[v],!0);j.__removalCount=(o.__removalCount||0)+1,E.insertBefore(j,Kn(o))}}}return $(o),!0}return o instanceof p&&!po(o)||(l==="noscript"||l==="noembed"||l==="noframes")&&N(/<\/no(script|embed|frames)/i,o.innerHTML)?($(o),!0):(nt&&o.nodeType===ht.text&&(a=o.textContent,yt([ne,oe,se],E=>{a=ft(a,E," ")}),o.textContent!==a&&(lt(t.removed,{element:o.cloneNode()}),o.textContent=a)),B(P.afterSanitizeElements,o,null),!1)},sn=function(o,a,l){if(Ye&&(a==="id"||a==="name")&&(l in e||l in uo))return!1;if(!(re&&!ie[a]&&N(no,a))){if(!(Ge&&N(oo,a))){if(!(et.attributeCheck instanceof Function&&et.attributeCheck(a,o))){if(!R[a]||ie[a]){if(!(rn(o)&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o))&&(A.attributeNameCheck instanceof RegExp&&N(A.attributeNameCheck,a)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(a,o))||a==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l))))return!1}else if(!ue[a]){if(!N(ze,ft(l,He,""))){if(!((a==="src"||a==="xlink:href"||a==="href")&&o!=="script"&&En(l,"data:")===0&&Xe[o])){if(!(Be&&!N(so,ft(l,He,"")))){if(l)return!1}}}}}}}return!0},rn=function(o){return o!=="annotation-xml"&&Bt(o,io)},an=function(o){B(P.beforeSanitizeAttributes,o,null);const{attributes:a}=o;if(!a||de(o))return;const l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0};let E=a.length;for(;E--;){const C=a[E],{name:_,namespaceURI:v,value:j}=C,at=b(_),Te=j;let w=_==="value"?Te:gn(Te);if(l.attrName=at,l.attrValue=w,l.keepAttr=!0,l.forceKeepAttr=void 0,B(P.uponSanitizeAttribute,o,l),w=l.attrValue,Ve&&(at==="id"||at==="name")&&(J(_,o),w=ro+w),Pt&&N(/((--!?|])>)|<\/(style|title|textarea)/i,w)){J(_,o);continue}if(at==="attributename"&&Bt(w,"href")){J(_,o);continue}if(l.forceKeepAttr)continue;if(!l.keepAttr){J(_,o);continue}if(!je&&N(/\/>/i,w)){J(_,o);continue}nt&&yt([ne,oe,se],ln=>{w=ft(w,ln," ")});const cn=b(o.nodeName);if(!sn(cn,at,w)){J(_,o);continue}if(I&&typeof W=="object"&&typeof W.getAttributeType=="function"&&!v)switch(W.getAttributeType(cn,at)){case"TrustedHTML":{w=I.createHTML(w);break}case"TrustedScriptURL":{w=I.createScriptURL(w);break}}if(w!==Te)try{v?o.setAttributeNS(v,_,w):o.setAttribute(_,w),de(o)?$(o):ge(t.removed)}catch{J(_,o)}}B(P.afterSanitizeAttributes,o,null)},ho=function f(o){let a=null;const l=en(o);for(B(P.beforeSanitizeShadowDOM,o,null);a=l.nextNode();)B(P.uponSanitizeShadowNode,a,null),on(a),an(a),a.content instanceof i&&f(a.content);B(P.afterSanitizeShadowDOM,o,null)};return t.sanitize=function(f){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,l=null,E=null,C=null;if(pe=!f,pe&&(f="<!-->"),typeof f!="string"&&!nn(f))if(typeof f.toString=="function"){if(f=f.toString(),typeof f!="string")throw ut("dirty is not a string, aborting")}else throw ut("toString is not a function");if(!t.isSupported)return f;if(ae||me(o),t.removed=[],typeof f=="string"&&(_t=!1),_t){if(f.nodeName){const j=b(f.nodeName);if(!S[j]||At[j])throw ut("root node is forbidden and cannot be sanitized in-place")}}else if(f instanceof u)a=tn("<!---->"),l=a.ownerDocument.importNode(f,!0),l.nodeType===ht.element&&l.nodeName==="BODY"||l.nodeName==="HTML"?a=l:a.appendChild(l);else{if(!ot&&!nt&&!Z&&f.indexOf("<")===-1)return I&&xt?I.createHTML(f):f;if(a=tn(f),!a)return ot?null:xt?gt:""}a&&ce&&$(a.firstChild);const _=en(_t?f:a);for(;E=_.nextNode();)on(E),an(E),E.content instanceof i&&ho(E.content);if(_t)return f;if(ot){if(vt)for(C=Qn.call(a.ownerDocument);a.firstChild;)C.appendChild(a.firstChild);else C=a;return(R.shadowroot||R.shadowrootmode)&&(C=eo.call(n,C,!0)),C}let v=Z?a.outerHTML:a.innerHTML;return Z&&S["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&N(Re,a.ownerDocument.doctype.name)&&(v="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
2
- `+v),nt&&yt([ne,oe,se],j=>{v=ft(v,j," ")}),I&&xt?I.createHTML(v):v},t.setConfig=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};me(f),ae=!0},t.clearConfig=function(){rt=null,ae=!1},t.isValidAttribute=function(f,o,a){rt||me({});const l=b(f),E=b(o);return sn(l,E,a)},t.addHook=function(f,o){typeof o=="function"&&lt(P[f],o)},t.removeHook=function(f,o){if(o!==void 0){const a=dn(P[f],o);return a===-1?void 0:Tn(P[f],a,1)[0]}return ge(P[f])},t.removeHooks=function(f){P[f]=[]},t.removeAllHooks=function(){P=Oe()},t}var Me=Ce();function Le(r,t,e=""){const n=new WeakMap,s={get(i,c){const u=Reflect.get(i,c);if(u===null||typeof u!="object")return u;const p=n.get(u);if(p)return p;const h=e?`${e}.${c}`:c,m=Le(u,t,h);return n.set(u,m),m},set(i,c,u){const p=Reflect.get(i,c);if(p!==u){Reflect.set(i,c,u);const h=e?`${e}.${c}`:c;t(h,p,u)}return!0}};return new Proxy(r,s)}function Ne(r){const t={};for(const[e,n]of Object.entries(r)){const s=typeof n=="object"&&n!==null;t[e]=s?Ne(n):n}return t}const Ot=typeof window<"u"&&typeof window.document<"u";let De=class extends Error{};const tt=class tt{constructor(t,e,n){q(this,Dt);q(this,Nt,Symbol("objectId"));q(this,H,[]);q(this,Tt);q(this,Et);q(this,Y);if(!t)throw new De("name cannot be empty");if(O(tt,K).has(t))throw new De(`WrecState with name "${t}" already exists`);if(ct(this,Tt,t),ct(this,Et,e),ct(this,Y,Le({},un(this,Dt,pn).bind(this))),e&&Ot){const s=sessionStorage.getItem("wrec-state-"+t),i=s?JSON.parse(s):void 0;i&&(n=i)}if(n)for(const[s,i]of Object.entries(n))this.addProperty(s,i);O(tt,K).set(t,this)}static get(t){return O(this,K).get(t)}addListener(t,e={}){const n=O(this,H).find(s=>s.listenerRef.deref()===t);if(n){const{propertyMap:s}=n;for(const[i,c]of Object.entries(e))s[i]=c}else O(this,H).push({listenerRef:new WeakRef(t),propertyMap:e})}addProperty(t,e){Object.defineProperty(this,t,{enumerable:!0,get(){return O(this,Y)[t]},set(n){O(this,Y)[t]=n}}),O(this,Y)[t]=e}get id(){return O(this,Nt)}log(){console.log("WrecState:",O(this,Tt));for(const[t,e]of Object.entries(O(this,Y)))console.log(` ${t} = ${JSON.stringify(e)}`)}removeListener(t){ct(this,H,O(this,H).filter(e=>e.listenerRef.deref()!==t))}};K=new WeakMap,Nt=new WeakMap,H=new WeakMap,Tt=new WeakMap,Et=new WeakMap,Y=new WeakMap,Dt=new WeakSet,pn=function(t,e,n){const s=new Set;for(const i of O(this,H)){const c=i.listenerRef.deref();if(!c)s.add(i);else if(Ot&&c instanceof HTMLElement&&!c.isConnected)s.add(i);else{const{propertyMap:u}=i,p=Object.keys(u);(p.length===0||p.includes(t))&&c.changed(t,u[t],n,e,this)}}ct(this,H,O(this,H).filter(i=>!s.has(i)))},q(tt,K,new Map),Ot&&window.addEventListener("beforeunload",()=>{for(const[t,e]of O(tt,K).entries())if(O(e,Et)){const n=Ne(e);sessionStorage.setItem("wrec-state-"+t,JSON.stringify(n))}});let Ct=tt;Ot&&process.env.NODE_ENV==="development"&&(window.WrecState=Ct);function Ie(r,t){let e=r;for(const n of t.split("."))e=e[n];return e}function Pn(r,t,e){const n=t.split("."),s=n.length-1;let i=r;n.forEach((c,u)=>{u===s?i[c]=e:i=i[c]})}const vn=new Set(["onblur","onchange","onclick","onfocus","oninput","onkeydown","onreset","onsubmit"]);Me.addHook("uponSanitizeAttribute",(r,t)=>{const{attrName:e}=t,n=e.toLowerCase();vn.has(n)&&(t.forceKeepAttr=!0)});class Q extends Error{}const xn=/([a-zA-Z-]+)\s*:\s*([^;}]+)/g,Pe="a-zA-Z_$",kn=Pe+"0-9",mt=`[${Pe}][${kn}]*`,Fn=/<!--\s*(.*?)\s*-->/,Un=/<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g,qt=new RegExp(`^this\\.${mt}$`),Kt=new RegExp(`this\\.${mt}(\\.${mt})*`,"g"),ve=new RegExp(`this\\.${mt}(\\.${mt})*`),Hn=new Set(["class","style"]),xe=5;function zn(r){return r instanceof HTMLButtonElement||r instanceof HTMLFieldSetElement||r instanceof HTMLInputElement||r instanceof HTMLSelectElement||r instanceof HTMLTextAreaElement||r instanceof F}function $n(r,t,e){const n=document.createElement(r);if(t)for(const[s,i]of Object.entries(t))n.setAttribute(s,i);return e&&(n.innerHTML=e),n}const Wn=r=>r===String?"":r===Number?0:r===Boolean?!1:r===Array?[]:r===Object?{}:void 0;function Mt(r){const t=[];let e=r.firstElementChild;for(;e;)t.push(e),e.shadowRoot&&t.push(...Mt(e.shadowRoot)),e.firstElementChild&&t.push(...Mt(e)),e=e.nextElementSibling;return t}const Lt=r=>r.substring(xe).split(".")[0];function ke(r,t){let e=r[0];return t.forEach((n,s)=>{e+=n+r[s+1]}),e}function Zt(r){const t=typeof r;return t==="string"||t==="number"||t==="boolean"}function dt(r){return r.localName==="textarea"}function Jt(r){const{localName:t}=r;return t==="input"||t==="select"}const Gn=r=>r.replace(/<!--[\s\S]*?-->/g,"");function Fe(r,t,e,n){return r.slice(0,t)+n+r.slice(t+e)}function Bn(r){let t=r.trim(),e=null;/^\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");const n=Me.sanitize(t,{ADD_TAGS:["#comment"],ALLOW_UNKNOWN_PROTOCOLS:!0,RETURN_DOM_FRAGMENT:!0});if(e){const s=n.querySelector(e);if(s)return s.childNodes}return n.childNodes}function Qt(r){const t=Number(r);if(isNaN(t))throw new Q(`can't convert "${r}" to a number`);return t}function Ue(r,t,e){const[n,s]=t.split(":");if(Zt(e))if(typeof e=="boolean"){e?r.setAttribute(n,n):r.removeAttribute(n);const i=F.getPropName(n);r[i]=e}else{const i=r.getAttribute(t),c=String(e);i!==c&&(r.setAttribute(n,c),n==="value"&&Jt(r)&&(r.value=c))}else{const i=F.getPropName(t);r[i]=e}}function te(r,t,e){const[n,s]=t.split(":");r instanceof CSSStyleRule?r.style.setProperty(n,e):(Ue(r,n,e),n==="value"&&Jt(r)&&(r.value=e))}async function jn(r){const t=new Set;for(const n of Mt(r.content)){const{localName:s}=n;s.includes("-")&&t.add(s)}function e(n){return new Promise((s,i)=>{setTimeout(()=>{const c=`custom element <${n}> not defined`;i(new Error(c))},1e3)})}return Promise.all([...t].map(async n=>Promise.race([customElements.whenDefined(n),e(n)])))}class F extends HTMLElement{static attrToPropMap=new Map;static propToAttrMap=new Map;static css="";static elementName="";static formAssociated=!1;static html="";static properties;static propToComputedMap;static propToExprsMap;static template=null;#t=this.constructor;#n=new Map;#c={};#s;#l={};#f=null;#u=new Map;static define(t){if(this.elementName=t,customElements.get(t))throw new Q(`custom element ${t} is already defined`);customElements.define(t,this)}constructor(){super(),this.attachShadow({mode:"open"});const t=this.#t;t.attrToPropMap||(t.attrToPropMap=new Map),t.properties||(t.properties={}),t.propToAttrMap||(t.propToExprsMap=new Map),t.propToComputedMap||(t.propToComputedMap=new Map),t.propToExprsMap||(t.propToExprsMap=new Map)}attributeChangedCallback(t,e,n){t==="disabled"&&this.#h();const s=F.getPropName(t);if(this.#i(s)){const i=this.#A(s,String(n));this[s]=i;const c=this.#c[s];c&&this.setFormValue(c,String(i)),this.propertyChangedCallback(s,e,n)}}async#S(){const t=this.#t;let{template:e}=t;if(!e){e=t.template=document.createElement("template");let n=`<style>
1
+ (function(T,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(T=typeof globalThis<"u"?globalThis:T||self,E(T.wrec={}))})(this,(function(T){"use strict";var ln=T=>{throw TypeError(T)};var ge=(T,E,M)=>E.has(T)||ln("Cannot "+M);var O=(T,E,M)=>(ge(T,E,"read from private field"),M?M.call(T):E.get(T)),q=(T,E,M)=>E.has(T)?ln("Cannot add the same private member more than once"):E instanceof WeakSet?E.add(T):E.set(T,M),ct=(T,E,M,yt)=>(ge(T,E,"write to private field"),yt?yt.call(T,M):E.set(T,M),M),fn=(T,E,M)=>(ge(T,E,"access private method"),M);var K,Lt,H,gt,Et,Y,Dt,un;const{entries:E,setPrototypeOf:M,isFrozen:yt,getPrototypeOf:pn,getOwnPropertyDescriptor:hn}=Object;let{freeze:N,seal:x,create:zt}=Object,{apply:$t,construct:Wt}=typeof Reflect<"u"&&Reflect;N||(N=function(t){return t}),x||(x=function(t){return t}),$t||($t=function(t,e){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(e,s)}),Wt||(Wt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return new t(...n)});const Rt=D(Array.prototype.forEach),mn=D(Array.prototype.lastIndexOf),Ee=D(Array.prototype.pop),lt=D(Array.prototype.push),dn=D(Array.prototype.splice),wt=D(String.prototype.toLowerCase),Gt=D(String.prototype.toString),Bt=D(String.prototype.match),ft=D(String.prototype.replace),Tn=D(String.prototype.indexOf),gn=D(String.prototype.trim),k=D(Object.prototype.hasOwnProperty),L=D(RegExp.prototype.test),ut=En(TypeError);function D(r){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return $t(r,t,n)}}function En(r){return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Wt(r,e)}}function d(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wt;M&&M(r,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=e(s);i!==s&&(yt(t)||(t[n]=i),s=i)}r[s]=!0}return r}function An(r){for(let t=0;t<r.length;t++)k(r,t)||(r[t]=null);return r}function U(r){const t=zt(null);for(const[e,n]of E(r))k(r,e)&&(Array.isArray(n)?t[e]=An(n):n&&typeof n=="object"&&n.constructor===Object?t[e]=U(n):t[e]=n);return t}function pt(r,t){for(;r!==null;){const n=hn(r,t);if(n){if(n.get)return D(n.get);if(typeof n.value=="function")return D(n.value)}r=pn(r)}function e(){return null}return e}const Ae=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"]),jt=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"]),Yt=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"]),Vt=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"]),_e=N(["#text"]),be=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"]),Xt=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"]),Se=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"]),Ot=N(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Sn=x(/\{\{[\w\W]*|[\w\W]*\}\}/gm),yn=x(/<%[\w\W]*|[\w\W]*%>/gm),Rn=x(/\$\{[\w\W]*/gm),wn=x(/^data-[\-\w.\u00B7-\uFFFF]+$/),On=x(/^aria-[\-\w]+$/),ye=x(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Cn=x(/^(?:\w+script|data):/i),Mn=x(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Re=x(/^html$/i),Nn=x(/^[a-z][.\w]*(-[.\w]+)+$/i);var we=Object.freeze({__proto__:null,ARIA_ATTR:On,ATTR_WHITESPACE:Mn,CUSTOM_ELEMENT:Nn,DATA_ATTR:wn,DOCTYPE_NAME:Re,ERB_EXPR:yn,IS_ALLOWED_URI:ye,IS_SCRIPT_OR_DATA:Cn,MUSTACHE_EXPR:Sn,TMPLIT_EXPR:Rn});const ht={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ln=function(){return typeof window>"u"?null:window},Dn=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(n=e.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Oe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ce(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ln();const t=f=>Ce(f);if(t.version="3.3.1",t.removed=[],!r||!r.document||r.document.nodeType!==ht.document||!r.Element)return t.isSupported=!1,t;let{document:e}=r;const n=e,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:c,Node:u,Element:p,NodeFilter:h,NamedNodeMap:m=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:y,DOMParser:V,trustedTypes:W}=r,X=p.prototype,qn=pt(X,"cloneNode"),Kn=pt(X,"remove"),Zn=pt(X,"nextSibling"),Jn=pt(X,"childNodes"),It=pt(X,"parentNode");if(typeof c=="function"){const f=e.createElement("template");f.content&&f.content.ownerDocument&&(e=f.content.ownerDocument)}let I,At="";const{implementation:ee,createNodeIterator:Qn,createDocumentFragment:to,getElementsByTagName:eo}=e,{importNode:no}=n;let P=Oe();t.isSupported=typeof E=="function"&&typeof It=="function"&&ee&&ee.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ne,ERB_EXPR:oe,TMPLIT_EXPR:se,DATA_ATTR:oo,ARIA_ATTR:so,IS_SCRIPT_OR_DATA:io,ATTR_WHITESPACE:Ue,CUSTOM_ELEMENT:ro}=we;let{IS_ALLOWED_URI:He}=we,S=null;const ze=d({},[...Ae,...jt,...Yt,...Vt,..._e]);let R=null;const $e=d({},[...be,...Xt,...Se,...Ot]);let A=Object.seal(zt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_t=null,ie=null;const et=Object.seal(zt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let We=!0,re=!0,Ge=!1,Be=!0,nt=!1,Pt=!0,Z=!1,ae=!1,ce=!1,ot=!1,vt=!1,xt=!1,je=!0,Ye=!1;const ao="user-content-";let le=!0,bt=!1,st={},z=null;const fe=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"]);let Ve=null;const Xe=d({},["audio","video","img","source","image","track"]);let ue=null;const qe=d({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",Ft="http://www.w3.org/2000/svg",G="http://www.w3.org/1999/xhtml";let it=G,pe=!1,he=null;const co=d({},[kt,Ft,G],Gt);let Ut=d({},["mi","mo","mn","ms","mtext"]),Ht=d({},["annotation-xml"]);const lo=d({},["title","style","font","a","script"]);let St=null;const fo=["application/xhtml+xml","text/html"],uo="text/html";let b=null,rt=null;const po=e.createElement("form"),Ke=function(o){return o instanceof RegExp||o instanceof Function},me=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rt&&rt===o)){if((!o||typeof o!="object")&&(o={}),o=U(o),St=fo.indexOf(o.PARSER_MEDIA_TYPE)===-1?uo:o.PARSER_MEDIA_TYPE,b=St==="application/xhtml+xml"?Gt:wt,S=k(o,"ALLOWED_TAGS")?d({},o.ALLOWED_TAGS,b):ze,R=k(o,"ALLOWED_ATTR")?d({},o.ALLOWED_ATTR,b):$e,he=k(o,"ALLOWED_NAMESPACES")?d({},o.ALLOWED_NAMESPACES,Gt):co,ue=k(o,"ADD_URI_SAFE_ATTR")?d(U(qe),o.ADD_URI_SAFE_ATTR,b):qe,Ve=k(o,"ADD_DATA_URI_TAGS")?d(U(Xe),o.ADD_DATA_URI_TAGS,b):Xe,z=k(o,"FORBID_CONTENTS")?d({},o.FORBID_CONTENTS,b):fe,_t=k(o,"FORBID_TAGS")?d({},o.FORBID_TAGS,b):U({}),ie=k(o,"FORBID_ATTR")?d({},o.FORBID_ATTR,b):U({}),st=k(o,"USE_PROFILES")?o.USE_PROFILES:!1,We=o.ALLOW_ARIA_ATTR!==!1,re=o.ALLOW_DATA_ATTR!==!1,Ge=o.ALLOW_UNKNOWN_PROTOCOLS||!1,Be=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,nt=o.SAFE_FOR_TEMPLATES||!1,Pt=o.SAFE_FOR_XML!==!1,Z=o.WHOLE_DOCUMENT||!1,ot=o.RETURN_DOM||!1,vt=o.RETURN_DOM_FRAGMENT||!1,xt=o.RETURN_TRUSTED_TYPE||!1,ce=o.FORCE_BODY||!1,je=o.SANITIZE_DOM!==!1,Ye=o.SANITIZE_NAMED_PROPS||!1,le=o.KEEP_CONTENT!==!1,bt=o.IN_PLACE||!1,He=o.ALLOWED_URI_REGEXP||ye,it=o.NAMESPACE||G,Ut=o.MATHML_TEXT_INTEGRATION_POINTS||Ut,Ht=o.HTML_INTEGRATION_POINTS||Ht,A=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Ke(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(A.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Ke(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(A.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),nt&&(re=!1),vt&&(ot=!0),st&&(S=d({},_e),R=[],st.html===!0&&(d(S,Ae),d(R,be)),st.svg===!0&&(d(S,jt),d(R,Xt),d(R,Ot)),st.svgFilters===!0&&(d(S,Yt),d(R,Xt),d(R,Ot)),st.mathMl===!0&&(d(S,Vt),d(R,Se),d(R,Ot))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?et.tagCheck=o.ADD_TAGS:(S===ze&&(S=U(S)),d(S,o.ADD_TAGS,b))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?et.attributeCheck=o.ADD_ATTR:(R===$e&&(R=U(R)),d(R,o.ADD_ATTR,b))),o.ADD_URI_SAFE_ATTR&&d(ue,o.ADD_URI_SAFE_ATTR,b),o.FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.FORBID_CONTENTS,b)),o.ADD_FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.ADD_FORBID_CONTENTS,b)),le&&(S["#text"]=!0),Z&&d(S,["html","head","body"]),S.table&&(d(S,["tbody"]),delete _t.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=o.TRUSTED_TYPES_POLICY,At=I.createHTML("")}else I===void 0&&(I=Dn(W,s)),I!==null&&typeof At=="string"&&(At=I.createHTML(""));N&&N(o),rt=o}},Ze=d({},[...jt,...Yt,..._n]),Je=d({},[...Vt,...bn]),ho=function(o){let a=It(o);(!a||!a.tagName)&&(a={namespaceURI:it,tagName:"template"});const l=wt(o.tagName),g=wt(a.tagName);return he[o.namespaceURI]?o.namespaceURI===Ft?a.namespaceURI===G?l==="svg":a.namespaceURI===kt?l==="svg"&&(g==="annotation-xml"||Ut[g]):!!Ze[l]:o.namespaceURI===kt?a.namespaceURI===G?l==="math":a.namespaceURI===Ft?l==="math"&&Ht[g]:!!Je[l]:o.namespaceURI===G?a.namespaceURI===Ft&&!Ht[g]||a.namespaceURI===kt&&!Ut[g]?!1:!Je[l]&&(lo[l]||!Ze[l]):!!(St==="application/xhtml+xml"&&he[o.namespaceURI]):!1},$=function(o){lt(t.removed,{element:o});try{It(o).removeChild(o)}catch{Kn(o)}},J=function(o,a){try{lt(t.removed,{attribute:a.getAttributeNode(o),from:a})}catch{lt(t.removed,{attribute:null,from:a})}if(a.removeAttribute(o),o==="is")if(ot||vt)try{$(a)}catch{}else try{a.setAttribute(o,"")}catch{}},Qe=function(o){let a=null,l=null;if(ce)o="<remove></remove>"+o;else{const _=Bt(o,/^[\r\n\t ]+/);l=_&&_[0]}St==="application/xhtml+xml"&&it===G&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");const g=I?I.createHTML(o):o;if(it===G)try{a=new V().parseFromString(g,St)}catch{}if(!a||!a.documentElement){a=ee.createDocument(it,"template",null);try{a.documentElement.innerHTML=pe?At:g}catch{}}const C=a.body||a.documentElement;return o&&l&&C.insertBefore(e.createTextNode(l),C.childNodes[0]||null),it===G?eo.call(a,Z?"html":"body")[0]:Z?a.documentElement:C},tn=function(o){return Qn.call(o.ownerDocument||o,o,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},de=function(o){return o instanceof y&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof m)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},en=function(o){return typeof u=="function"&&o instanceof u};function B(f,o,a){Rt(f,l=>{l.call(t,o,a,rt)})}const nn=function(o){let a=null;if(B(P.beforeSanitizeElements,o,null),de(o))return $(o),!0;const l=b(o.nodeName);if(B(P.uponSanitizeElement,o,{tagName:l,allowedTags:S}),Pt&&o.hasChildNodes()&&!en(o.firstElementChild)&&L(/<[/\w!]/g,o.innerHTML)&&L(/<[/\w!]/g,o.textContent)||o.nodeType===ht.progressingInstruction||Pt&&o.nodeType===ht.comment&&L(/<[/\w]/g,o.data))return $(o),!0;if(!(et.tagCheck instanceof Function&&et.tagCheck(l))&&(!S[l]||_t[l])){if(!_t[l]&&sn(l)&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l)))return!1;if(le&&!z[l]){const g=It(o)||o.parentNode,C=Jn(o)||o.childNodes;if(C&&g){const _=C.length;for(let v=_-1;v>=0;--v){const j=qn(C[v],!0);j.__removalCount=(o.__removalCount||0)+1,g.insertBefore(j,Zn(o))}}}return $(o),!0}return o instanceof p&&!ho(o)||(l==="noscript"||l==="noembed"||l==="noframes")&&L(/<\/no(script|embed|frames)/i,o.innerHTML)?($(o),!0):(nt&&o.nodeType===ht.text&&(a=o.textContent,Rt([ne,oe,se],g=>{a=ft(a,g," ")}),o.textContent!==a&&(lt(t.removed,{element:o.cloneNode()}),o.textContent=a)),B(P.afterSanitizeElements,o,null),!1)},on=function(o,a,l){if(je&&(a==="id"||a==="name")&&(l in e||l in po))return!1;if(!(re&&!ie[a]&&L(oo,a))){if(!(We&&L(so,a))){if(!(et.attributeCheck instanceof Function&&et.attributeCheck(a,o))){if(!R[a]||ie[a]){if(!(sn(o)&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o))&&(A.attributeNameCheck instanceof RegExp&&L(A.attributeNameCheck,a)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(a,o))||a==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l))))return!1}else if(!ue[a]){if(!L(He,ft(l,Ue,""))){if(!((a==="src"||a==="xlink:href"||a==="href")&&o!=="script"&&Tn(l,"data:")===0&&Ve[o])){if(!(Ge&&!L(io,ft(l,Ue,"")))){if(l)return!1}}}}}}}return!0},sn=function(o){return o!=="annotation-xml"&&Bt(o,ro)},rn=function(o){B(P.beforeSanitizeAttributes,o,null);const{attributes:a}=o;if(!a||de(o))return;const l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0};let g=a.length;for(;g--;){const C=a[g],{name:_,namespaceURI:v,value:j}=C,at=b(_),Te=j;let w=_==="value"?Te:gn(Te);if(l.attrName=at,l.attrValue=w,l.keepAttr=!0,l.forceKeepAttr=void 0,B(P.uponSanitizeAttribute,o,l),w=l.attrValue,Ye&&(at==="id"||at==="name")&&(J(_,o),w=ao+w),Pt&&L(/((--!?|])>)|<\/(style|title|textarea)/i,w)){J(_,o);continue}if(at==="attributename"&&Bt(w,"href")){J(_,o);continue}if(l.forceKeepAttr)continue;if(!l.keepAttr){J(_,o);continue}if(!Be&&L(/\/>/i,w)){J(_,o);continue}nt&&Rt([ne,oe,se],cn=>{w=ft(w,cn," ")});const an=b(o.nodeName);if(!on(an,at,w)){J(_,o);continue}if(I&&typeof W=="object"&&typeof W.getAttributeType=="function"&&!v)switch(W.getAttributeType(an,at)){case"TrustedHTML":{w=I.createHTML(w);break}case"TrustedScriptURL":{w=I.createScriptURL(w);break}}if(w!==Te)try{v?o.setAttributeNS(v,_,w):o.setAttribute(_,w),de(o)?$(o):Ee(t.removed)}catch{J(_,o)}}B(P.afterSanitizeAttributes,o,null)},mo=function f(o){let a=null;const l=tn(o);for(B(P.beforeSanitizeShadowDOM,o,null);a=l.nextNode();)B(P.uponSanitizeShadowNode,a,null),nn(a),rn(a),a.content instanceof i&&f(a.content);B(P.afterSanitizeShadowDOM,o,null)};return t.sanitize=function(f){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,l=null,g=null,C=null;if(pe=!f,pe&&(f="<!-->"),typeof f!="string"&&!en(f))if(typeof f.toString=="function"){if(f=f.toString(),typeof f!="string")throw ut("dirty is not a string, aborting")}else throw ut("toString is not a function");if(!t.isSupported)return f;if(ae||me(o),t.removed=[],typeof f=="string"&&(bt=!1),bt){if(f.nodeName){const j=b(f.nodeName);if(!S[j]||_t[j])throw ut("root node is forbidden and cannot be sanitized in-place")}}else if(f instanceof u)a=Qe("<!---->"),l=a.ownerDocument.importNode(f,!0),l.nodeType===ht.element&&l.nodeName==="BODY"||l.nodeName==="HTML"?a=l:a.appendChild(l);else{if(!ot&&!nt&&!Z&&f.indexOf("<")===-1)return I&&xt?I.createHTML(f):f;if(a=Qe(f),!a)return ot?null:xt?At:""}a&&ce&&$(a.firstChild);const _=tn(bt?f:a);for(;g=_.nextNode();)nn(g),rn(g),g.content instanceof i&&mo(g.content);if(bt)return f;if(ot){if(vt)for(C=to.call(a.ownerDocument);a.firstChild;)C.appendChild(a.firstChild);else C=a;return(R.shadowroot||R.shadowrootmode)&&(C=no.call(n,C,!0)),C}let v=Z?a.outerHTML:a.innerHTML;return Z&&S["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&L(Re,a.ownerDocument.doctype.name)&&(v="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
2
+ `+v),nt&&Rt([ne,oe,se],j=>{v=ft(v,j," ")}),I&&xt?I.createHTML(v):v},t.setConfig=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};me(f),ae=!0},t.clearConfig=function(){rt=null,ae=!1},t.isValidAttribute=function(f,o,a){rt||me({});const l=b(f),g=b(o);return on(l,g,a)},t.addHook=function(f,o){typeof o=="function"&&lt(P[f],o)},t.removeHook=function(f,o){if(o!==void 0){const a=mn(P[f],o);return a===-1?void 0:dn(P[f],a,1)[0]}return Ee(P[f])},t.removeHooks=function(f){P[f]=[]},t.removeAllHooks=function(){P=Oe()},t}var Me=Ce();function Ne(r,t,e=""){const n=new WeakMap,s={get(i,c){const u=Reflect.get(i,c);if(u===null||typeof u!="object")return u;const p=n.get(u);if(p)return p;const h=e?`${e}.${c}`:c,m=Ne(u,t,h);return n.set(u,m),m},set(i,c,u){const p=Reflect.get(i,c);if(p!==u){Reflect.set(i,c,u);const h=e?`${e}.${c}`:c;t(h,p,u)}return!0}};return new Proxy(r,s)}function Le(r){const t={};for(const[e,n]of Object.entries(r)){const s=typeof n=="object"&&n!==null;t[e]=s?Le(n):n}return t}const Ct=typeof window<"u"&&typeof window.document<"u";let De=class extends Error{};const tt=class tt{constructor(t,e,n){q(this,Dt);q(this,Lt,Symbol("objectId"));q(this,H,[]);q(this,gt);q(this,Et);q(this,Y);if(!t)throw new De("name cannot be empty");if(O(tt,K).has(t))throw new De(`WrecState with name "${t}" already exists`);if(ct(this,gt,t),ct(this,Et,e),ct(this,Y,Ne({},fn(this,Dt,un).bind(this))),e&&Ct){const s=sessionStorage.getItem("wrec-state-"+t),i=s?JSON.parse(s):void 0;i&&(n=i)}if(n)for(const[s,i]of Object.entries(n))this.addProperty(s,i);O(tt,K).set(t,this)}static get(t){return O(this,K).get(t)}addListener(t,e={}){const n=O(this,H).find(s=>s.listenerRef.deref()===t);if(n){const{propertyMap:s}=n;for(const[i,c]of Object.entries(e))s[i]=c}else O(this,H).push({listenerRef:new WeakRef(t),propertyMap:e})}addProperty(t,e){Object.defineProperty(this,t,{enumerable:!0,get(){return O(this,Y)[t]},set(n){O(this,Y)[t]=n}}),O(this,Y)[t]=e}get id(){return O(this,Lt)}log(){console.log("WrecState:",O(this,gt));for(const[t,e]of Object.entries(O(this,Y)))console.log(` ${t} = ${JSON.stringify(e)}`)}removeListener(t){ct(this,H,O(this,H).filter(e=>e.listenerRef.deref()!==t))}};K=new WeakMap,Lt=new WeakMap,H=new WeakMap,gt=new WeakMap,Et=new WeakMap,Y=new WeakMap,Dt=new WeakSet,un=function(t,e,n){const s=new Set;for(const i of O(this,H)){const c=i.listenerRef.deref();if(!c)s.add(i);else if(Ct&&c instanceof HTMLElement&&!c.isConnected)s.add(i);else{const{propertyMap:u}=i,p=Object.keys(u);(p.length===0||p.includes(t))&&c.changed(t,u[t],n,e,this)}}ct(this,H,O(this,H).filter(i=>!s.has(i)))},q(tt,K,new Map),Ct&&window.addEventListener("beforeunload",()=>{for(const[t,e]of O(tt,K).entries())if(O(e,Et)){const n=Le(e);sessionStorage.setItem("wrec-state-"+t,JSON.stringify(n))}});let Mt=tt;Ct&&process.env.NODE_ENV==="development"&&(window.WrecState=Mt);function Ie(r,t){let e=r;for(const n of t.split("."))e=e[n];return e}function In(r,t,e){const n=t.split("."),s=n.length-1;let i=r;n.forEach((c,u)=>{u===s?i[c]=e:i=i[c]})}const Pn=new Set(["class","hidden","id","disabled","title"]),vn=new Set(["onblur","onchange","onclick","onfocus","oninput","onkeydown","onreset","onsubmit"]);Me.addHook("uponSanitizeAttribute",(r,t)=>{const{attrName:e}=t,n=e.toLowerCase();vn.has(n)&&(t.forceKeepAttr=!0)});class Q extends Error{}const xn=/([a-zA-Z-]+)\s*:\s*([^;}]+)/g,Pe="a-zA-Z_$",kn=Pe+"0-9",mt=`[${Pe}][${kn}]*`,Fn=/<!--\s*(.*?)\s*-->/,Un=/<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g,qt=new RegExp(`^this\\.${mt}$`),Kt=new RegExp(`this\\.${mt}(\\.${mt})*`,"g"),ve=new RegExp(`this\\.${mt}(\\.${mt})*`),Hn=new Set(["class","style"]),zn=5;function $n(r){return r instanceof HTMLButtonElement||r instanceof HTMLFieldSetElement||r instanceof HTMLInputElement||r instanceof HTMLSelectElement||r instanceof HTMLTextAreaElement||r instanceof F}function Wn(r,t,e){const n=document.createElement(r);if(t)for(const[s,i]of Object.entries(t))n.setAttribute(s,i);return e&&(n.innerHTML=e),n}const Gn=r=>r===String?"":r===Number?0:r===Boolean?!1:r===Array?[]:r===Object?{}:void 0;function Nt(r){const t=[];let e=r.firstElementChild;for(;e;)t.push(e),e.shadowRoot&&t.push(...Nt(e.shadowRoot)),e.firstElementChild&&t.push(...Nt(e)),e=e.nextElementSibling;return t}const dt=r=>r.substring(zn).split(".")[0];function xe(r,t){let e=r[0];return t.forEach((n,s)=>{e+=n+r[s+1]}),e}function Zt(r){const t=typeof r;return t==="string"||t==="number"||t==="boolean"}function Tt(r){return r.localName==="textarea"}function Jt(r){const{localName:t}=r;return t==="input"||t==="select"}const Bn=r=>r.replace(/<!--[\s\S]*?-->/g,"");function ke(r,t,e,n){return r.slice(0,t)+n+r.slice(t+e)}function jn(r){let t=r.trim(),e=null;/^\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");const n=Me.sanitize(t,{ADD_TAGS:["#comment"],ALLOW_UNKNOWN_PROTOCOLS:!0,RETURN_DOM_FRAGMENT:!0});if(e){const s=n.querySelector(e);if(s)return s.childNodes}return n.childNodes}function Qt(r){const t=Number(r);if(isNaN(t))throw new Q(`can't convert "${r}" to a number`);return t}function Fe(r,t,e){const[n,s]=t.split(":");if(Zt(e))if(typeof e=="boolean"){e?r.setAttribute(n,n):r.removeAttribute(n);const i=F.getPropName(n);r[i]=e}else{const i=r.getAttribute(t),c=String(e);i!==c&&(r.setAttribute(n,c),n==="value"&&Jt(r)&&(r.value=c))}else{const i=F.getPropName(t);r[i]=e}}function te(r,t,e){const[n,s]=t.split(":");r instanceof CSSStyleRule?r.style.setProperty(n,e):(Fe(r,n,e),n==="value"&&Jt(r)&&(r.value=e))}async function Yn(r){const t=new Set;for(const n of Nt(r.content)){const{localName:s}=n;s.includes("-")&&t.add(s)}function e(n){return new Promise((s,i)=>{setTimeout(()=>{const c=`custom element <${n}> not defined`;i(new Error(c))},1e3)})}return Promise.all([...t].map(async n=>Promise.race([customElements.whenDefined(n),e(n)])))}class F extends HTMLElement{static attrToPropMap=new Map;static propToAttrMap=new Map;static css="";static elementName="";static formAssociated=!1;static html="";static properties;static propToComputedMap;static propToExprsMap;static template=null;#t=this.constructor;#n=new Map;#c={};#s;#l={};#f=null;#u=new Map;static define(t){if(this.elementName=t,customElements.get(t))throw new Q(`custom element ${t} is already defined`);customElements.define(t,this)}constructor(){super(),this.attachShadow({mode:"open"});const t=this.#t;t.attrToPropMap||(t.attrToPropMap=new Map),t.properties||(t.properties={}),t.propToAttrMap||(t.propToExprsMap=new Map),t.propToComputedMap||(t.propToComputedMap=new Map),t.propToExprsMap||(t.propToExprsMap=new Map)}attributeChangedCallback(t,e,n){t==="disabled"&&this.#m();const s=F.getPropName(t);if(this.#i(s)){const i=this.#_(s,String(n));this[s]=i;const c=this.#c[s];c&&this.setFormValue(c,String(i)),this.propertyChangedCallback(s,e,n)}}async#y(){const t=this.#t;let{template:e}=t;if(!e){e=t.template=document.createElement("template");let n=`<style>
3
3
  :host([hidden]) { display: none; }`;t.css&&(n+=t.css),n+=`</style>
4
- `;let s=t.html.trim();if(!s)throw new Q("static property html must be set");s.startsWith("<")||(s=`<span><!--${s}--></span>`),e.innerHTML=n+s}await jn(e),this.shadowRoot.replaceChildren(e.content.cloneNode(!0))}changed(t,e,n){this[e]=n}connectedCallback(){this.#P(),this.#R(),this.#S().then(()=>{this.hasAttribute("disabled")&&this.#h(),this.#b(this.shadowRoot),this.#m(this.shadowRoot),this.#y()})}#y(){const t=this.#t,{properties:e}=t;for(const[n,{computed:s}]of Object.entries(e))s&&(this[n]=this.#o(s))}#R(){const t=this.#t,{observedAttributes:e,properties:n}=t;for(const[s,i]of Object.entries(n))this.#w(s,i,e)}#w(t,e,n){const s=F.getAttrName(t),i=this.hasAttribute(s);e.required&&!i&&this.#e(this,t,"is a required attribute");let c=e.value;this.hasOwnProperty(t)&&(c=this[t],delete this[t]);const{type:u}=e,p=u===Boolean?c||i:n.includes(s)&&i?this.#g(t,s):c||Wn(u),h="#"+t;this[h]=p,e.computed&&this.#L(t,e),Object.defineProperty(this,t,{enumerable:!0,get(){return this[h]},set(m){u===Number&&typeof m=="string"&&(m=Qt(m));const y=this[h];if(m===y)return;this.#x(t,u,m),this[h]=m;const{state:V,stateProp:W}=this.#t.properties[t];W&&Pn(V,W,m),this.#D(t),this.#N(t,u,m,s),this.#E(t),this.#I(t,m);const X=this.#c[t];X&&this.setFormValue(X,String(m)),this.propertyChangedCallback(t,y,m),e.dispatch&&this.dispatch("change",{tagName:this.localName,property:t,oldValue:y,value:m})}})}#h(){const t=this.hasAttribute("disabled"),e=Mt(this.shadowRoot);for(const n of e)zn(n)&&(n.disabled=t)}disconnectedCallback(){this.#n.clear(),this.#l.clear(),this.#u.clear()}dispatch(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}displayIfSet(t,e="block"){return`display: ${t?e:"none"}`}#O(t){const e=t instanceof F;for(const n of t.getAttributeNames()){const s=t.getAttribute(n),i=this.#T(t,s);if(i){const c=this[i];c===void 0&&this.#a(t,n,i),t[i]=c;let[u,p]=n.split(":");u==="value"&&(p?(t["on"+p]===void 0&&this.#e(t,n,"refers to an unsupported event name"),t.setAttribute(u,this[i])):p="change"),e&&t.#u.set(F.getPropName(u),i)}this.#r(s,t,n)}}#o(t){const e=new Function("return "+t).call(this);return Array.isArray(e)?e.join(""):e}#C(t){const{localName:e}=t;if(e==="style"){const{sheet:n}=t,s=n?.cssRules??[],i=Array.from(s);for(const c of i)if(c.constructor===CSSStyleRule){const u=Array.from(c.style);for(const p of u)if(p.startsWith("--")){const h=c.style.getPropertyValue(p);this.#r(h,c,p)}}}else{let n="";if(dt(t)){this.#r(t.textContent,t);const s=t.textContent?.match(Fn);s&&(n=s[1])}else{const s=Array.from(t.childNodes).find(i=>i.nodeType===Node.COMMENT_NODE);s&&(n=s.textContent?.trim()??"")}if(n){const s=this.#T(t,n);s&&dt(t)?t.textContent=this[s]:this.#r(n,t)}}}formAssociatedCallback(){let t=this.getAttribute("form-assoc");if(!t){const c=this.getAttribute("name");if(c)if(this.#i("value"))t=`value:${c}`;else return;else return}const e={},n=t.split(",");for(const c of n){const[u,p]=c.split(":");e[u.trim()]=p.trim()}this.#c=e,this.#s=new FormData,this.#f=this.attachInternals(),this.#f.setFormValue(this.#s);const s=Object.keys(this.#t.properties),i=this.#l;for(const c of s)i[c]=this[c]}formResetCallback(){const t=this.#l;for(const e of Object.keys(t)){let n=t[e];qt.test(n)&&(n=this.#o(n)),this[e]=n}}static getAttrName(t){let e=this.propToAttrMap.get(t);return e||(e=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),this.propToAttrMap.set(t,e)),e}static getPropName(t){let e=this.attrToPropMap.get(t);return e||(e=t.replace(/-([a-z])/g,(n,s)=>s.toUpperCase()),this.attrToPropMap.set(t,e)),e}#M(t,e,n){if(n.length!==1)return;const[s]=n;if(!qt.test(s))return;const i=Jt(t)||dt(t);let[c,u]=(e??"").split(":");if(!(i&&c==="value"||dt(t)))return;u?t["on"+u]===void 0&&this.#e(t,e,"refers to an unsupported event name"):u="change";const h=Lt(s);t.addEventListener(u,m=>{const{target:y}=m;if(!y)return;const V=y.value,{type:W}=this.#t.properties[h];this[h]=W===Number?Qt(V):V,this.#E(h)})}#i(t){return!!this.#t.properties[t]}#m(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e)this.#O(n),n.firstElementChild||this.#C(n)}#d(){if(this.#t.formAssociated||this.closest("form")===null)return;const t=this.#t.name;throw new Q(`inside form, class ${t} requires "static formAssociated = true;"`)}static get observedAttributes(){const t=Object.keys(this.properties||{}).map(e=>F.getAttrName(e));return t.includes("disabled")||t.push("disabled"),t}propertyChangedCallback(t,e,n){}#T(t,e){if(!e||!qt.test(e))return;const n=Lt(e);return this[n]===void 0&&this.#a(t,"",n),n}#E(t){const s=this.#t.propToExprsMap.get(t)||[];for(const i of s){let c=this.#o(i);const u=this.#n.get(i)??[];for(const p of u)if(p instanceof HTMLElement)this.#_(p,c);else if(!(p instanceof CSSStyleRule)){const{element:h,attrName:m}=p;h instanceof CSSStyleRule?h.style.setProperty(m,c):te(h,m,c)}}}#L(t,e){const{computed:n,uses:s}=e,i=this.#t.propToComputedMap;function c(p,h){let m=i.get(p);m||(m=[],i.set(p,m)),m.push([t,h])}const u=n.match(Kt)||[];for(const p of u){const h=p.substring(xe);this[h]===void 0&&this.#a(null,t,h),typeof this[h]!="function"&&c(h,n)}if(s)for(const p of s.split(","))c(p,n)}#r(t,e,n=void 0){if(!t)return;const s=this.#p(e,n,t);if(!s){const p=t.replaceAll("this..","this.");n?te(e,n,p):"textContent"in e&&(e.textContent=p);return}const i=this.#t;s.forEach(p=>{const h=Lt(p);if(typeof this[h]=="function")return;const m=i.propToExprsMap;let y=m.get(h);y||(y=[],m.set(h,y)),y.includes(t)||y.push(t)});for(const[p,h]of this.#n.entries())for(const m of h){const y=m instanceof HTMLElement||m instanceof CSSStyleRule?m:m.element;y instanceof CSSStyleRule||y.isConnected||this.#n.set(p,h.filter(V=>V!==m))}let c=this.#n.get(t);c||(c=[],this.#n.set(t,c)),c.push(n?{element:e,attrName:n}:e),e instanceof HTMLElement&&this.#M(e,n,s);const u=this.#o(t);n?te(e,n,u):this.#_(e,u)}setAttributeSafe(t,e){this.hasAttribute(t)||this.setAttribute(t,e)}setFormValue(t,e){!this.#s||!Zt(e)||(this.#s.set(t,e),this.#f?.setFormValue(this.#s))}#e(t,e,n){const s=t instanceof HTMLElement?t.localName:"CSS rule";throw new Q(`component ${this.#t.elementName}`+(t?`, element "${s}"`:"")+(e?`, attribute "${e}"`:"")+` ${n}`)}#a(t,e,n){this.#e(t,e,`refers to missing property "${n}"`)}#g(t,e){return this.#A(t,this.getAttribute(e))}#A(t,e){if(e?.match(Kt))return e;const n=this.#t,{type:s}=n.properties[t];if(s||this.#e(null,t,"does not specify its type"),s===String)return e;if(s===Number)return Qt(e);if(s===Boolean)return e==="true"?!0:e==="false"||e==="null"?!1:(e&&e!==t&&this.#e(null,t,"is a Boolean attribute, so its value must match attribute name or be missing"),e===t)}#N(t,e,n,s){if(Zt(n)&&this.hasAttribute(s)){const i=e===Boolean?this.hasAttribute(s):this.#g(t,s);n!==i&&Ue(this,t,n)}}#D(t){const n=this.#t.propToComputedMap.get(t)||[];for(const[s,i]of n)this[s]=this.#o(i)}#_(t,e){if(e===void 0)return;const n=t instanceof HTMLElement,s=typeof e;if(s!=="string"&&s!=="number"&&this.#e(t,void 0," computed content is not a string or number"),t instanceof HTMLElement&&dt(t))t.value=e;else if(n&&s==="string"&&e.trim().startsWith("<")){const i=Bn(e);t.replaceChildren(...i),this.#b(t),this.#m(t)}else n&&(t.textContent=e)}#I(t,e){const n=this.#u.get(t);if(!n)return;const s=this.getRootNode();if(!(s instanceof ShadowRoot))return;const{host:i}=s;if(!i)return;const c=i;c[n]=e}useState(t,e){if(!e){e={};for(const n of Object.keys(t))e[n]=n}this.#v(t,e);for(const[n,s]of Object.entries(e))if(this.#i(s)){const i=Ie(t,n);i!==void 0&&(this[s]=i);const c=this.#t.properties[s];c.state=t,c.stateProp=n}t.addListener(this,e)}#P(){const t=this.#t,e=new Set(Object.keys(t.properties));for(const n of e)Hn.has(n)&&this.#e(null,"",`property "${n}" is not allowed because it is a reserved attribute`);for(const n of this.getAttributeNames())if(n!=="class"&&n!=="id"&&n!=="disabled"&&!n.startsWith("on")){if(n==="form-assoc"){this.#d();continue}if(!e.has(F.getPropName(n))){if(n==="name"){this.#d();continue}this.#e(null,n,"is not a supported attribute")}}}#p(t,e,n){const s=n.match(Kt);if(s)return s.forEach(i=>{const c=Lt(i);this[c]===void 0&&this.#a(t,e,c)}),s}#v(t,e){for(const[n,s]of Object.entries(e)){let i=Ie(t,n);if(i===void 0)throw new Q(`invalid state path "${n}"`);i=this[s],this.#i(s)||this.#e(null,s,"refers to missing property in useState map")}}#x(t,e,n){if(n instanceof e)return;let s=typeof n;if(s==="object"){const{constructor:i}=n;s=i.name,i!==e&&this.#e(null,t,`was set to a ${s}, but must be a ${e.name}`)}s!==e.name.toLowerCase()&&this.#e(null,t,`was set to a ${s}, but must be a ${e.name}`)}#b(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e){const s=[];for(const i of Array.from(n.attributes)){const c=i.name;if(c.startsWith("on")){let u=c.slice(2);u=u[0].toLowerCase()+u.slice(1).toLowerCase();const p=i.value;this.#p(n,c,p);let h;typeof this[p]=="function"?h=m=>this[p](m):(this.#p(n,c,p),h=()=>this.#o(p)),n.addEventListener(u,h),s.push(c)}}for(const i of s)n.removeAttribute(i)}}}function Yn(r,...t){let e=ke(r,t);for(;;){const n=xn.exec(e);if(!n)break;const s=n[2];if(ve.test(s)){const i=n[1];if(!i.startsWith("--")){const c=`--${i}: ${s};
5
- ${i}: var(--${i})`;e=Fe(e,n.index,n[0].length,c)}}}return e}function Vn(r,...t){let e=ke(r,t);for(;;){const n=Un.exec(e);if(!n||n[1]==="style")break;const s=Gn(n[2]);if(ve.test(s)){const i=`<!-- ${s.trim()} -->`,c=n.index+n[0].indexOf(">")+1;e=Fe(e,c,s.length,i)}}return e}T.Wrec=F,T.WrecState=Ct,T.createElement=$n,T.css=Yn,T.html=Vn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
4
+ `;let s=t.html.trim();if(!s)throw new Q("static property html must be set");s.startsWith("<")||(s=`<span><!--${s}--></span>`),e.innerHTML=n+s}await Yn(e),this.shadowRoot.replaceChildren(e.content.cloneNode(!0))}changed(t,e,n){this[e]=n}connectedCallback(){this.#P(),this.#w(),this.#y().then(()=>{this.hasAttribute("disabled")&&this.#m(),this.#S(this.shadowRoot),this.#d(this.shadowRoot),this.#R()})}#R(){const t=this.#t,{properties:e}=t;for(const[n,{computed:s}]of Object.entries(e))s&&(this[n]=this.#o(s))}#w(){const t=this.#t,{observedAttributes:e,properties:n}=t;for(const[s,i]of Object.entries(n))i.computed||this.#h(s,i,e);for(const[s,i]of Object.entries(n))i.computed&&this.#h(s,i,e)}#h(t,e,n){const s=F.getAttrName(t),i=this.hasAttribute(s);e.required&&!i&&this.#e(this,t,"is a required attribute");let c=e.value;this.hasOwnProperty(t)&&(c=this[t],delete this[t]);const{type:u}=e,p=u===Boolean?c||i:n.includes(s)&&i?this.#A(t,s):c||Gn(u),h="#"+t;this[h]=p,e.computed&&this.#N(t,e),Object.defineProperty(this,t,{enumerable:!0,get(){return this[h]},set(m){u===Number&&typeof m=="string"&&(m=Qt(m));const y=this[h];if(m===y)return;this.#x(t,u,m),this[h]=m;const{state:V,stateProp:W}=this.#t.properties[t];W&&In(V,W,m),this.#D(t),this.#L(t,u,m,s),this.#E(t),this.#I(t,m);const X=this.#c[t];X&&this.setFormValue(X,String(m)),this.propertyChangedCallback(t,y,m),e.dispatch&&this.dispatch("change",{tagName:this.localName,property:t,oldValue:y,value:m})}})}#m(){const t=this.hasAttribute("disabled"),e=Nt(this.shadowRoot);for(const n of e)$n(n)&&(n.disabled=t)}disconnectedCallback(){this.#n.clear(),this.#l.clear(),this.#u.clear()}dispatch(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}displayIfSet(t,e="block"){return`display: ${t?e:"none"}`}#O(t){const e=t instanceof F;for(const n of t.getAttributeNames()){const s=t.getAttribute(n),i=this.#g(t,s);if(i){const c=this[i];c===void 0&&this.#a(t,n,i),t[i]=c;let[u,p]=n.split(":");u==="value"&&(p?(t["on"+p]===void 0&&this.#e(t,n,"refers to an unsupported event name"),t.setAttribute(u,this[i])):p="change"),e&&t.#u.set(F.getPropName(u),i)}this.#r(s,t,n)}}#o(t){return new Function("return "+t).call(this)}#C(t){const{localName:e}=t;if(e==="style"){const{sheet:n}=t,s=n?.cssRules??[],i=Array.from(s);for(const c of i)if(c.constructor===CSSStyleRule){const u=Array.from(c.style);for(const p of u)if(p.startsWith("--")){const h=c.style.getPropertyValue(p);this.#r(h,c,p)}}}else{let n="";if(Tt(t)){this.#r(t.textContent,t);const s=t.textContent?.match(Fn);s&&(n=s[1])}else{const s=Array.from(t.childNodes).find(i=>i.nodeType===Node.COMMENT_NODE);s&&(n=s.textContent?.trim()??"")}if(n){const s=this.#g(t,n);s&&Tt(t)?t.textContent=this[s]:this.#r(n,t)}}}formAssociatedCallback(){let t=this.getAttribute("form-assoc");if(!t){const c=this.getAttribute("name");if(c)if(this.#i("value"))t=`value:${c}`;else return;else return}const e={},n=t.split(",");for(const c of n){const[u,p]=c.split(":");e[u.trim()]=p.trim()}this.#c=e,this.#s=new FormData,this.#f=this.attachInternals(),this.#f.setFormValue(this.#s);const s=Object.keys(this.#t.properties),i=this.#l;for(const c of s)i[c]=this[c]}formResetCallback(){const t=this.#l;for(const e of Object.keys(t)){let n=t[e];qt.test(n)&&(n=this.#o(n)),this[e]=n}}static getAttrName(t){let e=this.propToAttrMap.get(t);return e||(e=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),this.propToAttrMap.set(t,e)),e}static getPropName(t){let e=this.attrToPropMap.get(t);return e||(e=t.replace(/-([a-z])/g,(n,s)=>s.toUpperCase()),this.attrToPropMap.set(t,e)),e}#M(t,e,n){if(n.length!==1)return;const[s]=n;if(!qt.test(s))return;const i=Jt(t)||Tt(t);let[c,u]=(e??"").split(":");if(!(i&&c==="value"||Tt(t)))return;u?t["on"+u]===void 0&&this.#e(t,e,"refers to an unsupported event name"):u="change";const h=dt(s);t.addEventListener(u,m=>{const{target:y}=m;if(!y)return;const V=y.value,{type:W}=this.#t.properties[h];this[h]=W===Number?Qt(V):V,this.#E(h)})}#i(t){return!!this.#t.properties[t]}#d(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e)this.#O(n),n.firstElementChild||this.#C(n)}#T(){if(this.#t.formAssociated||this.closest("form")===null)return;const t=this.#t.name;throw new Q(`inside form, class ${t} requires "static formAssociated = true;"`)}static get observedAttributes(){const t=Object.keys(this.properties||{}).map(e=>F.getAttrName(e));return t.includes("disabled")||t.push("disabled"),t}propertyChangedCallback(t,e,n){}#g(t,e){if(!e||!qt.test(e))return;const n=dt(e);return this[n]===void 0&&this.#a(t,"",n),n}#E(t){const s=this.#t.propToExprsMap.get(t)||[];for(const i of s){let c=this.#o(i);const u=this.#n.get(i)??[];for(const p of u)if(p instanceof HTMLElement)this.#b(p,c);else if(!(p instanceof CSSStyleRule)){const{element:h,attrName:m}=p;h instanceof CSSStyleRule?h.style.setProperty(m,c):te(h,m,c)}}}#N(t,e){const{computed:n,uses:s}=e,i=this.#t.propToComputedMap;function c(p,h){let m=i.get(p);m||(m=[],i.set(p,m)),m.push([t,h])}const u=n.match(Kt)||[];for(const p of u){const h=dt(p);this[h]===void 0&&this.#a(null,t,h),typeof this[h]!="function"&&c(h,n)}if(s)for(const p of s.split(","))c(p,n)}#r(t,e,n=void 0){if(!t)return;const s=this.#p(e,n,t);if(!s){const p=t.replaceAll("this..","this.");n?te(e,n,p):"textContent"in e&&(e.textContent=p);return}const i=this.#t;s.forEach(p=>{const h=dt(p);if(typeof this[h]=="function")return;const m=i.propToExprsMap;let y=m.get(h);y||(y=[],m.set(h,y)),y.includes(t)||y.push(t)});for(const[p,h]of this.#n.entries())for(const m of h){const y=m instanceof HTMLElement||m instanceof CSSStyleRule?m:m.element;y instanceof CSSStyleRule||y.isConnected||this.#n.set(p,h.filter(V=>V!==m))}let c=this.#n.get(t);c||(c=[],this.#n.set(t,c)),c.push(n?{element:e,attrName:n}:e),e instanceof HTMLElement&&this.#M(e,n,s);const u=this.#o(t);n?te(e,n,u):this.#b(e,u)}setAttributeSafe(t,e){this.hasAttribute(t)||this.setAttribute(t,e)}setFormValue(t,e){!this.#s||!Zt(e)||(this.#s.set(t,e),this.#f?.setFormValue(this.#s))}#e(t,e,n){const s=t instanceof HTMLElement?t.localName:"CSS rule";throw new Q(`component ${this.#t.elementName}`+(t?`, element "${s}"`:"")+(e?`, attribute "${e}"`:"")+` ${n}`)}#a(t,e,n){this.#e(t,e,`refers to missing property "${n}"`)}#A(t,e){return this.#_(t,this.getAttribute(e))}#_(t,e){if(e?.match(Kt))return e;const n=this.#t,{type:s}=n.properties[t];if(s||this.#e(null,t,"does not specify its type"),s===String)return e;if(s===Number)return Qt(e);if(s===Boolean)return e==="true"?!0:e==="false"||e==="null"?!1:(e&&e!==t&&this.#e(null,t,"is a Boolean attribute, so its value must match attribute name or be missing"),e===t)}#L(t,e,n,s){if(Zt(n)&&this.hasAttribute(s)){const i=e===Boolean?this.hasAttribute(s):this.#A(t,s);n!==i&&Fe(this,t,n)}}#D(t){const n=this.#t.propToComputedMap.get(t)||[];for(const[s,i]of n)this[s]=this.#o(i)}#b(t,e){if(e===void 0)return;const n=t instanceof HTMLElement;Array.isArray(e)&&(e=e.join(""));const s=typeof e;s!=="string"&&s!=="number"&&this.#e(t,void 0," computed content is not a string or number");const i=String(e);if(t instanceof HTMLElement&&Tt(t))t.value=i;else if(n&&s==="string"&&i.trim().startsWith("<")){const c=jn(i);t.replaceChildren(...c),this.#S(t),this.#d(t)}else n&&(t.textContent=i)}#I(t,e){const n=this.#u.get(t);if(!n)return;const s=this.getRootNode();if(!(s instanceof ShadowRoot))return;const{host:i}=s;if(!i)return;const c=i;c[n]=e}useState(t,e){if(!e){e={};for(const n of Object.keys(t))e[n]=n}this.#v(t,e);for(const[n,s]of Object.entries(e))if(this.#i(s)){const i=Ie(t,n);i!==void 0&&(this[s]=i);const c=this.#t.properties[s];c.state=t,c.stateProp=n}t.addListener(this,e)}#P(){const t=this.#t,e=new Set(Object.keys(t.properties));for(const n of e)Hn.has(n)&&this.#e(null,"",`property "${n}" is not allowed because it is a reserved attribute`);for(const n of this.getAttributeNames())if(!Pn.has(n)&&!n.startsWith("on")){if(n==="form-assoc"){this.#T();continue}if(!e.has(F.getPropName(n))){if(n==="name"){this.#T();continue}this.#e(null,n,"is not a supported attribute")}}}#p(t,e,n){const s=n.match(Kt);if(s)return s.forEach(i=>{const c=dt(i);this[c]===void 0&&this.#a(t,e,c)}),s}#v(t,e){for(const[n,s]of Object.entries(e)){let i=Ie(t,n);if(i===void 0)throw new Q(`invalid state path "${n}"`);i=this[s],this.#i(s)||this.#e(null,s,"refers to missing property in useState map")}}#x(t,e,n){if(n instanceof e)return;let s=typeof n;if(s==="object"){const{constructor:i}=n;s=i.name,i!==e&&this.#e(null,t,`was set to a ${s}, but must be a ${e.name}`)}s!==e.name.toLowerCase()&&this.#e(null,t,`was set to a ${s}, but must be a ${e.name}`)}#S(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e){const s=[];for(const i of Array.from(n.attributes)){const c=i.name;if(c.startsWith("on")){let u=c.slice(2);u=u[0].toLowerCase()+u.slice(1).toLowerCase();const p=i.value;this.#p(n,c,p);let h;typeof this[p]=="function"?h=m=>this[p](m):(this.#p(n,c,p),h=()=>this.#o(p)),n.addEventListener(u,h),s.push(c)}}for(const i of s)n.removeAttribute(i)}}}function Vn(r,...t){let e=xe(r,t);for(;;){const n=xn.exec(e);if(!n)break;const s=n[2];if(ve.test(s)){const i=n[1];if(!i.startsWith("--")){const c=`--${i}: ${s};
5
+ ${i}: var(--${i})`;e=ke(e,n.index,n[0].length,c)}}}return e}function Xn(r,...t){let e=xe(r,t);for(;;){const n=Un.exec(e);if(!n||n[1]==="style")break;const s=Bn(n[2]);if(ve.test(s)){const i=`<!-- ${s.trim()} -->`,c=n.index+n[0].indexOf(">")+1;e=ke(e,c,s.length,i)}}return e}T.Wrec=F,T.WrecState=Mt,T.createElement=Wn,T.css=Vn,T.html=Xn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "wrec",
3
3
  "description": "a small library that greatly simplifies building web components",
4
4
  "author": "R. Mark Volkmann",
5
- "version": "0.20.5",
5
+ "version": "0.20.7",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",