UNPKG

@safe-stars/components

Version:

React component library for buying Telegram Stars in Telegram Mini Apps via Safe Stars.

505 lines (503 loc) 19.4 kB
import { U as ee, c as se } from "./if-defined-CTZGcMnO.js"; import { Z as P, _ as Q, i as ae, r as ce, a as de, x as le } from "./index-B5pm1jHN.js"; import "./index-DRHnnPAq.js"; var ie = { exports: {} }; (function(e, d) { (function(a, c) { e.exports = c(); })(P, function() { var a = 1e3, c = 6e4, m = 36e5, l = "millisecond", f = "second", y = "minute", $ = "hour", p = "day", x = "week", M = "month", I = "quarter", b = "year", D = "date", Y = "Invalid Date", W = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, B = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, C = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(u) { var i = ["th", "st", "nd", "rd"], t = u % 100; return "[" + u + (i[(t - 20) % 10] || i[t] || i[0]) + "]"; } }, J = function(u, i, t) { var r = String(u); return !r || r.length >= i ? u : "" + Array(i + 1 - r.length).join(t) + u; }, j = { s: J, z: function(u) { var i = -u.utcOffset(), t = Math.abs(i), r = Math.floor(t / 60), n = t % 60; return (i <= 0 ? "+" : "-") + J(r, 2, "0") + ":" + J(n, 2, "0"); }, m: function u(i, t) { if (i.date() < t.date()) return -u(t, i); var r = 12 * (t.year() - i.year()) + (t.month() - i.month()), n = i.clone().add(r, M), o = t - n < 0, s = i.clone().add(r + (o ? -1 : 1), M); return +(-(r + (t - n) / (o ? n - s : s - n)) || 0); }, a: function(u) { return u < 0 ? Math.ceil(u) || 0 : Math.floor(u); }, p: function(u) { return { M, y: b, w: x, d: p, D, h: $, m: y, s: f, ms: l, Q: I }[u] || String(u || "").toLowerCase().replace(/s$/, ""); }, u: function(u) { return u === void 0; } }, S = "en", O = {}; O[S] = C; var E = "$isDayjsObject", k = function(u) { return u instanceof z || !(!u || !u[E]); }, q = function u(i, t, r) { var n; if (!i) return S; if (typeof i == "string") { var o = i.toLowerCase(); O[o] && (n = o), t && (O[o] = t, n = o); var s = i.split("-"); if (!n && s.length > 1) return u(s[0]); } else { var g = i.name; O[g] = i, n = g; } return !r && n && (S = n), n || !r && S; }, T = function(u, i) { if (k(u)) return u.clone(); var t = typeof i == "object" ? i : {}; return t.date = u, t.args = arguments, new z(t); }, h = j; h.l = q, h.i = k, h.w = function(u, i) { return T(u, { locale: i.$L, utc: i.$u, x: i.$x, $offset: i.$offset }); }; var z = function() { function u(t) { this.$L = q(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[E] = !0; } var i = u.prototype; return i.parse = function(t) { this.$d = function(r) { var n = r.date, o = r.utc; if (n === null) return /* @__PURE__ */ new Date(NaN); if (h.u(n)) return /* @__PURE__ */ new Date(); if (n instanceof Date) return new Date(n); if (typeof n == "string" && !/Z$/i.test(n)) { var s = n.match(W); if (s) { var g = s[2] - 1 || 0, v = (s[7] || "0").substring(0, 3); return o ? new Date(Date.UTC(s[1], g, s[3] || 1, s[4] || 0, s[5] || 0, s[6] || 0, v)) : new Date(s[1], g, s[3] || 1, s[4] || 0, s[5] || 0, s[6] || 0, v); } } return new Date(n); }(t), this.init(); }, i.init = function() { var t = this.$d; this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds(); }, i.$utils = function() { return h; }, i.isValid = function() { return this.$d.toString() !== Y; }, i.isSame = function(t, r) { var n = T(t); return this.startOf(r) <= n && n <= this.endOf(r); }, i.isAfter = function(t, r) { return T(t) < this.startOf(r); }, i.isBefore = function(t, r) { return this.endOf(r) < T(t); }, i.$g = function(t, r, n) { return h.u(t) ? this[r] : this.set(n, t); }, i.unix = function() { return Math.floor(this.valueOf() / 1e3); }, i.valueOf = function() { return this.$d.getTime(); }, i.startOf = function(t, r) { var n = this, o = !!h.u(r) || r, s = h.p(t), g = function(U, L) { var N = h.w(n.$u ? Date.UTC(n.$y, L, U) : new Date(n.$y, L, U), n); return o ? N : N.endOf(p); }, v = function(U, L) { return h.w(n.toDate()[U].apply(n.toDate("s"), (o ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(L)), n); }, w = this.$W, _ = this.$M, F = this.$D, H = "set" + (this.$u ? "UTC" : ""); switch (s) { case b: return o ? g(1, 0) : g(31, 11); case M: return o ? g(1, _) : g(0, _ + 1); case x: var A = this.$locale().weekStart || 0, V = (w < A ? w + 7 : w) - A; return g(o ? F - V : F + (6 - V), _); case p: case D: return v(H + "Hours", 0); case $: return v(H + "Minutes", 1); case y: return v(H + "Seconds", 2); case f: return v(H + "Milliseconds", 3); default: return this.clone(); } }, i.endOf = function(t) { return this.startOf(t, !1); }, i.$set = function(t, r) { var n, o = h.p(t), s = "set" + (this.$u ? "UTC" : ""), g = (n = {}, n[p] = s + "Date", n[D] = s + "Date", n[M] = s + "Month", n[b] = s + "FullYear", n[$] = s + "Hours", n[y] = s + "Minutes", n[f] = s + "Seconds", n[l] = s + "Milliseconds", n)[o], v = o === p ? this.$D + (r - this.$W) : r; if (o === M || o === b) { var w = this.clone().set(D, 1); w.$d[g](v), w.init(), this.$d = w.set(D, Math.min(this.$D, w.daysInMonth())).$d; } else g && this.$d[g](v); return this.init(), this; }, i.set = function(t, r) { return this.clone().$set(t, r); }, i.get = function(t) { return this[h.p(t)](); }, i.add = function(t, r) { var n, o = this; t = Number(t); var s = h.p(r), g = function(_) { var F = T(o); return h.w(F.date(F.date() + Math.round(_ * t)), o); }; if (s === M) return this.set(M, this.$M + t); if (s === b) return this.set(b, this.$y + t); if (s === p) return g(1); if (s === x) return g(7); var v = (n = {}, n[y] = c, n[$] = m, n[f] = a, n)[s] || 1, w = this.$d.getTime() + t * v; return h.w(w, this); }, i.subtract = function(t, r) { return this.add(-1 * t, r); }, i.format = function(t) { var r = this, n = this.$locale(); if (!this.isValid()) return n.invalidDate || Y; var o = t || "YYYY-MM-DDTHH:mm:ssZ", s = h.z(this), g = this.$H, v = this.$m, w = this.$M, _ = n.weekdays, F = n.months, H = n.meridiem, A = function(L, N, Z, G) { return L && (L[N] || L(r, o)) || Z[N].slice(0, G); }, V = function(L) { return h.s(g % 12 || 12, L, "0"); }, U = H || function(L, N, Z) { var G = L < 12 ? "AM" : "PM"; return Z ? G.toLowerCase() : G; }; return o.replace(B, function(L, N) { return N || function(Z) { switch (Z) { case "YY": return String(r.$y).slice(-2); case "YYYY": return h.s(r.$y, 4, "0"); case "M": return w + 1; case "MM": return h.s(w + 1, 2, "0"); case "MMM": return A(n.monthsShort, w, F, 3); case "MMMM": return A(F, w); case "D": return r.$D; case "DD": return h.s(r.$D, 2, "0"); case "d": return String(r.$W); case "dd": return A(n.weekdaysMin, r.$W, _, 2); case "ddd": return A(n.weekdaysShort, r.$W, _, 3); case "dddd": return _[r.$W]; case "H": return String(g); case "HH": return h.s(g, 2, "0"); case "h": return V(1); case "hh": return V(2); case "a": return U(g, v, !0); case "A": return U(g, v, !1); case "m": return String(v); case "mm": return h.s(v, 2, "0"); case "s": return String(r.$s); case "ss": return h.s(r.$s, 2, "0"); case "SSS": return h.s(r.$ms, 3, "0"); case "Z": return s; } return null; }(L) || s.replace(":", ""); }); }, i.utcOffset = function() { return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); }, i.diff = function(t, r, n) { var o, s = this, g = h.p(r), v = T(t), w = (v.utcOffset() - this.utcOffset()) * c, _ = this - v, F = function() { return h.m(s, v); }; switch (g) { case b: o = F() / 12; break; case M: o = F(); break; case I: o = F() / 3; break; case x: o = (_ - w) / 6048e5; break; case p: o = (_ - w) / 864e5; break; case $: o = _ / m; break; case y: o = _ / c; break; case f: o = _ / a; break; default: o = _; } return n ? o : h.a(o); }, i.daysInMonth = function() { return this.endOf(M).$D; }, i.$locale = function() { return O[this.$L]; }, i.locale = function(t, r) { if (!t) return this.$L; var n = this.clone(), o = q(t, r, !0); return o && (n.$L = o), n; }, i.clone = function() { return h.w(this.$d, this); }, i.toDate = function() { return new Date(this.valueOf()); }, i.toJSON = function() { return this.isValid() ? this.toISOString() : null; }, i.toISOString = function() { return this.$d.toISOString(); }, i.toString = function() { return this.$d.toUTCString(); }, u; }(), K = z.prototype; return T.prototype = K, [["$ms", l], ["$s", f], ["$m", y], ["$H", $], ["$W", p], ["$M", M], ["$y", b], ["$D", D]].forEach(function(u) { K[u[1]] = function(i) { return this.$g(i, u[0], u[1]); }; }), T.extend = function(u, i) { return u.$i || (u(i, z, T), u.$i = !0), T; }, T.locale = q, T.isDayjs = k, T.unix = function(u) { return T(1e3 * u); }, T.en = O[S], T.Ls = O, T.p = {}, T; }); })(ie); var he = ie.exports; const R = /* @__PURE__ */ Q(he); var re = { exports: {} }; (function(e, d) { (function(a, c) { e.exports = c(); })(P, function() { return { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(a) { var c = ["th", "st", "nd", "rd"], m = a % 100; return "[" + a + (c[(m - 20) % 10] || c[m] || c[0]) + "]"; } }; }); })(re); var fe = re.exports; const me = /* @__PURE__ */ Q(fe); var ue = { exports: {} }; (function(e, d) { (function(a, c) { e.exports = c(); })(P, function() { return function(a, c, m) { a = a || {}; var l = c.prototype, f = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" }; function y(p, x, M, I) { return l.fromToBase(p, x, M, I); } m.en.relativeTime = f, l.fromToBase = function(p, x, M, I, b) { for (var D, Y, W, B = M.$locale().relativeTime || f, C = a.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], J = C.length, j = 0; j < J; j += 1) { var S = C[j]; S.d && (D = I ? m(p).diff(M, S.d, !0) : M.diff(p, S.d, !0)); var O = (a.rounding || Math.round)(Math.abs(D)); if (W = D > 0, O <= S.r || !S.r) { O <= 1 && j > 0 && (S = C[j - 1]); var E = B[S.l]; b && (O = b("" + O)), Y = typeof E == "string" ? E.replace("%d", O) : E(O, x, S.l, W); break; } } if (x) return Y; var k = W ? B.future : B.past; return typeof k == "function" ? k(Y) : k.replace("%s", Y); }, l.to = function(p, x) { return y(p, x, this, !0); }, l.from = function(p, x) { return y(p, x, this); }; var $ = function(p) { return p.$u ? m.utc() : m(); }; l.toNow = function(p) { return this.to($(this), p); }, l.fromNow = function(p) { return this.from($(this), p); }; }; }); })(ue); var pe = ue.exports; const ge = /* @__PURE__ */ Q(pe); var oe = { exports: {} }; (function(e, d) { (function(a, c) { e.exports = c(); })(P, function() { return function(a, c, m) { m.updateLocale = function(l, f) { var y = m.Ls[l]; if (y) return (f ? Object.keys(f) : []).forEach(function($) { y[$] = f[$]; }), y; }; }; }); })(oe); var ye = oe.exports; const $e = /* @__PURE__ */ Q(ye); R.extend(ge); R.extend($e); const ve = { ...me, name: "en-web3-modal", relativeTime: { future: "in %s", past: "%s ago", s: "%d sec", m: "1 min", mm: "%d min", h: "1 hr", hh: "%d hrs", d: "1 d", dd: "%d d", M: "1 mo", MM: "%d mo", y: "1 yr", yy: "%d yr" } }, Me = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; R.locale("en-web3-modal", ve); const te = { getMonthNameByIndex(e) { return Me[e]; }, getYear(e = (/* @__PURE__ */ new Date()).toISOString()) { return R(e).year(); }, getRelativeDateFromNow(e) { return R(e).locale("en-web3-modal").fromNow(!0); }, formatDate(e, d = "DD MMM") { return R(e).format(d); } }, Te = 3, we = ["receive", "deposit", "borrow", "claim"], xe = ["withdraw", "repay", "burn"], ne = { getTransactionGroupTitle(e, d) { const a = te.getYear(), c = te.getMonthNameByIndex(d); return e === a ? c : `${c} ${e}`; }, getTransactionImages(e) { const [d, a] = e, c = !!d && (e == null ? void 0 : e.every((f) => !!f.nft_info)), m = (e == null ? void 0 : e.length) > 1; return (e == null ? void 0 : e.length) === 2 && !c ? [this.getTransactionImage(d), this.getTransactionImage(a)] : m ? e.map((f) => this.getTransactionImage(f)) : [this.getTransactionImage(d)]; }, getTransactionImage(e) { return { type: ne.getTransactionTransferTokenType(e), url: ne.getTransactionImageURL(e) }; }, getTransactionImageURL(e) { var m, l, f, y, $; let d; const a = !!(e != null && e.nft_info), c = !!(e != null && e.fungible_info); return e && a ? d = (f = (l = (m = e == null ? void 0 : e.nft_info) == null ? void 0 : m.content) == null ? void 0 : l.preview) == null ? void 0 : f.url : e && c && (d = ($ = (y = e == null ? void 0 : e.fungible_info) == null ? void 0 : y.icon) == null ? void 0 : $.url), d; }, getTransactionTransferTokenType(e) { if (e != null && e.fungible_info) return "FUNGIBLE"; if (e != null && e.nft_info) return "NFT"; }, getTransactionDescriptions(e) { var M, I, b; const d = (M = e == null ? void 0 : e.metadata) == null ? void 0 : M.operationType, a = e == null ? void 0 : e.transfers, c = ((I = e == null ? void 0 : e.transfers) == null ? void 0 : I.length) > 0, m = ((b = e == null ? void 0 : e.transfers) == null ? void 0 : b.length) > 1, l = c && (a == null ? void 0 : a.every((D) => !!(D != null && D.fungible_info))), [f, y] = a; let $ = this.getTransferDescription(f), p = this.getTransferDescription(y); if (!c) return (d === "send" || d === "receive") && l ? ($ = ee.getTruncateString({ string: e == null ? void 0 : e.metadata.sentFrom, charsStart: 4, charsEnd: 6, truncate: "middle" }), p = ee.getTruncateString({ string: e == null ? void 0 : e.metadata.sentTo, charsStart: 4, charsEnd: 6, truncate: "middle" }), [$, p]) : [e.metadata.status]; if (m) return a.map((D) => this.getTransferDescription(D)); let x = ""; return we.includes(d) ? x = "+" : xe.includes(d) && (x = "-"), $ = x.concat($), [$]; }, getTransferDescription(e) { var a; let d = ""; return e && (e != null && e.nft_info ? d = ((a = e == null ? void 0 : e.nft_info) == null ? void 0 : a.name) || "-" : e != null && e.fungible_info && (d = this.getFungibleTransferDescription(e) || "-")), d; }, getFungibleTransferDescription(e) { var c; return e ? [this.getQuantityFixedValue(e == null ? void 0 : e.quantity.numeric), (c = e == null ? void 0 : e.fungible_info) == null ? void 0 : c.symbol].join(" ").trim() : null; }, getQuantityFixedValue(e) { return e ? parseFloat(e).toFixed(Te) : null; } }, De = ae` :host > wui-flex:first-child { column-gap: var(--wui-spacing-s); padding: 7px var(--wui-spacing-l) 7px var(--wui-spacing-xs); width: 100%; } wui-flex { display: flex; flex: 1; } `; var _e = function(e, d, a, c) { var m = arguments.length, l = m < 3 ? d : c === null ? c = Object.getOwnPropertyDescriptor(d, a) : c, f; if (typeof Reflect == "object" && typeof Reflect.decorate == "function") l = Reflect.decorate(e, d, a, c); else for (var y = e.length - 1; y >= 0; y--) (f = e[y]) && (l = (m < 3 ? f(l) : m > 3 ? f(d, a, l) : f(d, a)) || l); return m > 3 && l && Object.defineProperty(d, a, l), l; }; let X = class extends de { render() { return le` <wui-flex alignItems="center"> <wui-shimmer width="40px" height="40px"></wui-shimmer> <wui-flex flexDirection="column" gap="2xs"> <wui-shimmer width="72px" height="16px" borderRadius="4xs"></wui-shimmer> <wui-shimmer width="148px" height="14px" borderRadius="4xs"></wui-shimmer> </wui-flex> <wui-shimmer width="24px" height="12px" borderRadius="5xs"></wui-shimmer> </wui-flex> `; } }; X.styles = [ce, De]; X = _e([ se("wui-transaction-list-item-loader") ], X); export { te as D, ne as T }; //# sourceMappingURL=index-DhDR0x0s.js.map