UNPKG

@stlite/browser

Version:
290 lines (289 loc) 9.85 kB
import { o as e } from "./value-YcFXbvJe-DIeu1yzI.js"; //#region ../react/build/timer-ChR2a-4D.js var t = Math.PI, n = 2 * t, r = 1e-6, i = n - r; function a(e) { this._ += e[0]; for (let t = 1, n = e.length; t < n; ++t) this._ += arguments[t] + e[t]; } function o(e) { let t = Math.floor(e); if (!(t >= 0)) throw Error(`invalid digits: ${e}`); if (t > 15) return a; let n = 10 ** t; return function(e) { this._ += e[0]; for (let t = 1, r = e.length; t < r; ++t) this._ += Math.round(arguments[t] * n) / n + e[t]; }; } var s = class { constructor(e) { this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "", this._append = e == null ? a : o(e); } moveTo(e, t) { this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}`; } closePath() { this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`); } lineTo(e, t) { this._append`L${this._x1 = +e},${this._y1 = +t}`; } quadraticCurveTo(e, t, n, r) { this._append`Q${+e},${+t},${this._x1 = +n},${this._y1 = +r}`; } bezierCurveTo(e, t, n, r, i, a) { this._append`C${+e},${+t},${+n},${+r},${this._x1 = +i},${this._y1 = +a}`; } arcTo(e, n, i, a, o) { if (e = +e, n = +n, i = +i, a = +a, o = +o, o < 0) throw Error(`negative radius: ${o}`); let s = this._x1, c = this._y1, l = i - e, u = a - n, d = s - e, f = c - n, p = d * d + f * f; if (this._x1 === null) this._append`M${this._x1 = e},${this._y1 = n}`; else if (p > r) if (!(Math.abs(f * l - u * d) > r) || !o) this._append`L${this._x1 = e},${this._y1 = n}`; else { let m = i - s, h = a - c, g = l * l + u * u, _ = m * m + h * h, v = Math.sqrt(g), y = Math.sqrt(p), b = o * Math.tan((t - Math.acos((g + p - _) / (2 * v * y))) / 2), x = b / y, S = b / v; Math.abs(x - 1) > r && this._append`L${e + x * d},${n + x * f}`, this._append`A${o},${o},0,0,${+(f * m > d * h)},${this._x1 = e + S * l},${this._y1 = n + S * u}`; } } arc(e, a, o, s, c, l) { if (e = +e, a = +a, o = +o, l = !!l, o < 0) throw Error(`negative radius: ${o}`); let u = o * Math.cos(s), d = o * Math.sin(s), f = e + u, p = a + d, m = 1 ^ l, h = l ? s - c : c - s; this._x1 === null ? this._append`M${f},${p}` : (Math.abs(this._x1 - f) > r || Math.abs(this._y1 - p) > r) && this._append`L${f},${p}`, o && (h < 0 && (h = h % n + n), h > i ? this._append`A${o},${o},0,1,${m},${e - u},${a - d}A${o},${o},0,1,${m},${this._x1 = f},${this._y1 = p}` : h > r && this._append`A${o},${o},0,${+(h >= t)},${m},${this._x1 = e + o * Math.cos(c)},${this._y1 = a + o * Math.sin(c)}`); } rect(e, t, n, r) { this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}h${n = +n}v${+r}h${-n}Z`; } toString() { return this._; } }; function c() { return new s(); } c.prototype = s.prototype; var l = 180 / Math.PI, u = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 }; function d(e, t, n, r, i, a) { var o, s, c; return (o = Math.sqrt(e * e + t * t)) && (e /= o, t /= o), (c = e * n + t * r) && (n -= e * c, r -= t * c), (s = Math.sqrt(n * n + r * r)) && (n /= s, r /= s, c /= s), e * r < t * n && (e = -e, t = -t, c = -c, o = -o), { translateX: i, translateY: a, rotate: Math.atan2(t, e) * l, skewX: Math.atan(c) * l, scaleX: o, scaleY: s }; } var f; function p(e) { let t = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(e + ""); return t.isIdentity ? u : d(t.a, t.b, t.c, t.d, t.e, t.f); } function m(e) { return e == null || (f ||= document.createElementNS("http://www.w3.org/2000/svg", "g"), f.setAttribute("transform", e), !(e = f.transform.baseVal.consolidate())) ? u : (e = e.matrix, d(e.a, e.b, e.c, e.d, e.e, e.f)); } function h(t, n, r, i) { function a(e) { return e.length ? e.pop() + " " : ""; } function o(t, i, a, o, s, c) { if (t !== a || i !== o) { var l = s.push("translate(", null, n, null, r); c.push({ i: l - 4, x: e(t, a) }, { i: l - 2, x: e(i, o) }); } else (a || o) && s.push("translate(" + a + n + o + r); } function s(t, n, r, o) { t === n ? n && r.push(a(r) + "rotate(" + n + i) : (t - n > 180 ? n += 360 : n - t > 180 && (t += 360), o.push({ i: r.push(a(r) + "rotate(", null, i) - 2, x: e(t, n) })); } function c(t, n, r, o) { t === n ? n && r.push(a(r) + "skewX(" + n + i) : o.push({ i: r.push(a(r) + "skewX(", null, i) - 2, x: e(t, n) }); } function l(t, n, r, i, o, s) { if (t !== r || n !== i) { var c = o.push(a(o) + "scale(", null, ",", null, ")"); s.push({ i: c - 4, x: e(t, r) }, { i: c - 2, x: e(n, i) }); } else (r !== 1 || i !== 1) && o.push(a(o) + "scale(" + r + "," + i + ")"); } return function(e, n) { var r = [], i = []; return e = t(e), n = t(n), o(e.translateX, e.translateY, n.translateX, n.translateY, r, i), s(e.rotate, n.rotate, r, i), c(e.skewX, n.skewX, r, i), l(e.scaleX, e.scaleY, n.scaleX, n.scaleY, r, i), e = n = null, function(e) { for (var t = -1, n = i.length, a; ++t < n;) r[(a = i[t]).i] = a.x(e); return r.join(""); }; }; } var g = h(p, "px, ", "px)", "deg)"), _ = h(m, ", ", ")", ")"), v = 1e-12; function y(e) { return ((e = Math.exp(e)) + 1 / e) / 2; } function b(e) { return ((e = Math.exp(e)) - 1 / e) / 2; } function x(e) { return ((e = Math.exp(2 * e)) - 1) / (e + 1); } var S = function e(t, n, r) { function i(e, i) { var a = e[0], o = e[1], s = e[2], c = i[0], l = i[1], u = i[2], d = c - a, f = l - o, p = d * d + f * f, m, h; if (p < v) h = Math.log(u / s) / t, m = function(e) { return [ a + e * d, o + e * f, s * Math.exp(t * e * h) ]; }; else { var g = Math.sqrt(p), _ = (u * u - s * s + r * p) / (2 * s * n * g), S = (u * u - s * s - r * p) / (2 * u * n * g), C = Math.log(Math.sqrt(_ * _ + 1) - _); h = (Math.log(Math.sqrt(S * S + 1) - S) - C) / t, m = function(e) { var r = e * h, i = y(C), c = s / (n * g) * (i * x(t * r + C) - b(C)); return [ a + c * d, o + c * f, s * i / y(t * r + C) ]; }; } return m.duration = h * 1e3 * t / Math.SQRT2, m; } return i.rho = function(t) { var n = Math.max(.001, +t), r = n * n; return e(n, r, r * r); }, i; }(Math.SQRT2, 2, 4), C = { value: () => {} }; function w() { for (var e = 0, t = arguments.length, n = {}, r; e < t; ++e) { if (!(r = arguments[e] + "") || r in n || /[\s.]/.test(r)) throw Error("illegal type: " + r); n[r] = []; } return new T(n); } function T(e) { this._ = e; } function E(e, t) { return e.trim().split(/^|\s+/).map(function(e) { var n = "", r = e.indexOf("."); if (r >= 0 && (n = e.slice(r + 1), e = e.slice(0, r)), e && !t.hasOwnProperty(e)) throw Error("unknown type: " + e); return { type: e, name: n }; }); } T.prototype = w.prototype = { constructor: T, on: function(e, t) { var n = this._, r = E(e + "", n), i, a = -1, o = r.length; if (arguments.length < 2) { for (; ++a < o;) if ((i = (e = r[a]).type) && (i = D(n[i], e.name))) return i; return; } if (t != null && typeof t != "function") throw Error("invalid callback: " + t); for (; ++a < o;) if (i = (e = r[a]).type) n[i] = O(n[i], e.name, t); else if (t == null) for (i in n) n[i] = O(n[i], e.name, null); return this; }, copy: function() { var e = {}, t = this._; for (var n in t) e[n] = t[n].slice(); return new T(e); }, call: function(e, t) { if ((i = arguments.length - 2) > 0) for (var n = Array(i), r = 0, i, a; r < i; ++r) n[r] = arguments[r + 2]; if (!this._.hasOwnProperty(e)) throw Error("unknown type: " + e); for (a = this._[e], r = 0, i = a.length; r < i; ++r) a[r].value.apply(t, n); }, apply: function(e, t, n) { if (!this._.hasOwnProperty(e)) throw Error("unknown type: " + e); for (var r = this._[e], i = 0, a = r.length; i < a; ++i) r[i].value.apply(t, n); } }; function D(e, t) { for (var n = 0, r = e.length, i; n < r; ++n) if ((i = e[n]).name === t) return i.value; } function O(e, t, n) { for (var r = 0, i = e.length; r < i; ++r) if (e[r].name === t) { e[r] = C, e = e.slice(0, r).concat(e.slice(r + 1)); break; } return n != null && e.push({ name: t, value: n }), e; } var k = 0, A = 0, j = 0, M = 1e3, N, P, F = 0, I = 0, L = 0, R = typeof performance == "object" && performance.now ? performance : Date, z = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(e) { setTimeout(e, 17); }; function B() { return I ||= (z(V), R.now() + L); } function V() { I = 0; } function H() { this._call = this._time = this._next = null; } H.prototype = U.prototype = { constructor: H, restart: function(e, t, n) { if (typeof e != "function") throw TypeError("callback is not a function"); n = (n == null ? B() : +n) + (t == null ? 0 : +t), !this._next && P !== this && (P ? P._next = this : N = this, P = this), this._call = e, this._time = n, J(); }, stop: function() { this._call && (this._call = null, this._time = Infinity, J()); } }; function U(e, t, n) { var r = new H(); return r.restart(e, t, n), r; } function W() { B(), ++k; for (var e = N, t; e;) (t = I - e._time) >= 0 && e._call.call(void 0, t), e = e._next; --k; } function G() { I = (F = R.now()) + L, k = A = 0; try { W(); } finally { k = 0, q(), I = 0; } } function K() { var e = R.now(), t = e - F; t > M && (L -= t, F = e); } function q() { for (var e, t = N, n, r = Infinity; t;) t._call ? (r > t._time && (r = t._time), e = t, t = t._next) : (n = t._next, t._next = null, t = e ? e._next = n : N = n); P = e, J(r); } function J(e) { k || (A &&= clearTimeout(A), e - I > 24 ? (e < Infinity && (A = setTimeout(G, e - R.now() - L)), j &&= clearInterval(j)) : (j ||= (F = R.now(), setInterval(K, M)), k = 1, z(G))); } //#endregion export { c as a, U as c, S as i, _ as l, H as n, B as o, w as r, g as s, s as t }; //# sourceMappingURL=timer-ChR2a-4D-CgvgGXZ7.js.map