diff options
Diffstat (limited to 'backoffice/index.js')
-rw-r--r-- | backoffice/index.js | 4624 |
1 files changed, 3004 insertions, 1620 deletions
diff --git a/backoffice/index.js b/backoffice/index.js index 39513f588..ed5d62ef6 100644 --- a/backoffice/index.js +++ b/backoffice/index.js @@ -6775,473 +6775,6 @@ var require_qrcode = __commonJS({ } }); -// ../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/dist/preact.module.js -var n; -var l; -var u; -var i; -var t; -var o; -var r; -var f = {}; -var e = []; -var c = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i; -function s(n2, l3) { - for (var u4 in l3) - n2[u4] = l3[u4]; - return n2; -} -function a(n2) { - var l3 = n2.parentNode; - l3 && l3.removeChild(n2); -} -function h(l3, u4, i4) { - var t4, o3, r3, f3 = {}; - for (r3 in u4) - "key" == r3 ? t4 = u4[r3] : "ref" == r3 ? o3 = u4[r3] : f3[r3] = u4[r3]; - if (arguments.length > 2 && (f3.children = arguments.length > 3 ? n.call(arguments, 2) : i4), "function" == typeof l3 && null != l3.defaultProps) - for (r3 in l3.defaultProps) - void 0 === f3[r3] && (f3[r3] = l3.defaultProps[r3]); - return v(l3, f3, t4, o3, null); -} -function v(n2, i4, t4, o3, r3) { - var f3 = { type: n2, props: i4, key: t4, ref: o3, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: null == r3 ? ++u : r3 }; - return null == r3 && null != l.vnode && l.vnode(f3), f3; -} -function p(n2) { - return n2.children; -} -function d(n2, l3) { - this.props = n2, this.context = l3; -} -function _(n2, l3) { - if (null == l3) - return n2.__ ? _(n2.__, n2.__.__k.indexOf(n2) + 1) : null; - for (var u4; l3 < n2.__k.length; l3++) - if (null != (u4 = n2.__k[l3]) && null != u4.__e) - return u4.__e; - return "function" == typeof n2.type ? _(n2) : null; -} -function k(n2) { - var l3, u4; - if (null != (n2 = n2.__) && null != n2.__c) { - for (n2.__e = n2.__c.base = null, l3 = 0; l3 < n2.__k.length; l3++) - if (null != (u4 = n2.__k[l3]) && null != u4.__e) { - n2.__e = n2.__c.base = u4.__e; - break; - } - return k(n2); - } -} -function b(n2) { - (!n2.__d && (n2.__d = true) && t.push(n2) && !g.__r++ || o !== l.debounceRendering) && ((o = l.debounceRendering) || setTimeout)(g); -} -function g() { - for (var n2; g.__r = t.length; ) - n2 = t.sort(function(n3, l3) { - return n3.__v.__b - l3.__v.__b; - }), t = [], n2.some(function(n3) { - var l3, u4, i4, t4, o3, r3; - n3.__d && (o3 = (t4 = (l3 = n3).__v).__e, (r3 = l3.__P) && (u4 = [], (i4 = s({}, t4)).__v = t4.__v + 1, j(r3, t4, i4, l3.__n, void 0 !== r3.ownerSVGElement, null != t4.__h ? [o3] : null, u4, null == o3 ? _(t4) : o3, t4.__h), z(u4, t4), t4.__e != o3 && k(t4))); - }); -} -function w(n2, l3, u4, i4, t4, o3, r3, c4, s5, a5) { - var h5, y5, d5, k4, b4, g4, w5, x6 = i4 && i4.__k || e, C3 = x6.length; - for (u4.__k = [], h5 = 0; h5 < l3.length; h5++) - if (null != (k4 = u4.__k[h5] = null == (k4 = l3[h5]) || "boolean" == typeof k4 ? null : "string" == typeof k4 || "number" == typeof k4 || "bigint" == typeof k4 ? v(null, k4, null, null, k4) : Array.isArray(k4) ? v(p, { children: k4 }, null, null, null) : k4.__b > 0 ? v(k4.type, k4.props, k4.key, k4.ref ? k4.ref : null, k4.__v) : k4)) { - if (k4.__ = u4, k4.__b = u4.__b + 1, null === (d5 = x6[h5]) || d5 && k4.key == d5.key && k4.type === d5.type) - x6[h5] = void 0; - else - for (y5 = 0; y5 < C3; y5++) { - if ((d5 = x6[y5]) && k4.key == d5.key && k4.type === d5.type) { - x6[y5] = void 0; - break; - } - d5 = null; - } - j(n2, k4, d5 = d5 || f, t4, o3, r3, c4, s5, a5), b4 = k4.__e, (y5 = k4.ref) && d5.ref != y5 && (w5 || (w5 = []), d5.ref && w5.push(d5.ref, null, k4), w5.push(y5, k4.__c || b4, k4)), null != b4 ? (null == g4 && (g4 = b4), "function" == typeof k4.type && k4.__k === d5.__k ? k4.__d = s5 = m(k4, s5, n2) : s5 = A(n2, k4, d5, x6, b4, s5), "function" == typeof u4.type && (u4.__d = s5)) : s5 && d5.__e == s5 && s5.parentNode != n2 && (s5 = _(d5)); - } - for (u4.__e = g4, h5 = C3; h5--; ) - null != x6[h5] && N(x6[h5], x6[h5]); - if (w5) - for (h5 = 0; h5 < w5.length; h5++) - M(w5[h5], w5[++h5], w5[++h5]); -} -function m(n2, l3, u4) { - for (var i4, t4 = n2.__k, o3 = 0; t4 && o3 < t4.length; o3++) - (i4 = t4[o3]) && (i4.__ = n2, l3 = "function" == typeof i4.type ? m(i4, l3, u4) : A(u4, i4, i4, t4, i4.__e, l3)); - return l3; -} -function x(n2, l3) { - return l3 = l3 || [], null == n2 || "boolean" == typeof n2 || (Array.isArray(n2) ? n2.some(function(n3) { - x(n3, l3); - }) : l3.push(n2)), l3; -} -function A(n2, l3, u4, i4, t4, o3) { - var r3, f3, e4; - if (void 0 !== l3.__d) - r3 = l3.__d, l3.__d = void 0; - else if (null == u4 || t4 != o3 || null == t4.parentNode) - n: - if (null == o3 || o3.parentNode !== n2) - n2.appendChild(t4), r3 = null; - else { - for (f3 = o3, e4 = 0; (f3 = f3.nextSibling) && e4 < i4.length; e4 += 1) - if (f3 == t4) - break n; - n2.insertBefore(t4, o3), r3 = o3; - } - return void 0 !== r3 ? r3 : t4.nextSibling; -} -function C(n2, l3, u4, i4, t4) { - var o3; - for (o3 in u4) - "children" === o3 || "key" === o3 || o3 in l3 || H(n2, o3, null, u4[o3], i4); - for (o3 in l3) - t4 && "function" != typeof l3[o3] || "children" === o3 || "key" === o3 || "value" === o3 || "checked" === o3 || u4[o3] === l3[o3] || H(n2, o3, l3[o3], u4[o3], i4); -} -function $(n2, l3, u4) { - "-" === l3[0] ? n2.setProperty(l3, u4) : n2[l3] = null == u4 ? "" : "number" != typeof u4 || c.test(l3) ? u4 : u4 + "px"; -} -function H(n2, l3, u4, i4, t4) { - var o3; - n: - if ("style" === l3) - if ("string" == typeof u4) - n2.style.cssText = u4; - else { - if ("string" == typeof i4 && (n2.style.cssText = i4 = ""), i4) - for (l3 in i4) - u4 && l3 in u4 || $(n2.style, l3, ""); - if (u4) - for (l3 in u4) - i4 && u4[l3] === i4[l3] || $(n2.style, l3, u4[l3]); - } - else if ("o" === l3[0] && "n" === l3[1]) - o3 = l3 !== (l3 = l3.replace(/Capture$/, "")), l3 = l3.toLowerCase() in n2 ? l3.toLowerCase().slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + o3] = u4, u4 ? i4 || n2.addEventListener(l3, o3 ? T : I, o3) : n2.removeEventListener(l3, o3 ? T : I, o3); - else if ("dangerouslySetInnerHTML" !== l3) { - if (t4) - l3 = l3.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); - else if ("href" !== l3 && "list" !== l3 && "form" !== l3 && "tabIndex" !== l3 && "download" !== l3 && l3 in n2) - try { - n2[l3] = null == u4 ? "" : u4; - break n; - } catch (n3) { - } - "function" == typeof u4 || (null == u4 || false === u4 && -1 == l3.indexOf("-") ? n2.removeAttribute(l3) : n2.setAttribute(l3, u4)); - } -} -function I(n2) { - this.l[n2.type + false](l.event ? l.event(n2) : n2); -} -function T(n2) { - this.l[n2.type + true](l.event ? l.event(n2) : n2); -} -function j(n2, u4, i4, t4, o3, r3, f3, e4, c4) { - var a5, h5, v3, y5, _3, k4, b4, g4, m5, x6, A4, C3, $2, H5, I5, T5 = u4.type; - if (void 0 !== u4.constructor) - return null; - null != i4.__h && (c4 = i4.__h, e4 = u4.__e = i4.__e, u4.__h = null, r3 = [e4]), (a5 = l.__b) && a5(u4); - try { - n: - if ("function" == typeof T5) { - if (g4 = u4.props, m5 = (a5 = T5.contextType) && t4[a5.__c], x6 = a5 ? m5 ? m5.props.value : a5.__ : t4, i4.__c ? b4 = (h5 = u4.__c = i4.__c).__ = h5.__E : ("prototype" in T5 && T5.prototype.render ? u4.__c = h5 = new T5(g4, x6) : (u4.__c = h5 = new d(g4, x6), h5.constructor = T5, h5.render = O), m5 && m5.sub(h5), h5.props = g4, h5.state || (h5.state = {}), h5.context = x6, h5.__n = t4, v3 = h5.__d = true, h5.__h = [], h5._sb = []), null == h5.__s && (h5.__s = h5.state), null != T5.getDerivedStateFromProps && (h5.__s == h5.state && (h5.__s = s({}, h5.__s)), s(h5.__s, T5.getDerivedStateFromProps(g4, h5.__s))), y5 = h5.props, _3 = h5.state, v3) - null == T5.getDerivedStateFromProps && null != h5.componentWillMount && h5.componentWillMount(), null != h5.componentDidMount && h5.__h.push(h5.componentDidMount); - else { - if (null == T5.getDerivedStateFromProps && g4 !== y5 && null != h5.componentWillReceiveProps && h5.componentWillReceiveProps(g4, x6), !h5.__e && null != h5.shouldComponentUpdate && false === h5.shouldComponentUpdate(g4, h5.__s, x6) || u4.__v === i4.__v) { - for (h5.props = g4, h5.state = h5.__s, u4.__v !== i4.__v && (h5.__d = false), h5.__v = u4, u4.__e = i4.__e, u4.__k = i4.__k, u4.__k.forEach(function(n3) { - n3 && (n3.__ = u4); - }), A4 = 0; A4 < h5._sb.length; A4++) - h5.__h.push(h5._sb[A4]); - h5._sb = [], h5.__h.length && f3.push(h5); - break n; - } - null != h5.componentWillUpdate && h5.componentWillUpdate(g4, h5.__s, x6), null != h5.componentDidUpdate && h5.__h.push(function() { - h5.componentDidUpdate(y5, _3, k4); - }); - } - if (h5.context = x6, h5.props = g4, h5.__v = u4, h5.__P = n2, C3 = l.__r, $2 = 0, "prototype" in T5 && T5.prototype.render) { - for (h5.state = h5.__s, h5.__d = false, C3 && C3(u4), a5 = h5.render(h5.props, h5.state, h5.context), H5 = 0; H5 < h5._sb.length; H5++) - h5.__h.push(h5._sb[H5]); - h5._sb = []; - } else - do { - h5.__d = false, C3 && C3(u4), a5 = h5.render(h5.props, h5.state, h5.context), h5.state = h5.__s; - } while (h5.__d && ++$2 < 25); - h5.state = h5.__s, null != h5.getChildContext && (t4 = s(s({}, t4), h5.getChildContext())), v3 || null == h5.getSnapshotBeforeUpdate || (k4 = h5.getSnapshotBeforeUpdate(y5, _3)), I5 = null != a5 && a5.type === p && null == a5.key ? a5.props.children : a5, w(n2, Array.isArray(I5) ? I5 : [I5], u4, i4, t4, o3, r3, f3, e4, c4), h5.base = u4.__e, u4.__h = null, h5.__h.length && f3.push(h5), b4 && (h5.__E = h5.__ = null), h5.__e = false; - } else - null == r3 && u4.__v === i4.__v ? (u4.__k = i4.__k, u4.__e = i4.__e) : u4.__e = L(i4.__e, u4, i4, t4, o3, r3, f3, c4); - (a5 = l.diffed) && a5(u4); - } catch (n3) { - u4.__v = null, (c4 || null != r3) && (u4.__e = e4, u4.__h = !!c4, r3[r3.indexOf(e4)] = null), l.__e(n3, u4, i4); - } -} -function z(n2, u4) { - l.__c && l.__c(u4, n2), n2.some(function(u5) { - try { - n2 = u5.__h, u5.__h = [], n2.some(function(n3) { - n3.call(u5); - }); - } catch (n3) { - l.__e(n3, u5.__v); - } - }); -} -function L(l3, u4, i4, t4, o3, r3, e4, c4) { - var s5, h5, v3, y5 = i4.props, p4 = u4.props, d5 = u4.type, k4 = 0; - if ("svg" === d5 && (o3 = true), null != r3) { - for (; k4 < r3.length; k4++) - if ((s5 = r3[k4]) && "setAttribute" in s5 == !!d5 && (d5 ? s5.localName === d5 : 3 === s5.nodeType)) { - l3 = s5, r3[k4] = null; - break; - } - } - if (null == l3) { - if (null === d5) - return document.createTextNode(p4); - l3 = o3 ? document.createElementNS("http://www.w3.org/2000/svg", d5) : document.createElement(d5, p4.is && p4), r3 = null, c4 = false; - } - if (null === d5) - y5 === p4 || c4 && l3.data === p4 || (l3.data = p4); - else { - if (r3 = r3 && n.call(l3.childNodes), h5 = (y5 = i4.props || f).dangerouslySetInnerHTML, v3 = p4.dangerouslySetInnerHTML, !c4) { - if (null != r3) - for (y5 = {}, k4 = 0; k4 < l3.attributes.length; k4++) - y5[l3.attributes[k4].name] = l3.attributes[k4].value; - (v3 || h5) && (v3 && (h5 && v3.__html == h5.__html || v3.__html === l3.innerHTML) || (l3.innerHTML = v3 && v3.__html || "")); - } - if (C(l3, p4, y5, o3, c4), v3) - u4.__k = []; - else if (k4 = u4.props.children, w(l3, Array.isArray(k4) ? k4 : [k4], u4, i4, t4, o3 && "foreignObject" !== d5, r3, e4, r3 ? r3[0] : i4.__k && _(i4, 0), c4), null != r3) - for (k4 = r3.length; k4--; ) - null != r3[k4] && a(r3[k4]); - c4 || ("value" in p4 && void 0 !== (k4 = p4.value) && (k4 !== l3.value || "progress" === d5 && !k4 || "option" === d5 && k4 !== y5.value) && H(l3, "value", k4, y5.value, false), "checked" in p4 && void 0 !== (k4 = p4.checked) && k4 !== l3.checked && H(l3, "checked", k4, y5.checked, false)); - } - return l3; -} -function M(n2, u4, i4) { - try { - "function" == typeof n2 ? n2(u4) : n2.current = u4; - } catch (n3) { - l.__e(n3, i4); - } -} -function N(n2, u4, i4) { - var t4, o3; - if (l.unmount && l.unmount(n2), (t4 = n2.ref) && (t4.current && t4.current !== n2.__e || M(t4, null, u4)), null != (t4 = n2.__c)) { - if (t4.componentWillUnmount) - try { - t4.componentWillUnmount(); - } catch (n3) { - l.__e(n3, u4); - } - t4.base = t4.__P = null, n2.__c = void 0; - } - if (t4 = n2.__k) - for (o3 = 0; o3 < t4.length; o3++) - t4[o3] && N(t4[o3], u4, i4 || "function" != typeof n2.type); - i4 || null == n2.__e || a(n2.__e), n2.__ = n2.__e = n2.__d = void 0; -} -function O(n2, l3, u4) { - return this.constructor(n2, u4); -} -function P(u4, i4, t4) { - var o3, r3, e4; - l.__ && l.__(u4, i4), r3 = (o3 = "function" == typeof t4) ? null : t4 && t4.__k || i4.__k, e4 = [], j(i4, u4 = (!o3 && t4 || i4).__k = h(p, null, [u4]), r3 || f, f, void 0 !== i4.ownerSVGElement, !o3 && t4 ? [t4] : r3 ? null : i4.firstChild ? n.call(i4.childNodes) : null, e4, !o3 && t4 ? t4 : r3 ? r3.__e : i4.firstChild, o3), z(e4, u4); -} -function q(l3, u4, i4) { - var t4, o3, r3, f3 = s({}, l3.props); - for (r3 in u4) - "key" == r3 ? t4 = u4[r3] : "ref" == r3 ? o3 = u4[r3] : f3[r3] = u4[r3]; - return arguments.length > 2 && (f3.children = arguments.length > 3 ? n.call(arguments, 2) : i4), v(l3.type, f3, t4 || l3.key, o3 || l3.ref, null); -} -function B(n2, l3) { - var u4 = { __c: l3 = "__cC" + r++, __: n2, Consumer: function(n3, l4) { - return n3.children(l4); - }, Provider: function(n3) { - var u5, i4; - return this.getChildContext || (u5 = [], (i4 = {})[l3] = this, this.getChildContext = function() { - return i4; - }, this.shouldComponentUpdate = function(n4) { - this.props.value !== n4.value && u5.some(b); - }, this.sub = function(n4) { - u5.push(n4); - var l4 = n4.componentWillUnmount; - n4.componentWillUnmount = function() { - u5.splice(u5.indexOf(n4), 1), l4 && l4.call(n4); - }; - }), n3.children; - } }; - return u4.Provider.__ = u4.Consumer.contextType = u4; -} -n = e.slice, l = { __e: function(n2, l3, u4, i4) { - for (var t4, o3, r3; l3 = l3.__; ) - if ((t4 = l3.__c) && !t4.__) - try { - if ((o3 = t4.constructor) && null != o3.getDerivedStateFromError && (t4.setState(o3.getDerivedStateFromError(n2)), r3 = t4.__d), null != t4.componentDidCatch && (t4.componentDidCatch(n2, i4 || {}), r3 = t4.__d), r3) - return t4.__E = t4; - } catch (l4) { - n2 = l4; - } - throw n2; -} }, u = 0, i = function(n2) { - return null != n2 && void 0 === n2.constructor; -}, d.prototype.setState = function(n2, l3) { - var u4; - u4 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = s({}, this.state), "function" == typeof n2 && (n2 = n2(s({}, u4), this.props)), n2 && s(u4, n2), null != n2 && this.__v && (l3 && this._sb.push(l3), b(this)); -}, d.prototype.forceUpdate = function(n2) { - this.__v && (this.__e = true, n2 && this.__h.push(n2), b(this)); -}, d.prototype.render = p, t = [], g.__r = 0, r = 0; - -// ../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/hooks/dist/hooks.module.js -var t2; -var r2; -var u2; -var i2; -var o2 = 0; -var f2 = []; -var c2 = []; -var e2 = l.__b; -var a2 = l.__r; -var v2 = l.diffed; -var l2 = l.__c; -var m2 = l.unmount; -function d2(t4, u4) { - l.__h && l.__h(r2, t4, o2 || u4), o2 = 0; - var i4 = r2.__H || (r2.__H = { __: [], __h: [] }); - return t4 >= i4.__.length && i4.__.push({ __V: c2 }), i4.__[t4]; -} -function p2(n2) { - return o2 = 1, y(B2, n2); -} -function y(n2, u4, i4) { - var o3 = d2(t2++, 2); - if (o3.t = n2, !o3.__c && (o3.__ = [i4 ? i4(u4) : B2(void 0, u4), function(n3) { - var t4 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t4, n3); - t4 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({})); - }], o3.__c = r2, !r2.u)) { - r2.u = true; - var f3 = r2.shouldComponentUpdate; - r2.shouldComponentUpdate = function(n3, t4, r3) { - if (!o3.__c.__H) - return true; - var u5 = o3.__c.__H.__.filter(function(n4) { - return n4.__c; - }); - if (u5.every(function(n4) { - return !n4.__N; - })) - return !f3 || f3.call(this, n3, t4, r3); - var i5 = false; - return u5.forEach(function(n4) { - if (n4.__N) { - var t5 = n4.__[0]; - n4.__ = n4.__N, n4.__N = void 0, t5 !== n4.__[0] && (i5 = true); - } - }), !(!i5 && o3.__c.props === n3) && (!f3 || f3.call(this, n3, t4, r3)); - }; - } - return o3.__N || o3.__; -} -function h2(u4, i4) { - var o3 = d2(t2++, 3); - !l.__s && z2(o3.__H, i4) && (o3.__ = u4, o3.i = i4, r2.__H.__h.push(o3)); -} -function s2(u4, i4) { - var o3 = d2(t2++, 4); - !l.__s && z2(o3.__H, i4) && (o3.__ = u4, o3.i = i4, r2.__h.push(o3)); -} -function _2(n2) { - return o2 = 5, F(function() { - return { current: n2 }; - }, []); -} -function F(n2, r3) { - var u4 = d2(t2++, 7); - return z2(u4.__H, r3) ? (u4.__V = n2(), u4.i = r3, u4.__h = n2, u4.__V) : u4.__; -} -function T2(n2, t4) { - return o2 = 8, F(function() { - return n2; - }, t4); -} -function q2(n2) { - var u4 = r2.context[n2.__c], i4 = d2(t2++, 9); - return i4.c = n2, u4 ? (null == i4.__ && (i4.__ = true, u4.sub(r2)), u4.props.value) : n2.__; -} -function x2(t4, r3) { - l.useDebugValue && l.useDebugValue(r3 ? r3(t4) : t4); -} -function b2() { - for (var t4; t4 = f2.shift(); ) - if (t4.__P && t4.__H) - try { - t4.__H.__h.forEach(k2), t4.__H.__h.forEach(w2), t4.__H.__h = []; - } catch (r3) { - t4.__H.__h = [], l.__e(r3, t4.__v); - } -} -l.__b = function(n2) { - r2 = null, e2 && e2(n2); -}, l.__r = function(n2) { - a2 && a2(n2), t2 = 0; - var i4 = (r2 = n2.__c).__H; - i4 && (u2 === r2 ? (i4.__h = [], r2.__h = [], i4.__.forEach(function(n3) { - n3.__N && (n3.__ = n3.__N), n3.__V = c2, n3.__N = n3.i = void 0; - })) : (i4.__h.forEach(k2), i4.__h.forEach(w2), i4.__h = [])), u2 = r2; -}, l.diffed = function(t4) { - v2 && v2(t4); - var o3 = t4.__c; - o3 && o3.__H && (o3.__H.__h.length && (1 !== f2.push(o3) && i2 === l.requestAnimationFrame || ((i2 = l.requestAnimationFrame) || j2)(b2)), o3.__H.__.forEach(function(n2) { - n2.i && (n2.__H = n2.i), n2.__V !== c2 && (n2.__ = n2.__V), n2.i = void 0, n2.__V = c2; - })), u2 = r2 = null; -}, l.__c = function(t4, r3) { - r3.some(function(t5) { - try { - t5.__h.forEach(k2), t5.__h = t5.__h.filter(function(n2) { - return !n2.__ || w2(n2); - }); - } catch (u4) { - r3.some(function(n2) { - n2.__h && (n2.__h = []); - }), r3 = [], l.__e(u4, t5.__v); - } - }), l2 && l2(t4, r3); -}, l.unmount = function(t4) { - m2 && m2(t4); - var r3, u4 = t4.__c; - u4 && u4.__H && (u4.__H.__.forEach(function(n2) { - try { - k2(n2); - } catch (n3) { - r3 = n3; - } - }), u4.__H = void 0, r3 && l.__e(r3, u4.__v)); -}; -var g2 = "function" == typeof requestAnimationFrame; -function j2(n2) { - var t4, r3 = function() { - clearTimeout(u4), g2 && cancelAnimationFrame(t4), setTimeout(n2); - }, u4 = setTimeout(r3, 100); - g2 && (t4 = requestAnimationFrame(r3)); -} -function k2(n2) { - var t4 = r2, u4 = n2.__c; - "function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t4; -} -function w2(n2) { - var t4 = r2; - n2.__c = n2.__(), r2 = t4; -} -function z2(n2, t4) { - return !n2 || n2.length !== t4.length || t4.some(function(t5, r3) { - return t5 !== n2[r3]; - }); -} -function B2(n2, t4) { - return "function" == typeof t4 ? t4(n2) : t4; -} - // ../taler-util/lib/nacl-fast.js var gf = function(init = []) { const r3 = new Float64Array(16); @@ -7330,7 +6863,7 @@ var Y = gf([ 26214, 26214 ]); -var I2 = gf([ +var I = gf([ 41136, 18958, 6951, @@ -7449,7 +6982,7 @@ function unpack25519(o3, n2) { o3[i4] = n2[2 * i4] + (n2[2 * i4 + 1] << 8); o3[15] &= 32767; } -function A2(o3, a5, b4) { +function A(o3, a5, b4) { for (let i4 = 0; i4 < 16; i4++) o3[i4] = a5[i4] + b4[i4]; } @@ -7457,7 +6990,7 @@ function Z(o3, a5, b4) { for (let i4 = 0; i4 < 16; i4++) o3[i4] = a5[i4] - b4[i4]; } -function M2(o3, a5, b4) { +function M(o3, a5, b4) { let v3, c4, t0 = 0, t1 = 0, t22 = 0, t32 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t222 = 0, t23 = 0, t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0; const b0 = b4[0], b1 = b4[1], b22 = b4[2], b32 = b4[3], b42 = b4[4], b5 = b4[5], b6 = b4[6], b7 = b4[7], b8 = b4[8], b9 = b4[9], b10 = b4[10], b11 = b4[11], b12 = b4[12], b13 = b4[13], b14 = b4[14], b15 = b4[15]; v3 = a5[0]; @@ -7865,7 +7398,7 @@ function M2(o3, a5, b4) { o3[15] = t15; } function S(o3, a5) { - M2(o3, a5, a5); + M(o3, a5, a5); } function inv25519(o3, i4) { const c4 = gf(); @@ -7875,7 +7408,7 @@ function inv25519(o3, i4) { for (a5 = 253; a5 >= 0; a5--) { S(c4, c4); if (a5 !== 2 && a5 !== 4) - M2(c4, c4, i4); + M(c4, c4, i4); } for (a5 = 0; a5 < 16; a5++) o3[a5] = c4[a5]; @@ -7888,7 +7421,7 @@ function pow2523(o3, i4) { for (a5 = 250; a5 >= 0; a5--) { S(c4, c4); if (a5 !== 1) - M2(c4, c4, i4); + M(c4, c4, i4); } for (a5 = 0; a5 < 16; a5++) o3[a5] = c4[a5]; @@ -8454,22 +7987,22 @@ function add(p4, q4) { const a5 = gf(), b4 = gf(), c4 = gf(), d5 = gf(), e4 = gf(), f3 = gf(), g4 = gf(), h5 = gf(), t4 = gf(); Z(a5, p4[1], p4[0]); Z(t4, q4[1], q4[0]); - M2(a5, a5, t4); - A2(b4, p4[0], p4[1]); - A2(t4, q4[0], q4[1]); - M2(b4, b4, t4); - M2(c4, p4[3], q4[3]); - M2(c4, c4, D2); - M2(d5, p4[2], q4[2]); - A2(d5, d5, d5); + M(a5, a5, t4); + A(b4, p4[0], p4[1]); + A(t4, q4[0], q4[1]); + M(b4, b4, t4); + M(c4, p4[3], q4[3]); + M(c4, c4, D2); + M(d5, p4[2], q4[2]); + A(d5, d5, d5); Z(e4, b4, a5); Z(f3, d5, c4); - A2(g4, d5, c4); - A2(h5, b4, a5); - M2(p4[0], e4, f3); - M2(p4[1], h5, g4); - M2(p4[2], g4, f3); - M2(p4[3], e4, h5); + A(g4, d5, c4); + A(h5, b4, a5); + M(p4[0], e4, f3); + M(p4[1], h5, g4); + M(p4[2], g4, f3); + M(p4[3], e4, h5); } function cswap(p4, q4, b4) { let i4; @@ -8480,8 +8013,8 @@ function cswap(p4, q4, b4) { function pack(r3, p4) { const tx = gf(), ty = gf(), zi = gf(); inv25519(zi, p4[2]); - M2(tx, p4[0], zi); - M2(ty, p4[1], zi); + M(tx, p4[0], zi); + M(ty, p4[1], zi); pack25519(r3, ty); r3[31] ^= par25519(tx) << 7; } @@ -8504,10 +8037,10 @@ function scalarbase(p4, s5) { set25519(q4[0], X); set25519(q4[1], Y); set25519(q4[2], gf1); - M2(q4[3], X, Y); + M(q4[3], X, Y); scalarmult(p4, q4, s5); } -var L2 = new Float64Array([ +var L = new Float64Array([ 237, 211, 245, @@ -8546,7 +8079,7 @@ function modL(r3, x6) { for (i4 = 63; i4 >= 32; --i4) { carry = 0; for (j3 = i4 - 32, k4 = i4 - 12; j3 < k4; ++j3) { - x6[j3] += carry - 16 * x6[i4] * L2[j3 - (i4 - 32)]; + x6[j3] += carry - 16 * x6[i4] * L[j3 - (i4 - 32)]; carry = Math.floor((x6[j3] + 128) / 256); x6[j3] -= carry * 256; } @@ -8555,12 +8088,12 @@ function modL(r3, x6) { } carry = 0; for (j3 = 0; j3 < 32; j3++) { - x6[j3] += carry - (x6[31] >> 4) * L2[j3]; + x6[j3] += carry - (x6[31] >> 4) * L[j3]; carry = x6[j3] >> 8; x6[j3] &= 255; } for (j3 = 0; j3 < 32; j3++) - x6[j3] -= carry * L2[j3]; + x6[j3] -= carry * L[j3]; for (i4 = 0; i4 < 32; i4++) { x6[i4 + 1] += x6[i4] >> 8; r3[i4] = x6[i4] & 255; @@ -8596,30 +8129,30 @@ function unpackneg(r3, p4) { set25519(r3[2], gf1); unpack25519(r3[1], p4); S(num, r3[1]); - M2(den, num, D); + M(den, num, D); Z(num, num, r3[2]); - A2(den, r3[2], den); + A(den, r3[2], den); S(den2, den); S(den4, den2); - M2(den6, den4, den2); - M2(t4, den6, num); - M2(t4, t4, den); + M(den6, den4, den2); + M(t4, den6, num); + M(t4, t4, den); pow2523(t4, t4); - M2(t4, t4, num); - M2(t4, t4, den); - M2(t4, t4, den); - M2(r3[0], t4, den); + M(t4, t4, num); + M(t4, t4, den); + M(t4, t4, den); + M(r3[0], t4, den); S(chk, r3[0]); - M2(chk, chk, den); + M(chk, chk, den); if (neq25519(chk, num)) - M2(r3[0], r3[0], I2); + M(r3[0], r3[0], I); S(chk, r3[0]); - M2(chk, chk, den); + M(chk, chk, den); if (neq25519(chk, num)) return -1; if (par25519(r3[0]) === p4[31] >> 7) Z(r3[0], gf0, r3[0]); - M2(r3[3], r3[0], r3[1]); + M(r3[3], r3[0], r3[1]); return 0; } function crypto_scalarmult_ed25519_base_noclamp(s5) { @@ -8883,6 +8416,11 @@ var TalerErrorCode; TalerErrorCode2[TalerErrorCode2["EXCHANGE_WITHDRAW_DENOMINATION_KEY_LOST"] = 1158] = "EXCHANGE_WITHDRAW_DENOMINATION_KEY_LOST"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_WITHDRAW_UNBLIND_FAILURE"] = 1159] = "EXCHANGE_WITHDRAW_UNBLIND_FAILURE"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_WITHDRAW_NONCE_REUSE"] = 1160] = "EXCHANGE_WITHDRAW_NONCE_REUSE"; + TalerErrorCode2[TalerErrorCode2["EXCHANGE_AGE_WITHDRAW_COMMITMENT_UNKNOWN"] = 1161] = "EXCHANGE_AGE_WITHDRAW_COMMITMENT_UNKNOWN"; + TalerErrorCode2[TalerErrorCode2["EXCHANGE_AGE_WITHDRAW_AMOUNT_OVERFLOW"] = 1162] = "EXCHANGE_AGE_WITHDRAW_AMOUNT_OVERFLOW"; + TalerErrorCode2[TalerErrorCode2["EXCHANGE_AGE_WITHDRAW_AMOUNT_INCORRECT"] = 1163] = "EXCHANGE_AGE_WITHDRAW_AMOUNT_INCORRECT"; + TalerErrorCode2[TalerErrorCode2["EXCHANGE_AGE_WITHDRAW_REVEAL_INVALID_HASH"] = 1164] = "EXCHANGE_AGE_WITHDRAW_REVEAL_INVALID_HASH"; + TalerErrorCode2[TalerErrorCode2["EXCHANGE_AGE_WITHDRAW_MAXIMUM_AGE_TOO_LARGE"] = 1165] = "EXCHANGE_AGE_WITHDRAW_MAXIMUM_AGE_TOO_LARGE"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_WITHDRAW_BATCH_IDEMPOTENT_PLANCHET"] = 1175] = "EXCHANGE_WITHDRAW_BATCH_IDEMPOTENT_PLANCHET"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSIT_COIN_SIGNATURE_INVALID"] = 1205] = "EXCHANGE_DEPOSIT_COIN_SIGNATURE_INVALID"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSIT_CONFLICTING_CONTRACT"] = 1206] = "EXCHANGE_DEPOSIT_CONFLICTING_CONTRACT"; @@ -8952,6 +8490,7 @@ var TalerErrorCode; TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_PURSE_FEE_TOO_LOW"] = 1678] = "EXCHANGE_RESERVES_PURSE_FEE_TOO_LOW"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_DELETE_ALREADY_DECIDED"] = 1679] = "EXCHANGE_PURSE_DELETE_ALREADY_DECIDED"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_DELETE_SIGNATURE_INVALID"] = 1680] = "EXCHANGE_PURSE_DELETE_SIGNATURE_INVALID"; + TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_AGE_RESTRICTION_REQUIRED"] = 1681] = "EXCHANGE_RESERVES_AGE_RESTRICTION_REQUIRED"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE"] = 1700] = "EXCHANGE_DENOMINATION_HELPER_UNAVAILABLE"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_DENOMINATION_HELPER_BUG"] = 1701] = "EXCHANGE_DENOMINATION_HELPER_BUG"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_DENOMINATION_HELPER_TOO_EARLY"] = 1702] = "EXCHANGE_DENOMINATION_HELPER_TOO_EARLY"; @@ -9035,6 +8574,7 @@ var TalerErrorCode; TalerErrorCode2[TalerErrorCode2["EXCHANGE_CONTRACTS_DECODING_FAILED"] = 1954] = "EXCHANGE_CONTRACTS_DECODING_FAILED"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_DEPOSIT_COIN_SIGNATURE_INVALID"] = 1975] = "EXCHANGE_PURSE_DEPOSIT_COIN_SIGNATURE_INVALID"; TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_DEPOSIT_DECIDED_ALREADY"] = 1976] = "EXCHANGE_PURSE_DEPOSIT_DECIDED_ALREADY"; + TalerErrorCode2[TalerErrorCode2["EXCHANGE_TOTP_KEY_INVALID"] = 1980] = "EXCHANGE_TOTP_KEY_INVALID"; TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_INSTANCE_UNKNOWN"] = 2e3] = "MERCHANT_GENERIC_INSTANCE_UNKNOWN"; TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_HOLE_IN_WIRE_FEE_STRUCTURE"] = 2001] = "MERCHANT_GENERIC_HOLE_IN_WIRE_FEE_STRUCTURE"; TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_EXCHANGE_WIRE_REQUEST_FAILED"] = 2002] = "MERCHANT_GENERIC_EXCHANGE_WIRE_REQUEST_FAILED"; @@ -9083,6 +8623,7 @@ var TalerErrorCode; TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_SIZE_MISMATCH"] = 2172] = "MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_SIZE_MISMATCH"; TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_AGE_VERIFICATION_FAILED"] = 2173] = "MERCHANT_POST_ORDERS_ID_PAY_AGE_VERIFICATION_FAILED"; TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_HASH_MISSING"] = 2174] = "MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_HASH_MISSING"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_WIRE_METHOD_UNSUPPORTED"] = 2175] = "MERCHANT_POST_ORDERS_ID_PAY_WIRE_METHOD_UNSUPPORTED"; TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAID_CONTRACT_HASH_MISMATCH"] = 2200] = "MERCHANT_POST_ORDERS_ID_PAID_CONTRACT_HASH_MISMATCH"; TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAID_COIN_SIGNATURE_INVALID"] = 2201] = "MERCHANT_POST_ORDERS_ID_PAID_COIN_SIGNATURE_INVALID"; TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_REFUND_FAILED"] = 2251] = "MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_REFUND_FAILED"; @@ -9110,6 +8651,7 @@ var TalerErrorCode; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_WIRE_DEADLINE_IS_NEVER"] = 2506] = "MERCHANT_PRIVATE_POST_ORDERS_WIRE_DEADLINE_IS_NEVER"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_PAY_DEADLINE_IN_PAST"] = 2507] = "MERCHANT_PRIVATE_POST_ORDERS_PAY_DEADLINE_IN_PAST"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_REFUND_DEADLINE_IN_PAST"] = 2508] = "MERCHANT_PRIVATE_POST_ORDERS_REFUND_DEADLINE_IN_PAST"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_NO_EXCHANGES_FOR_WIRE_METHOD"] = 2509] = "MERCHANT_PRIVATE_POST_ORDERS_NO_EXCHANGES_FOR_WIRE_METHOD"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_SYNTAX_INCORRECT"] = 2510] = "MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_SYNTAX_INCORRECT"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_NOT_FORGETTABLE"] = 2511] = "MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_NOT_FORGETTABLE"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_DELETE_ORDERS_AWAITING_PAYMENT"] = 2520] = "MERCHANT_PRIVATE_DELETE_ORDERS_AWAITING_PAYMENT"; @@ -9125,11 +8667,21 @@ var TalerErrorCode; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TRANSFERS_ACCOUNT_NOT_FOUND"] = 2555] = "MERCHANT_PRIVATE_POST_TRANSFERS_ACCOUNT_NOT_FOUND"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_DELETE_TRANSFERS_ALREADY_CONFIRMED"] = 2556] = "MERCHANT_PRIVATE_DELETE_TRANSFERS_ALREADY_CONFIRMED"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_SUBMISSION"] = 2557] = "MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_SUBMISSION"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_EXCHANGE_TRANSFERS_AWAITING_KEYS"] = 2258] = "MERCHANT_EXCHANGE_TRANSFERS_AWAITING_KEYS"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_EXCHANGE_TRANSFERS_AWAITING_LIST"] = 2259] = "MERCHANT_EXCHANGE_TRANSFERS_AWAITING_LIST"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_EXCHANGE_TRANSFERS_FATAL_NO_EXCHANGE"] = 2260] = "MERCHANT_EXCHANGE_TRANSFERS_FATAL_NO_EXCHANGE"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_EXCHANGE_TRANSFERS_FATAL_NOT_FOUND"] = 2261] = "MERCHANT_EXCHANGE_TRANSFERS_FATAL_NOT_FOUND"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_EXCHANGE_TRANSFERS_RATE_LIMITED"] = 2262] = "MERCHANT_EXCHANGE_TRANSFERS_RATE_LIMITED"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_EXCHANGE_TRANSFERS_TRANSIENT_FAILURE"] = 2263] = "MERCHANT_EXCHANGE_TRANSFERS_TRANSIENT_FAILURE"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_EXCHANGE_TRANSFERS_HARD_FAILURE"] = 2264] = "MERCHANT_EXCHANGE_TRANSFERS_HARD_FAILURE"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_EXCHANGE_TRANSFERS_CONFLICTING_TRANSFERS"] = 2563] = "MERCHANT_EXCHANGE_TRANSFERS_CONFLICTING_TRANSFERS"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS"] = 2600] = "MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_INSTANCES_BAD_AUTH"] = 2601] = "MERCHANT_PRIVATE_POST_INSTANCES_BAD_AUTH"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_INSTANCE_AUTH_BAD_AUTH"] = 2602] = "MERCHANT_PRIVATE_POST_INSTANCE_AUTH_BAD_AUTH"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_INSTANCES_PURGE_REQUIRED"] = 2603] = "MERCHANT_PRIVATE_POST_INSTANCES_PURGE_REQUIRED"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_PATCH_INSTANCES_PURGE_REQUIRED"] = 2625] = "MERCHANT_PRIVATE_PATCH_INSTANCES_PURGE_REQUIRED"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_ACCOUNT_DELETE_UNKNOWN_ACCOUNT"] = 2626] = "MERCHANT_PRIVATE_ACCOUNT_DELETE_UNKNOWN_ACCOUNT"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_ACCOUNT_EXISTS"] = 2627] = "MERCHANT_PRIVATE_ACCOUNT_EXISTS"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_PRODUCTS_CONFLICT_PRODUCT_EXISTS"] = 2650] = "MERCHANT_PRIVATE_POST_PRODUCTS_CONFLICT_PRODUCT_EXISTS"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_REDUCED"] = 2660] = "MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_REDUCED"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_EXCEEDS_STOCKS"] = 2661] = "MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_LOST_EXCEEDS_STOCKS"; @@ -9138,6 +8690,7 @@ var TalerErrorCode; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_PRODUCTS_LOCK_INSUFFICIENT_STOCKS"] = 2670] = "MERCHANT_PRIVATE_POST_PRODUCTS_LOCK_INSUFFICIENT_STOCKS"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_DELETE_PRODUCTS_CONFLICTING_LOCK"] = 2680] = "MERCHANT_PRIVATE_DELETE_PRODUCTS_CONFLICTING_LOCK"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_RESERVES_UNSUPPORTED_WIRE_METHOD"] = 2700] = "MERCHANT_PRIVATE_POST_RESERVES_UNSUPPORTED_WIRE_METHOD"; + TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_RESERVES_TIPPING_NOT_ALLOWED"] = 2701] = "MERCHANT_PRIVATE_POST_RESERVES_TIPPING_NOT_ALLOWED"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_DELETE_RESERVES_NO_SUCH_RESERVE"] = 2710] = "MERCHANT_PRIVATE_DELETE_RESERVES_NO_SUCH_RESERVE"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_RESERVE_EXPIRED"] = 2750] = "MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_RESERVE_EXPIRED"; TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_RESERVE_UNKNOWN"] = 2751] = "MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_RESERVE_UNKNOWN"; @@ -9217,6 +8770,8 @@ var TalerErrorCode; TalerErrorCode2[TalerErrorCode2["WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE"] = 7027] = "WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE"; TalerErrorCode2[TalerErrorCode2["WALLET_PEER_PULL_PAYMENT_INSUFFICIENT_BALANCE"] = 7028] = "WALLET_PEER_PULL_PAYMENT_INSUFFICIENT_BALANCE"; TalerErrorCode2[TalerErrorCode2["WALLET_REFRESH_GROUP_INCOMPLETE"] = 7029] = "WALLET_REFRESH_GROUP_INCOMPLETE"; + TalerErrorCode2[TalerErrorCode2["WALLET_EXCHANGE_BASE_URL_MISMATCH"] = 7030] = "WALLET_EXCHANGE_BASE_URL_MISMATCH"; + TalerErrorCode2[TalerErrorCode2["WALLET_ORDER_ALREADY_PAID"] = 7031] = "WALLET_ORDER_ALREADY_PAID"; TalerErrorCode2[TalerErrorCode2["ANASTASIS_GENERIC_BACKEND_TIMEOUT"] = 8e3] = "ANASTASIS_GENERIC_BACKEND_TIMEOUT"; TalerErrorCode2[TalerErrorCode2["ANASTASIS_GENERIC_INVALID_PAYMENT_REQUEST"] = 8001] = "ANASTASIS_GENERIC_INVALID_PAYMENT_REQUEST"; TalerErrorCode2[TalerErrorCode2["ANASTASIS_GENERIC_BACKEND_ERROR"] = 8002] = "ANASTASIS_GENERIC_BACKEND_ERROR"; @@ -9289,6 +8844,15 @@ var TalerErrorCode; TalerErrorCode2[TalerErrorCode2["LIBEUFIN_SANDBOX_UNCAUGHT_EXCEPTION"] = 9501] = "LIBEUFIN_SANDBOX_UNCAUGHT_EXCEPTION"; TalerErrorCode2[TalerErrorCode2["TALDIR_METHOD_NOT_SUPPORTED"] = 9600] = "TALDIR_METHOD_NOT_SUPPORTED"; TalerErrorCode2[TalerErrorCode2["TALDIR_REGISTER_RATE_LIMITED"] = 9601] = "TALDIR_REGISTER_RATE_LIMITED"; + TalerErrorCode2[TalerErrorCode2["CHALLENGER_GENERIC_CLIENT_UNKNOWN"] = 9750] = "CHALLENGER_GENERIC_CLIENT_UNKNOWN"; + TalerErrorCode2[TalerErrorCode2["CHALLENGER_GENERIC_CLIENT_FORBIDDEN_BAD_REDIRECT_URI"] = 9751] = "CHALLENGER_GENERIC_CLIENT_FORBIDDEN_BAD_REDIRECT_URI"; + TalerErrorCode2[TalerErrorCode2["CHALLENGER_HELPER_EXEC_FAILED"] = 9752] = "CHALLENGER_HELPER_EXEC_FAILED"; + TalerErrorCode2[TalerErrorCode2["CHALLENGER_GRANT_UNKNOWN"] = 9753] = "CHALLENGER_GRANT_UNKNOWN"; + TalerErrorCode2[TalerErrorCode2["CHALLENGER_CLIENT_FORBIDDEN_BAD_CODE"] = 9754] = "CHALLENGER_CLIENT_FORBIDDEN_BAD_CODE"; + TalerErrorCode2[TalerErrorCode2["CHALLENGER_GENERIC_VALIDATION_UNKNOWN"] = 9755] = "CHALLENGER_GENERIC_VALIDATION_UNKNOWN"; + TalerErrorCode2[TalerErrorCode2["CHALLENGER_CLIENT_FORBIDDEN_INVALID_CODE"] = 9756] = "CHALLENGER_CLIENT_FORBIDDEN_INVALID_CODE"; + TalerErrorCode2[TalerErrorCode2["CHALLENGER_TOO_MANY_ATTEMPTS"] = 9757] = "CHALLENGER_TOO_MANY_ATTEMPTS"; + TalerErrorCode2[TalerErrorCode2["CHALLENGER_INVALID_PIN"] = 9758] = "CHALLENGER_INVALID_PIN"; TalerErrorCode2[TalerErrorCode2["END"] = 9999] = "END"; })(TalerErrorCode || (TalerErrorCode = {})); @@ -9308,6 +8872,59 @@ function renderContext(c4) { return "(unknown)"; } } +function joinContext(c4, part) { + var _a2; + const path = (_a2 = c4 == null ? void 0 : c4.path) != null ? _a2 : []; + return { + path: path.concat([part]) + }; +} +var ObjectCodecBuilder = class { + constructor() { + this.propList = []; + } + /** + * Define a property for the object. + */ + property(x6, codec) { + if (!codec) { + throw Error("inner codec must be defined"); + } + this.propList.push({ name: x6, codec }); + return this; + } + /** + * Return the built codec. + * + * @param objectDisplayName name of the object that this codec operates on, + * used in error messages. + */ + build(objectDisplayName) { + const propList = this.propList; + return { + decode(x6, c4) { + if (!c4) { + c4 = { + path: [`(${objectDisplayName})`] + }; + } + if (typeof x6 !== "object") { + throw new DecodingError(`expected object for ${objectDisplayName} at ${renderContext(c4)} but got ${typeof x6}`); + } + const obj = {}; + for (const prop of propList) { + const propRawVal = x6[prop.name]; + const propVal = prop.codec.decode(propRawVal, joinContext(c4, prop.name)); + obj[prop.name] = propVal; + } + return obj; + } + }; + } +}; +function buildCodecForObject() { + return new ObjectCodecBuilder(); +} function codecForNumber() { return { decode(x6, c4) { @@ -9328,6 +8945,29 @@ function codecForString() { } }; } +function codecForConstString(s5) { + return { + decode(x6, c4) { + if (x6 === s5) { + return x6; + } + if (typeof x6 !== "string") { + throw new DecodingError(`expected string constant "${s5}" at ${renderContext(c4)} but got ${typeof x6}`); + } + throw new DecodingError(`expected string constant "${s5}" at ${renderContext(c4)} but got string value "${x6}"`); + } + }; +} +function codecOptional(innerCodec) { + return { + decode(x6, c4) { + if (x6 === void 0 || x6 === null) { + return void 0; + } + return innerCodec.decode(x6, c4); + } + }; +} function codecForEither(...alts) { return { decode(x6, c4) { @@ -9342,12 +8982,13 @@ function codecForEither(...alts) { } }; } -var x3 = codecForEither(codecForString(), codecForNumber()); +var x = codecForEither(codecForString(), codecForNumber()); // ../taler-util/lib/amounts.js var amountFractionalBase = 1e8; var amountFractionalLength = 8; var amountMaxValue = __pow(2, 52); +var codecForAmountString = () => codecForString(); var Amounts = class { constructor() { throw Error("not instantiable"); @@ -9380,6 +9021,25 @@ var Amounts = class { } return amt; } + static divmod(a1, a22) { + const am1 = Amounts.jsonifyAmount(a1); + const am2 = Amounts.jsonifyAmount(a22); + if (am1.currency != am2.currency) { + throw Error(`incompatible currency (${am1.currency} vs${am2.currency})`); + } + const x1 = BigInt(am1.value) * BigInt(amountFractionalBase) + BigInt(am1.fraction); + const x22 = BigInt(am2.value) * BigInt(amountFractionalBase) + BigInt(am2.fraction); + const quotient = x1 / x22; + const remainderScaled = x1 % x22; + return { + quotient: Number(quotient), + remainder: { + currency: am1.currency, + value: Number(remainderScaled / BigInt(amountFractionalBase)), + fraction: Number(remainderScaled % BigInt(amountFractionalBase)) + } + }; + } static sum(amounts) { if (amounts.length <= 0) { throw Error("can't sum zero amounts"); @@ -9590,17 +9250,6 @@ var Amounts = class { throw Error("invalid amount (illegal type)"); } } - /** - * Convert a float to a Taler amount. - * Loss of precision possible. - */ - static fromFloat(floatVal, currency) { - return { - currency, - fraction: Math.floor((floatVal - Math.floor(floatVal)) * amountFractionalBase), - value: Math.floor(floatVal) - }; - } static min(a5, b4) { const cr = Amounts.cmp(a5, b4); if (cr >= 0) { @@ -9762,6 +9411,7 @@ var BackupRefundState; var BackupProposalStatus; (function(BackupProposalStatus2) { BackupProposalStatus2["Proposed"] = "proposed"; + BackupProposalStatus2["Shared"] = "shared"; BackupProposalStatus2["Refused"] = "refused"; BackupProposalStatus2["PermanentlyFailed"] = "permanently-failed"; BackupProposalStatus2["Repurchase"] = "repurchase"; @@ -10011,14 +9661,14 @@ function utf8DecodeWithoutBOM(bytes) { return utf8Decoder.decode(bytes); } function parseUrlencoded(input) { - const sequences = strictlySplitByteSequence(input, p3("&")); + const sequences = strictlySplitByteSequence(input, p("&")); const output = []; for (const bytes of sequences) { if (bytes.length === 0) { continue; } let name, value; - const indexOfEqual = bytes.indexOf(p3("=")); + const indexOfEqual = bytes.indexOf(p("=")); if (indexOfEqual >= 0) { name = bytes.slice(0, indexOfEqual); value = bytes.slice(indexOfEqual + 1); @@ -10083,7 +9733,7 @@ function replaceByteInByteSequence(buf, from, to) { } return buf; } -function p3(char) { +function p(char) { return char.codePointAt(0); } function percentEncode(c4) { @@ -10118,63 +9768,63 @@ function isC0ControlPercentEncode(c4) { return c4 <= 31 || c4 > 126; } var extraFragmentPercentEncodeSet = /* @__PURE__ */ new Set([ - p3(" "), - p3('"'), - p3("<"), - p3(">"), - p3("`") + p(" "), + p('"'), + p("<"), + p(">"), + p("`") ]); function isFragmentPercentEncode(c4) { return isC0ControlPercentEncode(c4) || extraFragmentPercentEncodeSet.has(c4); } var extraQueryPercentEncodeSet = /* @__PURE__ */ new Set([ - p3(" "), - p3('"'), - p3("#"), - p3("<"), - p3(">") + p(" "), + p('"'), + p("#"), + p("<"), + p(">") ]); function isQueryPercentEncode(c4) { return isC0ControlPercentEncode(c4) || extraQueryPercentEncodeSet.has(c4); } function isSpecialQueryPercentEncode(c4) { - return isQueryPercentEncode(c4) || c4 === p3("'"); + return isQueryPercentEncode(c4) || c4 === p("'"); } -var extraPathPercentEncodeSet = /* @__PURE__ */ new Set([p3("?"), p3("`"), p3("{"), p3("}")]); +var extraPathPercentEncodeSet = /* @__PURE__ */ new Set([p("?"), p("`"), p("{"), p("}")]); function isPathPercentEncode(c4) { return isQueryPercentEncode(c4) || extraPathPercentEncodeSet.has(c4); } var extraUserinfoPercentEncodeSet = /* @__PURE__ */ new Set([ - p3("/"), - p3(":"), - p3(";"), - p3("="), - p3("@"), - p3("["), - p3("\\"), - p3("]"), - p3("^"), - p3("|") + p("/"), + p(":"), + p(";"), + p("="), + p("@"), + p("["), + p("\\"), + p("]"), + p("^"), + p("|") ]); function isUserinfoPercentEncode(c4) { return isPathPercentEncode(c4) || extraUserinfoPercentEncodeSet.has(c4); } var extraComponentPercentEncodeSet = /* @__PURE__ */ new Set([ - p3("$"), - p3("%"), - p3("&"), - p3("+"), - p3(",") + p("$"), + p("%"), + p("&"), + p("+"), + p(",") ]); function isComponentPercentEncode(c4) { return isUserinfoPercentEncode(c4) || extraComponentPercentEncodeSet.has(c4); } var extraURLEncodedPercentEncodeSet = /* @__PURE__ */ new Set([ - p3("!"), - p3("'"), - p3("("), - p3(")"), - p3("~") + p("!"), + p("'"), + p("("), + p(")"), + p("~") ]); function isURLEncodedPercentEncode(c4) { return isComponentPercentEncode(c4) || extraURLEncodedPercentEncodeSet.has(c4); @@ -10358,7 +10008,7 @@ function isDoubleDot(buffer) { return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; } function isWindowsDriveLetterCodePoints(cp1, cp2) { - return isASCIIAlpha(cp1) && (cp2 === p3(":") || cp2 === p3("|")); + return isASCIIAlpha(cp1) && (cp2 === p(":") || cp2 === p("|")); } function isWindowsDriveLetterString(string2) { return string2.length === 2 && isASCIIAlpha(string2.codePointAt(0)) && (string2[1] === ":" || string2[1] === "|"); @@ -10463,8 +10113,8 @@ function parseIPv6(inputArg) { let compress = null; let pointer = 0; const input = Array.from(inputArg, (c4) => c4.codePointAt(0)); - if (input[pointer] === p3(":")) { - if (input[pointer + 1] !== p3(":")) { + if (input[pointer] === p(":")) { + if (input[pointer + 1] !== p(":")) { return failure; } pointer += 2; @@ -10475,7 +10125,7 @@ function parseIPv6(inputArg) { if (pieceIndex === 8) { return failure; } - if (input[pointer] === p3(":")) { + if (input[pointer] === p(":")) { if (compress !== null) { return failure; } @@ -10491,7 +10141,7 @@ function parseIPv6(inputArg) { ++pointer; ++length; } - if (input[pointer] === p3(".")) { + if (input[pointer] === p(".")) { if (length === 0) { return failure; } @@ -10503,7 +10153,7 @@ function parseIPv6(inputArg) { while (input[pointer] !== void 0) { let ipv4Piece = null; if (numbersSeen > 0) { - if (input[pointer] === p3(".") && numbersSeen < 4) { + if (input[pointer] === p(".") && numbersSeen < 4) { ++pointer; } else { return failure; @@ -10536,7 +10186,7 @@ function parseIPv6(inputArg) { return failure; } break; - } else if (input[pointer] === p3(":")) { + } else if (input[pointer] === p(":")) { ++pointer; if (input[pointer] === void 0) { return failure; @@ -10790,9 +10440,9 @@ var URLStateMachine = class { return true; } parseScheme(c4, cStr) { - if (isASCIIAlphanumeric(c4) || c4 === p3("+") || c4 === p3("-") || c4 === p3(".")) { + if (isASCIIAlphanumeric(c4) || c4 === p("+") || c4 === p("-") || c4 === p(".")) { this.buffer += cStr.toLowerCase(); - } else if (c4 === p3(":")) { + } else if (c4 === p(":")) { if (this.stateOverride) { if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { return false; @@ -10816,7 +10466,7 @@ var URLStateMachine = class { } this.buffer = ""; if (this.url.scheme === "file") { - if (this.input[this.pointer + 1] !== p3("/") || this.input[this.pointer + 2] !== p3("/")) { + if (this.input[this.pointer + 1] !== p("/") || this.input[this.pointer + 2] !== p("/")) { this.parseError = true; } this.state = "file"; @@ -10824,7 +10474,7 @@ var URLStateMachine = class { this.state = "special relative or authority"; } else if (isSpecial(this.url)) { this.state = "special authority slashes"; - } else if (this.input[this.pointer + 1] === p3("/")) { + } else if (this.input[this.pointer + 1] === p("/")) { this.state = "path or authority"; ++this.pointer; } else { @@ -10842,9 +10492,9 @@ var URLStateMachine = class { return true; } parseNoScheme(c4) { - if (this.base === null || hasAnOpaquePath(this.base) && c4 !== p3("#")) { + if (this.base === null || hasAnOpaquePath(this.base) && c4 !== p("#")) { return failure; - } else if (hasAnOpaquePath(this.base) && c4 === p3("#")) { + } else if (hasAnOpaquePath(this.base) && c4 === p("#")) { this.url.scheme = this.base.scheme; this.url.path = this.base.path; this.url.query = this.base.query; @@ -10860,7 +10510,7 @@ var URLStateMachine = class { return true; } parseSpecialRelativeOrAuthority(c4) { - if (c4 === p3("/") && this.input[this.pointer + 1] === p3("/")) { + if (c4 === p("/") && this.input[this.pointer + 1] === p("/")) { this.state = "special authority ignore slashes"; ++this.pointer; } else { @@ -10871,7 +10521,7 @@ var URLStateMachine = class { return true; } parsePathOrAuthority(c4) { - if (c4 === p3("/")) { + if (c4 === p("/")) { this.state = "authority"; } else { this.state = "path"; @@ -10881,9 +10531,9 @@ var URLStateMachine = class { } parseRelative(c4) { this.url.scheme = this.base.scheme; - if (c4 === p3("/")) { + if (c4 === p("/")) { this.state = "relative slash"; - } else if (isSpecial(this.url) && c4 === p3("\\")) { + } else if (isSpecial(this.url) && c4 === p("\\")) { this.parseError = true; this.state = "relative slash"; } else { @@ -10893,10 +10543,10 @@ var URLStateMachine = class { this.url.port = this.base.port; this.url.path = this.base.path.slice(); this.url.query = this.base.query; - if (c4 === p3("?")) { + if (c4 === p("?")) { this.url.query = ""; this.state = "query"; - } else if (c4 === p3("#")) { + } else if (c4 === p("#")) { this.url.fragment = ""; this.state = "fragment"; } else if (!isNaN(c4)) { @@ -10909,12 +10559,12 @@ var URLStateMachine = class { return true; } parseRelativeSlash(c4) { - if (isSpecial(this.url) && (c4 === p3("/") || c4 === p3("\\"))) { - if (c4 === p3("\\")) { + if (isSpecial(this.url) && (c4 === p("/") || c4 === p("\\"))) { + if (c4 === p("\\")) { this.parseError = true; } this.state = "special authority ignore slashes"; - } else if (c4 === p3("/")) { + } else if (c4 === p("/")) { this.state = "authority"; } else { this.url.username = this.base.username; @@ -10927,7 +10577,7 @@ var URLStateMachine = class { return true; } parseSpecialAuthoritySlashes(c4) { - if (c4 === p3("/") && this.input[this.pointer + 1] === p3("/")) { + if (c4 === p("/") && this.input[this.pointer + 1] === p("/")) { this.state = "special authority ignore slashes"; ++this.pointer; } else { @@ -10938,7 +10588,7 @@ var URLStateMachine = class { return true; } parseSpecialAuthorityIgnoreSlashes(c4) { - if (c4 !== p3("/") && c4 !== p3("\\")) { + if (c4 !== p("/") && c4 !== p("\\")) { this.state = "authority"; --this.pointer; } else { @@ -10947,7 +10597,7 @@ var URLStateMachine = class { return true; } parseAuthority(c4, cStr) { - if (c4 === p3("@")) { + if (c4 === p("@")) { this.parseError = true; if (this.atFlag) { this.buffer = `%40${this.buffer}`; @@ -10956,7 +10606,7 @@ var URLStateMachine = class { const len = countSymbols(this.buffer); for (let pointer = 0; pointer < len; ++pointer) { const codePoint = this.buffer.codePointAt(pointer); - if (codePoint === p3(":") && !this.passwordTokenSeenFlag) { + if (codePoint === p(":") && !this.passwordTokenSeenFlag) { this.passwordTokenSeenFlag = true; continue; } @@ -10968,7 +10618,7 @@ var URLStateMachine = class { } } this.buffer = ""; - } else if (isNaN(c4) || c4 === p3("/") || c4 === p3("?") || c4 === p3("#") || isSpecial(this.url) && c4 === p3("\\")) { + } else if (isNaN(c4) || c4 === p("/") || c4 === p("?") || c4 === p("#") || isSpecial(this.url) && c4 === p("\\")) { if (this.atFlag && this.buffer === "") { this.parseError = true; return failure; @@ -10985,7 +10635,7 @@ var URLStateMachine = class { if (this.stateOverride && this.url.scheme === "file") { --this.pointer; this.state = "file host"; - } else if (c4 === p3(":") && !this.arrFlag) { + } else if (c4 === p(":") && !this.arrFlag) { if (this.buffer === "") { this.parseError = true; return failure; @@ -11000,7 +10650,7 @@ var URLStateMachine = class { this.url.host = host; this.buffer = ""; this.state = "port"; - } else if (isNaN(c4) || c4 === p3("/") || c4 === p3("?") || c4 === p3("#") || isSpecial(this.url) && c4 === p3("\\")) { + } else if (isNaN(c4) || c4 === p("/") || c4 === p("?") || c4 === p("#") || isSpecial(this.url) && c4 === p("\\")) { --this.pointer; if (isSpecial(this.url) && this.buffer === "") { this.parseError = true; @@ -11020,9 +10670,9 @@ var URLStateMachine = class { return false; } } else { - if (c4 === p3("[")) { + if (c4 === p("[")) { this.arrFlag = true; - } else if (c4 === p3("]")) { + } else if (c4 === p("]")) { this.arrFlag = false; } this.buffer += cStr; @@ -11032,7 +10682,7 @@ var URLStateMachine = class { parsePort(c4, cStr) { if (isASCIIDigit(c4)) { this.buffer += cStr; - } else if (isNaN(c4) || c4 === p3("/") || c4 === p3("?") || c4 === p3("#") || isSpecial(this.url) && c4 === p3("\\") || this.stateOverride) { + } else if (isNaN(c4) || c4 === p("/") || c4 === p("?") || c4 === p("#") || isSpecial(this.url) && c4 === p("\\") || this.stateOverride) { if (this.buffer !== "") { const port = parseInt(this.buffer); if (port > __pow(2, 16) - 1) { @@ -11056,8 +10706,8 @@ var URLStateMachine = class { parseFile(c4) { this.url.scheme = "file"; this.url.host = ""; - if (c4 === p3("/") || c4 === p3("\\")) { - if (c4 === p3("\\")) { + if (c4 === p("/") || c4 === p("\\")) { + if (c4 === p("\\")) { this.parseError = true; } this.state = "file slash"; @@ -11065,10 +10715,10 @@ var URLStateMachine = class { this.url.host = this.base.host; this.url.path = this.base.path.slice(); this.url.query = this.base.query; - if (c4 === p3("?")) { + if (c4 === p("?")) { this.url.query = ""; this.state = "query"; - } else if (c4 === p3("#")) { + } else if (c4 === p("#")) { this.url.fragment = ""; this.state = "fragment"; } else if (!isNaN(c4)) { @@ -11089,8 +10739,8 @@ var URLStateMachine = class { return true; } parseFileSlash(c4) { - if (c4 === p3("/") || c4 === p3("\\")) { - if (c4 === p3("\\")) { + if (c4 === p("/") || c4 === p("\\")) { + if (c4 === p("\\")) { this.parseError = true; } this.state = "file host"; @@ -11107,7 +10757,7 @@ var URLStateMachine = class { return true; } parseFileHost(c4, cStr) { - if (isNaN(c4) || c4 === p3("/") || c4 === p3("\\") || c4 === p3("?") || c4 === p3("#")) { + if (isNaN(c4) || c4 === p("/") || c4 === p("\\") || c4 === p("?") || c4 === p("#")) { --this.pointer; if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { this.parseError = true; @@ -11140,22 +10790,22 @@ var URLStateMachine = class { } parsePathStart(c4) { if (isSpecial(this.url)) { - if (c4 === p3("\\")) { + if (c4 === p("\\")) { this.parseError = true; } this.state = "path"; - if (c4 !== p3("/") && c4 !== p3("\\")) { + if (c4 !== p("/") && c4 !== p("\\")) { --this.pointer; } - } else if (!this.stateOverride && c4 === p3("?")) { + } else if (!this.stateOverride && c4 === p("?")) { this.url.query = ""; this.state = "query"; - } else if (!this.stateOverride && c4 === p3("#")) { + } else if (!this.stateOverride && c4 === p("#")) { this.url.fragment = ""; this.state = "fragment"; } else if (c4 !== void 0) { this.state = "path"; - if (c4 !== p3("/")) { + if (c4 !== p("/")) { --this.pointer; } } else if (this.stateOverride && this.url.host === null) { @@ -11164,16 +10814,16 @@ var URLStateMachine = class { return true; } parsePath(c4) { - if (isNaN(c4) || c4 === p3("/") || isSpecial(this.url) && c4 === p3("\\") || !this.stateOverride && (c4 === p3("?") || c4 === p3("#"))) { - if (isSpecial(this.url) && c4 === p3("\\")) { + if (isNaN(c4) || c4 === p("/") || isSpecial(this.url) && c4 === p("\\") || !this.stateOverride && (c4 === p("?") || c4 === p("#"))) { + if (isSpecial(this.url) && c4 === p("\\")) { this.parseError = true; } if (isDoubleDot(this.buffer)) { shortenPath(this.url); - if (c4 !== p3("/") && !(isSpecial(this.url) && c4 === p3("\\"))) { + if (c4 !== p("/") && !(isSpecial(this.url) && c4 === p("\\"))) { this.url.path.push(""); } - } else if (isSingleDot(this.buffer) && c4 !== p3("/") && !(isSpecial(this.url) && c4 === p3("\\"))) { + } else if (isSingleDot(this.buffer) && c4 !== p("/") && !(isSpecial(this.url) && c4 === p("\\"))) { this.url.path.push(""); } else if (!isSingleDot(this.buffer)) { if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { @@ -11182,16 +10832,16 @@ var URLStateMachine = class { this.url.path.push(this.buffer); } this.buffer = ""; - if (c4 === p3("?")) { + if (c4 === p("?")) { this.url.query = ""; this.state = "query"; } - if (c4 === p3("#")) { + if (c4 === p("#")) { this.url.fragment = ""; this.state = "fragment"; } } else { - if (c4 === p3("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) { + if (c4 === p("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) { this.parseError = true; } this.buffer += utf8PercentEncodeCodePoint(c4, isPathPercentEncode); @@ -11199,17 +10849,17 @@ var URLStateMachine = class { return true; } parseOpaquePath(c4) { - if (c4 === p3("?")) { + if (c4 === p("?")) { this.url.query = ""; this.state = "query"; - } else if (c4 === p3("#")) { + } else if (c4 === p("#")) { this.url.fragment = ""; this.state = "fragment"; } else { - if (!isNaN(c4) && c4 !== p3("%")) { + if (!isNaN(c4) && c4 !== p("%")) { this.parseError = true; } - if (c4 === p3("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) { + if (c4 === p("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) { this.parseError = true; } if (!isNaN(c4)) { @@ -11222,16 +10872,16 @@ var URLStateMachine = class { if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { this.encodingOverride = "utf-8"; } - if (!this.stateOverride && c4 === p3("#") || isNaN(c4)) { + if (!this.stateOverride && c4 === p("#") || isNaN(c4)) { const queryPercentEncodePredicate = isSpecial(this.url) ? isSpecialQueryPercentEncode : isQueryPercentEncode; this.url.query += utf8PercentEncodeString(this.buffer, queryPercentEncodePredicate); this.buffer = ""; - if (c4 === p3("#")) { + if (c4 === p("#")) { this.url.fragment = ""; this.state = "fragment"; } } else if (!isNaN(c4)) { - if (c4 === p3("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) { + if (c4 === p("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) { this.parseError = true; } this.buffer += cStr; @@ -11240,7 +10890,7 @@ var URLStateMachine = class { } parseFragment(c4) { if (!isNaN(c4)) { - if (c4 === p3("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) { + if (c4 === p("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) { this.parseError = true; } this.url.fragment += utf8PercentEncodeCodePoint(c4, isFragmentPercentEncode); @@ -11248,7 +10898,7 @@ var URLStateMachine = class { return true; } }; -var fileOtherwiseCodePoints = /* @__PURE__ */ new Set([p3("/"), p3("\\"), p3("?"), p3("#")]); +var fileOtherwiseCodePoints = /* @__PURE__ */ new Set([p("/"), p("\\"), p("?"), p("#")]); function startsWithWindowsDriveLetter(input, pointer) { const length = input.length - pointer; return length >= 2 && isWindowsDriveLetterCodePoints(input[pointer], input[pointer + 1]) && (length === 2 || fileOtherwiseCodePoints.has(input[pointer + 2])); @@ -11531,6 +11181,7 @@ if (useOwnUrlImp || !_URL) { globalThis.URL = _URL = URLImpl; _URL = URLImpl; } +var URL2 = _URL; var _URLSearchParams = globalThis.URLSearchParams; if (useOwnUrlImp || !_URLSearchParams) { globalThis.URLSearchParams = URLSearchParamsImpl; @@ -11539,6 +11190,18 @@ if (useOwnUrlImp || !_URLSearchParams) { var URLSearchParams2 = _URLSearchParams; // ../taler-util/lib/helpers.js +function canonicalizeBaseUrl(url) { + if (!url.startsWith("http") && !url.startsWith("https")) { + url = "https://" + url; + } + const x6 = new URL2(url); + if (!x6.pathname.endsWith("/")) { + x6.pathname = x6.pathname + "/"; + } + x6.search = ""; + x6.hash = ""; + return x6.href; +} function canonicalJson(obj) { obj = JSON.parse(JSON.stringify(obj)); if (typeof obj === "string") { @@ -11615,48 +11278,12 @@ var LibtoolVersion; // ../taler-util/lib/notifications.js var NotificationType; (function(NotificationType2) { - NotificationType2["CoinWithdrawn"] = "coin-withdrawn"; - NotificationType2["ProposalAccepted"] = "proposal-accepted"; - NotificationType2["ProposalDownloaded"] = "proposal-downloaded"; - NotificationType2["RefundsSubmitted"] = "refunds-submitted"; - NotificationType2["RecoupStarted"] = "recoup-started"; - NotificationType2["RecoupFinished"] = "recoup-finished"; - NotificationType2["RefreshRevealed"] = "refresh-revealed"; - NotificationType2["RefreshMelted"] = "refresh-melted"; - NotificationType2["RefreshStarted"] = "refresh-started"; - NotificationType2["RefreshUnwarranted"] = "refresh-unwarranted"; - NotificationType2["ReserveUpdated"] = "reserve-updated"; - NotificationType2["ReserveConfirmed"] = "reserve-confirmed"; - NotificationType2["ReserveCreated"] = "reserve-created"; - NotificationType2["WithdrawGroupCreated"] = "withdraw-group-created"; - NotificationType2["WithdrawGroupFinished"] = "withdraw-group-finished"; - NotificationType2["WaitingForRetry"] = "waiting-for-retry"; - NotificationType2["RefundStarted"] = "refund-started"; - NotificationType2["RefundQueried"] = "refund-queried"; - NotificationType2["RefundFinished"] = "refund-finished"; + NotificationType2["BalanceChange"] = "balance-change"; NotificationType2["ExchangeOperationError"] = "exchange-operation-error"; NotificationType2["ExchangeAdded"] = "exchange-added"; - NotificationType2["RefreshOperationError"] = "refresh-operation-error"; - NotificationType2["RecoupOperationError"] = "recoup-operation-error"; - NotificationType2["RefundApplyOperationError"] = "refund-apply-error"; - NotificationType2["RefundStatusOperationError"] = "refund-status-error"; - NotificationType2["ProposalOperationError"] = "proposal-error"; NotificationType2["BackupOperationError"] = "backup-error"; - NotificationType2["TipOperationError"] = "tip-error"; - NotificationType2["PayOperationError"] = "pay-error"; - NotificationType2["PayOperationSuccess"] = "pay-operation-success"; - NotificationType2["WithdrawOperationError"] = "withdraw-error"; - NotificationType2["ReserveNotYetFound"] = "reserve-not-yet-found"; - NotificationType2["ReserveOperationError"] = "reserve-error"; - NotificationType2["InternalError"] = "internal-error"; NotificationType2["PendingOperationProcessed"] = "pending-operation-processed"; - NotificationType2["ProposalRefused"] = "proposal-refused"; - NotificationType2["ReserveRegisteredWithBank"] = "reserve-registered-with-bank"; - NotificationType2["WithdrawalGroupKycRequested"] = "withdrawal-group-kyc-requested"; - NotificationType2["WithdrawalGroupBankConfirmed"] = "withdrawal-group-bank-confirmed"; - NotificationType2["WithdrawalGroupReserveReady"] = "withdrawal-group-reserve-ready"; - NotificationType2["PeerPullCreditReady"] = "peer-pull-credit-ready"; - NotificationType2["DepositOperationError"] = "deposit-operation-error"; + NotificationType2["TransactionStateTransition"] = "transaction-state-transition"; })(NotificationType || (NotificationType = {})); // ../taler-util/lib/sha256.js @@ -11947,10 +11574,39 @@ function hmacSha256(key, message) { var import_big_integer = __toESM(require_BigInteger(), 1); // ../taler-util/lib/time.js +var opaque_AbsoluteTime = Symbol("opaque_AbsoluteTime"); +var TalerPreciseTimestamp; +(function(TalerPreciseTimestamp2) { + function now2() { + const absNow = AbsoluteTime.now(); + return AbsoluteTime.toPreciseTimestamp(absNow); + } + TalerPreciseTimestamp2.now = now2; + function round(t4) { + return { + t_s: t4.t_s + }; + } + TalerPreciseTimestamp2.round = round; + function fromSeconds(s5) { + return { + t_s: Math.floor(s5), + off_us: Math.floor((s5 - Math.floor(s5)) / 1e3 / 1e3) + }; + } + TalerPreciseTimestamp2.fromSeconds = fromSeconds; + function fromMilliseconds(ms) { + return { + t_s: Math.floor(ms / 1e3), + off_us: Math.floor((ms - Math.floor(ms / 100) * 1e3) * 1e3) + }; + } + TalerPreciseTimestamp2.fromMilliseconds = fromMilliseconds; +})(TalerPreciseTimestamp || (TalerPreciseTimestamp = {})); var TalerProtocolTimestamp; (function(TalerProtocolTimestamp2) { function now2() { - return AbsoluteTime.toTimestamp(AbsoluteTime.now()); + return AbsoluteTime.toProtocolTimestamp(AbsoluteTime.now()); } TalerProtocolTimestamp2.now = now2; function zero() { @@ -11965,6 +11621,10 @@ var TalerProtocolTimestamp; }; } TalerProtocolTimestamp2.never = never; + function isNever(t4) { + return t4.t_s === "never"; + } + TalerProtocolTimestamp2.isNever = isNever; function fromSeconds(s5) { return { t_s: s5 @@ -12046,6 +11706,25 @@ var Duration; }; } Duration2.fromPrettyString = fromPrettyString; + function cmp(d1, d22) { + if (d1.d_ms === "forever") { + if (d22.d_ms === "forever") { + return 0; + } + return 1; + } + if (d22.d_ms === "forever") { + return -1; + } + if (d1.d_ms == d22.d_ms) { + return 0; + } + if (d1.d_ms > d22.d_ms) { + return 1; + } + return -1; + } + Duration2.cmp = cmp; function max(d1, d22) { return durationMax(d1, d22); } @@ -12081,7 +11760,7 @@ var Duration; }; } return { - d_ms: d5.d_us / 1e3 + d_ms: Math.floor(d5.d_us / 1e3) }; } Duration2.fromTalerProtocolDuration = fromTalerProtocolDuration; @@ -12096,6 +11775,12 @@ var Duration; }; } Duration2.toTalerProtocolDuration = toTalerProtocolDuration; + function fromMilliseconds(ms) { + return { + d_ms: ms + }; + } + Duration2.fromMilliseconds = fromMilliseconds; function clamp(args) { return durationMax(durationMin(args.value, args.upper), args.lower); } @@ -12105,16 +11790,25 @@ var AbsoluteTime; (function(AbsoluteTime2) { function now2() { return { - t_ms: (/* @__PURE__ */ new Date()).getTime() + timeshift + t_ms: (/* @__PURE__ */ new Date()).getTime() + timeshift, + [opaque_AbsoluteTime]: true }; } AbsoluteTime2.now = now2; function never() { return { - t_ms: "never" + t_ms: "never", + [opaque_AbsoluteTime]: true }; } AbsoluteTime2.never = never; + function fromMilliseconds(ms) { + return { + t_ms: ms, + [opaque_AbsoluteTime]: true + }; + } + AbsoluteTime2.fromMilliseconds = fromMilliseconds; function cmp(t1, t22) { if (t1.t_ms === "never") { if (t22.t_ms === "never") { @@ -12136,22 +11830,22 @@ var AbsoluteTime; AbsoluteTime2.cmp = cmp; function min(t1, t22) { if (t1.t_ms === "never") { - return { t_ms: t22.t_ms }; + return { t_ms: t22.t_ms, [opaque_AbsoluteTime]: true }; } if (t22.t_ms === "never") { - return { t_ms: t22.t_ms }; + return { t_ms: t22.t_ms, [opaque_AbsoluteTime]: true }; } - return { t_ms: Math.min(t1.t_ms, t22.t_ms) }; + return { t_ms: Math.min(t1.t_ms, t22.t_ms), [opaque_AbsoluteTime]: true }; } AbsoluteTime2.min = min; function max(t1, t22) { if (t1.t_ms === "never") { - return { t_ms: "never" }; + return { t_ms: "never", [opaque_AbsoluteTime]: true }; } if (t22.t_ms === "never") { - return { t_ms: "never" }; + return { t_ms: "never", [opaque_AbsoluteTime]: true }; } - return { t_ms: Math.max(t1.t_ms, t22.t_ms) }; + return { t_ms: Math.max(t1.t_ms, t22.t_ms), [opaque_AbsoluteTime]: true }; } AbsoluteTime2.max = max; function difference2(t1, t22) { @@ -12168,16 +11862,43 @@ var AbsoluteTime; return cmp(t4, now2()) <= 0; } AbsoluteTime2.isExpired = isExpired; - function fromTimestamp(t4) { + function fromProtocolTimestamp(t4) { + if (t4.t_s === "never") { + return { t_ms: "never", [opaque_AbsoluteTime]: true }; + } + return { + t_ms: t4.t_s * 1e3, + [opaque_AbsoluteTime]: true + }; + } + AbsoluteTime2.fromProtocolTimestamp = fromProtocolTimestamp; + function fromPreciseTimestamp(t4) { + var _a2; if (t4.t_s === "never") { - return { t_ms: "never" }; + return { t_ms: "never", [opaque_AbsoluteTime]: true }; } + const offsetUs = (_a2 = t4.off_us) != null ? _a2 : 0; return { - t_ms: t4.t_s * 1e3 + t_ms: t4.t_s * 1e3 + Math.floor(offsetUs / 1e3), + [opaque_AbsoluteTime]: true }; } - AbsoluteTime2.fromTimestamp = fromTimestamp; - function toTimestamp(at2) { + AbsoluteTime2.fromPreciseTimestamp = fromPreciseTimestamp; + function toPreciseTimestamp(at2) { + if (at2.t_ms == "never") { + return { + t_s: "never" + }; + } + const t_s = Math.floor(at2.t_ms / 1e3); + const off_us = Math.floor(1e3 * (at2.t_ms - t_s * 1e3)); + return { + t_s, + off_us + }; + } + AbsoluteTime2.toPreciseTimestamp = toPreciseTimestamp; + function toProtocolTimestamp(at2) { if (at2.t_ms === "never") { return { t_s: "never" }; } @@ -12185,7 +11906,7 @@ var AbsoluteTime; t_s: Math.floor(at2.t_ms / 1e3) }; } - AbsoluteTime2.toTimestamp = toTimestamp; + AbsoluteTime2.toProtocolTimestamp = toProtocolTimestamp; function isBetween(t4, start, end) { if (cmp(t4, start) < 0) { return false; @@ -12206,19 +11927,19 @@ var AbsoluteTime; AbsoluteTime2.toIsoString = toIsoString; function addDuration(t1, d5) { if (t1.t_ms === "never" || d5.d_ms === "forever") { - return { t_ms: "never" }; + return { t_ms: "never", [opaque_AbsoluteTime]: true }; } - return { t_ms: t1.t_ms + d5.d_ms }; + return { t_ms: t1.t_ms + d5.d_ms, [opaque_AbsoluteTime]: true }; } AbsoluteTime2.addDuration = addDuration; function subtractDuraction(t1, d5) { if (t1.t_ms === "never") { - return { t_ms: "never" }; + return { t_ms: "never", [opaque_AbsoluteTime]: true }; } if (d5.d_ms === "forever") { - return { t_ms: 0 }; + return { t_ms: 0, [opaque_AbsoluteTime]: true }; } - return { t_ms: Math.max(0, t1.t_ms - d5.d_ms) }; + return { t_ms: Math.max(0, t1.t_ms - d5.d_ms), [opaque_AbsoluteTime]: true }; } AbsoluteTime2.subtractDuraction = subtractDuraction; function stringify(t4) { @@ -12654,6 +12375,7 @@ var TalerSignaturePurpose; TalerSignaturePurpose2[TalerSignaturePurpose2["TEST"] = 4242] = "TEST"; TalerSignaturePurpose2[TalerSignaturePurpose2["MERCHANT_PAYMENT_OK"] = 1104] = "MERCHANT_PAYMENT_OK"; TalerSignaturePurpose2[TalerSignaturePurpose2["MERCHANT_CONTRACT"] = 1101] = "MERCHANT_CONTRACT"; + TalerSignaturePurpose2[TalerSignaturePurpose2["MERCHANT_REFUND"] = 1102] = "MERCHANT_REFUND"; TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_COIN_RECOUP"] = 1203] = "WALLET_COIN_RECOUP"; TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_COIN_LINK"] = 1204] = "WALLET_COIN_LINK"; TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_COIN_RECOUP_REFRESH"] = 1206] = "WALLET_COIN_RECOUP_REFRESH"; @@ -12663,6 +12385,7 @@ var TalerSignaturePurpose; TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_PURSE_MERGE"] = 1213] = "WALLET_PURSE_MERGE"; TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_ACCOUNT_MERGE"] = 1214] = "WALLET_ACCOUNT_MERGE"; TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_PURSE_ECONTRACT"] = 1216] = "WALLET_PURSE_ECONTRACT"; + TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_PURSE_DELETE"] = 1220] = "WALLET_PURSE_DELETE"; TalerSignaturePurpose2[TalerSignaturePurpose2["EXCHANGE_CONFIRM_RECOUP"] = 1039] = "EXCHANGE_CONFIRM_RECOUP"; TalerSignaturePurpose2[TalerSignaturePurpose2["EXCHANGE_CONFIRM_RECOUP_REFRESH"] = 1041] = "EXCHANGE_CONFIRM_RECOUP_REFRESH"; TalerSignaturePurpose2[TalerSignaturePurpose2["ANASTASIS_POLICY_UPLOAD"] = 1400] = "ANASTASIS_POLICY_UPLOAD"; @@ -13290,6 +13013,25 @@ var ReserveTransactionType; })(ReserveTransactionType || (ReserveTransactionType = {})); // ../taler-util/lib/taleruri.js +function parseWithdrawUri(s5) { + const pi = parseProtoInfo(s5, "withdraw"); + if (!pi) { + return void 0; + } + const parts = pi.rest.split("/"); + if (parts.length < 2) { + return void 0; + } + const host = parts[0].toLowerCase(); + const pathSegments = parts.slice(1, parts.length - 1); + const withdrawId = parts[parts.length - 1]; + const p4 = [host, ...pathSegments].join("/"); + return { + type: TalerUriAction.Withdraw, + bankIntegrationApiBaseUrl: canonicalizeBaseUrl(`${pi.innerProto}://${p4}/`), + withdrawalOperationId: withdrawId + }; +} var TalerUriType; (function(TalerUriType2) { TalerUriType2["TalerPay"] = "taler-pay"; @@ -13304,20 +13046,365 @@ var TalerUriType; TalerUriType2["TalerDevExperiment"] = "taler-dev-experiment"; TalerUriType2["Unknown"] = "unknown"; })(TalerUriType || (TalerUriType = {})); +var talerActionPayPull = "pay-pull"; +var talerActionPayPush = "pay-push"; +var talerActionPayTemplate = "pay-template"; +var TalerUriAction; +(function(TalerUriAction2) { + TalerUriAction2["Pay"] = "pay"; + TalerUriAction2["Withdraw"] = "withdraw"; + TalerUriAction2["Refund"] = "refund"; + TalerUriAction2["Tip"] = "tip"; + TalerUriAction2["PayPull"] = "pay-pull"; + TalerUriAction2["PayPush"] = "pay-push"; + TalerUriAction2["PayTemplate"] = "pay-template"; + TalerUriAction2["Exchange"] = "exchange"; + TalerUriAction2["Auditor"] = "auditor"; + TalerUriAction2["Restore"] = "restore"; + TalerUriAction2["DevExperiment"] = "dev-experiment"; + TalerUriAction2["WithdrawExchange"] = "withdraw-exchange"; +})(TalerUriAction || (TalerUriAction = {})); +function parseProtoInfo(s5, action) { + const pfxPlain = `taler://${action}/`; + const pfxHttp = `taler+http://${action}/`; + if (s5.toLowerCase().startsWith(pfxPlain)) { + return { + innerProto: "https", + rest: s5.substring(pfxPlain.length) + }; + } else if (s5.toLowerCase().startsWith(pfxHttp)) { + return { + innerProto: "http", + rest: s5.substring(pfxHttp.length) + }; + } else { + return void 0; + } +} +var parsers = { + [TalerUriAction.Pay]: parsePayUri, + [TalerUriAction.PayPull]: parsePayPullUri, + [TalerUriAction.PayPush]: parsePayPushUri, + [TalerUriAction.PayTemplate]: parsePayTemplateUri, + [TalerUriAction.Restore]: parseRestoreUri, + [TalerUriAction.Refund]: parseRefundUri, + [TalerUriAction.Tip]: parseTipUri, + [TalerUriAction.Withdraw]: parseWithdrawUri, + [TalerUriAction.DevExperiment]: parseDevExperimentUri, + [TalerUriAction.Exchange]: parseExchangeUri, + [TalerUriAction.Auditor]: parseAuditorUri, + [TalerUriAction.WithdrawExchange]: parseWithdrawExchangeUri +}; +function parsePayUri(s5) { + var _a2, _b, _c; + const pi = parseProtoInfo(s5, "pay"); + if (!pi) { + return void 0; + } + const c4 = pi == null ? void 0 : pi.rest.split("?"); + const q4 = new URLSearchParams2((_a2 = c4[1]) != null ? _a2 : ""); + const claimToken = (_b = q4.get("c")) != null ? _b : void 0; + const noncePriv = (_c = q4.get("n")) != null ? _c : void 0; + const parts = c4[0].split("/"); + if (parts.length < 3) { + return void 0; + } + const host = parts[0].toLowerCase(); + const sessionId = parts[parts.length - 1]; + const orderId = parts[parts.length - 2]; + const pathSegments = parts.slice(1, parts.length - 2); + const p4 = [host, ...pathSegments].join("/"); + const merchantBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${p4}/`); + return { + type: TalerUriAction.Pay, + merchantBaseUrl, + orderId, + sessionId, + claimToken, + noncePriv + }; +} +function parsePayTemplateUri(uriString) { + var _a2; + const pi = parseProtoInfo(uriString, talerActionPayTemplate); + if (!pi) { + return void 0; + } + const c4 = pi.rest.split("?"); + const parts = c4[0].split("/"); + if (parts.length < 2) { + return void 0; + } + const q4 = new URLSearchParams2((_a2 = c4[1]) != null ? _a2 : ""); + const params = {}; + q4.forEach((v3, k4) => { + params[k4] = v3; + }); + const host = parts[0].toLowerCase(); + const templateId = parts[parts.length - 1]; + const pathSegments = parts.slice(1, parts.length - 1); + const hostAndSegments = [host, ...pathSegments].join("/"); + const merchantBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`); + return { + type: TalerUriAction.PayTemplate, + merchantBaseUrl, + templateId, + templateParams: params + }; +} +function parsePayPushUri(s5) { + const pi = parseProtoInfo(s5, talerActionPayPush); + if (!pi) { + return void 0; + } + const c4 = pi == null ? void 0 : pi.rest.split("?"); + const parts = c4[0].split("/"); + if (parts.length < 2) { + return void 0; + } + const host = parts[0].toLowerCase(); + const contractPriv = parts[parts.length - 1]; + const pathSegments = parts.slice(1, parts.length - 1); + const hostAndSegments = [host, ...pathSegments].join("/"); + const exchangeBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`); + return { + type: TalerUriAction.PayPush, + exchangeBaseUrl, + contractPriv + }; +} +function parsePayPullUri(s5) { + const pi = parseProtoInfo(s5, talerActionPayPull); + if (!pi) { + return void 0; + } + const c4 = pi == null ? void 0 : pi.rest.split("?"); + const parts = c4[0].split("/"); + if (parts.length < 2) { + return void 0; + } + const host = parts[0].toLowerCase(); + const contractPriv = parts[parts.length - 1]; + const pathSegments = parts.slice(1, parts.length - 1); + const hostAndSegments = [host, ...pathSegments].join("/"); + const exchangeBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`); + return { + type: TalerUriAction.PayPull, + exchangeBaseUrl, + contractPriv + }; +} +function parseTipUri(s5) { + const pi = parseProtoInfo(s5, "tip"); + if (!pi) { + return void 0; + } + const c4 = pi == null ? void 0 : pi.rest.split("?"); + const parts = c4[0].split("/"); + if (parts.length < 2) { + return void 0; + } + const host = parts[0].toLowerCase(); + const tipId = parts[parts.length - 1]; + const pathSegments = parts.slice(1, parts.length - 1); + const hostAndSegments = [host, ...pathSegments].join("/"); + const merchantBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`); + return { + type: TalerUriAction.Tip, + merchantBaseUrl, + merchantTipId: tipId + }; +} +function parseExchangeUri(s5) { + const pi = parseProtoInfo(s5, "exchange"); + if (!pi) { + return void 0; + } + const c4 = pi == null ? void 0 : pi.rest.split("?"); + const parts = c4[0].split("/"); + if (parts.length < 2) { + return void 0; + } + const host = parts[0].toLowerCase(); + const exchangePub = parts[parts.length - 1]; + const pathSegments = parts.slice(1, parts.length - 1); + const hostAndSegments = [host, ...pathSegments].join("/"); + const exchangeBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`); + return { + type: TalerUriAction.Exchange, + exchangeBaseUrl, + exchangePub + }; +} +function parseWithdrawExchangeUri(s5) { + var _a2, _b; + const pi = parseProtoInfo(s5, "withdraw-exchange"); + if (!pi) { + return void 0; + } + const c4 = pi == null ? void 0 : pi.rest.split("?"); + const parts = c4[0].split("/"); + if (parts.length < 2) { + return void 0; + } + const host = parts[0].toLowerCase(); + const exchangePub = parts[parts.length - 1]; + const pathSegments = parts.slice(1, parts.length - 1); + const hostAndSegments = [host, ...pathSegments].join("/"); + const exchangeBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`); + const q4 = new URLSearchParams2((_a2 = c4[1]) != null ? _a2 : ""); + const amount = (_b = q4.get("a")) != null ? _b : void 0; + return { + type: TalerUriAction.WithdrawExchange, + exchangeBaseUrl, + exchangePub, + amount + }; +} +function parseAuditorUri(s5) { + const pi = parseProtoInfo(s5, "auditor"); + if (!pi) { + return void 0; + } + const c4 = pi == null ? void 0 : pi.rest.split("?"); + const parts = c4[0].split("/"); + if (parts.length < 2) { + return void 0; + } + const host = parts[0].toLowerCase(); + const auditorPub = parts[parts.length - 1]; + const pathSegments = parts.slice(1, parts.length - 1); + const hostAndSegments = [host, ...pathSegments].join("/"); + const auditorBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`); + return { + type: TalerUriAction.Auditor, + auditorBaseUrl, + auditorPub + }; +} +function parseRefundUri(s5) { + const pi = parseProtoInfo(s5, "refund"); + if (!pi) { + return void 0; + } + const c4 = pi == null ? void 0 : pi.rest.split("?"); + const parts = c4[0].split("/"); + if (parts.length < 3) { + return void 0; + } + const host = parts[0].toLowerCase(); + const sessionId = parts[parts.length - 1]; + const orderId = parts[parts.length - 2]; + const pathSegments = parts.slice(1, parts.length - 2); + const hostAndSegments = [host, ...pathSegments].join("/"); + const merchantBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`); + return { + type: TalerUriAction.Refund, + merchantBaseUrl, + orderId + }; +} +function parseDevExperimentUri(s5) { + const pi = parseProtoInfo(s5, "dev-experiment"); + const c4 = pi == null ? void 0 : pi.rest.split("?"); + if (!c4) { + return void 0; + } + const parts = c4[0].split("/"); + return { + type: TalerUriAction.DevExperiment, + devExperimentId: parts[0] + }; +} +function parseRestoreUri(uri) { + const pi = parseProtoInfo(uri, "restore"); + if (!pi) { + return void 0; + } + const c4 = pi.rest.split("?"); + const parts = c4[0].split("/"); + if (parts.length < 2) { + return void 0; + } + const walletRootPriv = parts[0]; + if (!walletRootPriv) + return void 0; + const providers = new Array(); + parts[1].split(",").map((name) => { + const url = canonicalizeBaseUrl(`${pi.innerProto}://${decodeURIComponent(name)}/`); + providers.push(url); + }); + return { + type: TalerUriAction.Restore, + walletRootPriv, + providers + }; +} // ../taler-util/lib/transactions-types.js -var ExtendedStatus; -(function(ExtendedStatus2) { - ExtendedStatus2["Pending"] = "pending"; - ExtendedStatus2["Done"] = "done"; - ExtendedStatus2["Aborting"] = "aborting"; - ExtendedStatus2["Aborted"] = "aborted"; - ExtendedStatus2["Failed"] = "failed"; - ExtendedStatus2["KycRequired"] = "kyc-required"; -})(ExtendedStatus || (ExtendedStatus = {})); +var TransactionMajorState; +(function(TransactionMajorState2) { + TransactionMajorState2["None"] = "none"; + TransactionMajorState2["Pending"] = "pending"; + TransactionMajorState2["Done"] = "done"; + TransactionMajorState2["Aborting"] = "aborting"; + TransactionMajorState2["Aborted"] = "aborted"; + TransactionMajorState2["Suspended"] = "suspended"; + TransactionMajorState2["Dialog"] = "dialog"; + TransactionMajorState2["SuspendedAborting"] = "suspended-aborting"; + TransactionMajorState2["Failed"] = "failed"; + TransactionMajorState2["Expired"] = "expired"; + TransactionMajorState2["Deleted"] = "deleted"; +})(TransactionMajorState || (TransactionMajorState = {})); +var TransactionMinorState; +(function(TransactionMinorState2) { + TransactionMinorState2["Unknown"] = "unknown"; + TransactionMinorState2["Deposit"] = "deposit"; + TransactionMinorState2["KycRequired"] = "kyc"; + TransactionMinorState2["AmlRequired"] = "aml"; + TransactionMinorState2["MergeKycRequired"] = "merge-kyc"; + TransactionMinorState2["Track"] = "track"; + TransactionMinorState2["SubmitPayment"] = "submit-payment"; + TransactionMinorState2["RebindSession"] = "rebind-session"; + TransactionMinorState2["Refresh"] = "refresh"; + TransactionMinorState2["Pickup"] = "pickup"; + TransactionMinorState2["AutoRefund"] = "auto-refund"; + TransactionMinorState2["User"] = "user"; + TransactionMinorState2["Bank"] = "bank"; + TransactionMinorState2["Exchange"] = "exchange"; + TransactionMinorState2["ClaimProposal"] = "claim-proposal"; + TransactionMinorState2["CheckRefund"] = "check-refund"; + TransactionMinorState2["CreatePurse"] = "create-purse"; + TransactionMinorState2["DeletePurse"] = "delete-purse"; + TransactionMinorState2["Ready"] = "ready"; + TransactionMinorState2["Merge"] = "merge"; + TransactionMinorState2["Repurchase"] = "repurchase"; + TransactionMinorState2["BankRegisterReserve"] = "bank-register-reserve"; + TransactionMinorState2["BankConfirmTransfer"] = "bank-confirm-transfer"; + TransactionMinorState2["WithdrawCoins"] = "withdraw-coins"; + TransactionMinorState2["ExchangeWaitReserve"] = "exchange-wait-reserve"; + TransactionMinorState2["AbortingBank"] = "aborting-bank"; + TransactionMinorState2["Aborting"] = "aborting"; + TransactionMinorState2["Refused"] = "refused"; + TransactionMinorState2["Withdraw"] = "withdraw"; + TransactionMinorState2["MerchantOrderProposed"] = "merchant-order-proposed"; + TransactionMinorState2["Proposed"] = "proposed"; + TransactionMinorState2["RefundAvailable"] = "refund-available"; + TransactionMinorState2["AcceptRefund"] = "accept-refund"; +})(TransactionMinorState || (TransactionMinorState = {})); +var TransactionAction; +(function(TransactionAction2) { + TransactionAction2["Delete"] = "delete"; + TransactionAction2["Suspend"] = "suspend"; + TransactionAction2["Resume"] = "resume"; + TransactionAction2["Abort"] = "abort"; + TransactionAction2["Fail"] = "fail"; + TransactionAction2["Retry"] = "retry"; +})(TransactionAction || (TransactionAction = {})); var TransactionType; (function(TransactionType2) { TransactionType2["Withdrawal"] = "withdrawal"; + TransactionType2["InternalWithdrawal"] = "internal-withdrawal"; TransactionType2["Payment"] = "payment"; TransactionType2["Refund"] = "refund"; TransactionType2["Refresh"] = "refresh"; @@ -13342,6 +13429,21 @@ var PaymentStatus; })(PaymentStatus || (PaymentStatus = {})); // ../taler-util/lib/wallet-types.js +var TransactionAmountMode; +(function(TransactionAmountMode2) { + TransactionAmountMode2["Effective"] = "effective"; + TransactionAmountMode2["Raw"] = "raw"; +})(TransactionAmountMode || (TransactionAmountMode = {})); +var codecForConvertAmountRequest = buildCodecForObject().property("amount", codecForAmountString()).property("type", codecForEither(codecForConstString(TransactionAmountMode.Raw), codecForConstString(TransactionAmountMode.Effective))).build("ConvertAmountRequest"); +var codecForGetAmountRequest = buildCodecForObject().property("currency", codecForString()).build("GetAmountRequest"); +var codecForGetPlanForWalletInitiatedOperation = () => buildCodecForObject().property("mode", codecForEither(codecForConstString(TransactionAmountMode.Raw), codecForConstString(TransactionAmountMode.Effective))).property("instructedAmount", codecForAmountString()); +var codecForGetPlanForWithdrawRequest = codecForGetPlanForWalletInitiatedOperation().property("type", codecForConstString(TransactionType.Withdrawal)).property("exchangeUrl", codecOptional(codecForString())).build("GetPlanForWithdrawRequest"); +var codecForGetPlanForDepositRequest = codecForGetPlanForWalletInitiatedOperation().property("type", codecForConstString(TransactionType.Deposit)).property("account", codecForString()).build("GetPlanForDepositRequest"); +var codecForGetPlanForPushDebitRequest = codecForGetPlanForWalletInitiatedOperation().property("type", codecForConstString(TransactionType.PeerPushDebit)).build("GetPlanForPushDebitRequest"); +var codecForGetPlanForPullCreditRequest = codecForGetPlanForWalletInitiatedOperation().property("type", codecForConstString(TransactionType.PeerPullCredit)).property("exchangeUrl", codecForString()).build("GetPlanForPullCreditRequest"); +var codecForGetPlanForPaymentRequest = buildCodecForObject().property("type", codecForConstString(TransactionType.Payment)).property("maxDepositFee", codecForAmountString()).property("maxWireFee", codecForAmountString()).build("GetPlanForPaymentRequest"); +var codecForGetPlanForPullDebitRequest = buildCodecForObject().property("type", codecForConstString(TransactionType.PeerPullDebit)).build("GetPlanForPullDebitRequest"); +var codecForGetPlanForPushCreditRequest = buildCodecForObject().property("type", codecForConstString(TransactionType.PeerPushCredit)).build("GetPlanForPushCreditRequest"); var ScopeType; (function(ScopeType2) { ScopeType2["Global"] = "global"; @@ -13374,6 +13476,8 @@ var RefreshReason; RefreshReason2["PayPeerPull"] = "pay-peer-pull"; RefreshReason2["Refund"] = "refund"; RefreshReason2["AbortPay"] = "abort-pay"; + RefreshReason2["AbortDeposit"] = "abort-deposit"; + RefreshReason2["AbortPeerPushDebit"] = "abort-peer-push-debit"; RefreshReason2["Recoup"] = "recoup"; RefreshReason2["BackupRestored"] = "backup-restored"; RefreshReason2["Scheduled"] = "scheduled"; @@ -13959,6 +14063,95 @@ var ContractTermsUtil; ContractTermsUtil2.hashContractTerms = hashContractTerms; })(ContractTermsUtil || (ContractTermsUtil = {})); +// ../taler-util/lib/iban.js +var ccZero = "0".charCodeAt(0); +var ccNine = "9".charCodeAt(0); +var ccA = "A".charCodeAt(0); +var ccZ = "Z".charCodeAt(0); + +// ../taler-util/lib/transaction-test-data.js +var sampleWalletCoreTransactions = [ + { + type: TransactionType.Payment, + txState: { + major: TransactionMajorState.Done + }, + amountRaw: "KUDOS:10", + amountEffective: "KUDOS:10", + totalRefundRaw: "KUDOS:0", + totalRefundEffective: "KUDOS:0", + status: PaymentStatus.Paid, + refundPending: void 0, + posConfirmation: void 0, + pending: false, + refunds: [], + timestamp: { + t_s: 1677166045 + }, + transactionId: "txn:payment:NRRD9KJ8970P5HDAGPW1MBA6HZHB1XMFKF5M3CNR6WA0GT98DHY0", + proposalId: "NRRD9KJ8970P5HDAGPW1MBA6HZHB1XMFKF5M3CNR6WA0GT98DHY0", + info: { + merchant: { + name: "woocommerce", + website: "woocommerce.demo.taler.net", + email: "foo@example.com", + address: {}, + jurisdiction: {} + }, + orderId: "wc_order_KQCRldghIgDRB-100", + products: [ + { + description: "Using GCC", + quantity: 1, + price: "KUDOS:10", + product_id: "28" + } + ], + summary: "WooTalerShop #100", + contractTermsHash: "A02E1M6ARWKBJ87K2TV4S6WQ4X5YH7BRVR6MYCHCTVAED8MBXTFD6PZ5Q50Y7Z5K18PYBTDA14NQ56XPC1VCQW1EVRWTSB7ZYT65B5G", + fulfillmentUrl: "https://woocommerce.demo.taler.net/?wc-api=wc_gnutaler_gateway&order_id=wc_order_KQCRldghIgDRB-100" + }, + refundQueryActive: false, + frozen: false + }, + { + type: TransactionType.Refresh, + txState: { + major: TransactionMajorState.Pending + }, + refreshReason: RefreshReason.PayMerchant, + amountEffective: "KUDOS:0", + amountRaw: "KUDOS:0", + refreshInputAmount: "KUDOS:1.5", + refreshOutputAmount: "KUDOS:1.4", + originatingTransactionId: "txn:proposal:ZCGBZFE8KZ1CBYYGSC3ZC8E40KVJWV16VYCTHGC8FFSVZ5HD24BG", + pending: true, + timestamp: { + t_s: 1681376214 + }, + transactionId: "txn:refresh:QQSWHHXCRQ269G0E3RW14JMC6F7NFDYDW26NSFHRTXSKDS6CMCZ0", + frozen: false, + error: { + code: 7029, + when: { + t_ms: 1681376473665 + }, + hint: "Error (WALLET_REFRESH_GROUP_INCOMPLETE)", + numErrors: 1, + errors: [ + { + code: 7001, + when: { + t_ms: 1681376473189 + }, + hint: "unexpected exception (message: exchange wire fee signature invalid)", + stack: " at validateWireInfo (../taler-wallet-core-qjs.mjs:23166)\n" + } + ] + } + } +]; + // ../taler-util/lib/http-common.js var textEncoder = new TextEncoder(); var logger5 = new Logger("http.ts"); @@ -13966,76 +14159,800 @@ var logger5 = new Logger("http.ts"); // ../taler-util/lib/index.browser.js loadBrowserPrng(); +// ../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/dist/preact.module.js +var n; +var l; +var u; +var i; +var t; +var o; +var r; +var f = {}; +var e = []; +var c = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i; +function s(n2, l3) { + for (var u4 in l3) + n2[u4] = l3[u4]; + return n2; +} +function a(n2) { + var l3 = n2.parentNode; + l3 && l3.removeChild(n2); +} +function h(l3, u4, i4) { + var t4, o3, r3, f3 = {}; + for (r3 in u4) + "key" == r3 ? t4 = u4[r3] : "ref" == r3 ? o3 = u4[r3] : f3[r3] = u4[r3]; + if (arguments.length > 2 && (f3.children = arguments.length > 3 ? n.call(arguments, 2) : i4), "function" == typeof l3 && null != l3.defaultProps) + for (r3 in l3.defaultProps) + void 0 === f3[r3] && (f3[r3] = l3.defaultProps[r3]); + return v(l3, f3, t4, o3, null); +} +function v(n2, i4, t4, o3, r3) { + var f3 = { type: n2, props: i4, key: t4, ref: o3, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: null == r3 ? ++u : r3 }; + return null == r3 && null != l.vnode && l.vnode(f3), f3; +} +function p2(n2) { + return n2.children; +} +function d(n2, l3) { + this.props = n2, this.context = l3; +} +function _(n2, l3) { + if (null == l3) + return n2.__ ? _(n2.__, n2.__.__k.indexOf(n2) + 1) : null; + for (var u4; l3 < n2.__k.length; l3++) + if (null != (u4 = n2.__k[l3]) && null != u4.__e) + return u4.__e; + return "function" == typeof n2.type ? _(n2) : null; +} +function k(n2) { + var l3, u4; + if (null != (n2 = n2.__) && null != n2.__c) { + for (n2.__e = n2.__c.base = null, l3 = 0; l3 < n2.__k.length; l3++) + if (null != (u4 = n2.__k[l3]) && null != u4.__e) { + n2.__e = n2.__c.base = u4.__e; + break; + } + return k(n2); + } +} +function b(n2) { + (!n2.__d && (n2.__d = true) && t.push(n2) && !g.__r++ || o !== l.debounceRendering) && ((o = l.debounceRendering) || setTimeout)(g); +} +function g() { + for (var n2; g.__r = t.length; ) + n2 = t.sort(function(n3, l3) { + return n3.__v.__b - l3.__v.__b; + }), t = [], n2.some(function(n3) { + var l3, u4, i4, t4, o3, r3; + n3.__d && (o3 = (t4 = (l3 = n3).__v).__e, (r3 = l3.__P) && (u4 = [], (i4 = s({}, t4)).__v = t4.__v + 1, j(r3, t4, i4, l3.__n, void 0 !== r3.ownerSVGElement, null != t4.__h ? [o3] : null, u4, null == o3 ? _(t4) : o3, t4.__h), z(u4, t4), t4.__e != o3 && k(t4))); + }); +} +function w(n2, l3, u4, i4, t4, o3, r3, c4, s5, a5) { + var h5, y5, d5, k4, b4, g4, w5, x6 = i4 && i4.__k || e, C3 = x6.length; + for (u4.__k = [], h5 = 0; h5 < l3.length; h5++) + if (null != (k4 = u4.__k[h5] = null == (k4 = l3[h5]) || "boolean" == typeof k4 ? null : "string" == typeof k4 || "number" == typeof k4 || "bigint" == typeof k4 ? v(null, k4, null, null, k4) : Array.isArray(k4) ? v(p2, { children: k4 }, null, null, null) : k4.__b > 0 ? v(k4.type, k4.props, k4.key, k4.ref ? k4.ref : null, k4.__v) : k4)) { + if (k4.__ = u4, k4.__b = u4.__b + 1, null === (d5 = x6[h5]) || d5 && k4.key == d5.key && k4.type === d5.type) + x6[h5] = void 0; + else + for (y5 = 0; y5 < C3; y5++) { + if ((d5 = x6[y5]) && k4.key == d5.key && k4.type === d5.type) { + x6[y5] = void 0; + break; + } + d5 = null; + } + j(n2, k4, d5 = d5 || f, t4, o3, r3, c4, s5, a5), b4 = k4.__e, (y5 = k4.ref) && d5.ref != y5 && (w5 || (w5 = []), d5.ref && w5.push(d5.ref, null, k4), w5.push(y5, k4.__c || b4, k4)), null != b4 ? (null == g4 && (g4 = b4), "function" == typeof k4.type && k4.__k === d5.__k ? k4.__d = s5 = m(k4, s5, n2) : s5 = A2(n2, k4, d5, x6, b4, s5), "function" == typeof u4.type && (u4.__d = s5)) : s5 && d5.__e == s5 && s5.parentNode != n2 && (s5 = _(d5)); + } + for (u4.__e = g4, h5 = C3; h5--; ) + null != x6[h5] && N(x6[h5], x6[h5]); + if (w5) + for (h5 = 0; h5 < w5.length; h5++) + M2(w5[h5], w5[++h5], w5[++h5]); +} +function m(n2, l3, u4) { + for (var i4, t4 = n2.__k, o3 = 0; t4 && o3 < t4.length; o3++) + (i4 = t4[o3]) && (i4.__ = n2, l3 = "function" == typeof i4.type ? m(i4, l3, u4) : A2(u4, i4, i4, t4, i4.__e, l3)); + return l3; +} +function x2(n2, l3) { + return l3 = l3 || [], null == n2 || "boolean" == typeof n2 || (Array.isArray(n2) ? n2.some(function(n3) { + x2(n3, l3); + }) : l3.push(n2)), l3; +} +function A2(n2, l3, u4, i4, t4, o3) { + var r3, f3, e4; + if (void 0 !== l3.__d) + r3 = l3.__d, l3.__d = void 0; + else if (null == u4 || t4 != o3 || null == t4.parentNode) + n: + if (null == o3 || o3.parentNode !== n2) + n2.appendChild(t4), r3 = null; + else { + for (f3 = o3, e4 = 0; (f3 = f3.nextSibling) && e4 < i4.length; e4 += 1) + if (f3 == t4) + break n; + n2.insertBefore(t4, o3), r3 = o3; + } + return void 0 !== r3 ? r3 : t4.nextSibling; +} +function C(n2, l3, u4, i4, t4) { + var o3; + for (o3 in u4) + "children" === o3 || "key" === o3 || o3 in l3 || H(n2, o3, null, u4[o3], i4); + for (o3 in l3) + t4 && "function" != typeof l3[o3] || "children" === o3 || "key" === o3 || "value" === o3 || "checked" === o3 || u4[o3] === l3[o3] || H(n2, o3, l3[o3], u4[o3], i4); +} +function $(n2, l3, u4) { + "-" === l3[0] ? n2.setProperty(l3, u4) : n2[l3] = null == u4 ? "" : "number" != typeof u4 || c.test(l3) ? u4 : u4 + "px"; +} +function H(n2, l3, u4, i4, t4) { + var o3; + n: + if ("style" === l3) + if ("string" == typeof u4) + n2.style.cssText = u4; + else { + if ("string" == typeof i4 && (n2.style.cssText = i4 = ""), i4) + for (l3 in i4) + u4 && l3 in u4 || $(n2.style, l3, ""); + if (u4) + for (l3 in u4) + i4 && u4[l3] === i4[l3] || $(n2.style, l3, u4[l3]); + } + else if ("o" === l3[0] && "n" === l3[1]) + o3 = l3 !== (l3 = l3.replace(/Capture$/, "")), l3 = l3.toLowerCase() in n2 ? l3.toLowerCase().slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + o3] = u4, u4 ? i4 || n2.addEventListener(l3, o3 ? T : I2, o3) : n2.removeEventListener(l3, o3 ? T : I2, o3); + else if ("dangerouslySetInnerHTML" !== l3) { + if (t4) + l3 = l3.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); + else if ("href" !== l3 && "list" !== l3 && "form" !== l3 && "tabIndex" !== l3 && "download" !== l3 && l3 in n2) + try { + n2[l3] = null == u4 ? "" : u4; + break n; + } catch (n3) { + } + "function" == typeof u4 || (null == u4 || false === u4 && -1 == l3.indexOf("-") ? n2.removeAttribute(l3) : n2.setAttribute(l3, u4)); + } +} +function I2(n2) { + this.l[n2.type + false](l.event ? l.event(n2) : n2); +} +function T(n2) { + this.l[n2.type + true](l.event ? l.event(n2) : n2); +} +function j(n2, u4, i4, t4, o3, r3, f3, e4, c4) { + var a5, h5, v3, y5, _3, k4, b4, g4, m5, x6, A4, C3, $2, H5, I5, T5 = u4.type; + if (void 0 !== u4.constructor) + return null; + null != i4.__h && (c4 = i4.__h, e4 = u4.__e = i4.__e, u4.__h = null, r3 = [e4]), (a5 = l.__b) && a5(u4); + try { + n: + if ("function" == typeof T5) { + if (g4 = u4.props, m5 = (a5 = T5.contextType) && t4[a5.__c], x6 = a5 ? m5 ? m5.props.value : a5.__ : t4, i4.__c ? b4 = (h5 = u4.__c = i4.__c).__ = h5.__E : ("prototype" in T5 && T5.prototype.render ? u4.__c = h5 = new T5(g4, x6) : (u4.__c = h5 = new d(g4, x6), h5.constructor = T5, h5.render = O), m5 && m5.sub(h5), h5.props = g4, h5.state || (h5.state = {}), h5.context = x6, h5.__n = t4, v3 = h5.__d = true, h5.__h = [], h5._sb = []), null == h5.__s && (h5.__s = h5.state), null != T5.getDerivedStateFromProps && (h5.__s == h5.state && (h5.__s = s({}, h5.__s)), s(h5.__s, T5.getDerivedStateFromProps(g4, h5.__s))), y5 = h5.props, _3 = h5.state, v3) + null == T5.getDerivedStateFromProps && null != h5.componentWillMount && h5.componentWillMount(), null != h5.componentDidMount && h5.__h.push(h5.componentDidMount); + else { + if (null == T5.getDerivedStateFromProps && g4 !== y5 && null != h5.componentWillReceiveProps && h5.componentWillReceiveProps(g4, x6), !h5.__e && null != h5.shouldComponentUpdate && false === h5.shouldComponentUpdate(g4, h5.__s, x6) || u4.__v === i4.__v) { + for (h5.props = g4, h5.state = h5.__s, u4.__v !== i4.__v && (h5.__d = false), h5.__v = u4, u4.__e = i4.__e, u4.__k = i4.__k, u4.__k.forEach(function(n3) { + n3 && (n3.__ = u4); + }), A4 = 0; A4 < h5._sb.length; A4++) + h5.__h.push(h5._sb[A4]); + h5._sb = [], h5.__h.length && f3.push(h5); + break n; + } + null != h5.componentWillUpdate && h5.componentWillUpdate(g4, h5.__s, x6), null != h5.componentDidUpdate && h5.__h.push(function() { + h5.componentDidUpdate(y5, _3, k4); + }); + } + if (h5.context = x6, h5.props = g4, h5.__v = u4, h5.__P = n2, C3 = l.__r, $2 = 0, "prototype" in T5 && T5.prototype.render) { + for (h5.state = h5.__s, h5.__d = false, C3 && C3(u4), a5 = h5.render(h5.props, h5.state, h5.context), H5 = 0; H5 < h5._sb.length; H5++) + h5.__h.push(h5._sb[H5]); + h5._sb = []; + } else + do { + h5.__d = false, C3 && C3(u4), a5 = h5.render(h5.props, h5.state, h5.context), h5.state = h5.__s; + } while (h5.__d && ++$2 < 25); + h5.state = h5.__s, null != h5.getChildContext && (t4 = s(s({}, t4), h5.getChildContext())), v3 || null == h5.getSnapshotBeforeUpdate || (k4 = h5.getSnapshotBeforeUpdate(y5, _3)), I5 = null != a5 && a5.type === p2 && null == a5.key ? a5.props.children : a5, w(n2, Array.isArray(I5) ? I5 : [I5], u4, i4, t4, o3, r3, f3, e4, c4), h5.base = u4.__e, u4.__h = null, h5.__h.length && f3.push(h5), b4 && (h5.__E = h5.__ = null), h5.__e = false; + } else + null == r3 && u4.__v === i4.__v ? (u4.__k = i4.__k, u4.__e = i4.__e) : u4.__e = L2(i4.__e, u4, i4, t4, o3, r3, f3, c4); + (a5 = l.diffed) && a5(u4); + } catch (n3) { + u4.__v = null, (c4 || null != r3) && (u4.__e = e4, u4.__h = !!c4, r3[r3.indexOf(e4)] = null), l.__e(n3, u4, i4); + } +} +function z(n2, u4) { + l.__c && l.__c(u4, n2), n2.some(function(u5) { + try { + n2 = u5.__h, u5.__h = [], n2.some(function(n3) { + n3.call(u5); + }); + } catch (n3) { + l.__e(n3, u5.__v); + } + }); +} +function L2(l3, u4, i4, t4, o3, r3, e4, c4) { + var s5, h5, v3, y5 = i4.props, p4 = u4.props, d5 = u4.type, k4 = 0; + if ("svg" === d5 && (o3 = true), null != r3) { + for (; k4 < r3.length; k4++) + if ((s5 = r3[k4]) && "setAttribute" in s5 == !!d5 && (d5 ? s5.localName === d5 : 3 === s5.nodeType)) { + l3 = s5, r3[k4] = null; + break; + } + } + if (null == l3) { + if (null === d5) + return document.createTextNode(p4); + l3 = o3 ? document.createElementNS("http://www.w3.org/2000/svg", d5) : document.createElement(d5, p4.is && p4), r3 = null, c4 = false; + } + if (null === d5) + y5 === p4 || c4 && l3.data === p4 || (l3.data = p4); + else { + if (r3 = r3 && n.call(l3.childNodes), h5 = (y5 = i4.props || f).dangerouslySetInnerHTML, v3 = p4.dangerouslySetInnerHTML, !c4) { + if (null != r3) + for (y5 = {}, k4 = 0; k4 < l3.attributes.length; k4++) + y5[l3.attributes[k4].name] = l3.attributes[k4].value; + (v3 || h5) && (v3 && (h5 && v3.__html == h5.__html || v3.__html === l3.innerHTML) || (l3.innerHTML = v3 && v3.__html || "")); + } + if (C(l3, p4, y5, o3, c4), v3) + u4.__k = []; + else if (k4 = u4.props.children, w(l3, Array.isArray(k4) ? k4 : [k4], u4, i4, t4, o3 && "foreignObject" !== d5, r3, e4, r3 ? r3[0] : i4.__k && _(i4, 0), c4), null != r3) + for (k4 = r3.length; k4--; ) + null != r3[k4] && a(r3[k4]); + c4 || ("value" in p4 && void 0 !== (k4 = p4.value) && (k4 !== l3.value || "progress" === d5 && !k4 || "option" === d5 && k4 !== y5.value) && H(l3, "value", k4, y5.value, false), "checked" in p4 && void 0 !== (k4 = p4.checked) && k4 !== l3.checked && H(l3, "checked", k4, y5.checked, false)); + } + return l3; +} +function M2(n2, u4, i4) { + try { + "function" == typeof n2 ? n2(u4) : n2.current = u4; + } catch (n3) { + l.__e(n3, i4); + } +} +function N(n2, u4, i4) { + var t4, o3; + if (l.unmount && l.unmount(n2), (t4 = n2.ref) && (t4.current && t4.current !== n2.__e || M2(t4, null, u4)), null != (t4 = n2.__c)) { + if (t4.componentWillUnmount) + try { + t4.componentWillUnmount(); + } catch (n3) { + l.__e(n3, u4); + } + t4.base = t4.__P = null, n2.__c = void 0; + } + if (t4 = n2.__k) + for (o3 = 0; o3 < t4.length; o3++) + t4[o3] && N(t4[o3], u4, i4 || "function" != typeof n2.type); + i4 || null == n2.__e || a(n2.__e), n2.__ = n2.__e = n2.__d = void 0; +} +function O(n2, l3, u4) { + return this.constructor(n2, u4); +} +function P(u4, i4, t4) { + var o3, r3, e4; + l.__ && l.__(u4, i4), r3 = (o3 = "function" == typeof t4) ? null : t4 && t4.__k || i4.__k, e4 = [], j(i4, u4 = (!o3 && t4 || i4).__k = h(p2, null, [u4]), r3 || f, f, void 0 !== i4.ownerSVGElement, !o3 && t4 ? [t4] : r3 ? null : i4.firstChild ? n.call(i4.childNodes) : null, e4, !o3 && t4 ? t4 : r3 ? r3.__e : i4.firstChild, o3), z(e4, u4); +} +function q(l3, u4, i4) { + var t4, o3, r3, f3 = s({}, l3.props); + for (r3 in u4) + "key" == r3 ? t4 = u4[r3] : "ref" == r3 ? o3 = u4[r3] : f3[r3] = u4[r3]; + return arguments.length > 2 && (f3.children = arguments.length > 3 ? n.call(arguments, 2) : i4), v(l3.type, f3, t4 || l3.key, o3 || l3.ref, null); +} +function B(n2, l3) { + var u4 = { __c: l3 = "__cC" + r++, __: n2, Consumer: function(n3, l4) { + return n3.children(l4); + }, Provider: function(n3) { + var u5, i4; + return this.getChildContext || (u5 = [], (i4 = {})[l3] = this, this.getChildContext = function() { + return i4; + }, this.shouldComponentUpdate = function(n4) { + this.props.value !== n4.value && u5.some(b); + }, this.sub = function(n4) { + u5.push(n4); + var l4 = n4.componentWillUnmount; + n4.componentWillUnmount = function() { + u5.splice(u5.indexOf(n4), 1), l4 && l4.call(n4); + }; + }), n3.children; + } }; + return u4.Provider.__ = u4.Consumer.contextType = u4; +} +n = e.slice, l = { __e: function(n2, l3, u4, i4) { + for (var t4, o3, r3; l3 = l3.__; ) + if ((t4 = l3.__c) && !t4.__) + try { + if ((o3 = t4.constructor) && null != o3.getDerivedStateFromError && (t4.setState(o3.getDerivedStateFromError(n2)), r3 = t4.__d), null != t4.componentDidCatch && (t4.componentDidCatch(n2, i4 || {}), r3 = t4.__d), r3) + return t4.__E = t4; + } catch (l4) { + n2 = l4; + } + throw n2; +} }, u = 0, i = function(n2) { + return null != n2 && void 0 === n2.constructor; +}, d.prototype.setState = function(n2, l3) { + var u4; + u4 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = s({}, this.state), "function" == typeof n2 && (n2 = n2(s({}, u4), this.props)), n2 && s(u4, n2), null != n2 && this.__v && (l3 && this._sb.push(l3), b(this)); +}, d.prototype.forceUpdate = function(n2) { + this.__v && (this.__e = true, n2 && this.__h.push(n2), b(this)); +}, d.prototype.render = p2, t = [], g.__r = 0, r = 0; + +// ../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/hooks/dist/hooks.module.js +var t2; +var r2; +var u2; +var i2; +var o2 = 0; +var f2 = []; +var c2 = []; +var e2 = l.__b; +var a2 = l.__r; +var v2 = l.diffed; +var l2 = l.__c; +var m2 = l.unmount; +function d2(t4, u4) { + l.__h && l.__h(r2, t4, o2 || u4), o2 = 0; + var i4 = r2.__H || (r2.__H = { __: [], __h: [] }); + return t4 >= i4.__.length && i4.__.push({ __V: c2 }), i4.__[t4]; +} +function p3(n2) { + return o2 = 1, y(B2, n2); +} +function y(n2, u4, i4) { + var o3 = d2(t2++, 2); + if (o3.t = n2, !o3.__c && (o3.__ = [i4 ? i4(u4) : B2(void 0, u4), function(n3) { + var t4 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t4, n3); + t4 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({})); + }], o3.__c = r2, !r2.u)) { + r2.u = true; + var f3 = r2.shouldComponentUpdate; + r2.shouldComponentUpdate = function(n3, t4, r3) { + if (!o3.__c.__H) + return true; + var u5 = o3.__c.__H.__.filter(function(n4) { + return n4.__c; + }); + if (u5.every(function(n4) { + return !n4.__N; + })) + return !f3 || f3.call(this, n3, t4, r3); + var i5 = false; + return u5.forEach(function(n4) { + if (n4.__N) { + var t5 = n4.__[0]; + n4.__ = n4.__N, n4.__N = void 0, t5 !== n4.__[0] && (i5 = true); + } + }), !(!i5 && o3.__c.props === n3) && (!f3 || f3.call(this, n3, t4, r3)); + }; + } + return o3.__N || o3.__; +} +function h2(u4, i4) { + var o3 = d2(t2++, 3); + !l.__s && z2(o3.__H, i4) && (o3.__ = u4, o3.i = i4, r2.__H.__h.push(o3)); +} +function s2(u4, i4) { + var o3 = d2(t2++, 4); + !l.__s && z2(o3.__H, i4) && (o3.__ = u4, o3.i = i4, r2.__h.push(o3)); +} +function _2(n2) { + return o2 = 5, F(function() { + return { current: n2 }; + }, []); +} +function F(n2, r3) { + var u4 = d2(t2++, 7); + return z2(u4.__H, r3) ? (u4.__V = n2(), u4.i = r3, u4.__h = n2, u4.__V) : u4.__; +} +function T2(n2, t4) { + return o2 = 8, F(function() { + return n2; + }, t4); +} +function q2(n2) { + var u4 = r2.context[n2.__c], i4 = d2(t2++, 9); + return i4.c = n2, u4 ? (null == i4.__ && (i4.__ = true, u4.sub(r2)), u4.props.value) : n2.__; +} +function x3(t4, r3) { + l.useDebugValue && l.useDebugValue(r3 ? r3(t4) : t4); +} +function b2() { + for (var t4; t4 = f2.shift(); ) + if (t4.__P && t4.__H) + try { + t4.__H.__h.forEach(k2), t4.__H.__h.forEach(w2), t4.__H.__h = []; + } catch (r3) { + t4.__H.__h = [], l.__e(r3, t4.__v); + } +} +l.__b = function(n2) { + r2 = null, e2 && e2(n2); +}, l.__r = function(n2) { + a2 && a2(n2), t2 = 0; + var i4 = (r2 = n2.__c).__H; + i4 && (u2 === r2 ? (i4.__h = [], r2.__h = [], i4.__.forEach(function(n3) { + n3.__N && (n3.__ = n3.__N), n3.__V = c2, n3.__N = n3.i = void 0; + })) : (i4.__h.forEach(k2), i4.__h.forEach(w2), i4.__h = [])), u2 = r2; +}, l.diffed = function(t4) { + v2 && v2(t4); + var o3 = t4.__c; + o3 && o3.__H && (o3.__H.__h.length && (1 !== f2.push(o3) && i2 === l.requestAnimationFrame || ((i2 = l.requestAnimationFrame) || j2)(b2)), o3.__H.__.forEach(function(n2) { + n2.i && (n2.__H = n2.i), n2.__V !== c2 && (n2.__ = n2.__V), n2.i = void 0, n2.__V = c2; + })), u2 = r2 = null; +}, l.__c = function(t4, r3) { + r3.some(function(t5) { + try { + t5.__h.forEach(k2), t5.__h = t5.__h.filter(function(n2) { + return !n2.__ || w2(n2); + }); + } catch (u4) { + r3.some(function(n2) { + n2.__h && (n2.__h = []); + }), r3 = [], l.__e(u4, t5.__v); + } + }), l2 && l2(t4, r3); +}, l.unmount = function(t4) { + m2 && m2(t4); + var r3, u4 = t4.__c; + u4 && u4.__H && (u4.__H.__.forEach(function(n2) { + try { + k2(n2); + } catch (n3) { + r3 = n3; + } + }), u4.__H = void 0, r3 && l.__e(r3, u4.__v)); +}; +var g2 = "function" == typeof requestAnimationFrame; +function j2(n2) { + var t4, r3 = function() { + clearTimeout(u4), g2 && cancelAnimationFrame(t4), setTimeout(n2); + }, u4 = setTimeout(r3, 100); + g2 && (t4 = requestAnimationFrame(r3)); +} +function k2(n2) { + var t4 = r2, u4 = n2.__c; + "function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t4; +} +function w2(n2) { + var t4 = r2; + n2.__c = n2.__(), r2 = t4; +} +function z2(n2, t4) { + return !n2 || n2.length !== t4.length || t4.some(function(t5, r3) { + return t5 !== n2[r3]; + }); +} +function B2(n2, t4) { + return "function" == typeof t4 ? t4(n2) : t4; +} + // ../web-util/lib/index.browser.mjs var __defProp2 = Object.defineProperty; var __export = (target, all) => { for (var name in all) __defProp2(target, name, { get: all[name], enumerable: true }); }; -var __async2 = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e4) { - reject(e4); +function memoryMap(backend = /* @__PURE__ */ new Map()) { + const obs = new EventTarget(); + const theMemoryMap = { + onAnyUpdate: (handler) => { + obs.addEventListener(`update`, handler); + obs.addEventListener(`clear`, handler); + return () => { + obs.removeEventListener(`update`, handler); + obs.removeEventListener(`clear`, handler); + }; + }, + onUpdate: (key, handler) => { + obs.addEventListener(`update-${key}`, handler); + obs.addEventListener(`clear`, handler); + return () => { + obs.removeEventListener(`update-${key}`, handler); + obs.removeEventListener(`clear`, handler); + }; + }, + delete: (key) => { + const result = backend.delete(key); + theMemoryMap.size = backend.length; + obs.dispatchEvent(new Event(`update-${key}`)); + obs.dispatchEvent(new Event(`update`)); + return result; + }, + set: (key, value) => { + backend.set(key, value); + theMemoryMap.size = backend.length; + obs.dispatchEvent(new Event(`update-${key}`)); + obs.dispatchEvent(new Event(`update`)); + return theMemoryMap; + }, + clear: () => { + backend.clear(); + obs.dispatchEvent(new Event(`clear`)); + }, + entries: backend.entries.bind(backend), + forEach: backend.forEach.bind(backend), + get: backend.get.bind(backend), + has: backend.has.bind(backend), + keys: backend.keys.bind(backend), + size: backend.size, + values: backend.values.bind(backend), + [Symbol.iterator]: backend[Symbol.iterator], + [Symbol.toStringTag]: "theMemoryMap" + }; + return theMemoryMap; +} +function localStorageMap() { + const obs = new EventTarget(); + const theLocalStorageMap = { + onAnyUpdate: (handler) => { + obs.addEventListener(`update`, handler); + obs.addEventListener(`clear`, handler); + window.addEventListener("storage", handler); + return () => { + window.removeEventListener("storage", handler); + obs.removeEventListener(`update`, handler); + obs.removeEventListener(`clear`, handler); + }; + }, + onUpdate: (key, handler) => { + obs.addEventListener(`update-${key}`, handler); + obs.addEventListener(`clear`, handler); + function handleStorageEvent(ev) { + if (ev.key === null || ev.key === key) { + handler(); + } + } + window.addEventListener("storage", handleStorageEvent); + return () => { + window.removeEventListener("storage", handleStorageEvent); + obs.removeEventListener(`update-${key}`, handler); + obs.removeEventListener(`clear`, handler); + }; + }, + delete: (key) => { + const exists = localStorage.getItem(key) !== null; + localStorage.removeItem(key); + theLocalStorageMap.size = localStorage.length; + obs.dispatchEvent(new Event(`update-${key}`)); + obs.dispatchEvent(new Event(`update`)); + return exists; + }, + set: (key, v3) => { + localStorage.setItem(key, v3); + theLocalStorageMap.size = localStorage.length; + obs.dispatchEvent(new Event(`update-${key}`)); + obs.dispatchEvent(new Event(`update`)); + return theLocalStorageMap; + }, + clear: () => { + localStorage.clear(); + obs.dispatchEvent(new Event(`clear`)); + }, + entries: () => { + let index = 0; + const total = localStorage.length; + return { + next() { + const key = localStorage.key(index); + if (key === null) { + throw Error("key cant be null"); + } + const item = localStorage.getItem(key); + if (item === null) { + throw Error("value cant be null"); + } + if (index == total) + return { done: true, value: [key, item] }; + index = index + 1; + return { done: false, value: [key, item] }; + }, + [Symbol.iterator]() { + return this; + } + }; + }, + forEach: (cb) => { + for (let index = 0; index < localStorage.length; index++) { + const key = localStorage.key(index); + if (key === null) { + throw Error("key cant be null"); + } + const item = localStorage.getItem(key); + if (item === null) { + throw Error("value cant be null"); + } + cb(key, item, theLocalStorageMap); } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e4) { - reject(e4); + }, + get: (key) => { + const item = localStorage.getItem(key); + if (item === null) + return void 0; + return item; + }, + has: (key) => { + return localStorage.getItem(key) === null; + }, + keys: () => { + let index = 0; + const total = localStorage.length; + return { + next() { + const key = localStorage.key(index); + if (key === null) { + throw Error("key cant be null"); + } + if (index == total) + return { done: true, value: key }; + index = index + 1; + return { done: false, value: key }; + }, + [Symbol.iterator]() { + return this; + } + }; + }, + size: localStorage.length, + values: () => { + let index = 0; + const total = localStorage.length; + return { + next() { + const key = localStorage.key(index); + if (key === null) { + throw Error("key cant be null"); + } + const item = localStorage.getItem(key); + if (item === null) { + throw Error("value cant be null"); + } + if (index == total) + return { done: true, value: item }; + index = index + 1; + return { done: false, value: item }; + }, + [Symbol.iterator]() { + return this; + } + }; + }, + [Symbol.iterator]: function() { + return theLocalStorageMap.entries(); + }, + [Symbol.toStringTag]: "theLocalStorageMap" + }; + return theLocalStorageMap; +} +var isFirefox = typeof window !== "undefined" && typeof window["InstallTrigger"] !== "undefined"; +function getAllContent() { + return __async(this, null, function* () { + if (isFirefox) { + return browser.storage.local.get(); + } else { + return chrome.storage.local.get(); + } + }); +} +function updateContent(obj) { + return __async(this, null, function* () { + if (isFirefox) { + return browser.storage.local.set(obj); + } else { + return chrome.storage.local.set(obj); + } + }); +} +function onBrowserStorageUpdate(cb) { + if (isFirefox) { + browser.storage.local.onChanged.addListener(cb); + } else { + chrome.storage.local.onChanged.addListener(cb); + } +} +function browserStorageMap(backend) { + getAllContent().then((content) => { + Object.entries(content != null ? content : {}).forEach(([k4, v3]) => { + backend.set(k4, v3); + }); + }); + backend.onAnyUpdate(() => __async(this, null, function* () { + const result = {}; + for (const [key, value] of backend.entries()) { + result[key] = value; + } + yield updateContent(result); + })); + onBrowserStorageUpdate((changes) => { + const changedItems = Object.keys(changes); + if (changedItems.length === 0) { + backend.clear(); + } else { + for (const key of changedItems) { + if (!changes[key].newValue) { + backend.delete(key); + } else { + if (changes[key].newValue !== changes[key].oldValue) { + backend.set(key, changes[key].newValue); + } + } } - }; - var step = (x6) => x6.done ? resolve(x6.value) : Promise.resolve(x6.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); + } }); -}; -function buildListenerForKey(key, onUpdate) { - return function listenKeyChange() { - const value = window.localStorage.getItem(key); - onUpdate(value != null ? value : void 0); + return backend; +} +function buildStorageKey(name, codec) { + return { + id: name, + codec: codec != null ? codec : codecForString() }; } -function useNotNullLocalStorage(key, initialValue) { - const [storedValue, setStoredValue] = p2(() => { - return typeof window !== "undefined" ? window.localStorage.getItem(key) || initialValue : initialValue; - }); +var supportLocalStorage = typeof window !== "undefined"; +var supportBrowserStorage = typeof chrome !== "undefined" && typeof chrome.storage !== "undefined"; +var storage = function buildStorage() { + if (supportBrowserStorage) { + return browserStorageMap(memoryMap()); + } else if (supportLocalStorage) { + return localStorageMap(); + } else { + return memoryMap(); + } +}(); +function useLocalStorage(key, defaultValue) { + function convert2(updated) { + if (updated === void 0) + return defaultValue; + try { + return key.codec.decode(JSON.parse(updated)); + } catch (e4) { + return defaultValue; + } + } + const [storedValue, setStoredValue] = p3( + () => { + const prev = storage.get(key.id); + return convert2(prev); + } + ); h2(() => { - const listener = buildListenerForKey(key, (newValue) => { - setStoredValue(newValue != null ? newValue : initialValue); + return storage.onUpdate(key.id, () => { + const newValue = storage.get(key.id); + setStoredValue(convert2(newValue)); }); - window.addEventListener("storage", listener); - return () => { - window.removeEventListener("storage", listener); - }; - }); + }, []); const setValue = (value) => { - const valueToStore = value instanceof Function ? value(storedValue) : value; - setStoredValue(valueToStore); - if (typeof window !== "undefined") { - if (!valueToStore) { - window.localStorage.removeItem(key); - } else { - window.localStorage.setItem(key, valueToStore); - } + if (value === void 0) { + storage.delete(key.id); + } else { + storage.set( + key.id, + key.codec ? JSON.stringify(value) : value + ); + } + }; + return { + value: storedValue, + update: setValue, + reset: () => { + setValue(defaultValue); } }; - const isSaved = window.localStorage.getItem(key) !== null; - return [storedValue, setValue, isSaved]; } function getBrowserLang() { + if (typeof window === "undefined") + return void 0; if (window.navigator.languages) return window.navigator.languages[0]; if (window.navigator.language) return window.navigator.language; return void 0; } +var langPreferenceKey = buildStorageKey("lang-preference"); function useLang(initial2) { - const defaultLang = (getBrowserLang() || initial2 || "en").substring(0, 2); - return useNotNullLocalStorage("lang-preference", defaultLang); + const defaultValue = (getBrowserLang() || initial2 || "en").substring(0, 2); + return useLocalStorage(langPreferenceKey, defaultValue); } +var storage2 = memoryMap(); +var storage3 = memoryMap(); function base64encode(str) { return base64EncArr(strToUTF8Arr(str)); } @@ -14122,28 +15039,29 @@ function strToUTF8Arr(sDOMStr) { var ErrorType = /* @__PURE__ */ ((ErrorType2) => { ErrorType2[ErrorType2["CLIENT"] = 0] = "CLIENT"; ErrorType2[ErrorType2["SERVER"] = 1] = "SERVER"; - ErrorType2[ErrorType2["TIMEOUT"] = 2] = "TIMEOUT"; - ErrorType2[ErrorType2["UNEXPECTED"] = 3] = "UNEXPECTED"; + ErrorType2[ErrorType2["UNREADABLE"] = 2] = "UNREADABLE"; + ErrorType2[ErrorType2["TIMEOUT"] = 3] = "TIMEOUT"; + ErrorType2[ErrorType2["UNEXPECTED"] = 4] = "UNEXPECTED"; return ErrorType2; })(ErrorType || {}); function defaultRequestHandler(_0, _1) { - return __async2(this, arguments, function* (baseUrl, endpoint, options2 = {}) { + return __async(this, arguments, function* (baseUrl, endpoint, options = {}) { var _a2, _b, _c, _d, _e; const requestHeaders = {}; - if (options2.token) { - requestHeaders.Authorization = `Bearer ${options2.token}`; - } else if (options2.basicAuth) { + if (options.token) { + requestHeaders.Authorization = `Bearer ${options.token}`; + } else if (options.basicAuth) { requestHeaders.Authorization = `Basic ${base64encode( - `${options2.basicAuth.username}:${options2.basicAuth.password}` + `${options.basicAuth.username}:${options.basicAuth.password}` )}`; } - requestHeaders["Content-Type"] = options2.contentType === "json" ? "application/json" : "text/plain"; - const requestMethod = (_a2 = options2 == null ? void 0 : options2.method) != null ? _a2 : "GET"; - const requestBody = options2 == null ? void 0 : options2.data; - const requestTimeout = (_b = options2 == null ? void 0 : options2.timeout) != null ? _b : 5 * 1e3; - const requestParams = (_c = options2.params) != null ? _c : {}; - const requestPreventCache = (_d = options2.preventCache) != null ? _d : false; - const requestPreventCors = (_e = options2.preventCors) != null ? _e : false; + requestHeaders["Content-Type"] = options.contentType === "json" ? "application/json" : "text/plain"; + const requestMethod = (_a2 = options == null ? void 0 : options.method) != null ? _a2 : "GET"; + const requestBody = options == null ? void 0 : options.data; + const requestTimeout = (_b = options == null ? void 0 : options.timeout) != null ? _b : 5 * 1e3; + const requestParams = (_c = options.params) != null ? _c : {}; + const requestPreventCache = (_d = options.preventCache) != null ? _d : false; + const requestPreventCors = (_e = options.preventCors) != null ? _e : false; const _url = new URL(`${baseUrl}${endpoint}`); Object.entries(requestParams).forEach(([key, value]) => { _url.searchParams.set(key, String(value)); @@ -14181,16 +15099,13 @@ function defaultRequestHandler(_0, _1) { const info = { payload, url: _url.href, - hasToken: !!options2.token, - status: 0 + hasToken: !!options.token, + status: 0, + options }; const error2 = { - clientError: true, - isNotfound: false, - isUnauthorized: false, - error: void 0, info, - type: 2, + type: 3, message: "Request timeout" }; throw new RequestError(error2); @@ -14207,15 +15122,18 @@ function defaultRequestHandler(_0, _1) { response, _url.href, payload, - !!options2.token + !!options.token, + options ); return result; } else { - const error2 = yield buildRequestFailed( - response, + const dataTxt = yield response.text(); + const error2 = buildRequestFailed( _url.href, + dataTxt, + response.status, payload, - !!options2.token + options ); throw new RequestError(error2); } @@ -14228,8 +15146,8 @@ var RequestError = class extends Error { this.cause = d5; } }; -function buildRequestOk(response, url, payload, hasToken) { - return __async2(this, null, function* () { +function buildRequestOk(response, url, payload, hasToken, options) { + return __async(this, null, function* () { const dataTxt = yield response.text(); const data = dataTxt ? JSON.parse(dataTxt) : void 0; return { @@ -14239,73 +15157,69 @@ function buildRequestOk(response, url, payload, hasToken) { payload, url, hasToken, + options, status: response.status } }; }); } -function buildRequestFailed(response, url, payload, hasToken) { - return __async2(this, null, function* () { - const status = response == null ? void 0 : response.status; - const info = { - payload, - url, - hasToken, - status: status || 0 - }; - try { - const dataTxt = yield response.text(); - const data = dataTxt ? JSON.parse(dataTxt) : void 0; - if (status && status >= 400 && status < 500) { - const error2 = { - clientError: true, - isNotfound: status === 404, - isUnauthorized: status === 401, - type: 0, - status, - info, - message: data == null ? void 0 : data.hint, - error: data, - // remove this - payload: data - }; - return error2; - } - if (status && status >= 500 && status < 600) { - const error2 = { - serverError: true, - type: 1, - status, - info, - message: `${data == null ? void 0 : data.hint} (code ${data == null ? void 0 : data.code})`, - error: data, - //remove this - payload: data - }; - return error2; - } - return { - info, - type: 3, +function buildRequestFailed(url, dataTxt, status, payload, maybeOptions) { + const options = maybeOptions != null ? maybeOptions : {}; + const info = { + payload, + url, + hasToken: !!options.token, + options, + status: status || 0 + }; + try { + const data = dataTxt ? JSON.parse(dataTxt) : void 0; + const errorCode = !data || !data.code ? "" : `(code: ${data.code})`; + const errorHint = !data || !data.hint ? "Not hint." : `${data.hint} ${errorCode}`; + if (status && status >= 400 && status < 500) { + const message = data === void 0 ? `Client error (${status}) without data.` : errorHint; + const error2 = { + type: 0, status, - error: {}, - // remove this - exception: void 0, - message: "NOT DEFINED" + info, + message, + payload: data }; - } catch (ex) { + return error2; + } + if (status && status >= 500 && status < 600) { + const message = data === void 0 ? `Server error (${status}) without data.` : errorHint; const error2 = { - info, + type: 1, status, - type: 3, - error: ex, - exception: ex, - message: "NOT DEFINED" + info, + message, + payload: data }; return error2; } - }); + return { + info, + loading: false, + type: 4, + status, + exception: void 0, + message: `http status code not handled: ${status}` + }; + } catch (ex) { + const error2 = { + info, + loading: false, + status, + type: 2, + exception: ex, + body: dataTxt, + message: "Could not parse body as json" + }; + return error2; + } } +var logger6 = new Logger("browserHttpLib"); var Context = B({ request: defaultRequestHandler }); @@ -14324,8 +15238,7 @@ var initial = { supportedLang, changeLanguage: () => { }, - i18n, - isSaved: false + i18n }; var Context2 = B(initial); var TranslationProvider = ({ @@ -14334,7 +15247,7 @@ var TranslationProvider = ({ forceLang, source }) => { - const [lang, changeLanguage, isSaved] = useLang(initial2); + const { value: lang, update: changeLanguage } = useLang(initial2); h2(() => { if (forceLang) { changeLanguage(forceLang); @@ -14349,7 +15262,7 @@ var TranslationProvider = ({ setupI18n(lang, source); } return h(Context2.Provider, { - value: { lang, changeLanguage, supportedLang, i18n, isSaved }, + value: { lang, changeLanguage, supportedLang, i18n }, children }); }; @@ -14419,175 +15332,6 @@ function inspect(obj) { inspect(children); } } -var tests_exports = {}; -__export(tests_exports, { - createExample: () => createExample, - hookBehaveLikeThis: () => hookBehaveLikeThis, - mountHook: () => mountHook, - nullAsyncFunction: () => nullAsyncFunction, - nullFunction: () => nullFunction, - renderNodeOrBrowser: () => renderNodeOrBrowser -}); -l.requestAnimationFrame = (fn) => { - return fn(); -}; -function createExample(Component, props) { - const evaluatedProps = typeof props === "function" ? props() : props; - const Render = (args) => h(Component, args); - return { - component: Render, - props: evaluatedProps - }; -} -var isNode2 = typeof window === "undefined"; -function renderNodeOrBrowser(Component, args, Context32) { - const vdom = !Context32 ? h(Component, args) : h(Context32, { children: [h(Component, args)] }); - const customElement = {}; - const parentElement = isNode2 ? customElement : document.createElement("div"); - if (!isNode2) { - document.body.appendChild(parentElement); - } - P(vdom, parentElement); - if (!isNode2) { - document.body.removeChild(parentElement); - } -} -function mountHook(hookToBeTested, Context32) { - let lastResult = null; - const listener = []; - function Component() { - try { - let componentOrResult = hookToBeTested(); - while (typeof componentOrResult === "function") { - componentOrResult = componentOrResult(); - } - const l3 = componentOrResult; - lastResult = l3; - } catch (e4) { - if (e4 instanceof Error) { - lastResult = e4; - } else { - lastResult = new Error(`mounting the hook throw an exception: ${e4}`); - } - } - listener.splice(0, listener.length).forEach((cb) => cb()); - return h(p, {}); - } - renderNodeOrBrowser(Component, {}, Context32); - function pullLastResult() { - const copy = lastResult; - lastResult = null; - return copy; - } - function pullLastResultOrThrow() { - const r3 = pullLastResult(); - if (r3 instanceof Error) - throw r3; - if (!r3) - throw Error("there was no last result"); - return r3; - } - function assertNoPendingUpdate() { - return __async2(this, null, function* () { - yield new Promise((res, rej) => { - const tid = setTimeout(() => { - res(true); - }, 10); - listener.push(() => { - clearTimeout(tid); - res(false); - }); - }); - const r3 = pullLastResult(); - if (r3) { - return Promise.resolve(false); - } - return Promise.resolve(true); - }); - } - function waitForStateUpdate() { - return __async2(this, null, function* () { - return yield new Promise((res, rej) => { - const tid = setTimeout(() => { - res(false); - }, 10); - listener.push(() => { - clearTimeout(tid); - res(true); - }); - }); - }); - } - return { - // unmount, - pullLastResultOrThrow, - waitForStateUpdate, - assertNoPendingUpdate - }; -} -var nullFunction = () => { - null; -}; -var nullAsyncFunction = () => { - return Promise.resolve(); -}; -function hookBehaveLikeThis(hookFunction, props, checks, Context32) { - return __async2(this, null, function* () { - const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } = mountHook(() => hookFunction(props), Context32); - const [firstCheck, ...resultOfTheChecks] = checks; - { - const state = pullLastResultOrThrow(); - const checkError = firstCheck(state); - if (checkError !== void 0) { - return { - result: "fail", - index: 0, - error: `Check return not undefined error: ${checkError}` - }; - } - } - let index = 1; - for (const check of resultOfTheChecks) { - const hasNext2 = yield waitForStateUpdate(); - if (!hasNext2) { - return { - result: "fail", - error: "Component didn't update and the test expected one more state", - index - }; - } - const state = pullLastResultOrThrow(); - const checkError = check(state); - if (checkError !== void 0) { - return { - result: "fail", - index, - error: `Check return not undefined error: ${checkError}` - }; - } - index++; - } - const hasNext = yield waitForStateUpdate(); - if (hasNext) { - return { - result: "fail", - index, - error: "Component updated and test didn't expect more states" - }; - } - const noMoreUpdates = yield assertNoPendingUpdate(); - if (noMoreUpdates === false) { - return { - result: "fail", - index, - error: "Component was updated but the test does not cover the update" - }; - } - return { - result: "ok" - }; - }); -} // ../../node_modules/.pnpm/preact-router@3.2.1_preact@10.11.3/node_modules/preact-router/dist/preact-router.es.js var EMPTY$1 = {}; @@ -14789,7 +15533,7 @@ var Router = function(Component$$1) { return props.url !== this.props.url || props.onChange !== this.props.onChange; }; Router2.prototype.canRoute = function canRoute2(url) { - var children = x(this.props.children); + var children = x2(this.props.children); return this.getMatchingChildren(children, url, false).length > 0; }; Router2.prototype.routeTo = function routeTo2(url) { @@ -14844,7 +15588,7 @@ var Router = function(Component$$1) { var children = ref.children; var onChange = ref.onChange; var url = ref$1.url; - var active = this.getMatchingChildren(x(children), url, true); + var active = this.getMatchingChildren(x2(children), url, true); var current = active[0] || null; var previous = this.previousUrl; if (url !== previous) { @@ -14951,33 +15695,14 @@ function resolvePathname(to, from) { } var resolve_pathname_default = resolvePathname; -// ../../node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js -var isProduction = false; -function warning(condition, message) { - if (!isProduction) { - if (condition) { - return; - } - var text = "Warning: " + message; - if (typeof console !== "undefined") { - console.warn(text); - } - try { - throw Error(text); - } catch (x6) { - } - } -} -var tiny_warning_esm_default = warning; - // ../../node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js -var isProduction2 = false; +var isProduction = true; var prefix = "Invariant failed"; function invariant2(condition, message) { if (condition) { return; } - if (isProduction2) { + if (isProduction) { throw new Error(prefix); } var provided = typeof message === "function" ? message() : message; @@ -15081,7 +15806,7 @@ function createLocation(path, state, key, currentLocation) { function createTransitionManager() { var prompt = null; function setPrompt(nextPrompt) { - true ? tiny_warning_esm_default(prompt == null, "A history supports only one prompt at a time") : void 0; + false ? tiny_warning_esm_default(prompt == null, "A history supports only one prompt at a time") : void 0; prompt = nextPrompt; return function() { if (prompt === nextPrompt) @@ -15095,7 +15820,7 @@ function createTransitionManager() { if (typeof getUserConfirmation === "function") { getUserConfirmation(result, callback); } else { - true ? tiny_warning_esm_default(false, "A history needs a getUserConfirmation function in order to use a prompt message") : void 0; + false ? tiny_warning_esm_default(false, "A history needs a getUserConfirmation function in order to use a prompt message") : void 0; callback(true); } } else { @@ -15180,7 +15905,7 @@ function createHashHistory(props) { if (props === void 0) { props = {}; } - !canUseDOM ? true ? invariant2(false, "Hash history needs a DOM") : invariant2(false) : void 0; + !canUseDOM ? false ? invariant2(false, "Hash history needs a DOM") : invariant2(false) : void 0; var globalHistory = window.history; var canGoWithoutReload = supportsGoWithoutReloadUsingHash(); var _props = props, _props$getUserConfirm = _props.getUserConfirmation, getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, _props$hashType = _props.hashType, hashType = _props$hashType === void 0 ? "slash" : _props$hashType; @@ -15188,7 +15913,7 @@ function createHashHistory(props) { var _HashPathCoders$hashT = HashPathCoders[hashType], encodePath2 = _HashPathCoders$hashT.encodePath, decodePath2 = _HashPathCoders$hashT.decodePath; function getDOMLocation() { var path2 = decodePath2(getHashPath()); - true ? tiny_warning_esm_default(!basename || hasBasename(path2, basename), 'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "' + path2 + '" to begin with "' + basename + '".') : void 0; + false ? tiny_warning_esm_default(!basename || hasBasename(path2, basename), 'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "' + path2 + '" to begin with "' + basename + '".') : void 0; if (basename) path2 = stripBasename(path2, basename); return createLocation(path2); @@ -15267,7 +15992,7 @@ function createHashHistory(props) { return href + "#" + encodePath2(basename + createPath(location2)); } function push(path2, state) { - true ? tiny_warning_esm_default(state === void 0, "Hash history cannot push state; it is ignored") : void 0; + false ? tiny_warning_esm_default(state === void 0, "Hash history cannot push state; it is ignored") : void 0; var action = "PUSH"; var location2 = createLocation(path2, void 0, void 0, history2.location); transitionManager.confirmTransitionTo(location2, action, getUserConfirmation, function(ok) { @@ -15288,13 +16013,13 @@ function createHashHistory(props) { location: location2 }); } else { - true ? tiny_warning_esm_default(false, "Hash history cannot PUSH the same path; a new entry will not be added to the history stack") : void 0; + false ? tiny_warning_esm_default(false, "Hash history cannot PUSH the same path; a new entry will not be added to the history stack") : void 0; setState(); } }); } function replace(path2, state) { - true ? tiny_warning_esm_default(state === void 0, "Hash history cannot replace state; it is ignored") : void 0; + false ? tiny_warning_esm_default(state === void 0, "Hash history cannot replace state; it is ignored") : void 0; var action = "REPLACE"; var location2 = createLocation(path2, void 0, void 0, history2.location); transitionManager.confirmTransitionTo(location2, action, getUserConfirmation, function(ok) { @@ -15317,7 +16042,7 @@ function createHashHistory(props) { }); } function go(n2) { - true ? tiny_warning_esm_default(canGoWithoutReload, "Hash history go(n) causes a full page reload in this browser") : void 0; + false ? tiny_warning_esm_default(canGoWithoutReload, "Hash history go(n) causes a full page reload in this browser") : void 0; globalHistory.go(n2); } function goBack() { @@ -15383,11 +16108,11 @@ var calculateRootPath = () => { return rootPath; }; function useBackendURL(url) { - const [value, setter] = useNotNullLocalStorage2( + const [value, setter] = useNotNullLocalStorage( "backend-url", url || calculateRootPath() ); - const [triedToLog, setTriedToLog] = useLocalStorage("tried-login"); + const [triedToLog, setTriedToLog] = useLocalStorage2("tried-login"); const checkedSetter = (v3) => { setTriedToLog("yes"); return setter((p4) => (v3 instanceof Function ? v3(p4) : v3).replace(/\/$/, "")); @@ -15398,10 +16123,10 @@ function useBackendURL(url) { return [value, !!triedToLog, checkedSetter, resetBackend]; } function useBackendDefaultToken(initialValue) { - return useLocalStorage("backend-token", initialValue); + return useLocalStorage2("backend-token", initialValue); } function useBackendInstanceToken(id) { - const [token, setToken] = useLocalStorage(`backend-token-${id}`); + const [token, setToken] = useLocalStorage2(`backend-token-${id}`); const [defaultToken, defaultSetToken] = useBackendDefaultToken(); if (id === "default") { return [defaultToken, defaultSetToken]; @@ -15414,8 +16139,8 @@ function useBackendInstanceToken(id) { } return [token, updateToken]; } -function useLocalStorage(key, initialValue) { - const [storedValue, setStoredValue] = p2( +function useLocalStorage2(key, initialValue) { + const [storedValue, setStoredValue] = p3( () => { return typeof window !== "undefined" ? window.localStorage.getItem(key) || initialValue : initialValue; } @@ -15435,8 +16160,8 @@ function useLocalStorage(key, initialValue) { }; return [storedValue, setValue]; } -function useNotNullLocalStorage2(key, initialValue) { - const [storedValue, setStoredValue] = p2(() => { +function useNotNullLocalStorage(key, initialValue) { + const [storedValue, setStoredValue] = p3(() => { return typeof window !== "undefined" ? window.localStorage.getItem(key) || initialValue : initialValue; }); const setValue = (value) => { @@ -15473,7 +16198,7 @@ function useBackendContextState(defaultUrl, initialToken) { const tokenCleaner = T2(() => { updateToken(void 0); }, []); - const [cleaners, setCleaners] = p2([tokenCleaner]); + const [cleaners, setCleaners] = p3([tokenCleaner]); const addTokenCleaner = (c4) => setCleaners((cs) => [...cs, c4]); const addTokenCleanerMemo = T2( (c4) => { @@ -15516,7 +16241,7 @@ var BackendContextProvider = ({ }; var useBackendContext = () => q2(BackendContext); -// node_modules/preact/compat/dist/compat.module.js +// ../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/dist/compat.module.js function g3(n2, t4) { for (var e4 in t4) n2[e4] = t4[e4]; @@ -15606,8 +16331,8 @@ l.unmount = function(n2) { } this.__b = null; } - var i4 = e4.__a && h(p, null, n2.fallback); - return i4 && (i4.__h = null), [h(p, null, e4.__a ? null : n2.children), i4]; + var i4 = e4.__a && h(p2, null, n2.fallback); + return i4 && (i4.__h = null), [h(p2, null, e4.__a ? null : n2.children), i4]; }; var W = function(n2, t4, e4) { if (++e4[1] === e4[0] && n2.o.delete(t4), n2.props.revealOrder && ("t" !== n2.props.revealOrder[0] || !n2.o.size)) @@ -15629,7 +16354,7 @@ var W = function(n2, t4, e4) { }; }, V2.prototype.render = function(n2) { this.u = null, this.o = /* @__PURE__ */ new Map(); - var t4 = x(n2.children); + var t4 = x2(n2.children); n2.revealOrder && "b" === n2.revealOrder[0] && t4.reverse(); for (var e4 = t4.length; e4--; ) this.o.set(t4[e4], this.u = [1, 0, this.u]); @@ -15678,9 +16403,9 @@ l.vnode = function(n2) { var l3 = e4[i4]; H2 && "children" === i4 && "noscript" === t4 || "value" === i4 && "defaultValue" in e4 && null == l3 || ("defaultValue" === i4 && "value" in e4 && null == e4.value ? i4 = "value" : "download" === i4 && true === l3 ? l3 = "" : /ondoubleclick/i.test(i4) ? i4 = "ondblclick" : /^onchange(textarea|input)/i.test(i4 + t4) && !Z2(e4.type) ? i4 = "oninput" : /^onfocus$/i.test(i4) ? i4 = "onfocusin" : /^onblur$/i.test(i4) ? i4 = "onfocusout" : /^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i4) ? i4 = i4.toLowerCase() : o3 && B3.test(i4) ? i4 = i4.replace(/[A-Z0-9]/g, "-$&").toLowerCase() : null === l3 && (l3 = void 0), /^oninput$/i.test(i4) && (i4 = i4.toLowerCase(), u4[i4] && (i4 = "oninputCapture")), u4[i4] = l3); } - "select" == t4 && u4.multiple && Array.isArray(u4.value) && (u4.value = x(e4.children).forEach(function(n3) { + "select" == t4 && u4.multiple && Array.isArray(u4.value) && (u4.value = x2(e4.children).forEach(function(n3) { n3.props.selected = -1 != u4.value.indexOf(n3.props.value); - })), "select" == t4 && null != u4.defaultValue && (u4.value = x(e4.children).forEach(function(n3) { + })), "select" == t4 && null != u4.defaultValue && (u4.value = x2(e4.children).forEach(function(n3) { n3.props.selected = u4.multiple ? -1 != u4.defaultValue.indexOf(n3.props.value) : u4.defaultValue == n3.props.value; })), n2.props = u4, e4.class != e4.className && (nn.enumerable = "className" in e4, null != e4.className && (u4.class = e4.className), Object.defineProperty(u4, "className", nn)); } @@ -15691,7 +16416,7 @@ l.__r = function(n2) { en && en(n2), X2 = n2.__c; }; -// ../../node_modules/.pnpm/swr@1.3.0/node_modules/swr/dist/index.mjs +// ../../node_modules/.pnpm/swr@1.3.0_react@18.2.0/node_modules/swr/dist/index.mjs function __awaiter(thisArg, _arguments, P3, generator) { function adopt(value) { return value instanceof P3 ? value : new P3(function(resolve) { @@ -16132,7 +16857,7 @@ var SWRConfig$1 = function(props) { var value = props.value; var extendedConfig = mergeConfigs(q2(SWRConfigContext), value); var provider = value && value.provider; - var cacheContext = p2(function() { + var cacheContext = p3(function() { return provider ? initCache(provider(extendedConfig.cache || cache), value) : UNDEFINED; })[0]; if (cacheContext) { @@ -16147,7 +16872,7 @@ var SWRConfig$1 = function(props) { })); }; var useStateWithDeps = function(state, unmountedRef) { - var rerender = p2({})[1]; + var rerender = p3({})[1]; var stateRef = _2(state); var stateDependenciesRef = _2({ data: false, @@ -16498,7 +17223,7 @@ var useSWRHandler = function(_key, fetcher, config) { } }; }, [refreshInterval, refreshWhenHidden, refreshWhenOffline, revalidate]); - x2(data); + x3(data); if (suspense && isUndefined(data) && key) { fetcherRef.current = fetcher; configRef.current = config; @@ -16550,15 +17275,17 @@ function useMatchMutate() { } function useBackendInstancesTestForAdmin() { const { request } = useBackendBaseRequest(); - const [result, setResult] = p2({ loading: true }); + const [result, setResult] = p3({ loading: true }); h2(() => { - request(`/management/instances`).then((data) => setResult(data)).catch((error2) => setResult(error2)); + request(`/management/instances`).then((data) => setResult(data)).catch( + (error2) => setResult(error2.cause) + ); }, [request]); return result; } function useBackendConfig() { const { request } = useBackendBaseRequest(); - const [result, setResult] = p2({ loading: true }); + const [result, setResult] = p3({ loading: true }); h2(() => { request(`/config`).then((data) => setResult(data)).catch((error2) => setResult(error2)); }, [request]); @@ -16836,7 +17563,7 @@ function useInstanceDetails() { if (data) return data; if (error2) - return error2.info; + return error2.cause; return { loading: true }; } function useInstanceKYCDetails() { @@ -16860,7 +17587,7 @@ function useInstanceKYCDetails() { return { ok: true, data: { type: "ok" } }; } if (error2) - return error2.info; + return error2.cause; return { loading: true }; } function useManagedInstanceDetails(instanceId) { @@ -16880,7 +17607,7 @@ function useManagedInstanceDetails(instanceId) { if (data) return data; if (error2) - return error2.info; + return error2.cause; return { loading: true }; } function useBackendInstances() { @@ -16891,7 +17618,7 @@ function useBackendInstances() { if (data) return data; if (error2) - return error2.info; + return error2.cause; return { loading: true }; } @@ -17113,7 +17840,7 @@ function useFormContext() { // src/components/form/useField.tsx function useField(name) { const { errors: errors2, object: object2, initialObject, toStr, fromStr, valueHandler } = useFormContext(); - const [isDirty, setDirty] = p2(false); + const [isDirty, setDirty] = p3(false); const updateField = (field) => (value2) => { setDirty(true); return valueHandler((prev) => { @@ -17217,7 +17944,7 @@ function ConfirmModal({ label = "Confirm" }) { const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h("div", { class: active ? "modal is-active" : "modal" }, /* @__PURE__ */ h("div", { class: "modal-background ", onClick: onCancel }), /* @__PURE__ */ h("div", { class: "modal-card", style: { maxWidth: 700 } }, /* @__PURE__ */ h("header", { class: "modal-card-head" }, !description ? null : /* @__PURE__ */ h("p", { class: "modal-card-title" }, /* @__PURE__ */ h("b", null, description)), /* @__PURE__ */ h("button", { class: "delete ", "aria-label": "close", onClick: onCancel })), /* @__PURE__ */ h("section", { class: "modal-card-body" }, children), /* @__PURE__ */ h("footer", { class: "modal-card-foot" }, /* @__PURE__ */ h("div", { class: "buttons is-right", style: { width: "100%" } }, onConfirm ? /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("button", { class: "button ", onClick: onCancel }, /* @__PURE__ */ h(i18n2.Translate, null, "Cancel")), /* @__PURE__ */ h( + return /* @__PURE__ */ h("div", { class: active ? "modal is-active" : "modal" }, /* @__PURE__ */ h("div", { class: "modal-background ", onClick: onCancel }), /* @__PURE__ */ h("div", { class: "modal-card", style: { maxWidth: 700 } }, /* @__PURE__ */ h("header", { class: "modal-card-head" }, !description ? null : /* @__PURE__ */ h("p", { class: "modal-card-title" }, /* @__PURE__ */ h("b", null, description)), /* @__PURE__ */ h("button", { class: "delete ", "aria-label": "close", onClick: onCancel })), /* @__PURE__ */ h("section", { class: "modal-card-body" }, children), /* @__PURE__ */ h("footer", { class: "modal-card-foot" }, /* @__PURE__ */ h("div", { class: "buttons is-right", style: { width: "100%" } }, onConfirm ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("button", { class: "button ", onClick: onCancel }, /* @__PURE__ */ h(i18n2.Translate, null, "Cancel")), /* @__PURE__ */ h( "button", { class: danger ? "button is-danger " : "button is-info ", @@ -17349,7 +18076,7 @@ function UpdateTokenModal({ onConfirm, oldToken }) { - const [form, setValue] = p2({ + const [form, setValue] = p3({ old_token: "", new_token: "", repeat_token: "" @@ -17406,7 +18133,7 @@ function SetTokenNewInstanceModal({ onClear, onConfirm }) { - const [form, setValue] = p2({ + const [form, setValue] = p3({ new_token: "", repeat_token: "" }); @@ -17482,10 +18209,10 @@ function LoadingModal({ onCancel }) { // src/hooks/async.ts function useAsync(fn, { slowTolerance: tooLong } = { slowTolerance: 1e3 }) { - const [data, setData] = p2(void 0); - const [isLoading, setLoading] = p2(false); - const [error2, setError] = p2(void 0); - const [isSlow, setSlow] = p2(false); + const [data, setData] = p3(void 0); + const [isLoading, setLoading] = p3(false); + const [error2, setError] = p3(void 0); + const [isSlow, setSlow] = p3(false); const request = (...args) => __async(this, null, function* () { if (!fn) return; @@ -19635,7 +20362,7 @@ function InputNumber({ initial: initial2, onChange }) { - const [value, handler] = p2({ + const [value, handler] = p3({ v: toTwoDigitString(initial2) }); return /* @__PURE__ */ h( @@ -19709,7 +20436,7 @@ function InputDuration({ readonly, withForever }) { - const [opened, setOpened] = p2(false); + const [opened, setOpened] = p3(false); const { i18n: i18n2 } = useTranslationContext(); const { error: error2, required, value, onChange } = useField(name); let strValue = ""; @@ -19824,7 +20551,7 @@ function InputGroup({ fixed, initialActive }) { - const [active, setActive] = p2(initialActive || fixed); + const [active, setActive] = p3(initialActive || fixed); const group = useGroupField(name); return /* @__PURE__ */ h("div", { class: "card" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, label, tooltip && /* @__PURE__ */ h("span", { class: "icon has-tooltip-right", "data-tooltip": tooltip }, /* @__PURE__ */ h("i", { class: "mdi mdi-information" })), (group == null ? void 0 : group.hasError) && /* @__PURE__ */ h("span", { class: "icon has-text-danger", "data-tooltip": tooltip }, /* @__PURE__ */ h("i", { class: "mdi mdi-alert" }))), !fixed && /* @__PURE__ */ h( "button", @@ -19851,7 +20578,7 @@ function InputImage({ const { error: error2, value, onChange } = useField(name); const image = _2(null); const { i18n: i18n2 } = useTranslationContext(); - const [sizeError, setSizeError] = p2(false); + const [sizeError, setSizeError] = p3(false); return /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, label, tooltip && /* @__PURE__ */ h("span", { class: "icon has-tooltip-right", "data-tooltip": tooltip }, /* @__PURE__ */ h("i", { class: "mdi mdi-information" })))), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: expand ? "control is-expanded" : "control" }, value && /* @__PURE__ */ h( "img", { @@ -19901,7 +20628,7 @@ function InputImage({ // src/components/form/InputLocation.tsx function InputLocation({ name }) { const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(Input, { name: `${name}.country`, label: i18n2.str`Country` }), /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(Input, { name: `${name}.country`, label: i18n2.str`Country` }), /* @__PURE__ */ h( Input, { name: `${name}.address_lines`, @@ -19948,7 +20675,6 @@ function InputSelector({ toStr = defaultToString3 }) { const { error: error2, value, onChange } = useField(name); - console.log(error2); return /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, label, tooltip && /* @__PURE__ */ h("span", { class: "icon has-tooltip-right", "data-tooltip": tooltip }, /* @__PURE__ */ h("i", { class: "mdi mdi-information" })))), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: expand ? "control is-expanded select" : "control select" }, /* @__PURE__ */ h( "select", { @@ -20040,17 +20766,24 @@ var targets = [ "bitcoin", "ethereum" ]; +var accountAuthType = ["none", "basic"]; var noTargetValue = targets[0]; -var defaultTarget = { target: noTargetValue, options: {} }; +var defaultTarget = { + target: noTargetValue, + options: {}, + auth: { + type: "unset" + } +}; function InputPaytoForm({ name, readonly, label, tooltip }) { - var _a2; - const { value: paytos, onChange } = useField(name); - const [value, valueHandler] = p2(defaultTarget); + var _a2, _b, _c; + const { value: paytos, onChange, required } = useField(name); + const [value, valueHandler] = p3(defaultTarget); let payToPath; if (value.target === "iban" && value.path1) { payToPath = `/${value.path1.toUpperCase()}`; @@ -20062,7 +20795,7 @@ function InputPaytoForm({ } } const { i18n: i18n2 } = useTranslationContext(); - const ops = value.options; + const ops = (_a2 = value.options) != null ? _a2 : {}; const url = tryUrl(`payto://${value.target}${payToPath}`); if (url) { Object.keys(ops).forEach((opt_key) => { @@ -20073,20 +20806,47 @@ function InputPaytoForm({ } const paytoURL = !url ? "" : url.href; const errors2 = { - target: value.target === noTargetValue ? i18n2.str`required` : void 0, + target: value.target === noTargetValue && !paytos.length ? i18n2.str`required` : void 0, path1: !value.path1 ? i18n2.str`required` : value.target === "iban" ? validateIBAN(value.path1, i18n2) : value.target === "bitcoin" ? validateBitcoin(value.path1, i18n2) : value.target === "ethereum" ? validateEthereum(value.path1, i18n2) : void 0, path2: value.target === "x-taler-bank" ? !value.path2 ? i18n2.str`required` : void 0 : void 0, options: undefinedIfEmpty({ - "receiver-name": !((_a2 = value.options) == null ? void 0 : _a2["receiver-name"]) ? i18n2.str`required` : void 0 + "receiver-name": !((_b = value.options) == null ? void 0 : _b["receiver-name"]) ? i18n2.str`required` : void 0 + }), + auth: !value.auth ? void 0 : undefinedIfEmpty({ + username: value.auth.type === "basic" && !value.auth.username ? i18n2.str`required` : void 0, + password: value.auth.type === "basic" && !value.auth.password ? i18n2.str`required` : void 0, + repeat: value.auth.type === "basic" && !value.auth.repeat ? i18n2.str`required` : value.auth.repeat !== value.auth.password ? i18n2.str`is not the same` : void 0 }) }; const hasErrors = Object.keys(errors2).some( (k4) => errors2[k4] !== void 0 ); const submit = T2(() => { - const alreadyExists = paytos.findIndex((x6) => x6 === paytoURL) !== -1; + var _a3, _b2; + const accounts = paytos; + const alreadyExists = accounts.findIndex((x6) => x6.payto_uri === paytoURL) !== -1; if (!alreadyExists) { - onChange([paytoURL, ...paytos]); + const newValue = { + payto_uri: paytoURL + }; + if (value.auth) { + if (value.auth.url) { + newValue.credit_facade_url = value.auth.url; + } + if (value.auth.type === "none") { + newValue.credit_facade_credentials = { + type: "none" + }; + } + if (value.auth.type === "basic") { + newValue.credit_facade_credentials = { + type: "basic", + username: (_a3 = value.auth.username) != null ? _a3 : "", + password: (_b2 = value.auth.password) != null ? _b2 : "" + }; + } + } + onChange([newValue, ...accounts]); } valueHandler(defaultTarget); }, [value]); @@ -20108,7 +20868,7 @@ function InputPaytoForm({ toStr: (v3) => v3 === noTargetValue ? i18n2.str`Choose one...` : v3 } ), - value.target === "ach" && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + value.target === "ach" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( Input, { name: "path1", @@ -20123,7 +20883,7 @@ function InputPaytoForm({ tooltip: i18n2.str`Account number.` } )), - value.target === "bic" && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + value.target === "bic" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( Input, { name: "path1", @@ -20131,7 +20891,7 @@ function InputPaytoForm({ tooltip: i18n2.str`Business Identifier Code.` } )), - value.target === "iban" && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + value.target === "iban" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( Input, { name: "path1", @@ -20140,7 +20900,7 @@ function InputPaytoForm({ inputExtra: { style: { textTransform: "uppercase" } } } )), - value.target === "upi" && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + value.target === "upi" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( Input, { name: "path1", @@ -20148,7 +20908,7 @@ function InputPaytoForm({ tooltip: i18n2.str`Unified Payment Interface.` } )), - value.target === "bitcoin" && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + value.target === "bitcoin" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( Input, { name: "path1", @@ -20156,7 +20916,7 @@ function InputPaytoForm({ tooltip: i18n2.str`Bitcoin protocol.` } )), - value.target === "ethereum" && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + value.target === "ethereum" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( Input, { name: "path1", @@ -20164,7 +20924,7 @@ function InputPaytoForm({ tooltip: i18n2.str`Ethereum protocol.` } )), - value.target === "ilp" && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + value.target === "ilp" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( Input, { name: "path1", @@ -20172,8 +20932,8 @@ function InputPaytoForm({ tooltip: i18n2.str`Interledger protocol.` } )), - value.target === "void" && /* @__PURE__ */ h(p, null), - value.target === "x-taler-bank" && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + value.target === "void" && /* @__PURE__ */ h(p2, null), + value.target === "x-taler-bank" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( Input, { name: "path1", @@ -20188,39 +20948,85 @@ function InputPaytoForm({ tooltip: i18n2.str`Bank account.` } )), - value.target !== noTargetValue && /* @__PURE__ */ h( + value.target !== noTargetValue && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( Input, { name: "options.receiver-name", label: i18n2.str`Name`, tooltip: i18n2.str`Bank account owner's name.` } - ), - /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }), /* @__PURE__ */ h("div", { class: "field-body", style: { display: "block" } }, paytos.map((v3, i4) => /* @__PURE__ */ h( - "div", + ), /* @__PURE__ */ h( + InputWithAddon, { - key: i4, - class: "tags has-addons mt-3 mb-0 mr-3", - style: { flexWrap: "nowrap" } - }, - /* @__PURE__ */ h( - "span", + name: "auth.url", + label: i18n2.str`Account info URL`, + help: "https://bank.com", + expand: true, + tooltip: i18n2.str`From where the merchant can download information about incoming wire transfers to this account` + } + ), /* @__PURE__ */ h( + InputSelector, + { + name: "auth.type", + label: i18n2.str`Auth type`, + tooltip: i18n2.str`Choose the authentication type for the account info URL`, + values: accountAuthType, + toStr: (str) => { + if (str === "none") + return "Without authentication"; + return "Username and password"; + } + } + ), ((_c = value.auth) == null ? void 0 : _c.type) === "basic" ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( + Input, + { + name: "auth.username", + label: i18n2.str`Username`, + tooltip: i18n2.str`Username to access the account information.` + } + ), /* @__PURE__ */ h( + Input, + { + name: "auth.password", + inputType: "password", + label: i18n2.str`Password`, + tooltip: i18n2.str`Password to access the account information.` + } + ), /* @__PURE__ */ h( + Input, + { + name: "auth.repeat", + inputType: "password", + label: i18n2.str`Repeat password` + } + )) : void 0), + /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }), /* @__PURE__ */ h("div", { class: "field-body", style: { display: "block" } }, paytos.map( + (v3, i4) => /* @__PURE__ */ h( + "div", { - class: "tag is-medium is-info mb-0", - style: { maxWidth: "90%" } + key: i4, + class: "tags has-addons mt-3 mb-0 mr-3", + style: { flexWrap: "nowrap" } }, - v3 - ), - /* @__PURE__ */ h( - "a", - { - class: "tag is-medium is-danger is-delete mb-0", - onClick: () => { - onChange(paytos.filter((f3) => f3 !== v3)); + /* @__PURE__ */ h( + "span", + { + class: "tag is-medium is-info mb-0", + style: { maxWidth: "90%" } + }, + v3.payto_uri + ), + /* @__PURE__ */ h( + "a", + { + class: "tag is-medium is-danger is-delete mb-0", + onClick: () => { + onChange(paytos.filter((f3) => f3 !== v3)); + } } - } + ) ) - )), !paytos.length && i18n2.str`No accounts yet.`)), + ), !paytos.length && i18n2.str`No accounts yet.`, required && /* @__PURE__ */ h("span", { class: "icon has-text-danger is-right" }, /* @__PURE__ */ h("i", { class: "mdi mdi-alert" })))), value.target !== noTargetValue && /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, /* @__PURE__ */ h( "button", { @@ -20248,7 +21054,7 @@ function DefaultInstanceFormFields({ }) { const { i18n: i18n2 } = useTranslationContext(); const backend = useBackendContext(); - return /* @__PURE__ */ h(p, null, showId && /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, showId && /* @__PURE__ */ h( InputWithAddon, { name: "id", @@ -20265,6 +21071,14 @@ function DefaultInstanceFormFields({ tooltip: i18n2.str`Legal name of the business represented by this instance.` } ), /* @__PURE__ */ h( + InputSelector, + { + name: "user_type", + label: i18n2.str`Type`, + tooltip: i18n2.str`Different type of account can have different rules and requirements.`, + values: ["business", "individual"] + } + ), /* @__PURE__ */ h( Input, { name: "email", @@ -20288,7 +21102,7 @@ function DefaultInstanceFormFields({ ), /* @__PURE__ */ h( InputPaytoForm, { - name: "payto_uris", + name: "accounts", label: i18n2.str`Bank account`, tooltip: i18n2.str`URI specifying bank account for crediting revenue.` } @@ -20352,7 +21166,8 @@ function DefaultInstanceFormFields({ function with_defaults(id) { return { id, - payto_uris: [], + accounts: [], + user_type: "business", default_pay_delay: { d_us: 2 * 1e3 * 60 * 60 * 1e3 }, // two hours default_wire_fee_amortization: 1, @@ -20362,16 +21177,17 @@ function with_defaults(id) { } function CreatePage({ onCreate, onBack, forceId }) { var _a2, _b, _c, _d; - const [value, valueHandler] = p2(with_defaults(forceId)); - const [isTokenSet, updateIsTokenSet] = p2(false); - const [isTokenDialogActive, updateIsTokenDialogActive] = p2(false); + const [value, valueHandler] = p3(with_defaults(forceId)); + const [isTokenSet, updateIsTokenSet] = p3(false); + const [isTokenDialogActive, updateIsTokenDialogActive] = p3(false); const { i18n: i18n2 } = useTranslationContext(); const errors2 = { id: !value.id ? i18n2.str`required` : !INSTANCE_ID_REGEX.test(value.id) ? i18n2.str`is not valid` : void 0, name: !value.name ? i18n2.str`required` : void 0, - payto_uris: !value.payto_uris || !value.payto_uris.length ? i18n2.str`required` : undefinedIfEmpty( - value.payto_uris.map((p4) => { - return !PAYTO_REGEX.test(p4) ? i18n2.str`is not valid` : void 0; + user_type: !value.user_type ? i18n2.str`required` : value.user_type !== "business" && value.user_type !== "individual" ? i18n2.str`should be business or individual` : void 0, + accounts: !value.accounts || !value.accounts.length ? i18n2.str`required` : undefinedIfEmpty( + value.accounts.map((p4) => { + return !PAYTO_REGEX.test(p4.payto_uri) ? i18n2.str`is not valid` : void 0; }) ), default_max_deposit_fee: !value.default_max_deposit_fee ? i18n2.str`required` : !Amounts.parse(value.default_max_deposit_fee) ? i18n2.str`invalid format` : void 0, @@ -20425,13 +21241,13 @@ function CreatePage({ onCreate, onBack, forceId }) { )), /* @__PURE__ */ h("div", { class: "column" })), /* @__PURE__ */ h("section", { class: "hero is-hero-bar" }, /* @__PURE__ */ h("div", { class: "hero-body" }, /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-item has-text-centered" }, /* @__PURE__ */ h("h1", { class: "title" }, /* @__PURE__ */ h( "button", { - class: "button is-danger has-tooltip-bottom", + class: !isTokenSet ? "button is-danger has-tooltip-bottom" : !value.auth_token ? "button has-tooltip-bottom" : "button is-info has-tooltip-bottom", "data-tooltip": i18n2.str`change authorization configuration`, onClick: () => updateIsTokenDialogActive(true) }, /* @__PURE__ */ h("div", { class: "icon is-centered" }, /* @__PURE__ */ h("i", { class: "mdi mdi-lock-reset" })), /* @__PURE__ */ h("span", null, /* @__PURE__ */ h(i18n2.Translate, null, "Set access token")) - )))))), /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h( + )))), /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-item has-text-centered" }, !isTokenSet ? /* @__PURE__ */ h("p", { class: "is-size-6" }, /* @__PURE__ */ h(i18n2.Translate, null, "Access token is not yet configured. This instance can't be created.")) : value.auth_token === void 0 ? /* @__PURE__ */ h("p", { class: "is-size-6" }, /* @__PURE__ */ h(i18n2.Translate, null, "No access token. Authorization must be handled externally.")) : /* @__PURE__ */ h("p", { class: "is-size-6" }, /* @__PURE__ */ h(i18n2.Translate, null, "Access token is set. Authorization is handled by the merchant backend.")))))), /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h( FormProvider, { errors: errors2, @@ -20470,13 +21286,13 @@ function InstanceCreatedSuccessfully({ // src/paths/admin/create/index.tsx function Create({ onBack, onConfirm, forceId }) { const { createInstance } = useAdminAPI(); - const [notif, setNotif] = p2(void 0); - const [createdOk, setCreatedOk] = p2(void 0); + const [notif, setNotif] = p3(void 0); + const [createdOk, setCreatedOk] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); if (createdOk) { return /* @__PURE__ */ h(InstanceCreatedSuccessfully, { entity: createdOk, onConfirm }); } - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( CreatePage, { onBack, @@ -20506,8 +21322,8 @@ function CardTable({ onDelete, selected }) { - const [actionQueue, actionQueueHandler] = p2([]); - const [rowSelection, rowSelectionHandler] = p2([]); + const [actionQueue, actionQueueHandler] = p3([]); + const [rowSelection, rowSelectionHandler] = p3([]); h2(() => { if (actionQueue.length > 0 && !selected && actionQueue[0].type == "DELETE") { onDelete(actionQueue[0].element); @@ -20638,7 +21454,7 @@ function View({ setInstanceName, selected }) { - const [show, setShow] = p2("active"); + const [show, setShow] = p3("active"); const showIsActive = show === "active" ? "is-active" : ""; const showIsDeleted = show === "deleted" ? "is-active" : ""; const showAll = show === null ? "is-active" : ""; @@ -20689,20 +21505,21 @@ function Instances({ setInstanceName }) { const result = useBackendInstances(); - const [deleting, setDeleting] = p2(null); - const [purging, setPurging] = p2(null); + const [deleting, setDeleting] = p3(null); + const [purging, setPurging] = p3(null); const { deleteInstance, purgeInstance } = useAdminAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( View, { instances: result.data.instances, @@ -20722,7 +21539,7 @@ function Instances({ try { yield deleteInstance(deleting.id); setNotif({ - message: i18n2.str`Instance '${deleting.name}' (ID: ${deleting.id}) has been deleted`, + message: i18n2.str`Instance "${deleting.name}" (ID: ${deleting.id}) has been deleted`, type: "SUCCESS" }); } catch (error2) { @@ -20767,8 +21584,12 @@ function ListPage({ status }) { } function PendingTable({ entries }) { const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("table", { class: "table is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Exchange")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Target account")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "KYC URL")))), /* @__PURE__ */ h("tbody", null, entries.map((e4, i4) => { - return /* @__PURE__ */ h("tr", { key: i4 }, /* @__PURE__ */ h("td", null, e4.exchange_url), /* @__PURE__ */ h("td", null, e4.payto_uri), /* @__PURE__ */ h("td", null, /* @__PURE__ */ h("a", { href: e4.kyc_url, target: "_black", rel: "noreferrer" }, e4.kyc_url))); + return /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("table", { class: "table is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Exchange")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Target account")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Reason")))), /* @__PURE__ */ h("tbody", null, entries.map((e4, i4) => { + if (e4.kyc_url === void 0) { + return /* @__PURE__ */ h("tr", { key: i4 }, /* @__PURE__ */ h("td", null, e4.exchange_url), /* @__PURE__ */ h("td", null, e4.payto_uri), /* @__PURE__ */ h("td", null, e4.aml_status === 1 ? /* @__PURE__ */ h(i18n2.Translate, null, "There is an anti-money laundering process pending to complete.") : /* @__PURE__ */ h(i18n2.Translate, null, "The account is frozen due to the anti-money laundering rules. Contact the exchange service provider for further instructions."))); + } else { + return /* @__PURE__ */ h("tr", { key: i4 }, /* @__PURE__ */ h("td", null, e4.exchange_url), /* @__PURE__ */ h("td", null, e4.payto_uri), /* @__PURE__ */ h("td", null, /* @__PURE__ */ h("a", { href: e4.kyc_url, target: "_black", rel: "noreferrer" }, /* @__PURE__ */ h(i18n2.Translate, null, "Pending KYC process, click here to complete")))); + } })))); } function TimedOutTable({ entries }) { @@ -20789,14 +21610,15 @@ function ListKYC({ onNotFound }) { const result = useInstanceKYCDetails(); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); + } const status = result.data.type === "ok" ? void 0 : result.data.status; if (!status) { return /* @__PURE__ */ h("div", null, "no kyc required"); @@ -20878,13 +21700,13 @@ function useOrderDetails(oderId) { if (data) return data; if (error2) - return error2.info; + return error2.cause; return { loading: true }; } function useInstanceOrders(args, updateFilter) { const { orderFetcher } = useBackendInstanceRequest(); - const [pageBefore, setPageBefore] = p2(1); - const [pageAfter, setPageAfter] = p2(1); + const [pageBefore, setPageBefore] = p3(1); + const [pageAfter, setPageAfter] = p3(1); const totalAfter = pageAfter * PAGE_SIZE; const totalBefore = (args == null ? void 0 : args.date) ? pageBefore * PAGE_SIZE : 0; const { @@ -20917,8 +21739,8 @@ function useInstanceOrders(args, updateFilter) { ], orderFetcher ); - const [lastBefore, setLastBefore] = p2({ loading: true }); - const [lastAfter, setLastAfter] = p2({ loading: true }); + const [lastBefore, setLastBefore] = p3({ loading: true }); + const [lastAfter, setLastAfter] = p3({ loading: true }); h2(() => { if (afterData) setLastAfter(afterData); @@ -20926,9 +21748,9 @@ function useInstanceOrders(args, updateFilter) { setLastBefore(beforeData); }, [afterData, beforeData]); if (beforeError) - return beforeError.info; + return beforeError.cause; if (afterError) - return afterError.info; + return afterError.cause; const isReachingEnd = afterData && afterData.data.orders.length < totalAfter; const isReachingStart = (args == null ? void 0 : args.date) === void 0 || beforeData && beforeData.data.orders.length < totalBefore; const pagination = { @@ -21021,9 +21843,9 @@ function useInstanceProducts() { refreshWhenOffline: false }); if (listError) - return listError.info; + return listError.cause; if (productError) - return productError.info; + return productError.cause; if (products) { const dataWithId = products.map((d5) => { var _a2; @@ -21049,7 +21871,7 @@ function useProductDetails(productId) { if (data) return data; if (error2) - return error2.info; + return error2.cause; return { loading: true }; } @@ -21338,7 +22160,7 @@ function InputDate({ expand, withTimestampSupport }) { - const [opened, setOpened] = p2(false); + const [opened, setOpened] = p3(false); const { i18n: i18n2 } = useTranslationContext(); const { error: error2, required, value, onChange } = useField(name); let strValue = ""; @@ -21457,7 +22279,7 @@ function InputSearchProduct({ onChange, products }) { - const [prodForm, setProdName] = p2({ + const [prodForm, setProdName] = p3({ name: "" }); const errors2 = { @@ -21545,8 +22367,8 @@ function InventoryProductForm({ inventory }) { const initialState = { quantity: 1 }; - const [state, setState] = p2(initialState); - const [errors2, setErrors] = p2({}); + const [state, setState] = p3(initialState); + const [errors2, setErrors] = p3({}); const { i18n: i18n2 } = useTranslationContext(); const productWithInfiniteStock = state.product && state.product.total_stock === -1; const submit = () => { @@ -23690,7 +24512,7 @@ function setLocale(custom) { // src/hooks/listener.ts function useListener(action) { - const [state, setState] = p2({}); + const [state, setState] = p3({}); const subscriber = (listener) => { if (listener) { setState({ @@ -23877,7 +24699,7 @@ function InputTaxes({ label }) { const { value: taxes, onChange } = useField(name); - const [value, valueHandler] = p2({}); + const [value, valueHandler] = p3({}); let errors2 = {}; try { TaxSchema.validateSync(value, { abortEarly: false }); @@ -23977,7 +24799,7 @@ function NonInventoryProductFrom({ productToEdit, onAddProduct }) { - const [showCreateProduct, setShowCreateProduct] = p2(false); + const [showCreateProduct, setShowCreateProduct] = p3(false); const isEditing = !!productToEdit; h2(() => { setShowCreateProduct(isEditing); @@ -23997,7 +24819,7 @@ function NonInventoryProductFrom({ return Promise.resolve(); }); const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("div", { class: "buttons" }, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "buttons" }, /* @__PURE__ */ h( "button", { class: "button is-success", @@ -24049,7 +24871,7 @@ function NonInventoryProductFrom({ ))); } function ProductForm({ onSubscribe, initial: initial2 }) { - const [value, valueHandler] = p2(__spreadValues({ + const [value, valueHandler] = p3(__spreadValues({ taxes: [] }, initial2)); let errors2 = {}; @@ -24226,7 +25048,7 @@ function CreatePage2({ instanceInventory }) { var _a2, _b, _c, _d, _e, _f, _g, _h, _i; - const [value, valueHandler] = p2(with_defaults2(instanceConfig)); + const [value, valueHandler] = p3(with_defaults2(instanceConfig)); const config = useConfigContext(); const zero = Amounts.zeroOfCurrency(config.currency); const inventoryList = Object.values(value.inventoryProducts || {}); @@ -24331,7 +25153,7 @@ function CreatePage2({ return __spreadProps(__spreadValues({}, v3), { products }); }); }; - const [editingProduct, setEditingProduct] = p2(void 0); + const [editingProduct, setEditingProduct] = p3(void 0); const totalPriceInventory = inventoryList.reduce((prev, cur) => { const p4 = Amounts.parseOrThrow(cur.product.price); return Amounts.add(prev, Amounts.mult(p4, cur.quantity).amount).amount; @@ -24417,7 +25239,7 @@ function CreatePage2({ object: value, valueHandler }, - hasProducts ? /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + hasProducts ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( InputCurrency, { name: "pricing.products_price", @@ -24615,26 +25437,28 @@ function OrderCreate({ onUnauthorized }) { const { createOrder } = useOrderAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const detailsResult = useInstanceDetails(); const inventoryResult = useInstanceProducts(); - if (detailsResult.clientError && detailsResult.isUnauthorized) - return onUnauthorized(); - if (detailsResult.clientError && detailsResult.isNotfound) - return onNotFound(); if (detailsResult.loading) return /* @__PURE__ */ h(Loading, null); - if (!detailsResult.ok) - return onLoadError(detailsResult); - if (inventoryResult.clientError && inventoryResult.isUnauthorized) - return onUnauthorized(); - if (inventoryResult.clientError && inventoryResult.isNotfound) - return onNotFound(); if (inventoryResult.loading) return /* @__PURE__ */ h(Loading, null); - if (!inventoryResult.ok) + if (!detailsResult.ok) { + if (detailsResult.type === ErrorType.CLIENT && detailsResult.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (detailsResult.type === ErrorType.CLIENT && detailsResult.status === HttpStatusCode.NotFound) + return onNotFound(); + return onLoadError(detailsResult); + } + if (!inventoryResult.ok) { + if (inventoryResult.type === ErrorType.CLIENT && inventoryResult.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (inventoryResult.type === ErrorType.CLIENT && inventoryResult.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(inventoryResult); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( CreatePage2, { onBack, @@ -24686,7 +25510,7 @@ function CardTable2({ hasMoreAfter, hasMoreBefore }) { - const [rowSelection, rowSelectionHandler] = p2([]); + const [rowSelection, rowSelectionHandler] = p3([]); const { i18n: i18n2 } = useTranslationContext(); return /* @__PURE__ */ h("div", { class: "card has-table" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash-register" })), /* @__PURE__ */ h(i18n2.Translate, null, "Orders")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h("span", { class: "has-tooltip-left", "data-tooltip": i18n2.str`create order` }, /* @__PURE__ */ h("button", { class: "button is-info", type: "button", onClick: onCreate }, /* @__PURE__ */ h("span", { class: "icon is-small" }, /* @__PURE__ */ h("i", { class: "mdi mdi-plus mdi-36px" })))))), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h("div", { class: "b-table has-pagination" }, /* @__PURE__ */ h("div", { class: "table-wrapper has-mobile-cards" }, orders.length > 0 ? /* @__PURE__ */ h( Table2, @@ -24784,7 +25608,7 @@ function RefundModal({ onCancel, onConfirm }) { - const [form, setValue] = p2({}); + const [form, setValue] = p3({}); const { i18n: i18n2 } = useTranslationContext(); const refunds = (order.order_status === "paid" ? order.refund_details : []).reduce(mergeRefunds, []); const config = useConfigContext(); @@ -24894,7 +25718,7 @@ function Timeline({ events: e4 }) { type: "now" }); events.sort((a5, b4) => a5.when.getTime() - b4.when.getTime()); - const [state, setState] = p2(events); + const [state, setState] = p3(events); h2(() => { const handle = setTimeout(() => { const eventsWithoutNow = state.filter((e5) => e5.type !== "now"); @@ -25091,7 +25915,7 @@ function ClaimedPage({ type: "delivery" }); } - const [value, valueHandler] = p2(order); + const [value, valueHandler] = p3(order); const { i18n: i18n2 } = useTranslationContext(); return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("section", { class: "section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-10" }, /* @__PURE__ */ h("section", { class: "hero is-hero-bar" }, /* @__PURE__ */ h("div", { class: "hero-body" }, /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-left" }, /* @__PURE__ */ h("div", { class: "level-item" }, /* @__PURE__ */ h(i18n2.Translate, null, "Order"), " #", id, /* @__PURE__ */ h("div", { class: "tag is-info ml-4" }, /* @__PURE__ */ h(i18n2.Translate, null, "claimed"))))), /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-left" }, /* @__PURE__ */ h("div", { class: "level-item" }, /* @__PURE__ */ h("h1", { class: "title" }, order.contract_terms.amount)))), /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-left", style: { maxWidth: "100%" } }, /* @__PURE__ */ h("div", { class: "level-item", style: { maxWidth: "100%" } }, /* @__PURE__ */ h( "div", @@ -25138,7 +25962,7 @@ function ClaimedPage({ label: i18n2.str`Order status` } ) - )))), order.contract_terms.products.length ? /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Product list")), /* @__PURE__ */ h(ProductList2, { list: order.contract_terms.products })) : void 0, value.contract_terms && /* @__PURE__ */ h(ContractTerms, { value: value.contract_terms })), /* @__PURE__ */ h("div", { class: "column" })))); + )))), order.contract_terms.products.length ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Product list")), /* @__PURE__ */ h(ProductList2, { list: order.contract_terms.products })) : void 0, value.contract_terms && /* @__PURE__ */ h(ContractTerms, { value: value.contract_terms })), /* @__PURE__ */ h("div", { class: "column" })))); } function PaidPage({ id, @@ -25234,7 +26058,7 @@ function PaidPage({ }); } } - const [value, valueHandler] = p2(order); + const [value, valueHandler] = p3(order); const { url } = useBackendContext(); const refundHost = url.replace(/.*:\/\//, ""); const proto = url.startsWith("http://") ? "taler+http" : "taler"; @@ -25341,13 +26165,13 @@ function PaidPage({ }, /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: refundurl }, refundurl) ) - )))), order.contract_terms.products.length ? /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Product list")), /* @__PURE__ */ h(ProductList2, { list: order.contract_terms.products })) : void 0, value.contract_terms && /* @__PURE__ */ h(ContractTerms, { value: value.contract_terms })), /* @__PURE__ */ h("div", { class: "column" })))); + )))), order.contract_terms.products.length ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Product list")), /* @__PURE__ */ h(ProductList2, { list: order.contract_terms.products })) : void 0, value.contract_terms && /* @__PURE__ */ h(ContractTerms, { value: value.contract_terms })), /* @__PURE__ */ h("div", { class: "column" })))); } function UnpaidPage({ id, order }) { - const [value, valueHandler] = p2(order); + const [value, valueHandler] = p3(order); const { i18n: i18n2 } = useTranslationContext(); return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("section", { class: "hero is-hero-bar" }, /* @__PURE__ */ h("div", { class: "hero-body" }, /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-left" }, /* @__PURE__ */ h("div", { class: "level-item" }, /* @__PURE__ */ h("h1", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Order"), " #", id)), /* @__PURE__ */ h("div", { class: "tag is-dark" }, /* @__PURE__ */ h(i18n2.Translate, null, "unpaid")))), /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-left", style: { maxWidth: "100%" } }, /* @__PURE__ */ h("div", { class: "level-item", style: { maxWidth: "100%" } }, /* @__PURE__ */ h( "div", @@ -25412,7 +26236,7 @@ function UnpaidPage({ ))), /* @__PURE__ */ h("div", { class: "column" })))); } function DetailPage({ id, selected, onRefund, onBack }) { - const [showRefund, setShowRefund] = p2(void 0); + const [showRefund, setShowRefund] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); const DetailByStatus = function() { switch (selected.order_status) { @@ -25426,7 +26250,7 @@ function DetailPage({ id, selected, onRefund, onBack }) { return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h(i18n2.Translate, null, "Unknown order status. This is an error, please contact the administrator.")); } }; - return /* @__PURE__ */ h(p, null, DetailByStatus(), showRefund && /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, DetailByStatus(), showRefund && /* @__PURE__ */ h( RefundModal, { order: selected, @@ -25449,17 +26273,18 @@ function Update({ }) { const { refundOrder } = useOrderAPI(); const result = useOrderDetails(oid); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( DetailPage, { onBack, @@ -25503,8 +26328,8 @@ function ListPage2({ }) { const { i18n: i18n2 } = useTranslationContext(); const dateTooltip = i18n2.str`select date to show nearby orders`; - const [pickDate, setPickDate] = p2(false); - const [orderId, setOrderId] = p2(""); + const [pickDate, setPickDate] = p3(false); + const [orderId, setOrderId] = p3(""); return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-left" }, /* @__PURE__ */ h("div", { class: "level-item" }, /* @__PURE__ */ h("div", { class: "field has-addons" }, /* @__PURE__ */ h("div", { class: "control" }, /* @__PURE__ */ h( "input", { @@ -25611,24 +26436,25 @@ function OrderList({ onSelect, onNotFound }) { - const [filter, setFilter] = p2({}); - const [orderToBeRefunded, setOrderToBeRefunded] = p2(void 0); + const [filter, setFilter] = p3({}); + const [orderToBeRefunded, setOrderToBeRefunded] = p3(void 0); const setNewDate = (date2) => setFilter((prev) => __spreadProps(__spreadValues({}, prev), { date: date2 })); const result = useInstanceOrders(filter, setNewDate); const { refundOrder, getPaymentURL } = useOrderAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - const [errorOrderId, setErrorOrderId] = p2( + const [errorOrderId, setErrorOrderId] = p3( void 0 ); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); + } const isPaidActive = filter.paid === "yes" ? "is-active" : ""; const isRefundedActive = filter.refunded === "yes" ? "is-active" : ""; const isNotWiredActive = filter.wired === "no" ? "is-active" : ""; @@ -25648,7 +26474,7 @@ function OrderList({ } }); } - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( ListPage2, { orders: result.data.orders.map((o3) => __spreadProps(__spreadValues({}, o3), { id: o3.order_id })), @@ -25721,14 +26547,15 @@ function RefundModalForTable({ onCancel }) { const result = useOrderDetails(id); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); + } return /* @__PURE__ */ h( RefundModal, { @@ -25752,9 +26579,9 @@ function InputStock({ alreadyExist }) { const { error: error2, value, onChange } = useField(name); - const [errors2, setErrors] = p2({}); - const [formValue, valueHandler] = p2(value); - const [addedStock, setAddedStock] = p2({ + const [errors2, setErrors] = p3({}); + const [formValue, valueHandler] = p3(value); + const [addedStock, setAddedStock] = p3({ incoming: 0, lost: 0 }); @@ -25770,7 +26597,7 @@ function InputStock({ } }, [formValue, addedStock]); if (!formValue) { - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, label, tooltip && /* @__PURE__ */ h("span", { class: "icon has-tooltip-right", "data-tooltip": tooltip }, /* @__PURE__ */ h("i", { class: "mdi mdi-information" })))), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field has-addons" }, !alreadyExist ? /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, label, tooltip && /* @__PURE__ */ h("span", { class: "icon has-tooltip-right", "data-tooltip": tooltip }, /* @__PURE__ */ h("i", { class: "mdi mdi-information" })))), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field has-addons" }, !alreadyExist ? /* @__PURE__ */ h( "button", { class: "button", @@ -25798,7 +26625,7 @@ function InputStock({ const stockAddedErrors = { lost: currentStock + addedStock.incoming < addedStock.lost ? i18n2.str`lost cannot be greater than current and incoming (max ${currentStock + addedStock.incoming})` : void 0 }; - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("div", { class: "card" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, label, tooltip && /* @__PURE__ */ h("span", { class: "icon", "data-tooltip": tooltip }, /* @__PURE__ */ h("i", { class: "mdi mdi-information" })))), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "card" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, label, tooltip && /* @__PURE__ */ h("span", { class: "icon", "data-tooltip": tooltip }, /* @__PURE__ */ h("i", { class: "mdi mdi-information" })))), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h( FormProvider, { name: "stock", @@ -25806,7 +26633,7 @@ function InputStock({ object: formValue, valueHandler }, - alreadyExist ? /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + alreadyExist ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( FormProvider, { name: "added", @@ -25855,7 +26682,7 @@ function InputStock({ // src/components/product/ProductForm.tsx function ProductForm2({ onSubscribe, initial: initial2, alreadyExist }) { - const [value, valueHandler] = p2(__spreadProps(__spreadValues({ + const [value, valueHandler] = p3(__spreadProps(__spreadValues({ address: {}, description_i18n: {}, taxes: [], @@ -26010,9 +26837,9 @@ function CreatePage3({ onCreate, onBack }) { // src/paths/instance/products/create/index.tsx function CreateProduct({ onConfirm, onBack }) { const { createProduct } = useProductAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( CreatePage3, { onBack, @@ -26037,7 +26864,7 @@ function CardTable3({ onUpdate, onDelete }) { - const [rowSelection, rowSelectionHandler] = p2( + const [rowSelection, rowSelectionHandler] = p3( void 0 ); const { i18n: i18n2 } = useTranslationContext(); @@ -26082,7 +26909,7 @@ function Table3({ stockInfo = /* @__PURE__ */ h("label", { title: restStockInfo }, totalStock, " ", i4.unit); } const isFree = Amounts.isZero(Amounts.parseOrThrow(i4.price)); - return /* @__PURE__ */ h(p, { key: i4.id }, /* @__PURE__ */ h("tr", { key: "info" }, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, { key: i4.id }, /* @__PURE__ */ h("tr", { key: "info" }, /* @__PURE__ */ h( "td", { onClick: () => rowSelection !== i4.id && rowSelectionHandler(i4.id), @@ -26190,9 +27017,9 @@ function FastProductWithInfiniteStockUpdateForm({ onUpdate, onCancel }) { - const [value, valueHandler] = p2({ price: product.price }); + const [value, valueHandler] = p3({ price: product.price }); const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( FormProvider, { name: "added", @@ -26230,7 +27057,7 @@ function FastProductWithManagedStockUpdateForm({ onUpdate, onCancel }) { - const [value, valueHandler] = p2({ + const [value, valueHandler] = p3({ incoming: 0, lost: 0, price: product.price @@ -26243,7 +27070,7 @@ function FastProductWithManagedStockUpdateForm({ (k4) => errors2[k4] !== void 0 ); const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( FormProvider, { name: "added", @@ -26325,16 +27152,17 @@ function ProductList3({ }) { const result = useInstanceProducts(); const { deleteProduct, updateProduct } = useProductAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); + } return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( CardTable3, { @@ -26408,17 +27236,18 @@ function UpdateProduct({ }) { const { updateProduct } = useProductAPI(); const result = useProductDetails(pid); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( UpdatePage, { product: __spreadProps(__spreadValues({}, result.data), { product_id: pid }), @@ -26492,7 +27321,7 @@ function useInstanceReserves() { if (data) return data; if (error2) - return error2.info; + return error2.cause; return { loading: true }; } function useReserveDetails(reserveId) { @@ -26509,7 +27338,7 @@ function useReserveDetails(reserveId) { if (data) return data; if (error2) - return error2.info; + return error2.cause; return { loading: true }; } function useTipDetails(tipId) { @@ -26526,7 +27355,7 @@ function useTipDetails(tipId) { if (data) return data; if (error2) - return error2.info; + return error2.cause; return { loading: true }; } @@ -26565,17 +27394,15 @@ function QR({ text }) { } // src/paths/instance/reserves/create/CreatedSuccessfully.tsx +function isNotUndefined(x6) { + return !!x6; +} function CreatedSuccessfully2({ entity, onConfirm, onCreateAnother }) { - const p4 = parsePaytoUri(entity.response.payto_uri); - if (p4) { - p4.params["message"] = entity.response.reserve_pub; - p4.params["amount"] = entity.request.initial_balance; - } - const link = !p4 ? entity.response.payto_uri : stringifyPaytoUri(p4); + var _a2; const { i18n: i18n2 } = useTranslationContext(); return /* @__PURE__ */ h(CreatedSuccessfully, { onConfirm, onCreateAnother }, /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Amount")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h( "input", @@ -26584,14 +27411,48 @@ function CreatedSuccessfully2({ class: "input", value: entity.request.initial_balance } - ))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Exchange bank account")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("input", { readonly: true, class: "input", value: entity.response.payto_uri }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Wire transfer subject")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h( + ))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Wire transfer subject")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h( "input", { class: "input", readonly: true, value: entity.response.reserve_pub } - ))))), /* @__PURE__ */ h("p", { class: "is-size-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "To complete the setup of the reserve, you must now initiate a wire transfer using the given wire transfer subject and crediting the specified amount to the indicated account of the exchange.")), /* @__PURE__ */ h("p", { class: "is-size-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "If your system supports RFC 8905, you can do this by opening this URI:")), /* @__PURE__ */ h("pre", null, /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: link }, link)), /* @__PURE__ */ h(QR, { text: link })); + ))))), /* @__PURE__ */ h( + ShowAccountsOfReserveAsQRWithLink, + { + accounts: (_a2 = entity.response.accounts) != null ? _a2 : [], + message: entity.response.reserve_pub, + amount: entity.request.initial_balance + } + )); +} +function ShowAccountsOfReserveAsQRWithLink({ + accounts, + message, + amount +}) { + const { i18n: i18n2 } = useTranslationContext(); + const accountsInfo = !accounts ? [] : accounts.map((acc) => { + const p4 = parsePaytoUri(acc.payto_uri); + if (p4) { + p4.params["message"] = message; + p4.params["amount"] = amount; + } + return p4; + }).filter(isNotUndefined); + const links = accountsInfo.map((a5) => stringifyPaytoUri(a5)); + if (links.length === 0) { + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("p", { class: "is-size-5" }, "The reserve have invalid accounts. List of invalid payto URIs below:"), /* @__PURE__ */ h("ul", null, accounts.map((a5, idx) => { + return /* @__PURE__ */ h("li", { key: idx }, a5.payto_uri); + }))); + } + if (links.length === 1) { + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("p", { class: "is-size-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "To complete the setup of the reserve, you must now initiate a wire transfer using the given wire transfer subject and crediting the specified amount to the indicated account of the exchange.")), /* @__PURE__ */ h("p", { style: { margin: 10 } }, /* @__PURE__ */ h("b", null, "Exchange bank account")), /* @__PURE__ */ h(QR, { text: links[0] }), /* @__PURE__ */ h("p", { class: "is-size-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "If your system supports RFC 8905, you can do this by opening this URI:")), /* @__PURE__ */ h("pre", null, /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: links[0] }, links[0]))); + } + return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("p", { class: "is-size-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "To complete the setup of the reserve, you must now initiate a wire transfer using the given wire transfer subject and crediting the specified amount to one of the indicated account of the exchange.")), /* @__PURE__ */ h("p", { style: { margin: 10 } }, /* @__PURE__ */ h("b", null, "Exchange bank accounts")), /* @__PURE__ */ h("p", { class: "is-size-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "If your system supports RFC 8905, you can do this by clicking on the URI below the QR code:")), links.map((link) => { + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(QR, { text: link }), /* @__PURE__ */ h("pre", null, /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: link }, link))); + })); } // src/paths/instance/reserves/create/CreatePage.tsx @@ -26604,8 +27465,8 @@ function ViewStep({ setReserve }) { const { i18n: i18n2 } = useTranslationContext(); - const [wireMethods, setWireMethods] = p2([]); - const [exchangeQueryError, setExchangeQueryError] = p2(void 0); + const [wireMethods, setWireMethods] = p3([]); + const [exchangeQueryError, setExchangeQueryError] = p3(void 0); h2(() => { setExchangeQueryError(void 0); }, [reserve.exchange_url]); @@ -26618,7 +27479,7 @@ function ViewStep({ const hasErrors = Object.keys(errors2).some( (k4) => errors2[k4] !== void 0 ); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( FormProvider, { object: reserve, @@ -26671,7 +27532,7 @@ function ViewStep({ const hasErrors = Object.keys(errors2).some( (k4) => errors2[k4] !== void 0 ); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( FormProvider, { object: reserve, @@ -26726,11 +27587,11 @@ function ViewStep({ } } function CreatePage4({ onCreate, onBack }) { - const [reserve, setReserve] = p2({}); + const [reserve, setReserve] = p3({}); const submitForm = () => { return onCreate(reserve); }; - const [currentStep, setCurrentStep] = p2(0 /* EXCHANGE */); + const [currentStep, setCurrentStep] = p3(0 /* EXCHANGE */); return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h("div", { class: "tabs is-toggle is-fullwidth is-small" }, /* @__PURE__ */ h("ul", null, /* @__PURE__ */ h("li", { class: currentStep === 0 /* EXCHANGE */ ? "is-active" : "" }, /* @__PURE__ */ h("a", { style: { cursor: "initial" } }, /* @__PURE__ */ h("span", null, "Step 1: Specify exchange"))), /* @__PURE__ */ h( "li", { @@ -26753,13 +27614,13 @@ function CreatePage4({ onCreate, onBack }) { // src/paths/instance/reserves/create/index.tsx function CreateReserve({ onBack, onConfirm }) { const { createReserve } = useReservesAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - const [createdOk, setCreatedOk] = p2(void 0); + const [createdOk, setCreatedOk] = p3(void 0); if (createdOk) { return /* @__PURE__ */ h(CreatedSuccessfully2, { entity: createdOk, onConfirm }); } - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( CreatePage4, { onBack, @@ -26782,7 +27643,7 @@ function TipInfo({ id, amount, entity }) { const tipHost = url.replace(/.*:\/\//, ""); const proto = url.startsWith("http://") ? "taler+http" : "taler"; const tipURL = `${proto}://tip/${tipHost}/${id}`; - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Amount")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("input", { readonly: true, class: "input", value: amount }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "URL")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field", style: { overflowWrap: "anywhere" } }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: tipURL }, tipURL))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Valid until")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Amount")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("input", { readonly: true, class: "input", value: amount }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "URL")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field", style: { overflowWrap: "anywhere" } }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: tipURL }, tipURL))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Valid until")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h( "input", { class: "input", @@ -26801,12 +27662,6 @@ function DetailPage2({ id, selected, onBack }) { const didExchangeAckTransfer = Amounts.isNonZero( Amounts.parseOrThrow(selected.exchange_initial_amount) ); - const p4 = parsePaytoUri(selected.payto_uri); - if (p4) { - p4.params["message"] = id; - p4.params["amount"] = selected.merchant_initial_amount; - } - const link = !p4 ? selected.payto_uri : stringifyPaytoUri(p4); return /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h("div", { class: "section main-section" }, /* @__PURE__ */ h(FormProvider, { object: __spreadProps(__spreadValues({}, selected), { id }), valueHandler: null }, /* @__PURE__ */ h( InputDate, { @@ -26836,7 +27691,7 @@ function DetailPage2({ id, selected, onBack }) { readonly: true }, /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: selected.exchange_url }, selected.exchange_url) - ), didExchangeAckTransfer && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + ), didExchangeAckTransfer && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( InputCurrency, { name: "exchange_initial_amount", @@ -26857,14 +27712,14 @@ function DetailPage2({ id, selected, onBack }) { label: i18n2.str`Committed`, readonly: true } - )), /* @__PURE__ */ h( - Input, + )), /* @__PURE__ */ h(Input, { name: "id", label: i18n2.str`Subject`, readonly: true })), didExchangeAckTransfer ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "card has-table" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash-register" })), /* @__PURE__ */ h(i18n2.Translate, null, "Tips"))), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h("div", { class: "b-table has-pagination" }, /* @__PURE__ */ h("div", { class: "table-wrapper has-mobile-cards" }, selected.tips && selected.tips.length > 0 ? /* @__PURE__ */ h(Table4, { tips: selected.tips }) : /* @__PURE__ */ h(EmptyTable5, null)))))) : selected.accounts ? /* @__PURE__ */ h( + ShowAccountsOfReserveAsQRWithLink, { - name: "payto_uri", - label: i18n2.str`Account address`, - readonly: true + accounts: selected.accounts, + amount: selected.merchant_initial_amount, + message: id } - ), /* @__PURE__ */ h(Input, { name: "id", label: i18n2.str`Subject`, readonly: true })), didExchangeAckTransfer ? /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("div", { class: "card has-table" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash-register" })), /* @__PURE__ */ h(i18n2.Translate, null, "Tips"))), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h("div", { class: "b-table has-pagination" }, /* @__PURE__ */ h("div", { class: "table-wrapper has-mobile-cards" }, selected.tips && selected.tips.length > 0 ? /* @__PURE__ */ h(Table4, { tips: selected.tips }) : /* @__PURE__ */ h(EmptyTable5, null)))))) : /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("p", { class: "is-size-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "To complete the setup of the reserve, you must now initiate a wire transfer using the given wire transfer subject and crediting the specified amount to the indicated account of the exchange.")), /* @__PURE__ */ h("p", { class: "is-size-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "If your system supports RFC 8905, you can do this by opening this URI:")), /* @__PURE__ */ h("pre", null, /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: link }, link)), /* @__PURE__ */ h(QR, { text: link })), /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, /* @__PURE__ */ h("button", { class: "button", onClick: onBack }, /* @__PURE__ */ h(i18n2.Translate, null, "Back"))))), /* @__PURE__ */ h("div", { class: "column" })); + ) : void 0, /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, /* @__PURE__ */ h("button", { class: "button", onClick: onBack }, /* @__PURE__ */ h(i18n2.Translate, null, "Back"))))), /* @__PURE__ */ h("div", { class: "column" })); } function EmptyTable5() { const { i18n: i18n2 } = useTranslationContext(); @@ -26880,7 +27735,7 @@ function TipRow({ id, entry }) { - const [selected, setSelected] = p2(false); + const [selected, setSelected] = p3(false); const result = useTipDetails(id); if (result.loading) { return /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", null, "..."), /* @__PURE__ */ h("td", null, "..."), /* @__PURE__ */ h("td", null, "..."), /* @__PURE__ */ h("td", null, "...")); @@ -26892,7 +27747,7 @@ function TipRow({ function onSelect() { setSelected(true); } - return /* @__PURE__ */ h(p, null, selected && /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, selected && /* @__PURE__ */ h( SimpleModal, { description: "tip", @@ -26913,15 +27768,16 @@ function DetailReserve({ onDelete }) { const result = useReserveDetails(rid); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(DetailPage2, { selected: result.data, onBack, id: rid })); + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(DetailPage2, { selected: result.data, onBack, id: rid })); } // src/paths/instance/reserves/list/CreatedSuccessfully.tsx @@ -26931,7 +27787,7 @@ function CreatedSuccessfully3({ onConfirm, onCreateAnother }) { - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Amount")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("input", { readonly: true, class: "input", value: request.amount }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Justification")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("input", { readonly: true, class: "input", value: request.justification }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "URL")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("input", { readonly: true, class: "input", value: entity.tip_status_url }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Valid until")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Amount")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("input", { readonly: true, class: "input", value: request.amount }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Justification")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("input", { readonly: true, class: "input", value: request.justification }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "URL")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h("input", { readonly: true, class: "input", value: entity.tip_status_url }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Valid until")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, /* @__PURE__ */ h( "input", { class: "input", @@ -26950,7 +27806,7 @@ function AuthorizeTipModal({ onConfirm, tipAuthorized }) { - const [form, setValue] = p2({}); + const [form, setValue] = p3({}); const { i18n: i18n2 } = useTranslationContext(); let errors2 = {}; try { @@ -27043,7 +27899,7 @@ function CardTable4({ return prev; }, new Array([], [])); const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h(p, null, withoutFunds.length > 0 && /* @__PURE__ */ h("div", { class: "card has-table" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash" })), /* @__PURE__ */ h(i18n2.Translate, null, "Reserves not yet funded"))), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h("div", { class: "b-table has-pagination" }, /* @__PURE__ */ h("div", { class: "table-wrapper has-mobile-cards" }, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, withoutFunds.length > 0 && /* @__PURE__ */ h("div", { class: "card has-table" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash" })), /* @__PURE__ */ h(i18n2.Translate, null, "Reserves not yet funded"))), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h("div", { class: "b-table has-pagination" }, /* @__PURE__ */ h("div", { class: "table-wrapper has-mobile-cards" }, /* @__PURE__ */ h( TableWithoutFund, { instances: withoutFunds, @@ -27188,20 +28044,21 @@ function ListTips({ }) { const result = useInstanceReserves(); const { deleteReserve, authorizeTipReserve } = useReservesAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - const [reserveForTip, setReserveForTip] = p2( + const [reserveForTip, setReserveForTip] = p3( void 0 ); - const [tipAuthorized, setTipAuthorized] = p2(void 0); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); + const [tipAuthorized, setTipAuthorized] = p3(void 0); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); + } return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(NotificationCard, { notification: notif }), reserveForTip && /* @__PURE__ */ h( AuthorizeTipModal, { @@ -27290,14 +28147,14 @@ function useTemplateAPI() { } function useInstanceTemplates(args, updatePosition) { const { templateFetcher } = useBackendInstanceRequest(); - const [pageAfter, setPageAfter] = p2(1); + const [pageAfter, setPageAfter] = p3(1); const totalAfter = pageAfter * PAGE_SIZE; const { data: afterData, error: afterError, isValidating: loadingAfter } = useSWR6([`/private/templates`, args == null ? void 0 : args.position, -totalAfter], templateFetcher); - const [lastAfter, setLastAfter] = p2({ loading: true }); + const [lastAfter, setLastAfter] = p3({ loading: true }); h2(() => { if (afterData) setLastAfter(afterData); @@ -27306,7 +28163,7 @@ function useInstanceTemplates(args, updatePosition) { /*, beforeData*/ ]); if (afterError) - return afterError.info; + return afterError.cause; const isReachingEnd = afterData && afterData.data.templates.length < totalAfter; const isReachingStart = false; const pagination = { @@ -27352,7 +28209,7 @@ function useTemplateDetails(templateId) { return data; } if (error2) - return error2.info; + return error2.cause; return { loading: true }; } @@ -27402,8 +28259,10 @@ function CreatePage5({ onCreate, onBack }) { var _a2, _b, _c; const { i18n: i18n2 } = useTranslationContext(); const backend = useBackendContext(); - const [showKey, setShowKey] = p2(false); - const [state, setState] = p2({ + const { id: instanceId } = useInstanceContext(); + const issuer = new URL(backend.url).hostname; + const [showKey, setShowKey] = p3(false); + const [state, setState] = p3({ template_contract: { minimum_age: 0, pay_duration: { @@ -27431,6 +28290,7 @@ function CreatePage5({ onCreate, onBack }) { return Promise.reject(); return onCreate(state); }; + const qrText = `otpauth://totp/${instanceId}/${state.template_id}?issuer=${issuer}&algorithm=SHA1&digits=8&period=30&secret=${state.pos_key}`; return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h( FormProvider, { @@ -27502,11 +28362,12 @@ function CreatePage5({ onCreate, onBack }) { fromStr: (v3) => Number(v3) } ), - state.pos_algorithm && state.pos_algorithm > 0 ? /* @__PURE__ */ h( + state.pos_algorithm && state.pos_algorithm > 0 ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( InputWithAddon, { name: "pos_key", label: i18n2.str`Point-of-sale key`, + inputType: showKey ? "text" : "password", help: "Be sure to be very hard to guess or use the random generator", tooltip: i18n2.str`Useful to validate the purchase`, fromStr: (v3) => v3.toUpperCase(), @@ -27534,7 +28395,20 @@ function CreatePage5({ onCreate, onBack }) { showKey ? /* @__PURE__ */ h(i18n2.Translate, null, "hide") : /* @__PURE__ */ h(i18n2.Translate, null, "show") )) } - ) : void 0 + ), showKey && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(QR, { text: qrText }), /* @__PURE__ */ h( + "div", + { + style: { + color: "grey", + fontSize: "small", + width: 200, + textAlign: "center", + margin: "auto", + wordBreak: "break-all" + } + }, + qrText + ))) : void 0 ), /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, onBack && /* @__PURE__ */ h("button", { class: "button", onClick: onBack }, /* @__PURE__ */ h(i18n2.Translate, null, "Cancel")), /* @__PURE__ */ h( AsyncButton, { @@ -27549,9 +28423,9 @@ function CreatePage5({ onCreate, onBack }) { // src/paths/instance/templates/create/index.tsx function CreateTransfer({ onConfirm, onBack }) { const { createTemplate } = useTemplateAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( CreatePage5, { onBack, @@ -27571,7 +28445,7 @@ function CreateTransfer({ onConfirm, onBack }) { // src/paths/instance/templates/use/UsePage.tsx function UsePage({ id, template, onCreateOrder, onBack }) { const { i18n: i18n2 } = useTranslationContext(); - const [state, setState] = p2({ + const [state, setState] = p3({ amount: template.template_contract.amount, summary: template.template_contract.summary }); @@ -27641,17 +28515,18 @@ function TemplateUsePage({ }) { const { createOrderFromTemplate } = useTemplateAPI(); const result = useTemplateDetails(tid); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( UsePage, { template: result.data, @@ -27677,8 +28552,8 @@ function QrPage({ template, id: templateId, onBack }) { const { url: backendUrl } = useBackendContext(); const { id: instanceId } = useInstanceContext(); const config = useConfigContext(); - const [setupTOTP, setSetupTOTP] = p2(false); - const [state, setState] = p2({ + const [setupTOTP, setSetupTOTP] = p3(false); + const [state, setState] = p3({ amount: template.template_contract.amount, summary: template.template_contract.summary }); @@ -27791,16 +28666,17 @@ function TemplateQrPage({ onUnauthorized }) { const result = useTemplateDetails(tid); - const [notif, setNotif] = p2(void 0); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); + const [notif, setNotif] = p3(void 0); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(QrPage, { template: result.data, id: tid, onBack })); + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(QrPage, { template: result.data, id: tid, onBack })); } // src/paths/instance/templates/list/Table.tsx @@ -27816,7 +28692,7 @@ function CardTable5({ hasMoreAfter, hasMoreBefore }) { - const [rowSelection, rowSelectionHandler] = p2([]); + const [rowSelection, rowSelectionHandler] = p3([]); const { i18n: i18n2 } = useTranslationContext(); return /* @__PURE__ */ h("div", { class: "card has-table" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-newspaper" })), /* @__PURE__ */ h(i18n2.Translate, null, "Templates")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h( "span", @@ -27961,20 +28837,21 @@ function ListTemplates({ onNewOrder, onNotFound }) { - const [position, setPosition] = p2(void 0); + const [position, setPosition] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { deleteTemplate } = useTemplateAPI(); const result = useInstanceTemplates({ position }, (id) => setPosition(id)); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( ListPage3, { templates: result.data.templates, @@ -28013,8 +28890,10 @@ function UpdatePage2({ template, onUpdate, onBack }) { var _a2, _b, _c; const { i18n: i18n2 } = useTranslationContext(); const backend = useBackendContext(); - const [showKey, setShowKey] = p2(false); - const [state, setState] = p2(template); + const { id: instanceId } = useInstanceContext(); + const issuer = new URL(backend.url).hostname; + const [showKey, setShowKey] = p3(false); + const [state, setState] = p3(template); const parsedPrice = !((_a2 = state.template_contract) == null ? void 0 : _a2.amount) ? void 0 : Amounts.parse((_b = state.template_contract) == null ? void 0 : _b.amount); const errors2 = { template_description: !state.template_description ? i18n2.str`should not be empty` : void 0, @@ -28033,6 +28912,7 @@ function UpdatePage2({ template, onUpdate, onBack }) { return Promise.reject(); return onUpdate(state); }; + const qrText = `otpauth://totp/${instanceId}/${state.id}?issuer=${issuer}&algorithm=SHA1&digits=8&period=30&secret=${state.pos_key}`; return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("section", { class: "section" }, /* @__PURE__ */ h("section", { class: "hero is-hero-bar" }, /* @__PURE__ */ h("div", { class: "hero-body" }, /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-left" }, /* @__PURE__ */ h("div", { class: "level-item" }, /* @__PURE__ */ h("span", { class: "is-size-4" }, backend.url, "/instances/template/", template.id)))))), /* @__PURE__ */ h("hr", null), /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h( FormProvider, { @@ -28105,7 +28985,7 @@ function UpdatePage2({ template, onUpdate, onBack }) { fromStr: (v3) => Number(v3) } ), - state.pos_algorithm && state.pos_algorithm > 0 ? /* @__PURE__ */ h( + state.pos_algorithm && state.pos_algorithm > 0 ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( InputWithAddon, { name: "pos_key", @@ -28139,7 +29019,20 @@ function UpdatePage2({ template, onUpdate, onBack }) { showKey ? /* @__PURE__ */ h(i18n2.Translate, null, "hide") : /* @__PURE__ */ h(i18n2.Translate, null, "show") )) } - ) : void 0 + ), showKey && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(QR, { text: qrText }), /* @__PURE__ */ h( + "div", + { + style: { + color: "grey", + fontSize: "small", + width: 200, + textAlign: "center", + margin: "auto", + wordBreak: "break-all" + } + }, + qrText + ))) : void 0 ), /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, onBack && /* @__PURE__ */ h("button", { class: "button", onClick: onBack }, /* @__PURE__ */ h(i18n2.Translate, null, "Cancel")), /* @__PURE__ */ h( AsyncButton, { @@ -28162,17 +29055,18 @@ function UpdateTemplate({ }) { const { updateTemplate } = useTemplateAPI(); const result = useTemplateDetails(tid); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( UpdatePage2, { template: __spreadProps(__spreadValues({}, result.data), { id: tid }), @@ -28222,20 +29116,20 @@ function useWebhookAPI() { } function useInstanceWebhooks(args, updatePosition) { const { webhookFetcher } = useBackendInstanceRequest(); - const [pageAfter, setPageAfter] = p2(1); + const [pageAfter, setPageAfter] = p3(1); const totalAfter = pageAfter * PAGE_SIZE; const { data: afterData, error: afterError, isValidating: loadingAfter } = useSWR7([`/private/webhooks`, args == null ? void 0 : args.position, -totalAfter], webhookFetcher); - const [lastAfter, setLastAfter] = p2({ loading: true }); + const [lastAfter, setLastAfter] = p3({ loading: true }); h2(() => { if (afterData) setLastAfter(afterData); }, [afterData]); if (afterError) - return afterError.info; + return afterError.cause; const isReachingEnd = afterData && afterData.data.webhooks.length < totalAfter; const isReachingStart = false; const pagination = { @@ -28278,7 +29172,7 @@ function useWebhookDetails(webhookId) { if (data) return data; if (error2) - return error2.info; + return error2.cause; return { loading: true }; } @@ -28286,7 +29180,7 @@ function useWebhookDetails(webhookId) { var validMethod = ["GET", "POST", "PUT", "PATCH", "HEAD"]; function CreatePage6({ onCreate, onBack }) { const { i18n: i18n2 } = useTranslationContext(); - const [state, setState] = p2({}); + const [state, setState] = p3({}); const errors2 = { webhook_id: !state.webhook_id ? i18n2.str`required` : void 0, event_type: !state.event_type ? i18n2.str`required` : void 0, @@ -28372,9 +29266,9 @@ function CreatePage6({ onCreate, onBack }) { // src/paths/instance/webhooks/create/index.tsx function CreateWebhook({ onConfirm, onBack }) { const { createWebhook } = useWebhookAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( CreatePage6, { onBack, @@ -28402,7 +29296,7 @@ function CardTable6({ hasMoreAfter, hasMoreBefore }) { - const [rowSelection, rowSelectionHandler] = p2([]); + const [rowSelection, rowSelectionHandler] = p3([]); const { i18n: i18n2 } = useTranslationContext(); return /* @__PURE__ */ h("div", { class: "card has-table" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-newspaper" })), /* @__PURE__ */ h(i18n2.Translate, null, "Webhooks")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h( "span", @@ -28525,20 +29419,21 @@ function ListWebhooks({ onSelect, onNotFound }) { - const [position, setPosition] = p2(void 0); + const [position, setPosition] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { deleteWebhook } = useWebhookAPI(); const result = useInstanceWebhooks({ position }, (id) => setPosition(id)); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( ListPage4, { webhooks: result.data.webhooks, @@ -28568,7 +29463,7 @@ function ListWebhooks({ var validMethod2 = ["GET", "POST", "PUT", "PATCH", "HEAD"]; function UpdatePage3({ webhook, onUpdate, onBack }) { const { i18n: i18n2 } = useTranslationContext(); - const [state, setState] = p2(webhook); + const [state, setState] = p3(webhook); const errors2 = { event_type: !state.event_type ? i18n2.str`required` : void 0, http_method: !state.http_method ? i18n2.str`required` : !validMethod2.includes(state.http_method) ? i18n2.str`should be one of '${validMethod2.join(", ")}'` : void 0, @@ -28653,17 +29548,18 @@ function UpdateWebhook({ }) { const { updateWebhook } = useWebhookAPI(); const result = useWebhookDetails(tid); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( UpdatePage3, { webhook: __spreadProps(__spreadValues({}, result.data), { id: tid }), @@ -28687,13 +29583,10 @@ function useTransferAPI() { const mutateAll = useMatchMutate(); const { request } = useBackendInstanceRequest(); const informTransfer = (data) => __async(this, null, function* () { - const res = yield request( - `/private/transfers`, - { - method: "POST", - data - } - ); + const res = yield request(`/private/transfers`, { + method: "POST", + data + }); yield mutateAll(/.*private\/transfers.*/); return res; }); @@ -28701,8 +29594,8 @@ function useTransferAPI() { } function useInstanceTransfers(args, updatePosition) { const { transferFetcher } = useBackendInstanceRequest(); - const [pageBefore, setPageBefore] = p2(1); - const [pageAfter, setPageAfter] = p2(1); + const [pageBefore, setPageBefore] = p3(1); + const [pageAfter, setPageAfter] = p3(1); const totalAfter = pageAfter * PAGE_SIZE; const totalBefore = (args == null ? void 0 : args.position) !== void 0 ? pageBefore * PAGE_SIZE : 0; const { @@ -28733,8 +29626,8 @@ function useInstanceTransfers(args, updatePosition) { ], transferFetcher ); - const [lastBefore, setLastBefore] = p2({ loading: true }); - const [lastAfter, setLastAfter] = p2({ loading: true }); + const [lastBefore, setLastBefore] = p3({ loading: true }); + const [lastAfter, setLastAfter] = p3({ loading: true }); h2(() => { if (afterData) setLastAfter(afterData); @@ -28742,9 +29635,9 @@ function useInstanceTransfers(args, updatePosition) { setLastBefore(beforeData); }, [afterData, beforeData]); if (beforeError) - return beforeError.info; + return beforeError.cause; if (afterError) - return afterError.info; + return afterError.cause; const isReachingEnd = afterData && afterData.data.transfers.length < totalAfter; const isReachingStart = (args == null ? void 0 : args.position) === void 0 || beforeData && beforeData.data.transfers.length < totalBefore; const pagination = { @@ -28786,7 +29679,7 @@ function useInstanceTransfers(args, updatePosition) { function CreatePage7({ accounts, onCreate, onBack }) { const { i18n: i18n2 } = useTranslationContext(); const { currency } = useConfigContext(); - const [state, setState] = p2({ + const [state, setState] = p3({ wtid: "", // payto_uri: , // exchange_url: 'http://exchange.taler:8081/', @@ -28863,11 +29756,11 @@ function CreatePage7({ accounts, onCreate, onBack }) { // src/paths/instance/transfers/create/index.tsx function CreateTransfer2({ onConfirm, onBack }) { const { informTransfer } = useTransferAPI(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); const instance = useInstanceDetails(); const accounts = !instance.ok ? [] : instance.data.accounts.map((a5) => a5.payto_uri); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( CreatePage7, { onBack, @@ -28895,7 +29788,7 @@ function CardTable7({ hasMoreAfter, hasMoreBefore }) { - const [rowSelection, rowSelectionHandler] = p2([]); + const [rowSelection, rowSelectionHandler] = p3([]); const { i18n: i18n2 } = useTranslationContext(); return /* @__PURE__ */ h("div", { class: "card has-table" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-bank" })), /* @__PURE__ */ h(i18n2.Translate, null, "Transfers")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h( "span", @@ -29045,9 +29938,9 @@ function ListTransfer({ onCreate, onNotFound }) { - const [form, setForm] = p2({ payto_uri: "" }); + const [form, setForm] = p3({ payto_uri: "" }); const setFilter = (s5) => setForm(__spreadProps(__spreadValues({}, form), { verified: s5 })); - const [position, setPosition] = p2(void 0); + const [position, setPosition] = p3(void 0); const instance = useInstanceDetails(); const accounts = !instance.ok ? [] : instance.data.accounts.map((a5) => a5.payto_uri); const isVerifiedTransfers = form.verified === "yes"; @@ -29061,14 +29954,15 @@ function ListTransfer({ }, (id) => setPosition(id) ); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); + } return /* @__PURE__ */ h( ListPage5, { @@ -29094,8 +29988,14 @@ function ListTransfer({ // src/paths/instance/update/UpdatePage.tsx function convert(from) { - const _a2 = from, { accounts } = _a2, rest = __objRest(_a2, ["accounts"]); - const payto_uris = accounts.filter((a5) => a5.active).map((a5) => a5.payto_uri); + const _a2 = from, { accounts: qAccounts } = _a2, rest = __objRest(_a2, ["accounts"]); + const accounts = qAccounts.filter((a5) => a5.active).map( + (a5) => ({ + payto_uri: a5.payto_uri, + credit_facade_url: a5.credit_facade_url, + credit_facade_credentials: a5.credit_facade_credentials + }) + ); const defaults = { default_wire_fee_amortization: 1, default_pay_delay: { d_us: 2 * 1e3 * 1e3 * 60 * 60 }, @@ -29103,7 +30003,7 @@ function convert(from) { default_wire_transfer_delay: { d_us: 2 * 1e3 * 1e3 * 60 * 60 * 2 } //two hours }; - return __spreadProps(__spreadValues(__spreadValues({}, defaults), rest), { payto_uris }); + return __spreadProps(__spreadValues(__spreadValues({}, defaults), rest), { accounts }); } function getTokenValuePart(t4) { if (!t4) @@ -29130,13 +30030,14 @@ function UpdatePage4({ onChangeAuth({ method: "token", token: `secret-token:${value2}` }); } } - const [value, valueHandler] = p2(convert(selected)); + const [value, valueHandler] = p3(convert(selected)); const { i18n: i18n2 } = useTranslationContext(); const errors2 = { name: !value.name ? i18n2.str`required` : void 0, - payto_uris: !value.payto_uris || !value.payto_uris.length ? i18n2.str`required` : undefinedIfEmpty( - value.payto_uris.map((p4) => { - return !PAYTO_REGEX.test(p4) ? i18n2.str`is not valid` : void 0; + user_type: !value.user_type ? i18n2.str`required` : value.user_type !== "business" && value.user_type !== "individual" ? i18n2.str`should be business or individual` : void 0, + accounts: !value.accounts || !value.accounts.length ? i18n2.str`required` : undefinedIfEmpty( + value.accounts.map((p4) => { + return !PAYTO_REGEX.test(p4.payto_uri) ? i18n2.str`is not valid` : void 0; }) ), default_max_deposit_fee: !value.default_max_deposit_fee ? i18n2.str`required` : !Amounts.parse(value.default_max_deposit_fee) ? i18n2.str`invalid format` : void 0, @@ -29157,7 +30058,7 @@ function UpdatePage4({ const submit = () => __async(this, null, function* () { yield onUpdate(value); }); - const [active, setActive] = p2(false); + const [active, setActive] = p3(false); return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("section", { class: "section" }, /* @__PURE__ */ h("section", { class: "hero is-hero-bar" }, /* @__PURE__ */ h("div", { class: "hero-body" }, /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-left" }, /* @__PURE__ */ h("div", { class: "level-item" }, /* @__PURE__ */ h("span", { class: "is-size-4" }, /* @__PURE__ */ h(i18n2.Translate, null, "Instance id"), ": ", /* @__PURE__ */ h("b", null, id)))), /* @__PURE__ */ h("div", { class: "level-right" }, /* @__PURE__ */ h("div", { class: "level-item" }, /* @__PURE__ */ h("h1", { class: "title" }, /* @__PURE__ */ h( "button", { @@ -29234,17 +30135,18 @@ function CommonUpdate({ onUnauthorized }, result, updateInstance, clearToken, setNewToken) { const { changeToken } = useInstanceContext(); - const [notif, setNotif] = p2(void 0); + const [notif, setNotif] = p3(void 0); const { i18n: i18n2 } = useTranslationContext(); - if (result.clientError && result.isUnauthorized) - return onUnauthorized(); - if (result.clientError && result.isNotfound) - return onNotFound(); if (result.loading) return /* @__PURE__ */ h(Loading, null); - if (!result.ok) + if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) + return onUnauthorized(); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) + return onNotFound(); return onLoadError(result); - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h( UpdatePage4, { onBack, @@ -29294,8 +30196,8 @@ function LoginModal({ onConfirm, withMessage }) { const currentToken = getTokenValuePart2( (_a2 = !admin ? baseToken : instanceToken) != null ? _a2 : "" ); - const [token, setToken] = p2(currentToken); - const [url, setURL] = p2(cleanUp(backendUrl)); + const [token, setToken] = p3(currentToken); + const [url, setURL] = p3(cleanUp(backendUrl)); const { i18n: i18n2 } = useTranslationContext(); return /* @__PURE__ */ h("div", { class: "columns is-centered", style: { margin: "auto" } }, /* @__PURE__ */ h("div", { class: "column is-two-thirds " }, /* @__PURE__ */ h("div", { class: "modal-card", style: { width: "100%", margin: 0 } }, /* @__PURE__ */ h( "header", @@ -29394,7 +30296,7 @@ function InstanceRoutes({ updateToken(void 0); }, [id]); const { i18n: i18n2 } = useTranslationContext(); - const [globalNotification, setGlobalNotification] = p2(void 0); + const [globalNotification, setGlobalNotification] = p3(void 0); h2(() => { addTokenCleaner(cleaner); }, [addTokenCleaner, cleaner]); @@ -29417,19 +30319,18 @@ function InstanceRoutes({ ); function ServerErrorRedirectTo(to) { return function ServerErrorRedirectToImpl(error2) { - var _a2, _b, _c; if (error2.type === ErrorType.TIMEOUT) { setGlobalNotification({ message: i18n2.str`The request to the backend take too long and was cancelled`, - description: i18n2.str`Diagnostic from ${(_a2 = error2.info) == null ? void 0 : _a2.url} is '${error2.message}'`, + description: i18n2.str`Diagnostic from ${error2.info.url} is "${error2.message}"`, type: "ERROR", to }); } else { setGlobalNotification({ message: i18n2.str`The backend reported a problem: HTTP status #${error2.status}`, - description: i18n2.str`Diagnostic from ${(_b = error2.info) == null ? void 0 : _b.url} is '${error2.message}'`, - details: error2.clientError || error2.serverError ? (_c = error2.error) == null ? void 0 : _c.detail : void 0, + description: i18n2.str`Diagnostic from ${error2.info.url} is '${error2.message}'`, + details: error2.type === ErrorType.CLIENT || error2.type === ErrorType.SERVER ? error2.payload.detail : void 0, type: "ERROR", to }); @@ -29437,7 +30338,7 @@ function InstanceRoutes({ return /* @__PURE__ */ h(Redirect, { to }); }; } - const LoginPageAccessDenied = () => /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + const LoginPageAccessDenied = () => /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( NotificationCard, { notification: { @@ -29450,7 +30351,7 @@ function InstanceRoutes({ function IfAdminCreateDefaultOr(Next) { return function IfAdminCreateDefaultOrImpl(props) { if (admin && id === "default") { - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( NotificationCard, { notification: { @@ -29871,21 +30772,20 @@ function AdminInstanceUpdatePage(_a2) { __spreadProps(__spreadValues({}, rest), { instanceId: id, onLoadError: (error2) => { - var _a3, _b2, _c; const notif = error2.type === ErrorType.TIMEOUT ? { message: i18n2.str`The request to the backend take too long and was cancelled`, - description: i18n2.str`Diagnostic from ${(_a3 = error2.info) == null ? void 0 : _a3.url} is '${error2.message}'`, + description: i18n2.str`Diagnostic from ${error2.info.url} is '${error2.message}'`, type: "ERROR" } : { message: i18n2.str`The backend reported a problem: HTTP status #${error2.status}`, - description: i18n2.str`Diagnostic from ${(_b2 = error2.info) == null ? void 0 : _b2.url} is '${error2.message}'`, - details: error2.clientError || error2.serverError ? (_c = error2.error) == null ? void 0 : _c.detail : void 0, + description: i18n2.str`Diagnostic from ${error2.info.url} is '${error2.message}'`, + details: error2.type === ErrorType.CLIENT || error2.type === ErrorType.SERVER ? error2.payload.detail : void 0, type: "ERROR" }; - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginStatus })); + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginStatus })); }, onUnauthorized: () => { - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h( NotificationCard, { notification: { @@ -29903,11 +30803,11 @@ function KycBanner() { const kycStatus = useInstanceKYCDetails(); const { i18n: i18n2 } = useTranslationContext(); const today = format(/* @__PURE__ */ new Date(), "yyyy-MM-dd"); - const [lastHide, setLastHide] = useLocalStorage("kyc-last-hide"); + const [lastHide, setLastHide] = useLocalStorage2("kyc-last-hide"); const hasBeenHidden = today === lastHide; const needsToBeShown = kycStatus.ok && kycStatus.data.type === "redirect"; if (hasBeenHidden || !needsToBeShown) - return /* @__PURE__ */ h(p, null); + return /* @__PURE__ */ h(p2, null); return /* @__PURE__ */ h( NotificationCard, { @@ -29940,6 +30840,9 @@ strings["de"] = { "%1$s": [ "" ], + "Close": [ + "" + ], "Continue": [ "" ], @@ -30048,7 +30951,7 @@ strings["de"] = { "All": [ "" ], - "Instance '%1$s' (ID: %2$s) has been deleted": [ + 'Instance "%1$s" (ID: %2$s) has been deleted': [ "" ], "Failed to delete instance": [ @@ -30240,6 +31143,9 @@ strings["de"] = { "required": [ "" ], + "not valid": [ + "" + ], "must be greater than 0": [ "" ], @@ -30939,6 +31845,12 @@ strings["de"] = { "to short": [ "" ], + "just letters and numbers from 2 to 7": [ + "" + ], + "size of the key should be 32": [ + "" + ], "Identifier": [ "" ], @@ -30948,7 +31860,16 @@ strings["de"] = { "Describe what this template stands for": [ "" ], - "Order summary": [ + "Fixed summary": [ + "" + ], + "If specified, this template will create order with the same summary": [ + "" + ], + "Fixed price": [ + "" + ], + "If specified, this template will create order with the same price": [ "" ], "Minimum age": [ @@ -30963,12 +31884,36 @@ strings["de"] = { "How much time has the customer to complete the payment once the order was created.": [ "" ], + "Verification algorithm": [ + "" + ], + "Algorithm to use to verify transaction in offline mode": [ + "" + ], "Point-of-sale key": [ "" ], "Useful to validate the purchase": [ "" ], + "generate random secret key": [ + "" + ], + "random": [ + "" + ], + "show secret key": [ + "" + ], + "hide secret key": [ + "" + ], + "hide": [ + "" + ], + "show": [ + "" + ], "could not inform template": [ "" ], @@ -30978,12 +31923,36 @@ strings["de"] = { "Order summary is required": [ "" ], + "New order for template": [ + "" + ], "Amount of the order": [ "" ], + "Order summary": [ + "" + ], "could not create order from template": [ "" ], + "Here you can specify a default value for fields that are not fixed. Default values can be edited by the customer before the payment.": [ + "" + ], + "Fixed amount": [ + "" + ], + "Default amount": [ + "" + ], + "Default summary": [ + "" + ], + "Print": [ + "" + ], + "Setup TOTP": [ + "" + ], "Templates": [ "" ], @@ -31002,6 +31971,9 @@ strings["de"] = { "use template to create new order": [ "" ], + "create qr code for the template": [ + "" + ], "load more templates after the last one": [ "" ], @@ -31365,12 +32337,15 @@ strings["de"] = { "The request to the backend take too long and was cancelled": [ "" ], - "Diagnostic from %1$s is '%2$s'": [ + 'Diagnostic from %1$s is "%2$s"': [ "" ], "The backend reported a problem: HTTP status #%1$s": [ "" ], + "Diagnostic from %1$s is '%2$s'": [ + "" + ], "Access denied": [ "" ], @@ -31419,12 +32394,15 @@ strings["de"] = { "Server not found": [ "" ], - "Couldn't access the server": [ + "Server response with an error code": [ "" ], "Got message %1$s from %2$s": [ "" ], + "Response from server is unreadable, http status: %1$s": [ + "" + ], "Unexpected Error": [ "" ], @@ -31467,6 +32445,9 @@ strings["en"] = { "%1$s": [ "" ], + "Close": [ + "" + ], "Continue": [ "" ], @@ -31575,7 +32556,7 @@ strings["en"] = { "All": [ "" ], - "Instance '%1$s' (ID: %2$s) has been deleted": [ + 'Instance "%1$s" (ID: %2$s) has been deleted': [ "" ], "Failed to delete instance": [ @@ -31767,6 +32748,9 @@ strings["en"] = { "required": [ "" ], + "not valid": [ + "" + ], "must be greater than 0": [ "" ], @@ -32466,6 +33450,12 @@ strings["en"] = { "to short": [ "" ], + "just letters and numbers from 2 to 7": [ + "" + ], + "size of the key should be 32": [ + "" + ], "Identifier": [ "" ], @@ -32475,7 +33465,16 @@ strings["en"] = { "Describe what this template stands for": [ "" ], - "Order summary": [ + "Fixed summary": [ + "" + ], + "If specified, this template will create order with the same summary": [ + "" + ], + "Fixed price": [ + "" + ], + "If specified, this template will create order with the same price": [ "" ], "Minimum age": [ @@ -32490,12 +33489,36 @@ strings["en"] = { "How much time has the customer to complete the payment once the order was created.": [ "" ], + "Verification algorithm": [ + "" + ], + "Algorithm to use to verify transaction in offline mode": [ + "" + ], "Point-of-sale key": [ "" ], "Useful to validate the purchase": [ "" ], + "generate random secret key": [ + "" + ], + "random": [ + "" + ], + "show secret key": [ + "" + ], + "hide secret key": [ + "" + ], + "hide": [ + "" + ], + "show": [ + "" + ], "could not inform template": [ "" ], @@ -32505,12 +33528,36 @@ strings["en"] = { "Order summary is required": [ "" ], + "New order for template": [ + "" + ], "Amount of the order": [ "" ], + "Order summary": [ + "" + ], "could not create order from template": [ "" ], + "Here you can specify a default value for fields that are not fixed. Default values can be edited by the customer before the payment.": [ + "" + ], + "Fixed amount": [ + "" + ], + "Default amount": [ + "" + ], + "Default summary": [ + "" + ], + "Print": [ + "" + ], + "Setup TOTP": [ + "" + ], "Templates": [ "" ], @@ -32529,6 +33576,9 @@ strings["en"] = { "use template to create new order": [ "" ], + "create qr code for the template": [ + "" + ], "load more templates after the last one": [ "" ], @@ -32892,12 +33942,15 @@ strings["en"] = { "The request to the backend take too long and was cancelled": [ "" ], - "Diagnostic from %1$s is '%2$s'": [ + 'Diagnostic from %1$s is "%2$s"': [ "" ], "The backend reported a problem: HTTP status #%1$s": [ "" ], + "Diagnostic from %1$s is '%2$s'": [ + "" + ], "Access denied": [ "" ], @@ -32946,12 +33999,15 @@ strings["en"] = { "Server not found": [ "" ], - "Couldn't access the server": [ + "Server response with an error code": [ "" ], "Got message %1$s from %2$s": [ "" ], + "Response from server is unreadable, http status: %1$s": [ + "" + ], "Unexpected Error": [ "" ], @@ -32994,6 +34050,9 @@ strings["es"] = { "%1$s": [ "%1$s" ], + "Close": [ + "" + ], "Continue": [ "Continuar" ], @@ -33016,49 +34075,49 @@ strings["es"] = { "no son iguales" ], "You are updating the access token from instance with id %1$s": [ - "Est\xE1 actualizando el token de autorizaci\xF3n para la instancia con id %1$s" + "Est\xE1 actualizando el token de acceso para la instancia con id %1$s" ], "Old access token": [ "Viejo token de acceso" ], "access token currently in use": [ - "" + "acceder al token en uso actualmente" ], "New access token": [ - "Nuevo token" + "Nuevo token de acceso" ], "next access token to be used": [ - "" + "siguiente token de acceso a usar" ], "Repeat access token": [ - "" + "Repetir token de acceso" ], "confirm the same access token": [ - "" + "confirmar el mismo token de acceso" ], "Clearing the access token will mean public access to the instance": [ - "Limpiar el token de autorizaci\xF3n significa acceso publico a la instancia" + "Limpiar el token de acceso significa acceso p\xFAblico a la instancia" ], "cannot be the same as the old access token": [ - "no puede ser igual al anterior" + "no puede ser igual al anterior token de acceso" ], "You are setting the access token for the new instance": [ - "" + "Est\xE1 estableciendo el token de acceso para la nueva instancia" ], "With external authorization method no check will be done by the merchant backend": [ - "" + "Con el m\xE9todo de autorizaci\xF3n externa no se har\xE1 ninguna revisi\xF3n por el backend del comerciante" ], "Set external authorization": [ - "Amortizaci\xF3n de comisi\xF3n de transferencia" + "Establecer autorizaci\xF3n externa" ], "Set access token": [ - "" + "Establecer token de acceso" ], "Operation in progress...": [ - "" + "Operaci\xF3n en progreso..." ], "The operation will be automatically canceled after %1$s seconds": [ - "" + "La operaci\xF3n ser\xE1 autom\xE1ticamente cancelada luego de %1$s segundos" ], "Instances": [ "Instancias" @@ -33067,7 +34126,7 @@ strings["es"] = { "Eliminar" ], "add new instance": [ - "no se pudo crear la instancia" + "agregar nueva instancia" ], "ID": [ "ID" @@ -33079,76 +34138,76 @@ strings["es"] = { "Editar" ], "Purge": [ - "" + "Purgar" ], "There is no instances yet, add more pressing the + sign": [ - "No hay instancias todav\xEDan, agregue mas presionando el signo +" + "Todav\xEDa no hay instancias, agregue m\xE1s presionando el signo +" ], "Only show active instances": [ - "no se pudo crear la instancia" + "Solo mostrar instancias activas" ], "Active": [ - "" + "Activo" ], "Only show deleted instances": [ - "Sin instancia default" + "Mostrar solo instancias eliminadas" ], "Deleted": [ - "Eliminar" + "Eliminado" ], "Show all instances": [ - "Sin instancia default" + "Mostrar todas las instancias" ], "All": [ "Todo" ], - "Instance '%1$s' (ID: %2$s) has been deleted": [ - "" + 'Instance "%1$s" (ID: %2$s) has been deleted': [ + "La instancia '%1$s' (ID: %2$s) fue eliminada" ], "Failed to delete instance": [ - "Sin instancia default" + "Fallo al eliminar instancia" ], "Instance '%1$s' (ID: %2$s) has been disabled": [ - "" + "Instance '%1$s' (ID: %2$s) ha sido deshabilitada" ], "Failed to purge instance": [ - "no se pudo crear la instancia" + "Fallo al purgar la instancia" ], "Pending KYC verification": [ - "" + "Verificaci\xF3n KYC pendiente" ], "Timed out": [ - "" + "Expirado" ], "Exchange": [ - "URL del Exchange" + "Exchange" ], "Target account": [ - "" + "Cuenta objetivo" ], "KYC URL": [ - "" + "URL de KYC" ], "Code": [ - "" + "C\xF3digo" ], "Http Status": [ - "" + "Estado http" ], "No pending kyc verification!": [ - "" + "\xA1No hay verificaci\xF3n kyc pendiente!" ], "change value to unknown date": [ - "" + "cambiar valor a fecha desconocida" ], "change value to empty": [ - "no puede ser vac\xEDo" + "cambiar valor a vac\xEDo" ], "clear": [ - "Limpiar" + "limpiar" ], "change value to never": [ - "" + "cambiar valor a nunca" ], "never": [ "nunca" @@ -33193,28 +34252,28 @@ strings["es"] = { "Productos" ], "search products by it's description or id": [ - "" + "buscar productos por su descripci\xF3n o ID" ], "no products found with that description": [ - "No se encontraron productos" + "no se encontraron productos con esa descripci\xF3n" ], "You must enter a valid product identifier.": [ - "" + "Debe ingresar un identificador de producto v\xE1lido." ], "Quantity must be greater than 0!": [ - "Debe ser mayor a 0" + "\xA1Cantidad debe ser mayor que 0!" ], "This quantity exceeds remaining stock. Currently, only %1$s units remain unreserved in stock.": [ - "" + "Esta cantidad excede las existencias restantes. Actualmente, solo quedan %1$s unidades sin reservar en las existencias." ], "Quantity": [ "Cantidad" ], "how many products will be added": [ - "" + "cu\xE1ntos productos ser\xE1n agregados" ], "Add from inventory": [ - "" + "Agregar del inventario" ], "Image should be smaller than 1 MB": [ "La imagen debe ser mas chica que 1 MB" @@ -33226,187 +34285,190 @@ strings["es"] = { "Eliminar" ], "No taxes configured for this product.": [ - "" + "Ningun impuesto configurado para este producto." ], "Amount": [ "Monto" ], "Taxes can be in currencies that differ from the main currency used by the merchant.": [ - "" + "Impuestos pueden estar en divisas que difieren de la principal divisa usada por el comerciante." ], "Enter currency and value separated with a colon, e.g. "USD:2.3".": [ - "Moneda y valor separado por dos puntos" + "Ingrese divisa y valor separado por dos puntos, e.g. "USD:2.3"." ], "Legal name of the tax, e.g. VAT or import duties.": [ - "" + "Nombre legal del impuesto, e.g. IVA o arancel." ], "add tax to the tax list": [ - "" + "agregar impuesto a la lista de impuestos" ], "describe and add a product that is not in the inventory list": [ - "" + "describa y agregue un producto que no est\xE1 en la lista de inventarios" ], "Add custom product": [ - "" + "Agregue un producto personalizado" ], "Complete information of the product": [ - "no se pudo eliminar el producto" + "Complete informaci\xF3n del producto" ], "Image": [ "Imagen" ], "photo of the product": [ - "no se pudo crear el producto" + "foto del producto" ], "full product description": [ - "" + "descripci\xF3n completa del producto" ], "Unit": [ "Unidad" ], "name of the product unit": [ - "No se encontraron productos" + "nombre de la unidad del producto" ], "Price": [ "Precio" ], "amount in the current currency": [ - "" + "monto de la divisa actual" ], "Taxes": [ - "Impuesto" + "Impuestos" ], "image": [ - "Imagen" + "imagen" ], "description": [ - "Descripcion" + "descripci\xF3n" ], "quantity": [ - "Cantidad" + "cantidad" ], "unit price": [ - "Precio total" + "precio unitario" ], "total price": [ - "Precio total" + "precio total" ], "required": [ - "Login necesario" + "requerido" + ], + "not valid": [ + "no es un json v\xE1lido" ], "must be greater than 0": [ - "Debe ser mayor a 0" + "debe ser mayor que 0" ], "not a valid json": [ - "" + "no es un json v\xE1lido" ], "should be in the future": [ - "deber\xEDan ser iguales" + "deber\xEDan ser en el futuro" ], "refund deadline cannot be before pay deadline": [ - "" + "plazo de reembolso no puede ser antes que el plazo de pago" ], "wire transfer deadline cannot be before refund deadline": [ - "" + "el plazo de la transferencia bancaria no puede ser antes que el plazo de reembolso" ], "wire transfer deadline cannot be before pay deadline": [ - "" + "el plazo de la transferencia bancaria no puede ser antes que el plazo de pago" ], "should have a refund deadline": [ - "Plazo de reembolso autom\xE1tico" + "deber\xEDa tener un plazo de reembolso" ], "auto refund cannot be after refund deadline": [ - "Plazo de reembolso autom\xE1tico" + "reembolso autom\xE1tico no puede ser despu\xE9s qu el plazo de reembolso" ], "Manage products in order": [ - "No se encontraron productos" + "Manejar productos en orden" ], "Manage list of products in the order.": [ - "" + "Manejar lista de productos en la orden." ], "Remove this product from the order.": [ - "" + "Remover este producto de la orden." ], "Total price": [ "Precio total" ], "total product price added up": [ - "" + "precio total de producto agregado" ], "Amount to be paid by the customer": [ - "pedido por el consumidor" + "Monto a ser pagado por el cliente" ], "Order price": [ "Precio de la orden" ], "final order price": [ - "Precio de la orden" + "Precio final de la orden" ], "Summary": [ "Resumen" ], "Title of the order to be shown to the customer": [ - "" + "T\xEDtulo de la orden a ser mostrado al cliente" ], "Shipping and Fulfillment": [ - "" + "Env\xEDo y cumplimiento" ], "Delivery date": [ "Fecha de entrega" ], "Deadline for physical delivery assured by the merchant.": [ - "" + "Plazo para la entrega f\xEDsica asegurado por el comerciante." ], "Location": [ "Ubicaci\xF3n" ], "address where the products will be delivered": [ - "" + "direcci\xF3n a donde los productos ser\xE1n entregados" ], "Fulfillment URL": [ - "URL de completitud" + "URL de cumplimiento" ], "URL to which the user will be redirected after successful payment.": [ - "" + "URL al cual el usuario ser\xE1 redirigido luego de pago exitoso." ], "Taler payment options": [ - "Opciones de pago" + "Opciones de pago de Taler" ], "Override default Taler payment settings for this order": [ - "" + "Sobreescribir pagos por omisi\xF3n de Taler para esta orden" ], "Payment deadline": [ "Plazo de pago" ], "Deadline for the customer to pay for the offer before it expires. Inventory products will be reserved until this deadline.": [ - "" + "Plazo l\xEDmite para que el cliente pague por la oferta antes de que expire. Productos del inventario ser\xE1n reservados hasta este plazo l\xEDmite." ], "Refund deadline": [ "Plazo de reembolso" ], "Time until which the order can be refunded by the merchant.": [ - "" + "Tiempo hasta el cual la orden puede ser reembolsada por el comerciante." ], "Wire transfer deadline": [ - "Retrazo de transferencia por omisi\xF3n" + "Plazo de la transferencia" ], "Deadline for the exchange to make the wire transfer.": [ - "" + "Plazo para que el exchange haga la transferencia." ], "Auto-refund deadline": [ "Plazo de reembolso autom\xE1tico" ], "Time until which the wallet will automatically check for refunds without user interaction.": [ - "" + "Tiempo hasta el cual la billetera ser\xE1 autom\xE1ticamente revisada por reembolsos win interaci\xF3n por parte del usuario." ], "Maximum deposit fee": [ - "Impuesto m\xE1ximo de deposito por omisi\xF3n" + "M\xE1xima tarifa de dep\xF3sito" ], "Maximum deposit fees the merchant is willing to cover for this order. Higher deposit fees must be covered in full by the consumer.": [ - "" + "M\xE1xima tarifa de dep\xF3sito que el comerciante esta dispuesto a cubir para esta orden. Mayores tarifas de dep\xF3sito deben ser cubiertas completamente por el consumidor." ], "Maximum wire fee": [ - "Impuesto de transferencia m\xE1ximo" + "M\xE1xima tarifa de transferencia" ], "Maximum aggregate wire fees the merchant is willing to cover for this order. Wire fees exceeding this amount are to be covered by the customers.": [ "" @@ -33442,16 +34504,16 @@ strings["es"] = { "" ], "days": [ - "" + "d\xEDas" ], "hours": [ - "" + "horas" ], "minutes": [ - "" + "minutos" ], "seconds": [ - "" + "segundos" ], "forever": [ "nunca" @@ -33496,16 +34558,16 @@ strings["es"] = { "cargar viejas ordenes" ], "No orders have been found matching your query!": [ - "No se enconraron ordenes" + "\xA1No se encontraron \xF3rdenes que emparejen su b\xFAsqueda!" ], "duplicated": [ "duplicado" ], "invalid format": [ - "" + "formato inv\xE1lido" ], "this value exceed the refundable amount": [ - "" + "este monto excede el monto reembolsable" ], "date": [ "fecha" @@ -33517,7 +34579,7 @@ strings["es"] = { "raz\xF3n" ], "amount to be refunded": [ - "No se pudo create el reembolso" + "monto a ser reembolsado" ], "Max refundable:": [ "M\xE1ximo reembolzable:" @@ -33526,7 +34588,7 @@ strings["es"] = { "Raz\xF3n" ], "Choose one...": [ - "" + "Elija uno..." ], "requested by the customer": [ "pedido por el consumidor" @@ -33535,22 +34597,22 @@ strings["es"] = { "otro" ], "why this order is being refunded": [ - "No se enconraron ordenes" + "por qu\xE9 esta orden est\xE1 siendo reembolsada" ], "more information to give context": [ - "" + "m\xE1s informaci\xF3n para dar contexto" ], "Contract Terms": [ - "" + "T\xE9rminos de contrato" ], "human-readable description of the whole purchase": [ - "" + "descripci\xF3n legible de toda la compra" ], "total price for the transaction": [ - "" + "precio total de la transacci\xF3n" ], "URL for this purchase": [ - "" + "URL para esta compra" ], "Max fee": [ "M\xE1xima comisi\xF3n" @@ -33568,7 +34630,7 @@ strings["es"] = { "" ], "Created at": [ - "creado" + "Creado en" ], "time when this contract was generated": [ "" @@ -33814,7 +34876,7 @@ strings["es"] = { "Vendido" ], "free": [ - "" + "Gratis" ], "go to product update page": [ "producto actualizado correctamente" @@ -33889,7 +34951,7 @@ strings["es"] = { "" ], "Next": [ - "" + "Siguiente" ], "Wire method": [ "" @@ -33904,7 +34966,7 @@ strings["es"] = { "No se pudo create el reembolso" ], "Valid until": [ - "" + "V\xE1lido hasta" ], "Created balance": [ "creado" @@ -33922,7 +34984,7 @@ strings["es"] = { "Direcci\xF3n de cuenta" ], "Subject": [ - "" + "Asunto" ], "Tips": [ "Propinas" @@ -33993,6 +35055,12 @@ strings["es"] = { "to short": [ "" ], + "just letters and numbers from 2 to 7": [ + "" + ], + "size of the key should be 32": [ + "" + ], "Identifier": [ "" ], @@ -34002,12 +35070,21 @@ strings["es"] = { "Describe what this template stands for": [ "" ], - "Order summary": [ + "Fixed summary": [ "Estado de orden" ], - "Minimum age": [ + "If specified, this template will create order with the same summary": [ "" ], + "Fixed price": [ + "precio unitario" + ], + "If specified, this template will create order with the same price": [ + "" + ], + "Minimum age": [ + "Edad m\xEDnima" + ], "Is this contract restricted to some age?": [ "" ], @@ -34017,12 +35094,36 @@ strings["es"] = { "How much time has the customer to complete the payment once the order was created.": [ "" ], + "Verification algorithm": [ + "" + ], + "Algorithm to use to verify transaction in offline mode": [ + "" + ], "Point-of-sale key": [ "" ], "Useful to validate the purchase": [ "" ], + "generate random secret key": [ + "" + ], + "random": [ + "" + ], + "show secret key": [ + "" + ], + "hide secret key": [ + "" + ], + "hide": [ + "" + ], + "show": [ + "" + ], "could not inform template": [ "no se pudo informar la transferencia" ], @@ -34032,12 +35133,36 @@ strings["es"] = { "Order summary is required": [ "" ], + "New order for template": [ + "cargar viejas transferencias" + ], "Amount of the order": [ "" ], + "Order summary": [ + "Estado de orden" + ], "could not create order from template": [ "No se pudo create el reembolso" ], + "Here you can specify a default value for fields that are not fixed. Default values can be edited by the customer before the payment.": [ + "" + ], + "Fixed amount": [ + "Monto reembolzado" + ], + "Default amount": [ + "Monto reembolzado" + ], + "Default summary": [ + "Estado de orden" + ], + "Print": [ + "" + ], + "Setup TOTP": [ + "" + ], "Templates": [ "" ], @@ -34056,6 +35181,9 @@ strings["es"] = { "use template to create new order": [ "" ], + "create qr code for the template": [ + "No se pudo create el reembolso" + ], "load more templates after the last one": [ "" ], @@ -34093,7 +35221,7 @@ strings["es"] = { "" ], "URL": [ - "" + "URL" ], "URL of the webhook where the customer will be redirected": [ "" @@ -34213,10 +35341,10 @@ strings["es"] = { "desconocido" ], "delete selected transfer from the database": [ - "" + "eliminar transferencia seleccionada de la base de datos" ], "load more transfer after the last one": [ - "" + "cargue m\xE1s transferencia luego de la \xFAltima" ], "load older transfers": [ "cargar viejas transferencias" @@ -34243,49 +35371,49 @@ strings["es"] = { "N\xFAmero de edificio" ], "must be 1 or greater": [ - "" + "debe ser 1 o mayor" ], "max 7 lines": [ - "" + "m\xE1ximo 7 l\xEDneas" ], "change authorization configuration": [ - "" + "cambiar configuraci\xF3n de autorizaci\xF3n" ], "Need to complete marked fields and choose authorization method": [ - "" + "Necesita completar campos marcados y escoger un m\xE9todo de autorizaci\xF3n" ], "This is not a valid bitcoin address.": [ - "" + "Esta no es una direcci\xF3n de bitcoin v\xE1lida." ], "This is not a valid Ethereum address.": [ - "" + "Esta no es una direcci\xF3n de Ethereum v\xE1lida." ], "IBAN numbers usually have more that 4 digits": [ - "" + "N\xFAmeros IBAN usualmente tienen m\xE1s de 4 d\xEDgitos" ], "IBAN numbers usually have less that 34 digits": [ - "" + "N\xFAmero IBAN usualmente tienen menos de 34 d\xEDgitos" ], "IBAN country code not found": [ - "" + "C\xF3digo IBAN de pa\xEDs no encontrado" ], "IBAN number is not valid, checksum is wrong": [ - "" + "N\xFAmero IBAN no es v\xE1lido, la suma de verificaci\xF3n es incorrecta" ], "Target type": [ - "" + "Tipo objetivo" ], "Method to use for wire transfer": [ - "no se pudo informar la transferencia" + "M\xE9todo a usar para la transferencia" ], "Routing": [ - "" + "Enrutamiento" ], "Routing number.": [ - "N\xFAmero de edificio" + "N\xFAmero de enrutamiento." ], "Account": [ - "Monto" + "Cuenta" ], "Account number.": [ "Direcci\xF3n de cuenta" @@ -34297,7 +35425,7 @@ strings["es"] = { "" ], "Unified Payment Interface.": [ - "" + "Interfaz de pago unificado." ], "Bitcoin protocol.": [ "" @@ -34339,7 +35467,7 @@ strings["es"] = { "" ], "Website URL": [ - "" + "URL de sitio web" ], "URL.": [ "" @@ -34351,7 +35479,7 @@ strings["es"] = { "" ], "Bank account": [ - "" + "Cuenta bancaria" ], "URI specifying bank account for crediting revenue.": [ "" @@ -34381,7 +35509,7 @@ strings["es"] = { "Jurisdicci\xF3n" ], "Jurisdiction for legal disputes with the merchant.": [ - "" + "Jurisdicci\xF3n para disputas legales con el comerciante." ], "Default payment delay": [ "Retrazo de pago por omisi\xF3n" @@ -34396,16 +35524,16 @@ strings["es"] = { "" ], "Instance id": [ - "Instancia" + "ID de instancia" ], "Change the authorization method use for this instance.": [ - "Limpiar el token de autorizaci\xF3n significa acceso publico a la instancia" + "Limpiar el token de autorizaci\xF3n significa acceso p\xFAblico a la instancia" ], "Manage access token": [ - "Administrar token" + "Administrar token de acceso" ], "Failed to create instance": [ - "no se pudo crear la instancia" + "Fallo al crear la instancia" ], "Login required": [ "Login necesario" @@ -34419,12 +35547,15 @@ strings["es"] = { "The request to the backend take too long and was cancelled": [ "" ], - "Diagnostic from %1$s is '%2$s'": [ + 'Diagnostic from %1$s is "%2$s"': [ "" ], "The backend reported a problem: HTTP status #%1$s": [ "Servidir reporto un problema: HTTP status #%1$s" ], + "Diagnostic from %1$s is '%2$s'": [ + "" + ], "Access denied": [ "Acceso denegado" ], @@ -34473,11 +35604,14 @@ strings["es"] = { "Server not found": [ "Servidor no encontrado" ], - "Couldn't access the server": [ - "No se pudo aceder al servidor" + "Server response with an error code": [ + "" ], "Got message %1$s from %2$s": [ - "Recivimos el mensaje %1$s desde %2$s" + "Recibimos el mensaje %1$s desde %2$s" + ], + "Response from server is unreadable, http status: %1$s": [ + "" ], "Unexpected Error": [ "Error inesperado" @@ -34486,7 +35620,7 @@ strings["es"] = { "El valor %1$s es invalido para una URL de pago" ], "add element to the list": [ - "" + "agregar elemento a la lista" ], "add": [ "Agregar" @@ -34498,10 +35632,10 @@ strings["es"] = { "Cambiando" ], "Order ID": [ - "Orden" + "ID de pedido" ], "Payment URL": [ - "Detalles de pago" + "URL de pago" ] } } @@ -34521,6 +35655,9 @@ strings["fr"] = { "%1$s": [ "" ], + "Close": [ + "" + ], "Continue": [ "" ], @@ -34629,7 +35766,7 @@ strings["fr"] = { "All": [ "" ], - "Instance '%1$s' (ID: %2$s) has been deleted": [ + 'Instance "%1$s" (ID: %2$s) has been deleted': [ "" ], "Failed to delete instance": [ @@ -34821,6 +35958,9 @@ strings["fr"] = { "required": [ "" ], + "not valid": [ + "" + ], "must be greater than 0": [ "" ], @@ -35520,6 +36660,12 @@ strings["fr"] = { "to short": [ "" ], + "just letters and numbers from 2 to 7": [ + "" + ], + "size of the key should be 32": [ + "" + ], "Identifier": [ "" ], @@ -35529,7 +36675,16 @@ strings["fr"] = { "Describe what this template stands for": [ "" ], - "Order summary": [ + "Fixed summary": [ + "" + ], + "If specified, this template will create order with the same summary": [ + "" + ], + "Fixed price": [ + "" + ], + "If specified, this template will create order with the same price": [ "" ], "Minimum age": [ @@ -35544,12 +36699,36 @@ strings["fr"] = { "How much time has the customer to complete the payment once the order was created.": [ "" ], + "Verification algorithm": [ + "" + ], + "Algorithm to use to verify transaction in offline mode": [ + "" + ], "Point-of-sale key": [ "" ], "Useful to validate the purchase": [ "" ], + "generate random secret key": [ + "" + ], + "random": [ + "" + ], + "show secret key": [ + "" + ], + "hide secret key": [ + "" + ], + "hide": [ + "" + ], + "show": [ + "" + ], "could not inform template": [ "" ], @@ -35559,12 +36738,36 @@ strings["fr"] = { "Order summary is required": [ "" ], + "New order for template": [ + "" + ], "Amount of the order": [ "" ], + "Order summary": [ + "" + ], "could not create order from template": [ "" ], + "Here you can specify a default value for fields that are not fixed. Default values can be edited by the customer before the payment.": [ + "" + ], + "Fixed amount": [ + "" + ], + "Default amount": [ + "" + ], + "Default summary": [ + "" + ], + "Print": [ + "" + ], + "Setup TOTP": [ + "" + ], "Templates": [ "" ], @@ -35583,6 +36786,9 @@ strings["fr"] = { "use template to create new order": [ "" ], + "create qr code for the template": [ + "" + ], "load more templates after the last one": [ "" ], @@ -35946,12 +37152,15 @@ strings["fr"] = { "The request to the backend take too long and was cancelled": [ "" ], - "Diagnostic from %1$s is '%2$s'": [ + 'Diagnostic from %1$s is "%2$s"': [ "" ], "The backend reported a problem: HTTP status #%1$s": [ "" ], + "Diagnostic from %1$s is '%2$s'": [ + "" + ], "Access denied": [ "" ], @@ -36000,12 +37209,15 @@ strings["fr"] = { "Server not found": [ "" ], - "Couldn't access the server": [ + "Server response with an error code": [ "" ], "Got message %1$s from %2$s": [ "" ], + "Response from server is unreadable, http status: %1$s": [ + "" + ], "Unexpected Error": [ "" ], @@ -36048,6 +37260,9 @@ strings["it"] = { "%1$s": [ "" ], + "Close": [ + "" + ], "Continue": [ "" ], @@ -36156,7 +37371,7 @@ strings["it"] = { "All": [ "" ], - "Instance '%1$s' (ID: %2$s) has been deleted": [ + 'Instance "%1$s" (ID: %2$s) has been deleted': [ "" ], "Failed to delete instance": [ @@ -36348,6 +37563,9 @@ strings["it"] = { "required": [ "" ], + "not valid": [ + "" + ], "must be greater than 0": [ "" ], @@ -37047,6 +38265,12 @@ strings["it"] = { "to short": [ "" ], + "just letters and numbers from 2 to 7": [ + "" + ], + "size of the key should be 32": [ + "" + ], "Identifier": [ "" ], @@ -37056,7 +38280,16 @@ strings["it"] = { "Describe what this template stands for": [ "" ], - "Order summary": [ + "Fixed summary": [ + "" + ], + "If specified, this template will create order with the same summary": [ + "" + ], + "Fixed price": [ + "" + ], + "If specified, this template will create order with the same price": [ "" ], "Minimum age": [ @@ -37071,12 +38304,36 @@ strings["it"] = { "How much time has the customer to complete the payment once the order was created.": [ "" ], + "Verification algorithm": [ + "" + ], + "Algorithm to use to verify transaction in offline mode": [ + "" + ], "Point-of-sale key": [ "" ], "Useful to validate the purchase": [ "" ], + "generate random secret key": [ + "" + ], + "random": [ + "" + ], + "show secret key": [ + "" + ], + "hide secret key": [ + "" + ], + "hide": [ + "" + ], + "show": [ + "" + ], "could not inform template": [ "" ], @@ -37086,12 +38343,36 @@ strings["it"] = { "Order summary is required": [ "" ], + "New order for template": [ + "" + ], "Amount of the order": [ "" ], + "Order summary": [ + "" + ], "could not create order from template": [ "" ], + "Here you can specify a default value for fields that are not fixed. Default values can be edited by the customer before the payment.": [ + "" + ], + "Fixed amount": [ + "" + ], + "Default amount": [ + "" + ], + "Default summary": [ + "" + ], + "Print": [ + "" + ], + "Setup TOTP": [ + "" + ], "Templates": [ "" ], @@ -37110,6 +38391,9 @@ strings["it"] = { "use template to create new order": [ "" ], + "create qr code for the template": [ + "" + ], "load more templates after the last one": [ "" ], @@ -37473,12 +38757,15 @@ strings["it"] = { "The request to the backend take too long and was cancelled": [ "" ], - "Diagnostic from %1$s is '%2$s'": [ + 'Diagnostic from %1$s is "%2$s"': [ "" ], "The backend reported a problem: HTTP status #%1$s": [ "" ], + "Diagnostic from %1$s is '%2$s'": [ + "" + ], "Access denied": [ "" ], @@ -37527,12 +38814,15 @@ strings["it"] = { "Server not found": [ "" ], - "Couldn't access the server": [ + "Server response with an error code": [ "" ], "Got message %1$s from %2$s": [ "" ], + "Response from server is unreadable, http status: %1$s": [ + "" + ], "Unexpected Error": [ "" ], @@ -37575,6 +38865,9 @@ strings["sv"] = { "%1$s": [ "" ], + "Close": [ + "" + ], "Continue": [ "" ], @@ -37683,7 +38976,7 @@ strings["sv"] = { "All": [ "" ], - "Instance '%1$s' (ID: %2$s) has been deleted": [ + 'Instance "%1$s" (ID: %2$s) has been deleted': [ "" ], "Failed to delete instance": [ @@ -37875,6 +39168,9 @@ strings["sv"] = { "required": [ "" ], + "not valid": [ + "" + ], "must be greater than 0": [ "" ], @@ -38574,6 +39870,12 @@ strings["sv"] = { "to short": [ "" ], + "just letters and numbers from 2 to 7": [ + "" + ], + "size of the key should be 32": [ + "" + ], "Identifier": [ "" ], @@ -38583,7 +39885,16 @@ strings["sv"] = { "Describe what this template stands for": [ "" ], - "Order summary": [ + "Fixed summary": [ + "" + ], + "If specified, this template will create order with the same summary": [ + "" + ], + "Fixed price": [ + "" + ], + "If specified, this template will create order with the same price": [ "" ], "Minimum age": [ @@ -38598,12 +39909,36 @@ strings["sv"] = { "How much time has the customer to complete the payment once the order was created.": [ "" ], + "Verification algorithm": [ + "" + ], + "Algorithm to use to verify transaction in offline mode": [ + "" + ], "Point-of-sale key": [ "" ], "Useful to validate the purchase": [ "" ], + "generate random secret key": [ + "" + ], + "random": [ + "" + ], + "show secret key": [ + "" + ], + "hide secret key": [ + "" + ], + "hide": [ + "" + ], + "show": [ + "" + ], "could not inform template": [ "" ], @@ -38613,12 +39948,36 @@ strings["sv"] = { "Order summary is required": [ "" ], + "New order for template": [ + "" + ], "Amount of the order": [ "" ], + "Order summary": [ + "" + ], "could not create order from template": [ "" ], + "Here you can specify a default value for fields that are not fixed. Default values can be edited by the customer before the payment.": [ + "" + ], + "Fixed amount": [ + "" + ], + "Default amount": [ + "" + ], + "Default summary": [ + "" + ], + "Print": [ + "" + ], + "Setup TOTP": [ + "" + ], "Templates": [ "" ], @@ -38637,6 +39996,9 @@ strings["sv"] = { "use template to create new order": [ "" ], + "create qr code for the template": [ + "" + ], "load more templates after the last one": [ "" ], @@ -39000,12 +40362,15 @@ strings["sv"] = { "The request to the backend take too long and was cancelled": [ "" ], - "Diagnostic from %1$s is '%2$s'": [ + 'Diagnostic from %1$s is "%2$s"': [ "" ], "The backend reported a problem: HTTP status #%1$s": [ "" ], + "Diagnostic from %1$s is '%2$s'": [ + "" + ], "Access denied": [ "" ], @@ -39054,12 +40419,15 @@ strings["sv"] = { "Server not found": [ "" ], - "Couldn't access the server": [ + "Server response with an error code": [ "" ], "Got message %1$s from %2$s": [ "" ], + "Response from server is unreadable, http status: %1$s": [ + "" + ], "Unexpected Error": [ "" ], @@ -39103,7 +40471,7 @@ function getLangName(s5) { return s5; } function LangSelector() { - const [updatingLang, setUpdatingLang] = p2(false); + const [updatingLang, setUpdatingLang] = p3(false); const { lang, changeLanguage } = useTranslationContext(); return /* @__PURE__ */ h("div", { class: "dropdown is-active " }, /* @__PURE__ */ h("div", { class: "dropdown-trigger" }, /* @__PURE__ */ h( "button", @@ -39204,7 +40572,7 @@ function Sidebar({ " (", config.version, ")" - ))), /* @__PURE__ */ h("div", { class: "menu is-menu-main" }, instance ? /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("p", { class: "menu-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Instance")), /* @__PURE__ */ h("ul", { class: "menu-list" }, /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/update", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-square-edit-outline" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Settings")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/orders", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash-register" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Orders")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/products", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-shopping" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Products")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/transfers", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-bank" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Transfers")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/templates", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-newspaper" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Templates")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/reserves", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, "Reserves"))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/webhooks", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-newspaper" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Webhooks")))), needKYC && /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/kyc", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-account-check" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, "KYC Status"))))) : void 0, /* @__PURE__ */ h("p", { class: "menu-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Connection")), /* @__PURE__ */ h("ul", { class: "menu-list" }, /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("span", { style: { width: "3rem" }, class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-currency-eur" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, config.currency))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("span", { style: { width: "3rem" }, class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-web" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, new URL(backend.url).hostname))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("span", { style: { width: "3rem" }, class: "icon" }, "ID"), /* @__PURE__ */ h("span", { class: "menu-item-label" }, !instance ? "default" : instance))), admin && !mimic && /* @__PURE__ */ h(p, null, /* @__PURE__ */ h("p", { class: "menu-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Instances")), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/instance/new", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-plus" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "New")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/instances", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-format-list-bulleted" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "List"))))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h( + ))), /* @__PURE__ */ h("div", { class: "menu is-menu-main" }, instance ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("p", { class: "menu-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Instance")), /* @__PURE__ */ h("ul", { class: "menu-list" }, /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/update", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-square-edit-outline" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Settings")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/orders", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash-register" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Orders")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/products", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-shopping" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Products")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/transfers", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-bank" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Transfers")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/templates", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-newspaper" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Templates")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/reserves", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, "Reserves"))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/webhooks", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-newspaper" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Webhooks")))), needKYC && /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/kyc", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-account-check" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, "KYC Status"))))) : void 0, /* @__PURE__ */ h("p", { class: "menu-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Connection")), /* @__PURE__ */ h("ul", { class: "menu-list" }, /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("span", { style: { width: "3rem" }, class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-currency-eur" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, config.currency))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("span", { style: { width: "3rem" }, class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-web" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, new URL(backend.url).hostname))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("span", { style: { width: "3rem" }, class: "icon" }, "ID"), /* @__PURE__ */ h("span", { class: "menu-item-label" }, !instance ? "default" : instance))), admin && !mimic && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("p", { class: "menu-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Instances")), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/instance/new", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-plus" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "New")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/instances", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-format-list-bulleted" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "List"))))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h( "a", { class: "has-icon is-state-info is-hoverable", @@ -39270,7 +40638,7 @@ function WithTitle({ h2(() => { document.title = `Taler Backoffice: ${title}`; }, [title]); - return /* @__PURE__ */ h(p, null, children); + return /* @__PURE__ */ h(p2, null, children); } function Menu({ onLogout, @@ -39280,7 +40648,7 @@ function Menu({ admin, setInstanceName }) { - const [mobileOpen, setMobileOpen] = p2(false); + const [mobileOpen, setMobileOpen] = p3(false); const titleWithSubtitle = title ? title : !admin ? getInstanceTitle(path, instance) : getAdminTitle(path, instance); const adminInstance = instance === "default"; const mimic = admin && !adminInstance; @@ -39337,7 +40705,7 @@ function NotYetReadyAppMenu({ onLogout, title }) { - const [mobileOpen, setMobileOpen] = p2(false); + const [mobileOpen, setMobileOpen] = p3(false); h2(() => { document.title = `Taler Backoffice: ${title}`; }, [title]); @@ -39371,27 +40739,27 @@ function ApplicationReadyRoutes() { clearAllTokens(); route("/"); }; - if (result.clientError && result.isUnauthorized) { - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Login", onLogout: clearTokenAndGoToRoot }), /* @__PURE__ */ h( - NotificationCard, - { - notification: { - message: i18n2.str`Access denied`, - description: i18n2.str`Check your token is valid`, - type: "ERROR" - } - } - ), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginStatus })); - } if (result.loading) return /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Loading..." }); let admin = true; let instanceNameByBackendURL; if (!result.ok) { + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) { + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Login", onLogout: clearTokenAndGoToRoot }), /* @__PURE__ */ h( + NotificationCard, + { + notification: { + message: i18n2.str`Access denied`, + description: i18n2.str`Check your token is valid`, + type: "ERROR" + } + } + ), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginStatus })); + } const path = new URL(backendURL).pathname; const match2 = INSTANCE_ID_LOOKUP.exec(path); if (!match2 || !match2[1]) { - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Error", onLogout: clearTokenAndGoToRoot }), /* @__PURE__ */ h( + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Error", onLogout: clearTokenAndGoToRoot }), /* @__PURE__ */ h( NotificationCard, { notification: { @@ -39423,7 +40791,7 @@ function DefaultMainRoute({ url //from preact-router }) { - const [instanceName, setInstanceName] = p2( + const [instanceName, setInstanceName] = p3( instanceNameByBackendURL || instance || "default" ); return /* @__PURE__ */ h( @@ -39445,7 +40813,7 @@ function Application() { ); } function ApplicationStatusRoutes() { - var _a2, _b; + var _a2, _b, _c; const { updateLoginStatus, triedToLog } = useBackendContext(); const result = useBackendConfig(); const { i18n: i18n2 } = useTranslationContext(); @@ -39456,45 +40824,61 @@ function ApplicationStatusRoutes() { const { currency, version } = result.ok ? result.data : { currency: "unknown", version: "unknown" }; const ctx = F(() => ({ currency, version }), [currency, version]); if (!triedToLog) { - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Welcome!" }), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Welcome!" }), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); } - if (result.clientError && result.isUnauthorized) - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Login" }), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); - if (result.clientError && result.isNotfound) - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Error" }), /* @__PURE__ */ h( - NotificationCard, - { - notification: { - message: i18n2.str`Server not found`, - type: "ERROR", - description: `Check your url` + if (!result.ok) { + if (result.loading) + return /* @__PURE__ */ h(Loading, null); + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized) { + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Login" }), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); + } + if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) { + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Error" }), /* @__PURE__ */ h( + NotificationCard, + { + notification: { + message: i18n2.str`Server not found`, + type: "ERROR", + description: `Check your url` + } } - } - ), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); - if (result.serverError) - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Error" }), /* @__PURE__ */ h( - NotificationCard, - { - notification: { - message: i18n2.str`Couldn't access the server`, - type: "ERROR", - description: i18n2.str`Got message ${result.message} from ${(_a2 = result.info) == null ? void 0 : _a2.url}` + ), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); + } + if (result.type === ErrorType.SERVER) { + /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Error" }), /* @__PURE__ */ h( + NotificationCard, + { + notification: { + message: i18n2.str`Server response with an error code`, + type: "ERROR", + description: i18n2.str`Got message ${result.message} from ${(_a2 = result.info) == null ? void 0 : _a2.url}` + } } - } - ), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); - if (result.loading) - return /* @__PURE__ */ h(Loading, null); - if (!result.ok) - return /* @__PURE__ */ h(p, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Error" }), /* @__PURE__ */ h( + ), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); + } + if (result.type === ErrorType.UNREADABLE) { + /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Error" }), /* @__PURE__ */ h( + NotificationCard, + { + notification: { + message: i18n2.str`Response from server is unreadable, http status: ${result.status}`, + type: "ERROR", + description: i18n2.str`Got message ${result.message} from ${(_b = result.info) == null ? void 0 : _b.url}` + } + } + ), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); + } + return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { title: "Error" }), /* @__PURE__ */ h( NotificationCard, { notification: { message: i18n2.str`Unexpected Error`, type: "ERROR", - description: i18n2.str`Got message ${result.message} from ${(_b = result.info) == null ? void 0 : _b.url}` + description: i18n2.str`Got message ${result.message} from ${(_c = result.info) == null ? void 0 : _c.url}` } } ), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginInfoAndGoToRoot })); + } return /* @__PURE__ */ h("div", { class: "has-navbar-fixed-top" }, /* @__PURE__ */ h(ConfigContextProvider, { value: ctx }, /* @__PURE__ */ h(ApplicationReadyRoutes, null))); } |