Skip to content

Instantly share code, notes, and snippets.

@rschristian
Created June 7, 2025 22:25
Show Gist options
  • Save rschristian/0350b99b288dca69ba6073922f2d695d to your computer and use it in GitHub Desktop.
Save rschristian/0350b99b288dca69ba6073922f2d695d to your computer and use it in GitHub Desktop.
Comparison of `preact.mjs` w/ hoisting of `null` & `undefined`
var n, t, i, r, f, e, o, u, c, s, a, h = null,
l = void 0,
p = {},
y = [],
v = Array.isArray,
w = y.slice,
d = Object.assign;
function _(n) {
n && n.parentNode && n.remove()
}
function g(n, t, i) {
var r, f, e, o = {};
for (e in t) "key" == e ? r = t[e] : "ref" == e && "function" != typeof n ? f = t[e] : o[e] = t[e];
return arguments.length > 2 && (o.children = arguments.length > 3 ? w.call(arguments, 2) : i), b(n, o, r, f, h)
}
function b(i, r, f, e, o) {
var u = {
type: i,
props: r,
key: f,
ref: e,
__k: h,
__: h,
__b: 0,
__e: h,
__c: h,
constructor: l,
__v: o == h ? ++t : o,
__i: -1,
__u: 0
};
return o == h && n.vnode != h && n.vnode(u), u
}
function k() {
return {
current: h
}
}
function m(n) {
return n.children
}
function M(n, t) {
this.props = n, this.context = t
}
function S(n, t) {
if (t == h) return n.__ ? S(n.__, n.__i + 1) : h;
for (var i; t < n.__k.length; t++)
if ((i = n.__k[t]) != h && i.__e != h) return i.__e;
return "function" == typeof n.type ? S(n) : h
}
function $(n) {
var t, i;
if ((n = n.__) != h && n.__c != h) {
for (n.__e = h, t = 0; t < n.__k.length; t++)
if ((i = n.__k[t]) != h && i.__e != h) {
n.__e = i.__e;
break
} return $(n)
}
}
function x(t) {
(!t.__d && (t.__d = !0) && r.push(t) && !C.__r++ || f != n.debounceRendering) && ((f = n.debounceRendering) || queueMicrotask)(C)
}
function C() {
for (var t, i, f, o, u, c, s, a = 1; r.length;) r.length > a && r.sort(e), t = r.shift(), a = r.length, t.__d && (f = void 0, u = (o = (i = t).__v).__e, c = [], s = [], i.__P && ((f = d({}, o)).__v = o.__v + 1, n.vnode && n.vnode(f), N(i.__P, f, o, i.__n, i.__P.namespaceURI, 32 & o.__u ? [u] : h, c, u == h ? S(o) : u, !!(32 & o.__u), s), f.__v = o.__v, f.__.__k[f.__i] = f, P(c, f, s), f.__e != u && $(f)));
C.__r = 0
}
function j(n, t, i, r, f, e, o, u, c, s, a) {
var v, w, d, _, g, b, k = r && r.__k || y,
m = t.length;
for (c = A(i, t, k, c, m), v = 0; v < m; v++)(d = i.__k[v]) != h && (w = -1 == d.__i ? p : k[d.__i] || p, d.__i = v, b = N(n, d, w, f, e, o, u, c, s, a), _ = d.__e, d.ref && w.ref != d.ref && (w.ref && B(w.ref, h, d), a.push(d.ref, d.__c || _, d)), g == h && _ != h && (g = _), 4 & d.__u || w.__k === d.__k ? c = H(d, c, n) : "function" == typeof d.type && b !== l ? c = b : _ && (c = _.nextSibling), d.__u &= -7);
return i.__e = g, c
}
function A(n, t, i, r, f) {
var e, o, u, c, s, a = i.length,
p = a,
y = 0;
for (n.__k = new Array(f), e = 0; e < f; e++)(o = t[e]) != h && "boolean" != typeof o && "function" != typeof o ? (c = e + y, (o = n.__k[e] = "string" == typeof o || "number" == typeof o || "bigint" == typeof o || o.constructor == String ? b(h, o, h, h, h) : v(o) ? b(m, {
children: o
}, h, h, h) : o.constructor == l && o.__b > 0 ? b(o.type, o.props, o.key, o.ref ? o.ref : h, o.__v) : o).__ = n, o.__b = n.__b + 1, s = o.__i = L(o, i, c, p), u = h, -1 != s && (p--, (u = i[s]) && (u.__u |= 2)), u == h || u.__v == h ? (-1 == s && (f > a ? y-- : f < a && y++), "function" != typeof o.type && (o.__u |= 4)) : s != c && (s == c - 1 ? y-- : s == c + 1 ? y++ : (s > c ? y-- : y++, o.__u |= 4))) : n.__k[e] = h;
if (p)
for (e = 0; e < a; e++)(u = i[e]) != h && !(2 & u.__u) && (u.__e == r && (r = S(u)), D(u, u));
return r
}
function H(n, t, i) {
var r, f;
if ("function" == typeof n.type) {
for (r = n.__k, f = 0; r && f < r.length; f++) r[f] && (r[f].__ = n, t = H(r[f], t, i));
return t
}
n.__e != t && (t && n.type && !t.parentNode && (t = S(n)), i.insertBefore(n.__e, t || h), t = n.__e);
do {
t = t && t.nextSibling
} while (t != h && 8 == t.nodeType);
return t
}
function I(n, t) {
return t = t || [], n == h || "boolean" == typeof n || (v(n) ? n.some(function(n) {
I(n, t)
}) : t.push(n)), t
}
function L(n, t, i, r) {
var f, e, o = n.key,
u = n.type,
c = t[i];
if (c === h && null == n.key || c && o == c.key && u == c.type && !(2 & c.__u)) return i;
if (r > (c == h || 2 & c.__u ? 0 : 1))
for (f = i - 1, e = i + 1; f >= 0 || e < t.length;) {
if (f >= 0) {
if ((c = t[f]) && !(2 & c.__u) && o == c.key && u == c.type) return f;
f--
}
if (e < t.length) {
if ((c = t[e]) && !(2 & c.__u) && o == c.key && u == c.type) return e;
e++
}
}
return -1
}
function O(n, t, i) {
"-" == t[0] ? n.setProperty(t, i == h ? "" : i) : n[t] = i == h ? "" : i
}
function T(n, t, i, r, f) {
var e;
n: if ("style" == t)
if ("string" == typeof i) n.style.cssText = i;
else {
if ("string" == typeof r && (n.style.cssText = r = ""), r)
for (t in r) i && t in i || O(n.style, t, "");
if (i)
for (t in i) r && i[t] == r[t] || O(n.style, t, i[t])
}
else if ("o" == t[0] && "n" == t[1]) e = t != (t = t.replace(o, "$1")), t = t[2].toLowerCase() != t[2] ? t.toLowerCase().slice(2) : t.slice(2), n.__l || (n.__l = {}), n.__l[t + e] = i, i ? r ? i.t = r.t : (i.t = u, n.addEventListener(t, e ? s : c, e)) : n.removeEventListener(t, e ? s : c, e);
else {
if ("http://www.w3.org/2000/svg" == f) t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
else if ("width" != t && "height" != t && "href" != t && "list" != t && "form" != t && "tabIndex" != t && "download" != t && "rowSpan" != t && "colSpan" != t && "role" != t && "popover" != t && t in n) try {
n[t] = i == h ? "" : i;
break n
} catch (n) {}
"function" == typeof i || (i == h || !1 === i && "-" != t[4] ? n.removeAttribute(t) : n.setAttribute(t, "popover" == t && 1 == i ? "" : i))
}
}
function q(t) {
return function(i) {
if (this.__l) {
var r = this.__l[i.type + t];
if (i.i == h) i.i = u++;
else if (i.i < r.t) return;
return r(n.event ? n.event(i) : i)
}
}
}
function N(t, i, r, f, e, o, u, c, s, a) {
var p, y, w, g, b, k, S, $, x, C, A, H, I, L, O, T, q, N, P, B, D, F, G = i.type;
if (i.constructor != l) return h;
128 & r.__u && (s = !!(32 & r.__u), r.__c.__z && (c = i.__e = r.__e = (o = r.__c.__z)[0], r.__c.__z = null)), (p = n.__b) && p(i);
n: if ("function" == typeof G) try {
if ($ = i.props, x = "prototype" in G && G.prototype.render, C = (p = G.contextType) && f[p.__c], A = p ? C ? C.props.value : p.__ : f, r.__c ? S = (y = i.__c = r.__c).__ = y.__E : (x ? i.__c = y = new G($, A) : (i.__c = y = new M($, A), y.constructor = G, y.render = E), C && C.sub(y), y.props = $, y.state || (y.state = {}), y.context = A, y.__n = f, w = y.__d = !0, y.__h = [], y._sb = []), x && y.__s == h && (y.__s = y.state), x && G.getDerivedStateFromProps != h && (y.__s == y.state && (y.__s = d({}, y.__s)), d(y.__s, G.getDerivedStateFromProps($, y.__s))), g = y.props, b = y.state, y.__v = i, w) x && G.getDerivedStateFromProps == h && y.componentWillMount != h && y.componentWillMount(), x && y.componentDidMount != h && y.__h.push(y.componentDidMount);
else {
if (x && G.getDerivedStateFromProps == h && $ !== g && y.componentWillReceiveProps != h && y.componentWillReceiveProps($, A), !y.__e && y.shouldComponentUpdate != h && !1 === y.shouldComponentUpdate($, y.__s, A) || i.__v == r.__v) {
for (i.__v != r.__v && (y.props = $, y.state = y.__s, y.__d = !1), i.__e = r.__e, i.__k = r.__k, i.__k.some(function(n) {
n && (n.__ = i)
}), H = 0; H < y._sb.length; H++) y.__h.push(y._sb[H]);
y._sb = [], y.__h.length && u.push(y);
break n
}
y.componentWillUpdate != h && y.componentWillUpdate($, y.__s, A), x && y.componentDidUpdate != h && y.__h.push(function() {
y.componentDidUpdate(g, b, k)
})
}
if (y.context = A, y.props = $, y.__P = t, y.__e = !1, I = n.__r, L = n.__d, O = 0, x) {
for (y.state = y.__s, y.__d = !1, I && I(i), p = y.render(y.props, y.state, y.context), L && L(i, r), T = 0; T < y._sb.length; T++) y.__h.push(y._sb[T]);
y._sb = []
} else
do {
if (y.__d = !1, I && I(i), p = y.render(y.props, y.state, y.context), L && L(i, r), 8 & i.__u) {
y.__d = !1, y.__h = [], i.__e = r.__e, i.__k = r.__k, i.__k.some(function(n) {
n && (n.__ = i)
});
break n
}
y.state = y.__s
} while (y.__d && ++O < 25);
y.state = y.__s, y.getChildContext != h && (f = d({}, f, y.getChildContext())), x && !w && y.getSnapshotBeforeUpdate != h && (k = y.getSnapshotBeforeUpdate(g, b)), q = p, p != h && p.type === m && p.key == h && (q = V(p.props.children)), c = j(t, v(q) ? q : [q], i, r, f, e, o, u, c, s, a), i.__u &= -161, y.__h.length && u.push(y), S && (y.__E = y.__ = h)
} catch (t) {
if (i.__v = h, s || o != h)
if (t.then) {
for (N = 0, P = !1, i.__u |= s ? 160 : 128, i.__c.__z = [], B = 0; B < o.length; B++)(D = o[B]) == h || P || (8 == D.nodeType && "$s" == D.data ? (N > 0 && i.__c.__z.push(D), N++, o[B] = h) : 8 == D.nodeType && "/$s" == D.data ? (--N > 0 && i.__c.__z.push(D), P = 0 === N, c = o[B], o[B] = h) : N > 0 && (i.__c.__z.push(D), o[B] = h));
if (!P) {
for (; c && 8 == c.nodeType && c.nextSibling;) c = c.nextSibling;
o[o.indexOf(c)] = h, i.__c.__z = [c]
}
i.__e = c
} else
for (F = o.length; F--;) _(o[F]);
else i.__e = r.__e, i.__k = r.__k;
n.__e(t, i, r)
} else c = i.__e = z(r.__e, i, r, f, e, o, u, s, a);
return (p = n.diffed) && p(i), 128 & i.__u ? void 0 : c
}
function P(t, i, r) {
for (var f = 0; f < r.length; f++) B(r[f], r[++f], r[++f]);
n.__c && n.__c(i, t), t.some(function(i) {
try {
t = i.__h, i.__h = [], t.some(function(n) {
n.call(i)
})
} catch (t) {
n.__e(t, i.__v)
}
})
}
function V(n) {
return "object" != typeof n || n == h || n.__b && n.__b > 0 ? n : v(n) ? n.map(V) : d({}, n)
}
function z(t, i, r, f, e, o, u, c, s) {
var a, y, d, g, b, k, m, M = r.props,
$ = i.props,
x = i.type;
if ("svg" == x ? e = "http://www.w3.org/2000/svg" : "math" == x ? e = "http://www.w3.org/1998/Math/MathML" : e || (e = "http://www.w3.org/1999/xhtml"), o != h)
for (a = 0; a < o.length; a++)
if ((b = o[a]) && "setAttribute" in b == !!x && (x ? b.localName == x : 3 == b.nodeType)) {
t = b, o[a] = h;
break
} if (t == h) {
if (x == h) return document.createTextNode($);
t = document.createElementNS(e, x, $.is && $), c && (n.__m && n.__m(i, o), c = !1), o = h
}
if (x == h) M === $ || c && t.data == $ || (t.data = $);
else {
if (o = o && w.call(t.childNodes), M = r.props || p, !c && o != h)
for (M = {}, a = 0; a < t.attributes.length; a++) M[(b = t.attributes[a]).name] = b.value;
for (a in M)
if (b = M[a], "children" == a);
else if ("dangerouslySetInnerHTML" == a) d = b;
else if (!(a in $)) {
if ("value" == a && "defaultValue" in $ || "checked" == a && "defaultChecked" in $) continue;
T(t, a, h, b, e)
}
for (a in $) b = $[a], "children" == a ? g = b : "dangerouslySetInnerHTML" == a ? y = b : "value" == a ? k = b : "checked" == a ? m = b : c && "function" != typeof b || M[a] === b || T(t, a, b, M[a], e);
if (y) c || d && (y.__html == d.__html || y.__html == t.innerHTML) || (t.innerHTML = y.__html), i.__k = [];
else if (d && (t.innerHTML = ""), j("template" == i.type ? t.content : t, v(g) ? g : [g], i, r, f, "foreignObject" == x ? "http://www.w3.org/1999/xhtml" : e, o, u, o ? o[0] : r.__k && S(r, 0), c, s), o != h)
for (a = o.length; a--;) _(o[a]);
c || (a = "value", "progress" == x && k == h ? t.removeAttribute("value") : k == l || k === t[a] && ("progress" !== x || k) || T(t, a, k, M[a], e), a = "checked", m != l && m != t[a] && T(t, a, m, M[a], e))
}
return t
}
function B(t, i, r) {
try {
if ("function" == typeof t) {
var f = "function" == typeof t.__u;
f && t.__u(), f && i == h || (t.__u = t(i))
} else t.current = i
} catch (t) {
n.__e(t, r)
}
}
function D(t, i, r) {
var f, e;
if (n.unmount && n.unmount(t), (f = t.ref) && (f.current && f.current != t.__e || B(f, h, i)), (f = t.__c) != h) {
if (f.componentWillUnmount) try {
f.componentWillUnmount()
} catch (t) {
n.__e(t, i)
}
f.__P = h
}
if (f = t.__k)
for (e = 0; e < f.length; e++) f[e] && D(f[e], i, r || "function" != typeof t.type);
r || _(t.__e), t.__c = t.__ = t.__e = l
}
function E(n, t, i) {
return this.constructor(n, i)
}
function F(t, i) {
var r, f, e, o;
i == document && (i = document.documentElement), n.__ && n.__(t, i), f = (r = !!(t && 32 & t.__u)) ? h : i.__k, t = i.__k = g(m, h, [t]), e = [], o = [], N(i, t, f || p, p, i.namespaceURI, f ? h : i.firstChild ? w.call(i.childNodes) : h, e, f ? f.__e : i.firstChild, r, o), P(e, t, o)
}
function G(n, t) {
n.__u |= 32, F(n, t)
}
function J(n, t, i) {
var r, f, e, o = d({}, n.props);
for (e in t) "key" == e ? r = t[e] : "ref" == e && "function" != typeof n.type ? f = t[e] : o[e] = t[e];
return arguments.length > 2 && (o.children = arguments.length > 3 ? w.call(arguments, 2) : i), b(n.type, o, r || n.key, f || n.ref, h)
}
function K(n) {
function t(n) {
var i, r;
return this.getChildContext || (i = new Set, (r = {})[t.__c] = this, this.getChildContext = function() {
return r
}, this.componentWillUnmount = function() {
i = h
}, this.shouldComponentUpdate = function(n) {
this.props.value != n.value && i.forEach(function(n) {
n.__e = !0, x(n)
})
}, this.sub = function(n) {
i.add(n);
var t = n.componentWillUnmount;
n.componentWillUnmount = function() {
i && i.delete(n), t && t.call(n)
}
}), n.children
}
return t.__c = "__cC" + a++, t.__ = n, t.Provider = t.__l = (t.Consumer = function(n, t) {
return n.children(t)
}).contextType = t, t
}
n = {
__e: function(n, t, i, r) {
for (var f, e, o; t = t.__;)
if ((f = t.__c) && !f.__) try {
if ((e = f.constructor) && e.getDerivedStateFromError != h && (f.setState(e.getDerivedStateFromError(n)), o = f.__d), f.componentDidCatch != h && (f.componentDidCatch(n, r || {}), o = f.__d), o) return f.__E = f
} catch (t) {
n = t
}
throw n
}
}, t = 0, i = function(n) {
return n != h && n.constructor == l
}, M.prototype.setState = function(n, t) {
var i;
i = this.__s != h && this.__s != this.state ? this.__s : this.__s = d({}, this.state), "function" == typeof n && (n = n(d({}, i), this.props)), n && d(i, n), n != h && this.__v && (t && this._sb.push(t), x(this))
}, M.prototype.forceUpdate = function(n) {
this.__v && (this.__e = !0, n && this.__h.push(n), x(this))
}, M.prototype.render = m, r = [], e = function(n, t) {
return n.__v.__b - t.__v.__b
}, C.__r = 0, o = /(PointerCapture)$|Capture$/i, u = 0, c = q(!1), s = q(!0), a = 0;
export {
M as Component, m as Fragment, J as cloneElement, K as createContext, g as createElement, k as createRef, g as h, G as hydrate, i as isValidElement, n as options, F as render, I as toChildArray
};
var n, l, u, t, i, r, f, e, o, c, s, a = {},
h = [],
p = Array.isArray,
v = h.slice,
y = Object.assign;
function w(n) {
n && n.parentNode && n.remove()
}
function d(n, l, u) {
var t, i, r, f = {};
for (r in l) "key" == r ? t = l[r] : "ref" == r && "function" != typeof n ? i = l[r] : f[r] = l[r];
return arguments.length > 2 && (f.children = arguments.length > 3 ? v.call(arguments, 2) : u), _(n, f, t, i, null)
}
function _(u, t, i, r, f) {
var e = {
type: u,
props: t,
key: i,
ref: r,
__k: null,
__: null,
__b: 0,
__e: null,
__c: null,
constructor: void 0,
__v: null == f ? ++l : f,
__i: -1,
__u: 0
};
return null == f && null != n.vnode && n.vnode(e), e
}
function g() {
return {
current: null
}
}
function b(n) {
return n.children
}
function k(n, l) {
this.props = n, this.context = l
}
function m(n, l) {
if (null == l) return n.__ ? m(n.__, n.__i + 1) : null;
for (var u; l < n.__k.length; l++)
if (null != (u = n.__k[l]) && null != u.__e) return u.__e;
return "function" == typeof n.type ? m(n) : null
}
function M(n) {
var l, u;
if (null != (n = n.__) && null != n.__c) {
for (n.__e = null, l = 0; l < n.__k.length; l++)
if (null != (u = n.__k[l]) && null != u.__e) {
n.__e = u.__e;
break
} return M(n)
}
}
function S(l) {
(!l.__d && (l.__d = !0) && t.push(l) && !$.__r++ || i != n.debounceRendering) && ((i = n.debounceRendering) || queueMicrotask)($)
}
function $() {
for (var l, u, i, f, e, o, c, s = 1; t.length;) t.length > s && t.sort(r), l = t.shift(), s = t.length, l.__d && (i = void 0, e = (f = (u = l).__v).__e, o = [], c = [], u.__P && ((i = y({}, f)).__v = f.__v + 1, n.vnode && n.vnode(i), T(u.__P, i, f, u.__n, u.__P.namespaceURI, 32 & f.__u ? [e] : null, o, null == e ? m(f) : e, !!(32 & f.__u), c), i.__v = f.__v, i.__.__k[i.__i] = i, q(o, i, c), i.__e != e && M(i)));
$.__r = 0
}
function x(n, l, u, t, i, r, f, e, o, c, s) {
var p, v, y, w, d, _, g = t && t.__k || h,
b = l.length;
for (o = C(u, l, g, o, b), p = 0; p < b; p++) null != (y = u.__k[p]) && (v = -1 == y.__i ? a : g[y.__i] || a, y.__i = p, _ = T(n, y, v, i, r, f, e, o, c, s), w = y.__e, y.ref && v.ref != y.ref && (v.ref && V(v.ref, null, y), s.push(y.ref, y.__c || w, y)), null == d && null != w && (d = w), 4 & y.__u || v.__k === y.__k ? o = j(y, o, n) : "function" == typeof y.type && void 0 !== _ ? o = _ : w && (o = w.nextSibling), y.__u &= -7);
return u.__e = d, o
}
function C(n, l, u, t, i) {
var r, f, e, o, c, s = u.length,
a = s,
h = 0;
for (n.__k = new Array(i), r = 0; r < i; r++) null != (f = l[r]) && "boolean" != typeof f && "function" != typeof f ? (o = r + h, (f = n.__k[r] = "string" == typeof f || "number" == typeof f || "bigint" == typeof f || f.constructor == String ? _(null, f, null, null, null) : p(f) ? _(b, {
children: f
}, null, null, null) : null == f.constructor && f.__b > 0 ? _(f.type, f.props, f.key, f.ref ? f.ref : null, f.__v) : f).__ = n, f.__b = n.__b + 1, e = null, -1 != (c = f.__i = H(f, u, o, a)) && (a--, (e = u[c]) && (e.__u |= 2)), null == e || null == e.__v ? (-1 == c && (i > s ? h-- : i < s && h++), "function" != typeof f.type && (f.__u |= 4)) : c != o && (c == o - 1 ? h-- : c == o + 1 ? h++ : (c > o ? h-- : h++, f.__u |= 4))) : n.__k[r] = null;
if (a)
for (r = 0; r < s; r++) null != (e = u[r]) && 0 == (2 & e.__u) && (e.__e == t && (t = m(e)), z(e, e));
return t
}
function j(n, l, u) {
var t, i;
if ("function" == typeof n.type) {
for (t = n.__k, i = 0; t && i < t.length; i++) t[i] && (t[i].__ = n, l = j(t[i], l, u));
return l
}
n.__e != l && (l && n.type && !l.parentNode && (l = m(n)), u.insertBefore(n.__e, l || null), l = n.__e);
do {
l = l && l.nextSibling
} while (null != l && 8 == l.nodeType);
return l
}
function A(n, l) {
return l = l || [], null == n || "boolean" == typeof n || (p(n) ? n.some(function(n) {
A(n, l)
}) : l.push(n)), l
}
function H(n, l, u, t) {
var i, r, f = n.key,
e = n.type,
o = l[u];
if (null === o && null == n.key || o && f == o.key && e == o.type && 0 == (2 & o.__u)) return u;
if (t > (null != o && 0 == (2 & o.__u) ? 1 : 0))
for (i = u - 1, r = u + 1; i >= 0 || r < l.length;) {
if (i >= 0) {
if ((o = l[i]) && 0 == (2 & o.__u) && f == o.key && e == o.type) return i;
i--
}
if (r < l.length) {
if ((o = l[r]) && 0 == (2 & o.__u) && f == o.key && e == o.type) return r;
r++
}
}
return -1
}
function I(n, l, u) {
"-" == l[0] ? n.setProperty(l, null == u ? "" : u) : n[l] = null == u ? "" : u
}
function L(n, l, u, t, i) {
var r;
n: if ("style" == l)
if ("string" == typeof u) n.style.cssText = u;
else {
if ("string" == typeof t && (n.style.cssText = t = ""), t)
for (l in t) u && l in u || I(n.style, l, "");
if (u)
for (l in u) t && u[l] == t[l] || I(n.style, l, u[l])
}
else if ("o" == l[0] && "n" == l[1]) r = l != (l = l.replace(f, "$1")), l = l[2].toLowerCase() != l[2] ? l.toLowerCase().slice(2) : l.slice(2), n.__l || (n.__l = {}), n.__l[l + r] = u, u ? t ? u.l = t.l : (u.l = e, n.addEventListener(l, r ? c : o, r)) : n.removeEventListener(l, r ? c : o, r);
else {
if ("http://www.w3.org/2000/svg" == i) l = l.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
else if ("width" != l && "height" != l && "href" != l && "list" != l && "form" != l && "tabIndex" != l && "download" != l && "rowSpan" != l && "colSpan" != l && "role" != l && "popover" != l && l in n) try {
n[l] = null == u ? "" : u;
break n
} catch (n) {}
"function" == typeof u || (null == u || !1 === u && "-" != l[4] ? n.removeAttribute(l) : n.setAttribute(l, "popover" == l && 1 == u ? "" : u))
}
}
function O(l) {
return function(u) {
if (this.__l) {
var t = this.__l[u.type + l];
if (null == u.u) u.u = e++;
else if (u.u < t.l) return;
return t(n.event ? n.event(u) : u)
}
}
}
function T(l, u, t, i, r, f, e, o, c, s) {
var a, h, v, d, _, g, m, M, S, $, C, j, A, H, I, L, O, T, q, V, z, D, E = u.type;
if (null != u.constructor) return null;
128 & t.__u && (c = !!(32 & t.__u), t.__c.__z && (o = u.__e = t.__e = (f = t.__c.__z)[0], t.__c.__z = null)), (a = n.__b) && a(u);
n: if ("function" == typeof E) try {
if (M = u.props, S = "prototype" in E && E.prototype.render, $ = (a = E.contextType) && i[a.__c], C = a ? $ ? $.props.value : a.__ : i, t.__c ? m = (h = u.__c = t.__c).__ = h.__E : (S ? u.__c = h = new E(M, C) : (u.__c = h = new k(M, C), h.constructor = E, h.render = B), $ && $.sub(h), h.props = M, h.state || (h.state = {}), h.context = C, h.__n = i, v = h.__d = !0, h.__h = [], h._sb = []), S && null == h.__s && (h.__s = h.state), S && null != E.getDerivedStateFromProps && (h.__s == h.state && (h.__s = y({}, h.__s)), y(h.__s, E.getDerivedStateFromProps(M, h.__s))), d = h.props, _ = h.state, h.__v = u, v) S && null == E.getDerivedStateFromProps && null != h.componentWillMount && h.componentWillMount(), S && null != h.componentDidMount && h.__h.push(h.componentDidMount);
else {
if (S && null == E.getDerivedStateFromProps && M !== d && null != h.componentWillReceiveProps && h.componentWillReceiveProps(M, C), !h.__e && null != h.shouldComponentUpdate && !1 === h.shouldComponentUpdate(M, h.__s, C) || u.__v == t.__v) {
for (u.__v != t.__v && (h.props = M, h.state = h.__s, h.__d = !1), u.__e = t.__e, u.__k = t.__k, u.__k.some(function(n) {
n && (n.__ = u)
}), j = 0; j < h._sb.length; j++) h.__h.push(h._sb[j]);
h._sb = [], h.__h.length && e.push(h);
break n
}
null != h.componentWillUpdate && h.componentWillUpdate(M, h.__s, C), S && null != h.componentDidUpdate && h.__h.push(function() {
h.componentDidUpdate(d, _, g)
})
}
if (h.context = C, h.props = M, h.__P = l, h.__e = !1, A = n.__r, H = n.__d, I = 0, S) {
for (h.state = h.__s, h.__d = !1, A && A(u), a = h.render(h.props, h.state, h.context), H && H(u, t), L = 0; L < h._sb.length; L++) h.__h.push(h._sb[L]);
h._sb = []
} else
do {
if (h.__d = !1, A && A(u), a = h.render(h.props, h.state, h.context), H && H(u, t), 8 & u.__u) {
h.__d = !1, h.__h = [], u.__e = t.__e, u.__k = t.__k, u.__k.some(function(n) {
n && (n.__ = u)
});
break n
}
h.state = h.__s
} while (h.__d && ++I < 25);
h.state = h.__s, null != h.getChildContext && (i = y({}, i, h.getChildContext())), S && !v && null != h.getSnapshotBeforeUpdate && (g = h.getSnapshotBeforeUpdate(d, _)), O = a, null != a && a.type === b && null == a.key && (O = N(a.props.children)), o = x(l, p(O) ? O : [O], u, t, i, r, f, e, o, c, s), u.__u &= -161, h.__h.length && e.push(h), m && (h.__E = h.__ = null)
} catch (l) {
if (u.__v = null, c || null != f)
if (l.then) {
for (T = 0, q = !1, u.__u |= c ? 160 : 128, u.__c.__z = [], V = 0; V < f.length; V++) null == (z = f[V]) || q || (8 == z.nodeType && "$s" == z.data ? (T > 0 && u.__c.__z.push(z), T++, f[V] = null) : 8 == z.nodeType && "/$s" == z.data ? (--T > 0 && u.__c.__z.push(z), q = 0 === T, o = f[V], f[V] = null) : T > 0 && (u.__c.__z.push(z), f[V] = null));
if (!q) {
for (; o && 8 == o.nodeType && o.nextSibling;) o = o.nextSibling;
f[f.indexOf(o)] = null, u.__c.__z = [o]
}
u.__e = o
} else
for (D = f.length; D--;) w(f[D]);
else u.__e = t.__e, u.__k = t.__k;
n.__e(l, u, t)
} else o = u.__e = P(t.__e, u, t, i, r, f, e, c, s);
return (a = n.diffed) && a(u), 128 & u.__u ? void 0 : o
}
function q(l, u, t) {
for (var i = 0; i < t.length; i++) V(t[i], t[++i], t[++i]);
n.__c && n.__c(u, l), l.some(function(u) {
try {
l = u.__h, u.__h = [], l.some(function(n) {
n.call(u)
})
} catch (l) {
n.__e(l, u.__v)
}
})
}
function N(n) {
return "object" != typeof n || null == n || n.__b && n.__b > 0 ? n : p(n) ? n.map(N) : y({}, n)
}
function P(l, u, t, i, r, f, e, o, c) {
var s, h, y, d, _, g, b, k = t.props,
M = u.props,
S = u.type;
if ("svg" == S ? r = "http://www.w3.org/2000/svg" : "math" == S ? r = "http://www.w3.org/1998/Math/MathML" : r || (r = "http://www.w3.org/1999/xhtml"), null != f)
for (s = 0; s < f.length; s++)
if ((_ = f[s]) && "setAttribute" in _ == !!S && (S ? _.localName == S : 3 == _.nodeType)) {
l = _, f[s] = null;
break
} if (null == l) {
if (null == S) return document.createTextNode(M);
l = document.createElementNS(r, S, M.is && M), o && (n.__m && n.__m(u, f), o = !1), f = null
}
if (null == S) k === M || o && l.data == M || (l.data = M);
else {
if (f = f && v.call(l.childNodes), k = t.props || a, !o && null != f)
for (k = {}, s = 0; s < l.attributes.length; s++) k[(_ = l.attributes[s]).name] = _.value;
for (s in k)
if (_ = k[s], "children" == s);
else if ("dangerouslySetInnerHTML" == s) y = _;
else if (!(s in M)) {
if ("value" == s && "defaultValue" in M || "checked" == s && "defaultChecked" in M) continue;
L(l, s, null, _, r)
}
for (s in M) _ = M[s], "children" == s ? d = _ : "dangerouslySetInnerHTML" == s ? h = _ : "value" == s ? g = _ : "checked" == s ? b = _ : o && "function" != typeof _ || k[s] === _ || L(l, s, _, k[s], r);
if (h) o || y && (h.__html == y.__html || h.__html == l.innerHTML) || (l.innerHTML = h.__html), u.__k = [];
else if (y && (l.innerHTML = ""), x("template" == u.type ? l.content : l, p(d) ? d : [d], u, t, i, "foreignObject" == S ? "http://www.w3.org/1999/xhtml" : r, f, e, f ? f[0] : t.__k && m(t, 0), o, c), null != f)
for (s = f.length; s--;) w(f[s]);
o || (s = "value", "progress" == S && null == g ? l.removeAttribute("value") : null == g || g === l[s] && ("progress" !== S || g) || L(l, s, g, k[s], r), s = "checked", null != b && b != l[s] && L(l, s, b, k[s], r))
}
return l
}
function V(l, u, t) {
try {
if ("function" == typeof l) {
var i = "function" == typeof l.__u;
i && l.__u(), i && null == u || (l.__u = l(u))
} else l.current = u
} catch (l) {
n.__e(l, t)
}
}
function z(l, u, t) {
var i, r;
if (n.unmount && n.unmount(l), (i = l.ref) && (i.current && i.current != l.__e || V(i, null, u)), null != (i = l.__c)) {
if (i.componentWillUnmount) try {
i.componentWillUnmount()
} catch (l) {
n.__e(l, u)
}
i.__P = null
}
if (i = l.__k)
for (r = 0; r < i.length; r++) i[r] && z(i[r], u, t || "function" != typeof l.type);
t || w(l.__e), l.__c = l.__ = l.__e = void 0
}
function B(n, l, u) {
return this.constructor(n, u)
}
function D(l, u) {
var t, i, r, f;
u == document && (u = document.documentElement), n.__ && n.__(l, u), i = (t = !!(l && 32 & l.__u)) ? null : u.__k, l = u.__k = d(b, null, [l]), r = [], f = [], T(u, l, i || a, a, u.namespaceURI, i ? null : u.firstChild ? v.call(u.childNodes) : null, r, i ? i.__e : u.firstChild, t, f), q(r, l, f)
}
function E(n, l) {
n.__u |= 32, D(n, l)
}
function F(n, l, u) {
var t, i, r, f = y({}, n.props);
for (r in l) "key" == r ? t = l[r] : "ref" == r && "function" != typeof n.type ? i = l[r] : f[r] = l[r];
return arguments.length > 2 && (f.children = arguments.length > 3 ? v.call(arguments, 2) : u), _(n.type, f, t || n.key, i || n.ref, null)
}
function G(n) {
function l(n) {
var u, t;
return this.getChildContext || (u = new Set, (t = {})[l.__c] = this, this.getChildContext = function() {
return t
}, this.componentWillUnmount = function() {
u = null
}, this.shouldComponentUpdate = function(n) {
this.props.value != n.value && u.forEach(function(n) {
n.__e = !0, S(n)
})
}, this.sub = function(n) {
u.add(n);
var l = n.componentWillUnmount;
n.componentWillUnmount = function() {
u && u.delete(n), l && l.call(n)
}
}), n.children
}
return l.__c = "__cC" + s++, l.__ = n, l.Provider = l.__l = (l.Consumer = function(n, l) {
return n.children(l)
}).contextType = l, l
}
n = {
__e: function(n, l, u, t) {
for (var i, r, f; l = l.__;)
if ((i = l.__c) && !i.__) try {
if ((r = i.constructor) && null != r.getDerivedStateFromError && (i.setState(r.getDerivedStateFromError(n)), f = i.__d), null != i.componentDidCatch && (i.componentDidCatch(n, t || {}), f = i.__d), f) return i.__E = i
} catch (l) {
n = l
}
throw n
}
}, l = 0, u = function(n) {
return null != n && null == n.constructor
}, k.prototype.setState = function(n, l) {
var u;
u = null != this.__s && this.__s != this.state ? this.__s : this.__s = y({}, this.state), "function" == typeof n && (n = n(y({}, u), this.props)), n && y(u, n), null != n && this.__v && (l && this._sb.push(l), S(this))
}, k.prototype.forceUpdate = function(n) {
this.__v && (this.__e = !0, n && this.__h.push(n), S(this))
}, k.prototype.render = b, t = [], r = function(n, l) {
return n.__v.__b - l.__v.__b
}, $.__r = 0, f = /(PointerCapture)$|Capture$/i, e = 0, o = O(!1), c = O(!0), s = 0;
export {
k as Component, b as Fragment, F as cloneElement, G as createContext, d as createElement, g as createRef, d as h, E as hydrate, u as isValidElement, n as options, D as render, A as toChildArray
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment