var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __pow = Math.pow;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a5, b4) => {
for (var prop in b4 || (b4 = {}))
if (__hasOwnProp.call(b4, prop))
__defNormalProp(a5, prop, b4[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b4)) {
if (__propIsEnum.call(b4, prop))
__defNormalProp(a5, prop, b4[prop]);
}
return a5;
};
var __spreadProps = (a5, b4) => __defProps(a5, __getOwnPropDescs(b4));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __esm = (fn2, res) => function __init() {
return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e4) {
reject(e4);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e4) {
reject(e4);
}
};
var step = (x6) => x6.done ? resolve(x6.value) : Promise.resolve(x6.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// ../../node_modules/.pnpm/big-integer@1.6.51/node_modules/big-integer/BigInteger.js
var require_BigInteger = __commonJS({
"../../node_modules/.pnpm/big-integer@1.6.51/node_modules/big-integer/BigInteger.js"(exports, module) {
var bigInt = function(undefined2) {
"use strict";
var BASE = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
var supportsNativeBigInt = typeof BigInt === "function";
function Integer(v3, radix, alphabet, caseSensitive) {
if (typeof v3 === "undefined")
return Integer[0];
if (typeof radix !== "undefined")
return +radix === 10 && !alphabet ? parseValue(v3) : parseBase(v3, radix, alphabet, caseSensitive);
return parseValue(v3);
}
function BigInteger(value, sign) {
this.value = value;
this.sign = sign;
this.isSmall = false;
}
BigInteger.prototype = Object.create(Integer.prototype);
function SmallInteger(value) {
this.value = value;
this.sign = value < 0;
this.isSmall = true;
}
SmallInteger.prototype = Object.create(Integer.prototype);
function NativeBigInt(value) {
this.value = value;
}
NativeBigInt.prototype = Object.create(Integer.prototype);
function isPrecise(n2) {
return -MAX_INT < n2 && n2 < MAX_INT;
}
function smallToArray(n2) {
if (n2 < 1e7)
return [n2];
if (n2 < 1e14)
return [n2 % 1e7, Math.floor(n2 / 1e7)];
return [n2 % 1e7, Math.floor(n2 / 1e7) % 1e7, Math.floor(n2 / 1e14)];
}
function arrayToSmall(arr) {
trim2(arr);
var length = arr.length;
if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
switch (length) {
case 0:
return 0;
case 1:
return arr[0];
case 2:
return arr[0] + arr[1] * BASE;
default:
return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
}
}
return arr;
}
function trim2(v3) {
var i5 = v3.length;
while (v3[--i5] === 0)
;
v3.length = i5 + 1;
}
function createArray(length) {
var x6 = new Array(length);
var i5 = -1;
while (++i5 < length) {
x6[i5] = 0;
}
return x6;
}
function truncate(n2) {
if (n2 > 0)
return Math.floor(n2);
return Math.ceil(n2);
}
function add3(a5, b4) {
var l_a = a5.length, l_b = b4.length, r3 = new Array(l_a), carry = 0, base2 = BASE, sum2, i5;
for (i5 = 0; i5 < l_b; i5++) {
sum2 = a5[i5] + b4[i5] + carry;
carry = sum2 >= base2 ? 1 : 0;
r3[i5] = sum2 - carry * base2;
}
while (i5 < l_a) {
sum2 = a5[i5] + carry;
carry = sum2 === base2 ? 1 : 0;
r3[i5++] = sum2 - carry * base2;
}
if (carry > 0)
r3.push(carry);
return r3;
}
function addAny(a5, b4) {
if (a5.length >= b4.length)
return add3(a5, b4);
return add3(b4, a5);
}
function addSmall(a5, carry) {
var l3 = a5.length, r3 = new Array(l3), base2 = BASE, sum2, i5;
for (i5 = 0; i5 < l3; i5++) {
sum2 = a5[i5] - base2 + carry;
carry = Math.floor(sum2 / base2);
r3[i5] = sum2 - carry * base2;
carry += 1;
}
while (carry > 0) {
r3[i5++] = carry % base2;
carry = Math.floor(carry / base2);
}
return r3;
}
BigInteger.prototype.add = function(v3) {
var n2 = parseValue(v3);
if (this.sign !== n2.sign) {
return this.subtract(n2.negate());
}
var a5 = this.value, b4 = n2.value;
if (n2.isSmall) {
return new BigInteger(addSmall(a5, Math.abs(b4)), this.sign);
}
return new BigInteger(addAny(a5, b4), this.sign);
};
BigInteger.prototype.plus = BigInteger.prototype.add;
SmallInteger.prototype.add = function(v3) {
var n2 = parseValue(v3);
var a5 = this.value;
if (a5 < 0 !== n2.sign) {
return this.subtract(n2.negate());
}
var b4 = n2.value;
if (n2.isSmall) {
if (isPrecise(a5 + b4))
return new SmallInteger(a5 + b4);
b4 = smallToArray(Math.abs(b4));
}
return new BigInteger(addSmall(b4, Math.abs(a5)), a5 < 0);
};
SmallInteger.prototype.plus = SmallInteger.prototype.add;
NativeBigInt.prototype.add = function(v3) {
return new NativeBigInt(this.value + parseValue(v3).value);
};
NativeBigInt.prototype.plus = NativeBigInt.prototype.add;
function subtract(a5, b4) {
var a_l = a5.length, b_l = b4.length, r3 = new Array(a_l), borrow = 0, base2 = BASE, i5, difference2;
for (i5 = 0; i5 < b_l; i5++) {
difference2 = a5[i5] - borrow - b4[i5];
if (difference2 < 0) {
difference2 += base2;
borrow = 1;
} else
borrow = 0;
r3[i5] = difference2;
}
for (i5 = b_l; i5 < a_l; i5++) {
difference2 = a5[i5] - borrow;
if (difference2 < 0)
difference2 += base2;
else {
r3[i5++] = difference2;
break;
}
r3[i5] = difference2;
}
for (; i5 < a_l; i5++) {
r3[i5] = a5[i5];
}
trim2(r3);
return r3;
}
function subtractAny(a5, b4, sign) {
var value;
if (compareAbs(a5, b4) >= 0) {
value = subtract(a5, b4);
} else {
value = subtract(b4, a5);
sign = !sign;
}
value = arrayToSmall(value);
if (typeof value === "number") {
if (sign)
value = -value;
return new SmallInteger(value);
}
return new BigInteger(value, sign);
}
function subtractSmall(a5, b4, sign) {
var l3 = a5.length, r3 = new Array(l3), carry = -b4, base2 = BASE, i5, difference2;
for (i5 = 0; i5 < l3; i5++) {
difference2 = a5[i5] + carry;
carry = Math.floor(difference2 / base2);
difference2 %= base2;
r3[i5] = difference2 < 0 ? difference2 + base2 : difference2;
}
r3 = arrayToSmall(r3);
if (typeof r3 === "number") {
if (sign)
r3 = -r3;
return new SmallInteger(r3);
}
return new BigInteger(r3, sign);
}
BigInteger.prototype.subtract = function(v3) {
var n2 = parseValue(v3);
if (this.sign !== n2.sign) {
return this.add(n2.negate());
}
var a5 = this.value, b4 = n2.value;
if (n2.isSmall)
return subtractSmall(a5, Math.abs(b4), this.sign);
return subtractAny(a5, b4, this.sign);
};
BigInteger.prototype.minus = BigInteger.prototype.subtract;
SmallInteger.prototype.subtract = function(v3) {
var n2 = parseValue(v3);
var a5 = this.value;
if (a5 < 0 !== n2.sign) {
return this.add(n2.negate());
}
var b4 = n2.value;
if (n2.isSmall) {
return new SmallInteger(a5 - b4);
}
return subtractSmall(b4, Math.abs(a5), a5 >= 0);
};
SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
NativeBigInt.prototype.subtract = function(v3) {
return new NativeBigInt(this.value - parseValue(v3).value);
};
NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;
BigInteger.prototype.negate = function() {
return new BigInteger(this.value, !this.sign);
};
SmallInteger.prototype.negate = function() {
var sign = this.sign;
var small = new SmallInteger(-this.value);
small.sign = !sign;
return small;
};
NativeBigInt.prototype.negate = function() {
return new NativeBigInt(-this.value);
};
BigInteger.prototype.abs = function() {
return new BigInteger(this.value, false);
};
SmallInteger.prototype.abs = function() {
return new SmallInteger(Math.abs(this.value));
};
NativeBigInt.prototype.abs = function() {
return new NativeBigInt(this.value >= 0 ? this.value : -this.value);
};
function multiplyLong(a5, b4) {
var a_l = a5.length, b_l = b4.length, l3 = a_l + b_l, r3 = createArray(l3), base2 = BASE, product, carry, i5, a_i, b_j;
for (i5 = 0; i5 < a_l; ++i5) {
a_i = a5[i5];
for (var j4 = 0; j4 < b_l; ++j4) {
b_j = b4[j4];
product = a_i * b_j + r3[i5 + j4];
carry = Math.floor(product / base2);
r3[i5 + j4] = product - carry * base2;
r3[i5 + j4 + 1] += carry;
}
}
trim2(r3);
return r3;
}
function multiplySmall(a5, b4) {
var l3 = a5.length, r3 = new Array(l3), base2 = BASE, carry = 0, product, i5;
for (i5 = 0; i5 < l3; i5++) {
product = a5[i5] * b4 + carry;
carry = Math.floor(product / base2);
r3[i5] = product - carry * base2;
}
while (carry > 0) {
r3[i5++] = carry % base2;
carry = Math.floor(carry / base2);
}
return r3;
}
function shiftLeft(x6, n2) {
var r3 = [];
while (n2-- > 0)
r3.push(0);
return r3.concat(x6);
}
function multiplyKaratsuba(x6, y5) {
var n2 = Math.max(x6.length, y5.length);
if (n2 <= 30)
return multiplyLong(x6, y5);
n2 = Math.ceil(n2 / 2);
var b4 = x6.slice(n2), a5 = x6.slice(0, n2), d5 = y5.slice(n2), c4 = y5.slice(0, n2);
var ac = multiplyKaratsuba(a5, c4), bd = multiplyKaratsuba(b4, d5), abcd = multiplyKaratsuba(addAny(a5, b4), addAny(c4, d5));
var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n2)), shiftLeft(bd, 2 * n2));
trim2(product);
return product;
}
function useKaratsuba(l1, l22) {
return -0.012 * l1 - 0.012 * l22 + 15e-6 * l1 * l22 > 0;
}
BigInteger.prototype.multiply = function(v3) {
var n2 = parseValue(v3), a5 = this.value, b4 = n2.value, sign = this.sign !== n2.sign, abs;
if (n2.isSmall) {
if (b4 === 0)
return Integer[0];
if (b4 === 1)
return this;
if (b4 === -1)
return this.negate();
abs = Math.abs(b4);
if (abs < BASE) {
return new BigInteger(multiplySmall(a5, abs), sign);
}
b4 = smallToArray(abs);
}
if (useKaratsuba(a5.length, b4.length))
return new BigInteger(multiplyKaratsuba(a5, b4), sign);
return new BigInteger(multiplyLong(a5, b4), sign);
};
BigInteger.prototype.times = BigInteger.prototype.multiply;
function multiplySmallAndArray(a5, b4, sign) {
if (a5 < BASE) {
return new BigInteger(multiplySmall(b4, a5), sign);
}
return new BigInteger(multiplyLong(b4, smallToArray(a5)), sign);
}
SmallInteger.prototype._multiplyBySmall = function(a5) {
if (isPrecise(a5.value * this.value)) {
return new SmallInteger(a5.value * this.value);
}
return multiplySmallAndArray(Math.abs(a5.value), smallToArray(Math.abs(this.value)), this.sign !== a5.sign);
};
BigInteger.prototype._multiplyBySmall = function(a5) {
if (a5.value === 0)
return Integer[0];
if (a5.value === 1)
return this;
if (a5.value === -1)
return this.negate();
return multiplySmallAndArray(Math.abs(a5.value), this.value, this.sign !== a5.sign);
};
SmallInteger.prototype.multiply = function(v3) {
return parseValue(v3)._multiplyBySmall(this);
};
SmallInteger.prototype.times = SmallInteger.prototype.multiply;
NativeBigInt.prototype.multiply = function(v3) {
return new NativeBigInt(this.value * parseValue(v3).value);
};
NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;
function square(a5) {
var l3 = a5.length, r3 = createArray(l3 + l3), base2 = BASE, product, carry, i5, a_i, a_j;
for (i5 = 0; i5 < l3; i5++) {
a_i = a5[i5];
carry = 0 - a_i * a_i;
for (var j4 = i5; j4 < l3; j4++) {
a_j = a5[j4];
product = 2 * (a_i * a_j) + r3[i5 + j4] + carry;
carry = Math.floor(product / base2);
r3[i5 + j4] = product - carry * base2;
}
r3[i5 + l3] = carry;
}
trim2(r3);
return r3;
}
BigInteger.prototype.square = function() {
return new BigInteger(square(this.value), false);
};
SmallInteger.prototype.square = function() {
var value = this.value * this.value;
if (isPrecise(value))
return new SmallInteger(value);
return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
};
NativeBigInt.prototype.square = function(v3) {
return new NativeBigInt(this.value * this.value);
};
function divMod1(a5, b4) {
var a_l = a5.length, b_l = b4.length, base2 = BASE, result = createArray(b4.length), divisorMostSignificantDigit = b4[b_l - 1], lambda = Math.ceil(base2 / (2 * divisorMostSignificantDigit)), remainder = multiplySmall(a5, lambda), divisor = multiplySmall(b4, lambda), quotientDigit, shift, carry, borrow, i5, l3, q5;
if (remainder.length <= a_l)
remainder.push(0);
divisor.push(0);
divisorMostSignificantDigit = divisor[b_l - 1];
for (shift = a_l - b_l; shift >= 0; shift--) {
quotientDigit = base2 - 1;
if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
quotientDigit = Math.floor((remainder[shift + b_l] * base2 + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
}
carry = 0;
borrow = 0;
l3 = divisor.length;
for (i5 = 0; i5 < l3; i5++) {
carry += quotientDigit * divisor[i5];
q5 = Math.floor(carry / base2);
borrow += remainder[shift + i5] - (carry - q5 * base2);
carry = q5;
if (borrow < 0) {
remainder[shift + i5] = borrow + base2;
borrow = -1;
} else {
remainder[shift + i5] = borrow;
borrow = 0;
}
}
while (borrow !== 0) {
quotientDigit -= 1;
carry = 0;
for (i5 = 0; i5 < l3; i5++) {
carry += remainder[shift + i5] - base2 + divisor[i5];
if (carry < 0) {
remainder[shift + i5] = carry + base2;
carry = 0;
} else {
remainder[shift + i5] = carry;
carry = 1;
}
}
borrow += carry;
}
result[shift] = quotientDigit;
}
remainder = divModSmall(remainder, lambda)[0];
return [arrayToSmall(result), arrayToSmall(remainder)];
}
function divMod2(a5, b4) {
var a_l = a5.length, b_l = b4.length, result = [], part = [], base2 = BASE, guess, xlen, highx, highy, check;
while (a_l) {
part.unshift(a5[--a_l]);
trim2(part);
if (compareAbs(part, b4) < 0) {
result.push(0);
continue;
}
xlen = part.length;
highx = part[xlen - 1] * base2 + part[xlen - 2];
highy = b4[b_l - 1] * base2 + b4[b_l - 2];
if (xlen > b_l) {
highx = (highx + 1) * base2;
}
guess = Math.ceil(highx / highy);
do {
check = multiplySmall(b4, guess);
if (compareAbs(check, part) <= 0)
break;
guess--;
} while (guess);
result.push(guess);
part = subtract(part, check);
}
result.reverse();
return [arrayToSmall(result), arrayToSmall(part)];
}
function divModSmall(value, lambda) {
var length = value.length, quotient = createArray(length), base2 = BASE, i5, q5, remainder, divisor;
remainder = 0;
for (i5 = length - 1; i5 >= 0; --i5) {
divisor = remainder * base2 + value[i5];
q5 = truncate(divisor / lambda);
remainder = divisor - q5 * lambda;
quotient[i5] = q5 | 0;
}
return [quotient, remainder | 0];
}
function divModAny(self2, v3) {
var value, n2 = parseValue(v3);
if (supportsNativeBigInt) {
return [new NativeBigInt(self2.value / n2.value), new NativeBigInt(self2.value % n2.value)];
}
var a5 = self2.value, b4 = n2.value;
var quotient;
if (b4 === 0)
throw new Error("Cannot divide by zero");
if (self2.isSmall) {
if (n2.isSmall) {
return [new SmallInteger(truncate(a5 / b4)), new SmallInteger(a5 % b4)];
}
return [Integer[0], self2];
}
if (n2.isSmall) {
if (b4 === 1)
return [self2, Integer[0]];
if (b4 == -1)
return [self2.negate(), Integer[0]];
var abs = Math.abs(b4);
if (abs < BASE) {
value = divModSmall(a5, abs);
quotient = arrayToSmall(value[0]);
var remainder = value[1];
if (self2.sign)
remainder = -remainder;
if (typeof quotient === "number") {
if (self2.sign !== n2.sign)
quotient = -quotient;
return [new SmallInteger(quotient), new SmallInteger(remainder)];
}
return [new BigInteger(quotient, self2.sign !== n2.sign), new SmallInteger(remainder)];
}
b4 = smallToArray(abs);
}
var comparison = compareAbs(a5, b4);
if (comparison === -1)
return [Integer[0], self2];
if (comparison === 0)
return [Integer[self2.sign === n2.sign ? 1 : -1], Integer[0]];
if (a5.length + b4.length <= 200)
value = divMod1(a5, b4);
else
value = divMod2(a5, b4);
quotient = value[0];
var qSign = self2.sign !== n2.sign, mod = value[1], mSign = self2.sign;
if (typeof quotient === "number") {
if (qSign)
quotient = -quotient;
quotient = new SmallInteger(quotient);
} else
quotient = new BigInteger(quotient, qSign);
if (typeof mod === "number") {
if (mSign)
mod = -mod;
mod = new SmallInteger(mod);
} else
mod = new BigInteger(mod, mSign);
return [quotient, mod];
}
BigInteger.prototype.divmod = function(v3) {
var result = divModAny(this, v3);
return {
quotient: result[0],
remainder: result[1]
};
};
NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
BigInteger.prototype.divide = function(v3) {
return divModAny(this, v3)[0];
};
NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function(v3) {
return new NativeBigInt(this.value / parseValue(v3).value);
};
SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
BigInteger.prototype.mod = function(v3) {
return divModAny(this, v3)[1];
};
NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function(v3) {
return new NativeBigInt(this.value % parseValue(v3).value);
};
SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
BigInteger.prototype.pow = function(v3) {
var n2 = parseValue(v3), a5 = this.value, b4 = n2.value, value, x6, y5;
if (b4 === 0)
return Integer[1];
if (a5 === 0)
return Integer[0];
if (a5 === 1)
return Integer[1];
if (a5 === -1)
return n2.isEven() ? Integer[1] : Integer[-1];
if (n2.sign) {
return Integer[0];
}
if (!n2.isSmall)
throw new Error("The exponent " + n2.toString() + " is too large.");
if (this.isSmall) {
if (isPrecise(value = Math.pow(a5, b4)))
return new SmallInteger(truncate(value));
}
x6 = this;
y5 = Integer[1];
while (true) {
if (b4 & true) {
y5 = y5.times(x6);
--b4;
}
if (b4 === 0)
break;
b4 /= 2;
x6 = x6.square();
}
return y5;
};
SmallInteger.prototype.pow = BigInteger.prototype.pow;
NativeBigInt.prototype.pow = function(v3) {
var n2 = parseValue(v3);
var a5 = this.value, b4 = n2.value;
var _0 = BigInt(0), _1 = BigInt(1), _22 = BigInt(2);
if (b4 === _0)
return Integer[1];
if (a5 === _0)
return Integer[0];
if (a5 === _1)
return Integer[1];
if (a5 === BigInt(-1))
return n2.isEven() ? Integer[1] : Integer[-1];
if (n2.isNegative())
return new NativeBigInt(_0);
var x6 = this;
var y5 = Integer[1];
while (true) {
if ((b4 & _1) === _1) {
y5 = y5.times(x6);
--b4;
}
if (b4 === _0)
break;
b4 /= _22;
x6 = x6.square();
}
return y5;
};
BigInteger.prototype.modPow = function(exp, mod) {
exp = parseValue(exp);
mod = parseValue(mod);
if (mod.isZero())
throw new Error("Cannot take modPow with modulus 0");
var r3 = Integer[1], base2 = this.mod(mod);
if (exp.isNegative()) {
exp = exp.multiply(Integer[-1]);
base2 = base2.modInv(mod);
}
while (exp.isPositive()) {
if (base2.isZero())
return Integer[0];
if (exp.isOdd())
r3 = r3.multiply(base2).mod(mod);
exp = exp.divide(2);
base2 = base2.square().mod(mod);
}
return r3;
};
NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
function compareAbs(a5, b4) {
if (a5.length !== b4.length) {
return a5.length > b4.length ? 1 : -1;
}
for (var i5 = a5.length - 1; i5 >= 0; i5--) {
if (a5[i5] !== b4[i5])
return a5[i5] > b4[i5] ? 1 : -1;
}
return 0;
}
BigInteger.prototype.compareAbs = function(v3) {
var n2 = parseValue(v3), a5 = this.value, b4 = n2.value;
if (n2.isSmall)
return 1;
return compareAbs(a5, b4);
};
SmallInteger.prototype.compareAbs = function(v3) {
var n2 = parseValue(v3), a5 = Math.abs(this.value), b4 = n2.value;
if (n2.isSmall) {
b4 = Math.abs(b4);
return a5 === b4 ? 0 : a5 > b4 ? 1 : -1;
}
return -1;
};
NativeBigInt.prototype.compareAbs = function(v3) {
var a5 = this.value;
var b4 = parseValue(v3).value;
a5 = a5 >= 0 ? a5 : -a5;
b4 = b4 >= 0 ? b4 : -b4;
return a5 === b4 ? 0 : a5 > b4 ? 1 : -1;
};
BigInteger.prototype.compare = function(v3) {
if (v3 === Infinity) {
return -1;
}
if (v3 === -Infinity) {
return 1;
}
var n2 = parseValue(v3), a5 = this.value, b4 = n2.value;
if (this.sign !== n2.sign) {
return n2.sign ? 1 : -1;
}
if (n2.isSmall) {
return this.sign ? -1 : 1;
}
return compareAbs(a5, b4) * (this.sign ? -1 : 1);
};
BigInteger.prototype.compareTo = BigInteger.prototype.compare;
SmallInteger.prototype.compare = function(v3) {
if (v3 === Infinity) {
return -1;
}
if (v3 === -Infinity) {
return 1;
}
var n2 = parseValue(v3), a5 = this.value, b4 = n2.value;
if (n2.isSmall) {
return a5 == b4 ? 0 : a5 > b4 ? 1 : -1;
}
if (a5 < 0 !== n2.sign) {
return a5 < 0 ? -1 : 1;
}
return a5 < 0 ? 1 : -1;
};
SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
NativeBigInt.prototype.compare = function(v3) {
if (v3 === Infinity) {
return -1;
}
if (v3 === -Infinity) {
return 1;
}
var a5 = this.value;
var b4 = parseValue(v3).value;
return a5 === b4 ? 0 : a5 > b4 ? 1 : -1;
};
NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;
BigInteger.prototype.equals = function(v3) {
return this.compare(v3) === 0;
};
NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
BigInteger.prototype.notEquals = function(v3) {
return this.compare(v3) !== 0;
};
NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
BigInteger.prototype.greater = function(v3) {
return this.compare(v3) > 0;
};
NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
BigInteger.prototype.lesser = function(v3) {
return this.compare(v3) < 0;
};
NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
BigInteger.prototype.greaterOrEquals = function(v3) {
return this.compare(v3) >= 0;
};
NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
BigInteger.prototype.lesserOrEquals = function(v3) {
return this.compare(v3) <= 0;
};
NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
BigInteger.prototype.isEven = function() {
return (this.value[0] & 1) === 0;
};
SmallInteger.prototype.isEven = function() {
return (this.value & 1) === 0;
};
NativeBigInt.prototype.isEven = function() {
return (this.value & BigInt(1)) === BigInt(0);
};
BigInteger.prototype.isOdd = function() {
return (this.value[0] & 1) === 1;
};
SmallInteger.prototype.isOdd = function() {
return (this.value & 1) === 1;
};
NativeBigInt.prototype.isOdd = function() {
return (this.value & BigInt(1)) === BigInt(1);
};
BigInteger.prototype.isPositive = function() {
return !this.sign;
};
SmallInteger.prototype.isPositive = function() {
return this.value > 0;
};
NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;
BigInteger.prototype.isNegative = function() {
return this.sign;
};
SmallInteger.prototype.isNegative = function() {
return this.value < 0;
};
NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;
BigInteger.prototype.isUnit = function() {
return false;
};
SmallInteger.prototype.isUnit = function() {
return Math.abs(this.value) === 1;
};
NativeBigInt.prototype.isUnit = function() {
return this.abs().value === BigInt(1);
};
BigInteger.prototype.isZero = function() {
return false;
};
SmallInteger.prototype.isZero = function() {
return this.value === 0;
};
NativeBigInt.prototype.isZero = function() {
return this.value === BigInt(0);
};
BigInteger.prototype.isDivisibleBy = function(v3) {
var n2 = parseValue(v3);
if (n2.isZero())
return false;
if (n2.isUnit())
return true;
if (n2.compareAbs(2) === 0)
return this.isEven();
return this.mod(n2).isZero();
};
NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
function isBasicPrime(v3) {
var n2 = v3.abs();
if (n2.isUnit())
return false;
if (n2.equals(2) || n2.equals(3) || n2.equals(5))
return true;
if (n2.isEven() || n2.isDivisibleBy(3) || n2.isDivisibleBy(5))
return false;
if (n2.lesser(49))
return true;
}
function millerRabinTest(n2, a5) {
var nPrev = n2.prev(), b4 = nPrev, r3 = 0, d5, t4, i5, x6;
while (b4.isEven())
b4 = b4.divide(2), r3++;
next:
for (i5 = 0; i5 < a5.length; i5++) {
if (n2.lesser(a5[i5]))
continue;
x6 = bigInt(a5[i5]).modPow(b4, n2);
if (x6.isUnit() || x6.equals(nPrev))
continue;
for (d5 = r3 - 1; d5 != 0; d5--) {
x6 = x6.square().mod(n2);
if (x6.isUnit())
return false;
if (x6.equals(nPrev))
continue next;
}
return false;
}
return true;
}
BigInteger.prototype.isPrime = function(strict) {
var isPrime = isBasicPrime(this);
if (isPrime !== undefined2)
return isPrime;
var n2 = this.abs();
var bits = n2.bitLength();
if (bits <= 64)
return millerRabinTest(n2, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
var logN = Math.log(2) * bits.toJSNumber();
var t4 = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);
for (var a5 = [], i5 = 0; i5 < t4; i5++) {
a5.push(bigInt(i5 + 2));
}
return millerRabinTest(n2, a5);
};
NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
BigInteger.prototype.isProbablePrime = function(iterations, rng) {
var isPrime = isBasicPrime(this);
if (isPrime !== undefined2)
return isPrime;
var n2 = this.abs();
var t4 = iterations === undefined2 ? 5 : iterations;
for (var a5 = [], i5 = 0; i5 < t4; i5++) {
a5.push(bigInt.randBetween(2, n2.minus(2), rng));
}
return millerRabinTest(n2, a5);
};
NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
BigInteger.prototype.modInv = function(n2) {
var t4 = bigInt.zero, newT = bigInt.one, r3 = parseValue(n2), newR = this.abs(), q5, lastT, lastR;
while (!newR.isZero()) {
q5 = r3.divide(newR);
lastT = t4;
lastR = r3;
t4 = newT;
r3 = newR;
newT = lastT.subtract(q5.multiply(newT));
newR = lastR.subtract(q5.multiply(newR));
}
if (!r3.isUnit())
throw new Error(this.toString() + " and " + n2.toString() + " are not co-prime");
if (t4.compare(0) === -1) {
t4 = t4.add(n2);
}
if (this.isNegative()) {
return t4.negate();
}
return t4;
};
NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
BigInteger.prototype.next = function() {
var value = this.value;
if (this.sign) {
return subtractSmall(value, 1, this.sign);
}
return new BigInteger(addSmall(value, 1), this.sign);
};
SmallInteger.prototype.next = function() {
var value = this.value;
if (value + 1 < MAX_INT)
return new SmallInteger(value + 1);
return new BigInteger(MAX_INT_ARR, false);
};
NativeBigInt.prototype.next = function() {
return new NativeBigInt(this.value + BigInt(1));
};
BigInteger.prototype.prev = function() {
var value = this.value;
if (this.sign) {
return new BigInteger(addSmall(value, 1), true);
}
return subtractSmall(value, 1, this.sign);
};
SmallInteger.prototype.prev = function() {
var value = this.value;
if (value - 1 > -MAX_INT)
return new SmallInteger(value - 1);
return new BigInteger(MAX_INT_ARR, true);
};
NativeBigInt.prototype.prev = function() {
return new NativeBigInt(this.value - BigInt(1));
};
var powersOfTwo = [1];
while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE)
powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
function shift_isSmall(n2) {
return Math.abs(n2) <= BASE;
}
BigInteger.prototype.shiftLeft = function(v3) {
var n2 = parseValue(v3).toJSNumber();
if (!shift_isSmall(n2)) {
throw new Error(String(n2) + " is too large for shifting.");
}
if (n2 < 0)
return this.shiftRight(-n2);
var result = this;
if (result.isZero())
return result;
while (n2 >= powers2Length) {
result = result.multiply(highestPower2);
n2 -= powers2Length - 1;
}
return result.multiply(powersOfTwo[n2]);
};
NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
BigInteger.prototype.shiftRight = function(v3) {
var remQuo;
var n2 = parseValue(v3).toJSNumber();
if (!shift_isSmall(n2)) {
throw new Error(String(n2) + " is too large for shifting.");
}
if (n2 < 0)
return this.shiftLeft(-n2);
var result = this;
while (n2 >= powers2Length) {
if (result.isZero() || result.isNegative() && result.isUnit())
return result;
remQuo = divModAny(result, highestPower2);
result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
n2 -= powers2Length - 1;
}
remQuo = divModAny(result, powersOfTwo[n2]);
return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
};
NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
function bitwise(x6, y5, fn2) {
y5 = parseValue(y5);
var xSign = x6.isNegative(), ySign = y5.isNegative();
var xRem = xSign ? x6.not() : x6, yRem = ySign ? y5.not() : y5;
var xDigit = 0, yDigit = 0;
var xDivMod = null, yDivMod = null;
var result = [];
while (!xRem.isZero() || !yRem.isZero()) {
xDivMod = divModAny(xRem, highestPower2);
xDigit = xDivMod[1].toJSNumber();
if (xSign) {
xDigit = highestPower2 - 1 - xDigit;
}
yDivMod = divModAny(yRem, highestPower2);
yDigit = yDivMod[1].toJSNumber();
if (ySign) {
yDigit = highestPower2 - 1 - yDigit;
}
xRem = xDivMod[0];
yRem = yDivMod[0];
result.push(fn2(xDigit, yDigit));
}
var sum2 = fn2(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
for (var i5 = result.length - 1; i5 >= 0; i5 -= 1) {
sum2 = sum2.multiply(highestPower2).add(bigInt(result[i5]));
}
return sum2;
}
BigInteger.prototype.not = function() {
return this.negate().prev();
};
NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;
BigInteger.prototype.and = function(n2) {
return bitwise(this, n2, function(a5, b4) {
return a5 & b4;
});
};
NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;
BigInteger.prototype.or = function(n2) {
return bitwise(this, n2, function(a5, b4) {
return a5 | b4;
});
};
NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;
BigInteger.prototype.xor = function(n2) {
return bitwise(this, n2, function(a5, b4) {
return a5 ^ b4;
});
};
NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;
var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
function roughLOB(n2) {
var v3 = n2.value, x6 = typeof v3 === "number" ? v3 | LOBMASK_I : typeof v3 === "bigint" ? v3 | BigInt(LOBMASK_I) : v3[0] + v3[1] * BASE | LOBMASK_BI;
return x6 & -x6;
}
function integerLogarithm(value, base2) {
if (base2.compareTo(value) <= 0) {
var tmp = integerLogarithm(value, base2.square(base2));
var p4 = tmp.p;
var e4 = tmp.e;
var t4 = p4.multiply(base2);
return t4.compareTo(value) <= 0 ? { p: t4, e: e4 * 2 + 1 } : { p: p4, e: e4 * 2 };
}
return { p: bigInt(1), e: 0 };
}
BigInteger.prototype.bitLength = function() {
var n2 = this;
if (n2.compareTo(bigInt(0)) < 0) {
n2 = n2.negate().subtract(bigInt(1));
}
if (n2.compareTo(bigInt(0)) === 0) {
return bigInt(0);
}
return bigInt(integerLogarithm(n2, bigInt(2)).e).add(bigInt(1));
};
NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
function max(a5, b4) {
a5 = parseValue(a5);
b4 = parseValue(b4);
return a5.greater(b4) ? a5 : b4;
}
function min(a5, b4) {
a5 = parseValue(a5);
b4 = parseValue(b4);
return a5.lesser(b4) ? a5 : b4;
}
function gcd(a5, b4) {
a5 = parseValue(a5).abs();
b4 = parseValue(b4).abs();
if (a5.equals(b4))
return a5;
if (a5.isZero())
return b4;
if (b4.isZero())
return a5;
var c4 = Integer[1], d5, t4;
while (a5.isEven() && b4.isEven()) {
d5 = min(roughLOB(a5), roughLOB(b4));
a5 = a5.divide(d5);
b4 = b4.divide(d5);
c4 = c4.multiply(d5);
}
while (a5.isEven()) {
a5 = a5.divide(roughLOB(a5));
}
do {
while (b4.isEven()) {
b4 = b4.divide(roughLOB(b4));
}
if (a5.greater(b4)) {
t4 = b4;
b4 = a5;
a5 = t4;
}
b4 = b4.subtract(a5);
} while (!b4.isZero());
return c4.isUnit() ? a5 : a5.multiply(c4);
}
function lcm(a5, b4) {
a5 = parseValue(a5).abs();
b4 = parseValue(b4).abs();
return a5.divide(gcd(a5, b4)).multiply(b4);
}
function randBetween(a5, b4, rng) {
a5 = parseValue(a5);
b4 = parseValue(b4);
var usedRNG = rng || Math.random;
var low = min(a5, b4), high = max(a5, b4);
var range = high.subtract(low).add(1);
if (range.isSmall)
return low.add(Math.floor(usedRNG() * range));
var digits = toBase(range, BASE).value;
var result = [], restricted = true;
for (var i5 = 0; i5 < digits.length; i5++) {
var top = restricted ? digits[i5] + (i5 + 1 < digits.length ? digits[i5 + 1] / BASE : 0) : BASE;
var digit = truncate(usedRNG() * top);
result.push(digit);
if (digit < digits[i5])
restricted = false;
}
return low.add(Integer.fromArray(result, BASE, false));
}
var parseBase = function(text, base2, alphabet, caseSensitive) {
alphabet = alphabet || DEFAULT_ALPHABET;
text = String(text);
if (!caseSensitive) {
text = text.toLowerCase();
alphabet = alphabet.toLowerCase();
}
var length = text.length;
var i5;
var absBase = Math.abs(base2);
var alphabetValues = {};
for (i5 = 0; i5 < alphabet.length; i5++) {
alphabetValues[alphabet[i5]] = i5;
}
for (i5 = 0; i5 < length; i5++) {
var c4 = text[i5];
if (c4 === "-")
continue;
if (c4 in alphabetValues) {
if (alphabetValues[c4] >= absBase) {
if (c4 === "1" && absBase === 1)
continue;
throw new Error(c4 + " is not a valid digit in base " + base2 + ".");
}
}
}
base2 = parseValue(base2);
var digits = [];
var isNegative = text[0] === "-";
for (i5 = isNegative ? 1 : 0; i5 < text.length; i5++) {
var c4 = text[i5];
if (c4 in alphabetValues)
digits.push(parseValue(alphabetValues[c4]));
else if (c4 === "<") {
var start = i5;
do {
i5++;
} while (text[i5] !== ">" && i5 < text.length);
digits.push(parseValue(text.slice(start + 1, i5)));
} else
throw new Error(c4 + " is not a valid character");
}
return parseBaseFromArray(digits, base2, isNegative);
};
function parseBaseFromArray(digits, base2, isNegative) {
var val = Integer[0], pow = Integer[1], i5;
for (i5 = digits.length - 1; i5 >= 0; i5--) {
val = val.add(digits[i5].times(pow));
pow = pow.times(base2);
}
return isNegative ? val.negate() : val;
}
function stringify(digit, alphabet) {
alphabet = alphabet || DEFAULT_ALPHABET;
if (digit < alphabet.length) {
return alphabet[digit];
}
return "<" + digit + ">";
}
function toBase(n2, base2) {
base2 = bigInt(base2);
if (base2.isZero()) {
if (n2.isZero())
return { value: [0], isNegative: false };
throw new Error("Cannot convert nonzero numbers to base 0.");
}
if (base2.equals(-1)) {
if (n2.isZero())
return { value: [0], isNegative: false };
if (n2.isNegative())
return {
value: [].concat.apply(
[],
Array.apply(null, Array(-n2.toJSNumber())).map(Array.prototype.valueOf, [1, 0])
),
isNegative: false
};
var arr = Array.apply(null, Array(n2.toJSNumber() - 1)).map(Array.prototype.valueOf, [0, 1]);
arr.unshift([1]);
return {
value: [].concat.apply([], arr),
isNegative: false
};
}
var neg = false;
if (n2.isNegative() && base2.isPositive()) {
neg = true;
n2 = n2.abs();
}
if (base2.isUnit()) {
if (n2.isZero())
return { value: [0], isNegative: false };
return {
value: Array.apply(null, Array(n2.toJSNumber())).map(Number.prototype.valueOf, 1),
isNegative: neg
};
}
var out = [];
var left = n2, divmod;
while (left.isNegative() || left.compareAbs(base2) >= 0) {
divmod = left.divmod(base2);
left = divmod.quotient;
var digit = divmod.remainder;
if (digit.isNegative()) {
digit = base2.minus(digit).abs();
left = left.next();
}
out.push(digit.toJSNumber());
}
out.push(left.toJSNumber());
return { value: out.reverse(), isNegative: neg };
}
function toBaseString(n2, base2, alphabet) {
var arr = toBase(n2, base2);
return (arr.isNegative ? "-" : "") + arr.value.map(function(x6) {
return stringify(x6, alphabet);
}).join("");
}
BigInteger.prototype.toArray = function(radix) {
return toBase(this, radix);
};
SmallInteger.prototype.toArray = function(radix) {
return toBase(this, radix);
};
NativeBigInt.prototype.toArray = function(radix) {
return toBase(this, radix);
};
BigInteger.prototype.toString = function(radix, alphabet) {
if (radix === undefined2)
radix = 10;
if (radix !== 10)
return toBaseString(this, radix, alphabet);
var v3 = this.value, l3 = v3.length, str = String(v3[--l3]), zeros = "0000000", digit;
while (--l3 >= 0) {
digit = String(v3[l3]);
str += zeros.slice(digit.length) + digit;
}
var sign = this.sign ? "-" : "";
return sign + str;
};
SmallInteger.prototype.toString = function(radix, alphabet) {
if (radix === undefined2)
radix = 10;
if (radix != 10)
return toBaseString(this, radix, alphabet);
return String(this.value);
};
NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() {
return this.toString();
};
BigInteger.prototype.valueOf = function() {
return parseInt(this.toString(), 10);
};
BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
SmallInteger.prototype.valueOf = function() {
return this.value;
};
SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function() {
return parseInt(this.toString(), 10);
};
function parseStringValue(v3) {
if (isPrecise(+v3)) {
var x6 = +v3;
if (x6 === truncate(x6))
return supportsNativeBigInt ? new NativeBigInt(BigInt(x6)) : new SmallInteger(x6);
throw new Error("Invalid integer: " + v3);
}
var sign = v3[0] === "-";
if (sign)
v3 = v3.slice(1);
var split2 = v3.split(/e/i);
if (split2.length > 2)
throw new Error("Invalid integer: " + split2.join("e"));
if (split2.length === 2) {
var exp = split2[1];
if (exp[0] === "+")
exp = exp.slice(1);
exp = +exp;
if (exp !== truncate(exp) || !isPrecise(exp))
throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
var text = split2[0];
var decimalPlace = text.indexOf(".");
if (decimalPlace >= 0) {
exp -= text.length - decimalPlace - 1;
text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
}
if (exp < 0)
throw new Error("Cannot include negative exponent part for integers");
text += new Array(exp + 1).join("0");
v3 = text;
}
var isValid2 = /^([0-9][0-9]*)$/.test(v3);
if (!isValid2)
throw new Error("Invalid integer: " + v3);
if (supportsNativeBigInt) {
return new NativeBigInt(BigInt(sign ? "-" + v3 : v3));
}
var r3 = [], max2 = v3.length, l3 = LOG_BASE, min2 = max2 - l3;
while (max2 > 0) {
r3.push(+v3.slice(min2, max2));
min2 -= l3;
if (min2 < 0)
min2 = 0;
max2 -= l3;
}
trim2(r3);
return new BigInteger(r3, sign);
}
function parseNumberValue(v3) {
if (supportsNativeBigInt) {
return new NativeBigInt(BigInt(v3));
}
if (isPrecise(v3)) {
if (v3 !== truncate(v3))
throw new Error(v3 + " is not an integer.");
return new SmallInteger(v3);
}
return parseStringValue(v3.toString());
}
function parseValue(v3) {
if (typeof v3 === "number") {
return parseNumberValue(v3);
}
if (typeof v3 === "string") {
return parseStringValue(v3);
}
if (typeof v3 === "bigint") {
return new NativeBigInt(v3);
}
return v3;
}
for (var i4 = 0; i4 < 1e3; i4++) {
Integer[i4] = parseValue(i4);
if (i4 > 0)
Integer[-i4] = parseValue(-i4);
}
Integer.one = Integer[1];
Integer.zero = Integer[0];
Integer.minusOne = Integer[-1];
Integer.max = max;
Integer.min = min;
Integer.gcd = gcd;
Integer.lcm = lcm;
Integer.isInstance = function(x6) {
return x6 instanceof BigInteger || x6 instanceof SmallInteger || x6 instanceof NativeBigInt;
};
Integer.randBetween = randBetween;
Integer.fromArray = function(digits, base2, isNegative) {
return parseBaseFromArray(digits.map(parseValue), parseValue(base2 || 10), isNegative);
};
return Integer;
}();
if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {
module.exports = bigInt;
}
if (typeof define === "function" && define.amd) {
define(function() {
return bigInt;
});
}
}
});
// ../../node_modules/.pnpm/jed@1.1.1/node_modules/jed/jed.js
var require_jed = __commonJS({
"../../node_modules/.pnpm/jed@1.1.1/node_modules/jed/jed.js"(exports, module) {
(function(root, undef) {
var ArrayProto = Array.prototype, ObjProto = Object.prototype, slice = ArrayProto.slice, hasOwnProp = ObjProto.hasOwnProperty, nativeForEach = ArrayProto.forEach, breaker = {};
var _3 = {
forEach: function(obj, iterator, context) {
var i4, l3, key;
if (obj === null) {
return;
}
if (nativeForEach && obj.forEach === nativeForEach) {
obj.forEach(iterator, context);
} else if (obj.length === +obj.length) {
for (i4 = 0, l3 = obj.length; i4 < l3; i4++) {
if (i4 in obj && iterator.call(context, obj[i4], i4, obj) === breaker) {
return;
}
}
} else {
for (key in obj) {
if (hasOwnProp.call(obj, key)) {
if (iterator.call(context, obj[key], key, obj) === breaker) {
return;
}
}
}
}
},
extend: function(obj) {
this.forEach(slice.call(arguments, 1), function(source) {
for (var prop in source) {
obj[prop] = source[prop];
}
});
return obj;
}
};
var Jed2 = function(options) {
this.defaults = {
"locale_data": {
"messages": {
"": {
"domain": "messages",
"lang": "en",
"plural_forms": "nplurals=2; plural=(n != 1);"
}
// There are no default keys, though
}
},
// The default domain if one is missing
"domain": "messages",
// enable debug mode to log untranslated strings to the console
"debug": false
};
this.options = _3.extend({}, this.defaults, options);
this.textdomain(this.options.domain);
if (options.domain && !this.options.locale_data[this.options.domain]) {
throw new Error("Text domain set to non-existent domain: `" + options.domain + "`");
}
};
Jed2.context_delimiter = String.fromCharCode(4);
function getPluralFormFunc(plural_form_string) {
return Jed2.PF.compile(plural_form_string || "nplurals=2; plural=(n != 1);");
}
function Chain(key, i18n2) {
this._key = key;
this._i18n = i18n2;
}
_3.extend(Chain.prototype, {
onDomain: function(domain) {
this._domain = domain;
return this;
},
withContext: function(context) {
this._context = context;
return this;
},
ifPlural: function(num, pkey) {
this._val = num;
this._pkey = pkey;
return this;
},
fetch: function(sArr) {
if ({}.toString.call(sArr) != "[object Array]") {
sArr = [].slice.call(arguments, 0);
}
return (sArr && sArr.length ? Jed2.sprintf : function(x6) {
return x6;
})(
this._i18n.dcnpgettext(this._domain, this._context, this._key, this._pkey, this._val),
sArr
);
}
});
_3.extend(Jed2.prototype, {
// The sexier api start point
translate: function(key) {
return new Chain(key, this);
},
textdomain: function(domain) {
if (!domain) {
return this._textdomain;
}
this._textdomain = domain;
},
gettext: function(key) {
return this.dcnpgettext.call(this, undef, undef, key);
},
dgettext: function(domain, key) {
return this.dcnpgettext.call(this, domain, undef, key);
},
dcgettext: function(domain, key) {
return this.dcnpgettext.call(this, domain, undef, key);
},
ngettext: function(skey, pkey, val) {
return this.dcnpgettext.call(this, undef, undef, skey, pkey, val);
},
dngettext: function(domain, skey, pkey, val) {
return this.dcnpgettext.call(this, domain, undef, skey, pkey, val);
},
dcngettext: function(domain, skey, pkey, val) {
return this.dcnpgettext.call(this, domain, undef, skey, pkey, val);
},
pgettext: function(context, key) {
return this.dcnpgettext.call(this, undef, context, key);
},
dpgettext: function(domain, context, key) {
return this.dcnpgettext.call(this, domain, context, key);
},
dcpgettext: function(domain, context, key) {
return this.dcnpgettext.call(this, domain, context, key);
},
npgettext: function(context, skey, pkey, val) {
return this.dcnpgettext.call(this, undef, context, skey, pkey, val);
},
dnpgettext: function(domain, context, skey, pkey, val) {
return this.dcnpgettext.call(this, domain, context, skey, pkey, val);
},
// The most fully qualified gettext function. It has every option.
// Since it has every option, we can use it from every other method.
// This is the bread and butter.
// Technically there should be one more argument in this function for 'Category',
// but since we never use it, we might as well not waste the bytes to define it.
dcnpgettext: function(domain, context, singular_key, plural_key, val) {
plural_key = plural_key || singular_key;
domain = domain || this._textdomain;
var fallback;
if (!this.options) {
fallback = new Jed2();
return fallback.dcnpgettext.call(fallback, void 0, void 0, singular_key, plural_key, val);
}
if (!this.options.locale_data) {
throw new Error("No locale data provided.");
}
if (!this.options.locale_data[domain]) {
throw new Error("Domain `" + domain + "` was not found.");
}
if (!this.options.locale_data[domain][""]) {
throw new Error("No locale meta information provided.");
}
if (!singular_key) {
throw new Error("No translation key found.");
}
var key = context ? context + Jed2.context_delimiter + singular_key : singular_key, locale_data = this.options.locale_data, dict = locale_data[domain], defaultConf = (locale_data.messages || this.defaults.locale_data.messages)[""], pluralForms = dict[""].plural_forms || dict[""]["Plural-Forms"] || dict[""]["plural-forms"] || defaultConf.plural_forms || defaultConf["Plural-Forms"] || defaultConf["plural-forms"], val_list, res;
var val_idx;
if (val === void 0) {
val_idx = 0;
} else {
if (typeof val != "number") {
val = parseInt(val, 10);
if (isNaN(val)) {
throw new Error("The number that was passed in is not a number.");
}
}
val_idx = getPluralFormFunc(pluralForms)(val);
}
if (!dict) {
throw new Error("No domain named `" + domain + "` could be found.");
}
val_list = dict[key];
if (!val_list || val_idx > val_list.length) {
if (this.options.missing_key_callback) {
this.options.missing_key_callback(key, domain);
}
res = [singular_key, plural_key];
if (this.options.debug === true) {
console.log(res[getPluralFormFunc(pluralForms)(val)]);
}
return res[getPluralFormFunc()(val)];
}
res = val_list[val_idx];
if (!res) {
res = [singular_key, plural_key];
return res[getPluralFormFunc()(val)];
}
return res;
}
});
var sprintf = function() {
function get_type(variable) {
return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
}
function str_repeat(input, multiplier) {
for (var output = []; multiplier > 0; output[--multiplier] = input) {
}
return output.join("");
}
var str_format = function() {
if (!str_format.cache.hasOwnProperty(arguments[0])) {
str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
}
return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
};
str_format.format = function(parse_tree, argv) {
var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i4, k5, match2, pad, pad_character, pad_length;
for (i4 = 0; i4 < tree_length; i4++) {
node_type = get_type(parse_tree[i4]);
if (node_type === "string") {
output.push(parse_tree[i4]);
} else if (node_type === "array") {
match2 = parse_tree[i4];
if (match2[2]) {
arg = argv[cursor];
for (k5 = 0; k5 < match2[2].length; k5++) {
if (!arg.hasOwnProperty(match2[2][k5])) {
throw sprintf('[sprintf] property "%s" does not exist', match2[2][k5]);
}
arg = arg[match2[2][k5]];
}
} else if (match2[1]) {
arg = argv[match2[1]];
} else {
arg = argv[cursor++];
}
if (/[^s]/.test(match2[8]) && get_type(arg) != "number") {
throw sprintf("[sprintf] expecting number but found %s", get_type(arg));
}
if (typeof arg == "undefined" || arg === null) {
arg = "";
}
switch (match2[8]) {
case "b":
arg = arg.toString(2);
break;
case "c":
arg = String.fromCharCode(arg);
break;
case "d":
arg = parseInt(arg, 10);
break;
case "e":
arg = match2[7] ? arg.toExponential(match2[7]) : arg.toExponential();
break;
case "f":
arg = match2[7] ? parseFloat(arg).toFixed(match2[7]) : parseFloat(arg);
break;
case "o":
arg = arg.toString(8);
break;
case "s":
arg = (arg = String(arg)) && match2[7] ? arg.substring(0, match2[7]) : arg;
break;
case "u":
arg = Math.abs(arg);
break;
case "x":
arg = arg.toString(16);
break;
case "X":
arg = arg.toString(16).toUpperCase();
break;
}
arg = /[def]/.test(match2[8]) && match2[3] && arg >= 0 ? "+" + arg : arg;
pad_character = match2[4] ? match2[4] == "0" ? "0" : match2[4].charAt(1) : " ";
pad_length = match2[6] - String(arg).length;
pad = match2[6] ? str_repeat(pad_character, pad_length) : "";
output.push(match2[5] ? arg + pad : pad + arg);
}
}
return output.join("");
};
str_format.cache = {};
str_format.parse = function(fmt) {
var _fmt = fmt, match2 = [], parse_tree = [], arg_names = 0;
while (_fmt) {
if ((match2 = /^[^\x25]+/.exec(_fmt)) !== null) {
parse_tree.push(match2[0]);
} else if ((match2 = /^\x25{2}/.exec(_fmt)) !== null) {
parse_tree.push("%");
} else if ((match2 = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
if (match2[2]) {
arg_names |= 1;
var field_list = [], replacement_field = match2[2], field_match = [];
if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
field_list.push(field_match[1]);
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") {
if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
field_list.push(field_match[1]);
} else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
field_list.push(field_match[1]);
} else {
throw "[sprintf] huh?";
}
}
} else {
throw "[sprintf] huh?";
}
match2[2] = field_list;
} else {
arg_names |= 2;
}
if (arg_names === 3) {
throw "[sprintf] mixing positional and named placeholders is not (yet) supported";
}
parse_tree.push(match2);
} else {
throw "[sprintf] huh?";
}
_fmt = _fmt.substring(match2[0].length);
}
return parse_tree;
};
return str_format;
}();
var vsprintf = function(fmt, argv) {
argv.unshift(fmt);
return sprintf.apply(null, argv);
};
Jed2.parse_plural = function(plural_forms, n2) {
plural_forms = plural_forms.replace(/n/g, n2);
return Jed2.parse_expression(plural_forms);
};
Jed2.sprintf = function(fmt, args) {
if ({}.toString.call(args) == "[object Array]") {
return vsprintf(fmt, [].slice.call(args));
}
return sprintf.apply(this, [].slice.call(arguments));
};
Jed2.prototype.sprintf = function() {
return Jed2.sprintf.apply(this, arguments);
};
Jed2.PF = {};
Jed2.PF.parse = function(p4) {
var plural_str = Jed2.PF.extractPluralExpr(p4);
return Jed2.PF.parser.parse.call(Jed2.PF.parser, plural_str);
};
Jed2.PF.compile = function(p4) {
function imply(val) {
return val === true ? 1 : val ? val : 0;
}
var ast = Jed2.PF.parse(p4);
return function(n2) {
return imply(Jed2.PF.interpreter(ast)(n2));
};
};
Jed2.PF.interpreter = function(ast) {
return function(n2) {
var res;
switch (ast.type) {
case "GROUP":
return Jed2.PF.interpreter(ast.expr)(n2);
case "TERNARY":
if (Jed2.PF.interpreter(ast.expr)(n2)) {
return Jed2.PF.interpreter(ast.truthy)(n2);
}
return Jed2.PF.interpreter(ast.falsey)(n2);
case "OR":
return Jed2.PF.interpreter(ast.left)(n2) || Jed2.PF.interpreter(ast.right)(n2);
case "AND":
return Jed2.PF.interpreter(ast.left)(n2) && Jed2.PF.interpreter(ast.right)(n2);
case "LT":
return Jed2.PF.interpreter(ast.left)(n2) < Jed2.PF.interpreter(ast.right)(n2);
case "GT":
return Jed2.PF.interpreter(ast.left)(n2) > Jed2.PF.interpreter(ast.right)(n2);
case "LTE":
return Jed2.PF.interpreter(ast.left)(n2) <= Jed2.PF.interpreter(ast.right)(n2);
case "GTE":
return Jed2.PF.interpreter(ast.left)(n2) >= Jed2.PF.interpreter(ast.right)(n2);
case "EQ":
return Jed2.PF.interpreter(ast.left)(n2) == Jed2.PF.interpreter(ast.right)(n2);
case "NEQ":
return Jed2.PF.interpreter(ast.left)(n2) != Jed2.PF.interpreter(ast.right)(n2);
case "MOD":
return Jed2.PF.interpreter(ast.left)(n2) % Jed2.PF.interpreter(ast.right)(n2);
case "VAR":
return n2;
case "NUM":
return ast.val;
default:
throw new Error("Invalid Token found.");
}
};
};
Jed2.PF.extractPluralExpr = function(p4) {
p4 = p4.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
if (!/;\s*$/.test(p4)) {
p4 = p4.concat(";");
}
var nplurals_re = /nplurals\=(\d+);/, plural_re = /plural\=(.*);/, nplurals_matches = p4.match(nplurals_re), res = {}, plural_matches;
if (nplurals_matches.length > 1) {
res.nplurals = nplurals_matches[1];
} else {
throw new Error("nplurals not found in plural_forms string: " + p4);
}
p4 = p4.replace(nplurals_re, "");
plural_matches = p4.match(plural_re);
if (!(plural_matches && plural_matches.length > 1)) {
throw new Error("`plural` expression not found: " + p4);
}
return plural_matches[1];
};
Jed2.PF.parser = function() {
var parser = {
trace: function trace() {
},
yy: {},
symbols_: { "error": 2, "expressions": 3, "e": 4, "EOF": 5, "?": 6, ":": 7, "||": 8, "&&": 9, "<": 10, "<=": 11, ">": 12, ">=": 13, "!=": 14, "==": 15, "%": 16, "(": 17, ")": 18, "n": 19, "NUMBER": 20, "$accept": 0, "$end": 1 },
terminals_: { 2: "error", 5: "EOF", 6: "?", 7: ":", 8: "||", 9: "&&", 10: "<", 11: "<=", 12: ">", 13: ">=", 14: "!=", 15: "==", 16: "%", 17: "(", 18: ")", 19: "n", 20: "NUMBER" },
productions_: [0, [3, 2], [4, 5], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 1], [4, 1]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
var $0 = $$.length - 1;
switch (yystate) {
case 1:
return { type: "GROUP", expr: $$[$0 - 1] };
break;
case 2:
this.$ = { type: "TERNARY", expr: $$[$0 - 4], truthy: $$[$0 - 2], falsey: $$[$0] };
break;
case 3:
this.$ = { type: "OR", left: $$[$0 - 2], right: $$[$0] };
break;
case 4:
this.$ = { type: "AND", left: $$[$0 - 2], right: $$[$0] };
break;
case 5:
this.$ = { type: "LT", left: $$[$0 - 2], right: $$[$0] };
break;
case 6:
this.$ = { type: "LTE", left: $$[$0 - 2], right: $$[$0] };
break;
case 7:
this.$ = { type: "GT", left: $$[$0 - 2], right: $$[$0] };
break;
case 8:
this.$ = { type: "GTE", left: $$[$0 - 2], right: $$[$0] };
break;
case 9:
this.$ = { type: "NEQ", left: $$[$0 - 2], right: $$[$0] };
break;
case 10:
this.$ = { type: "EQ", left: $$[$0 - 2], right: $$[$0] };
break;
case 11:
this.$ = { type: "MOD", left: $$[$0 - 2], right: $$[$0] };
break;
case 12:
this.$ = { type: "GROUP", expr: $$[$0 - 1] };
break;
case 13:
this.$ = { type: "VAR" };
break;
case 14:
this.$ = { type: "NUM", val: Number(yytext) };
break;
}
},
table: [{ 3: 1, 4: 2, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 1: [3] }, { 5: [1, 6], 6: [1, 7], 8: [1, 8], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16] }, { 4: 17, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 5: [2, 13], 6: [2, 13], 7: [2, 13], 8: [2, 13], 9: [2, 13], 10: [2, 13], 11: [2, 13], 12: [2, 13], 13: [2, 13], 14: [2, 13], 15: [2, 13], 16: [2, 13], 18: [2, 13] }, { 5: [2, 14], 6: [2, 14], 7: [2, 14], 8: [2, 14], 9: [2, 14], 10: [2, 14], 11: [2, 14], 12: [2, 14], 13: [2, 14], 14: [2, 14], 15: [2, 14], 16: [2, 14], 18: [2, 14] }, { 1: [2, 1] }, { 4: 18, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 4: 19, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 4: 20, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 4: 21, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 4: 22, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 4: 23, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 4: 24, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 4: 25, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 4: 26, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 4: 27, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 6: [1, 7], 8: [1, 8], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16], 18: [1, 28] }, { 6: [1, 7], 7: [1, 29], 8: [1, 8], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16] }, { 5: [2, 3], 6: [2, 3], 7: [2, 3], 8: [2, 3], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16], 18: [2, 3] }, { 5: [2, 4], 6: [2, 4], 7: [2, 4], 8: [2, 4], 9: [2, 4], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16], 18: [2, 4] }, { 5: [2, 5], 6: [2, 5], 7: [2, 5], 8: [2, 5], 9: [2, 5], 10: [2, 5], 11: [2, 5], 12: [2, 5], 13: [2, 5], 14: [2, 5], 15: [2, 5], 16: [1, 16], 18: [2, 5] }, { 5: [2, 6], 6: [2, 6], 7: [2, 6], 8: [2, 6], 9: [2, 6], 10: [2, 6], 11: [2, 6], 12: [2, 6], 13: [2, 6], 14: [2, 6], 15: [2, 6], 16: [1, 16], 18: [2, 6] }, { 5: [2, 7], 6: [2, 7], 7: [2, 7], 8: [2, 7], 9: [2, 7], 10: [2, 7], 11: [2, 7], 12: [2, 7], 13: [2, 7], 14: [2, 7], 15: [2, 7], 16: [1, 16], 18: [2, 7] }, { 5: [2, 8], 6: [2, 8], 7: [2, 8], 8: [2, 8], 9: [2, 8], 10: [2, 8], 11: [2, 8], 12: [2, 8], 13: [2, 8], 14: [2, 8], 15: [2, 8], 16: [1, 16], 18: [2, 8] }, { 5: [2, 9], 6: [2, 9], 7: [2, 9], 8: [2, 9], 9: [2, 9], 10: [2, 9], 11: [2, 9], 12: [2, 9], 13: [2, 9], 14: [2, 9], 15: [2, 9], 16: [1, 16], 18: [2, 9] }, { 5: [2, 10], 6: [2, 10], 7: [2, 10], 8: [2, 10], 9: [2, 10], 10: [2, 10], 11: [2, 10], 12: [2, 10], 13: [2, 10], 14: [2, 10], 15: [2, 10], 16: [1, 16], 18: [2, 10] }, { 5: [2, 11], 6: [2, 11], 7: [2, 11], 8: [2, 11], 9: [2, 11], 10: [2, 11], 11: [2, 11], 12: [2, 11], 13: [2, 11], 14: [2, 11], 15: [2, 11], 16: [2, 11], 18: [2, 11] }, { 5: [2, 12], 6: [2, 12], 7: [2, 12], 8: [2, 12], 9: [2, 12], 10: [2, 12], 11: [2, 12], 12: [2, 12], 13: [2, 12], 14: [2, 12], 15: [2, 12], 16: [2, 12], 18: [2, 12] }, { 4: 30, 17: [1, 3], 19: [1, 4], 20: [1, 5] }, { 5: [2, 2], 6: [1, 7], 7: [2, 2], 8: [1, 8], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16], 18: [2, 2] }],
defaultActions: { 6: [2, 1] },
parseError: function parseError(str, hash3) {
throw new Error(str);
},
parse: function parse(input) {
var self2 = this, stack = [0], vstack = [null], lstack = [], table2 = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
if (typeof this.lexer.yylloc == "undefined")
this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
if (typeof this.yy.parseError === "function")
this.parseError = this.yy.parseError;
function popStack(n2) {
stack.length = stack.length - 2 * n2;
vstack.length = vstack.length - n2;
lstack.length = lstack.length - n2;
}
function lex() {
var token;
token = self2.lexer.lex() || 1;
if (typeof token !== "number") {
token = self2.symbols_[token] || token;
}
return token;
}
var symbol, preErrorSymbol, state, action, a5, r3, yyval = {}, p4, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol == null)
symbol = lex();
action = table2[state] && table2[state][symbol];
}
_handle_error:
if (typeof action === "undefined" || !action.length || !action[0]) {
if (!recovering) {
expected = [];
for (p4 in table2[state])
if (this.terminals_[p4] && p4 > 2) {
expected.push("'" + this.terminals_[p4] + "'");
}
var errStr = "";
if (this.lexer.showPosition) {
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + this.terminals_[symbol] + "'";
} else {
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
}
this.parseError(
errStr,
{ text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected }
);
}
if (recovering == 3) {
if (symbol == EOF) {
throw new Error(errStr || "Parsing halted.");
}
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
yyloc = this.lexer.yylloc;
symbol = lex();
}
while (1) {
if (TERROR.toString() in table2[state]) {
break;
}
if (state == 0) {
throw new Error(errStr || "Parsing halted.");
}
popStack(1);
state = stack[stack.length - 1];
}
preErrorSymbol = symbol;
symbol = TERROR;
state = stack[stack.length - 1];
action = table2[state] && table2[state][TERROR];
recovering = 3;
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(this.lexer.yytext);
lstack.push(this.lexer.yylloc);
stack.push(action[1]);
symbol = null;
if (!preErrorSymbol) {
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
yyloc = this.lexer.yylloc;
if (recovering > 0)
recovering--;
} else {
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
r3 = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
if (typeof r3 !== "undefined") {
return r3;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table2[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}
};
var lexer = function() {
var lexer2 = {
EOF: 1,
parseError: function parseError(str, hash3) {
if (this.yy.parseError) {
this.yy.parseError(str, hash3);
} else {
throw new Error(str);
}
},
setInput: function(input) {
this._input = input;
this._more = this._less = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = "";
this.conditionStack = ["INITIAL"];
this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 };
return this;
},
input: function() {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/\n/);
if (lines)
this.yylineno++;
this._input = this._input.slice(1);
return ch;
},
unput: function(ch) {
this._input = ch + this._input;
return this;
},
more: function() {
this._more = true;
return this;
},
pastInput: function() {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
},
upcomingInput: function() {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20 - next.length);
}
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
},
showPosition: function() {
var pre = this.pastInput();
var c4 = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c4 + "^";
},
next: function() {
if (this.done) {
return this.EOF;
}
if (!this._input)
this.done = true;
var token, match2, col, lines;
if (!this._more) {
this.yytext = "";
this.match = "";
}
var rules = this._currentRules();
for (var i4 = 0; i4 < rules.length; i4++) {
match2 = this._input.match(this.rules[rules[i4]]);
if (match2) {
lines = match2[0].match(/\n.*/g);
if (lines)
this.yylineno += lines.length;
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length - 1].length - 1 : this.yylloc.last_column + match2[0].length
};
this.yytext += match2[0];
this.match += match2[0];
this.matches = match2;
this.yyleng = this.yytext.length;
this._more = false;
this._input = this._input.slice(match2[0].length);
this.matched += match2[0];
token = this.performAction.call(this, this.yy, this, rules[i4], this.conditionStack[this.conditionStack.length - 1]);
if (token)
return token;
else
return;
}
}
if (this._input === "") {
return this.EOF;
} else {
this.parseError(
"Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(),
{ text: "", token: null, line: this.yylineno }
);
}
},
lex: function lex() {
var r3 = this.next();
if (typeof r3 !== "undefined") {
return r3;
} else {
return this.lex();
}
},
begin: function begin(condition) {
this.conditionStack.push(condition);
},
popState: function popState() {
return this.conditionStack.pop();
},
_currentRules: function _currentRules() {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
},
topState: function() {
return this.conditionStack[this.conditionStack.length - 2];
},
pushState: function begin(condition) {
this.begin(condition);
}
};
lexer2.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
var YYSTATE = YY_START;
switch ($avoiding_name_collisions) {
case 0:
break;
case 1:
return 20;
break;
case 2:
return 19;
break;
case 3:
return 8;
break;
case 4:
return 9;
break;
case 5:
return 6;
break;
case 6:
return 7;
break;
case 7:
return 11;
break;
case 8:
return 13;
break;
case 9:
return 10;
break;
case 10:
return 12;
break;
case 11:
return 14;
break;
case 12:
return 15;
break;
case 13:
return 16;
break;
case 14:
return 17;
break;
case 15:
return 18;
break;
case 16:
return 5;
break;
case 17:
return "INVALID";
break;
}
};
lexer2.rules = [/^\s+/, /^[0-9]+(\.[0-9]+)?\b/, /^n\b/, /^\|\|/, /^&&/, /^\?/, /^:/, /^<=/, /^>=/, /^, /^>/, /^!=/, /^==/, /^%/, /^\(/, /^\)/, /^$/, /^./];
lexer2.conditions = { "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], "inclusive": true } };
return lexer2;
}();
parser.lexer = lexer;
return parser;
}();
if (typeof exports !== "undefined") {
if (typeof module !== "undefined" && module.exports) {
exports = module.exports = Jed2;
}
exports.Jed = Jed2;
} else {
if (typeof define === "function" && define.amd) {
define(function() {
return Jed2;
});
}
root["Jed"] = Jed2;
}
})(exports);
}
});
// ../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/dist/preact.module.js
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 y() {
return { current: null };
}
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, k5, b4, g4, w5, x6 = i4 && i4.__k || e, C3 = x6.length;
for (u4.__k = [], h5 = 0; h5 < l3.length; h5++)
if (null != (k5 = u4.__k[h5] = null == (k5 = l3[h5]) || "boolean" == typeof k5 ? null : "string" == typeof k5 || "number" == typeof k5 || "bigint" == typeof k5 ? v(null, k5, null, null, k5) : Array.isArray(k5) ? v(p2, { children: k5 }, null, null, null) : k5.__b > 0 ? v(k5.type, k5.props, k5.key, k5.ref ? k5.ref : null, k5.__v) : k5)) {
if (k5.__ = u4, k5.__b = u4.__b + 1, null === (d5 = x6[h5]) || d5 && k5.key == d5.key && k5.type === d5.type)
x6[h5] = void 0;
else
for (y5 = 0; y5 < C3; y5++) {
if ((d5 = x6[y5]) && k5.key == d5.key && k5.type === d5.type) {
x6[y5] = void 0;
break;
}
d5 = null;
}
j(n2, k5, d5 = d5 || f, t4, o3, r3, c4, s5, a5), b4 = k5.__e, (y5 = k5.ref) && d5.ref != y5 && (w5 || (w5 = []), d5.ref && w5.push(d5.ref, null, k5), w5.push(y5, k5.__c || b4, k5)), null != b4 ? (null == g4 && (g4 = b4), "function" == typeof k5.type && k5.__k === d5.__k ? k5.__d = s5 = m(k5, s5, n2) : s5 = A2(n2, k5, 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, k5, b4, g4, m5, x6, A5, C3, $3, 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);
}), A5 = 0; A5 < h5._sb.length; A5++)
h5.__h.push(h5._sb[A5]);
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, k5);
});
}
if (h5.context = x6, h5.props = g4, h5.__v = u4, h5.__P = n2, C3 = l.__r, $3 = 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 && ++$3 < 25);
h5.state = h5.__s, null != h5.getChildContext && (t4 = s(s({}, t4), h5.getChildContext())), v3 || null == h5.getSnapshotBeforeUpdate || (k5 = 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, k5 = 0;
if ("svg" === d5 && (o3 = true), null != r3) {
for (; k5 < r3.length; k5++)
if ((s5 = r3[k5]) && "setAttribute" in s5 == !!d5 && (d5 ? s5.localName === d5 : 3 === s5.nodeType)) {
l3 = s5, r3[k5] = 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 = {}, k5 = 0; k5 < l3.attributes.length; k5++)
y5[l3.attributes[k5].name] = l3.attributes[k5].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 (k5 = u4.props.children, w(l3, Array.isArray(k5) ? k5 : [k5], u4, i4, t4, o3 && "foreignObject" !== d5, r3, e4, r3 ? r3[0] : i4.__k && _(i4, 0), c4), null != r3)
for (k5 = r3.length; k5--; )
null != r3[k5] && a(r3[k5]);
c4 || ("value" in p4 && void 0 !== (k5 = p4.value) && (k5 !== l3.value || "progress" === d5 && !k5 || "option" === d5 && k5 !== y5.value) && H(l3, "value", k5, y5.value, false), "checked" in p4 && void 0 !== (k5 = p4.checked) && k5 !== l3.checked && H(l3, "checked", k5, 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 S2(n2, l3) {
P(n2, l3, S2);
}
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;
}
var n, l, u, i, t, o, r, f, e, c;
var init_preact_module = __esm({
"../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/dist/preact.module.js"() {
f = {};
e = [];
c = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
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
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, y2(B2, n2);
}
function y2(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 A3(n2, t4, r3) {
o2 = 6, s2(function() {
return "function" == typeof n2 ? (n2(t4()), function() {
return n2(null);
}) : n2 ? (n2.current = t4(), function() {
return n2.current = null;
}) : void 0;
}, null == r3 ? r3 : r3.concat(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 P2(n2) {
var u4 = d2(t2++, 10), i4 = p3();
return u4.__ = n2, r2.componentDidCatch || (r2.componentDidCatch = function(n3, t4) {
u4.__ && u4.__(n3, t4), i4[1](n3);
}), [i4[0], function() {
i4[1](void 0);
}];
}
function V() {
var n2 = d2(t2++, 11);
if (!n2.__) {
for (var u4 = r2.__v; null !== u4 && !u4.__m && null !== u4.__; )
u4 = u4.__;
var i4 = u4.__m || (u4.__m = [0, 0]);
n2.__ = "P" + i4[0] + "-" + i4[1]++;
}
return n2.__;
}
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);
}
}
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;
}
var t2, r2, u2, i2, o2, f2, c2, e2, a2, v2, l2, m2, g2;
var init_hooks_module = __esm({
"../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/hooks/dist/hooks.module.js"() {
init_preact_module();
o2 = 0;
f2 = [];
c2 = [];
e2 = l.__b;
a2 = l.__r;
v2 = l.diffed;
l2 = l.__c;
m2 = l.unmount;
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));
};
g2 = "function" == typeof requestAnimationFrame;
}
});
// ../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/dist/compat.module.js
var compat_module_exports = {};
__export(compat_module_exports, {
Children: () => O3,
Component: () => d,
Fragment: () => p2,
PureComponent: () => w4,
StrictMode: () => vn2,
Suspense: () => D4,
SuspenseList: () => V2,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: () => rn,
cloneElement: () => cn,
createContext: () => B,
createElement: () => h,
createFactory: () => on,
createPortal: () => j3,
createRef: () => y,
default: () => bn,
findDOMNode: () => an,
flushSync: () => hn,
forwardRef: () => k4,
hydrate: () => q4,
isValidElement: () => ln,
lazy: () => M5,
memo: () => R2,
render: () => Y3,
startTransition: () => dn,
unmountComponentAtNode: () => fn,
unstable_batchedUpdates: () => sn,
useCallback: () => T2,
useContext: () => q2,
useDebugValue: () => x3,
useDeferredValue: () => pn,
useEffect: () => h2,
useErrorBoundary: () => P2,
useId: () => V,
useImperativeHandle: () => A3,
useInsertionEffect: () => yn,
useLayoutEffect: () => s2,
useMemo: () => F,
useReducer: () => y2,
useRef: () => _2,
useState: () => p3,
useSyncExternalStore: () => _n,
useTransition: () => mn,
version: () => un
});
function g3(n2, t4) {
for (var e4 in t4)
n2[e4] = t4[e4];
return n2;
}
function C2(n2, t4) {
for (var e4 in n2)
if ("__source" !== e4 && !(e4 in t4))
return true;
for (var r3 in t4)
if ("__source" !== r3 && n2[r3] !== t4[r3])
return true;
return false;
}
function E2(n2, t4) {
return n2 === t4 && (0 !== n2 || 1 / n2 == 1 / t4) || n2 != n2 && t4 != t4;
}
function w4(n2) {
this.props = n2;
}
function R2(n2, e4) {
function r3(n3) {
var t4 = this.props.ref, r4 = t4 == n3.ref;
return !r4 && t4 && (t4.call ? t4(null) : t4.current = null), e4 ? !e4(this.props, n3) || !r4 : C2(this.props, n3);
}
function u4(e5) {
return this.shouldComponentUpdate = r3, h(n2, e5);
}
return u4.displayName = "Memo(" + (n2.displayName || n2.name) + ")", u4.prototype.isReactComponent = true, u4.__f = true, u4;
}
function k4(n2) {
function t4(t5) {
var e4 = g3({}, t5);
return delete e4.ref, n2(e4, t5.ref || null);
}
return t4.$$typeof = N2, t4.render = t4, t4.prototype.isReactComponent = t4.__f = true, t4.displayName = "ForwardRef(" + (n2.displayName || n2.name) + ")", t4;
}
function L4(n2, t4, e4) {
return n2 && (n2.__c && n2.__c.__H && (n2.__c.__H.__.forEach(function(n3) {
"function" == typeof n3.__c && n3.__c();
}), n2.__c.__H = null), null != (n2 = g3({}, n2)).__c && (n2.__c.__P === e4 && (n2.__c.__P = t4), n2.__c = null), n2.__k = n2.__k && n2.__k.map(function(n3) {
return L4(n3, t4, e4);
})), n2;
}
function U(n2, t4, e4) {
return n2 && (n2.__v = null, n2.__k = n2.__k && n2.__k.map(function(n3) {
return U(n3, t4, e4);
}), n2.__c && n2.__c.__P === t4 && (n2.__e && e4.insertBefore(n2.__e, n2.__d), n2.__c.__e = true, n2.__c.__P = e4)), n2;
}
function D4() {
this.__u = 0, this.t = null, this.__b = null;
}
function F2(n2) {
var t4 = n2.__.__c;
return t4 && t4.__a && t4.__a(n2);
}
function M5(n2) {
var e4, r3, u4;
function o3(o4) {
if (e4 || (e4 = n2()).then(function(n3) {
r3 = n3.default || n3;
}, function(n3) {
u4 = n3;
}), u4)
throw u4;
if (!r3)
throw e4;
return h(r3, o4);
}
return o3.displayName = "Lazy", o3.__f = true, o3;
}
function V2() {
this.u = null, this.o = null;
}
function P3(n2) {
return this.getChildContext = function() {
return n2.context;
}, n2.children;
}
function $2(n2) {
var e4 = this, r3 = n2.i;
e4.componentWillUnmount = function() {
P(null, e4.l), e4.l = null, e4.i = null;
}, e4.i && e4.i !== r3 && e4.componentWillUnmount(), n2.__v ? (e4.l || (e4.i = r3, e4.l = { nodeType: 1, parentNode: r3, childNodes: [], appendChild: function(n3) {
this.childNodes.push(n3), e4.i.appendChild(n3);
}, insertBefore: function(n3, t4) {
this.childNodes.push(n3), e4.i.appendChild(n3);
}, removeChild: function(n3) {
this.childNodes.splice(this.childNodes.indexOf(n3) >>> 1, 1), e4.i.removeChild(n3);
} }), P(h(P3, { context: e4.context }, n2.__v), e4.l)) : e4.l && e4.componentWillUnmount();
}
function j3(n2, e4) {
var r3 = h($2, { __v: n2, i: e4 });
return r3.containerInfo = e4, r3;
}
function Y3(n2, t4, e4) {
return null == t4.__k && (t4.textContent = ""), P(n2, t4), "function" == typeof e4 && e4(), n2 ? n2.__c : null;
}
function q4(n2, t4, e4) {
return S2(n2, t4), "function" == typeof e4 && e4(), n2 ? n2.__c : null;
}
function J() {
}
function K4() {
return this.cancelBubble;
}
function Q2() {
return this.defaultPrevented;
}
function on(n2) {
return h.bind(null, n2);
}
function ln(n2) {
return !!n2 && n2.$$typeof === z4;
}
function cn(n2) {
return ln(n2) ? q.apply(null, arguments) : n2;
}
function fn(n2) {
return !!n2.__k && (P(null, n2), true);
}
function an(n2) {
return n2 && (n2.base || 1 === n2.nodeType && n2) || null;
}
function dn(n2) {
n2();
}
function pn(n2) {
return n2;
}
function mn() {
return [false, dn];
}
function _n(n2, t4) {
var e4 = t4(), r3 = p3({ h: { __: e4, v: t4 } }), u4 = r3[0].h, o3 = r3[1];
return s2(function() {
u4.__ = e4, u4.v = t4, E2(u4.__, t4()) || o3({ h: u4 });
}, [n2, e4, t4]), h2(function() {
return E2(u4.__, u4.v()) || o3({ h: u4 }), n2(function() {
E2(u4.__, u4.v()) || o3({ h: u4 });
});
}, [n2]), e4;
}
var x5, N2, A4, O3, T4, I4, W, z4, B4, H4, Z2, G2, X3, nn, tn, en, rn, un, sn, hn, vn2, yn, bn;
var init_compat_module = __esm({
"../../node_modules/.pnpm/preact@10.11.3/node_modules/preact/compat/dist/compat.module.js"() {
init_preact_module();
init_preact_module();
init_hooks_module();
init_hooks_module();
(w4.prototype = new d()).isPureReactComponent = true, w4.prototype.shouldComponentUpdate = function(n2, t4) {
return C2(this.props, n2) || C2(this.state, t4);
};
x5 = l.__b;
l.__b = function(n2) {
n2.type && n2.type.__f && n2.ref && (n2.props.ref = n2.ref, n2.ref = null), x5 && x5(n2);
};
N2 = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.forward_ref") || 3911;
A4 = function(n2, t4) {
return null == n2 ? null : x2(x2(n2).map(t4));
};
O3 = { map: A4, forEach: A4, count: function(n2) {
return n2 ? x2(n2).length : 0;
}, only: function(n2) {
var t4 = x2(n2);
if (1 !== t4.length)
throw "Children.only";
return t4[0];
}, toArray: x2 };
T4 = l.__e;
l.__e = function(n2, t4, e4, r3) {
if (n2.then) {
for (var u4, o3 = t4; o3 = o3.__; )
if ((u4 = o3.__c) && u4.__c)
return null == t4.__e && (t4.__e = e4.__e, t4.__k = e4.__k), u4.__c(n2, t4);
}
T4(n2, t4, e4, r3);
};
I4 = l.unmount;
l.unmount = function(n2) {
var t4 = n2.__c;
t4 && t4.__R && t4.__R(), t4 && true === n2.__h && (n2.type = null), I4 && I4(n2);
}, (D4.prototype = new d()).__c = function(n2, t4) {
var e4 = t4.__c, r3 = this;
null == r3.t && (r3.t = []), r3.t.push(e4);
var u4 = F2(r3.__v), o3 = false, i4 = function() {
o3 || (o3 = true, e4.__R = null, u4 ? u4(l3) : l3());
};
e4.__R = i4;
var l3 = function() {
if (!--r3.__u) {
if (r3.state.__a) {
var n3 = r3.state.__a;
r3.__v.__k[0] = U(n3, n3.__c.__P, n3.__c.__O);
}
var t5;
for (r3.setState({ __a: r3.__b = null }); t5 = r3.t.pop(); )
t5.forceUpdate();
}
}, c4 = true === t4.__h;
r3.__u++ || c4 || r3.setState({ __a: r3.__b = r3.__v.__k[0] }), n2.then(i4, i4);
}, D4.prototype.componentWillUnmount = function() {
this.t = [];
}, D4.prototype.render = function(n2, e4) {
if (this.__b) {
if (this.__v.__k) {
var r3 = document.createElement("div"), o3 = this.__v.__k[0].__c;
this.__v.__k[0] = L4(this.__b, r3, o3.__O = o3.__P);
}
this.__b = null;
}
var i4 = e4.__a && h(p2, null, n2.fallback);
return i4 && (i4.__h = null), [h(p2, null, e4.__a ? null : n2.children), i4];
};
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))
for (e4 = n2.u; e4; ) {
for (; e4.length > 3; )
e4.pop()();
if (e4[1] < e4[0])
break;
n2.u = e4 = e4[2];
}
};
(V2.prototype = new d()).__a = function(n2) {
var t4 = this, e4 = F2(t4.__v), r3 = t4.o.get(n2);
return r3[0]++, function(u4) {
var o3 = function() {
t4.props.revealOrder ? (r3.push(u4), W(t4, n2, r3)) : u4();
};
e4 ? e4(o3) : o3();
};
}, V2.prototype.render = function(n2) {
this.u = null, this.o = /* @__PURE__ */ new Map();
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]);
return n2.children;
}, V2.prototype.componentDidUpdate = V2.prototype.componentDidMount = function() {
var n2 = this;
this.o.forEach(function(t4, e4) {
W(n2, e4, t4);
});
};
z4 = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103;
B4 = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;
H4 = "undefined" != typeof document;
Z2 = function(n2) {
return ("undefined" != typeof Symbol && "symbol" == typeof Symbol() ? /fil|che|rad/i : /fil|che|ra/i).test(n2);
};
d.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(t4) {
Object.defineProperty(d.prototype, t4, { configurable: true, get: function() {
return this["UNSAFE_" + t4];
}, set: function(n2) {
Object.defineProperty(this, t4, { configurable: true, writable: true, value: n2 });
} });
});
G2 = l.event;
l.event = function(n2) {
return G2 && (n2 = G2(n2)), n2.persist = J, n2.isPropagationStopped = K4, n2.isDefaultPrevented = Q2, n2.nativeEvent = n2;
};
nn = { configurable: true, get: function() {
return this.class;
} };
tn = l.vnode;
l.vnode = function(n2) {
var t4 = n2.type, e4 = n2.props, u4 = e4;
if ("string" == typeof t4) {
var o3 = -1 === t4.indexOf("-");
for (var i4 in u4 = {}, e4) {
var l3 = e4[i4];
H4 && "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 && B4.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 = x2(e4.children).forEach(function(n3) {
n3.props.selected = -1 != u4.value.indexOf(n3.props.value);
})), "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));
}
n2.$$typeof = z4, tn && tn(n2);
};
en = l.__r;
l.__r = function(n2) {
en && en(n2), X3 = n2.__c;
};
rn = { ReactCurrentDispatcher: { current: { readContext: function(n2) {
return X3.__n[n2.__c].props.value;
} } } };
un = "17.0.2";
sn = function(n2, t4) {
return n2(t4);
};
hn = function(n2, t4) {
return n2(t4);
};
vn2 = p2;
yn = s2;
bn = { useState: p3, useId: V, useReducer: y2, useEffect: h2, useLayoutEffect: s2, useInsertionEffect: yn, useTransition: mn, useDeferredValue: pn, useSyncExternalStore: _n, startTransition: dn, useRef: _2, useImperativeHandle: A3, useMemo: F, useCallback: T2, useContext: q2, useDebugValue: x3, version: "17.0.2", Children: O3, render: Y3, hydrate: q4, unmountComponentAtNode: fn, createPortal: j3, createElement: h, createContext: B, createFactory: on, cloneElement: cn, createRef: y, Fragment: p2, isValidElement: ln, findDOMNode: an, Component: d, PureComponent: w4, memo: R2, forwardRef: k4, flushSync: hn, unstable_batchedUpdates: sn, StrictMode: vn2, Suspense: D4, SuspenseList: V2, lazy: M5, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: rn };
}
});
// ../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js
var require_use_sync_external_store_shim_production_min = __commonJS({
"../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js"(exports) {
"use strict";
var e4 = (init_compat_module(), __toCommonJS(compat_module_exports));
function h5(a5, b4) {
return a5 === b4 && (0 !== a5 || 1 / a5 === 1 / b4) || a5 !== a5 && b4 !== b4;
}
var k5 = "function" === typeof Object.is ? Object.is : h5;
var l3 = e4.useState;
var m5 = e4.useEffect;
var n2 = e4.useLayoutEffect;
var p4 = e4.useDebugValue;
function q5(a5, b4) {
var d5 = b4(), f3 = l3({ inst: { value: d5, getSnapshot: b4 } }), c4 = f3[0].inst, g4 = f3[1];
n2(function() {
c4.value = d5;
c4.getSnapshot = b4;
r3(c4) && g4({ inst: c4 });
}, [a5, d5, b4]);
m5(function() {
r3(c4) && g4({ inst: c4 });
return a5(function() {
r3(c4) && g4({ inst: c4 });
});
}, [a5]);
p4(d5);
return d5;
}
function r3(a5) {
var b4 = a5.getSnapshot;
a5 = a5.value;
try {
var d5 = b4();
return !k5(a5, d5);
} catch (f3) {
return true;
}
}
function t4(a5, b4) {
return b4();
}
var u4 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? t4 : q5;
exports.useSyncExternalStore = void 0 !== e4.useSyncExternalStore ? e4.useSyncExternalStore : u4;
}
});
// ../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.js
var require_shim = __commonJS({
"../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.2.0/node_modules/use-sync-external-store/shim/index.js"(exports, module) {
"use strict";
if (true) {
module.exports = require_use_sync_external_store_shim_production_min();
} else {
module.exports = null;
}
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHas.js
var require_baseHas = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHas.js"(exports, module) {
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
function baseHas(object2, key) {
return object2 != null && hasOwnProperty.call(object2, key);
}
module.exports = baseHas;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js
var require_isArray = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"(exports, module) {
var isArray = Array.isArray;
module.exports = isArray;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js
var require_freeGlobal = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js"(exports, module) {
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
module.exports = freeGlobal;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js
var require_root = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js"(exports, module) {
var freeGlobal = require_freeGlobal();
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
module.exports = root;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js
var require_Symbol = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js"(exports, module) {
var root = require_root();
var Symbol2 = root.Symbol;
module.exports = Symbol2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js
var require_getRawTag = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js"(exports, module) {
var Symbol2 = require_Symbol();
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
var nativeObjectToString = objectProto.toString;
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
try {
value[symToStringTag] = void 0;
var unmasked = true;
} catch (e4) {
}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js
var require_objectToString = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js"(exports, module) {
var objectProto = Object.prototype;
var nativeObjectToString = objectProto.toString;
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js
var require_baseGetTag = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js"(exports, module) {
var Symbol2 = require_Symbol();
var getRawTag = require_getRawTag();
var objectToString = require_objectToString();
var nullTag = "[object Null]";
var undefinedTag = "[object Undefined]";
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
function baseGetTag(value) {
if (value == null) {
return value === void 0 ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
module.exports = baseGetTag;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js
var require_isObjectLike = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js"(exports, module) {
function isObjectLike(value) {
return value != null && typeof value == "object";
}
module.exports = isObjectLike;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js
var require_isSymbol = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js"(exports, module) {
var baseGetTag = require_baseGetTag();
var isObjectLike = require_isObjectLike();
var symbolTag = "[object Symbol]";
function isSymbol(value) {
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
}
module.exports = isSymbol;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js
var require_isKey = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js"(exports, module) {
var isArray = require_isArray();
var isSymbol = require_isSymbol();
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
var reIsPlainProp = /^\w*$/;
function isKey(value, object2) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object2 != null && value in Object(object2);
}
module.exports = isKey;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js
var require_isObject = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js"(exports, module) {
function isObject2(value) {
var type = typeof value;
return value != null && (type == "object" || type == "function");
}
module.exports = isObject2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isFunction.js
var require_isFunction = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isFunction.js"(exports, module) {
var baseGetTag = require_baseGetTag();
var isObject2 = require_isObject();
var asyncTag = "[object AsyncFunction]";
var funcTag = "[object Function]";
var genTag = "[object GeneratorFunction]";
var proxyTag = "[object Proxy]";
function isFunction2(value) {
if (!isObject2(value)) {
return false;
}
var tag = baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
module.exports = isFunction2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_coreJsData.js
var require_coreJsData = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_coreJsData.js"(exports, module) {
var root = require_root();
var coreJsData = root["__core-js_shared__"];
module.exports = coreJsData;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isMasked.js
var require_isMasked = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isMasked.js"(exports, module) {
var coreJsData = require_coreJsData();
var maskSrcKey = function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
return uid ? "Symbol(src)_1." + uid : "";
}();
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
module.exports = isMasked;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toSource.js
var require_toSource = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toSource.js"(exports, module) {
var funcProto = Function.prototype;
var funcToString = funcProto.toString;
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e4) {
}
try {
return func + "";
} catch (e4) {
}
}
return "";
}
module.exports = toSource;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNative.js
var require_baseIsNative = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNative.js"(exports, module) {
var isFunction2 = require_isFunction();
var isMasked = require_isMasked();
var isObject2 = require_isObject();
var toSource = require_toSource();
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var funcProto = Function.prototype;
var objectProto = Object.prototype;
var funcToString = funcProto.toString;
var hasOwnProperty = objectProto.hasOwnProperty;
var reIsNative = RegExp(
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function baseIsNative(value) {
if (!isObject2(value) || isMasked(value)) {
return false;
}
var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
module.exports = baseIsNative;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getValue.js
var require_getValue = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getValue.js"(exports, module) {
function getValue2(object2, key) {
return object2 == null ? void 0 : object2[key];
}
module.exports = getValue2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js
var require_getNative = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js"(exports, module) {
var baseIsNative = require_baseIsNative();
var getValue2 = require_getValue();
function getNative(object2, key) {
var value = getValue2(object2, key);
return baseIsNative(value) ? value : void 0;
}
module.exports = getNative;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeCreate.js
var require_nativeCreate = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeCreate.js"(exports, module) {
var getNative = require_getNative();
var nativeCreate = getNative(Object, "create");
module.exports = nativeCreate;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashClear.js
var require_hashClear = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashClear.js"(exports, module) {
var nativeCreate = require_nativeCreate();
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
module.exports = hashClear;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashDelete.js
var require_hashDelete = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashDelete.js"(exports, module) {
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
module.exports = hashDelete;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashGet.js
var require_hashGet = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashGet.js"(exports, module) {
var nativeCreate = require_nativeCreate();
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? void 0 : result;
}
return hasOwnProperty.call(data, key) ? data[key] : void 0;
}
module.exports = hashGet;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashHas.js
var require_hashHas = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashHas.js"(exports, module) {
var nativeCreate = require_nativeCreate();
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
}
module.exports = hashHas;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashSet.js
var require_hashSet = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashSet.js"(exports, module) {
var nativeCreate = require_nativeCreate();
var HASH_UNDEFINED = "__lodash_hash_undefined__";
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
return this;
}
module.exports = hashSet;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Hash.js
var require_Hash = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Hash.js"(exports, module) {
var hashClear = require_hashClear();
var hashDelete = require_hashDelete();
var hashGet = require_hashGet();
var hashHas = require_hashHas();
var hashSet = require_hashSet();
function Hash(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
module.exports = Hash;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js
var require_listCacheClear = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"(exports, module) {
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
module.exports = listCacheClear;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js
var require_eq = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js"(exports, module) {
function eq(value, other) {
return value === other || value !== value && other !== other;
}
module.exports = eq;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js
var require_assocIndexOf = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js"(exports, module) {
var eq = require_eq();
function assocIndexOf(array2, key) {
var length = array2.length;
while (length--) {
if (eq(array2[length][0], key)) {
return length;
}
}
return -1;
}
module.exports = assocIndexOf;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js
var require_listCacheDelete = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"(exports, module) {
var assocIndexOf = require_assocIndexOf();
var arrayProto = Array.prototype;
var splice = arrayProto.splice;
function listCacheDelete(key) {
var data = this.__data__, index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
module.exports = listCacheDelete;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js
var require_listCacheGet = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"(exports, module) {
var assocIndexOf = require_assocIndexOf();
function listCacheGet(key) {
var data = this.__data__, index = assocIndexOf(data, key);
return index < 0 ? void 0 : data[index][1];
}
module.exports = listCacheGet;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js
var require_listCacheHas = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"(exports, module) {
var assocIndexOf = require_assocIndexOf();
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
module.exports = listCacheHas;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js
var require_listCacheSet = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js"(exports, module) {
var assocIndexOf = require_assocIndexOf();
function listCacheSet(key, value) {
var data = this.__data__, index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
module.exports = listCacheSet;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_ListCache.js
var require_ListCache = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_ListCache.js"(exports, module) {
var listCacheClear = require_listCacheClear();
var listCacheDelete = require_listCacheDelete();
var listCacheGet = require_listCacheGet();
var listCacheHas = require_listCacheHas();
var listCacheSet = require_listCacheSet();
function ListCache(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Map.js
var require_Map = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Map.js"(exports, module) {
var getNative = require_getNative();
var root = require_root();
var Map2 = getNative(root, "Map");
module.exports = Map2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js
var require_mapCacheClear = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js"(exports, module) {
var Hash = require_Hash();
var ListCache = require_ListCache();
var Map2 = require_Map();
function mapCacheClear() {
this.size = 0;
this.__data__ = {
"hash": new Hash(),
"map": new (Map2 || ListCache)(),
"string": new Hash()
};
}
module.exports = mapCacheClear;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKeyable.js
var require_isKeyable = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKeyable.js"(exports, module) {
function isKeyable(value) {
var type = typeof value;
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
}
module.exports = isKeyable;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMapData.js
var require_getMapData = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMapData.js"(exports, module) {
var isKeyable = require_isKeyable();
function getMapData(map3, key) {
var data = map3.__data__;
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
module.exports = getMapData;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js
var require_mapCacheDelete = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js"(exports, module) {
var getMapData = require_getMapData();
function mapCacheDelete(key) {
var result = getMapData(this, key)["delete"](key);
this.size -= result ? 1 : 0;
return result;
}
module.exports = mapCacheDelete;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js
var require_mapCacheGet = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js"(exports, module) {
var getMapData = require_getMapData();
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
module.exports = mapCacheGet;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js
var require_mapCacheHas = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js"(exports, module) {
var getMapData = require_getMapData();
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
module.exports = mapCacheHas;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js
var require_mapCacheSet = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js"(exports, module) {
var getMapData = require_getMapData();
function mapCacheSet(key, value) {
var data = getMapData(this, key), size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
module.exports = mapCacheSet;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js
var require_MapCache = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js"(exports, module) {
var mapCacheClear = require_mapCacheClear();
var mapCacheDelete = require_mapCacheDelete();
var mapCacheGet = require_mapCacheGet();
var mapCacheHas = require_mapCacheHas();
var mapCacheSet = require_mapCacheSet();
function MapCache(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
module.exports = MapCache;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js
var require_memoize = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js"(exports, module) {
var MapCache = require_MapCache();
var FUNC_ERROR_TEXT = "Expected a function";
function memoize(func, resolver) {
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache;
if (cache2.has(key)) {
return cache2.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache2.set(key, result) || cache2;
return result;
};
memoized.cache = new (memoize.Cache || MapCache)();
return memoized;
}
memoize.Cache = MapCache;
module.exports = memoize;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_memoizeCapped.js
var require_memoizeCapped = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_memoizeCapped.js"(exports, module) {
var memoize = require_memoize();
var MAX_MEMOIZE_SIZE = 500;
function memoizeCapped(func) {
var result = memoize(func, function(key) {
if (cache2.size === MAX_MEMOIZE_SIZE) {
cache2.clear();
}
return key;
});
var cache2 = result.cache;
return result;
}
module.exports = memoizeCapped;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToPath.js
var require_stringToPath = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToPath.js"(exports, module) {
var memoizeCapped = require_memoizeCapped();
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar = /\\(\\)?/g;
var stringToPath = memoizeCapped(function(string2) {
var result = [];
if (string2.charCodeAt(0) === 46) {
result.push("");
}
string2.replace(rePropName, function(match2, number2, quote, subString) {
result.push(quote ? subString.replace(reEscapeChar, "$1") : number2 || match2);
});
return result;
});
module.exports = stringToPath;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js
var require_arrayMap = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js"(exports, module) {
function arrayMap(array2, iteratee) {
var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
while (++index < length) {
result[index] = iteratee(array2[index], index, array2);
}
return result;
}
module.exports = arrayMap;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js
var require_baseToString = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js"(exports, module) {
var Symbol2 = require_Symbol();
var arrayMap = require_arrayMap();
var isArray = require_isArray();
var isSymbol = require_isSymbol();
var INFINITY = 1 / 0;
var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
var symbolToString2 = symbolProto ? symbolProto.toString : void 0;
function baseToString(value) {
if (typeof value == "string") {
return value;
}
if (isArray(value)) {
return arrayMap(value, baseToString) + "";
}
if (isSymbol(value)) {
return symbolToString2 ? symbolToString2.call(value) : "";
}
var result = value + "";
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
}
module.exports = baseToString;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js
var require_toString = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js"(exports, module) {
var baseToString = require_baseToString();
function toString2(value) {
return value == null ? "" : baseToString(value);
}
module.exports = toString2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js
var require_castPath = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js"(exports, module) {
var isArray = require_isArray();
var isKey = require_isKey();
var stringToPath = require_stringToPath();
var toString2 = require_toString();
function castPath(value, object2) {
if (isArray(value)) {
return value;
}
return isKey(value, object2) ? [value] : stringToPath(toString2(value));
}
module.exports = castPath;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsArguments.js
var require_baseIsArguments = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsArguments.js"(exports, module) {
var baseGetTag = require_baseGetTag();
var isObjectLike = require_isObjectLike();
var argsTag = "[object Arguments]";
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag;
}
module.exports = baseIsArguments;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArguments.js
var require_isArguments = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArguments.js"(exports, module) {
var baseIsArguments = require_baseIsArguments();
var isObjectLike = require_isObjectLike();
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
var isArguments = baseIsArguments(function() {
return arguments;
}()) ? baseIsArguments : function(value) {
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
};
module.exports = isArguments;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js
var require_isIndex = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js"(exports, module) {
var MAX_SAFE_INTEGER = 9007199254740991;
var reIsUint = /^(?:0|[1-9]\d*)$/;
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
}
module.exports = isIndex;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js
var require_isLength = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js"(exports, module) {
var MAX_SAFE_INTEGER = 9007199254740991;
function isLength(value) {
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
module.exports = isLength;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js
var require_toKey = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js"(exports, module) {
var isSymbol = require_isSymbol();
var INFINITY = 1 / 0;
function toKey(value) {
if (typeof value == "string" || isSymbol(value)) {
return value;
}
var result = value + "";
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
}
module.exports = toKey;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasPath.js
var require_hasPath = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasPath.js"(exports, module) {
var castPath = require_castPath();
var isArguments = require_isArguments();
var isArray = require_isArray();
var isIndex = require_isIndex();
var isLength = require_isLength();
var toKey = require_toKey();
function hasPath(object2, path, hasFunc) {
path = castPath(path, object2);
var index = -1, length = path.length, result = false;
while (++index < length) {
var key = toKey(path[index]);
if (!(result = object2 != null && hasFunc(object2, key))) {
break;
}
object2 = object2[key];
}
if (result || ++index != length) {
return result;
}
length = object2 == null ? 0 : object2.length;
return !!length && isLength(length) && isIndex(key, length) && (isArray(object2) || isArguments(object2));
}
module.exports = hasPath;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/has.js
var require_has = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/has.js"(exports, module) {
var baseHas = require_baseHas();
var hasPath = require_hasPath();
function has4(object2, path) {
return object2 != null && hasPath(object2, path, baseHas);
}
module.exports = has4;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js
var require_defineProperty = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js"(exports, module) {
var getNative = require_getNative();
var defineProperty = function() {
try {
var func = getNative(Object, "defineProperty");
func({}, "", {});
return func;
} catch (e4) {
}
}();
module.exports = defineProperty;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js
var require_baseAssignValue = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js"(exports, module) {
var defineProperty = require_defineProperty();
function baseAssignValue(object2, key, value) {
if (key == "__proto__" && defineProperty) {
defineProperty(object2, key, {
"configurable": true,
"enumerable": true,
"value": value,
"writable": true
});
} else {
object2[key] = value;
}
}
module.exports = baseAssignValue;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createBaseFor.js
var require_createBaseFor = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createBaseFor.js"(exports, module) {
function createBaseFor(fromRight) {
return function(object2, iteratee, keysFunc) {
var index = -1, iterable = Object(object2), props = keysFunc(object2), length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object2;
};
}
module.exports = createBaseFor;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFor.js
var require_baseFor = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFor.js"(exports, module) {
var createBaseFor = require_createBaseFor();
var baseFor = createBaseFor();
module.exports = baseFor;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js
var require_baseTimes = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js"(exports, module) {
function baseTimes(n2, iteratee) {
var index = -1, result = Array(n2);
while (++index < n2) {
result[index] = iteratee(index);
}
return result;
}
module.exports = baseTimes;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubFalse.js
var require_stubFalse = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubFalse.js"(exports, module) {
function stubFalse() {
return false;
}
module.exports = stubFalse;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isBuffer.js
var require_isBuffer = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isBuffer.js"(exports, module) {
var root = require_root();
var stubFalse = require_stubFalse();
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
var moduleExports = freeModule && freeModule.exports === freeExports;
var Buffer2 = moduleExports ? root.Buffer : void 0;
var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
var isBuffer = nativeIsBuffer || stubFalse;
module.exports = isBuffer;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsTypedArray.js
var require_baseIsTypedArray = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsTypedArray.js"(exports, module) {
var baseGetTag = require_baseGetTag();
var isLength = require_isLength();
var isObjectLike = require_isObjectLike();
var argsTag = "[object Arguments]";
var arrayTag = "[object Array]";
var boolTag = "[object Boolean]";
var dateTag = "[object Date]";
var errorTag = "[object Error]";
var funcTag = "[object Function]";
var mapTag = "[object Map]";
var numberTag = "[object Number]";
var objectTag = "[object Object]";
var regexpTag = "[object RegExp]";
var setTag = "[object Set]";
var stringTag = "[object String]";
var weakMapTag = "[object WeakMap]";
var arrayBufferTag = "[object ArrayBuffer]";
var dataViewTag = "[object DataView]";
var float32Tag = "[object Float32Array]";
var float64Tag = "[object Float64Array]";
var int8Tag = "[object Int8Array]";
var int16Tag = "[object Int16Array]";
var int32Tag = "[object Int32Array]";
var uint8Tag = "[object Uint8Array]";
var uint8ClampedTag = "[object Uint8ClampedArray]";
var uint16Tag = "[object Uint16Array]";
var uint32Tag = "[object Uint32Array]";
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
function baseIsTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
module.exports = baseIsTypedArray;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseUnary.js
var require_baseUnary = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseUnary.js"(exports, module) {
function baseUnary(func) {
return function(value) {
return func(value);
};
}
module.exports = baseUnary;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nodeUtil.js
var require_nodeUtil = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nodeUtil.js"(exports, module) {
var freeGlobal = require_freeGlobal();
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
var moduleExports = freeModule && freeModule.exports === freeExports;
var freeProcess = moduleExports && freeGlobal.process;
var nodeUtil = function() {
try {
var types = freeModule && freeModule.require && freeModule.require("util").types;
if (types) {
return types;
}
return freeProcess && freeProcess.binding && freeProcess.binding("util");
} catch (e4) {
}
}();
module.exports = nodeUtil;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isTypedArray.js
var require_isTypedArray = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isTypedArray.js"(exports, module) {
var baseIsTypedArray = require_baseIsTypedArray();
var baseUnary = require_baseUnary();
var nodeUtil = require_nodeUtil();
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
module.exports = isTypedArray;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayLikeKeys.js
var require_arrayLikeKeys = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayLikeKeys.js"(exports, module) {
var baseTimes = require_baseTimes();
var isArguments = require_isArguments();
var isArray = require_isArray();
var isBuffer = require_isBuffer();
var isIndex = require_isIndex();
var isTypedArray = require_isTypedArray();
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
module.exports = arrayLikeKeys;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js
var require_isPrototype = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js"(exports, module) {
var objectProto = Object.prototype;
function isPrototype(value) {
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
return value === proto;
}
module.exports = isPrototype;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js
var require_overArg = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js"(exports, module) {
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
module.exports = overArg;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeKeys.js
var require_nativeKeys = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeKeys.js"(exports, module) {
var overArg = require_overArg();
var nativeKeys = overArg(Object.keys, Object);
module.exports = nativeKeys;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeys.js
var require_baseKeys = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeys.js"(exports, module) {
var isPrototype = require_isPrototype();
var nativeKeys = require_nativeKeys();
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
function baseKeys(object2) {
if (!isPrototype(object2)) {
return nativeKeys(object2);
}
var result = [];
for (var key in Object(object2)) {
if (hasOwnProperty.call(object2, key) && key != "constructor") {
result.push(key);
}
}
return result;
}
module.exports = baseKeys;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js
var require_isArrayLike = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js"(exports, module) {
var isFunction2 = require_isFunction();
var isLength = require_isLength();
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction2(value);
}
module.exports = isArrayLike;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keys.js
var require_keys = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keys.js"(exports, module) {
var arrayLikeKeys = require_arrayLikeKeys();
var baseKeys = require_baseKeys();
var isArrayLike = require_isArrayLike();
function keys(object2) {
return isArrayLike(object2) ? arrayLikeKeys(object2) : baseKeys(object2);
}
module.exports = keys;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseForOwn.js
var require_baseForOwn = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseForOwn.js"(exports, module) {
var baseFor = require_baseFor();
var keys = require_keys();
function baseForOwn(object2, iteratee) {
return object2 && baseFor(object2, iteratee, keys);
}
module.exports = baseForOwn;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js
var require_stackClear = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js"(exports, module) {
var ListCache = require_ListCache();
function stackClear() {
this.__data__ = new ListCache();
this.size = 0;
}
module.exports = stackClear;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js
var require_stackDelete = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js"(exports, module) {
function stackDelete(key) {
var data = this.__data__, result = data["delete"](key);
this.size = data.size;
return result;
}
module.exports = stackDelete;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js
var require_stackGet = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js"(exports, module) {
function stackGet(key) {
return this.__data__.get(key);
}
module.exports = stackGet;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js
var require_stackHas = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js"(exports, module) {
function stackHas(key) {
return this.__data__.has(key);
}
module.exports = stackHas;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js
var require_stackSet = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js"(exports, module) {
var ListCache = require_ListCache();
var Map2 = require_Map();
var MapCache = require_MapCache();
var LARGE_ARRAY_SIZE = 200;
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
module.exports = stackSet;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js
var require_Stack = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js"(exports, module) {
var ListCache = require_ListCache();
var stackClear = require_stackClear();
var stackDelete = require_stackDelete();
var stackGet = require_stackGet();
var stackHas = require_stackHas();
var stackSet = require_stackSet();
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
Stack.prototype.clear = stackClear;
Stack.prototype["delete"] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
module.exports = Stack;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheAdd.js
var require_setCacheAdd = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheAdd.js"(exports, module) {
var HASH_UNDEFINED = "__lodash_hash_undefined__";
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
module.exports = setCacheAdd;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheHas.js
var require_setCacheHas = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheHas.js"(exports, module) {
function setCacheHas(value) {
return this.__data__.has(value);
}
module.exports = setCacheHas;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js
var require_SetCache = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js"(exports, module) {
var MapCache = require_MapCache();
var setCacheAdd = require_setCacheAdd();
var setCacheHas = require_setCacheHas();
function SetCache(values) {
var index = -1, length = values == null ? 0 : values.length;
this.__data__ = new MapCache();
while (++index < length) {
this.add(values[index]);
}
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
module.exports = SetCache;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arraySome.js
var require_arraySome = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arraySome.js"(exports, module) {
function arraySome(array2, predicate) {
var index = -1, length = array2 == null ? 0 : array2.length;
while (++index < length) {
if (predicate(array2[index], index, array2)) {
return true;
}
}
return false;
}
module.exports = arraySome;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cacheHas.js
var require_cacheHas = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cacheHas.js"(exports, module) {
function cacheHas(cache2, key) {
return cache2.has(key);
}
module.exports = cacheHas;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalArrays.js
var require_equalArrays = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalArrays.js"(exports, module) {
var SetCache = require_SetCache();
var arraySome = require_arraySome();
var cacheHas = require_cacheHas();
var COMPARE_PARTIAL_FLAG = 1;
var COMPARE_UNORDERED_FLAG = 2;
function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
var arrStacked = stack.get(array2);
var othStacked = stack.get(other);
if (arrStacked && othStacked) {
return arrStacked == other && othStacked == array2;
}
var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0;
stack.set(array2, other);
stack.set(other, array2);
while (++index < arrLength) {
var arrValue = array2[index], othValue = other[index];
if (customizer) {
var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
}
if (compared !== void 0) {
if (compared) {
continue;
}
result = false;
break;
}
if (seen) {
if (!arraySome(other, function(othValue2, othIndex) {
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
result = false;
break;
}
}
stack["delete"](array2);
stack["delete"](other);
return result;
}
module.exports = equalArrays;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js
var require_Uint8Array = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js"(exports, module) {
var root = require_root();
var Uint8Array2 = root.Uint8Array;
module.exports = Uint8Array2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapToArray.js
var require_mapToArray = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapToArray.js"(exports, module) {
function mapToArray(map3) {
var index = -1, result = Array(map3.size);
map3.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
module.exports = mapToArray;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToArray.js
var require_setToArray = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToArray.js"(exports, module) {
function setToArray(set2) {
var index = -1, result = Array(set2.size);
set2.forEach(function(value) {
result[++index] = value;
});
return result;
}
module.exports = setToArray;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalByTag.js
var require_equalByTag = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalByTag.js"(exports, module) {
var Symbol2 = require_Symbol();
var Uint8Array2 = require_Uint8Array();
var eq = require_eq();
var equalArrays = require_equalArrays();
var mapToArray = require_mapToArray();
var setToArray = require_setToArray();
var COMPARE_PARTIAL_FLAG = 1;
var COMPARE_UNORDERED_FLAG = 2;
var boolTag = "[object Boolean]";
var dateTag = "[object Date]";
var errorTag = "[object Error]";
var mapTag = "[object Map]";
var numberTag = "[object Number]";
var regexpTag = "[object RegExp]";
var setTag = "[object Set]";
var stringTag = "[object String]";
var symbolTag = "[object Symbol]";
var arrayBufferTag = "[object ArrayBuffer]";
var dataViewTag = "[object DataView]";
var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
function equalByTag(object2, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if (object2.byteLength != other.byteLength || object2.byteOffset != other.byteOffset) {
return false;
}
object2 = object2.buffer;
other = other.buffer;
case arrayBufferTag:
if (object2.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object2), new Uint8Array2(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
return eq(+object2, +other);
case errorTag:
return object2.name == other.name && object2.message == other.message;
case regexpTag:
case stringTag:
return object2 == other + "";
case mapTag:
var convert2 = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert2 || (convert2 = setToArray);
if (object2.size != other.size && !isPartial) {
return false;
}
var stacked = stack.get(object2);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
stack.set(object2, other);
var result = equalArrays(convert2(object2), convert2(other), bitmask, customizer, equalFunc, stack);
stack["delete"](object2);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object2) == symbolValueOf.call(other);
}
}
return false;
}
module.exports = equalByTag;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js
var require_arrayPush = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js"(exports, module) {
function arrayPush(array2, values) {
var index = -1, length = values.length, offset = array2.length;
while (++index < length) {
array2[offset + index] = values[index];
}
return array2;
}
module.exports = arrayPush;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetAllKeys.js
var require_baseGetAllKeys = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetAllKeys.js"(exports, module) {
var arrayPush = require_arrayPush();
var isArray = require_isArray();
function baseGetAllKeys(object2, keysFunc, symbolsFunc) {
var result = keysFunc(object2);
return isArray(object2) ? result : arrayPush(result, symbolsFunc(object2));
}
module.exports = baseGetAllKeys;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayFilter.js
var require_arrayFilter = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayFilter.js"(exports, module) {
function arrayFilter(array2, predicate) {
var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
while (++index < length) {
var value = array2[index];
if (predicate(value, index, array2)) {
result[resIndex++] = value;
}
}
return result;
}
module.exports = arrayFilter;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubArray.js
var require_stubArray = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubArray.js"(exports, module) {
function stubArray() {
return [];
}
module.exports = stubArray;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getSymbols.js
var require_getSymbols = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getSymbols.js"(exports, module) {
var arrayFilter = require_arrayFilter();
var stubArray = require_stubArray();
var objectProto = Object.prototype;
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
var nativeGetSymbols = Object.getOwnPropertySymbols;
var getSymbols = !nativeGetSymbols ? stubArray : function(object2) {
if (object2 == null) {
return [];
}
object2 = Object(object2);
return arrayFilter(nativeGetSymbols(object2), function(symbol) {
return propertyIsEnumerable.call(object2, symbol);
});
};
module.exports = getSymbols;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getAllKeys.js
var require_getAllKeys = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getAllKeys.js"(exports, module) {
var baseGetAllKeys = require_baseGetAllKeys();
var getSymbols = require_getSymbols();
var keys = require_keys();
function getAllKeys(object2) {
return baseGetAllKeys(object2, keys, getSymbols);
}
module.exports = getAllKeys;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalObjects.js
var require_equalObjects = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalObjects.js"(exports, module) {
var getAllKeys = require_getAllKeys();
var COMPARE_PARTIAL_FLAG = 1;
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
function equalObjects(object2, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object2), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
var objStacked = stack.get(object2);
var othStacked = stack.get(other);
if (objStacked && othStacked) {
return objStacked == other && othStacked == object2;
}
var result = true;
stack.set(object2, other);
stack.set(other, object2);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object2[key], othValue = other[key];
if (customizer) {
var compared = isPartial ? customizer(othValue, objValue, key, other, object2, stack) : customizer(objValue, othValue, key, object2, other, stack);
}
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
result = false;
break;
}
skipCtor || (skipCtor = key == "constructor");
}
if (result && !skipCtor) {
var objCtor = object2.constructor, othCtor = other.constructor;
if (objCtor != othCtor && ("constructor" in object2 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
result = false;
}
}
stack["delete"](object2);
stack["delete"](other);
return result;
}
module.exports = equalObjects;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_DataView.js
var require_DataView = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_DataView.js"(exports, module) {
var getNative = require_getNative();
var root = require_root();
var DataView2 = getNative(root, "DataView");
module.exports = DataView2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Promise.js
var require_Promise = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Promise.js"(exports, module) {
var getNative = require_getNative();
var root = require_root();
var Promise2 = getNative(root, "Promise");
module.exports = Promise2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Set.js
var require_Set = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Set.js"(exports, module) {
var getNative = require_getNative();
var root = require_root();
var Set2 = getNative(root, "Set");
module.exports = Set2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_WeakMap.js
var require_WeakMap = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_WeakMap.js"(exports, module) {
var getNative = require_getNative();
var root = require_root();
var WeakMap2 = getNative(root, "WeakMap");
module.exports = WeakMap2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getTag.js
var require_getTag = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getTag.js"(exports, module) {
var DataView2 = require_DataView();
var Map2 = require_Map();
var Promise2 = require_Promise();
var Set2 = require_Set();
var WeakMap2 = require_WeakMap();
var baseGetTag = require_baseGetTag();
var toSource = require_toSource();
var mapTag = "[object Map]";
var objectTag = "[object Object]";
var promiseTag = "[object Promise]";
var setTag = "[object Set]";
var weakMapTag = "[object WeakMap]";
var dataViewTag = "[object DataView]";
var dataViewCtorString = toSource(DataView2);
var mapCtorString = toSource(Map2);
var promiseCtorString = toSource(Promise2);
var setCtorString = toSource(Set2);
var weakMapCtorString = toSource(WeakMap2);
var getTag = baseGetTag;
if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
getTag = function(value) {
var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
if (ctorString) {
switch (ctorString) {
case dataViewCtorString:
return dataViewTag;
case mapCtorString:
return mapTag;
case promiseCtorString:
return promiseTag;
case setCtorString:
return setTag;
case weakMapCtorString:
return weakMapTag;
}
}
return result;
};
}
module.exports = getTag;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqualDeep.js
var require_baseIsEqualDeep = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqualDeep.js"(exports, module) {
var Stack = require_Stack();
var equalArrays = require_equalArrays();
var equalByTag = require_equalByTag();
var equalObjects = require_equalObjects();
var getTag = require_getTag();
var isArray = require_isArray();
var isBuffer = require_isBuffer();
var isTypedArray = require_isTypedArray();
var COMPARE_PARTIAL_FLAG = 1;
var argsTag = "[object Arguments]";
var arrayTag = "[object Array]";
var objectTag = "[object Object]";
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
function baseIsEqualDeep(object2, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray(object2), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object2), othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object2)) {
if (!isBuffer(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack());
return objIsArr || isTypedArray(object2) ? equalArrays(object2, other, bitmask, customizer, equalFunc, stack) : equalByTag(object2, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object2, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object2.value() : object2, othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack());
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack());
return equalObjects(object2, other, bitmask, customizer, equalFunc, stack);
}
module.exports = baseIsEqualDeep;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js
var require_baseIsEqual = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js"(exports, module) {
var baseIsEqualDeep = require_baseIsEqualDeep();
var isObjectLike = require_isObjectLike();
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
module.exports = baseIsEqual;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsMatch.js
var require_baseIsMatch = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsMatch.js"(exports, module) {
var Stack = require_Stack();
var baseIsEqual = require_baseIsEqual();
var COMPARE_PARTIAL_FLAG = 1;
var COMPARE_UNORDERED_FLAG = 2;
function baseIsMatch(object2, source, matchData, customizer) {
var index = matchData.length, length = index, noCustomizer = !customizer;
if (object2 == null) {
return !length;
}
object2 = Object(object2);
while (index--) {
var data = matchData[index];
if (noCustomizer && data[2] ? data[1] !== object2[data[0]] : !(data[0] in object2)) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0], objValue = object2[key], srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === void 0 && !(key in object2)) {
return false;
}
} else {
var stack = new Stack();
if (customizer) {
var result = customizer(objValue, srcValue, key, object2, source, stack);
}
if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result)) {
return false;
}
}
}
return true;
}
module.exports = baseIsMatch;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isStrictComparable.js
var require_isStrictComparable = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isStrictComparable.js"(exports, module) {
var isObject2 = require_isObject();
function isStrictComparable(value) {
return value === value && !isObject2(value);
}
module.exports = isStrictComparable;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMatchData.js
var require_getMatchData = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMatchData.js"(exports, module) {
var isStrictComparable = require_isStrictComparable();
var keys = require_keys();
function getMatchData(object2) {
var result = keys(object2), length = result.length;
while (length--) {
var key = result[length], value = object2[key];
result[length] = [key, value, isStrictComparable(value)];
}
return result;
}
module.exports = getMatchData;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_matchesStrictComparable.js
var require_matchesStrictComparable = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_matchesStrictComparable.js"(exports, module) {
function matchesStrictComparable(key, srcValue) {
return function(object2) {
if (object2 == null) {
return false;
}
return object2[key] === srcValue && (srcValue !== void 0 || key in Object(object2));
};
}
module.exports = matchesStrictComparable;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatches.js
var require_baseMatches = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatches.js"(exports, module) {
var baseIsMatch = require_baseIsMatch();
var getMatchData = require_getMatchData();
var matchesStrictComparable = require_matchesStrictComparable();
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object2) {
return object2 === source || baseIsMatch(object2, source, matchData);
};
}
module.exports = baseMatches;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js
var require_baseGet = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"(exports, module) {
var castPath = require_castPath();
var toKey = require_toKey();
function baseGet(object2, path) {
path = castPath(path, object2);
var index = 0, length = path.length;
while (object2 != null && index < length) {
object2 = object2[toKey(path[index++])];
}
return index && index == length ? object2 : void 0;
}
module.exports = baseGet;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js
var require_get = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js"(exports, module) {
var baseGet = require_baseGet();
function get(object2, path, defaultValue) {
var result = object2 == null ? void 0 : baseGet(object2, path);
return result === void 0 ? defaultValue : result;
}
module.exports = get;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js
var require_baseHasIn = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js"(exports, module) {
function baseHasIn(object2, key) {
return object2 != null && key in Object(object2);
}
module.exports = baseHasIn;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/hasIn.js
var require_hasIn = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/hasIn.js"(exports, module) {
var baseHasIn = require_baseHasIn();
var hasPath = require_hasPath();
function hasIn(object2, path) {
return object2 != null && hasPath(object2, path, baseHasIn);
}
module.exports = hasIn;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatchesProperty.js
var require_baseMatchesProperty = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatchesProperty.js"(exports, module) {
var baseIsEqual = require_baseIsEqual();
var get = require_get();
var hasIn = require_hasIn();
var isKey = require_isKey();
var isStrictComparable = require_isStrictComparable();
var matchesStrictComparable = require_matchesStrictComparable();
var toKey = require_toKey();
var COMPARE_PARTIAL_FLAG = 1;
var COMPARE_UNORDERED_FLAG = 2;
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object2) {
var objValue = get(object2, path);
return objValue === void 0 && objValue === srcValue ? hasIn(object2, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}
module.exports = baseMatchesProperty;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js
var require_identity = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js"(exports, module) {
function identity(value) {
return value;
}
module.exports = identity;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseProperty.js
var require_baseProperty = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseProperty.js"(exports, module) {
function baseProperty(key) {
return function(object2) {
return object2 == null ? void 0 : object2[key];
};
}
module.exports = baseProperty;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyDeep.js
var require_basePropertyDeep = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyDeep.js"(exports, module) {
var baseGet = require_baseGet();
function basePropertyDeep(path) {
return function(object2) {
return baseGet(object2, path);
};
}
module.exports = basePropertyDeep;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/property.js
var require_property = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/property.js"(exports, module) {
var baseProperty = require_baseProperty();
var basePropertyDeep = require_basePropertyDeep();
var isKey = require_isKey();
var toKey = require_toKey();
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
module.exports = property;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIteratee.js
var require_baseIteratee = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIteratee.js"(exports, module) {
var baseMatches = require_baseMatches();
var baseMatchesProperty = require_baseMatchesProperty();
var identity = require_identity();
var isArray = require_isArray();
var property = require_property();
function baseIteratee(value) {
if (typeof value == "function") {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == "object") {
return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
}
return property(value);
}
module.exports = baseIteratee;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/mapValues.js
var require_mapValues = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/mapValues.js"(exports, module) {
var baseAssignValue = require_baseAssignValue();
var baseForOwn = require_baseForOwn();
var baseIteratee = require_baseIteratee();
function mapValues3(object2, iteratee) {
var result = {};
iteratee = baseIteratee(iteratee, 3);
baseForOwn(object2, function(value, key, object3) {
baseAssignValue(result, key, iteratee(value, key, object3));
});
return result;
}
module.exports = mapValues3;
}
});
// ../../node_modules/.pnpm/property-expr@2.0.5/node_modules/property-expr/index.js
var require_property_expr = __commonJS({
"../../node_modules/.pnpm/property-expr@2.0.5/node_modules/property-expr/index.js"(exports, module) {
"use strict";
function Cache(maxSize) {
this._maxSize = maxSize;
this.clear();
}
Cache.prototype.clear = function() {
this._size = 0;
this._values = /* @__PURE__ */ Object.create(null);
};
Cache.prototype.get = function(key) {
return this._values[key];
};
Cache.prototype.set = function(key, value) {
this._size >= this._maxSize && this.clear();
if (!(key in this._values))
this._size++;
return this._values[key] = value;
};
var SPLIT_REGEX = /[^.^\]^[]+|(?=\[\]|\.\.)/g;
var DIGIT_REGEX = /^\d+$/;
var LEAD_DIGIT_REGEX = /^\d/;
var SPEC_CHAR_REGEX = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g;
var CLEAN_QUOTES_REGEX = /^\s*(['"]?)(.*?)(\1)\s*$/;
var MAX_CACHE_SIZE = 512;
var pathCache = new Cache(MAX_CACHE_SIZE);
var setCache = new Cache(MAX_CACHE_SIZE);
var getCache = new Cache(MAX_CACHE_SIZE);
module.exports = {
Cache,
split: split2,
normalizePath,
setter: function(path) {
var parts = normalizePath(path);
return setCache.get(path) || setCache.set(path, function setter(obj, value) {
var index = 0;
var len = parts.length;
var data = obj;
while (index < len - 1) {
var part = parts[index];
if (part === "__proto__" || part === "constructor" || part === "prototype") {
return obj;
}
data = data[parts[index++]];
}
data[parts[index]] = value;
});
},
getter: function(path, safe) {
var parts = normalizePath(path);
return getCache.get(path) || getCache.set(path, function getter3(data) {
var index = 0, len = parts.length;
while (index < len) {
if (data != null || !safe)
data = data[parts[index++]];
else
return;
}
return data;
});
},
join: function(segments) {
return segments.reduce(function(path, part) {
return path + (isQuoted(part) || DIGIT_REGEX.test(part) ? "[" + part + "]" : (path ? "." : "") + part);
}, "");
},
forEach: function(path, cb, thisArg) {
forEach2(Array.isArray(path) ? path : split2(path), cb, thisArg);
}
};
function normalizePath(path) {
return pathCache.get(path) || pathCache.set(
path,
split2(path).map(function(part) {
return part.replace(CLEAN_QUOTES_REGEX, "$2");
})
);
}
function split2(path) {
return path.match(SPLIT_REGEX) || [""];
}
function forEach2(parts, iter, thisArg) {
var len = parts.length, part, idx, isArray, isBracket;
for (idx = 0; idx < len; idx++) {
part = parts[idx];
if (part) {
if (shouldBeQuoted(part)) {
part = '"' + part + '"';
}
isBracket = isQuoted(part);
isArray = !isBracket && /^\d+$/.test(part);
iter.call(thisArg, part, isBracket, isArray, idx, parts);
}
}
}
function isQuoted(str) {
return typeof str === "string" && str && ["'", '"'].indexOf(str.charAt(0)) !== -1;
}
function hasLeadingNumber(part) {
return part.match(LEAD_DIGIT_REGEX) && !part.match(DIGIT_REGEX);
}
function hasSpecialChars(part) {
return SPEC_CHAR_REGEX.test(part);
}
function shouldBeQuoted(part) {
return !isQuoted(part) && (hasLeadingNumber(part) || hasSpecialChars(part));
}
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js
var require_arrayReduce = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js"(exports, module) {
function arrayReduce(array2, iteratee, accumulator, initAccum) {
var index = -1, length = array2 == null ? 0 : array2.length;
if (initAccum && length) {
accumulator = array2[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array2[index], index, array2);
}
return accumulator;
}
module.exports = arrayReduce;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js
var require_basePropertyOf = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js"(exports, module) {
function basePropertyOf(object2) {
return function(key) {
return object2 == null ? void 0 : object2[key];
};
}
module.exports = basePropertyOf;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js
var require_deburrLetter = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js"(exports, module) {
var basePropertyOf = require_basePropertyOf();
var deburredLetters = {
// Latin-1 Supplement block.
"\xC0": "A",
"\xC1": "A",
"\xC2": "A",
"\xC3": "A",
"\xC4": "A",
"\xC5": "A",
"\xE0": "a",
"\xE1": "a",
"\xE2": "a",
"\xE3": "a",
"\xE4": "a",
"\xE5": "a",
"\xC7": "C",
"\xE7": "c",
"\xD0": "D",
"\xF0": "d",
"\xC8": "E",
"\xC9": "E",
"\xCA": "E",
"\xCB": "E",
"\xE8": "e",
"\xE9": "e",
"\xEA": "e",
"\xEB": "e",
"\xCC": "I",
"\xCD": "I",
"\xCE": "I",
"\xCF": "I",
"\xEC": "i",
"\xED": "i",
"\xEE": "i",
"\xEF": "i",
"\xD1": "N",
"\xF1": "n",
"\xD2": "O",
"\xD3": "O",
"\xD4": "O",
"\xD5": "O",
"\xD6": "O",
"\xD8": "O",
"\xF2": "o",
"\xF3": "o",
"\xF4": "o",
"\xF5": "o",
"\xF6": "o",
"\xF8": "o",
"\xD9": "U",
"\xDA": "U",
"\xDB": "U",
"\xDC": "U",
"\xF9": "u",
"\xFA": "u",
"\xFB": "u",
"\xFC": "u",
"\xDD": "Y",
"\xFD": "y",
"\xFF": "y",
"\xC6": "Ae",
"\xE6": "ae",
"\xDE": "Th",
"\xFE": "th",
"\xDF": "ss",
// Latin Extended-A block.
"\u0100": "A",
"\u0102": "A",
"\u0104": "A",
"\u0101": "a",
"\u0103": "a",
"\u0105": "a",
"\u0106": "C",
"\u0108": "C",
"\u010A": "C",
"\u010C": "C",
"\u0107": "c",
"\u0109": "c",
"\u010B": "c",
"\u010D": "c",
"\u010E": "D",
"\u0110": "D",
"\u010F": "d",
"\u0111": "d",
"\u0112": "E",
"\u0114": "E",
"\u0116": "E",
"\u0118": "E",
"\u011A": "E",
"\u0113": "e",
"\u0115": "e",
"\u0117": "e",
"\u0119": "e",
"\u011B": "e",
"\u011C": "G",
"\u011E": "G",
"\u0120": "G",
"\u0122": "G",
"\u011D": "g",
"\u011F": "g",
"\u0121": "g",
"\u0123": "g",
"\u0124": "H",
"\u0126": "H",
"\u0125": "h",
"\u0127": "h",
"\u0128": "I",
"\u012A": "I",
"\u012C": "I",
"\u012E": "I",
"\u0130": "I",
"\u0129": "i",
"\u012B": "i",
"\u012D": "i",
"\u012F": "i",
"\u0131": "i",
"\u0134": "J",
"\u0135": "j",
"\u0136": "K",
"\u0137": "k",
"\u0138": "k",
"\u0139": "L",
"\u013B": "L",
"\u013D": "L",
"\u013F": "L",
"\u0141": "L",
"\u013A": "l",
"\u013C": "l",
"\u013E": "l",
"\u0140": "l",
"\u0142": "l",
"\u0143": "N",
"\u0145": "N",
"\u0147": "N",
"\u014A": "N",
"\u0144": "n",
"\u0146": "n",
"\u0148": "n",
"\u014B": "n",
"\u014C": "O",
"\u014E": "O",
"\u0150": "O",
"\u014D": "o",
"\u014F": "o",
"\u0151": "o",
"\u0154": "R",
"\u0156": "R",
"\u0158": "R",
"\u0155": "r",
"\u0157": "r",
"\u0159": "r",
"\u015A": "S",
"\u015C": "S",
"\u015E": "S",
"\u0160": "S",
"\u015B": "s",
"\u015D": "s",
"\u015F": "s",
"\u0161": "s",
"\u0162": "T",
"\u0164": "T",
"\u0166": "T",
"\u0163": "t",
"\u0165": "t",
"\u0167": "t",
"\u0168": "U",
"\u016A": "U",
"\u016C": "U",
"\u016E": "U",
"\u0170": "U",
"\u0172": "U",
"\u0169": "u",
"\u016B": "u",
"\u016D": "u",
"\u016F": "u",
"\u0171": "u",
"\u0173": "u",
"\u0174": "W",
"\u0175": "w",
"\u0176": "Y",
"\u0177": "y",
"\u0178": "Y",
"\u0179": "Z",
"\u017B": "Z",
"\u017D": "Z",
"\u017A": "z",
"\u017C": "z",
"\u017E": "z",
"\u0132": "IJ",
"\u0133": "ij",
"\u0152": "Oe",
"\u0153": "oe",
"\u0149": "'n",
"\u017F": "s"
};
var deburrLetter = basePropertyOf(deburredLetters);
module.exports = deburrLetter;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js
var require_deburr = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js"(exports, module) {
var deburrLetter = require_deburrLetter();
var toString2 = require_toString();
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
var rsComboMarksRange = "\\u0300-\\u036f";
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsCombo = "[" + rsComboRange + "]";
var reComboMark = RegExp(rsCombo, "g");
function deburr(string2) {
string2 = toString2(string2);
return string2 && string2.replace(reLatin, deburrLetter).replace(reComboMark, "");
}
module.exports = deburr;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js
var require_asciiWords = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js"(exports, module) {
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
function asciiWords(string2) {
return string2.match(reAsciiWord) || [];
}
module.exports = asciiWords;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js
var require_hasUnicodeWord = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js"(exports, module) {
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
function hasUnicodeWord(string2) {
return reHasUnicodeWord.test(string2);
}
module.exports = hasUnicodeWord;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js
var require_unicodeWords = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js"(exports, module) {
var rsAstralRange = "\\ud800-\\udfff";
var rsComboMarksRange = "\\u0300-\\u036f";
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsDingbatRange = "\\u2700-\\u27bf";
var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
var rsPunctuationRange = "\\u2000-\\u206f";
var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
var rsVarRange = "\\ufe0e\\ufe0f";
var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
var rsApos = "['\u2019]";
var rsBreak = "[" + rsBreakRange + "]";
var rsCombo = "[" + rsComboRange + "]";
var rsDigits = "\\d+";
var rsDingbat = "[" + rsDingbatRange + "]";
var rsLower = "[" + rsLowerRange + "]";
var rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
var rsFitz = "\\ud83c[\\udffb-\\udfff]";
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
var rsNonAstral = "[^" + rsAstralRange + "]";
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
var rsUpper = "[" + rsUpperRange + "]";
var rsZWJ = "\\u200d";
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
var rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
var rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
var reOptMod = rsModifier + "?";
var rsOptVar = "[" + rsVarRange + "]?";
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
var rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq;
var reUnicodeWord = RegExp([
rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
rsUpper + "+" + rsOptContrUpper,
rsOrdUpper,
rsOrdLower,
rsDigits,
rsEmoji
].join("|"), "g");
function unicodeWords(string2) {
return string2.match(reUnicodeWord) || [];
}
module.exports = unicodeWords;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js
var require_words = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js"(exports, module) {
var asciiWords = require_asciiWords();
var hasUnicodeWord = require_hasUnicodeWord();
var toString2 = require_toString();
var unicodeWords = require_unicodeWords();
function words(string2, pattern, guard) {
string2 = toString2(string2);
pattern = guard ? void 0 : pattern;
if (pattern === void 0) {
return hasUnicodeWord(string2) ? unicodeWords(string2) : asciiWords(string2);
}
return string2.match(pattern) || [];
}
module.exports = words;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js
var require_createCompounder = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js"(exports, module) {
var arrayReduce = require_arrayReduce();
var deburr = require_deburr();
var words = require_words();
var rsApos = "['\u2019]";
var reApos = RegExp(rsApos, "g");
function createCompounder(callback) {
return function(string2) {
return arrayReduce(words(deburr(string2).replace(reApos, "")), callback, "");
};
}
module.exports = createCompounder;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js
var require_snakeCase = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js"(exports, module) {
var createCompounder = require_createCompounder();
var snakeCase2 = createCompounder(function(result, word, index) {
return result + (index ? "_" : "") + word.toLowerCase();
});
module.exports = snakeCase2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSlice.js
var require_baseSlice = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSlice.js"(exports, module) {
function baseSlice(array2, start, end) {
var index = -1, length = array2.length;
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : end - start >>> 0;
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array2[index + start];
}
return result;
}
module.exports = baseSlice;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castSlice.js
var require_castSlice = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castSlice.js"(exports, module) {
var baseSlice = require_baseSlice();
function castSlice(array2, start, end) {
var length = array2.length;
end = end === void 0 ? length : end;
return !start && end >= length ? array2 : baseSlice(array2, start, end);
}
module.exports = castSlice;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicode.js
var require_hasUnicode = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicode.js"(exports, module) {
var rsAstralRange = "\\ud800-\\udfff";
var rsComboMarksRange = "\\u0300-\\u036f";
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsVarRange = "\\ufe0e\\ufe0f";
var rsZWJ = "\\u200d";
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
function hasUnicode(string2) {
return reHasUnicode.test(string2);
}
module.exports = hasUnicode;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiToArray.js
var require_asciiToArray = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiToArray.js"(exports, module) {
function asciiToArray(string2) {
return string2.split("");
}
module.exports = asciiToArray;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeToArray.js
var require_unicodeToArray = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeToArray.js"(exports, module) {
var rsAstralRange = "\\ud800-\\udfff";
var rsComboMarksRange = "\\u0300-\\u036f";
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsVarRange = "\\ufe0e\\ufe0f";
var rsAstral = "[" + rsAstralRange + "]";
var rsCombo = "[" + rsComboRange + "]";
var rsFitz = "\\ud83c[\\udffb-\\udfff]";
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
var rsNonAstral = "[^" + rsAstralRange + "]";
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
var rsZWJ = "\\u200d";
var reOptMod = rsModifier + "?";
var rsOptVar = "[" + rsVarRange + "]?";
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
function unicodeToArray(string2) {
return string2.match(reUnicode) || [];
}
module.exports = unicodeToArray;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToArray.js
var require_stringToArray = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToArray.js"(exports, module) {
var asciiToArray = require_asciiToArray();
var hasUnicode = require_hasUnicode();
var unicodeToArray = require_unicodeToArray();
function stringToArray(string2) {
return hasUnicode(string2) ? unicodeToArray(string2) : asciiToArray(string2);
}
module.exports = stringToArray;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCaseFirst.js
var require_createCaseFirst = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCaseFirst.js"(exports, module) {
var castSlice = require_castSlice();
var hasUnicode = require_hasUnicode();
var stringToArray = require_stringToArray();
var toString2 = require_toString();
function createCaseFirst(methodName) {
return function(string2) {
string2 = toString2(string2);
var strSymbols = hasUnicode(string2) ? stringToArray(string2) : void 0;
var chr = strSymbols ? strSymbols[0] : string2.charAt(0);
var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string2.slice(1);
return chr[methodName]() + trailing;
};
}
module.exports = createCaseFirst;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/upperFirst.js
var require_upperFirst = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/upperFirst.js"(exports, module) {
var createCaseFirst = require_createCaseFirst();
var upperFirst = createCaseFirst("toUpperCase");
module.exports = upperFirst;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/capitalize.js
var require_capitalize = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/capitalize.js"(exports, module) {
var toString2 = require_toString();
var upperFirst = require_upperFirst();
function capitalize(string2) {
return upperFirst(toString2(string2).toLowerCase());
}
module.exports = capitalize;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/camelCase.js
var require_camelCase = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/camelCase.js"(exports, module) {
var capitalize = require_capitalize();
var createCompounder = require_createCompounder();
var camelCase2 = createCompounder(function(result, word, index) {
word = word.toLowerCase();
return result + (index ? capitalize(word) : word);
});
module.exports = camelCase2;
}
});
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/mapKeys.js
var require_mapKeys = __commonJS({
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/mapKeys.js"(exports, module) {
var baseAssignValue = require_baseAssignValue();
var baseForOwn = require_baseForOwn();
var baseIteratee = require_baseIteratee();
function mapKeys2(object2, iteratee) {
var result = {};
iteratee = baseIteratee(iteratee, 3);
baseForOwn(object2, function(value, key, object3) {
baseAssignValue(result, iteratee(value, key, object3), value);
});
return result;
}
module.exports = mapKeys2;
}
});
// ../../node_modules/.pnpm/toposort@2.0.2/node_modules/toposort/index.js
var require_toposort = __commonJS({
"../../node_modules/.pnpm/toposort@2.0.2/node_modules/toposort/index.js"(exports, module) {
module.exports = function(edges) {
return toposort2(uniqueNodes(edges), edges);
};
module.exports.array = toposort2;
function toposort2(nodes, edges) {
var cursor = nodes.length, sorted = new Array(cursor), visited = {}, i4 = cursor, outgoingEdges = makeOutgoingEdges(edges), nodesHash = makeNodesHash(nodes);
edges.forEach(function(edge) {
if (!nodesHash.has(edge[0]) || !nodesHash.has(edge[1])) {
throw new Error("Unknown node. There is an unknown node in the supplied edges.");
}
});
while (i4--) {
if (!visited[i4])
visit(nodes[i4], i4, /* @__PURE__ */ new Set());
}
return sorted;
function visit(node, i5, predecessors) {
if (predecessors.has(node)) {
var nodeRep;
try {
nodeRep = ", node was:" + JSON.stringify(node);
} catch (e4) {
nodeRep = "";
}
throw new Error("Cyclic dependency" + nodeRep);
}
if (!nodesHash.has(node)) {
throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(node));
}
if (visited[i5])
return;
visited[i5] = true;
var outgoing = outgoingEdges.get(node) || /* @__PURE__ */ new Set();
outgoing = Array.from(outgoing);
if (i5 = outgoing.length) {
predecessors.add(node);
do {
var child = outgoing[--i5];
visit(child, nodesHash.get(child), predecessors);
} while (i5);
predecessors.delete(node);
}
sorted[--cursor] = node;
}
}
function uniqueNodes(arr) {
var res = /* @__PURE__ */ new Set();
for (var i4 = 0, len = arr.length; i4 < len; i4++) {
var edge = arr[i4];
res.add(edge[0]);
res.add(edge[1]);
}
return Array.from(res);
}
function makeOutgoingEdges(arr) {
var edges = /* @__PURE__ */ new Map();
for (var i4 = 0, len = arr.length; i4 < len; i4++) {
var edge = arr[i4];
if (!edges.has(edge[0]))
edges.set(edge[0], /* @__PURE__ */ new Set());
if (!edges.has(edge[1]))
edges.set(edge[1], /* @__PURE__ */ new Set());
edges.get(edge[0]).add(edge[1]);
}
return edges;
}
function makeNodesHash(arr) {
var res = /* @__PURE__ */ new Map();
for (var i4 = 0, len = arr.length; i4 < len; i4++) {
res.set(arr[i4], i4);
}
return res;
}
}
});
// ../../node_modules/.pnpm/qrcode-generator@1.4.4/node_modules/qrcode-generator/qrcode.js
var require_qrcode = __commonJS({
"../../node_modules/.pnpm/qrcode-generator@1.4.4/node_modules/qrcode-generator/qrcode.js"(exports, module) {
var qrcode2 = function() {
var qrcode3 = function(typeNumber, errorCorrectionLevel) {
var PAD0 = 236;
var PAD1 = 17;
var _typeNumber = typeNumber;
var _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
var _modules = null;
var _moduleCount = 0;
var _dataCache = null;
var _dataList = [];
var _this = {};
var makeImpl = function(test, maskPattern) {
_moduleCount = _typeNumber * 4 + 17;
_modules = function(moduleCount) {
var modules = new Array(moduleCount);
for (var row = 0; row < moduleCount; row += 1) {
modules[row] = new Array(moduleCount);
for (var col = 0; col < moduleCount; col += 1) {
modules[row][col] = null;
}
}
return modules;
}(_moduleCount);
setupPositionProbePattern(0, 0);
setupPositionProbePattern(_moduleCount - 7, 0);
setupPositionProbePattern(0, _moduleCount - 7);
setupPositionAdjustPattern();
setupTimingPattern();
setupTypeInfo(test, maskPattern);
if (_typeNumber >= 7) {
setupTypeNumber(test);
}
if (_dataCache == null) {
_dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
}
mapData(_dataCache, maskPattern);
};
var setupPositionProbePattern = function(row, col) {
for (var r3 = -1; r3 <= 7; r3 += 1) {
if (row + r3 <= -1 || _moduleCount <= row + r3)
continue;
for (var c4 = -1; c4 <= 7; c4 += 1) {
if (col + c4 <= -1 || _moduleCount <= col + c4)
continue;
if (0 <= r3 && r3 <= 6 && (c4 == 0 || c4 == 6) || 0 <= c4 && c4 <= 6 && (r3 == 0 || r3 == 6) || 2 <= r3 && r3 <= 4 && 2 <= c4 && c4 <= 4) {
_modules[row + r3][col + c4] = true;
} else {
_modules[row + r3][col + c4] = false;
}
}
}
};
var getBestMaskPattern = function() {
var minLostPoint = 0;
var pattern = 0;
for (var i4 = 0; i4 < 8; i4 += 1) {
makeImpl(true, i4);
var lostPoint = QRUtil.getLostPoint(_this);
if (i4 == 0 || minLostPoint > lostPoint) {
minLostPoint = lostPoint;
pattern = i4;
}
}
return pattern;
};
var setupTimingPattern = function() {
for (var r3 = 8; r3 < _moduleCount - 8; r3 += 1) {
if (_modules[r3][6] != null) {
continue;
}
_modules[r3][6] = r3 % 2 == 0;
}
for (var c4 = 8; c4 < _moduleCount - 8; c4 += 1) {
if (_modules[6][c4] != null) {
continue;
}
_modules[6][c4] = c4 % 2 == 0;
}
};
var setupPositionAdjustPattern = function() {
var pos = QRUtil.getPatternPosition(_typeNumber);
for (var i4 = 0; i4 < pos.length; i4 += 1) {
for (var j4 = 0; j4 < pos.length; j4 += 1) {
var row = pos[i4];
var col = pos[j4];
if (_modules[row][col] != null) {
continue;
}
for (var r3 = -2; r3 <= 2; r3 += 1) {
for (var c4 = -2; c4 <= 2; c4 += 1) {
if (r3 == -2 || r3 == 2 || c4 == -2 || c4 == 2 || r3 == 0 && c4 == 0) {
_modules[row + r3][col + c4] = true;
} else {
_modules[row + r3][col + c4] = false;
}
}
}
}
}
};
var setupTypeNumber = function(test) {
var bits = QRUtil.getBCHTypeNumber(_typeNumber);
for (var i4 = 0; i4 < 18; i4 += 1) {
var mod = !test && (bits >> i4 & 1) == 1;
_modules[Math.floor(i4 / 3)][i4 % 3 + _moduleCount - 8 - 3] = mod;
}
for (var i4 = 0; i4 < 18; i4 += 1) {
var mod = !test && (bits >> i4 & 1) == 1;
_modules[i4 % 3 + _moduleCount - 8 - 3][Math.floor(i4 / 3)] = mod;
}
};
var setupTypeInfo = function(test, maskPattern) {
var data = _errorCorrectionLevel << 3 | maskPattern;
var bits = QRUtil.getBCHTypeInfo(data);
for (var i4 = 0; i4 < 15; i4 += 1) {
var mod = !test && (bits >> i4 & 1) == 1;
if (i4 < 6) {
_modules[i4][8] = mod;
} else if (i4 < 8) {
_modules[i4 + 1][8] = mod;
} else {
_modules[_moduleCount - 15 + i4][8] = mod;
}
}
for (var i4 = 0; i4 < 15; i4 += 1) {
var mod = !test && (bits >> i4 & 1) == 1;
if (i4 < 8) {
_modules[8][_moduleCount - i4 - 1] = mod;
} else if (i4 < 9) {
_modules[8][15 - i4 - 1 + 1] = mod;
} else {
_modules[8][15 - i4 - 1] = mod;
}
}
_modules[_moduleCount - 8][8] = !test;
};
var mapData = function(data, maskPattern) {
var inc = -1;
var row = _moduleCount - 1;
var bitIndex = 7;
var byteIndex = 0;
var maskFunc = QRUtil.getMaskFunction(maskPattern);
for (var col = _moduleCount - 1; col > 0; col -= 2) {
if (col == 6)
col -= 1;
while (true) {
for (var c4 = 0; c4 < 2; c4 += 1) {
if (_modules[row][col - c4] == null) {
var dark = false;
if (byteIndex < data.length) {
dark = (data[byteIndex] >>> bitIndex & 1) == 1;
}
var mask = maskFunc(row, col - c4);
if (mask) {
dark = !dark;
}
_modules[row][col - c4] = dark;
bitIndex -= 1;
if (bitIndex == -1) {
byteIndex += 1;
bitIndex = 7;
}
}
}
row += inc;
if (row < 0 || _moduleCount <= row) {
row -= inc;
inc = -inc;
break;
}
}
}
};
var createBytes = function(buffer, rsBlocks) {
var offset = 0;
var maxDcCount = 0;
var maxEcCount = 0;
var dcdata = new Array(rsBlocks.length);
var ecdata = new Array(rsBlocks.length);
for (var r3 = 0; r3 < rsBlocks.length; r3 += 1) {
var dcCount = rsBlocks[r3].dataCount;
var ecCount = rsBlocks[r3].totalCount - dcCount;
maxDcCount = Math.max(maxDcCount, dcCount);
maxEcCount = Math.max(maxEcCount, ecCount);
dcdata[r3] = new Array(dcCount);
for (var i4 = 0; i4 < dcdata[r3].length; i4 += 1) {
dcdata[r3][i4] = 255 & buffer.getBuffer()[i4 + offset];
}
offset += dcCount;
var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
var rawPoly = qrPolynomial(dcdata[r3], rsPoly.getLength() - 1);
var modPoly = rawPoly.mod(rsPoly);
ecdata[r3] = new Array(rsPoly.getLength() - 1);
for (var i4 = 0; i4 < ecdata[r3].length; i4 += 1) {
var modIndex = i4 + modPoly.getLength() - ecdata[r3].length;
ecdata[r3][i4] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
}
}
var totalCodeCount = 0;
for (var i4 = 0; i4 < rsBlocks.length; i4 += 1) {
totalCodeCount += rsBlocks[i4].totalCount;
}
var data = new Array(totalCodeCount);
var index = 0;
for (var i4 = 0; i4 < maxDcCount; i4 += 1) {
for (var r3 = 0; r3 < rsBlocks.length; r3 += 1) {
if (i4 < dcdata[r3].length) {
data[index] = dcdata[r3][i4];
index += 1;
}
}
}
for (var i4 = 0; i4 < maxEcCount; i4 += 1) {
for (var r3 = 0; r3 < rsBlocks.length; r3 += 1) {
if (i4 < ecdata[r3].length) {
data[index] = ecdata[r3][i4];
index += 1;
}
}
}
return data;
};
var createData = function(typeNumber2, errorCorrectionLevel2, dataList) {
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, errorCorrectionLevel2);
var buffer = qrBitBuffer();
for (var i4 = 0; i4 < dataList.length; i4 += 1) {
var data = dataList[i4];
buffer.put(data.getMode(), 4);
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
data.write(buffer);
}
var totalDataCount = 0;
for (var i4 = 0; i4 < rsBlocks.length; i4 += 1) {
totalDataCount += rsBlocks[i4].dataCount;
}
if (buffer.getLengthInBits() > totalDataCount * 8) {
throw "code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")";
}
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
buffer.put(0, 4);
}
while (buffer.getLengthInBits() % 8 != 0) {
buffer.putBit(false);
}
while (true) {
if (buffer.getLengthInBits() >= totalDataCount * 8) {
break;
}
buffer.put(PAD0, 8);
if (buffer.getLengthInBits() >= totalDataCount * 8) {
break;
}
buffer.put(PAD1, 8);
}
return createBytes(buffer, rsBlocks);
};
_this.addData = function(data, mode) {
mode = mode || "Byte";
var newData = null;
switch (mode) {
case "Numeric":
newData = qrNumber(data);
break;
case "Alphanumeric":
newData = qrAlphaNum(data);
break;
case "Byte":
newData = qr8BitByte(data);
break;
case "Kanji":
newData = qrKanji(data);
break;
default:
throw "mode:" + mode;
}
_dataList.push(newData);
_dataCache = null;
};
_this.isDark = function(row, col) {
if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
throw row + "," + col;
}
return _modules[row][col];
};
_this.getModuleCount = function() {
return _moduleCount;
};
_this.make = function() {
if (_typeNumber < 1) {
var typeNumber2 = 1;
for (; typeNumber2 < 40; typeNumber2++) {
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, _errorCorrectionLevel);
var buffer = qrBitBuffer();
for (var i4 = 0; i4 < _dataList.length; i4++) {
var data = _dataList[i4];
buffer.put(data.getMode(), 4);
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
data.write(buffer);
}
var totalDataCount = 0;
for (var i4 = 0; i4 < rsBlocks.length; i4++) {
totalDataCount += rsBlocks[i4].dataCount;
}
if (buffer.getLengthInBits() <= totalDataCount * 8) {
break;
}
}
_typeNumber = typeNumber2;
}
makeImpl(false, getBestMaskPattern());
};
_this.createTableTag = function(cellSize, margin) {
cellSize = cellSize || 2;
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
var qrHtml = "";
qrHtml += '
';
qrHtml += "";
for (var r3 = 0; r3 < _this.getModuleCount(); r3 += 1) {
qrHtml += "";
for (var c4 = 0; c4 < _this.getModuleCount(); c4 += 1) {
qrHtml += ' | ';
}
qrHtml += "
";
}
qrHtml += "";
qrHtml += "
";
return qrHtml;
};
_this.createSvgTag = function(cellSize, margin, alt, title) {
var opts = {};
if (typeof arguments[0] == "object") {
opts = arguments[0];
cellSize = opts.cellSize;
margin = opts.margin;
alt = opts.alt;
title = opts.title;
}
cellSize = cellSize || 2;
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
alt = typeof alt === "string" ? { text: alt } : alt || {};
alt.text = alt.text || null;
alt.id = alt.text ? alt.id || "qrcode-description" : null;
title = typeof title === "string" ? { text: title } : title || {};
title.text = title.text || null;
title.id = title.text ? title.id || "qrcode-title" : null;
var size = _this.getModuleCount() * cellSize + margin * 2;
var c4, mc, r3, mr, qrSvg = "", rect;
rect = "l" + cellSize + ",0 0," + cellSize + " -" + cellSize + ",0 0,-" + cellSize + "z ";
qrSvg += '";
return qrSvg;
};
_this.createDataURL = function(cellSize, margin) {
cellSize = cellSize || 2;
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
var size = _this.getModuleCount() * cellSize + margin * 2;
var min = margin;
var max = size - margin;
return createDataURL(size, size, function(x6, y5) {
if (min <= x6 && x6 < max && min <= y5 && y5 < max) {
var c4 = Math.floor((x6 - min) / cellSize);
var r3 = Math.floor((y5 - min) / cellSize);
return _this.isDark(r3, c4) ? 0 : 1;
} else {
return 1;
}
});
};
_this.createImgTag = function(cellSize, margin, alt) {
cellSize = cellSize || 2;
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
var size = _this.getModuleCount() * cellSize + margin * 2;
var img = "";
img += "";
return img;
};
var escapeXml = function(s5) {
var escaped = "";
for (var i4 = 0; i4 < s5.length; i4 += 1) {
var c4 = s5.charAt(i4);
switch (c4) {
case "<":
escaped += "<";
break;
case ">":
escaped += ">";
break;
case "&":
escaped += "&";
break;
case '"':
escaped += """;
break;
default:
escaped += c4;
break;
}
}
return escaped;
};
var _createHalfASCII = function(margin) {
var cellSize = 1;
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
var size = _this.getModuleCount() * cellSize + margin * 2;
var min = margin;
var max = size - margin;
var y5, x6, r1, r22, p4;
var blocks = {
"\u2588\u2588": "\u2588",
"\u2588 ": "\u2580",
" \u2588": "\u2584",
" ": " "
};
var blocksLastLineNoMargin = {
"\u2588\u2588": "\u2580",
"\u2588 ": "\u2580",
" \u2588": " ",
" ": " "
};
var ascii = "";
for (y5 = 0; y5 < size; y5 += 2) {
r1 = Math.floor((y5 - min) / cellSize);
r22 = Math.floor((y5 + 1 - min) / cellSize);
for (x6 = 0; x6 < size; x6 += 1) {
p4 = "\u2588";
if (min <= x6 && x6 < max && min <= y5 && y5 < max && _this.isDark(r1, Math.floor((x6 - min) / cellSize))) {
p4 = " ";
}
if (min <= x6 && x6 < max && min <= y5 + 1 && y5 + 1 < max && _this.isDark(r22, Math.floor((x6 - min) / cellSize))) {
p4 += " ";
} else {
p4 += "\u2588";
}
ascii += margin < 1 && y5 + 1 >= max ? blocksLastLineNoMargin[p4] : blocks[p4];
}
ascii += "\n";
}
if (size % 2 && margin > 0) {
return ascii.substring(0, ascii.length - size - 1) + Array(size + 1).join("\u2580");
}
return ascii.substring(0, ascii.length - 1);
};
_this.createASCII = function(cellSize, margin) {
cellSize = cellSize || 1;
if (cellSize < 2) {
return _createHalfASCII(margin);
}
cellSize -= 1;
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
var size = _this.getModuleCount() * cellSize + margin * 2;
var min = margin;
var max = size - margin;
var y5, x6, r3, p4;
var white = Array(cellSize + 1).join("\u2588\u2588");
var black = Array(cellSize + 1).join(" ");
var ascii = "";
var line = "";
for (y5 = 0; y5 < size; y5 += 1) {
r3 = Math.floor((y5 - min) / cellSize);
line = "";
for (x6 = 0; x6 < size; x6 += 1) {
p4 = 1;
if (min <= x6 && x6 < max && min <= y5 && y5 < max && _this.isDark(r3, Math.floor((x6 - min) / cellSize))) {
p4 = 0;
}
line += p4 ? white : black;
}
for (r3 = 0; r3 < cellSize; r3 += 1) {
ascii += line + "\n";
}
}
return ascii.substring(0, ascii.length - 1);
};
_this.renderTo2dContext = function(context, cellSize) {
cellSize = cellSize || 2;
var length = _this.getModuleCount();
for (var row = 0; row < length; row++) {
for (var col = 0; col < length; col++) {
context.fillStyle = _this.isDark(row, col) ? "black" : "white";
context.fillRect(row * cellSize, col * cellSize, cellSize, cellSize);
}
}
};
return _this;
};
qrcode3.stringToBytesFuncs = {
"default": function(s5) {
var bytes = [];
for (var i4 = 0; i4 < s5.length; i4 += 1) {
var c4 = s5.charCodeAt(i4);
bytes.push(c4 & 255);
}
return bytes;
}
};
qrcode3.stringToBytes = qrcode3.stringToBytesFuncs["default"];
qrcode3.createStringToBytes = function(unicodeData, numChars) {
var unicodeMap = function() {
var bin = base64DecodeInputStream(unicodeData);
var read = function() {
var b4 = bin.read();
if (b4 == -1)
throw "eof";
return b4;
};
var count = 0;
var unicodeMap2 = {};
while (true) {
var b0 = bin.read();
if (b0 == -1)
break;
var b1 = read();
var b22 = read();
var b32 = read();
var k5 = String.fromCharCode(b0 << 8 | b1);
var v3 = b22 << 8 | b32;
unicodeMap2[k5] = v3;
count += 1;
}
if (count != numChars) {
throw count + " != " + numChars;
}
return unicodeMap2;
}();
var unknownChar = "?".charCodeAt(0);
return function(s5) {
var bytes = [];
for (var i4 = 0; i4 < s5.length; i4 += 1) {
var c4 = s5.charCodeAt(i4);
if (c4 < 128) {
bytes.push(c4);
} else {
var b4 = unicodeMap[s5.charAt(i4)];
if (typeof b4 == "number") {
if ((b4 & 255) == b4) {
bytes.push(b4);
} else {
bytes.push(b4 >>> 8);
bytes.push(b4 & 255);
}
} else {
bytes.push(unknownChar);
}
}
}
return bytes;
};
};
var QRMode = {
MODE_NUMBER: 1 << 0,
MODE_ALPHA_NUM: 1 << 1,
MODE_8BIT_BYTE: 1 << 2,
MODE_KANJI: 1 << 3
};
var QRErrorCorrectionLevel = {
L: 1,
M: 0,
Q: 3,
H: 2
};
var QRMaskPattern = {
PATTERN000: 0,
PATTERN001: 1,
PATTERN010: 2,
PATTERN011: 3,
PATTERN100: 4,
PATTERN101: 5,
PATTERN110: 6,
PATTERN111: 7
};
var QRUtil = function() {
var PATTERN_POSITION_TABLE = [
[],
[6, 18],
[6, 22],
[6, 26],
[6, 30],
[6, 34],
[6, 22, 38],
[6, 24, 42],
[6, 26, 46],
[6, 28, 50],
[6, 30, 54],
[6, 32, 58],
[6, 34, 62],
[6, 26, 46, 66],
[6, 26, 48, 70],
[6, 26, 50, 74],
[6, 30, 54, 78],
[6, 30, 56, 82],
[6, 30, 58, 86],
[6, 34, 62, 90],
[6, 28, 50, 72, 94],
[6, 26, 50, 74, 98],
[6, 30, 54, 78, 102],
[6, 28, 54, 80, 106],
[6, 32, 58, 84, 110],
[6, 30, 58, 86, 114],
[6, 34, 62, 90, 118],
[6, 26, 50, 74, 98, 122],
[6, 30, 54, 78, 102, 126],
[6, 26, 52, 78, 104, 130],
[6, 30, 56, 82, 108, 134],
[6, 34, 60, 86, 112, 138],
[6, 30, 58, 86, 114, 142],
[6, 34, 62, 90, 118, 146],
[6, 30, 54, 78, 102, 126, 150],
[6, 24, 50, 76, 102, 128, 154],
[6, 28, 54, 80, 106, 132, 158],
[6, 32, 58, 84, 110, 136, 162],
[6, 26, 54, 82, 110, 138, 166],
[6, 30, 58, 86, 114, 142, 170]
];
var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
var _this = {};
var getBCHDigit = function(data) {
var digit = 0;
while (data != 0) {
digit += 1;
data >>>= 1;
}
return digit;
};
_this.getBCHTypeInfo = function(data) {
var d5 = data << 10;
while (getBCHDigit(d5) - getBCHDigit(G15) >= 0) {
d5 ^= G15 << getBCHDigit(d5) - getBCHDigit(G15);
}
return (data << 10 | d5) ^ G15_MASK;
};
_this.getBCHTypeNumber = function(data) {
var d5 = data << 12;
while (getBCHDigit(d5) - getBCHDigit(G18) >= 0) {
d5 ^= G18 << getBCHDigit(d5) - getBCHDigit(G18);
}
return data << 12 | d5;
};
_this.getPatternPosition = function(typeNumber) {
return PATTERN_POSITION_TABLE[typeNumber - 1];
};
_this.getMaskFunction = function(maskPattern) {
switch (maskPattern) {
case QRMaskPattern.PATTERN000:
return function(i4, j4) {
return (i4 + j4) % 2 == 0;
};
case QRMaskPattern.PATTERN001:
return function(i4, j4) {
return i4 % 2 == 0;
};
case QRMaskPattern.PATTERN010:
return function(i4, j4) {
return j4 % 3 == 0;
};
case QRMaskPattern.PATTERN011:
return function(i4, j4) {
return (i4 + j4) % 3 == 0;
};
case QRMaskPattern.PATTERN100:
return function(i4, j4) {
return (Math.floor(i4 / 2) + Math.floor(j4 / 3)) % 2 == 0;
};
case QRMaskPattern.PATTERN101:
return function(i4, j4) {
return i4 * j4 % 2 + i4 * j4 % 3 == 0;
};
case QRMaskPattern.PATTERN110:
return function(i4, j4) {
return (i4 * j4 % 2 + i4 * j4 % 3) % 2 == 0;
};
case QRMaskPattern.PATTERN111:
return function(i4, j4) {
return (i4 * j4 % 3 + (i4 + j4) % 2) % 2 == 0;
};
default:
throw "bad maskPattern:" + maskPattern;
}
};
_this.getErrorCorrectPolynomial = function(errorCorrectLength) {
var a5 = qrPolynomial([1], 0);
for (var i4 = 0; i4 < errorCorrectLength; i4 += 1) {
a5 = a5.multiply(qrPolynomial([1, QRMath.gexp(i4)], 0));
}
return a5;
};
_this.getLengthInBits = function(mode, type) {
if (1 <= type && type < 10) {
switch (mode) {
case QRMode.MODE_NUMBER:
return 10;
case QRMode.MODE_ALPHA_NUM:
return 9;
case QRMode.MODE_8BIT_BYTE:
return 8;
case QRMode.MODE_KANJI:
return 8;
default:
throw "mode:" + mode;
}
} else if (type < 27) {
switch (mode) {
case QRMode.MODE_NUMBER:
return 12;
case QRMode.MODE_ALPHA_NUM:
return 11;
case QRMode.MODE_8BIT_BYTE:
return 16;
case QRMode.MODE_KANJI:
return 10;
default:
throw "mode:" + mode;
}
} else if (type < 41) {
switch (mode) {
case QRMode.MODE_NUMBER:
return 14;
case QRMode.MODE_ALPHA_NUM:
return 13;
case QRMode.MODE_8BIT_BYTE:
return 16;
case QRMode.MODE_KANJI:
return 12;
default:
throw "mode:" + mode;
}
} else {
throw "type:" + type;
}
};
_this.getLostPoint = function(qrcode4) {
var moduleCount = qrcode4.getModuleCount();
var lostPoint = 0;
for (var row = 0; row < moduleCount; row += 1) {
for (var col = 0; col < moduleCount; col += 1) {
var sameCount = 0;
var dark = qrcode4.isDark(row, col);
for (var r3 = -1; r3 <= 1; r3 += 1) {
if (row + r3 < 0 || moduleCount <= row + r3) {
continue;
}
for (var c4 = -1; c4 <= 1; c4 += 1) {
if (col + c4 < 0 || moduleCount <= col + c4) {
continue;
}
if (r3 == 0 && c4 == 0) {
continue;
}
if (dark == qrcode4.isDark(row + r3, col + c4)) {
sameCount += 1;
}
}
}
if (sameCount > 5) {
lostPoint += 3 + sameCount - 5;
}
}
}
;
for (var row = 0; row < moduleCount - 1; row += 1) {
for (var col = 0; col < moduleCount - 1; col += 1) {
var count = 0;
if (qrcode4.isDark(row, col))
count += 1;
if (qrcode4.isDark(row + 1, col))
count += 1;
if (qrcode4.isDark(row, col + 1))
count += 1;
if (qrcode4.isDark(row + 1, col + 1))
count += 1;
if (count == 0 || count == 4) {
lostPoint += 3;
}
}
}
for (var row = 0; row < moduleCount; row += 1) {
for (var col = 0; col < moduleCount - 6; col += 1) {
if (qrcode4.isDark(row, col) && !qrcode4.isDark(row, col + 1) && qrcode4.isDark(row, col + 2) && qrcode4.isDark(row, col + 3) && qrcode4.isDark(row, col + 4) && !qrcode4.isDark(row, col + 5) && qrcode4.isDark(row, col + 6)) {
lostPoint += 40;
}
}
}
for (var col = 0; col < moduleCount; col += 1) {
for (var row = 0; row < moduleCount - 6; row += 1) {
if (qrcode4.isDark(row, col) && !qrcode4.isDark(row + 1, col) && qrcode4.isDark(row + 2, col) && qrcode4.isDark(row + 3, col) && qrcode4.isDark(row + 4, col) && !qrcode4.isDark(row + 5, col) && qrcode4.isDark(row + 6, col)) {
lostPoint += 40;
}
}
}
var darkCount = 0;
for (var col = 0; col < moduleCount; col += 1) {
for (var row = 0; row < moduleCount; row += 1) {
if (qrcode4.isDark(row, col)) {
darkCount += 1;
}
}
}
var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
lostPoint += ratio * 10;
return lostPoint;
};
return _this;
}();
var QRMath = function() {
var EXP_TABLE = new Array(256);
var LOG_TABLE = new Array(256);
for (var i4 = 0; i4 < 8; i4 += 1) {
EXP_TABLE[i4] = 1 << i4;
}
for (var i4 = 8; i4 < 256; i4 += 1) {
EXP_TABLE[i4] = EXP_TABLE[i4 - 4] ^ EXP_TABLE[i4 - 5] ^ EXP_TABLE[i4 - 6] ^ EXP_TABLE[i4 - 8];
}
for (var i4 = 0; i4 < 255; i4 += 1) {
LOG_TABLE[EXP_TABLE[i4]] = i4;
}
var _this = {};
_this.glog = function(n2) {
if (n2 < 1) {
throw "glog(" + n2 + ")";
}
return LOG_TABLE[n2];
};
_this.gexp = function(n2) {
while (n2 < 0) {
n2 += 255;
}
while (n2 >= 256) {
n2 -= 255;
}
return EXP_TABLE[n2];
};
return _this;
}();
function qrPolynomial(num, shift) {
if (typeof num.length == "undefined") {
throw num.length + "/" + shift;
}
var _num = function() {
var offset = 0;
while (offset < num.length && num[offset] == 0) {
offset += 1;
}
var _num2 = new Array(num.length - offset + shift);
for (var i4 = 0; i4 < num.length - offset; i4 += 1) {
_num2[i4] = num[i4 + offset];
}
return _num2;
}();
var _this = {};
_this.getAt = function(index) {
return _num[index];
};
_this.getLength = function() {
return _num.length;
};
_this.multiply = function(e4) {
var num2 = new Array(_this.getLength() + e4.getLength() - 1);
for (var i4 = 0; i4 < _this.getLength(); i4 += 1) {
for (var j4 = 0; j4 < e4.getLength(); j4 += 1) {
num2[i4 + j4] ^= QRMath.gexp(QRMath.glog(_this.getAt(i4)) + QRMath.glog(e4.getAt(j4)));
}
}
return qrPolynomial(num2, 0);
};
_this.mod = function(e4) {
if (_this.getLength() - e4.getLength() < 0) {
return _this;
}
var ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e4.getAt(0));
var num2 = new Array(_this.getLength());
for (var i4 = 0; i4 < _this.getLength(); i4 += 1) {
num2[i4] = _this.getAt(i4);
}
for (var i4 = 0; i4 < e4.getLength(); i4 += 1) {
num2[i4] ^= QRMath.gexp(QRMath.glog(e4.getAt(i4)) + ratio);
}
return qrPolynomial(num2, 0).mod(e4);
};
return _this;
}
;
var QRRSBlock = function() {
var RS_BLOCK_TABLE = [
// L
// M
// Q
// H
// 1
[1, 26, 19],
[1, 26, 16],
[1, 26, 13],
[1, 26, 9],
// 2
[1, 44, 34],
[1, 44, 28],
[1, 44, 22],
[1, 44, 16],
// 3
[1, 70, 55],
[1, 70, 44],
[2, 35, 17],
[2, 35, 13],
// 4
[1, 100, 80],
[2, 50, 32],
[2, 50, 24],
[4, 25, 9],
// 5
[1, 134, 108],
[2, 67, 43],
[2, 33, 15, 2, 34, 16],
[2, 33, 11, 2, 34, 12],
// 6
[2, 86, 68],
[4, 43, 27],
[4, 43, 19],
[4, 43, 15],
// 7
[2, 98, 78],
[4, 49, 31],
[2, 32, 14, 4, 33, 15],
[4, 39, 13, 1, 40, 14],
// 8
[2, 121, 97],
[2, 60, 38, 2, 61, 39],
[4, 40, 18, 2, 41, 19],
[4, 40, 14, 2, 41, 15],
// 9
[2, 146, 116],
[3, 58, 36, 2, 59, 37],
[4, 36, 16, 4, 37, 17],
[4, 36, 12, 4, 37, 13],
// 10
[2, 86, 68, 2, 87, 69],
[4, 69, 43, 1, 70, 44],
[6, 43, 19, 2, 44, 20],
[6, 43, 15, 2, 44, 16],
// 11
[4, 101, 81],
[1, 80, 50, 4, 81, 51],
[4, 50, 22, 4, 51, 23],
[3, 36, 12, 8, 37, 13],
// 12
[2, 116, 92, 2, 117, 93],
[6, 58, 36, 2, 59, 37],
[4, 46, 20, 6, 47, 21],
[7, 42, 14, 4, 43, 15],
// 13
[4, 133, 107],
[8, 59, 37, 1, 60, 38],
[8, 44, 20, 4, 45, 21],
[12, 33, 11, 4, 34, 12],
// 14
[3, 145, 115, 1, 146, 116],
[4, 64, 40, 5, 65, 41],
[11, 36, 16, 5, 37, 17],
[11, 36, 12, 5, 37, 13],
// 15
[5, 109, 87, 1, 110, 88],
[5, 65, 41, 5, 66, 42],
[5, 54, 24, 7, 55, 25],
[11, 36, 12, 7, 37, 13],
// 16
[5, 122, 98, 1, 123, 99],
[7, 73, 45, 3, 74, 46],
[15, 43, 19, 2, 44, 20],
[3, 45, 15, 13, 46, 16],
// 17
[1, 135, 107, 5, 136, 108],
[10, 74, 46, 1, 75, 47],
[1, 50, 22, 15, 51, 23],
[2, 42, 14, 17, 43, 15],
// 18
[5, 150, 120, 1, 151, 121],
[9, 69, 43, 4, 70, 44],
[17, 50, 22, 1, 51, 23],
[2, 42, 14, 19, 43, 15],
// 19
[3, 141, 113, 4, 142, 114],
[3, 70, 44, 11, 71, 45],
[17, 47, 21, 4, 48, 22],
[9, 39, 13, 16, 40, 14],
// 20
[3, 135, 107, 5, 136, 108],
[3, 67, 41, 13, 68, 42],
[15, 54, 24, 5, 55, 25],
[15, 43, 15, 10, 44, 16],
// 21
[4, 144, 116, 4, 145, 117],
[17, 68, 42],
[17, 50, 22, 6, 51, 23],
[19, 46, 16, 6, 47, 17],
// 22
[2, 139, 111, 7, 140, 112],
[17, 74, 46],
[7, 54, 24, 16, 55, 25],
[34, 37, 13],
// 23
[4, 151, 121, 5, 152, 122],
[4, 75, 47, 14, 76, 48],
[11, 54, 24, 14, 55, 25],
[16, 45, 15, 14, 46, 16],
// 24
[6, 147, 117, 4, 148, 118],
[6, 73, 45, 14, 74, 46],
[11, 54, 24, 16, 55, 25],
[30, 46, 16, 2, 47, 17],
// 25
[8, 132, 106, 4, 133, 107],
[8, 75, 47, 13, 76, 48],
[7, 54, 24, 22, 55, 25],
[22, 45, 15, 13, 46, 16],
// 26
[10, 142, 114, 2, 143, 115],
[19, 74, 46, 4, 75, 47],
[28, 50, 22, 6, 51, 23],
[33, 46, 16, 4, 47, 17],
// 27
[8, 152, 122, 4, 153, 123],
[22, 73, 45, 3, 74, 46],
[8, 53, 23, 26, 54, 24],
[12, 45, 15, 28, 46, 16],
// 28
[3, 147, 117, 10, 148, 118],
[3, 73, 45, 23, 74, 46],
[4, 54, 24, 31, 55, 25],
[11, 45, 15, 31, 46, 16],
// 29
[7, 146, 116, 7, 147, 117],
[21, 73, 45, 7, 74, 46],
[1, 53, 23, 37, 54, 24],
[19, 45, 15, 26, 46, 16],
// 30
[5, 145, 115, 10, 146, 116],
[19, 75, 47, 10, 76, 48],
[15, 54, 24, 25, 55, 25],
[23, 45, 15, 25, 46, 16],
// 31
[13, 145, 115, 3, 146, 116],
[2, 74, 46, 29, 75, 47],
[42, 54, 24, 1, 55, 25],
[23, 45, 15, 28, 46, 16],
// 32
[17, 145, 115],
[10, 74, 46, 23, 75, 47],
[10, 54, 24, 35, 55, 25],
[19, 45, 15, 35, 46, 16],
// 33
[17, 145, 115, 1, 146, 116],
[14, 74, 46, 21, 75, 47],
[29, 54, 24, 19, 55, 25],
[11, 45, 15, 46, 46, 16],
// 34
[13, 145, 115, 6, 146, 116],
[14, 74, 46, 23, 75, 47],
[44, 54, 24, 7, 55, 25],
[59, 46, 16, 1, 47, 17],
// 35
[12, 151, 121, 7, 152, 122],
[12, 75, 47, 26, 76, 48],
[39, 54, 24, 14, 55, 25],
[22, 45, 15, 41, 46, 16],
// 36
[6, 151, 121, 14, 152, 122],
[6, 75, 47, 34, 76, 48],
[46, 54, 24, 10, 55, 25],
[2, 45, 15, 64, 46, 16],
// 37
[17, 152, 122, 4, 153, 123],
[29, 74, 46, 14, 75, 47],
[49, 54, 24, 10, 55, 25],
[24, 45, 15, 46, 46, 16],
// 38
[4, 152, 122, 18, 153, 123],
[13, 74, 46, 32, 75, 47],
[48, 54, 24, 14, 55, 25],
[42, 45, 15, 32, 46, 16],
// 39
[20, 147, 117, 4, 148, 118],
[40, 75, 47, 7, 76, 48],
[43, 54, 24, 22, 55, 25],
[10, 45, 15, 67, 46, 16],
// 40
[19, 148, 118, 6, 149, 119],
[18, 75, 47, 31, 76, 48],
[34, 54, 24, 34, 55, 25],
[20, 45, 15, 61, 46, 16]
];
var qrRSBlock = function(totalCount, dataCount) {
var _this2 = {};
_this2.totalCount = totalCount;
_this2.dataCount = dataCount;
return _this2;
};
var _this = {};
var getRsBlockTable = function(typeNumber, errorCorrectionLevel) {
switch (errorCorrectionLevel) {
case QRErrorCorrectionLevel.L:
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
case QRErrorCorrectionLevel.M:
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
case QRErrorCorrectionLevel.Q:
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
case QRErrorCorrectionLevel.H:
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
default:
return void 0;
}
};
_this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {
var rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);
if (typeof rsBlock == "undefined") {
throw "bad rs block @ typeNumber:" + typeNumber + "/errorCorrectionLevel:" + errorCorrectionLevel;
}
var length = rsBlock.length / 3;
var list = [];
for (var i4 = 0; i4 < length; i4 += 1) {
var count = rsBlock[i4 * 3 + 0];
var totalCount = rsBlock[i4 * 3 + 1];
var dataCount = rsBlock[i4 * 3 + 2];
for (var j4 = 0; j4 < count; j4 += 1) {
list.push(qrRSBlock(totalCount, dataCount));
}
}
return list;
};
return _this;
}();
var qrBitBuffer = function() {
var _buffer = [];
var _length = 0;
var _this = {};
_this.getBuffer = function() {
return _buffer;
};
_this.getAt = function(index) {
var bufIndex = Math.floor(index / 8);
return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
};
_this.put = function(num, length) {
for (var i4 = 0; i4 < length; i4 += 1) {
_this.putBit((num >>> length - i4 - 1 & 1) == 1);
}
};
_this.getLengthInBits = function() {
return _length;
};
_this.putBit = function(bit) {
var bufIndex = Math.floor(_length / 8);
if (_buffer.length <= bufIndex) {
_buffer.push(0);
}
if (bit) {
_buffer[bufIndex] |= 128 >>> _length % 8;
}
_length += 1;
};
return _this;
};
var qrNumber = function(data) {
var _mode = QRMode.MODE_NUMBER;
var _data = data;
var _this = {};
_this.getMode = function() {
return _mode;
};
_this.getLength = function(buffer) {
return _data.length;
};
_this.write = function(buffer) {
var data2 = _data;
var i4 = 0;
while (i4 + 2 < data2.length) {
buffer.put(strToNum(data2.substring(i4, i4 + 3)), 10);
i4 += 3;
}
if (i4 < data2.length) {
if (data2.length - i4 == 1) {
buffer.put(strToNum(data2.substring(i4, i4 + 1)), 4);
} else if (data2.length - i4 == 2) {
buffer.put(strToNum(data2.substring(i4, i4 + 2)), 7);
}
}
};
var strToNum = function(s5) {
var num = 0;
for (var i4 = 0; i4 < s5.length; i4 += 1) {
num = num * 10 + chatToNum(s5.charAt(i4));
}
return num;
};
var chatToNum = function(c4) {
if ("0" <= c4 && c4 <= "9") {
return c4.charCodeAt(0) - "0".charCodeAt(0);
}
throw "illegal char :" + c4;
};
return _this;
};
var qrAlphaNum = function(data) {
var _mode = QRMode.MODE_ALPHA_NUM;
var _data = data;
var _this = {};
_this.getMode = function() {
return _mode;
};
_this.getLength = function(buffer) {
return _data.length;
};
_this.write = function(buffer) {
var s5 = _data;
var i4 = 0;
while (i4 + 1 < s5.length) {
buffer.put(
getCode(s5.charAt(i4)) * 45 + getCode(s5.charAt(i4 + 1)),
11
);
i4 += 2;
}
if (i4 < s5.length) {
buffer.put(getCode(s5.charAt(i4)), 6);
}
};
var getCode = function(c4) {
if ("0" <= c4 && c4 <= "9") {
return c4.charCodeAt(0) - "0".charCodeAt(0);
} else if ("A" <= c4 && c4 <= "Z") {
return c4.charCodeAt(0) - "A".charCodeAt(0) + 10;
} else {
switch (c4) {
case " ":
return 36;
case "$":
return 37;
case "%":
return 38;
case "*":
return 39;
case "+":
return 40;
case "-":
return 41;
case ".":
return 42;
case "/":
return 43;
case ":":
return 44;
default:
throw "illegal char :" + c4;
}
}
};
return _this;
};
var qr8BitByte = function(data) {
var _mode = QRMode.MODE_8BIT_BYTE;
var _data = data;
var _bytes = qrcode3.stringToBytes(data);
var _this = {};
_this.getMode = function() {
return _mode;
};
_this.getLength = function(buffer) {
return _bytes.length;
};
_this.write = function(buffer) {
for (var i4 = 0; i4 < _bytes.length; i4 += 1) {
buffer.put(_bytes[i4], 8);
}
};
return _this;
};
var qrKanji = function(data) {
var _mode = QRMode.MODE_KANJI;
var _data = data;
var stringToBytes2 = qrcode3.stringToBytesFuncs["SJIS"];
if (!stringToBytes2) {
throw "sjis not supported.";
}
!function(c4, code) {
var test = stringToBytes2(c4);
if (test.length != 2 || (test[0] << 8 | test[1]) != code) {
throw "sjis not supported.";
}
}("\u53CB", 38726);
var _bytes = stringToBytes2(data);
var _this = {};
_this.getMode = function() {
return _mode;
};
_this.getLength = function(buffer) {
return ~~(_bytes.length / 2);
};
_this.write = function(buffer) {
var data2 = _bytes;
var i4 = 0;
while (i4 + 1 < data2.length) {
var c4 = (255 & data2[i4]) << 8 | 255 & data2[i4 + 1];
if (33088 <= c4 && c4 <= 40956) {
c4 -= 33088;
} else if (57408 <= c4 && c4 <= 60351) {
c4 -= 49472;
} else {
throw "illegal char at " + (i4 + 1) + "/" + c4;
}
c4 = (c4 >>> 8 & 255) * 192 + (c4 & 255);
buffer.put(c4, 13);
i4 += 2;
}
if (i4 < data2.length) {
throw "illegal char at " + (i4 + 1);
}
};
return _this;
};
var byteArrayOutputStream = function() {
var _bytes = [];
var _this = {};
_this.writeByte = function(b4) {
_bytes.push(b4 & 255);
};
_this.writeShort = function(i4) {
_this.writeByte(i4);
_this.writeByte(i4 >>> 8);
};
_this.writeBytes = function(b4, off, len) {
off = off || 0;
len = len || b4.length;
for (var i4 = 0; i4 < len; i4 += 1) {
_this.writeByte(b4[i4 + off]);
}
};
_this.writeString = function(s5) {
for (var i4 = 0; i4 < s5.length; i4 += 1) {
_this.writeByte(s5.charCodeAt(i4));
}
};
_this.toByteArray = function() {
return _bytes;
};
_this.toString = function() {
var s5 = "";
s5 += "[";
for (var i4 = 0; i4 < _bytes.length; i4 += 1) {
if (i4 > 0) {
s5 += ",";
}
s5 += _bytes[i4];
}
s5 += "]";
return s5;
};
return _this;
};
var base64EncodeOutputStream = function() {
var _buffer = 0;
var _buflen = 0;
var _length = 0;
var _base64 = "";
var _this = {};
var writeEncoded = function(b4) {
_base64 += String.fromCharCode(encode4(b4 & 63));
};
var encode4 = function(n2) {
if (n2 < 0) {
} else if (n2 < 26) {
return 65 + n2;
} else if (n2 < 52) {
return 97 + (n2 - 26);
} else if (n2 < 62) {
return 48 + (n2 - 52);
} else if (n2 == 62) {
return 43;
} else if (n2 == 63) {
return 47;
}
throw "n:" + n2;
};
_this.writeByte = function(n2) {
_buffer = _buffer << 8 | n2 & 255;
_buflen += 8;
_length += 1;
while (_buflen >= 6) {
writeEncoded(_buffer >>> _buflen - 6);
_buflen -= 6;
}
};
_this.flush = function() {
if (_buflen > 0) {
writeEncoded(_buffer << 6 - _buflen);
_buffer = 0;
_buflen = 0;
}
if (_length % 3 != 0) {
var padlen = 3 - _length % 3;
for (var i4 = 0; i4 < padlen; i4 += 1) {
_base64 += "=";
}
}
};
_this.toString = function() {
return _base64;
};
return _this;
};
var base64DecodeInputStream = function(str) {
var _str = str;
var _pos = 0;
var _buffer = 0;
var _buflen = 0;
var _this = {};
_this.read = function() {
while (_buflen < 8) {
if (_pos >= _str.length) {
if (_buflen == 0) {
return -1;
}
throw "unexpected end of file./" + _buflen;
}
var c4 = _str.charAt(_pos);
_pos += 1;
if (c4 == "=") {
_buflen = 0;
return -1;
} else if (c4.match(/^\s$/)) {
continue;
}
_buffer = _buffer << 6 | decode4(c4.charCodeAt(0));
_buflen += 6;
}
var n2 = _buffer >>> _buflen - 8 & 255;
_buflen -= 8;
return n2;
};
var decode4 = function(c4) {
if (65 <= c4 && c4 <= 90) {
return c4 - 65;
} else if (97 <= c4 && c4 <= 122) {
return c4 - 97 + 26;
} else if (48 <= c4 && c4 <= 57) {
return c4 - 48 + 52;
} else if (c4 == 43) {
return 62;
} else if (c4 == 47) {
return 63;
} else {
throw "c:" + c4;
}
};
return _this;
};
var gifImage = function(width, height) {
var _width = width;
var _height = height;
var _data = new Array(width * height);
var _this = {};
_this.setPixel = function(x6, y5, pixel) {
_data[y5 * _width + x6] = pixel;
};
_this.write = function(out) {
out.writeString("GIF87a");
out.writeShort(_width);
out.writeShort(_height);
out.writeByte(128);
out.writeByte(0);
out.writeByte(0);
out.writeByte(0);
out.writeByte(0);
out.writeByte(0);
out.writeByte(255);
out.writeByte(255);
out.writeByte(255);
out.writeString(",");
out.writeShort(0);
out.writeShort(0);
out.writeShort(_width);
out.writeShort(_height);
out.writeByte(0);
var lzwMinCodeSize = 2;
var raster = getLZWRaster(lzwMinCodeSize);
out.writeByte(lzwMinCodeSize);
var offset = 0;
while (raster.length - offset > 255) {
out.writeByte(255);
out.writeBytes(raster, offset, 255);
offset += 255;
}
out.writeByte(raster.length - offset);
out.writeBytes(raster, offset, raster.length - offset);
out.writeByte(0);
out.writeString(";");
};
var bitOutputStream = function(out) {
var _out = out;
var _bitLength = 0;
var _bitBuffer = 0;
var _this2 = {};
_this2.write = function(data, length) {
if (data >>> length != 0) {
throw "length over";
}
while (_bitLength + length >= 8) {
_out.writeByte(255 & (data << _bitLength | _bitBuffer));
length -= 8 - _bitLength;
data >>>= 8 - _bitLength;
_bitBuffer = 0;
_bitLength = 0;
}
_bitBuffer = data << _bitLength | _bitBuffer;
_bitLength = _bitLength + length;
};
_this2.flush = function() {
if (_bitLength > 0) {
_out.writeByte(_bitBuffer);
}
};
return _this2;
};
var getLZWRaster = function(lzwMinCodeSize) {
var clearCode = 1 << lzwMinCodeSize;
var endCode = (1 << lzwMinCodeSize) + 1;
var bitLength = lzwMinCodeSize + 1;
var table2 = lzwTable();
for (var i4 = 0; i4 < clearCode; i4 += 1) {
table2.add(String.fromCharCode(i4));
}
table2.add(String.fromCharCode(clearCode));
table2.add(String.fromCharCode(endCode));
var byteOut = byteArrayOutputStream();
var bitOut = bitOutputStream(byteOut);
bitOut.write(clearCode, bitLength);
var dataIndex = 0;
var s5 = String.fromCharCode(_data[dataIndex]);
dataIndex += 1;
while (dataIndex < _data.length) {
var c4 = String.fromCharCode(_data[dataIndex]);
dataIndex += 1;
if (table2.contains(s5 + c4)) {
s5 = s5 + c4;
} else {
bitOut.write(table2.indexOf(s5), bitLength);
if (table2.size() < 4095) {
if (table2.size() == 1 << bitLength) {
bitLength += 1;
}
table2.add(s5 + c4);
}
s5 = c4;
}
}
bitOut.write(table2.indexOf(s5), bitLength);
bitOut.write(endCode, bitLength);
bitOut.flush();
return byteOut.toByteArray();
};
var lzwTable = function() {
var _map = {};
var _size = 0;
var _this2 = {};
_this2.add = function(key) {
if (_this2.contains(key)) {
throw "dup key:" + key;
}
_map[key] = _size;
_size += 1;
};
_this2.size = function() {
return _size;
};
_this2.indexOf = function(key) {
return _map[key];
};
_this2.contains = function(key) {
return typeof _map[key] != "undefined";
};
return _this2;
};
return _this;
};
var createDataURL = function(width, height, getPixel) {
var gif = gifImage(width, height);
for (var y5 = 0; y5 < height; y5 += 1) {
for (var x6 = 0; x6 < width; x6 += 1) {
gif.setPixel(x6, y5, getPixel(x6, y5));
}
}
var b4 = byteArrayOutputStream();
gif.write(b4);
var base64 = base64EncodeOutputStream();
var bytes = b4.toByteArray();
for (var i4 = 0; i4 < bytes.length; i4 += 1) {
base64.writeByte(bytes[i4]);
}
base64.flush();
return "data:image/gif;base64," + base64;
};
return qrcode3;
}();
!function() {
qrcode2.stringToBytesFuncs["UTF-8"] = function(s5) {
function toUTF8Array(str) {
var utf8 = [];
for (var i4 = 0; i4 < str.length; i4++) {
var charcode = str.charCodeAt(i4);
if (charcode < 128)
utf8.push(charcode);
else if (charcode < 2048) {
utf8.push(
192 | charcode >> 6,
128 | charcode & 63
);
} else if (charcode < 55296 || charcode >= 57344) {
utf8.push(
224 | charcode >> 12,
128 | charcode >> 6 & 63,
128 | charcode & 63
);
} else {
i4++;
charcode = 65536 + ((charcode & 1023) << 10 | str.charCodeAt(i4) & 1023);
utf8.push(
240 | charcode >> 18,
128 | charcode >> 12 & 63,
128 | charcode >> 6 & 63,
128 | charcode & 63
);
}
}
return utf8;
}
return toUTF8Array(s5);
};
}();
(function(factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports === "object") {
module.exports = factory();
}
})(function() {
return qrcode2;
});
}
});
// ../taler-util/lib/nacl-fast.js
var gf = function(init = []) {
const r3 = new Float64Array(16);
if (init)
for (let i4 = 0; i4 < init.length; i4++)
r3[i4] = init[i4];
return r3;
};
var randombytes = function(x6, n2) {
throw new Error("no PRNG");
};
var _9 = new Uint8Array(32);
_9[0] = 9;
var gf0 = gf();
var gf1 = gf([1]);
var _121665 = gf([56129, 1]);
var D = gf([
30883,
4953,
19914,
30187,
55467,
16705,
2637,
112,
59544,
30585,
16505,
36039,
65139,
11119,
27886,
20995
]);
var D2 = gf([
61785,
9906,
39828,
60374,
45398,
33411,
5274,
224,
53552,
61171,
33010,
6542,
64743,
22239,
55772,
9222
]);
var X = gf([
54554,
36645,
11616,
51542,
42930,
38181,
51040,
26924,
56412,
64982,
57905,
49316,
21502,
52590,
14035,
8553
]);
var Y = gf([
26200,
26214,
26214,
26214,
26214,
26214,
26214,
26214,
26214,
26214,
26214,
26214,
26214,
26214,
26214,
26214
]);
var I = gf([
41136,
18958,
6951,
50414,
58488,
44335,
6150,
12099,
55207,
15867,
153,
11085,
57099,
20417,
9344,
11139
]);
function ts64(x6, i4, h5, l3) {
x6[i4] = h5 >> 24 & 255;
x6[i4 + 1] = h5 >> 16 & 255;
x6[i4 + 2] = h5 >> 8 & 255;
x6[i4 + 3] = h5 & 255;
x6[i4 + 4] = l3 >> 24 & 255;
x6[i4 + 5] = l3 >> 16 & 255;
x6[i4 + 6] = l3 >> 8 & 255;
x6[i4 + 7] = l3 & 255;
}
function vn(x6, xi, y5, yi, n2) {
let i4, d5 = 0;
for (i4 = 0; i4 < n2; i4++)
d5 |= x6[xi + i4] ^ y5[yi + i4];
return (1 & d5 - 1 >>> 8) - 1;
}
function crypto_verify_32(x6, xi, y5, yi) {
return vn(x6, xi, y5, yi, 32);
}
var sigma = new Uint8Array([
101,
120,
112,
97,
110,
100,
32,
51,
50,
45,
98,
121,
116,
101,
32,
107
]);
function set25519(r3, a5) {
let i4;
for (i4 = 0; i4 < 16; i4++)
r3[i4] = a5[i4] | 0;
}
function car25519(o3) {
let i4, v3, c4 = 1;
for (i4 = 0; i4 < 16; i4++) {
v3 = o3[i4] + c4 + 65535;
c4 = Math.floor(v3 / 65536);
o3[i4] = v3 - c4 * 65536;
}
o3[0] += c4 - 1 + 37 * (c4 - 1);
}
function sel25519(p4, q5, b4) {
let t4;
const c4 = ~(b4 - 1);
for (let i4 = 0; i4 < 16; i4++) {
t4 = c4 & (p4[i4] ^ q5[i4]);
p4[i4] ^= t4;
q5[i4] ^= t4;
}
}
function pack25519(o3, n2) {
let i4, j4, b4;
const m5 = gf(), t4 = gf();
for (i4 = 0; i4 < 16; i4++)
t4[i4] = n2[i4];
car25519(t4);
car25519(t4);
car25519(t4);
for (j4 = 0; j4 < 2; j4++) {
m5[0] = t4[0] - 65517;
for (i4 = 1; i4 < 15; i4++) {
m5[i4] = t4[i4] - 65535 - (m5[i4 - 1] >> 16 & 1);
m5[i4 - 1] &= 65535;
}
m5[15] = t4[15] - 32767 - (m5[14] >> 16 & 1);
b4 = m5[15] >> 16 & 1;
m5[14] &= 65535;
sel25519(t4, m5, 1 - b4);
}
for (i4 = 0; i4 < 16; i4++) {
o3[2 * i4] = t4[i4] & 255;
o3[2 * i4 + 1] = t4[i4] >> 8;
}
}
function neq25519(a5, b4) {
const c4 = new Uint8Array(32), d5 = new Uint8Array(32);
pack25519(c4, a5);
pack25519(d5, b4);
return crypto_verify_32(c4, 0, d5, 0);
}
function par25519(a5) {
const d5 = new Uint8Array(32);
pack25519(d5, a5);
return d5[0] & 1;
}
function unpack25519(o3, n2) {
let i4;
for (i4 = 0; i4 < 16; i4++)
o3[i4] = n2[2 * i4] + (n2[2 * i4 + 1] << 8);
o3[15] &= 32767;
}
function A(o3, a5, b4) {
for (let i4 = 0; i4 < 16; i4++)
o3[i4] = a5[i4] + b4[i4];
}
function Z(o3, a5, b4) {
for (let i4 = 0; i4 < 16; i4++)
o3[i4] = a5[i4] - b4[i4];
}
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];
t0 += v3 * b0;
t1 += v3 * b1;
t22 += v3 * b22;
t32 += v3 * b32;
t4 += v3 * b42;
t5 += v3 * b5;
t6 += v3 * b6;
t7 += v3 * b7;
t8 += v3 * b8;
t9 += v3 * b9;
t10 += v3 * b10;
t11 += v3 * b11;
t12 += v3 * b12;
t13 += v3 * b13;
t14 += v3 * b14;
t15 += v3 * b15;
v3 = a5[1];
t1 += v3 * b0;
t22 += v3 * b1;
t32 += v3 * b22;
t4 += v3 * b32;
t5 += v3 * b42;
t6 += v3 * b5;
t7 += v3 * b6;
t8 += v3 * b7;
t9 += v3 * b8;
t10 += v3 * b9;
t11 += v3 * b10;
t12 += v3 * b11;
t13 += v3 * b12;
t14 += v3 * b13;
t15 += v3 * b14;
t16 += v3 * b15;
v3 = a5[2];
t22 += v3 * b0;
t32 += v3 * b1;
t4 += v3 * b22;
t5 += v3 * b32;
t6 += v3 * b42;
t7 += v3 * b5;
t8 += v3 * b6;
t9 += v3 * b7;
t10 += v3 * b8;
t11 += v3 * b9;
t12 += v3 * b10;
t13 += v3 * b11;
t14 += v3 * b12;
t15 += v3 * b13;
t16 += v3 * b14;
t17 += v3 * b15;
v3 = a5[3];
t32 += v3 * b0;
t4 += v3 * b1;
t5 += v3 * b22;
t6 += v3 * b32;
t7 += v3 * b42;
t8 += v3 * b5;
t9 += v3 * b6;
t10 += v3 * b7;
t11 += v3 * b8;
t12 += v3 * b9;
t13 += v3 * b10;
t14 += v3 * b11;
t15 += v3 * b12;
t16 += v3 * b13;
t17 += v3 * b14;
t18 += v3 * b15;
v3 = a5[4];
t4 += v3 * b0;
t5 += v3 * b1;
t6 += v3 * b22;
t7 += v3 * b32;
t8 += v3 * b42;
t9 += v3 * b5;
t10 += v3 * b6;
t11 += v3 * b7;
t12 += v3 * b8;
t13 += v3 * b9;
t14 += v3 * b10;
t15 += v3 * b11;
t16 += v3 * b12;
t17 += v3 * b13;
t18 += v3 * b14;
t19 += v3 * b15;
v3 = a5[5];
t5 += v3 * b0;
t6 += v3 * b1;
t7 += v3 * b22;
t8 += v3 * b32;
t9 += v3 * b42;
t10 += v3 * b5;
t11 += v3 * b6;
t12 += v3 * b7;
t13 += v3 * b8;
t14 += v3 * b9;
t15 += v3 * b10;
t16 += v3 * b11;
t17 += v3 * b12;
t18 += v3 * b13;
t19 += v3 * b14;
t20 += v3 * b15;
v3 = a5[6];
t6 += v3 * b0;
t7 += v3 * b1;
t8 += v3 * b22;
t9 += v3 * b32;
t10 += v3 * b42;
t11 += v3 * b5;
t12 += v3 * b6;
t13 += v3 * b7;
t14 += v3 * b8;
t15 += v3 * b9;
t16 += v3 * b10;
t17 += v3 * b11;
t18 += v3 * b12;
t19 += v3 * b13;
t20 += v3 * b14;
t21 += v3 * b15;
v3 = a5[7];
t7 += v3 * b0;
t8 += v3 * b1;
t9 += v3 * b22;
t10 += v3 * b32;
t11 += v3 * b42;
t12 += v3 * b5;
t13 += v3 * b6;
t14 += v3 * b7;
t15 += v3 * b8;
t16 += v3 * b9;
t17 += v3 * b10;
t18 += v3 * b11;
t19 += v3 * b12;
t20 += v3 * b13;
t21 += v3 * b14;
t222 += v3 * b15;
v3 = a5[8];
t8 += v3 * b0;
t9 += v3 * b1;
t10 += v3 * b22;
t11 += v3 * b32;
t12 += v3 * b42;
t13 += v3 * b5;
t14 += v3 * b6;
t15 += v3 * b7;
t16 += v3 * b8;
t17 += v3 * b9;
t18 += v3 * b10;
t19 += v3 * b11;
t20 += v3 * b12;
t21 += v3 * b13;
t222 += v3 * b14;
t23 += v3 * b15;
v3 = a5[9];
t9 += v3 * b0;
t10 += v3 * b1;
t11 += v3 * b22;
t12 += v3 * b32;
t13 += v3 * b42;
t14 += v3 * b5;
t15 += v3 * b6;
t16 += v3 * b7;
t17 += v3 * b8;
t18 += v3 * b9;
t19 += v3 * b10;
t20 += v3 * b11;
t21 += v3 * b12;
t222 += v3 * b13;
t23 += v3 * b14;
t24 += v3 * b15;
v3 = a5[10];
t10 += v3 * b0;
t11 += v3 * b1;
t12 += v3 * b22;
t13 += v3 * b32;
t14 += v3 * b42;
t15 += v3 * b5;
t16 += v3 * b6;
t17 += v3 * b7;
t18 += v3 * b8;
t19 += v3 * b9;
t20 += v3 * b10;
t21 += v3 * b11;
t222 += v3 * b12;
t23 += v3 * b13;
t24 += v3 * b14;
t25 += v3 * b15;
v3 = a5[11];
t11 += v3 * b0;
t12 += v3 * b1;
t13 += v3 * b22;
t14 += v3 * b32;
t15 += v3 * b42;
t16 += v3 * b5;
t17 += v3 * b6;
t18 += v3 * b7;
t19 += v3 * b8;
t20 += v3 * b9;
t21 += v3 * b10;
t222 += v3 * b11;
t23 += v3 * b12;
t24 += v3 * b13;
t25 += v3 * b14;
t26 += v3 * b15;
v3 = a5[12];
t12 += v3 * b0;
t13 += v3 * b1;
t14 += v3 * b22;
t15 += v3 * b32;
t16 += v3 * b42;
t17 += v3 * b5;
t18 += v3 * b6;
t19 += v3 * b7;
t20 += v3 * b8;
t21 += v3 * b9;
t222 += v3 * b10;
t23 += v3 * b11;
t24 += v3 * b12;
t25 += v3 * b13;
t26 += v3 * b14;
t27 += v3 * b15;
v3 = a5[13];
t13 += v3 * b0;
t14 += v3 * b1;
t15 += v3 * b22;
t16 += v3 * b32;
t17 += v3 * b42;
t18 += v3 * b5;
t19 += v3 * b6;
t20 += v3 * b7;
t21 += v3 * b8;
t222 += v3 * b9;
t23 += v3 * b10;
t24 += v3 * b11;
t25 += v3 * b12;
t26 += v3 * b13;
t27 += v3 * b14;
t28 += v3 * b15;
v3 = a5[14];
t14 += v3 * b0;
t15 += v3 * b1;
t16 += v3 * b22;
t17 += v3 * b32;
t18 += v3 * b42;
t19 += v3 * b5;
t20 += v3 * b6;
t21 += v3 * b7;
t222 += v3 * b8;
t23 += v3 * b9;
t24 += v3 * b10;
t25 += v3 * b11;
t26 += v3 * b12;
t27 += v3 * b13;
t28 += v3 * b14;
t29 += v3 * b15;
v3 = a5[15];
t15 += v3 * b0;
t16 += v3 * b1;
t17 += v3 * b22;
t18 += v3 * b32;
t19 += v3 * b42;
t20 += v3 * b5;
t21 += v3 * b6;
t222 += v3 * b7;
t23 += v3 * b8;
t24 += v3 * b9;
t25 += v3 * b10;
t26 += v3 * b11;
t27 += v3 * b12;
t28 += v3 * b13;
t29 += v3 * b14;
t30 += v3 * b15;
t0 += 38 * t16;
t1 += 38 * t17;
t22 += 38 * t18;
t32 += 38 * t19;
t4 += 38 * t20;
t5 += 38 * t21;
t6 += 38 * t222;
t7 += 38 * t23;
t8 += 38 * t24;
t9 += 38 * t25;
t10 += 38 * t26;
t11 += 38 * t27;
t12 += 38 * t28;
t13 += 38 * t29;
t14 += 38 * t30;
c4 = 1;
v3 = t0 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t0 = v3 - c4 * 65536;
v3 = t1 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t1 = v3 - c4 * 65536;
v3 = t22 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t22 = v3 - c4 * 65536;
v3 = t32 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t32 = v3 - c4 * 65536;
v3 = t4 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t4 = v3 - c4 * 65536;
v3 = t5 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t5 = v3 - c4 * 65536;
v3 = t6 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t6 = v3 - c4 * 65536;
v3 = t7 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t7 = v3 - c4 * 65536;
v3 = t8 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t8 = v3 - c4 * 65536;
v3 = t9 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t9 = v3 - c4 * 65536;
v3 = t10 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t10 = v3 - c4 * 65536;
v3 = t11 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t11 = v3 - c4 * 65536;
v3 = t12 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t12 = v3 - c4 * 65536;
v3 = t13 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t13 = v3 - c4 * 65536;
v3 = t14 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t14 = v3 - c4 * 65536;
v3 = t15 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t15 = v3 - c4 * 65536;
t0 += c4 - 1 + 37 * (c4 - 1);
c4 = 1;
v3 = t0 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t0 = v3 - c4 * 65536;
v3 = t1 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t1 = v3 - c4 * 65536;
v3 = t22 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t22 = v3 - c4 * 65536;
v3 = t32 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t32 = v3 - c4 * 65536;
v3 = t4 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t4 = v3 - c4 * 65536;
v3 = t5 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t5 = v3 - c4 * 65536;
v3 = t6 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t6 = v3 - c4 * 65536;
v3 = t7 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t7 = v3 - c4 * 65536;
v3 = t8 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t8 = v3 - c4 * 65536;
v3 = t9 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t9 = v3 - c4 * 65536;
v3 = t10 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t10 = v3 - c4 * 65536;
v3 = t11 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t11 = v3 - c4 * 65536;
v3 = t12 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t12 = v3 - c4 * 65536;
v3 = t13 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t13 = v3 - c4 * 65536;
v3 = t14 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t14 = v3 - c4 * 65536;
v3 = t15 + c4 + 65535;
c4 = Math.floor(v3 / 65536);
t15 = v3 - c4 * 65536;
t0 += c4 - 1 + 37 * (c4 - 1);
o3[0] = t0;
o3[1] = t1;
o3[2] = t22;
o3[3] = t32;
o3[4] = t4;
o3[5] = t5;
o3[6] = t6;
o3[7] = t7;
o3[8] = t8;
o3[9] = t9;
o3[10] = t10;
o3[11] = t11;
o3[12] = t12;
o3[13] = t13;
o3[14] = t14;
o3[15] = t15;
}
function S(o3, a5) {
M(o3, a5, a5);
}
function inv25519(o3, i4) {
const c4 = gf();
let a5;
for (a5 = 0; a5 < 16; a5++)
c4[a5] = i4[a5];
for (a5 = 253; a5 >= 0; a5--) {
S(c4, c4);
if (a5 !== 2 && a5 !== 4)
M(c4, c4, i4);
}
for (a5 = 0; a5 < 16; a5++)
o3[a5] = c4[a5];
}
function pow2523(o3, i4) {
const c4 = gf();
let a5;
for (a5 = 0; a5 < 16; a5++)
c4[a5] = i4[a5];
for (a5 = 250; a5 >= 0; a5--) {
S(c4, c4);
if (a5 !== 1)
M(c4, c4, i4);
}
for (a5 = 0; a5 < 16; a5++)
o3[a5] = c4[a5];
}
var K = [
1116352408,
3609767458,
1899447441,
602891725,
3049323471,
3964484399,
3921009573,
2173295548,
961987163,
4081628472,
1508970993,
3053834265,
2453635748,
2937671579,
2870763221,
3664609560,
3624381080,
2734883394,
310598401,
1164996542,
607225278,
1323610764,
1426881987,
3590304994,
1925078388,
4068182383,
2162078206,
991336113,
2614888103,
633803317,
3248222580,
3479774868,
3835390401,
2666613458,
4022224774,
944711139,
264347078,
2341262773,
604807628,
2007800933,
770255983,
1495990901,
1249150122,
1856431235,
1555081692,
3175218132,
1996064986,
2198950837,
2554220882,
3999719339,
2821834349,
766784016,
2952996808,
2566594879,
3210313671,
3203337956,
3336571891,
1034457026,
3584528711,
2466948901,
113926993,
3758326383,
338241895,
168717936,
666307205,
1188179964,
773529912,
1546045734,
1294757372,
1522805485,
1396182291,
2643833823,
1695183700,
2343527390,
1986661051,
1014477480,
2177026350,
1206759142,
2456956037,
344077627,
2730485921,
1290863460,
2820302411,
3158454273,
3259730800,
3505952657,
3345764771,
106217008,
3516065817,
3606008344,
3600352804,
1432725776,
4094571909,
1467031594,
275423344,
851169720,
430227734,
3100823752,
506948616,
1363258195,
659060556,
3750685593,
883997877,
3785050280,
958139571,
3318307427,
1322822218,
3812723403,
1537002063,
2003034995,
1747873779,
3602036899,
1955562222,
1575990012,
2024104815,
1125592928,
2227730452,
2716904306,
2361852424,
442776044,
2428436474,
593698344,
2756734187,
3733110249,
3204031479,
2999351573,
3329325298,
3815920427,
3391569614,
3928383900,
3515267271,
566280711,
3940187606,
3454069534,
4118630271,
4000239992,
116418474,
1914138554,
174292421,
2731055270,
289380356,
3203993006,
460393269,
320620315,
685471733,
587496836,
852142971,
1086792851,
1017036298,
365543100,
1126000580,
2618297676,
1288033470,
3409855158,
1501505948,
4234509866,
1607167915,
987167468,
1816402316,
1246189591
];
function crypto_hashblocks_hl(hh, hl, m5, n2) {
const wh = new Int32Array(16), wl = new Int32Array(16);
let bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, th, tl, i4, j4, h5, l3, a5, b4, c4, d5;
let ah0 = hh[0], ah1 = hh[1], ah2 = hh[2], ah3 = hh[3], ah4 = hh[4], ah5 = hh[5], ah6 = hh[6], ah7 = hh[7], al0 = hl[0], al1 = hl[1], al2 = hl[2], al3 = hl[3], al4 = hl[4], al5 = hl[5], al6 = hl[6], al7 = hl[7];
let pos = 0;
while (n2 >= 128) {
for (i4 = 0; i4 < 16; i4++) {
j4 = 8 * i4 + pos;
wh[i4] = m5[j4 + 0] << 24 | m5[j4 + 1] << 16 | m5[j4 + 2] << 8 | m5[j4 + 3];
wl[i4] = m5[j4 + 4] << 24 | m5[j4 + 5] << 16 | m5[j4 + 6] << 8 | m5[j4 + 7];
}
for (i4 = 0; i4 < 80; i4++) {
bh0 = ah0;
bh1 = ah1;
bh2 = ah2;
bh3 = ah3;
bh4 = ah4;
bh5 = ah5;
bh6 = ah6;
bh7 = ah7;
bl0 = al0;
bl1 = al1;
bl2 = al2;
bl3 = al3;
bl4 = al4;
bl5 = al5;
bl6 = al6;
bl7 = al7;
h5 = ah7;
l3 = al7;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = (ah4 >>> 14 | al4 << 32 - 14) ^ (ah4 >>> 18 | al4 << 32 - 18) ^ (al4 >>> 41 - 32 | ah4 << 32 - (41 - 32));
l3 = (al4 >>> 14 | ah4 << 32 - 14) ^ (al4 >>> 18 | ah4 << 32 - 18) ^ (ah4 >>> 41 - 32 | al4 << 32 - (41 - 32));
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
h5 = ah4 & ah5 ^ ~ah4 & ah6;
l3 = al4 & al5 ^ ~al4 & al6;
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
h5 = K[i4 * 2];
l3 = K[i4 * 2 + 1];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
h5 = wh[i4 % 16];
l3 = wl[i4 % 16];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
th = c4 & 65535 | d5 << 16;
tl = a5 & 65535 | b4 << 16;
h5 = th;
l3 = tl;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = (ah0 >>> 28 | al0 << 32 - 28) ^ (al0 >>> 34 - 32 | ah0 << 32 - (34 - 32)) ^ (al0 >>> 39 - 32 | ah0 << 32 - (39 - 32));
l3 = (al0 >>> 28 | ah0 << 32 - 28) ^ (ah0 >>> 34 - 32 | al0 << 32 - (34 - 32)) ^ (ah0 >>> 39 - 32 | al0 << 32 - (39 - 32));
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
h5 = ah0 & ah1 ^ ah0 & ah2 ^ ah1 & ah2;
l3 = al0 & al1 ^ al0 & al2 ^ al1 & al2;
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
bh7 = c4 & 65535 | d5 << 16;
bl7 = a5 & 65535 | b4 << 16;
h5 = bh3;
l3 = bl3;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = th;
l3 = tl;
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
bh3 = c4 & 65535 | d5 << 16;
bl3 = a5 & 65535 | b4 << 16;
ah1 = bh0;
ah2 = bh1;
ah3 = bh2;
ah4 = bh3;
ah5 = bh4;
ah6 = bh5;
ah7 = bh6;
ah0 = bh7;
al1 = bl0;
al2 = bl1;
al3 = bl2;
al4 = bl3;
al5 = bl4;
al6 = bl5;
al7 = bl6;
al0 = bl7;
if (i4 % 16 === 15) {
for (j4 = 0; j4 < 16; j4++) {
h5 = wh[j4];
l3 = wl[j4];
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = wh[(j4 + 9) % 16];
l3 = wl[(j4 + 9) % 16];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
th = wh[(j4 + 1) % 16];
tl = wl[(j4 + 1) % 16];
h5 = (th >>> 1 | tl << 32 - 1) ^ (th >>> 8 | tl << 32 - 8) ^ th >>> 7;
l3 = (tl >>> 1 | th << 32 - 1) ^ (tl >>> 8 | th << 32 - 8) ^ (tl >>> 7 | th << 32 - 7);
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
th = wh[(j4 + 14) % 16];
tl = wl[(j4 + 14) % 16];
h5 = (th >>> 19 | tl << 32 - 19) ^ (tl >>> 61 - 32 | th << 32 - (61 - 32)) ^ th >>> 6;
l3 = (tl >>> 19 | th << 32 - 19) ^ (th >>> 61 - 32 | tl << 32 - (61 - 32)) ^ (tl >>> 6 | th << 32 - 6);
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
wh[j4] = c4 & 65535 | d5 << 16;
wl[j4] = a5 & 65535 | b4 << 16;
}
}
}
h5 = ah0;
l3 = al0;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = hh[0];
l3 = hl[0];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
hh[0] = ah0 = c4 & 65535 | d5 << 16;
hl[0] = al0 = a5 & 65535 | b4 << 16;
h5 = ah1;
l3 = al1;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = hh[1];
l3 = hl[1];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
hh[1] = ah1 = c4 & 65535 | d5 << 16;
hl[1] = al1 = a5 & 65535 | b4 << 16;
h5 = ah2;
l3 = al2;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = hh[2];
l3 = hl[2];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
hh[2] = ah2 = c4 & 65535 | d5 << 16;
hl[2] = al2 = a5 & 65535 | b4 << 16;
h5 = ah3;
l3 = al3;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = hh[3];
l3 = hl[3];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
hh[3] = ah3 = c4 & 65535 | d5 << 16;
hl[3] = al3 = a5 & 65535 | b4 << 16;
h5 = ah4;
l3 = al4;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = hh[4];
l3 = hl[4];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
hh[4] = ah4 = c4 & 65535 | d5 << 16;
hl[4] = al4 = a5 & 65535 | b4 << 16;
h5 = ah5;
l3 = al5;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = hh[5];
l3 = hl[5];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
hh[5] = ah5 = c4 & 65535 | d5 << 16;
hl[5] = al5 = a5 & 65535 | b4 << 16;
h5 = ah6;
l3 = al6;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = hh[6];
l3 = hl[6];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
hh[6] = ah6 = c4 & 65535 | d5 << 16;
hl[6] = al6 = a5 & 65535 | b4 << 16;
h5 = ah7;
l3 = al7;
a5 = l3 & 65535;
b4 = l3 >>> 16;
c4 = h5 & 65535;
d5 = h5 >>> 16;
h5 = hh[7];
l3 = hl[7];
a5 += l3 & 65535;
b4 += l3 >>> 16;
c4 += h5 & 65535;
d5 += h5 >>> 16;
b4 += a5 >>> 16;
c4 += b4 >>> 16;
d5 += c4 >>> 16;
hh[7] = ah7 = c4 & 65535 | d5 << 16;
hl[7] = al7 = a5 & 65535 | b4 << 16;
pos += 128;
n2 -= 128;
}
return n2;
}
function crypto_hash(out, m5, n2) {
const hh = new Int32Array(8);
const hl = new Int32Array(8);
const x6 = new Uint8Array(256);
const b4 = n2;
hh[0] = 1779033703;
hh[1] = 3144134277;
hh[2] = 1013904242;
hh[3] = 2773480762;
hh[4] = 1359893119;
hh[5] = 2600822924;
hh[6] = 528734635;
hh[7] = 1541459225;
hl[0] = 4089235720;
hl[1] = 2227873595;
hl[2] = 4271175723;
hl[3] = 1595750129;
hl[4] = 2917565137;
hl[5] = 725511199;
hl[6] = 4215389547;
hl[7] = 327033209;
crypto_hashblocks_hl(hh, hl, m5, n2);
n2 %= 128;
for (let i4 = 0; i4 < n2; i4++)
x6[i4] = m5[b4 - n2 + i4];
x6[n2] = 128;
n2 = 256 - 128 * (n2 < 112 ? 1 : 0);
x6[n2 - 9] = 0;
ts64(x6, n2 - 8, b4 / 536870912 | 0, b4 << 3);
crypto_hashblocks_hl(hh, hl, x6, n2);
for (let i4 = 0; i4 < 8; i4++)
ts64(out, 8 * i4, hh[i4], hl[i4]);
return 0;
}
var HashState = class {
constructor() {
this.hh = new Int32Array(8);
this.hl = new Int32Array(8);
this.next = new Uint8Array(128);
this.p = 0;
this.total = 0;
this.hh[0] = 1779033703;
this.hh[1] = 3144134277;
this.hh[2] = 1013904242;
this.hh[3] = 2773480762;
this.hh[4] = 1359893119;
this.hh[5] = 2600822924;
this.hh[6] = 528734635;
this.hh[7] = 1541459225;
this.hl[0] = 4089235720;
this.hl[1] = 2227873595;
this.hl[2] = 4271175723;
this.hl[3] = 1595750129;
this.hl[4] = 2917565137;
this.hl[5] = 725511199;
this.hl[6] = 4215389547;
this.hl[7] = 327033209;
}
update(data) {
this.total += data.length;
let i4 = 0;
while (i4 < data.length) {
const r3 = 128 - this.p;
if (r3 > data.length - i4) {
for (let j4 = 0; i4 + j4 < data.length; j4++) {
this.next[this.p + j4] = data[i4 + j4];
}
this.p += data.length - i4;
break;
} else {
for (let j4 = 0; this.p + j4 < 128; j4++) {
this.next[this.p + j4] = data[i4 + j4];
}
crypto_hashblocks_hl(this.hh, this.hl, this.next, 128);
i4 += 128 - this.p;
this.p = 0;
}
}
return this;
}
finish() {
const out = new Uint8Array(64);
let n2 = this.p;
const x6 = new Uint8Array(256);
const b4 = this.total;
for (let i4 = 0; i4 < n2; i4++)
x6[i4] = this.next[i4];
x6[n2] = 128;
n2 = 256 - 128 * (n2 < 112 ? 1 : 0);
x6[n2 - 9] = 0;
ts64(x6, n2 - 8, b4 / 536870912 | 0, b4 << 3);
crypto_hashblocks_hl(this.hh, this.hl, x6, n2);
for (let i4 = 0; i4 < 8; i4++)
ts64(out, 8 * i4, this.hh[i4], this.hl[i4]);
return out;
}
};
function add(p4, q5) {
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, q5[1], q5[0]);
M(a5, a5, t4);
A(b4, p4[0], p4[1]);
A(t4, q5[0], q5[1]);
M(b4, b4, t4);
M(c4, p4[3], q5[3]);
M(c4, c4, D2);
M(d5, p4[2], q5[2]);
A(d5, d5, d5);
Z(e4, b4, a5);
Z(f3, d5, c4);
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, q5, b4) {
let i4;
for (i4 = 0; i4 < 4; i4++) {
sel25519(p4[i4], q5[i4], b4);
}
}
function pack(r3, p4) {
const tx = gf(), ty = gf(), zi = gf();
inv25519(zi, p4[2]);
M(tx, p4[0], zi);
M(ty, p4[1], zi);
pack25519(r3, ty);
r3[31] ^= par25519(tx) << 7;
}
function scalarmult(p4, q5, s5) {
let b4, i4;
set25519(p4[0], gf0);
set25519(p4[1], gf1);
set25519(p4[2], gf1);
set25519(p4[3], gf0);
for (i4 = 255; i4 >= 0; --i4) {
b4 = s5[i4 / 8 | 0] >> (i4 & 7) & 1;
cswap(p4, q5, b4);
add(q5, p4);
add(p4, p4);
cswap(p4, q5, b4);
}
}
function scalarbase(p4, s5) {
const q5 = [gf(), gf(), gf(), gf()];
set25519(q5[0], X);
set25519(q5[1], Y);
set25519(q5[2], gf1);
M(q5[3], X, Y);
scalarmult(p4, q5, s5);
}
var L = new Float64Array([
237,
211,
245,
92,
26,
99,
18,
88,
214,
156,
247,
162,
222,
249,
222,
20,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
16
]);
function modL(r3, x6) {
let carry, i4, j4, k5;
for (i4 = 63; i4 >= 32; --i4) {
carry = 0;
for (j4 = i4 - 32, k5 = i4 - 12; j4 < k5; ++j4) {
x6[j4] += carry - 16 * x6[i4] * L[j4 - (i4 - 32)];
carry = Math.floor((x6[j4] + 128) / 256);
x6[j4] -= carry * 256;
}
x6[j4] += carry;
x6[i4] = 0;
}
carry = 0;
for (j4 = 0; j4 < 32; j4++) {
x6[j4] += carry - (x6[31] >> 4) * L[j4];
carry = x6[j4] >> 8;
x6[j4] &= 255;
}
for (j4 = 0; j4 < 32; j4++)
x6[j4] -= carry * L[j4];
for (i4 = 0; i4 < 32; i4++) {
x6[i4 + 1] += x6[i4] >> 8;
r3[i4] = x6[i4] & 255;
}
}
function reduce(r3) {
const x6 = new Float64Array(64);
for (let i4 = 0; i4 < 64; i4++)
x6[i4] = r3[i4];
for (let i4 = 0; i4 < 64; i4++)
r3[i4] = 0;
modL(r3, x6);
}
function unpackpos(r3, p4) {
const q5 = [gf(), gf(), gf(), gf()];
if (unpackneg(q5, p4))
return -1;
const scalar0 = new Uint8Array(32);
const scalar1 = new Uint8Array(32);
scalar1[0] = 1;
const scalarNeg1 = crypto_core_ed25519_scalar_sub(scalar0, scalar1);
scalarmult(r3, q5, scalarNeg1);
return 0;
}
function unpackneg(r3, p4) {
const t4 = gf();
const chk = gf();
const num = gf();
const den = gf();
const den2 = gf();
const den4 = gf();
const den6 = gf();
set25519(r3[2], gf1);
unpack25519(r3[1], p4);
S(num, r3[1]);
M(den, num, D);
Z(num, num, r3[2]);
A(den, r3[2], den);
S(den2, den);
S(den4, den2);
M(den6, den4, den2);
M(t4, den6, num);
M(t4, t4, den);
pow2523(t4, t4);
M(t4, t4, num);
M(t4, t4, den);
M(t4, t4, den);
M(r3[0], t4, den);
S(chk, r3[0]);
M(chk, chk, den);
if (neq25519(chk, num))
M(r3[0], r3[0], I);
S(chk, r3[0]);
M(chk, chk, den);
if (neq25519(chk, num))
return -1;
if (par25519(r3[0]) === p4[31] >> 7)
Z(r3[0], gf0, r3[0]);
M(r3[3], r3[0], r3[1]);
return 0;
}
function crypto_scalarmult_ed25519_base_noclamp(s5) {
const r3 = new Uint8Array(32);
const p4 = [gf(), gf(), gf(), gf()];
scalarbase(p4, s5);
pack(r3, p4);
return r3;
}
function crypto_scalarmult_ed25519_noclamp(s5, q5) {
const r3 = new Uint8Array(32);
const p4 = [gf(), gf(), gf(), gf()];
const ql = [gf(), gf(), gf(), gf()];
if (unpackpos(ql, q5))
throw new Error();
scalarmult(p4, ql, s5);
pack(r3, p4);
return r3;
}
function crypto_sign_open(m5, sm, n2, pk) {
let i4, mlen;
const t4 = new Uint8Array(32), h5 = new Uint8Array(64);
const p4 = [gf(), gf(), gf(), gf()], q5 = [gf(), gf(), gf(), gf()];
mlen = -1;
if (n2 < 64)
return -1;
if (unpackneg(q5, pk))
return -1;
for (i4 = 0; i4 < n2; i4++)
m5[i4] = sm[i4];
for (i4 = 0; i4 < 32; i4++)
m5[i4 + 32] = pk[i4];
crypto_hash(h5, m5, n2);
reduce(h5);
scalarmult(p4, q5, h5);
scalarbase(q5, sm.subarray(32));
add(p4, q5);
pack(t4, p4);
n2 -= 64;
if (crypto_verify_32(sm, 0, t4, 0)) {
for (i4 = 0; i4 < n2; i4++)
m5[i4] = 0;
return -1;
}
for (i4 = 0; i4 < n2; i4++)
m5[i4] = sm[i4 + 64];
mlen = n2;
return mlen;
}
var crypto_sign_BYTES = 64;
var crypto_sign_PUBLICKEYBYTES = 32;
var crypto_hash_BYTES = 64;
function checkArrayTypes(...args) {
for (let i4 = 0; i4 < args.length; i4++) {
if (!(args[i4] instanceof Uint8Array))
throw new TypeError("unexpected type, use Uint8Array");
}
}
function randomBytes(n2) {
const b4 = new Uint8Array(n2);
randombytes(b4, n2);
return b4;
}
function hash(msg) {
checkArrayTypes(msg);
const h5 = new Uint8Array(crypto_hash_BYTES);
crypto_hash(h5, msg, msg.length);
return h5;
}
function setPRNG(fn2) {
randombytes = fn2;
}
function crypto_core_ed25519_scalar_reduce(x6) {
const len = x6.length;
const z5 = new Float64Array(64);
for (let i4 = 0; i4 < len; i4++)
z5[i4] = x6[i4];
const o3 = new Uint8Array(32);
modL(o3, z5);
return o3;
}
function crypto_core_ed25519_scalar_sub(x6, y5) {
const z5 = new Float64Array(64);
for (let i4 = 0; i4 < 32; i4++) {
z5[i4] = x6[i4] - y5[i4];
}
const o3 = new Uint8Array(32);
modL(o3, z5);
return o3;
}
function crypto_edx25519_private_key_create() {
const seed = new Uint8Array(32);
randombytes(seed, 32);
return crypto_edx25519_private_key_create_from_seed(seed);
}
function crypto_edx25519_private_key_create_from_seed(seed) {
const pk = hash(seed);
pk[0] &= 248;
pk[31] &= 127;
pk[31] |= 64;
return pk;
}
function crypto_edx25519_get_public(priv) {
return crypto_scalarmult_ed25519_base_noclamp(priv.subarray(0, 32));
}
function crypto_edx25519_sign_detached(m5, skx, pkx) {
const n2 = m5.length;
const h5 = new Uint8Array(64);
const r3 = new Uint8Array(64);
let i4, j4;
const x6 = new Float64Array(64);
const p4 = [gf(), gf(), gf(), gf()];
const sm = new Uint8Array(n2 + 64);
for (i4 = 0; i4 < n2; i4++)
sm[64 + i4] = m5[i4];
for (i4 = 0; i4 < 32; i4++)
sm[32 + i4] = skx[32 + i4];
crypto_hash(r3, sm.subarray(32), n2 + 32);
reduce(r3);
scalarbase(p4, r3);
pack(sm, p4);
for (i4 = 32; i4 < 64; i4++)
sm[i4] = pkx[i4 - 32];
crypto_hash(h5, sm, n2 + 64);
reduce(h5);
for (i4 = 0; i4 < 64; i4++)
x6[i4] = 0;
for (i4 = 0; i4 < 32; i4++)
x6[i4] = r3[i4];
for (i4 = 0; i4 < 32; i4++) {
for (j4 = 0; j4 < 32; j4++) {
x6[i4 + j4] += h5[i4] * skx[j4];
}
}
modL(sm.subarray(32), x6);
return sm.subarray(0, 64);
}
function crypto_edx25519_sign_detached_verify(msg, sig, publicKey) {
checkArrayTypes(msg, sig, publicKey);
if (sig.length !== crypto_sign_BYTES)
throw new Error("bad signature size");
if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
throw new Error("bad public key size");
const sm = new Uint8Array(crypto_sign_BYTES + msg.length);
const m5 = new Uint8Array(crypto_sign_BYTES + msg.length);
let i4;
for (i4 = 0; i4 < crypto_sign_BYTES; i4++)
sm[i4] = sig[i4];
for (i4 = 0; i4 < msg.length; i4++)
sm[i4 + crypto_sign_BYTES] = msg[i4];
return crypto_sign_open(m5, sm, sm.length, publicKey) >= 0;
}
// ../taler-util/lib/prng-browser.js
function loadBrowserPrng() {
const cr = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
const QUOTA = 65536;
setPRNG(function(x6, n2) {
let i4;
const v3 = new Uint8Array(n2);
for (i4 = 0; i4 < n2; i4 += QUOTA) {
cr.getRandomValues(v3.subarray(i4, i4 + Math.min(n2 - i4, QUOTA)));
}
for (i4 = 0; i4 < n2; i4++)
x6[i4] = v3[i4];
for (i4 = 0; i4 < v3.length; i4++)
v3[i4] = 0;
});
}
// ../taler-util/lib/taler-error-codes.js
var TalerErrorCode;
(function(TalerErrorCode2) {
TalerErrorCode2[TalerErrorCode2["NONE"] = 0] = "NONE";
TalerErrorCode2[TalerErrorCode2["INVALID"] = 1] = "INVALID";
TalerErrorCode2[TalerErrorCode2["GENERIC_CLIENT_INTERNAL_ERROR"] = 2] = "GENERIC_CLIENT_INTERNAL_ERROR";
TalerErrorCode2[TalerErrorCode2["GENERIC_INVALID_RESPONSE"] = 10] = "GENERIC_INVALID_RESPONSE";
TalerErrorCode2[TalerErrorCode2["GENERIC_TIMEOUT"] = 11] = "GENERIC_TIMEOUT";
TalerErrorCode2[TalerErrorCode2["GENERIC_VERSION_MALFORMED"] = 12] = "GENERIC_VERSION_MALFORMED";
TalerErrorCode2[TalerErrorCode2["GENERIC_REPLY_MALFORMED"] = 13] = "GENERIC_REPLY_MALFORMED";
TalerErrorCode2[TalerErrorCode2["GENERIC_CONFIGURATION_INVALID"] = 14] = "GENERIC_CONFIGURATION_INVALID";
TalerErrorCode2[TalerErrorCode2["GENERIC_UNEXPECTED_REQUEST_ERROR"] = 15] = "GENERIC_UNEXPECTED_REQUEST_ERROR";
TalerErrorCode2[TalerErrorCode2["GENERIC_METHOD_INVALID"] = 20] = "GENERIC_METHOD_INVALID";
TalerErrorCode2[TalerErrorCode2["GENERIC_ENDPOINT_UNKNOWN"] = 21] = "GENERIC_ENDPOINT_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["GENERIC_JSON_INVALID"] = 22] = "GENERIC_JSON_INVALID";
TalerErrorCode2[TalerErrorCode2["GENERIC_HTTP_HEADERS_MALFORMED"] = 23] = "GENERIC_HTTP_HEADERS_MALFORMED";
TalerErrorCode2[TalerErrorCode2["GENERIC_PAYTO_URI_MALFORMED"] = 24] = "GENERIC_PAYTO_URI_MALFORMED";
TalerErrorCode2[TalerErrorCode2["GENERIC_PARAMETER_MISSING"] = 25] = "GENERIC_PARAMETER_MISSING";
TalerErrorCode2[TalerErrorCode2["GENERIC_PARAMETER_MALFORMED"] = 26] = "GENERIC_PARAMETER_MALFORMED";
TalerErrorCode2[TalerErrorCode2["GENERIC_RESERVE_PUB_MALFORMED"] = 27] = "GENERIC_RESERVE_PUB_MALFORMED";
TalerErrorCode2[TalerErrorCode2["GENERIC_CURRENCY_MISMATCH"] = 30] = "GENERIC_CURRENCY_MISMATCH";
TalerErrorCode2[TalerErrorCode2["GENERIC_URI_TOO_LONG"] = 31] = "GENERIC_URI_TOO_LONG";
TalerErrorCode2[TalerErrorCode2["GENERIC_UPLOAD_EXCEEDS_LIMIT"] = 32] = "GENERIC_UPLOAD_EXCEEDS_LIMIT";
TalerErrorCode2[TalerErrorCode2["GENERIC_DB_SETUP_FAILED"] = 50] = "GENERIC_DB_SETUP_FAILED";
TalerErrorCode2[TalerErrorCode2["GENERIC_DB_START_FAILED"] = 51] = "GENERIC_DB_START_FAILED";
TalerErrorCode2[TalerErrorCode2["GENERIC_DB_STORE_FAILED"] = 52] = "GENERIC_DB_STORE_FAILED";
TalerErrorCode2[TalerErrorCode2["GENERIC_DB_FETCH_FAILED"] = 53] = "GENERIC_DB_FETCH_FAILED";
TalerErrorCode2[TalerErrorCode2["GENERIC_DB_COMMIT_FAILED"] = 54] = "GENERIC_DB_COMMIT_FAILED";
TalerErrorCode2[TalerErrorCode2["GENERIC_DB_SOFT_FAILURE"] = 55] = "GENERIC_DB_SOFT_FAILURE";
TalerErrorCode2[TalerErrorCode2["GENERIC_DB_INVARIANT_FAILURE"] = 56] = "GENERIC_DB_INVARIANT_FAILURE";
TalerErrorCode2[TalerErrorCode2["GENERIC_INTERNAL_INVARIANT_FAILURE"] = 60] = "GENERIC_INTERNAL_INVARIANT_FAILURE";
TalerErrorCode2[TalerErrorCode2["GENERIC_FAILED_COMPUTE_JSON_HASH"] = 61] = "GENERIC_FAILED_COMPUTE_JSON_HASH";
TalerErrorCode2[TalerErrorCode2["GENERIC_FAILED_COMPUTE_AMOUNT"] = 62] = "GENERIC_FAILED_COMPUTE_AMOUNT";
TalerErrorCode2[TalerErrorCode2["GENERIC_PARSER_OUT_OF_MEMORY"] = 70] = "GENERIC_PARSER_OUT_OF_MEMORY";
TalerErrorCode2[TalerErrorCode2["GENERIC_ALLOCATION_FAILURE"] = 71] = "GENERIC_ALLOCATION_FAILURE";
TalerErrorCode2[TalerErrorCode2["GENERIC_JSON_ALLOCATION_FAILURE"] = 72] = "GENERIC_JSON_ALLOCATION_FAILURE";
TalerErrorCode2[TalerErrorCode2["GENERIC_CURL_ALLOCATION_FAILURE"] = 73] = "GENERIC_CURL_ALLOCATION_FAILURE";
TalerErrorCode2[TalerErrorCode2["GENERIC_FAILED_TO_LOAD_TEMPLATE"] = 74] = "GENERIC_FAILED_TO_LOAD_TEMPLATE";
TalerErrorCode2[TalerErrorCode2["GENERIC_FAILED_TO_EXPAND_TEMPLATE"] = 75] = "GENERIC_FAILED_TO_EXPAND_TEMPLATE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_BAD_CONFIGURATION"] = 1e3] = "EXCHANGE_GENERIC_BAD_CONFIGURATION";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_OPERATION_UNKNOWN"] = 1001] = "EXCHANGE_GENERIC_OPERATION_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_WRONG_NUMBER_OF_SEGMENTS"] = 1002] = "EXCHANGE_GENERIC_WRONG_NUMBER_OF_SEGMENTS";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY"] = 1003] = "EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB"] = 1004] = "EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN"] = 1005] = "EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DENOMINATION_SIGNATURE_INVALID"] = 1006] = "EXCHANGE_DENOMINATION_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_KEYS_MISSING"] = 1007] = "EXCHANGE_GENERIC_KEYS_MISSING";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE"] = 1008] = "EXCHANGE_GENERIC_DENOMINATION_VALIDITY_IN_FUTURE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_DENOMINATION_EXPIRED"] = 1009] = "EXCHANGE_GENERIC_DENOMINATION_EXPIRED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_DENOMINATION_REVOKED"] = 1010] = "EXCHANGE_GENERIC_DENOMINATION_REVOKED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_SECMOD_TIMEOUT"] = 1011] = "EXCHANGE_GENERIC_SECMOD_TIMEOUT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_INSUFFICIENT_FUNDS"] = 1012] = "EXCHANGE_GENERIC_INSUFFICIENT_FUNDS";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_COIN_HISTORY_COMPUTATION_FAILED"] = 1013] = "EXCHANGE_GENERIC_COIN_HISTORY_COMPUTATION_FAILED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS"] = 1014] = "EXCHANGE_GENERIC_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_COIN_CONFLICTING_AGE_HASH"] = 1015] = "EXCHANGE_GENERIC_COIN_CONFLICTING_AGE_HASH";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_INVALID_DENOMINATION_CIPHER_FOR_OPERATION"] = 1016] = "EXCHANGE_GENERIC_INVALID_DENOMINATION_CIPHER_FOR_OPERATION";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_CIPHER_MISMATCH"] = 1017] = "EXCHANGE_GENERIC_CIPHER_MISMATCH";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE"] = 1018] = "EXCHANGE_GENERIC_NEW_DENOMS_ARRAY_SIZE_EXCESSIVE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_CLOCK_SKEW"] = 1020] = "EXCHANGE_GENERIC_CLOCK_SKEW";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_AMOUNT_EXCEEDS_DENOMINATION_VALUE"] = 1021] = "EXCHANGE_GENERIC_AMOUNT_EXCEEDS_DENOMINATION_VALUE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_GLOBAL_FEES_MISSING"] = 1022] = "EXCHANGE_GENERIC_GLOBAL_FEES_MISSING";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_WIRE_FEES_MISSING"] = 1023] = "EXCHANGE_GENERIC_WIRE_FEES_MISSING";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_PURSE_PUB_MALFORMED"] = 1024] = "EXCHANGE_GENERIC_PURSE_PUB_MALFORMED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_PURSE_UNKNOWN"] = 1025] = "EXCHANGE_GENERIC_PURSE_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_PURSE_EXPIRED"] = 1026] = "EXCHANGE_GENERIC_PURSE_EXPIRED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_RESERVE_UNKNOWN"] = 1027] = "EXCHANGE_GENERIC_RESERVE_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_KYC_REQUIRED"] = 1028] = "EXCHANGE_GENERIC_KYC_REQUIRED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_DEPOSIT_COIN_CONFLICTING_ATTEST_VS_AGE_COMMITMENT"] = 1029] = "EXCHANGE_PURSE_DEPOSIT_COIN_CONFLICTING_ATTEST_VS_AGE_COMMITMENT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_DEPOSIT_COIN_AGE_ATTESTATION_FAILURE"] = 1030] = "EXCHANGE_PURSE_DEPOSIT_COIN_AGE_ATTESTATION_FAILURE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_PURSE_DELETED"] = 1031] = "EXCHANGE_GENERIC_PURSE_DELETED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_AML_OFFICER_PUB_MALFORMED"] = 1032] = "EXCHANGE_GENERIC_AML_OFFICER_PUB_MALFORMED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_AML_OFFICER_GET_SIGNATURE_INVALID"] = 1033] = "EXCHANGE_GENERIC_AML_OFFICER_GET_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_AML_OFFICER_ACCESS_DENIED"] = 1034] = "EXCHANGE_GENERIC_AML_OFFICER_ACCESS_DENIED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_AML_PENDING"] = 1035] = "EXCHANGE_GENERIC_AML_PENDING";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GENERIC_AML_FROZEN"] = 1036] = "EXCHANGE_GENERIC_AML_FROZEN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSITS_GET_NOT_FOUND"] = 1100] = "EXCHANGE_DEPOSITS_GET_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE"] = 1101] = "EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB"] = 1102] = "EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS"] = 1103] = "EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB"] = 1104] = "EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSITS_GET_INVALID_SIGNATURE_BY_EXCHANGE"] = 1105] = "EXCHANGE_DEPOSITS_GET_INVALID_SIGNATURE_BY_EXCHANGE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID"] = 1106] = "EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSITS_POLICY_NOT_ACCEPTED"] = 1107] = "EXCHANGE_DEPOSITS_POLICY_NOT_ACCEPTED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS"] = 1150] = "EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_AGE_WITHDRAW_INSUFFICIENT_FUNDS"] = 1151] = "EXCHANGE_AGE_WITHDRAW_INSUFFICIENT_FUNDS";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_WITHDRAW_AMOUNT_FEE_OVERFLOW"] = 1152] = "EXCHANGE_WITHDRAW_AMOUNT_FEE_OVERFLOW";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_WITHDRAW_SIGNATURE_FAILED"] = 1153] = "EXCHANGE_WITHDRAW_SIGNATURE_FAILED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_WITHDRAW_RESERVE_SIGNATURE_INVALID"] = 1154] = "EXCHANGE_WITHDRAW_RESERVE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVE_HISTORY_ERROR_INSUFFICIENT_FUNDS"] = 1155] = "EXCHANGE_RESERVE_HISTORY_ERROR_INSUFFICIENT_FUNDS";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_GET_RESERVE_HISTORY_ERROR_INSUFFICIENT_BALANCE"] = 1156] = "EXCHANGE_GET_RESERVE_HISTORY_ERROR_INSUFFICIENT_BALANCE";
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";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE"] = 1207] = "EXCHANGE_DEPOSIT_NEGATIVE_VALUE_AFTER_FEE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE"] = 1208] = "EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSIT_WIRE_DEADLINE_IS_NEVER"] = 1209] = "EXCHANGE_DEPOSIT_WIRE_DEADLINE_IS_NEVER";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_JSON"] = 1210] = "EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_JSON";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT"] = 1211] = "EXCHANGE_DEPOSIT_INVALID_WIRE_FORMAT_CONTRACT_HASH_CONFLICT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE"] = 1221] = "EXCHANGE_DEPOSIT_INVALID_SIGNATURE_BY_EXCHANGE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_DEPOSIT_FEE_ABOVE_AMOUNT"] = 1222] = "EXCHANGE_DEPOSIT_FEE_ABOVE_AMOUNT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_EXTENSIONS_INVALID_FULFILLMENT"] = 1240] = "EXCHANGE_EXTENSIONS_INVALID_FULFILLMENT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_STATUS_UNKNOWN"] = 1250] = "EXCHANGE_RESERVES_STATUS_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_STATUS_BAD_SIGNATURE"] = 1251] = "EXCHANGE_RESERVES_STATUS_BAD_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_HISTORY_BAD_SIGNATURE"] = 1252] = "EXCHANGE_RESERVES_HISTORY_BAD_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MELT_FEES_EXCEED_CONTRIBUTION"] = 1302] = "EXCHANGE_MELT_FEES_EXCEED_CONTRIBUTION";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MELT_COIN_SIGNATURE_INVALID"] = 1303] = "EXCHANGE_MELT_COIN_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MELT_COIN_EXPIRED_NO_ZOMBIE"] = 1305] = "EXCHANGE_MELT_COIN_EXPIRED_NO_ZOMBIE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MELT_INVALID_SIGNATURE_BY_EXCHANGE"] = 1306] = "EXCHANGE_MELT_INVALID_SIGNATURE_BY_EXCHANGE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_COMMITMENT_VIOLATION"] = 1353] = "EXCHANGE_REFRESHES_REVEAL_COMMITMENT_VIOLATION";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_SIGNING_ERROR"] = 1354] = "EXCHANGE_REFRESHES_REVEAL_SIGNING_ERROR";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_SESSION_UNKNOWN"] = 1355] = "EXCHANGE_REFRESHES_REVEAL_SESSION_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID"] = 1356] = "EXCHANGE_REFRESHES_REVEAL_CNC_TRANSFER_ARRAY_SIZE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISMATCH"] = 1358] = "EXCHANGE_REFRESHES_REVEAL_NEW_DENOMS_ARRAY_SIZE_MISMATCH";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_COST_CALCULATION_OVERFLOW"] = 1359] = "EXCHANGE_REFRESHES_REVEAL_COST_CALCULATION_OVERFLOW";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_AMOUNT_INSUFFICIENT"] = 1360] = "EXCHANGE_REFRESHES_REVEAL_AMOUNT_INSUFFICIENT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_LINK_SIGNATURE_INVALID"] = 1361] = "EXCHANGE_REFRESHES_REVEAL_LINK_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_INVALID_RCH"] = 1362] = "EXCHANGE_REFRESHES_REVEAL_INVALID_RCH";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_OPERATION_INVALID"] = 1363] = "EXCHANGE_REFRESHES_REVEAL_OPERATION_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_NOT_SUPPORTED"] = 1364] = "EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_NOT_SUPPORTED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_COMMITMENT_INVALID"] = 1365] = "EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_COMMITMENT_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_LINK_COIN_UNKNOWN"] = 1400] = "EXCHANGE_LINK_COIN_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_TRANSFERS_GET_WTID_MALFORMED"] = 1450] = "EXCHANGE_TRANSFERS_GET_WTID_MALFORMED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_TRANSFERS_GET_WTID_NOT_FOUND"] = 1451] = "EXCHANGE_TRANSFERS_GET_WTID_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_TRANSFERS_GET_WIRE_FEE_NOT_FOUND"] = 1452] = "EXCHANGE_TRANSFERS_GET_WIRE_FEE_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_TRANSFERS_GET_WIRE_FEE_INCONSISTENT"] = 1453] = "EXCHANGE_TRANSFERS_GET_WIRE_FEE_INCONSISTENT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSES_INVALID_WAIT_TARGET"] = 1475] = "EXCHANGE_PURSES_INVALID_WAIT_TARGET";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSES_GET_INVALID_SIGNATURE_BY_EXCHANGE"] = 1476] = "EXCHANGE_PURSES_GET_INVALID_SIGNATURE_BY_EXCHANGE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_COIN_NOT_FOUND"] = 1500] = "EXCHANGE_REFUND_COIN_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT"] = 1501] = "EXCHANGE_REFUND_CONFLICT_DEPOSIT_INSUFFICIENT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_DEPOSIT_NOT_FOUND"] = 1502] = "EXCHANGE_REFUND_DEPOSIT_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_MERCHANT_ALREADY_PAID"] = 1503] = "EXCHANGE_REFUND_MERCHANT_ALREADY_PAID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_FEE_TOO_LOW"] = 1504] = "EXCHANGE_REFUND_FEE_TOO_LOW";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_FEE_ABOVE_AMOUNT"] = 1505] = "EXCHANGE_REFUND_FEE_ABOVE_AMOUNT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_MERCHANT_SIGNATURE_INVALID"] = 1506] = "EXCHANGE_REFUND_MERCHANT_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_MERCHANT_SIGNING_FAILED"] = 1507] = "EXCHANGE_REFUND_MERCHANT_SIGNING_FAILED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_INVALID_SIGNATURE_BY_EXCHANGE"] = 1508] = "EXCHANGE_REFUND_INVALID_SIGNATURE_BY_EXCHANGE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_INVALID_FAILURE_PROOF_BY_EXCHANGE"] = 1509] = "EXCHANGE_REFUND_INVALID_FAILURE_PROOF_BY_EXCHANGE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_REFUND_INCONSISTENT_AMOUNT"] = 1510] = "EXCHANGE_REFUND_INCONSISTENT_AMOUNT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_SIGNATURE_INVALID"] = 1550] = "EXCHANGE_RECOUP_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_WITHDRAW_NOT_FOUND"] = 1551] = "EXCHANGE_RECOUP_WITHDRAW_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_COIN_BALANCE_ZERO"] = 1552] = "EXCHANGE_RECOUP_COIN_BALANCE_ZERO";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_BLINDING_FAILED"] = 1553] = "EXCHANGE_RECOUP_BLINDING_FAILED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_COIN_BALANCE_NEGATIVE"] = 1554] = "EXCHANGE_RECOUP_COIN_BALANCE_NEGATIVE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_NOT_ELIGIBLE"] = 1555] = "EXCHANGE_RECOUP_NOT_ELIGIBLE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_REFRESH_SIGNATURE_INVALID"] = 1575] = "EXCHANGE_RECOUP_REFRESH_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_REFRESH_MELT_NOT_FOUND"] = 1576] = "EXCHANGE_RECOUP_REFRESH_MELT_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_REFRESH_BLINDING_FAILED"] = 1578] = "EXCHANGE_RECOUP_REFRESH_BLINDING_FAILED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RECOUP_REFRESH_NOT_ELIGIBLE"] = 1580] = "EXCHANGE_RECOUP_REFRESH_NOT_ELIGIBLE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KEYS_TIMETRAVEL_FORBIDDEN"] = 1600] = "EXCHANGE_KEYS_TIMETRAVEL_FORBIDDEN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_WIRE_SIGNATURE_INVALID"] = 1650] = "EXCHANGE_WIRE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_WIRE_NO_ACCOUNTS_CONFIGURED"] = 1651] = "EXCHANGE_WIRE_NO_ACCOUNTS_CONFIGURED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_WIRE_INVALID_PAYTO_CONFIGURED"] = 1652] = "EXCHANGE_WIRE_INVALID_PAYTO_CONFIGURED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_WIRE_FEES_NOT_CONFIGURED"] = 1653] = "EXCHANGE_WIRE_FEES_NOT_CONFIGURED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_PURSE_CREATE_CONFLICTING_META_DATA"] = 1675] = "EXCHANGE_RESERVES_PURSE_CREATE_CONFLICTING_META_DATA";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_PURSE_MERGE_CONFLICTING_META_DATA"] = 1676] = "EXCHANGE_RESERVES_PURSE_MERGE_CONFLICTING_META_DATA";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_PURSE_CREATE_INSUFFICIENT_FUNDS"] = 1677] = "EXCHANGE_RESERVES_PURSE_CREATE_INSUFFICIENT_FUNDS";
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";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_DEPOSIT_EXCHANGE_SIGNATURE_INVALID"] = 1725] = "EXCHANGE_PURSE_DEPOSIT_EXCHANGE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE"] = 1750] = "EXCHANGE_SIGNKEY_HELPER_UNAVAILABLE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_SIGNKEY_HELPER_BUG"] = 1751] = "EXCHANGE_SIGNKEY_HELPER_BUG";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_SIGNKEY_HELPER_TOO_EARLY"] = 1752] = "EXCHANGE_SIGNKEY_HELPER_TOO_EARLY";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_PURSE_EXPIRATION_BEFORE_NOW"] = 1775] = "EXCHANGE_RESERVES_PURSE_EXPIRATION_BEFORE_NOW";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_PURSE_EXPIRATION_IS_NEVER"] = 1776] = "EXCHANGE_RESERVES_PURSE_EXPIRATION_IS_NEVER";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_PURSE_MERGE_SIGNATURE_INVALID"] = 1777] = "EXCHANGE_RESERVES_PURSE_MERGE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_RESERVE_MERGE_SIGNATURE_INVALID"] = 1778] = "EXCHANGE_RESERVES_RESERVE_MERGE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_OPEN_BAD_SIGNATURE"] = 1785] = "EXCHANGE_RESERVES_OPEN_BAD_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_CLOSE_BAD_SIGNATURE"] = 1786] = "EXCHANGE_RESERVES_CLOSE_BAD_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_ATTEST_BAD_SIGNATURE"] = 1787] = "EXCHANGE_RESERVES_ATTEST_BAD_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_CLOSE_NO_TARGET_ACCOUNT"] = 1788] = "EXCHANGE_RESERVES_CLOSE_NO_TARGET_ACCOUNT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVES_OPEN_INSUFFICIENT_FUNDS"] = 1789] = "EXCHANGE_RESERVES_OPEN_INSUFFICIENT_FUNDS";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_AUDITOR_NOT_FOUND"] = 1800] = "EXCHANGE_MANAGEMENT_AUDITOR_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_AUDITOR_MORE_RECENT_PRESENT"] = 1801] = "EXCHANGE_MANAGEMENT_AUDITOR_MORE_RECENT_PRESENT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_AUDITOR_ADD_SIGNATURE_INVALID"] = 1802] = "EXCHANGE_MANAGEMENT_AUDITOR_ADD_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_AUDITOR_DEL_SIGNATURE_INVALID"] = 1803] = "EXCHANGE_MANAGEMENT_AUDITOR_DEL_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_DENOMINATION_REVOKE_SIGNATURE_INVALID"] = 1804] = "EXCHANGE_MANAGEMENT_DENOMINATION_REVOKE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_SIGNKEY_REVOKE_SIGNATURE_INVALID"] = 1805] = "EXCHANGE_MANAGEMENT_SIGNKEY_REVOKE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_WIRE_MORE_RECENT_PRESENT"] = 1806] = "EXCHANGE_MANAGEMENT_WIRE_MORE_RECENT_PRESENT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_UNKNOWN"] = 1807] = "EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_WIRE_DETAILS_SIGNATURE_INVALID"] = 1808] = "EXCHANGE_MANAGEMENT_WIRE_DETAILS_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_WIRE_ADD_SIGNATURE_INVALID"] = 1809] = "EXCHANGE_MANAGEMENT_WIRE_ADD_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID"] = 1810] = "EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_WIRE_NOT_FOUND"] = 1811] = "EXCHANGE_MANAGEMENT_WIRE_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_WIRE_FEE_SIGNATURE_INVALID"] = 1812] = "EXCHANGE_MANAGEMENT_WIRE_FEE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_WIRE_FEE_MISMATCH"] = 1813] = "EXCHANGE_MANAGEMENT_WIRE_FEE_MISMATCH";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_KEYS_DENOMKEY_ADD_SIGNATURE_INVALID"] = 1814] = "EXCHANGE_MANAGEMENT_KEYS_DENOMKEY_ADD_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_ADD_SIGNATURE_INVALID"] = 1815] = "EXCHANGE_MANAGEMENT_KEYS_SIGNKEY_ADD_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_GLOBAL_FEE_MISMATCH"] = 1816] = "EXCHANGE_MANAGEMENT_GLOBAL_FEE_MISMATCH";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_GLOBAL_FEE_SIGNATURE_INVALID"] = 1817] = "EXCHANGE_MANAGEMENT_GLOBAL_FEE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_DRAIN_PROFITS_SIGNATURE_INVALID"] = 1818] = "EXCHANGE_MANAGEMENT_DRAIN_PROFITS_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_AML_DECISION_ADD_SIGNATURE_INVALID"] = 1825] = "EXCHANGE_AML_DECISION_ADD_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_AML_DECISION_INVALID_OFFICER"] = 1826] = "EXCHANGE_AML_DECISION_INVALID_OFFICER";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_AML_DECISION_MORE_RECENT_PRESENT"] = 1827] = "EXCHANGE_AML_DECISION_MORE_RECENT_PRESENT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_AML_DECISION_UNKNOWN_CHECK"] = 1828] = "EXCHANGE_AML_DECISION_UNKNOWN_CHECK";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_UPDATE_AML_OFFICER_SIGNATURE_INVALID"] = 1830] = "EXCHANGE_MANAGEMENT_UPDATE_AML_OFFICER_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_AML_OFFICERS_MORE_RECENT_PRESENT"] = 1831] = "EXCHANGE_MANAGEMENT_AML_OFFICERS_MORE_RECENT_PRESENT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA"] = 1850] = "EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_CREATE_CONFLICTING_CONTRACT_STORED"] = 1851] = "EXCHANGE_PURSE_CREATE_CONFLICTING_CONTRACT_STORED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_CREATE_COIN_SIGNATURE_INVALID"] = 1852] = "EXCHANGE_PURSE_CREATE_COIN_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_CREATE_EXPIRATION_BEFORE_NOW"] = 1853] = "EXCHANGE_PURSE_CREATE_EXPIRATION_BEFORE_NOW";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_CREATE_EXPIRATION_IS_NEVER"] = 1854] = "EXCHANGE_PURSE_CREATE_EXPIRATION_IS_NEVER";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_CREATE_SIGNATURE_INVALID"] = 1855] = "EXCHANGE_PURSE_CREATE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_ECONTRACT_SIGNATURE_INVALID"] = 1856] = "EXCHANGE_PURSE_ECONTRACT_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_CREATE_EXCHANGE_SIGNATURE_INVALID"] = 1857] = "EXCHANGE_PURSE_CREATE_EXCHANGE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA"] = 1858] = "EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA"] = 1859] = "EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_CREATE_PURSE_NEGATIVE_VALUE_AFTER_FEE"] = 1860] = "EXCHANGE_CREATE_PURSE_NEGATIVE_VALUE_AFTER_FEE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_MERGE_INVALID_MERGE_SIGNATURE"] = 1876] = "EXCHANGE_PURSE_MERGE_INVALID_MERGE_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_MERGE_INVALID_RESERVE_SIGNATURE"] = 1877] = "EXCHANGE_PURSE_MERGE_INVALID_RESERVE_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_NOT_FULL"] = 1878] = "EXCHANGE_PURSE_NOT_FULL";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_PURSE_MERGE_EXCHANGE_SIGNATURE_INVALID"] = 1879] = "EXCHANGE_PURSE_MERGE_EXCHANGE_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MERGE_PURSE_PARTNER_UNKNOWN"] = 1880] = "EXCHANGE_MERGE_PURSE_PARTNER_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_ADD_PARTNER_SIGNATURE_INVALID"] = 1890] = "EXCHANGE_MANAGEMENT_ADD_PARTNER_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_MANAGEMENT_ADD_PARTNER_DATA_CONFLICT"] = 1891] = "EXCHANGE_MANAGEMENT_ADD_PARTNER_DATA_CONFLICT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_AUDITORS_AUDITOR_SIGNATURE_INVALID"] = 1900] = "EXCHANGE_AUDITORS_AUDITOR_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_AUDITORS_AUDITOR_UNKNOWN"] = 1901] = "EXCHANGE_AUDITORS_AUDITOR_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_AUDITORS_AUDITOR_INACTIVE"] = 1902] = "EXCHANGE_AUDITORS_AUDITOR_INACTIVE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_WALLET_SIGNATURE_INVALID"] = 1925] = "EXCHANGE_KYC_WALLET_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_PROOF_BACKEND_INVALID_RESPONSE"] = 1926] = "EXCHANGE_KYC_PROOF_BACKEND_INVALID_RESPONSE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_PROOF_BACKEND_ERROR"] = 1927] = "EXCHANGE_KYC_PROOF_BACKEND_ERROR";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_PROOF_BACKEND_AUTHORIZATION_FAILED"] = 1928] = "EXCHANGE_KYC_PROOF_BACKEND_AUTHORIZATION_FAILED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_PROOF_REQUEST_UNKNOWN"] = 1929] = "EXCHANGE_KYC_PROOF_REQUEST_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_CHECK_AUTHORIZATION_FAILED"] = 1930] = "EXCHANGE_KYC_CHECK_AUTHORIZATION_FAILED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_GENERIC_LOGIC_UNKNOWN"] = 1931] = "EXCHANGE_KYC_GENERIC_LOGIC_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_GENERIC_LOGIC_GONE"] = 1932] = "EXCHANGE_KYC_GENERIC_LOGIC_GONE";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_GENERIC_LOGIC_BUG"] = 1933] = "EXCHANGE_KYC_GENERIC_LOGIC_BUG";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_GENERIC_PROVIDER_ACCESS_REFUSED"] = 1934] = "EXCHANGE_KYC_GENERIC_PROVIDER_ACCESS_REFUSED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_GENERIC_PROVIDER_TIMEOUT"] = 1935] = "EXCHANGE_KYC_GENERIC_PROVIDER_TIMEOUT";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY"] = 1936] = "EXCHANGE_KYC_GENERIC_PROVIDER_UNEXPECTED_REPLY";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_GENERIC_PROVIDER_RATE_LIMIT_EXCEEDED"] = 1937] = "EXCHANGE_KYC_GENERIC_PROVIDER_RATE_LIMIT_EXCEEDED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_WEBHOOK_UNAUTHORIZED"] = 1938] = "EXCHANGE_KYC_WEBHOOK_UNAUTHORIZED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_CONTRACTS_UNKNOWN"] = 1950] = "EXCHANGE_CONTRACTS_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_CONTRACTS_INVALID_CONTRACT_PUB"] = 1951] = "EXCHANGE_CONTRACTS_INVALID_CONTRACT_PUB";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_CONTRACTS_DECRYPTION_FAILED"] = 1952] = "EXCHANGE_CONTRACTS_DECRYPTION_FAILED";
TalerErrorCode2[TalerErrorCode2["EXCHANGE_CONTRACTS_SIGNATURE_INVALID"] = 1953] = "EXCHANGE_CONTRACTS_SIGNATURE_INVALID";
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";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_ORDER_UNKNOWN"] = 2005] = "MERCHANT_GENERIC_ORDER_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_PRODUCT_UNKNOWN"] = 2006] = "MERCHANT_GENERIC_PRODUCT_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_TIP_ID_UNKNOWN"] = 2007] = "MERCHANT_GENERIC_TIP_ID_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID"] = 2008] = "MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER"] = 2009] = "MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_EXCHANGE_KEYS_FAILURE"] = 2010] = "MERCHANT_GENERIC_EXCHANGE_KEYS_FAILURE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_EXCHANGE_TIMEOUT"] = 2011] = "MERCHANT_GENERIC_EXCHANGE_TIMEOUT";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_EXCHANGE_CONNECT_FAILURE"] = 2012] = "MERCHANT_GENERIC_EXCHANGE_CONNECT_FAILURE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_EXCHANGE_REPLY_MALFORMED"] = 2013] = "MERCHANT_GENERIC_EXCHANGE_REPLY_MALFORMED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_EXCHANGE_UNEXPECTED_STATUS"] = 2014] = "MERCHANT_GENERIC_EXCHANGE_UNEXPECTED_STATUS";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_UNAUTHORIZED"] = 2015] = "MERCHANT_GENERIC_UNAUTHORIZED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_INSTANCE_DELETED"] = 2016] = "MERCHANT_GENERIC_INSTANCE_DELETED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_TRANSFER_UNKNOWN"] = 2017] = "MERCHANT_GENERIC_TRANSFER_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_TEMPLATE_UNKNOWN"] = 2018] = "MERCHANT_GENERIC_TEMPLATE_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_WEBHOOK_UNKNOWN"] = 2019] = "MERCHANT_GENERIC_WEBHOOK_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_PENDING_WEBHOOK_UNKNOWN"] = 2020] = "MERCHANT_GENERIC_PENDING_WEBHOOK_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GET_ORDERS_EXCHANGE_TRACKING_FAILURE"] = 2100] = "MERCHANT_GET_ORDERS_EXCHANGE_TRACKING_FAILURE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GET_ORDERS_ID_EXCHANGE_REQUEST_FAILURE"] = 2103] = "MERCHANT_GET_ORDERS_ID_EXCHANGE_REQUEST_FAILURE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GET_ORDERS_ID_EXCHANGE_LOOKUP_START_FAILURE"] = 2104] = "MERCHANT_GET_ORDERS_ID_EXCHANGE_LOOKUP_START_FAILURE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GET_ORDERS_ID_INVALID_TOKEN"] = 2105] = "MERCHANT_GET_ORDERS_ID_INVALID_TOKEN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_GET_ORDERS_ID_INVALID_CONTRACT_HASH"] = 2106] = "MERCHANT_GET_ORDERS_ID_INVALID_CONTRACT_HASH";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_FUNDS"] = 2150] = "MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_FUNDS";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_NOT_FOUND"] = 2151] = "MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_AUDITOR_FAILURE"] = 2152] = "MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_AUDITOR_FAILURE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_AMOUNT_OVERFLOW"] = 2153] = "MERCHANT_POST_ORDERS_ID_PAY_AMOUNT_OVERFLOW";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_FEES_EXCEED_PAYMENT"] = 2154] = "MERCHANT_POST_ORDERS_ID_PAY_FEES_EXCEED_PAYMENT";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_DUE_TO_FEES"] = 2155] = "MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_DUE_TO_FEES";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_PAYMENT_INSUFFICIENT"] = 2156] = "MERCHANT_POST_ORDERS_ID_PAY_PAYMENT_INSUFFICIENT";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_COIN_SIGNATURE_INVALID"] = 2157] = "MERCHANT_POST_ORDERS_ID_PAY_COIN_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_LOOKUP_FAILED"] = 2158] = "MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_LOOKUP_FAILED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_REFUND_DEADLINE_PAST_WIRE_TRANSFER_DEADLINE"] = 2159] = "MERCHANT_POST_ORDERS_ID_PAY_REFUND_DEADLINE_PAST_WIRE_TRANSFER_DEADLINE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_ALREADY_PAID"] = 2160] = "MERCHANT_POST_ORDERS_ID_PAY_ALREADY_PAID";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_OFFER_EXPIRED"] = 2161] = "MERCHANT_POST_ORDERS_ID_PAY_OFFER_EXPIRED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_MERCHANT_FIELD_MISSING"] = 2162] = "MERCHANT_POST_ORDERS_ID_PAY_MERCHANT_FIELD_MISSING";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_WIRE_HASH_UNKNOWN"] = 2163] = "MERCHANT_POST_ORDERS_ID_PAY_WIRE_HASH_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_DEPOSIT_EXPIRED"] = 2165] = "MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_DEPOSIT_EXPIRED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_WIRE_FEE_ADDITION_FAILED"] = 2166] = "MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_WIRE_FEE_ADDITION_FAILED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_REFUNDED"] = 2167] = "MERCHANT_POST_ORDERS_ID_PAY_REFUNDED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_REFUNDS_EXCEED_PAYMENTS"] = 2168] = "MERCHANT_POST_ORDERS_ID_PAY_REFUNDS_EXCEED_PAYMENTS";
TalerErrorCode2[TalerErrorCode2["DEAD_QQQ_PAY_MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE"] = 2169] = "DEAD_QQQ_PAY_MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_FAILED"] = 2170] = "MERCHANT_POST_ORDERS_ID_PAY_EXCHANGE_FAILED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_MISSING"] = 2171] = "MERCHANT_POST_ORDERS_ID_PAY_AGE_COMMITMENT_MISSING";
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";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_LOOKUP_FAILED"] = 2252] = "MERCHANT_POST_ORDERS_ID_ABORT_EXCHANGE_LOOKUP_FAILED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_NOT_FOUND"] = 2253] = "MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE"] = 2254] = "MERCHANT_POST_ORDERS_ID_ABORT_REFUND_REFUSED_PAYMENT_COMPLETE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_HASH_MISSMATCH"] = 2255] = "MERCHANT_POST_ORDERS_ID_ABORT_CONTRACT_HASH_MISSMATCH";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_ABORT_COINS_ARRAY_EMPTY"] = 2256] = "MERCHANT_POST_ORDERS_ID_ABORT_COINS_ARRAY_EMPTY";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_CLAIM_NOT_FOUND"] = 2300] = "MERCHANT_POST_ORDERS_ID_CLAIM_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_CLAIM_ALREADY_CLAIMED"] = 2301] = "MERCHANT_POST_ORDERS_ID_CLAIM_ALREADY_CLAIMED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_CLAIM_CLIENT_INTERNAL_FAILURE"] = 2302] = "MERCHANT_POST_ORDERS_ID_CLAIM_CLIENT_INTERNAL_FAILURE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_REFUND_SIGNATURE_FAILED"] = 2350] = "MERCHANT_POST_ORDERS_ID_REFUND_SIGNATURE_FAILED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_TIP_PICKUP_UNBLIND_FAILURE"] = 2400] = "MERCHANT_TIP_PICKUP_UNBLIND_FAILURE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_TIP_PICKUP_EXCHANGE_ERROR"] = 2403] = "MERCHANT_TIP_PICKUP_EXCHANGE_ERROR";
TalerErrorCode2[TalerErrorCode2["MERCHANT_TIP_PICKUP_SUMMATION_FAILED"] = 2404] = "MERCHANT_TIP_PICKUP_SUMMATION_FAILED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_TIP_PICKUP_HAS_EXPIRED"] = 2405] = "MERCHANT_TIP_PICKUP_HAS_EXPIRED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_TIP_PICKUP_AMOUNT_EXCEEDS_TIP_REMAINING"] = 2406] = "MERCHANT_TIP_PICKUP_AMOUNT_EXCEEDS_TIP_REMAINING";
TalerErrorCode2[TalerErrorCode2["MERCHANT_TIP_PICKUP_DENOMINATION_UNKNOWN"] = 2407] = "MERCHANT_TIP_PICKUP_DENOMINATION_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_INSTANCE_CONFIGURATION_LACKS_WIRE"] = 2500] = "MERCHANT_PRIVATE_POST_ORDERS_INSTANCE_CONFIGURATION_LACKS_WIRE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_NO_LOCALTIME"] = 2501] = "MERCHANT_PRIVATE_POST_ORDERS_NO_LOCALTIME";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_PROPOSAL_PARSE_ERROR"] = 2502] = "MERCHANT_PRIVATE_POST_ORDERS_PROPOSAL_PARSE_ERROR";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_ALREADY_EXISTS"] = 2503] = "MERCHANT_PRIVATE_POST_ORDERS_ALREADY_EXISTS";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_REFUND_AFTER_WIRE_DEADLINE"] = 2504] = "MERCHANT_PRIVATE_POST_ORDERS_REFUND_AFTER_WIRE_DEADLINE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_DELIVERY_DATE_IN_PAST"] = 2505] = "MERCHANT_PRIVATE_POST_ORDERS_DELIVERY_DATE_IN_PAST";
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";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_DELETE_ORDERS_ALREADY_PAID"] = 2521] = "MERCHANT_PRIVATE_DELETE_ORDERS_ALREADY_PAID";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_INCONSISTENT_AMOUNT"] = 2530] = "MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_INCONSISTENT_AMOUNT";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_ORDER_UNPAID"] = 2531] = "MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_ORDER_UNPAID";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_NOT_ALLOWED_BY_CONTRACT"] = 2532] = "MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_NOT_ALLOWED_BY_CONTRACT";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TRANSFERS_EXCHANGE_UNKNOWN"] = 2550] = "MERCHANT_PRIVATE_POST_TRANSFERS_EXCHANGE_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TRANSFERS_REQUEST_ERROR"] = 2551] = "MERCHANT_PRIVATE_POST_TRANSFERS_REQUEST_ERROR";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_TRANSFERS"] = 2552] = "MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_TRANSFERS";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_REPORTS"] = 2553] = "MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_REPORTS";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TRANSFERS_BAD_WIRE_FEE"] = 2554] = "MERCHANT_PRIVATE_POST_TRANSFERS_BAD_WIRE_FEE";
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";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_STOCKED_REDUCED"] = 2662] = "MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_STOCKED_REDUCED";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_SOLD_REDUCED"] = 2663] = "MERCHANT_PRIVATE_PATCH_PRODUCTS_TOTAL_SOLD_REDUCED";
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";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_INSUFFICIENT_FUNDS"] = 2752] = "MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_INSUFFICIENT_FUNDS";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_RESERVE_NOT_FOUND"] = 2753] = "MERCHANT_PRIVATE_POST_TIP_AUTHORIZE_RESERVE_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_GET_ORDERS_ID_AMOUNT_ARITHMETIC_FAILURE"] = 2800] = "MERCHANT_PRIVATE_GET_ORDERS_ID_AMOUNT_ARITHMETIC_FAILURE";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_TEMPLATES_CONFLICT_TEMPLATE_EXISTS"] = 2850] = "MERCHANT_PRIVATE_POST_TEMPLATES_CONFLICT_TEMPLATE_EXISTS";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_USING_TEMPLATES_AMOUNT_CONFLICT_TEMPLATES_CONTRACT_AMOUNT"] = 2860] = "MERCHANT_POST_USING_TEMPLATES_AMOUNT_CONFLICT_TEMPLATES_CONTRACT_AMOUNT";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_USING_TEMPLATES_SUMMARY_CONFLICT_TEMPLATES_CONTRACT_SUBJECT"] = 2861] = "MERCHANT_POST_USING_TEMPLATES_SUMMARY_CONFLICT_TEMPLATES_CONTRACT_SUBJECT";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_USING_TEMPLATES_NO_AMOUNT"] = 2862] = "MERCHANT_POST_USING_TEMPLATES_NO_AMOUNT";
TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_USING_TEMPLATES_NO_SUMMARY"] = 2863] = "MERCHANT_POST_USING_TEMPLATES_NO_SUMMARY";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_WEBHOOKS_CONFLICT_WEBHOOK_EXISTS"] = 2900] = "MERCHANT_PRIVATE_POST_WEBHOOKS_CONFLICT_WEBHOOK_EXISTS";
TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_PENDING_WEBHOOKS_CONFLICT_PENDING_WEBHOOK_EXISTS"] = 2910] = "MERCHANT_PRIVATE_POST_PENDING_WEBHOOKS_CONFLICT_PENDING_WEBHOOK_EXISTS";
TalerErrorCode2[TalerErrorCode2["AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID"] = 3100] = "AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["AUDITOR_EXCHANGE_SIGNING_KEY_REVOKED"] = 3101] = "AUDITOR_EXCHANGE_SIGNING_KEY_REVOKED";
TalerErrorCode2[TalerErrorCode2["BANK_SAME_ACCOUNT"] = 5101] = "BANK_SAME_ACCOUNT";
TalerErrorCode2[TalerErrorCode2["BANK_UNALLOWED_DEBIT"] = 5102] = "BANK_UNALLOWED_DEBIT";
TalerErrorCode2[TalerErrorCode2["BANK_NEGATIVE_NUMBER_AMOUNT"] = 5103] = "BANK_NEGATIVE_NUMBER_AMOUNT";
TalerErrorCode2[TalerErrorCode2["BANK_NUMBER_TOO_BIG"] = 5104] = "BANK_NUMBER_TOO_BIG";
TalerErrorCode2[TalerErrorCode2["BANK_LOGIN_FAILED"] = 5105] = "BANK_LOGIN_FAILED";
TalerErrorCode2[TalerErrorCode2["BANK_UNKNOWN_ACCOUNT"] = 5106] = "BANK_UNKNOWN_ACCOUNT";
TalerErrorCode2[TalerErrorCode2["BANK_TRANSACTION_NOT_FOUND"] = 5107] = "BANK_TRANSACTION_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["BANK_BAD_FORMAT_AMOUNT"] = 5108] = "BANK_BAD_FORMAT_AMOUNT";
TalerErrorCode2[TalerErrorCode2["BANK_REJECT_NO_RIGHTS"] = 5109] = "BANK_REJECT_NO_RIGHTS";
TalerErrorCode2[TalerErrorCode2["BANK_UNMANAGED_EXCEPTION"] = 5110] = "BANK_UNMANAGED_EXCEPTION";
TalerErrorCode2[TalerErrorCode2["BANK_SOFT_EXCEPTION"] = 5111] = "BANK_SOFT_EXCEPTION";
TalerErrorCode2[TalerErrorCode2["BANK_TRANSFER_REQUEST_UID_REUSED"] = 5112] = "BANK_TRANSFER_REQUEST_UID_REUSED";
TalerErrorCode2[TalerErrorCode2["BANK_WITHDRAWAL_OPERATION_RESERVE_SELECTION_CONFLICT"] = 5113] = "BANK_WITHDRAWAL_OPERATION_RESERVE_SELECTION_CONFLICT";
TalerErrorCode2[TalerErrorCode2["BANK_DUPLICATE_RESERVE_PUB_SUBJECT"] = 5114] = "BANK_DUPLICATE_RESERVE_PUB_SUBJECT";
TalerErrorCode2[TalerErrorCode2["BANK_ANCIENT_TRANSACTION_GONE"] = 5115] = "BANK_ANCIENT_TRANSACTION_GONE";
TalerErrorCode2[TalerErrorCode2["BANK_ABORT_CONFIRM_CONFLICT"] = 5116] = "BANK_ABORT_CONFIRM_CONFLICT";
TalerErrorCode2[TalerErrorCode2["BANK_CONFIRM_ABORT_CONFLICT"] = 5117] = "BANK_CONFIRM_ABORT_CONFLICT";
TalerErrorCode2[TalerErrorCode2["BANK_REGISTER_CONFLICT"] = 5118] = "BANK_REGISTER_CONFLICT";
TalerErrorCode2[TalerErrorCode2["BANK_POST_WITHDRAWAL_OPERATION_REQUIRED"] = 5119] = "BANK_POST_WITHDRAWAL_OPERATION_REQUIRED";
TalerErrorCode2[TalerErrorCode2["SYNC_ACCOUNT_UNKNOWN"] = 6100] = "SYNC_ACCOUNT_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["SYNC_BAD_IF_NONE_MATCH"] = 6101] = "SYNC_BAD_IF_NONE_MATCH";
TalerErrorCode2[TalerErrorCode2["SYNC_BAD_IF_MATCH"] = 6102] = "SYNC_BAD_IF_MATCH";
TalerErrorCode2[TalerErrorCode2["SYNC_BAD_SYNC_SIGNATURE"] = 6103] = "SYNC_BAD_SYNC_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["SYNC_INVALID_SIGNATURE"] = 6104] = "SYNC_INVALID_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["SYNC_MALFORMED_CONTENT_LENGTH"] = 6105] = "SYNC_MALFORMED_CONTENT_LENGTH";
TalerErrorCode2[TalerErrorCode2["SYNC_EXCESSIVE_CONTENT_LENGTH"] = 6106] = "SYNC_EXCESSIVE_CONTENT_LENGTH";
TalerErrorCode2[TalerErrorCode2["SYNC_OUT_OF_MEMORY_ON_CONTENT_LENGTH"] = 6107] = "SYNC_OUT_OF_MEMORY_ON_CONTENT_LENGTH";
TalerErrorCode2[TalerErrorCode2["SYNC_INVALID_UPLOAD"] = 6108] = "SYNC_INVALID_UPLOAD";
TalerErrorCode2[TalerErrorCode2["SYNC_PAYMENT_GENERIC_TIMEOUT"] = 6109] = "SYNC_PAYMENT_GENERIC_TIMEOUT";
TalerErrorCode2[TalerErrorCode2["SYNC_PAYMENT_CREATE_BACKEND_ERROR"] = 6110] = "SYNC_PAYMENT_CREATE_BACKEND_ERROR";
TalerErrorCode2[TalerErrorCode2["SYNC_PREVIOUS_BACKUP_UNKNOWN"] = 6111] = "SYNC_PREVIOUS_BACKUP_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["SYNC_MISSING_CONTENT_LENGTH"] = 6112] = "SYNC_MISSING_CONTENT_LENGTH";
TalerErrorCode2[TalerErrorCode2["SYNC_GENERIC_BACKEND_ERROR"] = 6113] = "SYNC_GENERIC_BACKEND_ERROR";
TalerErrorCode2[TalerErrorCode2["SYNC_GENERIC_BACKEND_TIMEOUT"] = 6114] = "SYNC_GENERIC_BACKEND_TIMEOUT";
TalerErrorCode2[TalerErrorCode2["WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE"] = 7e3] = "WALLET_EXCHANGE_PROTOCOL_VERSION_INCOMPATIBLE";
TalerErrorCode2[TalerErrorCode2["WALLET_UNEXPECTED_EXCEPTION"] = 7001] = "WALLET_UNEXPECTED_EXCEPTION";
TalerErrorCode2[TalerErrorCode2["WALLET_RECEIVED_MALFORMED_RESPONSE"] = 7002] = "WALLET_RECEIVED_MALFORMED_RESPONSE";
TalerErrorCode2[TalerErrorCode2["WALLET_NETWORK_ERROR"] = 7003] = "WALLET_NETWORK_ERROR";
TalerErrorCode2[TalerErrorCode2["WALLET_HTTP_REQUEST_THROTTLED"] = 7004] = "WALLET_HTTP_REQUEST_THROTTLED";
TalerErrorCode2[TalerErrorCode2["WALLET_UNEXPECTED_REQUEST_ERROR"] = 7005] = "WALLET_UNEXPECTED_REQUEST_ERROR";
TalerErrorCode2[TalerErrorCode2["WALLET_EXCHANGE_DENOMINATIONS_INSUFFICIENT"] = 7006] = "WALLET_EXCHANGE_DENOMINATIONS_INSUFFICIENT";
TalerErrorCode2[TalerErrorCode2["WALLET_CORE_API_OPERATION_UNKNOWN"] = 7007] = "WALLET_CORE_API_OPERATION_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["WALLET_INVALID_TALER_PAY_URI"] = 7008] = "WALLET_INVALID_TALER_PAY_URI";
TalerErrorCode2[TalerErrorCode2["WALLET_EXCHANGE_COIN_SIGNATURE_INVALID"] = 7009] = "WALLET_EXCHANGE_COIN_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["WALLET_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN_AT_EXCHANGE"] = 7010] = "WALLET_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN_AT_EXCHANGE";
TalerErrorCode2[TalerErrorCode2["WALLET_CORE_NOT_AVAILABLE"] = 7011] = "WALLET_CORE_NOT_AVAILABLE";
TalerErrorCode2[TalerErrorCode2["WALLET_WITHDRAWAL_OPERATION_ABORTED_BY_BANK"] = 7012] = "WALLET_WITHDRAWAL_OPERATION_ABORTED_BY_BANK";
TalerErrorCode2[TalerErrorCode2["WALLET_HTTP_REQUEST_GENERIC_TIMEOUT"] = 7013] = "WALLET_HTTP_REQUEST_GENERIC_TIMEOUT";
TalerErrorCode2[TalerErrorCode2["WALLET_ORDER_ALREADY_CLAIMED"] = 7014] = "WALLET_ORDER_ALREADY_CLAIMED";
TalerErrorCode2[TalerErrorCode2["WALLET_WITHDRAWAL_GROUP_INCOMPLETE"] = 7015] = "WALLET_WITHDRAWAL_GROUP_INCOMPLETE";
TalerErrorCode2[TalerErrorCode2["WALLET_TIPPING_COIN_SIGNATURE_INVALID"] = 7016] = "WALLET_TIPPING_COIN_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["WALLET_BANK_INTEGRATION_PROTOCOL_VERSION_INCOMPATIBLE"] = 7017] = "WALLET_BANK_INTEGRATION_PROTOCOL_VERSION_INCOMPATIBLE";
TalerErrorCode2[TalerErrorCode2["WALLET_CONTRACT_TERMS_BASE_URL_MISMATCH"] = 7018] = "WALLET_CONTRACT_TERMS_BASE_URL_MISMATCH";
TalerErrorCode2[TalerErrorCode2["WALLET_CONTRACT_TERMS_SIGNATURE_INVALID"] = 7019] = "WALLET_CONTRACT_TERMS_SIGNATURE_INVALID";
TalerErrorCode2[TalerErrorCode2["WALLET_CONTRACT_TERMS_MALFORMED"] = 7020] = "WALLET_CONTRACT_TERMS_MALFORMED";
TalerErrorCode2[TalerErrorCode2["WALLET_PENDING_OPERATION_FAILED"] = 7021] = "WALLET_PENDING_OPERATION_FAILED";
TalerErrorCode2[TalerErrorCode2["WALLET_PAY_MERCHANT_SERVER_ERROR"] = 7022] = "WALLET_PAY_MERCHANT_SERVER_ERROR";
TalerErrorCode2[TalerErrorCode2["WALLET_CRYPTO_WORKER_ERROR"] = 7023] = "WALLET_CRYPTO_WORKER_ERROR";
TalerErrorCode2[TalerErrorCode2["WALLET_CRYPTO_WORKER_BAD_REQUEST"] = 7024] = "WALLET_CRYPTO_WORKER_BAD_REQUEST";
TalerErrorCode2[TalerErrorCode2["WALLET_WITHDRAWAL_KYC_REQUIRED"] = 7025] = "WALLET_WITHDRAWAL_KYC_REQUIRED";
TalerErrorCode2[TalerErrorCode2["WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE"] = 7026] = "WALLET_DEPOSIT_GROUP_INSUFFICIENT_BALANCE";
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";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_GENERIC_MISSING_CONTENT_LENGTH"] = 8003] = "ANASTASIS_GENERIC_MISSING_CONTENT_LENGTH";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_GENERIC_MALFORMED_CONTENT_LENGTH"] = 8004] = "ANASTASIS_GENERIC_MALFORMED_CONTENT_LENGTH";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_GENERIC_ORDER_CREATE_BACKEND_ERROR"] = 8005] = "ANASTASIS_GENERIC_ORDER_CREATE_BACKEND_ERROR";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_GENERIC_PAYMENT_CHECK_UNAUTHORIZED"] = 8006] = "ANASTASIS_GENERIC_PAYMENT_CHECK_UNAUTHORIZED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_GENERIC_PAYMENT_CHECK_START_FAILED"] = 8007] = "ANASTASIS_GENERIC_PAYMENT_CHECK_START_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_GENERIC_PROVIDER_UNREACHABLE"] = 8008] = "ANASTASIS_GENERIC_PROVIDER_UNREACHABLE";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_PAYMENT_GENERIC_TIMEOUT"] = 8009] = "ANASTASIS_PAYMENT_GENERIC_TIMEOUT";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_UNKNOWN"] = 8108] = "ANASTASIS_TRUTH_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_AUTHORIZATION_METHOD_NO_LONGER_SUPPORTED"] = 8109] = "ANASTASIS_TRUTH_AUTHORIZATION_METHOD_NO_LONGER_SUPPORTED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED"] = 8110] = "ANASTASIS_TRUTH_CHALLENGE_RESPONSE_REQUIRED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_CHALLENGE_FAILED"] = 8111] = "ANASTASIS_TRUTH_CHALLENGE_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_CHALLENGE_UNKNOWN"] = 8112] = "ANASTASIS_TRUTH_CHALLENGE_UNKNOWN";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_AUTHORIZATION_START_FAILED"] = 8114] = "ANASTASIS_TRUTH_AUTHORIZATION_START_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_KEY_SHARE_GONE"] = 8115] = "ANASTASIS_TRUTH_KEY_SHARE_GONE";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_ORDER_DISAPPEARED"] = 8116] = "ANASTASIS_TRUTH_ORDER_DISAPPEARED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_BACKEND_EXCHANGE_BAD"] = 8117] = "ANASTASIS_TRUTH_BACKEND_EXCHANGE_BAD";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_UNEXPECTED_PAYMENT_STATUS"] = 8118] = "ANASTASIS_TRUTH_UNEXPECTED_PAYMENT_STATUS";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_PAYMENT_CREATE_BACKEND_ERROR"] = 8119] = "ANASTASIS_TRUTH_PAYMENT_CREATE_BACKEND_ERROR";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_DECRYPTION_FAILED"] = 8120] = "ANASTASIS_TRUTH_DECRYPTION_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_RATE_LIMITED"] = 8121] = "ANASTASIS_TRUTH_RATE_LIMITED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_CHALLENGE_WRONG_METHOD"] = 8123] = "ANASTASIS_TRUTH_CHALLENGE_WRONG_METHOD";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_UPLOAD_UUID_EXISTS"] = 8150] = "ANASTASIS_TRUTH_UPLOAD_UUID_EXISTS";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TRUTH_UPLOAD_METHOD_NOT_SUPPORTED"] = 8151] = "ANASTASIS_TRUTH_UPLOAD_METHOD_NOT_SUPPORTED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_SMS_PHONE_INVALID"] = 8200] = "ANASTASIS_SMS_PHONE_INVALID";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_SMS_HELPER_EXEC_FAILED"] = 8201] = "ANASTASIS_SMS_HELPER_EXEC_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_SMS_HELPER_COMMAND_FAILED"] = 8202] = "ANASTASIS_SMS_HELPER_COMMAND_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_EMAIL_INVALID"] = 8210] = "ANASTASIS_EMAIL_INVALID";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_EMAIL_HELPER_EXEC_FAILED"] = 8211] = "ANASTASIS_EMAIL_HELPER_EXEC_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_EMAIL_HELPER_COMMAND_FAILED"] = 8212] = "ANASTASIS_EMAIL_HELPER_COMMAND_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_POST_INVALID"] = 8220] = "ANASTASIS_POST_INVALID";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_POST_HELPER_EXEC_FAILED"] = 8221] = "ANASTASIS_POST_HELPER_EXEC_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_POST_HELPER_COMMAND_FAILED"] = 8222] = "ANASTASIS_POST_HELPER_COMMAND_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_IBAN_INVALID"] = 8230] = "ANASTASIS_IBAN_INVALID";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_IBAN_MISSING_TRANSFER"] = 8231] = "ANASTASIS_IBAN_MISSING_TRANSFER";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TOTP_KEY_MISSING"] = 8240] = "ANASTASIS_TOTP_KEY_MISSING";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_TOTP_KEY_INVALID"] = 8241] = "ANASTASIS_TOTP_KEY_INVALID";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_POLICY_BAD_IF_NONE_MATCH"] = 8301] = "ANASTASIS_POLICY_BAD_IF_NONE_MATCH";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_POLICY_OUT_OF_MEMORY_ON_CONTENT_LENGTH"] = 8304] = "ANASTASIS_POLICY_OUT_OF_MEMORY_ON_CONTENT_LENGTH";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_POLICY_BAD_SIGNATURE"] = 8305] = "ANASTASIS_POLICY_BAD_SIGNATURE";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_POLICY_BAD_IF_MATCH"] = 8306] = "ANASTASIS_POLICY_BAD_IF_MATCH";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_POLICY_INVALID_UPLOAD"] = 8307] = "ANASTASIS_POLICY_INVALID_UPLOAD";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_POLICY_NOT_FOUND"] = 8350] = "ANASTASIS_POLICY_NOT_FOUND";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_ACTION_INVALID"] = 8400] = "ANASTASIS_REDUCER_ACTION_INVALID";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_STATE_INVALID"] = 8401] = "ANASTASIS_REDUCER_STATE_INVALID";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_INPUT_INVALID"] = 8402] = "ANASTASIS_REDUCER_INPUT_INVALID";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_AUTHENTICATION_METHOD_NOT_SUPPORTED"] = 8403] = "ANASTASIS_REDUCER_AUTHENTICATION_METHOD_NOT_SUPPORTED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_INPUT_INVALID_FOR_STATE"] = 8404] = "ANASTASIS_REDUCER_INPUT_INVALID_FOR_STATE";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_BACKEND_FAILURE"] = 8405] = "ANASTASIS_REDUCER_BACKEND_FAILURE";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_RESOURCE_MALFORMED"] = 8406] = "ANASTASIS_REDUCER_RESOURCE_MALFORMED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_RESOURCE_MISSING"] = 8407] = "ANASTASIS_REDUCER_RESOURCE_MISSING";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_INPUT_REGEX_FAILED"] = 8408] = "ANASTASIS_REDUCER_INPUT_REGEX_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_INPUT_VALIDATION_FAILED"] = 8409] = "ANASTASIS_REDUCER_INPUT_VALIDATION_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_POLICY_LOOKUP_FAILED"] = 8410] = "ANASTASIS_REDUCER_POLICY_LOOKUP_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_BACKUP_PROVIDER_FAILED"] = 8411] = "ANASTASIS_REDUCER_BACKUP_PROVIDER_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED"] = 8412] = "ANASTASIS_REDUCER_PROVIDER_CONFIG_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_POLICY_MALFORMED"] = 8413] = "ANASTASIS_REDUCER_POLICY_MALFORMED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_NETWORK_FAILED"] = 8414] = "ANASTASIS_REDUCER_NETWORK_FAILED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_SECRET_MALFORMED"] = 8415] = "ANASTASIS_REDUCER_SECRET_MALFORMED";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_CHALLENGE_DATA_TOO_BIG"] = 8416] = "ANASTASIS_REDUCER_CHALLENGE_DATA_TOO_BIG";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_SECRET_TOO_BIG"] = 8417] = "ANASTASIS_REDUCER_SECRET_TOO_BIG";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_PROVIDER_INVALID_CONFIG"] = 8418] = "ANASTASIS_REDUCER_PROVIDER_INVALID_CONFIG";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_INTERNAL_ERROR"] = 8419] = "ANASTASIS_REDUCER_INTERNAL_ERROR";
TalerErrorCode2[TalerErrorCode2["ANASTASIS_REDUCER_PROVIDERS_ALREADY_SYNCED"] = 8420] = "ANASTASIS_REDUCER_PROVIDERS_ALREADY_SYNCED";
TalerErrorCode2[TalerErrorCode2["LIBEUFIN_NEXUS_GENERIC_ERROR"] = 9e3] = "LIBEUFIN_NEXUS_GENERIC_ERROR";
TalerErrorCode2[TalerErrorCode2["LIBEUFIN_NEXUS_UNCAUGHT_EXCEPTION"] = 9001] = "LIBEUFIN_NEXUS_UNCAUGHT_EXCEPTION";
TalerErrorCode2[TalerErrorCode2["LIBEUFIN_SANDBOX_GENERIC_ERROR"] = 9500] = "LIBEUFIN_SANDBOX_GENERIC_ERROR";
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 = {}));
// ../taler-util/lib/codec.js
var DecodingError = class extends Error {
constructor(message) {
super(message);
Object.setPrototypeOf(this, DecodingError.prototype);
this.name = "DecodingError";
}
};
function renderContext(c4) {
const p4 = c4 == null ? void 0 : c4.path;
if (p4) {
return p4.join(".");
} else {
return "(unknown)";
}
}
function joinContext(c4, part) {
var _a;
const path = (_a = c4 == null ? void 0 : c4.path) != null ? _a : [];
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 codecForMap(innerCodec) {
if (!innerCodec) {
throw Error("inner codec must be defined");
}
return {
decode(x6, c4) {
const map3 = {};
if (typeof x6 !== "object") {
throw new DecodingError(`expected object at ${renderContext(c4)}`);
}
for (const i4 in x6) {
map3[i4] = innerCodec.decode(x6[i4], joinContext(c4, `[${i4}]`));
}
return map3;
}
};
}
function codecForNumber() {
return {
decode(x6, c4) {
if (typeof x6 === "number") {
return x6;
}
throw new DecodingError(`expected number at ${renderContext(c4)} but got ${typeof x6}`);
}
};
}
function codecForBoolean() {
return {
decode(x6, c4) {
if (typeof x6 === "boolean") {
return x6;
}
throw new DecodingError(`expected boolean at ${renderContext(c4)} but got ${typeof x6}`);
}
};
}
function codecForString() {
return {
decode(x6, c4) {
if (typeof x6 === "string") {
return x6;
}
throw new DecodingError(`expected string at ${renderContext(c4)} but got ${typeof x6}`);
}
};
}
function codecForAny() {
return {
decode(x6, c4) {
return x6;
}
};
}
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) {
for (const alt of alts) {
try {
return alt.decode(x6, c4);
} catch (e4) {
continue;
}
}
throw new DecodingError(`No alternative matched at at ${renderContext(c4)}`);
}
};
}
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");
}
static currencyOf(amount) {
const amt = Amounts.parseOrThrow(amount);
return amt.currency;
}
static zeroOfAmount(amount) {
const amt = Amounts.parseOrThrow(amount);
return {
currency: amt.currency,
fraction: 0,
value: 0
};
}
/**
* Get an amount that represents zero units of a currency.
*/
static zeroOfCurrency(currency) {
return {
currency,
fraction: 0,
value: 0
};
}
static jsonifyAmount(amt) {
if (typeof amt === "string") {
return Amounts.parseOrThrow(amt);
}
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");
}
const jsonAmounts = amounts.map((x6) => Amounts.jsonifyAmount(x6));
return Amounts.add(jsonAmounts[0], ...jsonAmounts.slice(1));
}
static sumOrZero(currency, amounts) {
if (amounts.length <= 0) {
return {
amount: Amounts.zeroOfCurrency(currency),
saturated: false
};
}
const jsonAmounts = amounts.map((x6) => Amounts.jsonifyAmount(x6));
return Amounts.add(jsonAmounts[0], ...jsonAmounts.slice(1));
}
/**
* Add two amounts. Return the result and whether
* the addition overflowed. The overflow is always handled
* by saturating and never by wrapping.
*
* Throws when currencies don't match.
*/
static add(first, ...rest) {
const firstJ = Amounts.jsonifyAmount(first);
const currency = firstJ.currency;
let value = firstJ.value + Math.floor(firstJ.fraction / amountFractionalBase);
if (value > amountMaxValue) {
return {
amount: {
currency,
value: amountMaxValue,
fraction: amountFractionalBase - 1
},
saturated: true
};
}
let fraction = firstJ.fraction % amountFractionalBase;
for (const x6 of rest) {
const xJ = Amounts.jsonifyAmount(x6);
if (xJ.currency.toUpperCase() !== currency.toUpperCase()) {
throw Error(`Mismatched currency: ${xJ.currency} and ${currency}`);
}
value = value + xJ.value + Math.floor((fraction + xJ.fraction) / amountFractionalBase);
fraction = Math.floor((fraction + xJ.fraction) % amountFractionalBase);
if (value > amountMaxValue) {
return {
amount: {
currency,
value: amountMaxValue,
fraction: amountFractionalBase - 1
},
saturated: true
};
}
}
return { amount: { currency, value, fraction }, saturated: false };
}
/**
* Subtract two amounts. Return the result and whether
* the subtraction overflowed. The overflow is always handled
* by saturating and never by wrapping.
*
* Throws when currencies don't match.
*/
static sub(a5, ...rest) {
const aJ = Amounts.jsonifyAmount(a5);
const currency = aJ.currency;
let value = aJ.value;
let fraction = aJ.fraction;
for (const b4 of rest) {
const bJ = Amounts.jsonifyAmount(b4);
if (bJ.currency.toUpperCase() !== aJ.currency.toUpperCase()) {
throw Error(`Mismatched currency: ${bJ.currency} and ${currency}`);
}
if (fraction < bJ.fraction) {
if (value < 1) {
return {
amount: { currency, value: 0, fraction: 0 },
saturated: true
};
}
value--;
fraction += amountFractionalBase;
}
console.assert(fraction >= bJ.fraction);
fraction -= bJ.fraction;
if (value < bJ.value) {
return { amount: { currency, value: 0, fraction: 0 }, saturated: true };
}
value -= bJ.value;
}
return { amount: { currency, value, fraction }, saturated: false };
}
/**
* Compare two amounts. Returns 0 when equal, -1 when a < b
* and +1 when a > b. Throws when currencies don't match.
*/
static cmp(a5, b4) {
a5 = Amounts.jsonifyAmount(a5);
b4 = Amounts.jsonifyAmount(b4);
if (a5.currency !== b4.currency) {
throw Error(`Mismatched currency: ${a5.currency} and ${b4.currency}`);
}
const av = a5.value + Math.floor(a5.fraction / amountFractionalBase);
const af = a5.fraction % amountFractionalBase;
const bv = b4.value + Math.floor(b4.fraction / amountFractionalBase);
const bf = b4.fraction % amountFractionalBase;
switch (true) {
case av < bv:
return -1;
case av > bv:
return 1;
case af < bf:
return -1;
case af > bf:
return 1;
case af === bf:
return 0;
default:
throw Error("assertion failed");
}
}
/**
* Create a copy of an amount.
*/
static copy(a5) {
return {
currency: a5.currency,
fraction: a5.fraction,
value: a5.value
};
}
/**
* Divide an amount. Throws on division by zero.
*/
static divide(a5, n2) {
if (n2 === 0) {
throw Error(`Division by 0`);
}
if (n2 === 1) {
return { value: a5.value, fraction: a5.fraction, currency: a5.currency };
}
const r3 = a5.value % n2;
return {
currency: a5.currency,
fraction: Math.floor((r3 * amountFractionalBase + a5.fraction) / n2),
value: Math.floor(a5.value / n2)
};
}
/**
* Check if an amount is non-zero.
*/
static isNonZero(a5) {
a5 = Amounts.jsonifyAmount(a5);
return a5.value > 0 || a5.fraction > 0;
}
static isZero(a5) {
a5 = Amounts.jsonifyAmount(a5);
return a5.value === 0 && a5.fraction === 0;
}
/**
* Parse an amount like 'EUR:20.5' for 20 Euros and 50 ct.
*/
static parse(s5) {
const res = s5.match(/^([a-zA-Z0-9_*-]+):([0-9]+)([.][0-9]+)?$/);
if (!res) {
return void 0;
}
const tail = res[3] || ".0";
if (tail.length > amountFractionalLength + 1) {
return void 0;
}
const value = Number.parseInt(res[2]);
if (value > amountMaxValue) {
return void 0;
}
return {
currency: res[1].toUpperCase(),
fraction: Math.round(amountFractionalBase * Number.parseFloat(tail)),
value
};
}
/**
* Parse amount in standard string form (like 'EUR:20.5'),
* throw if the input is not a valid amount.
*/
static parseOrThrow(s5) {
if (typeof s5 === "object") {
if (typeof s5.currency !== "string") {
throw Error("invalid amount object");
}
if (typeof s5.value !== "number") {
throw Error("invalid amount object");
}
if (typeof s5.fraction !== "number") {
throw Error("invalid amount object");
}
return { currency: s5.currency, value: s5.value, fraction: s5.fraction };
} else if (typeof s5 === "string") {
const res = Amounts.parse(s5);
if (!res) {
throw Error(`Can't parse amount: "${s5}"`);
}
return res;
} else {
throw Error("invalid amount (illegal type)");
}
}
static min(a5, b4) {
const cr = Amounts.cmp(a5, b4);
if (cr >= 0) {
return Amounts.jsonifyAmount(b4);
} else {
return Amounts.jsonifyAmount(a5);
}
}
static max(a5, b4) {
const cr = Amounts.cmp(a5, b4);
if (cr >= 0) {
return Amounts.jsonifyAmount(a5);
} else {
return Amounts.jsonifyAmount(b4);
}
}
static mult(a5, n2) {
a5 = this.jsonifyAmount(a5);
if (!Number.isInteger(n2)) {
throw Error("amount can only be multipied by an integer");
}
if (n2 < 0) {
throw Error("amount can only be multiplied by a positive integer");
}
if (n2 == 0) {
return {
amount: Amounts.zeroOfCurrency(a5.currency),
saturated: false
};
}
let x6 = a5;
let acc = Amounts.zeroOfCurrency(a5.currency);
while (n2 > 1) {
if (n2 % 2 == 0) {
n2 = n2 / 2;
} else {
n2 = (n2 - 1) / 2;
const r23 = Amounts.add(acc, x6);
if (r23.saturated) {
return r23;
}
acc = r23.amount;
}
const r22 = Amounts.add(x6, x6);
if (r22.saturated) {
return r22;
}
x6 = r22.amount;
}
return Amounts.add(acc, x6);
}
/**
* Check if the argument is a valid amount in string form.
*/
static check(a5) {
if (typeof a5 !== "string") {
return false;
}
try {
const parsedAmount = Amounts.parse(a5);
return !!parsedAmount;
} catch (e4) {
return false;
}
}
/**
* Convert to standard human-readable string representation that's
* also used in JSON formats.
*/
static stringify(a5) {
a5 = Amounts.jsonifyAmount(a5);
const s5 = this.stringifyValue(a5);
return `${a5.currency}:${s5}`;
}
static isSameCurrency(a1, a22) {
const x1 = this.jsonifyAmount(a1);
const x22 = this.jsonifyAmount(a22);
return x1.currency.toUpperCase() === x22.currency.toUpperCase();
}
static stringifyValue(a5, minFractional = 0) {
const aJ = Amounts.jsonifyAmount(a5);
const av = aJ.value + Math.floor(aJ.fraction / amountFractionalBase);
const af = aJ.fraction % amountFractionalBase;
let s5 = av.toString();
if (af || minFractional) {
s5 = s5 + ".";
let n2 = af;
for (let i4 = 0; i4 < amountFractionalLength; i4++) {
if (!n2 && i4 >= minFractional) {
break;
}
s5 = s5 + Math.floor(n2 / amountFractionalBase * 10).toString();
n2 = n2 * 10 % amountFractionalBase;
}
}
return s5;
}
/**
* Number of fractional digits needed to fully represent the amount
* @param a amount
* @returns
*/
static maxFractionalDigits(a5) {
if (a5.fraction === 0)
return 0;
if (a5.fraction < 0) {
console.error("amount fraction can not be negative", a5);
return 0;
}
let i4 = 0;
let check = true;
let rest = a5.fraction;
while (rest > 0 && check) {
check = rest % 10 === 0;
rest = rest / 10;
i4++;
}
return amountFractionalLength - i4 + 1;
}
};
// ../taler-util/lib/punycode.js
var maxInt = 2147483647;
var base = 36;
var tMin = 1;
var tMax = 26;
var skew = 38;
var damp = 700;
var initialBias = 72;
var initialN = 128;
var delimiter = "-";
var regexPunycode = /^xn--/;
var regexNonASCII = /[^\0-\x7E]/;
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g;
var errors = {
overflow: "Overflow: input needs wider integers to process",
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
"invalid-input": "Invalid input"
};
var baseMinusTMin = base - tMin;
var floor = Math.floor;
var stringFromCharCode = String.fromCharCode;
function error(type) {
throw new RangeError(errors[type]);
}
function map(array2, fn2) {
const result = [];
let length = array2.length;
while (length--) {
result[length] = fn2(array2[length]);
}
return result;
}
function mapDomain(string2, fn2) {
const parts = string2.split("@");
let result = "";
if (parts.length > 1) {
result = parts[0] + "@";
string2 = parts[1];
}
string2 = string2.replace(regexSeparators, ".");
const labels = string2.split(".");
const encoded = map(labels, fn2).join(".");
return result + encoded;
}
function ucs2decode(string2) {
const output = [];
let counter2 = 0;
const length = string2.length;
while (counter2 < length) {
const value = string2.charCodeAt(counter2++);
if (value >= 55296 && value <= 56319 && counter2 < length) {
const extra = string2.charCodeAt(counter2++);
if ((extra & 64512) == 56320) {
output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
} else {
output.push(value);
counter2--;
}
} else {
output.push(value);
}
}
return output;
}
var ucs2encode = (array2) => String.fromCodePoint(...array2);
var basicToDigit = function(codePoint) {
if (codePoint - 48 < 10) {
return codePoint - 22;
}
if (codePoint - 65 < 26) {
return codePoint - 65;
}
if (codePoint - 97 < 26) {
return codePoint - 97;
}
return base;
};
var digitToBasic = function(digit, flag) {
return digit + 22 + 75 * Number(digit < 26) - (Number(flag != 0) << 5);
};
var adapt = function(delta, numPoints, firstTime) {
let k5 = 0;
delta = firstTime ? floor(delta / damp) : delta >> 1;
delta += floor(delta / numPoints);
for (
;
/* no initialization */
delta > baseMinusTMin * tMax >> 1;
k5 += base
) {
delta = floor(delta / baseMinusTMin);
}
return floor(k5 + (baseMinusTMin + 1) * delta / (delta + skew));
};
var decode = function(input) {
const output = [];
const inputLength = input.length;
let i4 = 0;
let n2 = initialN;
let bias = initialBias;
let basic = input.lastIndexOf(delimiter);
if (basic < 0) {
basic = 0;
}
for (let j4 = 0; j4 < basic; ++j4) {
if (input.charCodeAt(j4) >= 128) {
error("not-basic");
}
output.push(input.charCodeAt(j4));
}
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
let oldi = i4;
for (let w5 = 1, k5 = base; ; k5 += base) {
if (index >= inputLength) {
error("invalid-input");
}
const digit = basicToDigit(input.charCodeAt(index++));
if (digit >= base || digit > floor((maxInt - i4) / w5)) {
error("overflow");
}
i4 += digit * w5;
const t4 = k5 <= bias ? tMin : k5 >= bias + tMax ? tMax : k5 - bias;
if (digit < t4) {
break;
}
const baseMinusT = base - t4;
if (w5 > floor(maxInt / baseMinusT)) {
error("overflow");
}
w5 *= baseMinusT;
}
const out = output.length + 1;
bias = adapt(i4 - oldi, out, oldi == 0);
if (floor(i4 / out) > maxInt - n2) {
error("overflow");
}
n2 += floor(i4 / out);
i4 %= out;
output.splice(i4++, 0, n2);
}
return String.fromCodePoint(...output);
};
var encode = function(inputArg) {
const output = [];
let input = ucs2decode(inputArg);
let inputLength = input.length;
let n2 = initialN;
let delta = 0;
let bias = initialBias;
for (const currentValue of input) {
if (currentValue < 128) {
output.push(stringFromCharCode(currentValue));
}
}
let basicLength = output.length;
let handledCPCount = basicLength;
if (basicLength) {
output.push(delimiter);
}
while (handledCPCount < inputLength) {
let m5 = maxInt;
for (const currentValue of input) {
if (currentValue >= n2 && currentValue < m5) {
m5 = currentValue;
}
}
const handledCPCountPlusOne = handledCPCount + 1;
if (m5 - n2 > floor((maxInt - delta) / handledCPCountPlusOne)) {
error("overflow");
}
delta += (m5 - n2) * handledCPCountPlusOne;
n2 = m5;
for (const currentValue of input) {
if (currentValue < n2 && ++delta > maxInt) {
error("overflow");
}
if (currentValue == n2) {
let q5 = delta;
for (let k5 = base; ; k5 += base) {
const t4 = k5 <= bias ? tMin : k5 >= bias + tMax ? tMax : k5 - bias;
if (q5 < t4) {
break;
}
const qMinusT = q5 - t4;
const baseMinusT = base - t4;
output.push(stringFromCharCode(digitToBasic(t4 + qMinusT % baseMinusT, 0)));
q5 = floor(qMinusT / baseMinusT);
}
output.push(stringFromCharCode(digitToBasic(q5, 0)));
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
delta = 0;
++handledCPCount;
}
}
++delta;
++n2;
}
return output.join("");
};
var toUnicode = function(input) {
return mapDomain(input, function(string2) {
return regexPunycode.test(string2) ? decode(string2.slice(4).toLowerCase()) : string2;
});
};
var toASCII = function(input) {
return mapDomain(input, function(string2) {
return regexNonASCII.test(string2) ? "xn--" + encode(string2) : string2;
});
};
var punycode = {
/**
* A string representing the current Punycode.js version number.
* @memberOf punycode
* @type String
*/
version: "2.1.0",
/**
* An object of methods to convert from JavaScript's internal character
* representation (UCS-2) to Unicode code points, and back.
* @see
* @memberOf punycode
* @type Object
*/
ucs2: {
decode: ucs2decode,
encode: ucs2encode
},
decode,
encode,
toASCII,
toUnicode
};
// ../taler-util/lib/whatwg-url.js
var utf8Encoder = new TextEncoder();
var utf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
function utf8Encode(string2) {
return utf8Encoder.encode(string2);
}
function utf8DecodeWithoutBOM(bytes) {
return utf8Decoder.decode(bytes);
}
function parseUrlencoded(input) {
const sequences = strictlySplitByteSequence(input, p("&"));
const output = [];
for (const bytes of sequences) {
if (bytes.length === 0) {
continue;
}
let name, value;
const indexOfEqual = bytes.indexOf(p("="));
if (indexOfEqual >= 0) {
name = bytes.slice(0, indexOfEqual);
value = bytes.slice(indexOfEqual + 1);
} else {
name = bytes;
value = new Uint8Array(0);
}
name = replaceByteInByteSequence(name, 43, 32);
value = replaceByteInByteSequence(value, 43, 32);
const nameString = utf8DecodeWithoutBOM(percentDecodeBytes(name));
const valueString = utf8DecodeWithoutBOM(percentDecodeBytes(value));
output.push([nameString, valueString]);
}
return output;
}
function parseUrlencodedString(input) {
return parseUrlencoded(utf8Encode(input));
}
function serializeUrlencoded(tuples, encodingOverride = void 0) {
let encoding = "utf-8";
if (encodingOverride !== void 0) {
encoding = encodingOverride;
}
let output = "";
for (const [i4, tuple] of tuples.entries()) {
const name = utf8PercentEncodeString(tuple[0], isURLEncodedPercentEncode, true);
let value = tuple[1];
if (tuple.length > 2 && tuple[2] !== void 0) {
if (tuple[2] === "hidden" && name === "_charset_") {
value = encoding;
} else if (tuple[2] === "file") {
value = value.name;
}
}
value = utf8PercentEncodeString(value, isURLEncodedPercentEncode, true);
if (i4 !== 0) {
output += "&";
}
output += `${name}=${value}`;
}
return output;
}
function strictlySplitByteSequence(buf, cp) {
const list = [];
let last = 0;
let i4 = buf.indexOf(cp);
while (i4 >= 0) {
list.push(buf.slice(last, i4));
last = i4 + 1;
i4 = buf.indexOf(cp, last);
}
if (last !== buf.length) {
list.push(buf.slice(last));
}
return list;
}
function replaceByteInByteSequence(buf, from, to) {
let i4 = buf.indexOf(from);
while (i4 >= 0) {
buf[i4] = to;
i4 = buf.indexOf(from, i4 + 1);
}
return buf;
}
function p(char) {
return char.codePointAt(0);
}
function percentEncode(c4) {
let hex = c4.toString(16).toUpperCase();
if (hex.length === 1) {
hex = `0${hex}`;
}
return `%${hex}`;
}
function percentDecodeBytes(input) {
const output = new Uint8Array(input.byteLength);
let outputIndex = 0;
for (let i4 = 0; i4 < input.byteLength; ++i4) {
const byte = input[i4];
if (byte !== 37) {
output[outputIndex++] = byte;
} else if (byte === 37 && (!isASCIIHex(input[i4 + 1]) || !isASCIIHex(input[i4 + 2]))) {
output[outputIndex++] = byte;
} else {
const bytePoint = parseInt(String.fromCodePoint(input[i4 + 1], input[i4 + 2]), 16);
output[outputIndex++] = bytePoint;
i4 += 2;
}
}
return output.slice(0, outputIndex);
}
function percentDecodeString(input) {
const bytes = utf8Encode(input);
return percentDecodeBytes(bytes);
}
function isC0ControlPercentEncode(c4) {
return c4 <= 31 || c4 > 126;
}
var extraFragmentPercentEncodeSet = /* @__PURE__ */ new Set([
p(" "),
p('"'),
p("<"),
p(">"),
p("`")
]);
function isFragmentPercentEncode(c4) {
return isC0ControlPercentEncode(c4) || extraFragmentPercentEncodeSet.has(c4);
}
var extraQueryPercentEncodeSet = /* @__PURE__ */ new Set([
p(" "),
p('"'),
p("#"),
p("<"),
p(">")
]);
function isQueryPercentEncode(c4) {
return isC0ControlPercentEncode(c4) || extraQueryPercentEncodeSet.has(c4);
}
function isSpecialQueryPercentEncode(c4) {
return isQueryPercentEncode(c4) || c4 === p("'");
}
var extraPathPercentEncodeSet = /* @__PURE__ */ new Set([p("?"), p("`"), p("{"), p("}")]);
function isPathPercentEncode(c4) {
return isQueryPercentEncode(c4) || extraPathPercentEncodeSet.has(c4);
}
var extraUserinfoPercentEncodeSet = /* @__PURE__ */ new Set([
p("/"),
p(":"),
p(";"),
p("="),
p("@"),
p("["),
p("\\"),
p("]"),
p("^"),
p("|")
]);
function isUserinfoPercentEncode(c4) {
return isPathPercentEncode(c4) || extraUserinfoPercentEncodeSet.has(c4);
}
var extraComponentPercentEncodeSet = /* @__PURE__ */ new Set([
p("$"),
p("%"),
p("&"),
p("+"),
p(",")
]);
function isComponentPercentEncode(c4) {
return isUserinfoPercentEncode(c4) || extraComponentPercentEncodeSet.has(c4);
}
var extraURLEncodedPercentEncodeSet = /* @__PURE__ */ new Set([
p("!"),
p("'"),
p("("),
p(")"),
p("~")
]);
function isURLEncodedPercentEncode(c4) {
return isComponentPercentEncode(c4) || extraURLEncodedPercentEncodeSet.has(c4);
}
function utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate) {
const bytes = utf8Encode(codePoint);
let output = "";
for (const byte of bytes) {
if (!percentEncodePredicate(byte)) {
output += String.fromCharCode(byte);
} else {
output += percentEncode(byte);
}
}
return output;
}
function utf8PercentEncodeCodePoint(codePoint, percentEncodePredicate) {
return utf8PercentEncodeCodePointInternal(String.fromCodePoint(codePoint), percentEncodePredicate);
}
function utf8PercentEncodeString(input, percentEncodePredicate, spaceAsPlus = false) {
let output = "";
for (const codePoint of input) {
if (spaceAsPlus && codePoint === " ") {
output += "+";
} else {
output += utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate);
}
}
return output;
}
function isASCIIDigit(c4) {
return c4 >= 48 && c4 <= 57;
}
function isASCIIAlpha(c4) {
return c4 >= 65 && c4 <= 90 || c4 >= 97 && c4 <= 122;
}
function isASCIIAlphanumeric(c4) {
return isASCIIAlpha(c4) || isASCIIDigit(c4);
}
function isASCIIHex(c4) {
return isASCIIDigit(c4) || c4 >= 65 && c4 <= 70 || c4 >= 97 && c4 <= 102;
}
var URLSearchParamsImpl = class {
constructor(init, { doNotStripQMark = false } = {}) {
this._list = [];
this._url = null;
if (!doNotStripQMark && typeof init === "string" && init[0] === "?") {
init = init.slice(1);
}
if (Array.isArray(init)) {
for (const pair of init) {
if (pair.length !== 2) {
throw new TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element does not contain exactly two elements.");
}
this._list.push([pair[0], pair[1]]);
}
} else if (typeof init === "object" && Object.getPrototypeOf(init) === null) {
for (const name of Object.keys(init)) {
const value = init[name];
this._list.push([name, value]);
}
} else {
this._list = parseUrlencodedString(init);
}
}
_updateSteps() {
if (this._url !== null) {
let query = serializeUrlencoded(this._list);
if (query === "") {
query = null;
}
this._url._url.query = query;
}
}
append(name, value) {
this._list.push([name, value]);
this._updateSteps();
}
delete(name) {
let i4 = 0;
while (i4 < this._list.length) {
if (this._list[i4][0] === name) {
this._list.splice(i4, 1);
} else {
i4++;
}
}
this._updateSteps();
}
get(name) {
for (const tuple of this._list) {
if (tuple[0] === name) {
return tuple[1];
}
}
return null;
}
getAll(name) {
const output = [];
for (const tuple of this._list) {
if (tuple[0] === name) {
output.push(tuple[1]);
}
}
return output;
}
forEach(callbackfn, thisArg) {
for (const tuple of this._list) {
callbackfn.call(thisArg, tuple[1], tuple[0], this);
}
}
has(name) {
for (const tuple of this._list) {
if (tuple[0] === name) {
return true;
}
}
return false;
}
set(name, value) {
let found = false;
let i4 = 0;
while (i4 < this._list.length) {
if (this._list[i4][0] === name) {
if (found) {
this._list.splice(i4, 1);
} else {
found = true;
this._list[i4][1] = value;
i4++;
}
} else {
i4++;
}
}
if (!found) {
this._list.push([name, value]);
}
this._updateSteps();
}
sort() {
this._list.sort((a5, b4) => {
if (a5[0] < b4[0]) {
return -1;
}
if (a5[0] > b4[0]) {
return 1;
}
return 0;
});
this._updateSteps();
}
[Symbol.iterator]() {
return this._list[Symbol.iterator]();
}
toString() {
return serializeUrlencoded(this._list);
}
};
var specialSchemes = {
ftp: 21,
file: null,
http: 80,
https: 443,
ws: 80,
wss: 443
};
var failure = Symbol("failure");
function countSymbols(str) {
return [...str].length;
}
function at(input, idx) {
const c4 = input[idx];
return isNaN(c4) ? void 0 : String.fromCodePoint(c4);
}
function isSingleDot(buffer) {
return buffer === "." || buffer.toLowerCase() === "%2e";
}
function isDoubleDot(buffer) {
buffer = buffer.toLowerCase();
return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e";
}
function isWindowsDriveLetterCodePoints(cp1, cp2) {
return isASCIIAlpha(cp1) && (cp2 === p(":") || cp2 === p("|"));
}
function isWindowsDriveLetterString(string2) {
return string2.length === 2 && isASCIIAlpha(string2.codePointAt(0)) && (string2[1] === ":" || string2[1] === "|");
}
function isNormalizedWindowsDriveLetterString(string2) {
return string2.length === 2 && isASCIIAlpha(string2.codePointAt(0)) && string2[1] === ":";
}
function containsForbiddenHostCodePoint(string2) {
return string2.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u) !== -1;
}
function containsForbiddenDomainCodePoint(string2) {
return containsForbiddenHostCodePoint(string2) || string2.search(/[\u0000-\u001F]|%|\u007F/u) !== -1;
}
function isSpecialScheme(scheme) {
return specialSchemes[scheme] !== void 0;
}
function isSpecial(url) {
return isSpecialScheme(url.scheme);
}
function isNotSpecial(url) {
return !isSpecialScheme(url.scheme);
}
function defaultPort(scheme) {
return specialSchemes[scheme];
}
function parseIPv4Number(input) {
if (input === "") {
return failure;
}
let R3 = 10;
if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") {
input = input.substring(2);
R3 = 16;
} else if (input.length >= 2 && input.charAt(0) === "0") {
input = input.substring(1);
R3 = 8;
}
if (input === "") {
return 0;
}
let regex = /[^0-7]/u;
if (R3 === 10) {
regex = /[^0-9]/u;
}
if (R3 === 16) {
regex = /[^0-9A-Fa-f]/u;
}
if (regex.test(input)) {
return failure;
}
return parseInt(input, R3);
}
function parseIPv4(input) {
const parts = input.split(".");
if (parts[parts.length - 1] === "") {
if (parts.length > 1) {
parts.pop();
}
}
if (parts.length > 4) {
return failure;
}
const numbers = [];
for (const part of parts) {
const n2 = parseIPv4Number(part);
if (n2 === failure) {
return failure;
}
numbers.push(n2);
}
for (let i4 = 0; i4 < numbers.length - 1; ++i4) {
if (numbers[i4] > 255) {
return failure;
}
}
if (numbers[numbers.length - 1] >= __pow(256, 5 - numbers.length)) {
return failure;
}
let ipv4 = numbers.pop();
let counter2 = 0;
for (const n2 of numbers) {
ipv4 += n2 * __pow(256, 3 - counter2);
++counter2;
}
return ipv4;
}
function serializeIPv4(address) {
let output = "";
let n2 = address;
for (let i4 = 1; i4 <= 4; ++i4) {
output = String(n2 % 256) + output;
if (i4 !== 4) {
output = `.${output}`;
}
n2 = Math.floor(n2 / 256);
}
return output;
}
function parseIPv6(inputArg) {
const address = [0, 0, 0, 0, 0, 0, 0, 0];
let pieceIndex = 0;
let compress = null;
let pointer = 0;
const input = Array.from(inputArg, (c4) => c4.codePointAt(0));
if (input[pointer] === p(":")) {
if (input[pointer + 1] !== p(":")) {
return failure;
}
pointer += 2;
++pieceIndex;
compress = pieceIndex;
}
while (pointer < input.length) {
if (pieceIndex === 8) {
return failure;
}
if (input[pointer] === p(":")) {
if (compress !== null) {
return failure;
}
++pointer;
++pieceIndex;
compress = pieceIndex;
continue;
}
let value = 0;
let length = 0;
while (length < 4 && isASCIIHex(input[pointer])) {
value = value * 16 + parseInt(at(input, pointer), 16);
++pointer;
++length;
}
if (input[pointer] === p(".")) {
if (length === 0) {
return failure;
}
pointer -= length;
if (pieceIndex > 6) {
return failure;
}
let numbersSeen = 0;
while (input[pointer] !== void 0) {
let ipv4Piece = null;
if (numbersSeen > 0) {
if (input[pointer] === p(".") && numbersSeen < 4) {
++pointer;
} else {
return failure;
}
}
if (!isASCIIDigit(input[pointer])) {
return failure;
}
while (isASCIIDigit(input[pointer])) {
const number2 = parseInt(at(input, pointer));
if (ipv4Piece === null) {
ipv4Piece = number2;
} else if (ipv4Piece === 0) {
return failure;
} else {
ipv4Piece = ipv4Piece * 10 + number2;
}
if (ipv4Piece > 255) {
return failure;
}
++pointer;
}
address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
++numbersSeen;
if (numbersSeen === 2 || numbersSeen === 4) {
++pieceIndex;
}
}
if (numbersSeen !== 4) {
return failure;
}
break;
} else if (input[pointer] === p(":")) {
++pointer;
if (input[pointer] === void 0) {
return failure;
}
} else if (input[pointer] !== void 0) {
return failure;
}
address[pieceIndex] = value;
++pieceIndex;
}
if (compress !== null) {
let swaps = pieceIndex - compress;
pieceIndex = 7;
while (pieceIndex !== 0 && swaps > 0) {
const temp = address[compress + swaps - 1];
address[compress + swaps - 1] = address[pieceIndex];
address[pieceIndex] = temp;
--pieceIndex;
--swaps;
}
} else if (compress === null && pieceIndex !== 8) {
return failure;
}
return address;
}
function serializeIPv6(address) {
let output = "";
const compress = findLongestZeroSequence(address);
let ignore0 = false;
for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) {
if (ignore0 && address[pieceIndex] === 0) {
continue;
} else if (ignore0) {
ignore0 = false;
}
if (compress === pieceIndex) {
const separator = pieceIndex === 0 ? "::" : ":";
output += separator;
ignore0 = true;
continue;
}
output += address[pieceIndex].toString(16);
if (pieceIndex !== 7) {
output += ":";
}
}
return output;
}
function parseHost(input, isNotSpecialArg = false) {
if (input[0] === "[") {
if (input[input.length - 1] !== "]") {
return failure;
}
return parseIPv6(input.substring(1, input.length - 1));
}
if (isNotSpecialArg) {
return parseOpaqueHost(input);
}
const domain = utf8DecodeWithoutBOM(percentDecodeString(input));
const asciiDomain = domainToASCII(domain);
if (asciiDomain === failure) {
return failure;
}
if (containsForbiddenDomainCodePoint(asciiDomain)) {
return failure;
}
if (endsInANumber(asciiDomain)) {
return parseIPv4(asciiDomain);
}
return asciiDomain;
}
function endsInANumber(input) {
const parts = input.split(".");
if (parts[parts.length - 1] === "") {
if (parts.length === 1) {
return false;
}
parts.pop();
}
const last = parts[parts.length - 1];
if (parseIPv4Number(last) !== failure) {
return true;
}
if (/^[0-9]+$/u.test(last)) {
return true;
}
return false;
}
function parseOpaqueHost(input) {
if (containsForbiddenHostCodePoint(input)) {
return failure;
}
return utf8PercentEncodeString(input, isC0ControlPercentEncode);
}
function findLongestZeroSequence(arr) {
let maxIdx = null;
let maxLen = 1;
let currStart = null;
let currLen = 0;
for (let i4 = 0; i4 < arr.length; ++i4) {
if (arr[i4] !== 0) {
if (currLen > maxLen) {
maxIdx = currStart;
maxLen = currLen;
}
currStart = null;
currLen = 0;
} else {
if (currStart === null) {
currStart = i4;
}
++currLen;
}
}
if (currLen > maxLen) {
return currStart;
}
return maxIdx;
}
function serializeHost(host) {
if (typeof host === "number") {
return serializeIPv4(host);
}
if (host instanceof Array) {
return `[${serializeIPv6(host)}]`;
}
return host;
}
function domainToASCII(domain, beStrict = false) {
let result;
try {
result = punycode.toASCII(domain);
} catch (e4) {
return failure;
}
if (result === null || result === "") {
return failure;
}
return result;
}
function trimControlChars(url) {
return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/gu, "");
}
function trimTabAndNewline(url) {
return url.replace(/\u0009|\u000A|\u000D/gu, "");
}
function shortenPath(url) {
const { path } = url;
if (path.length === 0) {
return;
}
if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) {
return;
}
path.pop();
}
function includesCredentials(url) {
return url.username !== "" || url.password !== "";
}
function cannotHaveAUsernamePasswordPort(url) {
return url.host === null || url.host === "" || url.scheme === "file";
}
function hasAnOpaquePath(url) {
return typeof url.path === "string";
}
function isNormalizedWindowsDriveLetter(string2) {
return /^[A-Za-z]:$/u.test(string2);
}
var URLStateMachine = class {
constructor(input, base2, encodingOverride, url, stateOverride) {
this.table = {
"parse scheme start": this.parseSchemeStart,
"parse scheme": this.parseScheme,
"parse no scheme": this.parseNoScheme,
"parse special relative or authority": this.parseSpecialRelativeOrAuthority,
"parse path or authority": this.parsePathOrAuthority,
"parse relative": this.parseRelative,
"parse relative slash": this.parseRelativeSlash,
"parse special authority slashes": this.parseSpecialAuthoritySlashes,
"parse special authority ignore slashes": this.parseSpecialAuthorityIgnoreSlashes,
"parse authority": this.parseAuthority,
"parse host": this.parseHostName,
"parse hostname": this.parseHostName,
"parse port": this.parsePort,
"parse file": this.parseFile,
"parse file slash": this.parseFileSlash,
"parse file host": this.parseFileHost,
"parse path start": this.parsePathStart,
"parse path": this.parsePath,
"parse opaque path": this.parseOpaquePath,
"parse query": this.parseQuery,
"parse fragment": this.parseFragment
};
this.pointer = 0;
this.base = base2 || null;
this.encodingOverride = encodingOverride || "utf-8";
this.url = url;
this.failure = false;
this.parseError = false;
if (!this.url) {
this.url = {
scheme: "",
username: "",
password: "",
host: null,
port: null,
path: [],
query: null,
fragment: null
};
const res2 = trimControlChars(input);
if (res2 !== input) {
this.parseError = true;
}
input = res2;
}
const res = trimTabAndNewline(input);
if (res !== input) {
this.parseError = true;
}
input = res;
this.state = stateOverride || "scheme start";
this.buffer = "";
this.atFlag = false;
this.arrFlag = false;
this.passwordTokenSeenFlag = false;
this.input = Array.from(input, (c4) => c4.codePointAt(0));
for (; this.pointer <= this.input.length; ++this.pointer) {
const c4 = this.input[this.pointer];
const cStr = isNaN(c4) ? void 0 : String.fromCodePoint(c4);
const ret = this.table[`parse ${this.state}`].call(this, c4, cStr);
if (!ret) {
break;
} else if (ret === failure) {
this.failure = true;
break;
}
}
}
parseSchemeStart(c4, cStr) {
if (isASCIIAlpha(c4)) {
this.buffer += cStr.toLowerCase();
this.state = "scheme";
} else if (!this.stateOverride) {
this.state = "no scheme";
--this.pointer;
} else {
this.parseError = true;
return failure;
}
return true;
}
parseScheme(c4, cStr) {
if (isASCIIAlphanumeric(c4) || c4 === p("+") || c4 === p("-") || c4 === p(".")) {
this.buffer += cStr.toLowerCase();
} else if (c4 === p(":")) {
if (this.stateOverride) {
if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) {
return false;
}
if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) {
return false;
}
if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") {
return false;
}
if (this.url.scheme === "file" && this.url.host === "") {
return false;
}
}
this.url.scheme = this.buffer;
if (this.stateOverride) {
if (this.url.port === defaultPort(this.url.scheme)) {
this.url.port = null;
}
return false;
}
this.buffer = "";
if (this.url.scheme === "file") {
if (this.input[this.pointer + 1] !== p("/") || this.input[this.pointer + 2] !== p("/")) {
this.parseError = true;
}
this.state = "file";
} else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) {
this.state = "special relative or authority";
} else if (isSpecial(this.url)) {
this.state = "special authority slashes";
} else if (this.input[this.pointer + 1] === p("/")) {
this.state = "path or authority";
++this.pointer;
} else {
this.url.path = [""];
this.state = "opaque path";
}
} else if (!this.stateOverride) {
this.buffer = "";
this.state = "no scheme";
this.pointer = -1;
} else {
this.parseError = true;
return failure;
}
return true;
}
parseNoScheme(c4) {
if (this.base === null || hasAnOpaquePath(this.base) && c4 !== p("#")) {
return failure;
} 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;
this.url.fragment = "";
this.state = "fragment";
} else if (this.base.scheme === "file") {
this.state = "file";
--this.pointer;
} else {
this.state = "relative";
--this.pointer;
}
return true;
}
parseSpecialRelativeOrAuthority(c4) {
if (c4 === p("/") && this.input[this.pointer + 1] === p("/")) {
this.state = "special authority ignore slashes";
++this.pointer;
} else {
this.parseError = true;
this.state = "relative";
--this.pointer;
}
return true;
}
parsePathOrAuthority(c4) {
if (c4 === p("/")) {
this.state = "authority";
} else {
this.state = "path";
--this.pointer;
}
return true;
}
parseRelative(c4) {
this.url.scheme = this.base.scheme;
if (c4 === p("/")) {
this.state = "relative slash";
} else if (isSpecial(this.url) && c4 === p("\\")) {
this.parseError = true;
this.state = "relative slash";
} else {
this.url.username = this.base.username;
this.url.password = this.base.password;
this.url.host = this.base.host;
this.url.port = this.base.port;
this.url.path = this.base.path.slice();
this.url.query = this.base.query;
if (c4 === p("?")) {
this.url.query = "";
this.state = "query";
} else if (c4 === p("#")) {
this.url.fragment = "";
this.state = "fragment";
} else if (!isNaN(c4)) {
this.url.query = null;
this.url.path.pop();
this.state = "path";
--this.pointer;
}
}
return true;
}
parseRelativeSlash(c4) {
if (isSpecial(this.url) && (c4 === p("/") || c4 === p("\\"))) {
if (c4 === p("\\")) {
this.parseError = true;
}
this.state = "special authority ignore slashes";
} else if (c4 === p("/")) {
this.state = "authority";
} else {
this.url.username = this.base.username;
this.url.password = this.base.password;
this.url.host = this.base.host;
this.url.port = this.base.port;
this.state = "path";
--this.pointer;
}
return true;
}
parseSpecialAuthoritySlashes(c4) {
if (c4 === p("/") && this.input[this.pointer + 1] === p("/")) {
this.state = "special authority ignore slashes";
++this.pointer;
} else {
this.parseError = true;
this.state = "special authority ignore slashes";
--this.pointer;
}
return true;
}
parseSpecialAuthorityIgnoreSlashes(c4) {
if (c4 !== p("/") && c4 !== p("\\")) {
this.state = "authority";
--this.pointer;
} else {
this.parseError = true;
}
return true;
}
parseAuthority(c4, cStr) {
if (c4 === p("@")) {
this.parseError = true;
if (this.atFlag) {
this.buffer = `%40${this.buffer}`;
}
this.atFlag = true;
const len = countSymbols(this.buffer);
for (let pointer = 0; pointer < len; ++pointer) {
const codePoint = this.buffer.codePointAt(pointer);
if (codePoint === p(":") && !this.passwordTokenSeenFlag) {
this.passwordTokenSeenFlag = true;
continue;
}
const encodedCodePoints = utf8PercentEncodeCodePoint(codePoint, isUserinfoPercentEncode);
if (this.passwordTokenSeenFlag) {
this.url.password += encodedCodePoints;
} else {
this.url.username += encodedCodePoints;
}
}
this.buffer = "";
} 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;
}
this.pointer -= countSymbols(this.buffer) + 1;
this.buffer = "";
this.state = "host";
} else {
this.buffer += cStr;
}
return true;
}
parseHostName(c4, cStr) {
if (this.stateOverride && this.url.scheme === "file") {
--this.pointer;
this.state = "file host";
} else if (c4 === p(":") && !this.arrFlag) {
if (this.buffer === "") {
this.parseError = true;
return failure;
}
if (this.stateOverride === "hostname") {
return false;
}
const host = parseHost(this.buffer, isNotSpecial(this.url));
if (host === failure) {
return failure;
}
this.url.host = host;
this.buffer = "";
this.state = "port";
} 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;
return failure;
} else if (this.stateOverride && this.buffer === "" && (includesCredentials(this.url) || this.url.port !== null)) {
this.parseError = true;
return false;
}
const host = parseHost(this.buffer, isNotSpecial(this.url));
if (host === failure) {
return failure;
}
this.url.host = host;
this.buffer = "";
this.state = "path start";
if (this.stateOverride) {
return false;
}
} else {
if (c4 === p("[")) {
this.arrFlag = true;
} else if (c4 === p("]")) {
this.arrFlag = false;
}
this.buffer += cStr;
}
return true;
}
parsePort(c4, cStr) {
if (isASCIIDigit(c4)) {
this.buffer += cStr;
} 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) {
this.parseError = true;
return failure;
}
this.url.port = port === defaultPort(this.url.scheme) ? null : port;
this.buffer = "";
}
if (this.stateOverride) {
return false;
}
this.state = "path start";
--this.pointer;
} else {
this.parseError = true;
return failure;
}
return true;
}
parseFile(c4) {
this.url.scheme = "file";
this.url.host = "";
if (c4 === p("/") || c4 === p("\\")) {
if (c4 === p("\\")) {
this.parseError = true;
}
this.state = "file slash";
} else if (this.base !== null && this.base.scheme === "file") {
this.url.host = this.base.host;
this.url.path = this.base.path.slice();
this.url.query = this.base.query;
if (c4 === p("?")) {
this.url.query = "";
this.state = "query";
} else if (c4 === p("#")) {
this.url.fragment = "";
this.state = "fragment";
} else if (!isNaN(c4)) {
this.url.query = null;
if (!startsWithWindowsDriveLetter(this.input, this.pointer)) {
shortenPath(this.url);
} else {
this.parseError = true;
this.url.path = [];
}
this.state = "path";
--this.pointer;
}
} else {
this.state = "path";
--this.pointer;
}
return true;
}
parseFileSlash(c4) {
if (c4 === p("/") || c4 === p("\\")) {
if (c4 === p("\\")) {
this.parseError = true;
}
this.state = "file host";
} else {
if (this.base !== null && this.base.scheme === "file") {
if (!startsWithWindowsDriveLetter(this.input, this.pointer) && isNormalizedWindowsDriveLetterString(this.base.path[0])) {
this.url.path.push(this.base.path[0]);
}
this.url.host = this.base.host;
}
this.state = "path";
--this.pointer;
}
return true;
}
parseFileHost(c4, cStr) {
if (isNaN(c4) || c4 === p("/") || c4 === p("\\") || c4 === p("?") || c4 === p("#")) {
--this.pointer;
if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) {
this.parseError = true;
this.state = "path";
} else if (this.buffer === "") {
this.url.host = "";
if (this.stateOverride) {
return false;
}
this.state = "path start";
} else {
let host = parseHost(this.buffer, isNotSpecial(this.url));
if (host === failure) {
return failure;
}
if (host === "localhost") {
host = "";
}
this.url.host = host;
if (this.stateOverride) {
return false;
}
this.buffer = "";
this.state = "path start";
}
} else {
this.buffer += cStr;
}
return true;
}
parsePathStart(c4) {
if (isSpecial(this.url)) {
if (c4 === p("\\")) {
this.parseError = true;
}
this.state = "path";
if (c4 !== p("/") && c4 !== p("\\")) {
--this.pointer;
}
} else if (!this.stateOverride && c4 === p("?")) {
this.url.query = "";
this.state = "query";
} else if (!this.stateOverride && c4 === p("#")) {
this.url.fragment = "";
this.state = "fragment";
} else if (c4 !== void 0) {
this.state = "path";
if (c4 !== p("/")) {
--this.pointer;
}
} else if (this.stateOverride && this.url.host === null) {
this.url.path.push("");
}
return true;
}
parsePath(c4) {
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 !== p("/") && !(isSpecial(this.url) && c4 === p("\\"))) {
this.url.path.push("");
}
} 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)) {
this.buffer = `${this.buffer[0]}:`;
}
this.url.path.push(this.buffer);
}
this.buffer = "";
if (c4 === p("?")) {
this.url.query = "";
this.state = "query";
}
if (c4 === p("#")) {
this.url.fragment = "";
this.state = "fragment";
}
} else {
if (c4 === p("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) {
this.parseError = true;
}
this.buffer += utf8PercentEncodeCodePoint(c4, isPathPercentEncode);
}
return true;
}
parseOpaquePath(c4) {
if (c4 === p("?")) {
this.url.query = "";
this.state = "query";
} else if (c4 === p("#")) {
this.url.fragment = "";
this.state = "fragment";
} else {
if (!isNaN(c4) && c4 !== p("%")) {
this.parseError = true;
}
if (c4 === p("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) {
this.parseError = true;
}
if (!isNaN(c4)) {
this.url.path += utf8PercentEncodeCodePoint(c4, isC0ControlPercentEncode);
}
}
return true;
}
parseQuery(c4, cStr) {
if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") {
this.encodingOverride = "utf-8";
}
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 === p("#")) {
this.url.fragment = "";
this.state = "fragment";
}
} else if (!isNaN(c4)) {
if (c4 === p("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) {
this.parseError = true;
}
this.buffer += cStr;
}
return true;
}
parseFragment(c4) {
if (!isNaN(c4)) {
if (c4 === p("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) {
this.parseError = true;
}
this.url.fragment += utf8PercentEncodeCodePoint(c4, isFragmentPercentEncode);
}
return true;
}
};
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]));
}
function serializeURL(url, excludeFragment) {
let output = `${url.scheme}:`;
if (url.host !== null) {
output += "//";
if (url.username !== "" || url.password !== "") {
output += url.username;
if (url.password !== "") {
output += `:${url.password}`;
}
output += "@";
}
output += serializeHost(url.host);
if (url.port !== null) {
output += `:${url.port}`;
}
}
if (url.host === null && !hasAnOpaquePath(url) && url.path.length > 1 && url.path[0] === "") {
output += "/.";
}
output += serializePath(url);
if (url.query !== null) {
output += `?${url.query}`;
}
if (!excludeFragment && url.fragment !== null) {
output += `#${url.fragment}`;
}
return output;
}
function serializeOrigin(tuple) {
let result = `${tuple.scheme}://`;
result += serializeHost(tuple.host);
if (tuple.port !== null) {
result += `:${tuple.port}`;
}
return result;
}
function serializePath(url) {
if (typeof url.path === "string") {
return url.path;
}
let output = "";
for (const segment of url.path) {
output += `/${segment}`;
}
return output;
}
function serializeURLOrigin(url) {
switch (url.scheme) {
case "blob":
try {
return serializeURLOrigin(parseURL(serializePath(url)));
} catch (e4) {
return "null";
}
case "ftp":
case "http":
case "https":
case "ws":
case "wss":
return serializeOrigin({
scheme: url.scheme,
host: url.host,
port: url.port
});
case "file":
return "null";
default:
return "null";
}
}
function basicURLParse(input, options) {
if (options === void 0) {
options = {};
}
const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride);
if (usm.failure) {
return null;
}
return usm.url;
}
function setTheUsername(url, username) {
url.username = utf8PercentEncodeString(username, isUserinfoPercentEncode);
}
function setThePassword(url, password) {
url.password = utf8PercentEncodeString(password, isUserinfoPercentEncode);
}
function serializeInteger(integer) {
return String(integer);
}
function parseURL(input, options) {
if (options === void 0) {
options = {};
}
return basicURLParse(input, {
baseURL: options.baseURL,
encodingOverride: options.encodingOverride
});
}
var URLImpl = class {
constructor(url, base2) {
let parsedBase = null;
if (base2 !== void 0) {
parsedBase = basicURLParse(base2);
if (parsedBase === null) {
throw new TypeError(`Invalid base URL: ${base2}`);
}
}
const parsedURL = basicURLParse(url, { baseURL: parsedBase });
if (parsedURL === null) {
throw new TypeError(`Invalid URL: ${url}`);
}
const query = parsedURL.query !== null ? parsedURL.query : "";
this._url = parsedURL;
this._query = new URLSearchParamsImpl(query, {
doNotStripQMark: true
});
this._query._url = this;
}
get href() {
return serializeURL(this._url);
}
set href(v3) {
const parsedURL = basicURLParse(v3);
if (parsedURL === null) {
throw new TypeError(`Invalid URL: ${v3}`);
}
this._url = parsedURL;
this._query._list.splice(0);
const { query } = parsedURL;
if (query !== null) {
this._query._list = parseUrlencodedString(query);
}
}
get origin() {
return serializeURLOrigin(this._url);
}
get protocol() {
return `${this._url.scheme}:`;
}
set protocol(v3) {
basicURLParse(`${v3}:`, {
url: this._url,
stateOverride: "scheme start"
});
}
get username() {
return this._url.username;
}
set username(v3) {
if (cannotHaveAUsernamePasswordPort(this._url)) {
return;
}
setTheUsername(this._url, v3);
}
get password() {
return this._url.password;
}
set password(v3) {
if (cannotHaveAUsernamePasswordPort(this._url)) {
return;
}
setThePassword(this._url, v3);
}
get host() {
const url = this._url;
if (url.host === null) {
return "";
}
if (url.port === null) {
return serializeHost(url.host);
}
return `${serializeHost(url.host)}:${serializeInteger(url.port)}`;
}
set host(v3) {
if (hasAnOpaquePath(this._url)) {
return;
}
basicURLParse(v3, { url: this._url, stateOverride: "host" });
}
get hostname() {
if (this._url.host === null) {
return "";
}
return serializeHost(this._url.host);
}
set hostname(v3) {
if (hasAnOpaquePath(this._url)) {
return;
}
basicURLParse(v3, { url: this._url, stateOverride: "hostname" });
}
get port() {
if (this._url.port === null) {
return "";
}
return serializeInteger(this._url.port);
}
set port(v3) {
if (cannotHaveAUsernamePasswordPort(this._url)) {
return;
}
if (v3 === "") {
this._url.port = null;
} else {
basicURLParse(v3, { url: this._url, stateOverride: "port" });
}
}
get pathname() {
return serializePath(this._url);
}
set pathname(v3) {
if (hasAnOpaquePath(this._url)) {
return;
}
this._url.path = [];
basicURLParse(v3, { url: this._url, stateOverride: "path start" });
}
get search() {
if (this._url.query === null || this._url.query === "") {
return "";
}
return `?${this._url.query}`;
}
set search(v3) {
const url = this._url;
if (v3 === "") {
url.query = null;
this._query._list = [];
return;
}
const input = v3[0] === "?" ? v3.substring(1) : v3;
url.query = "";
basicURLParse(input, { url, stateOverride: "query" });
this._query._list = parseUrlencodedString(input);
}
get searchParams() {
return this._query;
}
get hash() {
if (this._url.fragment === null || this._url.fragment === "") {
return "";
}
return `#${this._url.fragment}`;
}
set hash(v3) {
if (v3 === "") {
this._url.fragment = null;
return;
}
const input = v3[0] === "#" ? v3.substring(1) : v3;
this._url.fragment = "";
basicURLParse(input, { url: this._url, stateOverride: "fragment" });
}
toJSON() {
return this.href;
}
};
// ../taler-util/lib/url.js
(function() {
if (typeof globalThis === "object")
return;
Object.defineProperty(Object.prototype, "__magic__", {
get: function() {
return this;
},
configurable: true
// This makes it possible to `delete` the getter later.
});
__magic__.globalThis = __magic__;
delete Object.prototype.__magic__;
})();
var useOwnUrlImp = true;
var _URL = globalThis.URL;
if (useOwnUrlImp || !_URL) {
globalThis.URL = _URL = URLImpl;
_URL = URLImpl;
}
var URL2 = _URL;
var _URLSearchParams = globalThis.URLSearchParams;
if (useOwnUrlImp || !_URLSearchParams) {
globalThis.URLSearchParams = URLSearchParamsImpl;
_URLSearchParams = URLSearchParamsImpl;
}
var URLSearchParams = _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") {
return JSON.stringify(obj);
}
if (typeof obj === "number" || typeof obj === "boolean" || obj === null) {
return JSON.stringify(obj);
}
if (Array.isArray(obj)) {
const objs = obj.map((e4) => canonicalJson(e4));
return `[${objs.join(",")}]`;
}
const keys = [];
for (const key in obj) {
keys.push(key);
}
keys.sort();
let s5 = "{";
for (let i4 = 0; i4 < keys.length; i4++) {
const key = keys[i4];
s5 += JSON.stringify(key) + ":" + canonicalJson(obj[key]);
if (i4 !== keys.length - 1) {
s5 += ",";
}
}
return s5 + "}";
}
function strcmp(s1, s22) {
if (s1 < s22) {
return -1;
}
if (s1 > s22) {
return 1;
}
return 0;
}
// ../taler-util/lib/libtool-version.js
var LibtoolVersion;
(function(LibtoolVersion2) {
function compare2(me, other) {
const meVer = parseVersion(me);
const otherVer = parseVersion(other);
if (!(meVer && otherVer)) {
return void 0;
}
const compatible = meVer.current - meVer.age <= otherVer.current && meVer.current >= otherVer.current - otherVer.age;
const currentCmp = Math.sign(meVer.current - otherVer.current);
return { compatible, currentCmp };
}
LibtoolVersion2.compare = compare2;
function parseVersion(v3) {
const [currentStr, revisionStr, ageStr, ...rest] = v3.split(":");
if (rest.length !== 0) {
return void 0;
}
const current = Number.parseInt(currentStr);
const revision = Number.parseInt(revisionStr);
const age = Number.parseInt(ageStr);
if (Number.isNaN(current)) {
return void 0;
}
if (Number.isNaN(revision)) {
return void 0;
}
if (Number.isNaN(age)) {
return void 0;
}
return { current, revision, age };
}
LibtoolVersion2.parseVersion = parseVersion;
})(LibtoolVersion || (LibtoolVersion = {}));
// ../taler-util/lib/notifications.js
var NotificationType;
(function(NotificationType2) {
NotificationType2["BalanceChange"] = "balance-change";
NotificationType2["ExchangeOperationError"] = "exchange-operation-error";
NotificationType2["ExchangeAdded"] = "exchange-added";
NotificationType2["BackupOperationError"] = "backup-error";
NotificationType2["PendingOperationProcessed"] = "pending-operation-processed";
NotificationType2["TransactionStateTransition"] = "transaction-state-transition";
})(NotificationType || (NotificationType = {}));
// ../taler-util/lib/sha256.js
var digestLength = 32;
var blockSize = 64;
var K2 = new Uint32Array([
1116352408,
1899447441,
3049323471,
3921009573,
961987163,
1508970993,
2453635748,
2870763221,
3624381080,
310598401,
607225278,
1426881987,
1925078388,
2162078206,
2614888103,
3248222580,
3835390401,
4022224774,
264347078,
604807628,
770255983,
1249150122,
1555081692,
1996064986,
2554220882,
2821834349,
2952996808,
3210313671,
3336571891,
3584528711,
113926993,
338241895,
666307205,
773529912,
1294757372,
1396182291,
1695183700,
1986661051,
2177026350,
2456956037,
2730485921,
2820302411,
3259730800,
3345764771,
3516065817,
3600352804,
4094571909,
275423344,
430227734,
506948616,
659060556,
883997877,
958139571,
1322822218,
1537002063,
1747873779,
1955562222,
2024104815,
2227730452,
2361852424,
2428436474,
2756734187,
3204031479,
3329325298
]);
function hashBlocks(w5, v3, p4, pos, len) {
let a5, b4, c4, d5, e4, f3, g4, h5, u4, i4, j4, t1, t22;
while (len >= 64) {
a5 = v3[0];
b4 = v3[1];
c4 = v3[2];
d5 = v3[3];
e4 = v3[4];
f3 = v3[5];
g4 = v3[6];
h5 = v3[7];
for (i4 = 0; i4 < 16; i4++) {
j4 = pos + i4 * 4;
w5[i4] = (p4[j4] & 255) << 24 | (p4[j4 + 1] & 255) << 16 | (p4[j4 + 2] & 255) << 8 | p4[j4 + 3] & 255;
}
for (i4 = 16; i4 < 64; i4++) {
u4 = w5[i4 - 2];
t1 = (u4 >>> 17 | u4 << 32 - 17) ^ (u4 >>> 19 | u4 << 32 - 19) ^ u4 >>> 10;
u4 = w5[i4 - 15];
t22 = (u4 >>> 7 | u4 << 32 - 7) ^ (u4 >>> 18 | u4 << 32 - 18) ^ u4 >>> 3;
w5[i4] = (t1 + w5[i4 - 7] | 0) + (t22 + w5[i4 - 16] | 0);
}
for (i4 = 0; i4 < 64; i4++) {
t1 = (((e4 >>> 6 | e4 << 32 - 6) ^ (e4 >>> 11 | e4 << 32 - 11) ^ (e4 >>> 25 | e4 << 32 - 25)) + (e4 & f3 ^ ~e4 & g4) | 0) + (h5 + (K2[i4] + w5[i4] | 0) | 0) | 0;
t22 = ((a5 >>> 2 | a5 << 32 - 2) ^ (a5 >>> 13 | a5 << 32 - 13) ^ (a5 >>> 22 | a5 << 32 - 22)) + (a5 & b4 ^ a5 & c4 ^ b4 & c4) | 0;
h5 = g4;
g4 = f3;
f3 = e4;
e4 = d5 + t1 | 0;
d5 = c4;
c4 = b4;
b4 = a5;
a5 = t1 + t22 | 0;
}
v3[0] += a5;
v3[1] += b4;
v3[2] += c4;
v3[3] += d5;
v3[4] += e4;
v3[5] += f3;
v3[6] += g4;
v3[7] += h5;
pos += 64;
len -= 64;
}
return pos;
}
var HashSha256 = class {
constructor() {
this.digestLength = digestLength;
this.blockSize = blockSize;
this.state = new Int32Array(8);
this.temp = new Int32Array(64);
this.buffer = new Uint8Array(128);
this.bufferLength = 0;
this.bytesHashed = 0;
this.finished = false;
this.reset();
}
// Resets hash state making it possible
// to re-use this instance to hash other data.
reset() {
this.state[0] = 1779033703;
this.state[1] = 3144134277;
this.state[2] = 1013904242;
this.state[3] = 2773480762;
this.state[4] = 1359893119;
this.state[5] = 2600822924;
this.state[6] = 528734635;
this.state[7] = 1541459225;
this.bufferLength = 0;
this.bytesHashed = 0;
this.finished = false;
return this;
}
// Cleans internal buffers and re-initializes hash state.
clean() {
for (let i4 = 0; i4 < this.buffer.length; i4++) {
this.buffer[i4] = 0;
}
for (let i4 = 0; i4 < this.temp.length; i4++) {
this.temp[i4] = 0;
}
this.reset();
}
// Updates hash state with the given data.
//
// Optionally, length of the data can be specified to hash
// fewer bytes than data.length.
//
// Throws error when trying to update already finalized hash:
// instance must be reset to use it again.
update(data, dataLength = data.length) {
if (this.finished) {
throw new Error("SHA256: can't update because hash was finished.");
}
let dataPos = 0;
this.bytesHashed += dataLength;
if (this.bufferLength > 0) {
while (this.bufferLength < 64 && dataLength > 0) {
this.buffer[this.bufferLength++] = data[dataPos++];
dataLength--;
}
if (this.bufferLength === 64) {
hashBlocks(this.temp, this.state, this.buffer, 0, 64);
this.bufferLength = 0;
}
}
if (dataLength >= 64) {
dataPos = hashBlocks(this.temp, this.state, data, dataPos, dataLength);
dataLength %= 64;
}
while (dataLength > 0) {
this.buffer[this.bufferLength++] = data[dataPos++];
dataLength--;
}
return this;
}
// Finalizes hash state and puts hash into out.
//
// If hash was already finalized, puts the same value.
finish(out) {
if (!this.finished) {
const bytesHashed = this.bytesHashed;
const left = this.bufferLength;
const bitLenHi = bytesHashed / 536870912 | 0;
const bitLenLo = bytesHashed << 3;
const padLength = bytesHashed % 64 < 56 ? 64 : 128;
this.buffer[left] = 128;
for (let i4 = left + 1; i4 < padLength - 8; i4++) {
this.buffer[i4] = 0;
}
this.buffer[padLength - 8] = bitLenHi >>> 24 & 255;
this.buffer[padLength - 7] = bitLenHi >>> 16 & 255;
this.buffer[padLength - 6] = bitLenHi >>> 8 & 255;
this.buffer[padLength - 5] = bitLenHi >>> 0 & 255;
this.buffer[padLength - 4] = bitLenLo >>> 24 & 255;
this.buffer[padLength - 3] = bitLenLo >>> 16 & 255;
this.buffer[padLength - 2] = bitLenLo >>> 8 & 255;
this.buffer[padLength - 1] = bitLenLo >>> 0 & 255;
hashBlocks(this.temp, this.state, this.buffer, 0, padLength);
this.finished = true;
}
for (let i4 = 0; i4 < 8; i4++) {
out[i4 * 4 + 0] = this.state[i4] >>> 24 & 255;
out[i4 * 4 + 1] = this.state[i4] >>> 16 & 255;
out[i4 * 4 + 2] = this.state[i4] >>> 8 & 255;
out[i4 * 4 + 3] = this.state[i4] >>> 0 & 255;
}
return this;
}
// Returns the final hash digest.
digest() {
const out = new Uint8Array(this.digestLength);
this.finish(out);
return out;
}
// Internal function for use in HMAC for optimization.
_saveState(out) {
for (let i4 = 0; i4 < this.state.length; i4++) {
out[i4] = this.state[i4];
}
}
// Internal function for use in HMAC for optimization.
_restoreState(from, bytesHashed) {
for (let i4 = 0; i4 < this.state.length; i4++) {
this.state[i4] = from[i4];
}
this.bytesHashed = bytesHashed;
this.finished = false;
this.bufferLength = 0;
}
};
function sha256(data) {
const h5 = new HashSha256().update(data);
const digest = h5.digest();
h5.clean();
return digest;
}
// ../taler-util/lib/kdf.js
function sha512(data) {
return hash(data);
}
function hmac(digest, blockSize2, key, message) {
if (key.byteLength > blockSize2) {
key = digest(key);
}
if (key.byteLength < blockSize2) {
const k5 = key;
key = new Uint8Array(blockSize2);
key.set(k5, 0);
}
const okp = new Uint8Array(blockSize2);
const ikp = new Uint8Array(blockSize2);
for (let i4 = 0; i4 < blockSize2; i4++) {
ikp[i4] = key[i4] ^ 54;
okp[i4] = key[i4] ^ 92;
}
const b1 = new Uint8Array(blockSize2 + message.byteLength);
b1.set(ikp, 0);
b1.set(message, blockSize2);
const h0 = digest(b1);
const b22 = new Uint8Array(blockSize2 + h0.length);
b22.set(okp, 0);
b22.set(h0, blockSize2);
return digest(b22);
}
function hmacSha512(key, message) {
return hmac(sha512, 128, key, message);
}
function hmacSha256(key, message) {
return hmac(sha256, 64, key, message);
}
// ../taler-util/lib/taler-crypto.js
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.toProtocolTimestamp(AbsoluteTime.now());
}
TalerProtocolTimestamp2.now = now2;
function zero() {
return {
t_s: 0
};
}
TalerProtocolTimestamp2.zero = zero;
function never() {
return {
t_s: "never"
};
}
TalerProtocolTimestamp2.never = never;
function isNever(t4) {
return t4.t_s === "never";
}
TalerProtocolTimestamp2.isNever = isNever;
function fromSeconds(s5) {
return {
t_s: s5
};
}
TalerProtocolTimestamp2.fromSeconds = fromSeconds;
function min(t1, t22) {
if (t1.t_s === "never") {
return { t_s: t22.t_s };
}
if (t22.t_s === "never") {
return { t_s: t1.t_s };
}
return { t_s: Math.min(t1.t_s, t22.t_s) };
}
TalerProtocolTimestamp2.min = min;
function max(t1, t22) {
if (t1.t_s === "never" || t22.t_s === "never") {
return { t_s: "never" };
}
return { t_s: Math.max(t1.t_s, t22.t_s) };
}
TalerProtocolTimestamp2.max = max;
})(TalerProtocolTimestamp || (TalerProtocolTimestamp = {}));
var timeshift = 0;
var Duration;
(function(Duration2) {
function toMilliseconds(d5) {
if (d5.d_ms === "forever") {
return Number.MAX_VALUE;
}
return d5.d_ms;
}
Duration2.toMilliseconds = toMilliseconds;
function getRemaining(deadline, now2 = AbsoluteTime.now()) {
if (deadline.t_ms === "never") {
return { d_ms: "forever" };
}
if (now2.t_ms === "never") {
throw Error("invalid argument for 'now'");
}
if (deadline.t_ms < now2.t_ms) {
return { d_ms: 0 };
}
return { d_ms: deadline.t_ms - now2.t_ms };
}
Duration2.getRemaining = getRemaining;
function fromPrettyString(s5) {
let dMs = 0;
let currentNum = "";
let parsingNum = true;
for (let i4 = 0; i4 < s5.length; i4++) {
const cc = s5.charCodeAt(i4);
if (cc >= "0".charCodeAt(0) && cc <= "9".charCodeAt(0)) {
if (!parsingNum) {
throw Error("invalid duration, unexpected number");
}
currentNum += s5[i4];
continue;
}
if (s5[i4] == " ") {
if (currentNum != "") {
parsingNum = false;
}
continue;
}
if (currentNum == "") {
throw Error("invalid duration, missing number");
}
if (s5[i4] === "s") {
dMs += 1e3 * Number.parseInt(currentNum, 10);
} else if (s5[i4] === "m") {
dMs += 60 * 1e3 * Number.parseInt(currentNum, 10);
} else if (s5[i4] === "h") {
dMs += 60 * 60 * 1e3 * Number.parseInt(currentNum, 10);
} else if (s5[i4] === "d") {
dMs += 24 * 60 * 60 * 1e3 * Number.parseInt(currentNum, 10);
} else {
throw Error("invalid duration, unsupported unit");
}
currentNum = "";
parsingNum = true;
}
return {
d_ms: dMs
};
}
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);
}
Duration2.max = max;
function min(d1, d22) {
return durationMin(d1, d22);
}
Duration2.min = min;
function multiply(d1, n2) {
return durationMul(d1, n2);
}
Duration2.multiply = multiply;
function toIntegerYears(d5) {
if (typeof d5.d_ms !== "number") {
throw Error("infinite duration");
}
return Math.ceil(d5.d_ms / 1e3 / 60 / 60 / 24 / 365);
}
Duration2.toIntegerYears = toIntegerYears;
Duration2.fromSpec = durationFromSpec;
function getForever() {
return { d_ms: "forever" };
}
Duration2.getForever = getForever;
function getZero() {
return { d_ms: 0 };
}
Duration2.getZero = getZero;
function fromTalerProtocolDuration(d5) {
if (d5.d_us === "forever") {
return {
d_ms: "forever"
};
}
return {
d_ms: Math.floor(d5.d_us / 1e3)
};
}
Duration2.fromTalerProtocolDuration = fromTalerProtocolDuration;
function toTalerProtocolDuration(d5) {
if (d5.d_ms === "forever") {
return {
d_us: "forever"
};
}
return {
d_us: d5.d_ms * 1e3
};
}
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);
}
Duration2.clamp = clamp;
})(Duration || (Duration = {}));
var AbsoluteTime;
(function(AbsoluteTime2) {
function getStampMsNow() {
return (/* @__PURE__ */ new Date()).getTime();
}
AbsoluteTime2.getStampMsNow = getStampMsNow;
function getStampMsNever() {
return Number.MAX_SAFE_INTEGER;
}
AbsoluteTime2.getStampMsNever = getStampMsNever;
function now2() {
return {
t_ms: (/* @__PURE__ */ new Date()).getTime() + timeshift,
[opaque_AbsoluteTime]: true
};
}
AbsoluteTime2.now = now2;
function never() {
return {
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") {
return 0;
}
return 1;
}
if (t22.t_ms === "never") {
return -1;
}
if (t1.t_ms == t22.t_ms) {
return 0;
}
if (t1.t_ms > t22.t_ms) {
return 1;
}
return -1;
}
AbsoluteTime2.cmp = cmp;
function min(t1, t22) {
if (t1.t_ms === "never") {
return { t_ms: t22.t_ms, [opaque_AbsoluteTime]: true };
}
if (t22.t_ms === "never") {
return { t_ms: t22.t_ms, [opaque_AbsoluteTime]: true };
}
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", [opaque_AbsoluteTime]: true };
}
if (t22.t_ms === "never") {
return { t_ms: "never", [opaque_AbsoluteTime]: true };
}
return { t_ms: Math.max(t1.t_ms, t22.t_ms), [opaque_AbsoluteTime]: true };
}
AbsoluteTime2.max = max;
function difference2(t1, t22) {
if (t1.t_ms === "never") {
return { d_ms: "forever" };
}
if (t22.t_ms === "never") {
return { d_ms: "forever" };
}
return { d_ms: Math.abs(t1.t_ms - t22.t_ms) };
}
AbsoluteTime2.difference = difference2;
function isExpired(t4) {
return cmp(t4, now2()) <= 0;
}
AbsoluteTime2.isExpired = isExpired;
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 fromStampMs(stampMs) {
return {
t_ms: stampMs,
[opaque_AbsoluteTime]: true
};
}
AbsoluteTime2.fromStampMs = fromStampMs;
function fromPreciseTimestamp(t4) {
var _a;
if (t4.t_s === "never") {
return { t_ms: "never", [opaque_AbsoluteTime]: true };
}
const offsetUs = (_a = t4.off_us) != null ? _a : 0;
return {
t_ms: t4.t_s * 1e3 + Math.floor(offsetUs / 1e3),
[opaque_AbsoluteTime]: true
};
}
AbsoluteTime2.fromPreciseTimestamp = fromPreciseTimestamp;
function toStampMs(at2) {
if (at2.t_ms === "never") {
return Number.MAX_SAFE_INTEGER;
}
return at2.t_ms;
}
AbsoluteTime2.toStampMs = toStampMs;
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" };
}
return {
t_s: Math.floor(at2.t_ms / 1e3)
};
}
AbsoluteTime2.toProtocolTimestamp = toProtocolTimestamp;
function isBetween(t4, start, end) {
if (cmp(t4, start) < 0) {
return false;
}
if (cmp(t4, end) > 0) {
return false;
}
return true;
}
AbsoluteTime2.isBetween = isBetween;
function toIsoString(t4) {
if (t4.t_ms === "never") {
return "";
} else {
return new Date(t4.t_ms).toISOString();
}
}
AbsoluteTime2.toIsoString = toIsoString;
function addDuration(t1, d5) {
if (t1.t_ms === "never" || d5.d_ms === "forever") {
return { t_ms: "never", [opaque_AbsoluteTime]: true };
}
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", [opaque_AbsoluteTime]: true };
}
if (d5.d_ms === "forever") {
return { t_ms: 0, [opaque_AbsoluteTime]: true };
}
return { t_ms: Math.max(0, t1.t_ms - d5.d_ms), [opaque_AbsoluteTime]: true };
}
AbsoluteTime2.subtractDuraction = subtractDuraction;
function stringify(t4) {
if (t4.t_ms === "never") {
return "never";
}
return new Date(t4.t_ms).toISOString();
}
AbsoluteTime2.stringify = stringify;
})(AbsoluteTime || (AbsoluteTime = {}));
var SECONDS = 1e3;
var MINUTES = SECONDS * 60;
var HOURS = MINUTES * 60;
var DAYS = HOURS * 24;
var MONTHS = DAYS * 30;
var YEARS = DAYS * 365;
function durationFromSpec(spec) {
var _a, _b, _c, _d, _e, _f;
let d_ms = 0;
d_ms += ((_a = spec.seconds) != null ? _a : 0) * SECONDS;
d_ms += ((_b = spec.minutes) != null ? _b : 0) * MINUTES;
d_ms += ((_c = spec.hours) != null ? _c : 0) * HOURS;
d_ms += ((_d = spec.days) != null ? _d : 0) * DAYS;
d_ms += ((_e = spec.months) != null ? _e : 0) * MONTHS;
d_ms += ((_f = spec.years) != null ? _f : 0) * YEARS;
return { d_ms };
}
function durationMin(d1, d22) {
if (d1.d_ms === "forever") {
return { d_ms: d22.d_ms };
}
if (d22.d_ms === "forever") {
return { d_ms: d1.d_ms };
}
return { d_ms: Math.min(d1.d_ms, d22.d_ms) };
}
function durationMax(d1, d22) {
if (d1.d_ms === "forever") {
return { d_ms: "forever" };
}
if (d22.d_ms === "forever") {
return { d_ms: "forever" };
}
return { d_ms: Math.max(d1.d_ms, d22.d_ms) };
}
function durationMul(d5, n2) {
if (d5.d_ms === "forever") {
return { d_ms: "forever" };
}
return { d_ms: Math.round(d5.d_ms * n2) };
}
var codecForTimestamp = {
decode(x6, c4) {
const t_ms = x6.t_ms;
if (typeof t_ms === "string") {
if (t_ms === "never") {
return { t_s: "never" };
}
} else if (typeof t_ms === "number") {
return { t_s: Math.floor(t_ms / 1e3) };
}
const t_s = x6.t_s;
if (typeof t_s === "string") {
if (t_s === "never") {
return { t_s: "never" };
}
throw Error(`expected timestamp at ${renderContext(c4)}`);
}
if (typeof t_s === "number") {
return { t_s };
}
throw Error(`expected timestamp at ${renderContext(c4)}`);
}
};
// ../taler-util/lib/taler-types.js
var DenomKeyType;
(function(DenomKeyType2) {
DenomKeyType2["Rsa"] = "RSA";
DenomKeyType2["ClauseSchnorr"] = "CS";
})(DenomKeyType || (DenomKeyType = {}));
(function(DenomKeyType2) {
function toIntTag(t4) {
switch (t4) {
case DenomKeyType2.Rsa:
return 1;
case DenomKeyType2.ClauseSchnorr:
return 2;
}
}
DenomKeyType2.toIntTag = toIntTag;
})(DenomKeyType || (DenomKeyType = {}));
var DenominationPubKey;
(function(DenominationPubKey2) {
function cmp(p1, p22) {
var _a, _b, _c, _d, _e, _f, _g, _h;
if (p1.cipher < p22.cipher) {
return -1;
} else if (p1.cipher > p22.cipher) {
return 1;
} else if (p1.cipher === DenomKeyType.Rsa && p22.cipher === DenomKeyType.Rsa) {
if (((_a = p1.age_mask) != null ? _a : 0) < ((_b = p22.age_mask) != null ? _b : 0)) {
return -1;
} else if (((_c = p1.age_mask) != null ? _c : 0) > ((_d = p22.age_mask) != null ? _d : 0)) {
return 1;
}
return strcmp(p1.rsa_public_key, p22.rsa_public_key);
} else if (p1.cipher === DenomKeyType.ClauseSchnorr && p22.cipher === DenomKeyType.ClauseSchnorr) {
if (((_e = p1.age_mask) != null ? _e : 0) < ((_f = p22.age_mask) != null ? _f : 0)) {
return -1;
} else if (((_g = p1.age_mask) != null ? _g : 0) > ((_h = p22.age_mask) != null ? _h : 0)) {
return 1;
}
return strcmp(p1.cs_public_key, p22.cs_public_key);
} else {
throw Error("unsupported cipher");
}
}
DenominationPubKey2.cmp = cmp;
})(DenominationPubKey || (DenominationPubKey = {}));
var codecForNgDenominations = codecForAny();
var ExchangeProtocolVersion;
(function(ExchangeProtocolVersion2) {
ExchangeProtocolVersion2[ExchangeProtocolVersion2["V12"] = 12] = "V12";
})(ExchangeProtocolVersion || (ExchangeProtocolVersion = {}));
var MerchantProtocolVersion;
(function(MerchantProtocolVersion2) {
MerchantProtocolVersion2[MerchantProtocolVersion2["V3"] = 3] = "V3";
})(MerchantProtocolVersion || (MerchantProtocolVersion = {}));
// ../taler-util/lib/logging.js
var isNode = typeof process !== "undefined" && typeof process.release !== "undefined" && process.release.name === "node";
var LogLevel;
(function(LogLevel2) {
LogLevel2["Trace"] = "trace";
LogLevel2["Message"] = "message";
LogLevel2["Info"] = "info";
LogLevel2["Warn"] = "warn";
LogLevel2["Error"] = "error";
LogLevel2["None"] = "none";
})(LogLevel || (LogLevel = {}));
var globalLogLevel = LogLevel.Info;
var byTagLogLevel = {};
function writeNodeLog(message, tag, level, args) {
try {
let msg = `${(/* @__PURE__ */ new Date()).toISOString()} ${tag} ${level} ${message}`;
if (args.length != 0) {
msg += ` ${JSON.stringify(args, void 0, 2)}
`;
} else {
msg += `
`;
}
process.stderr.write(msg);
} catch (e4) {
let msg = `${(/* @__PURE__ */ new Date()).toISOString()} (logger) FATAL `;
if (e4 instanceof Error) {
msg += `failed to write log: ${e4.message}
`;
} else {
msg += "failed to write log\n";
}
process.stderr.write(msg);
}
}
var Logger = class {
constructor(tag) {
this.tag = tag;
}
shouldLogTrace() {
var _a;
const level = (_a = byTagLogLevel[this.tag]) != null ? _a : globalLogLevel;
switch (level) {
case LogLevel.Trace:
return true;
case LogLevel.Message:
case LogLevel.Info:
case LogLevel.Warn:
case LogLevel.Error:
case LogLevel.None:
return false;
}
}
shouldLogInfo() {
var _a;
const level = (_a = byTagLogLevel[this.tag]) != null ? _a : globalLogLevel;
switch (level) {
case LogLevel.Trace:
case LogLevel.Message:
case LogLevel.Info:
return true;
case LogLevel.Warn:
case LogLevel.Error:
case LogLevel.None:
return false;
}
}
shouldLogWarn() {
var _a;
const level = (_a = byTagLogLevel[this.tag]) != null ? _a : globalLogLevel;
switch (level) {
case LogLevel.Trace:
case LogLevel.Message:
case LogLevel.Info:
case LogLevel.Warn:
return true;
case LogLevel.Error:
case LogLevel.None:
return false;
}
}
shouldLogError() {
var _a;
const level = (_a = byTagLogLevel[this.tag]) != null ? _a : globalLogLevel;
switch (level) {
case LogLevel.Trace:
case LogLevel.Message:
case LogLevel.Info:
case LogLevel.Warn:
case LogLevel.Error:
return true;
case LogLevel.None:
return false;
}
}
info(message, ...args) {
if (!this.shouldLogInfo()) {
return;
}
if (isNode) {
writeNodeLog(message, this.tag, "INFO", args);
} else {
console.info(`${(/* @__PURE__ */ new Date()).toISOString()} ${this.tag} INFO ` + message, ...args);
}
}
warn(message, ...args) {
if (!this.shouldLogWarn()) {
return;
}
if (isNode) {
writeNodeLog(message, this.tag, "WARN", args);
} else {
console.warn(`${(/* @__PURE__ */ new Date()).toISOString()} ${this.tag} INFO ` + message, ...args);
}
}
error(message, ...args) {
if (!this.shouldLogError()) {
return;
}
if (isNode) {
writeNodeLog(message, this.tag, "ERROR", args);
} else {
console.info(`${(/* @__PURE__ */ new Date()).toISOString()} ${this.tag} ERROR ` + message, ...args);
}
}
trace(message, ...args) {
if (!this.shouldLogTrace()) {
return;
}
if (isNode) {
writeNodeLog(message, this.tag, "TRACE", args);
} else {
console.info(`${(/* @__PURE__ */ new Date()).toISOString()} ${this.tag} TRACE ` + message, ...args);
}
}
reportBreak() {
if (!this.shouldLogError()) {
return;
}
const location2 = new Error("programming error");
this.error(`assertion failed: ${location2.stack}`);
}
};
// ../taler-util/lib/taler-crypto.js
function getRandomBytes(n2) {
return randomBytes(n2);
}
var useNative = true;
var tart;
if (useNative) {
tart = globalThis._tart;
}
var encTable = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
var EncodingError = class extends Error {
constructor() {
super("Encoding error");
Object.setPrototypeOf(this, EncodingError.prototype);
}
};
function getValue(chr) {
let a5 = chr;
switch (chr) {
case "O":
case "o":
a5 = "0;";
break;
case "i":
case "I":
case "l":
case "L":
a5 = "1";
break;
case "u":
case "U":
a5 = "V";
}
if (a5 >= "0" && a5 <= "9") {
return a5.charCodeAt(0) - "0".charCodeAt(0);
}
if (a5 >= "a" && a5 <= "z")
a5 = a5.toUpperCase();
let dec = 0;
if (a5 >= "A" && a5 <= "Z") {
if ("I" < a5)
dec++;
if ("L" < a5)
dec++;
if ("O" < a5)
dec++;
if ("U" < a5)
dec++;
return a5.charCodeAt(0) - "A".charCodeAt(0) + 10 - dec;
}
throw new EncodingError();
}
function encodeCrock(data) {
if (tart) {
return tart.encodeCrock(data);
}
const dataBytes = new Uint8Array(data);
let sb = "";
const size = data.byteLength;
let bitBuf = 0;
let numBits = 0;
let pos = 0;
while (pos < size || numBits > 0) {
if (pos < size && numBits < 5) {
const d5 = dataBytes[pos++];
bitBuf = bitBuf << 8 | d5;
numBits += 8;
}
if (numBits < 5) {
bitBuf = bitBuf << 5 - numBits;
numBits = 5;
}
const v3 = bitBuf >>> numBits - 5 & 31;
sb += encTable[v3];
numBits -= 5;
}
return sb;
}
function kdf(outputLength, ikm, salt, info) {
if (tart) {
return tart.kdf(outputLength, ikm, salt, info);
}
salt = salt != null ? salt : new Uint8Array(64);
const prk = hmacSha512(salt, ikm);
info = info != null ? info : new Uint8Array(0);
const N3 = Math.ceil(outputLength / 32);
const output = new Uint8Array(N3 * 32);
for (let i4 = 0; i4 < N3; i4++) {
let buf;
if (i4 == 0) {
buf = new Uint8Array(info.byteLength + 1);
buf.set(info, 0);
} else {
buf = new Uint8Array(info.byteLength + 1 + 32);
for (let j4 = 0; j4 < 32; j4++) {
buf[j4] = output[(i4 - 1) * 32 + j4];
}
buf.set(info, 32);
}
buf[buf.length - 1] = i4 + 1;
const chunk = hmacSha256(prk, buf);
output.set(chunk, i4 * 32);
}
return output.slice(0, outputLength);
}
function kdfKw(args) {
return kdf(args.outputLength, args.ikm, args.salt, args.info);
}
function decodeCrock(encoded) {
if (tart) {
return tart.decodeCrock(encoded);
}
const size = encoded.length;
let bitpos = 0;
let bitbuf = 0;
let readPosition = 0;
const outLen = Math.floor(size * 5 / 8);
const out = new Uint8Array(outLen);
let outPos = 0;
while (readPosition < size || bitpos > 0) {
if (readPosition < size) {
const v3 = getValue(encoded[readPosition++]);
bitbuf = bitbuf << 5 | v3;
bitpos += 5;
}
while (bitpos >= 8) {
const d5 = bitbuf >>> bitpos - 8 & 255;
out[outPos++] = d5;
bitpos -= 8;
}
if (readPosition == size && bitpos > 0) {
bitbuf = bitbuf << 8 - bitpos & 255;
bitpos = bitbuf == 0 ? 0 : 8;
}
}
return out;
}
var encoder;
function stringToBytes(s5) {
if (!encoder) {
encoder = new TextEncoder();
}
return encoder.encode(s5);
}
function typedArrayConcat(chunks) {
let payloadLen = 0;
for (const c4 of chunks) {
payloadLen += c4.byteLength;
}
const buf = new ArrayBuffer(payloadLen);
const u8buf = new Uint8Array(buf);
let p4 = 0;
for (const c4 of chunks) {
u8buf.set(c4, p4);
p4 += c4.byteLength;
}
return u8buf;
}
function hash2(d5) {
if (tart) {
return tart.hash(d5);
}
return hash(d5);
}
var logger = new Logger("talerCrypto.ts");
function bufferForUint32(n2) {
const arrBuf = new ArrayBuffer(4);
const buf = new Uint8Array(arrBuf);
const dv = new DataView(arrBuf);
dv.setUint32(0, n2);
return buf;
}
var TalerSignaturePurpose;
(function(TalerSignaturePurpose2) {
TalerSignaturePurpose2[TalerSignaturePurpose2["MERCHANT_TRACK_TRANSACTION"] = 1103] = "MERCHANT_TRACK_TRANSACTION";
TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_RESERVE_WITHDRAW"] = 1200] = "WALLET_RESERVE_WITHDRAW";
TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_COIN_DEPOSIT"] = 1201] = "WALLET_COIN_DEPOSIT";
TalerSignaturePurpose2[TalerSignaturePurpose2["GLOBAL_FEES"] = 1022] = "GLOBAL_FEES";
TalerSignaturePurpose2[TalerSignaturePurpose2["MASTER_DENOMINATION_KEY_VALIDITY"] = 1025] = "MASTER_DENOMINATION_KEY_VALIDITY";
TalerSignaturePurpose2[TalerSignaturePurpose2["MASTER_WIRE_FEES"] = 1028] = "MASTER_WIRE_FEES";
TalerSignaturePurpose2[TalerSignaturePurpose2["MASTER_WIRE_DETAILS"] = 1030] = "MASTER_WIRE_DETAILS";
TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_COIN_MELT"] = 1202] = "WALLET_COIN_MELT";
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";
TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_AGE_ATTESTATION"] = 1207] = "WALLET_AGE_ATTESTATION";
TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_PURSE_CREATE"] = 1210] = "WALLET_PURSE_CREATE";
TalerSignaturePurpose2[TalerSignaturePurpose2["WALLET_PURSE_DEPOSIT"] = 1211] = "WALLET_PURSE_DEPOSIT";
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["TALER_SIGNATURE_AML_DECISION"] = 1350] = "TALER_SIGNATURE_AML_DECISION";
TalerSignaturePurpose2[TalerSignaturePurpose2["TALER_SIGNATURE_AML_QUERY"] = 1351] = "TALER_SIGNATURE_AML_QUERY";
TalerSignaturePurpose2[TalerSignaturePurpose2["TALER_SIGNATURE_MASTER_AML_KEY"] = 1017] = "TALER_SIGNATURE_MASTER_AML_KEY";
TalerSignaturePurpose2[TalerSignaturePurpose2["ANASTASIS_POLICY_UPLOAD"] = 1400] = "ANASTASIS_POLICY_UPLOAD";
TalerSignaturePurpose2[TalerSignaturePurpose2["ANASTASIS_POLICY_DOWNLOAD"] = 1401] = "ANASTASIS_POLICY_DOWNLOAD";
TalerSignaturePurpose2[TalerSignaturePurpose2["SYNC_BACKUP_UPLOAD"] = 1450] = "SYNC_BACKUP_UPLOAD";
})(TalerSignaturePurpose || (TalerSignaturePurpose = {}));
var WalletAccountMergeFlags;
(function(WalletAccountMergeFlags2) {
WalletAccountMergeFlags2[WalletAccountMergeFlags2["None"] = 0] = "None";
WalletAccountMergeFlags2[WalletAccountMergeFlags2["MergeFullyPaidPurse"] = 1] = "MergeFullyPaidPurse";
WalletAccountMergeFlags2[WalletAccountMergeFlags2["CreateFromPurseQuota"] = 2] = "CreateFromPurseQuota";
WalletAccountMergeFlags2[WalletAccountMergeFlags2["CreateWithPurseFee"] = 3] = "CreateWithPurseFee";
})(WalletAccountMergeFlags || (WalletAccountMergeFlags = {}));
var SignaturePurposeBuilder = class {
constructor(purposeNum) {
this.purposeNum = purposeNum;
this.chunks = [];
}
put(bytes) {
this.chunks.push(Uint8Array.from(bytes));
return this;
}
build() {
let payloadLen = 0;
for (const c4 of this.chunks) {
payloadLen += c4.byteLength;
}
const buf = new ArrayBuffer(4 + 4 + payloadLen);
const u8buf = new Uint8Array(buf);
let p4 = 8;
for (const c4 of this.chunks) {
u8buf.set(c4, p4);
p4 += c4.byteLength;
}
const dvbuf = new DataView(buf);
dvbuf.setUint32(0, payloadLen + 4 + 4);
dvbuf.setUint32(4, this.purposeNum);
return u8buf;
}
};
function buildSigPS(purposeNum) {
return new SignaturePurposeBuilder(purposeNum);
}
function bigintToNaclArr(x6, size) {
const byteArr = new Uint8Array(size);
const arr = x6.toArray(256).value.reverse();
byteArr.set(arr, 0);
return byteArr;
}
function bigintFromNaclArr(arr) {
let rev = new Uint8Array(arr);
rev = rev.reverse();
return import_big_integer.default.fromArray(Array.from(rev), 256, false);
}
var Edx25519;
(function(Edx255192) {
const revL = [
237,
211,
245,
92,
26,
99,
18,
88,
214,
156,
247,
162,
222,
249,
222,
20,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
16
];
const L5 = import_big_integer.default.fromArray(revL.reverse(), 256, false);
function keyCreateFromSeed(seed) {
return __async(this, null, function* () {
return crypto_edx25519_private_key_create_from_seed(seed);
});
}
Edx255192.keyCreateFromSeed = keyCreateFromSeed;
function keyCreate() {
return __async(this, null, function* () {
return crypto_edx25519_private_key_create();
});
}
Edx255192.keyCreate = keyCreate;
function getPublic(priv) {
return __async(this, null, function* () {
return crypto_edx25519_get_public(priv);
});
}
Edx255192.getPublic = getPublic;
function sign(msg, key) {
throw Error("not implemented");
}
Edx255192.sign = sign;
function deriveFactor(pub, seed) {
return __async(this, null, function* () {
const res = kdfKw({
outputLength: 64,
salt: seed,
ikm: pub,
info: stringToBytes("edx25519-derivation")
});
return res;
});
}
function privateKeyDerive(priv, seed) {
return __async(this, null, function* () {
const pub = yield getPublic(priv);
const privDec = priv;
const a5 = bigintFromNaclArr(privDec.subarray(0, 32));
const factorEnc = yield deriveFactor(pub, seed);
const factorModL = bigintFromNaclArr(factorEnc).mod(L5);
const aPrime = a5.divide(8).multiply(factorModL).mod(L5).multiply(8).mod(L5);
const bPrime = hash(typedArrayConcat([privDec.subarray(32, 64), factorEnc])).subarray(0, 32);
const newPriv = typedArrayConcat([bigintToNaclArr(aPrime, 32), bPrime]);
return newPriv;
});
}
Edx255192.privateKeyDerive = privateKeyDerive;
function publicKeyDerive(pub, seed) {
return __async(this, null, function* () {
const factorEnc = yield deriveFactor(pub, seed);
const factorReduced = crypto_core_ed25519_scalar_reduce(factorEnc);
const res = crypto_scalarmult_ed25519_noclamp(factorReduced, pub);
return res;
});
}
Edx255192.publicKeyDerive = publicKeyDerive;
})(Edx25519 || (Edx25519 = {}));
function invariant(cond) {
if (!cond) {
throw Error("invariant failed");
}
}
var AgeRestriction;
(function(AgeRestriction2) {
AgeRestriction2.AGE_UNRESTRICTED = 32;
function hashCommitment(ac) {
const hc = new HashState();
for (const pub of ac.publicKeys) {
hc.update(decodeCrock(pub));
}
return encodeCrock(hc.finish().subarray(0, 32));
}
AgeRestriction2.hashCommitment = hashCommitment;
function countAgeGroups(mask) {
let count = 0;
let m5 = mask;
while (m5 > 0) {
count += m5 & 1;
m5 = m5 >> 1;
}
return count;
}
AgeRestriction2.countAgeGroups = countAgeGroups;
function getAgeGroupsFromMask(mask) {
const groups = [];
let age = 1;
let m5 = mask >> 1;
while (m5 > 0) {
if (m5 & 1) {
groups.push(age);
}
m5 = m5 >> 1;
age++;
}
return groups;
}
AgeRestriction2.getAgeGroupsFromMask = getAgeGroupsFromMask;
function getAgeGroupIndex(mask, age) {
invariant((mask & 1) === 1);
let i4 = 0;
let m5 = mask;
let a5 = age;
while (m5 > 0) {
if (a5 <= 0) {
break;
}
m5 = m5 >> 1;
i4 += m5 & 1;
a5--;
}
return i4;
}
AgeRestriction2.getAgeGroupIndex = getAgeGroupIndex;
function ageGroupSpecToMask(ageGroupSpec) {
throw Error("not implemented");
}
AgeRestriction2.ageGroupSpecToMask = ageGroupSpecToMask;
function restrictionCommit(ageMask, age) {
return __async(this, null, function* () {
invariant((ageMask & 1) === 1);
const numPubs = countAgeGroups(ageMask) - 1;
const numPrivs = getAgeGroupIndex(ageMask, age);
const pubs = [];
const privs = [];
for (let i4 = 0; i4 < numPubs; i4++) {
const priv = yield Edx25519.keyCreate();
const pub = yield Edx25519.getPublic(priv);
pubs.push(pub);
if (i4 < numPrivs) {
privs.push(priv);
}
}
return {
commitment: {
mask: ageMask,
publicKeys: pubs.map((x6) => encodeCrock(x6))
},
proof: {
privateKeys: privs.map((x6) => encodeCrock(x6))
}
};
});
}
AgeRestriction2.restrictionCommit = restrictionCommit;
const PublishedAgeRestrictionBaseKey = decodeCrock("CH0VKFDZ2GWRWHQBBGEK9MWV5YDQVJ0RXEE0KYT3NMB69F0R96TG");
function restrictionCommitSeeded(ageMask, age, seed) {
return __async(this, null, function* () {
invariant((ageMask & 1) === 1);
const numPubs = countAgeGroups(ageMask) - 1;
const numPrivs = getAgeGroupIndex(ageMask, age);
const pubs = [];
const privs = [];
for (let i4 = 0; i4 < numPrivs; i4++) {
const privSeed = yield kdfKw({
outputLength: 32,
ikm: seed,
info: stringToBytes("age-commitment"),
salt: bufferForUint32(i4)
});
const priv = yield Edx25519.keyCreateFromSeed(privSeed);
const pub = yield Edx25519.getPublic(priv);
pubs.push(pub);
privs.push(priv);
}
for (let i4 = numPrivs; i4 < numPubs; i4++) {
const deriveSeed = yield kdfKw({
outputLength: 32,
ikm: seed,
info: stringToBytes("age-factor"),
salt: bufferForUint32(i4)
});
const pub = yield Edx25519.publicKeyDerive(PublishedAgeRestrictionBaseKey, deriveSeed);
pubs.push(pub);
}
return {
commitment: {
mask: ageMask,
publicKeys: pubs.map((x6) => encodeCrock(x6))
},
proof: {
privateKeys: privs.map((x6) => encodeCrock(x6))
}
};
});
}
AgeRestriction2.restrictionCommitSeeded = restrictionCommitSeeded;
function commitCompare(c1, c22, salt) {
return __async(this, null, function* () {
if (c1.publicKeys.length != c22.publicKeys.length) {
return false;
}
for (let i4 = 0; i4 < c1.publicKeys.length; i4++) {
const k1 = decodeCrock(c1.publicKeys[i4]);
const k22 = yield Edx25519.publicKeyDerive(decodeCrock(c22.publicKeys[i4]), salt);
if (k1 != k22) {
return false;
}
}
return true;
});
}
AgeRestriction2.commitCompare = commitCompare;
function commitmentDerive(commitmentProof, salt) {
return __async(this, null, function* () {
const newPrivs = [];
const newPubs = [];
for (const oldPub of commitmentProof.commitment.publicKeys) {
newPubs.push(yield Edx25519.publicKeyDerive(decodeCrock(oldPub), salt));
}
for (const oldPriv of commitmentProof.proof.privateKeys) {
newPrivs.push(yield Edx25519.privateKeyDerive(decodeCrock(oldPriv), salt));
}
return {
commitment: {
mask: commitmentProof.commitment.mask,
publicKeys: newPubs.map((x6) => encodeCrock(x6))
},
proof: {
privateKeys: newPrivs.map((x6) => encodeCrock(x6))
}
};
});
}
AgeRestriction2.commitmentDerive = commitmentDerive;
function commitmentAttest(commitmentProof, age) {
const d5 = buildSigPS(TalerSignaturePurpose.WALLET_AGE_ATTESTATION).put(bufferForUint32(commitmentProof.commitment.mask)).put(bufferForUint32(age)).build();
const group = getAgeGroupIndex(commitmentProof.commitment.mask, age);
if (group === 0) {
return new Uint8Array(64);
}
const priv = commitmentProof.proof.privateKeys[group - 1];
const pub = commitmentProof.commitment.publicKeys[group - 1];
const sig = crypto_edx25519_sign_detached(d5, decodeCrock(priv), decodeCrock(pub));
return sig;
}
AgeRestriction2.commitmentAttest = commitmentAttest;
function commitmentVerify(commitment, sig, age) {
const d5 = buildSigPS(TalerSignaturePurpose.WALLET_AGE_ATTESTATION).put(bufferForUint32(commitment.mask)).put(bufferForUint32(age)).build();
const group = getAgeGroupIndex(commitment.mask, age);
if (group === 0) {
return true;
}
const pub = commitment.publicKeys[group - 1];
return crypto_edx25519_sign_detached_verify(d5, decodeCrock(sig), decodeCrock(pub));
}
AgeRestriction2.commitmentVerify = commitmentVerify;
})(AgeRestriction || (AgeRestriction = {}));
var ContractFormatTag;
(function(ContractFormatTag2) {
ContractFormatTag2[ContractFormatTag2["PaymentOffer"] = 0] = "PaymentOffer";
ContractFormatTag2[ContractFormatTag2["PaymentRequest"] = 1] = "PaymentRequest";
})(ContractFormatTag || (ContractFormatTag = {}));
// ../taler-util/lib/bech32.js
var CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
var GENERATOR = [996825010, 642813549, 513874426, 1027748829, 705979059];
var encodings = {
BECH32: "bech32",
BECH32M: "bech32m"
};
var bech32_default = {
decode: decode2,
encode: encode2,
encodings
};
function getEncodingConst(enc) {
if (enc == encodings.BECH32) {
return 1;
} else if (enc == encodings.BECH32M) {
return 734539939;
} else {
throw new Error("unknown encoding");
}
}
function polymod(values) {
var chk = 1;
for (var p4 = 0; p4 < values.length; ++p4) {
var top = chk >> 25;
chk = (chk & 33554431) << 5 ^ values[p4];
for (var i4 = 0; i4 < 5; ++i4) {
if (top >> i4 & 1) {
chk ^= GENERATOR[i4];
}
}
}
return chk;
}
function hrpExpand(hrp) {
var ret = [];
var p4;
for (p4 = 0; p4 < hrp.length; ++p4) {
ret.push(hrp.charCodeAt(p4) >> 5);
}
ret.push(0);
for (p4 = 0; p4 < hrp.length; ++p4) {
ret.push(hrp.charCodeAt(p4) & 31);
}
return ret;
}
function verifyChecksum(hrp, data, enc) {
return polymod(hrpExpand(hrp).concat(data)) === getEncodingConst(enc);
}
function createChecksum(hrp, data, enc) {
var values = hrpExpand(hrp).concat(data).concat([0, 0, 0, 0, 0, 0]);
var mod = polymod(values) ^ getEncodingConst(enc);
var ret = [];
for (var p4 = 0; p4 < 6; ++p4) {
ret.push(mod >> 5 * (5 - p4) & 31);
}
return ret;
}
function encode2(hrp, data, enc) {
var combined = data.concat(createChecksum(hrp, data, enc));
var ret = hrp + "1";
for (var p4 = 0; p4 < combined.length; ++p4) {
ret += CHARSET.charAt(combined[p4]);
}
return ret;
}
function decode2(bechString, enc) {
var p4;
var has_lower = false;
var has_upper = false;
for (p4 = 0; p4 < bechString.length; ++p4) {
if (bechString.charCodeAt(p4) < 33 || bechString.charCodeAt(p4) > 126) {
return null;
}
if (bechString.charCodeAt(p4) >= 97 && bechString.charCodeAt(p4) <= 122) {
has_lower = true;
}
if (bechString.charCodeAt(p4) >= 65 && bechString.charCodeAt(p4) <= 90) {
has_upper = true;
}
}
if (has_lower && has_upper) {
return null;
}
bechString = bechString.toLowerCase();
var pos = bechString.lastIndexOf("1");
if (pos < 1 || pos + 7 > bechString.length || bechString.length > 90) {
return null;
}
var hrp = bechString.substring(0, pos);
var data = [];
for (p4 = pos + 1; p4 < bechString.length; ++p4) {
var d5 = CHARSET.indexOf(bechString.charAt(p4));
if (d5 === -1) {
return null;
}
data.push(d5);
}
if (!verifyChecksum(hrp, data, enc)) {
return null;
}
return { hrp, data: data.slice(0, data.length - 6) };
}
// ../taler-util/lib/segwit_addr.js
var segwit_addr_default = {
encode: encode3,
decode: decode3
};
function convertbits(data, frombits, tobits, pad) {
var acc = 0;
var bits = 0;
var ret = [];
var maxv = (1 << tobits) - 1;
for (var p4 = 0; p4 < data.length; ++p4) {
var value = data[p4];
if (value < 0 || value >> frombits !== 0) {
return [];
}
acc = acc << frombits | value;
bits += frombits;
while (bits >= tobits) {
bits -= tobits;
ret.push(acc >> bits & maxv);
}
}
if (pad) {
if (bits > 0) {
ret.push(acc << tobits - bits & maxv);
}
} else if (bits >= frombits || acc << tobits - bits & maxv) {
return [];
}
return ret;
}
function decode3(hrp, addr) {
var bech32m = false;
var dec = bech32_default.decode(addr, bech32_default.encodings.BECH32);
if (dec === null) {
dec = bech32_default.decode(addr, bech32_default.encodings.BECH32M);
bech32m = true;
}
if (dec === null || dec.hrp !== hrp || dec.data.length < 1 || dec.data[0] > 16) {
return null;
}
var res = convertbits(dec.data.slice(1), 5, 8, false);
if (res === null || res.length < 2 || res.length > 40) {
return null;
}
if (dec.data[0] === 0 && res.length !== 20 && res.length !== 32) {
return null;
}
if (dec.data[0] === 0 && bech32m) {
return null;
}
if (dec.data[0] !== 0 && !bech32m) {
return null;
}
return { version: dec.data[0], program: res };
}
function encode3(hrp, version, program) {
var enc = bech32_default.encodings.BECH32;
if (version > 0) {
enc = bech32_default.encodings.BECH32M;
}
var ret = bech32_default.encode(hrp, [version].concat(convertbits(program, 8, 5, true)), enc);
if (decode3(
hrp,
ret
/*, enc*/
) === null) {
return "";
}
return ret;
}
// ../taler-util/lib/bitcoin.js
function generateFakeSegwitAddress(reservePub, addr) {
if (!reservePub)
return [];
let pub;
try {
pub = decodeCrock(reservePub);
} catch (e4) {
}
if (!pub || pub.length !== 32)
return [];
const first_rnd = new Uint8Array(4);
first_rnd.set(pub.subarray(0, 4));
const second_rnd = new Uint8Array(4);
second_rnd.set(pub.subarray(0, 4));
first_rnd[0] = first_rnd[0] & 127;
second_rnd[0] = second_rnd[0] | 128;
const first_part = new Uint8Array(first_rnd.length + pub.length / 2);
first_part.set(first_rnd, 0);
first_part.set(pub.subarray(0, 16), 4);
const second_part = new Uint8Array(first_rnd.length + pub.length / 2);
second_part.set(second_rnd, 0);
second_part.set(pub.subarray(16, 32), 4);
const prefix2 = addr[0] === "t" && addr[1] == "b" ? "tb" : addr[0] === "b" && addr[1] == "c" && addr[2] === "r" && addr[3] == "t" ? "bcrt" : addr[0] === "b" && addr[1] == "c" ? "bc" : void 0;
if (prefix2 === void 0)
throw new Error("unknown bitcoin net");
const addr1 = segwit_addr_default.encode(prefix2, 0, first_part);
const addr2 = segwit_addr_default.encode(prefix2, 0, second_part);
return [addr1, addr2];
}
// ../taler-util/lib/payto.js
var paytoPfx = "payto://";
function stringifyPaytoUri(p4) {
const url = new URL(`${paytoPfx}${p4.targetType}/${p4.targetPath}`);
const paramList = !p4.params ? [] : Object.entries(p4.params);
paramList.forEach(([key, value]) => {
url.searchParams.set(key, value);
});
return url.href;
}
function parsePaytoUri(s5) {
if (!s5.startsWith(paytoPfx)) {
return void 0;
}
const [acct, search] = s5.slice(paytoPfx.length).split("?");
const firstSlashPos = acct.indexOf("/");
if (firstSlashPos === -1) {
return void 0;
}
const targetType = acct.slice(0, firstSlashPos);
const targetPath = acct.slice(firstSlashPos + 1);
const params = {};
const searchParams = new URLSearchParams(search || "");
searchParams.forEach((v3, k5) => {
params[k5] = v3;
});
if (targetType === "x-taler-bank") {
const parts = targetPath.split("/");
const host = parts[0];
const account = parts[1];
return {
targetPath,
targetType,
params,
isKnown: true,
host,
account
};
}
if (targetType === "iban") {
const parts = targetPath.split("/");
let iban = void 0;
let bic = void 0;
if (parts.length === 1) {
iban = parts[0];
}
if (parts.length === 2) {
bic = parts[0];
iban = parts[1];
} else {
iban = targetPath;
}
return {
isKnown: true,
targetPath,
targetType,
params,
iban,
bic
};
}
if (targetType === "bitcoin") {
const msg = /\b([A-Z0-9]{52})\b/.exec(params["message"]);
const reserve = !msg ? params["subject"] : msg[0];
const segwitAddrs = !reserve ? [] : generateFakeSegwitAddress(reserve, targetPath);
const result = {
isKnown: true,
targetPath,
targetType,
params,
segwitAddrs
};
return result;
}
return {
targetPath,
targetType,
params,
isKnown: false
};
}
// ../taler-util/lib/ReserveTransaction.js
var ReserveTransactionType;
(function(ReserveTransactionType2) {
ReserveTransactionType2["Withdraw"] = "WITHDRAW";
ReserveTransactionType2["Credit"] = "CREDIT";
ReserveTransactionType2["Recoup"] = "RECOUP";
ReserveTransactionType2["Closing"] = "CLOSING";
})(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";
TalerUriType2["TalerTemplate"] = "taler-template";
TalerUriType2["TalerPayTemplate"] = "taler-pay-template";
TalerUriType2["TalerWithdraw"] = "taler-withdraw";
TalerUriType2["TalerTip"] = "taler-tip";
TalerUriType2["TalerRefund"] = "taler-refund";
TalerUriType2["TalerPayPush"] = "taler-pay-push";
TalerUriType2["TalerPayPull"] = "taler-pay-pull";
TalerUriType2["TalerRecovery"] = "taler-recovery";
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["Reward"] = "reward";
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.Reward]: parseRewardUri,
[TalerUriAction.Withdraw]: parseWithdrawUri,
[TalerUriAction.DevExperiment]: parseDevExperimentUri,
[TalerUriAction.Exchange]: parseExchangeUri,
[TalerUriAction.Auditor]: parseAuditorUri,
[TalerUriAction.WithdrawExchange]: parseWithdrawExchangeUri
};
function parsePayUri(s5) {
var _a, _b, _c;
const pi = parseProtoInfo(s5, "pay");
if (!pi) {
return void 0;
}
const c4 = pi == null ? void 0 : pi.rest.split("?");
const q5 = new URLSearchParams((_a = c4[1]) != null ? _a : "");
const claimToken = (_b = q5.get("c")) != null ? _b : void 0;
const noncePriv = (_c = q5.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 _a;
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 q5 = new URLSearchParams((_a = c4[1]) != null ? _a : "");
const params = {};
q5.forEach((v3, k5) => {
params[k5] = 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 parseRewardUri(s5) {
const pi = parseProtoInfo(s5, "reward");
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 rewardId = 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.Reward,
merchantBaseUrl,
merchantRewardId: rewardId
};
}
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 _a, _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 q5 = new URLSearchParams((_a = c4[1]) != null ? _a : "");
const amount = (_b = q5.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
};
}
function stringifyPayTemplateUri({ merchantBaseUrl, templateId, templateParams }) {
const { proto, path, query } = getUrlInfo(merchantBaseUrl, templateParams);
return `${proto}://pay-template/${path}${templateId}${query}`;
}
function stringifyRefundUri({ merchantBaseUrl, orderId }) {
const { proto, path } = getUrlInfo(merchantBaseUrl);
return `${proto}://refund/${path}${orderId}`;
}
function stringifyRewardUri({ merchantBaseUrl, merchantRewardId }) {
const { proto, path } = getUrlInfo(merchantBaseUrl);
return `${proto}://reward/${path}${merchantRewardId}`;
}
function getUrlInfo(baseUrl, params = {}) {
const url = new URL2(baseUrl);
let proto;
if (url.protocol === "https:") {
proto = "taler";
} else if (url.protocol === "http:") {
proto = "taler+http";
} else {
throw Error(`Unsupported URL protocol in ${baseUrl}`);
}
let path = url.hostname;
if (url.port) {
path = path + ":" + url.port;
}
if (url.pathname) {
path = path + url.pathname;
}
if (!path.endsWith("/")) {
path = path + "/";
}
const qp = new URLSearchParams();
let withParams = false;
Object.entries(params).forEach(([name, value]) => {
if (value !== void 0) {
withParams = true;
qp.append(name, value);
}
});
const query = withParams ? "?" + qp.toString() : "";
return { proto, path, query };
}
// ../taler-util/lib/transactions-types.js
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";
TransactionType2["Reward"] = "reward";
TransactionType2["Deposit"] = "deposit";
TransactionType2["PeerPushDebit"] = "peer-push-debit";
TransactionType2["PeerPushCredit"] = "peer-push-credit";
TransactionType2["PeerPullDebit"] = "peer-pull-debit";
TransactionType2["PeerPullCredit"] = "peer-pull-credit";
})(TransactionType || (TransactionType = {}));
var WithdrawalType;
(function(WithdrawalType2) {
WithdrawalType2["TalerBankIntegrationApi"] = "taler-bank-integration-api";
WithdrawalType2["ManualTransfer"] = "manual-transfer";
})(WithdrawalType || (WithdrawalType = {}));
var PaymentStatus;
(function(PaymentStatus2) {
PaymentStatus2["Aborted"] = "aborted";
PaymentStatus2["Failed"] = "failed";
PaymentStatus2["Paid"] = "paid";
PaymentStatus2["Accepted"] = "accepted";
})(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";
ScopeType2["Exchange"] = "exchange";
ScopeType2["Auditor"] = "auditor";
})(ScopeType || (ScopeType = {}));
var CoinStatus;
(function(CoinStatus2) {
CoinStatus2["Fresh"] = "fresh";
CoinStatus2["FreshSuspended"] = "fresh-suspended";
CoinStatus2["Dormant"] = "dormant";
})(CoinStatus || (CoinStatus = {}));
var ConfirmPayResultType;
(function(ConfirmPayResultType2) {
ConfirmPayResultType2["Done"] = "done";
ConfirmPayResultType2["Pending"] = "pending";
})(ConfirmPayResultType || (ConfirmPayResultType = {}));
var PreparePayResultType;
(function(PreparePayResultType2) {
PreparePayResultType2["PaymentPossible"] = "payment-possible";
PreparePayResultType2["InsufficientBalance"] = "insufficient-balance";
PreparePayResultType2["AlreadyConfirmed"] = "already-confirmed";
})(PreparePayResultType || (PreparePayResultType = {}));
var RefreshReason;
(function(RefreshReason2) {
RefreshReason2["Manual"] = "manual";
RefreshReason2["PayMerchant"] = "pay-merchant";
RefreshReason2["PayDeposit"] = "pay-deposit";
RefreshReason2["PayPeerPush"] = "pay-peer-push";
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";
})(RefreshReason || (RefreshReason = {}));
var ExchangeTosStatus;
(function(ExchangeTosStatus2) {
ExchangeTosStatus2["Pending"] = "pending";
ExchangeTosStatus2["Proposed"] = "proposed";
ExchangeTosStatus2["Accepted"] = "accepted";
})(ExchangeTosStatus || (ExchangeTosStatus = {}));
var ExchangeEntryStatus;
(function(ExchangeEntryStatus2) {
ExchangeEntryStatus2["Preset"] = "preset";
ExchangeEntryStatus2["Ephemeral"] = "ephemeral";
ExchangeEntryStatus2["Used"] = "used";
})(ExchangeEntryStatus || (ExchangeEntryStatus = {}));
var ExchangeUpdateStatus;
(function(ExchangeUpdateStatus2) {
ExchangeUpdateStatus2["Initial"] = "initial";
ExchangeUpdateStatus2["InitialUpdate"] = "initial(update)";
ExchangeUpdateStatus2["Suspended"] = "suspended";
ExchangeUpdateStatus2["Failed"] = "failed";
ExchangeUpdateStatus2["OutdatedUpdate"] = "outdated(update)";
ExchangeUpdateStatus2["Ready"] = "ready";
ExchangeUpdateStatus2["ReadyUpdate"] = "ready(update)";
})(ExchangeUpdateStatus || (ExchangeUpdateStatus = {}));
var RecoveryMergeStrategy;
(function(RecoveryMergeStrategy2) {
RecoveryMergeStrategy2["Ours"] = "ours";
RecoveryMergeStrategy2["Theirs"] = "theirs";
})(RecoveryMergeStrategy || (RecoveryMergeStrategy = {}));
var AttentionPriority;
(function(AttentionPriority2) {
AttentionPriority2["High"] = "high";
AttentionPriority2["Medium"] = "medium";
AttentionPriority2["Low"] = "low";
})(AttentionPriority || (AttentionPriority = {}));
var AttentionType;
(function(AttentionType2) {
AttentionType2["KycWithdrawal"] = "kyc-withdrawal";
AttentionType2["BackupUnpaid"] = "backup-unpaid";
AttentionType2["BackupExpiresSoon"] = "backup-expires-soon";
AttentionType2["MerchantRefund"] = "merchant-refund";
AttentionType2["ExchangeTosChanged"] = "exchange-tos-changed";
AttentionType2["ExchangeKeyExpired"] = "exchange-key-expired";
AttentionType2["ExchangeKeyExpiresSoon"] = "exchange-key-expires-soon";
AttentionType2["ExchangeDenominationsExpired"] = "exchange-denominations-expired";
AttentionType2["ExchangeDenominationsExpiresSoon"] = "exchange-denominations-expires-soon";
AttentionType2["AuditorTosChanged"] = "auditor-tos-changed";
AttentionType2["AuditorKeyExpires"] = "auditor-key-expires";
AttentionType2["AuditorDenominationsExpires"] = "auditor-denominations-expires";
AttentionType2["PullPaymentPaid"] = "pull-payment-paid";
AttentionType2["PushPaymentReceived"] = "push-payment-withdrawn";
})(AttentionType || (AttentionType = {}));
var UserAttentionPriority = {
"kyc-withdrawal": AttentionPriority.Medium,
"backup-unpaid": AttentionPriority.High,
"backup-expires-soon": AttentionPriority.Medium,
"merchant-refund": AttentionPriority.Medium,
"exchange-tos-changed": AttentionPriority.Medium,
"exchange-key-expired": AttentionPriority.High,
"exchange-key-expires-soon": AttentionPriority.Medium,
"exchange-denominations-expired": AttentionPriority.High,
"exchange-denominations-expires-soon": AttentionPriority.Medium,
"auditor-tos-changed": AttentionPriority.Medium,
"auditor-key-expires": AttentionPriority.Medium,
"auditor-denominations-expires": AttentionPriority.Medium,
"pull-payment-paid": AttentionPriority.High,
"push-payment-withdrawn": AttentionPriority.High
};
// ../taler-util/lib/i18n.js
var jedLib = __toESM(require_jed(), 1);
var logger2 = new Logger("i18n/index.ts");
var jed = void 0;
function setupI18n(lang, strings2) {
lang = lang.replace("_", "-");
if (!strings2[lang]) {
strings2[lang] = {};
}
jed = new jedLib.Jed(strings2[lang]);
}
function toI18nString(stringSeq) {
let s5 = "";
for (let i4 = 0; i4 < stringSeq.length; i4++) {
s5 += stringSeq[i4];
if (i4 < stringSeq.length - 1) {
s5 += `%${i4 + 1}$s`;
}
}
return s5;
}
function singular(stringSeq, ...values) {
const s5 = toI18nString(stringSeq);
const tr = jed.translate(s5).ifPlural(1, s5).fetch(...values);
return tr;
}
function translate(stringSeq, ...values) {
const s5 = toI18nString(stringSeq);
if (!s5)
return [];
const translation = jed.ngettext(s5, s5, 1);
return replacePlaceholderWithValues(translation, values);
}
function Translate({ children, debug }) {
const c4 = [].concat(children);
const s5 = stringifyArray(c4);
if (!s5)
return [];
const translation = jed.ngettext(s5, s5, 1);
if (debug) {
console.log("looking for ", s5, "got", translation);
}
return replacePlaceholderWithValues(translation, c4);
}
function replacePlaceholderWithValues(translation, childArray) {
const tr = translation.split(/%(\d+)\$s/);
const placeholderChildren = [];
for (let i4 = 0; i4 < childArray.length; i4++) {
const x6 = childArray[i4];
if (x6 === void 0) {
continue;
} else if (typeof x6 === "string") {
continue;
} else {
placeholderChildren.push(x6);
}
}
const result = [];
for (let i4 = 0; i4 < tr.length; i4++) {
if (i4 % 2 == 0) {
result.push(tr[i4]);
} else {
const childIdx = Number.parseInt(tr[i4]) - 1;
result.push(placeholderChildren[childIdx]);
}
}
return result;
}
function stringifyArray(children) {
let n2 = 1;
const ss = children.map((c4) => {
if (typeof c4 === "string") {
return c4;
}
return `%${n2++}$s`;
});
const s5 = ss.join("").replace(/ +/g, " ").trim();
return s5;
}
var i18n = {
str: singular,
singular,
Translate,
translate
};
// ../taler-util/lib/fnutils.js
var fnutil;
(function(fnutil2) {
function all(arr, f3) {
for (const x6 of arr) {
if (!f3(x6)) {
return false;
}
}
return true;
}
fnutil2.all = all;
function any(arr, f3) {
for (const x6 of arr) {
if (f3(x6)) {
return true;
}
}
return false;
}
fnutil2.any = any;
})(fnutil || (fnutil = {}));
// ../taler-util/lib/http-status-codes.js
var HttpStatusCode;
(function(HttpStatusCode2) {
HttpStatusCode2[HttpStatusCode2["Continue"] = 100] = "Continue";
HttpStatusCode2[HttpStatusCode2["SwitchingProtocols"] = 101] = "SwitchingProtocols";
HttpStatusCode2[HttpStatusCode2["Processing"] = 102] = "Processing";
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
HttpStatusCode2[HttpStatusCode2["Accepted"] = 202] = "Accepted";
HttpStatusCode2[HttpStatusCode2["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
HttpStatusCode2[HttpStatusCode2["ResetContent"] = 205] = "ResetContent";
HttpStatusCode2[HttpStatusCode2["PartialContent"] = 206] = "PartialContent";
HttpStatusCode2[HttpStatusCode2["MultiStatus"] = 207] = "MultiStatus";
HttpStatusCode2[HttpStatusCode2["AlreadyReported"] = 208] = "AlreadyReported";
HttpStatusCode2[HttpStatusCode2["ImUsed"] = 226] = "ImUsed";
HttpStatusCode2[HttpStatusCode2["MultipleChoices"] = 300] = "MultipleChoices";
HttpStatusCode2[HttpStatusCode2["MovedPermanently"] = 301] = "MovedPermanently";
HttpStatusCode2[HttpStatusCode2["Found"] = 302] = "Found";
HttpStatusCode2[HttpStatusCode2["SeeOther"] = 303] = "SeeOther";
HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
HttpStatusCode2[HttpStatusCode2["UseProxy"] = 305] = "UseProxy";
HttpStatusCode2[HttpStatusCode2["SwitchProxy"] = 306] = "SwitchProxy";
HttpStatusCode2[HttpStatusCode2["TemporaryRedirect"] = 307] = "TemporaryRedirect";
HttpStatusCode2[HttpStatusCode2["PermanentRedirect"] = 308] = "PermanentRedirect";
HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
HttpStatusCode2[HttpStatusCode2["PaymentRequired"] = 402] = "PaymentRequired";
HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
HttpStatusCode2[HttpStatusCode2["MethodNotAllowed"] = 405] = "MethodNotAllowed";
HttpStatusCode2[HttpStatusCode2["NotAcceptable"] = 406] = "NotAcceptable";
HttpStatusCode2[HttpStatusCode2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
HttpStatusCode2[HttpStatusCode2["RequestTimeout"] = 408] = "RequestTimeout";
HttpStatusCode2[HttpStatusCode2["Conflict"] = 409] = "Conflict";
HttpStatusCode2[HttpStatusCode2["Gone"] = 410] = "Gone";
HttpStatusCode2[HttpStatusCode2["LengthRequired"] = 411] = "LengthRequired";
HttpStatusCode2[HttpStatusCode2["PreconditionFailed"] = 412] = "PreconditionFailed";
HttpStatusCode2[HttpStatusCode2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
HttpStatusCode2[HttpStatusCode2["UriTooLong"] = 414] = "UriTooLong";
HttpStatusCode2[HttpStatusCode2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
HttpStatusCode2[HttpStatusCode2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
HttpStatusCode2[HttpStatusCode2["ExpectationFailed"] = 417] = "ExpectationFailed";
HttpStatusCode2[HttpStatusCode2["IAmATeapot"] = 418] = "IAmATeapot";
HttpStatusCode2[HttpStatusCode2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
HttpStatusCode2[HttpStatusCode2["UnprocessableEntity"] = 422] = "UnprocessableEntity";
HttpStatusCode2[HttpStatusCode2["Locked"] = 423] = "Locked";
HttpStatusCode2[HttpStatusCode2["FailedDependency"] = 424] = "FailedDependency";
HttpStatusCode2[HttpStatusCode2["UpgradeRequired"] = 426] = "UpgradeRequired";
HttpStatusCode2[HttpStatusCode2["PreconditionRequired"] = 428] = "PreconditionRequired";
HttpStatusCode2[HttpStatusCode2["TooManyRequests"] = 429] = "TooManyRequests";
HttpStatusCode2[HttpStatusCode2["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
HttpStatusCode2[HttpStatusCode2["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
HttpStatusCode2[HttpStatusCode2["InternalServerError"] = 500] = "InternalServerError";
HttpStatusCode2[HttpStatusCode2["NotImplemented"] = 501] = "NotImplemented";
HttpStatusCode2[HttpStatusCode2["BadGateway"] = 502] = "BadGateway";
HttpStatusCode2[HttpStatusCode2["ServiceUnavailable"] = 503] = "ServiceUnavailable";
HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
HttpStatusCode2[HttpStatusCode2["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
HttpStatusCode2[HttpStatusCode2["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
HttpStatusCode2[HttpStatusCode2["InsufficientStorage"] = 507] = "InsufficientStorage";
HttpStatusCode2[HttpStatusCode2["LoopDetected"] = 508] = "LoopDetected";
HttpStatusCode2[HttpStatusCode2["NotExtended"] = 510] = "NotExtended";
HttpStatusCode2[HttpStatusCode2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
})(HttpStatusCode || (HttpStatusCode = {}));
// ../taler-util/lib/RequestThrottler.js
var logger3 = new Logger("RequestThrottler.ts");
// ../taler-util/lib/CancellationToken.js
var NOOP = () => {
};
var CancellationToken = class {
/**
* Whether the token has been cancelled.
*/
get isCancelled() {
return this._isCancelled;
}
/**
* Whether the token can be cancelled.
*/
get canBeCancelled() {
return this._canBeCancelled;
}
/**
* Why this token has been cancelled.
*/
get reason() {
if (this.isCancelled) {
return this._reason;
} else {
throw new Error("This token is not cancelled.");
}
}
/**
* Make a promise that resolves when the async operation resolves,
* or rejects when the operation is rejected or this token is cancelled.
*/
racePromise(asyncOperation) {
if (!this.canBeCancelled) {
return asyncOperation;
}
return new Promise((resolve, reject) => {
const unregister = this.onCancelled((reason) => reject(new CancellationToken.CancellationError(reason)));
asyncOperation.then((value) => {
resolve(value);
unregister();
}, (err) => {
reject(err);
unregister();
});
});
}
/**
* Throw a {CancellationToken.CancellationError} if this token is cancelled.
*/
throwIfCancelled() {
if (this._isCancelled) {
throw new CancellationToken.CancellationError(this._reason);
}
}
/**
* Invoke the callback when this token is cancelled.
* If this token is already cancelled, the callback is invoked immediately.
* Returns a function that unregisters the cancellation callback.
*/
onCancelled(cb) {
var _a;
if (!this.canBeCancelled) {
return NOOP;
}
if (this.isCancelled) {
cb(this.reason);
return NOOP;
}
(_a = this._callbacks) == null ? void 0 : _a.add(cb);
return () => {
var _a2;
return (_a2 = this._callbacks) == null ? void 0 : _a2.delete(cb);
};
}
constructor(_isCancelled, _canBeCancelled) {
this._isCancelled = _isCancelled;
this._canBeCancelled = _canBeCancelled;
this._callbacks = /* @__PURE__ */ new Set();
}
/**
* Create a {CancellationTokenSource}.
*/
static create() {
const token = new CancellationToken(false, true);
const cancel = (reason) => {
var _a;
if (token._isCancelled)
return;
token._isCancelled = true;
token._reason = reason;
(_a = token._callbacks) == null ? void 0 : _a.forEach((cb) => cb(reason));
dispose();
};
const dispose = () => {
token._canBeCancelled = token.isCancelled;
delete token._callbacks;
};
return { token, cancel, dispose };
}
/**
* Create a {CancellationTokenSource}.
* The token will be cancelled automatically after the specified timeout in milliseconds.
*/
static timeout(ms) {
const { token, cancel: originalCancel, dispose: originalDispose } = CancellationToken.create();
let timer;
timer = setTimeout(() => originalCancel(CancellationToken.timeout), ms);
const disposeTimer = () => {
if (timer == null)
return;
clearTimeout(timer);
timer = null;
};
const cancel = (reason) => {
disposeTimer();
originalCancel(reason);
};
const dispose = () => {
disposeTimer();
originalDispose();
};
return { token, cancel, dispose };
}
/**
* Create a {CancellationToken} that is cancelled when all of the given tokens are cancelled.
*
* This is like {Promise.all} for {CancellationToken}s.
*/
static all(...tokens) {
if (tokens.some((token) => !token.canBeCancelled)) {
return CancellationToken.CONTINUE;
}
const combined = CancellationToken.create();
let countdown = tokens.length;
const handleNextTokenCancelled = () => {
if (--countdown === 0) {
const reasons = tokens.map((token) => token._reason);
combined.cancel(reasons);
}
};
tokens.forEach((token) => token.onCancelled(handleNextTokenCancelled));
return combined.token;
}
/**
* Create a {CancellationToken} that is cancelled when at least one of the given tokens is cancelled.
*
* This is like {Promise.race} for {CancellationToken}s.
*/
static race(...tokens) {
for (const token of tokens) {
if (token._isCancelled) {
return token;
}
}
const combined = CancellationToken.create();
let unregistrations;
const handleAnyTokenCancelled = (reason) => {
unregistrations.forEach((unregister) => unregister());
combined.cancel(reason);
};
unregistrations = tokens.map((token) => token.onCancelled(handleAnyTokenCancelled));
return combined.token;
}
};
CancellationToken.CANCELLED = new CancellationToken(true, true);
CancellationToken.CONTINUE = new CancellationToken(false, false);
(function(CancellationToken2) {
class CancellationError extends Error {
constructor(reason) {
super("Operation cancelled");
this.reason = reason;
Object.setPrototypeOf(this, CancellationError.prototype);
}
}
CancellationToken2.CancellationError = CancellationError;
})(CancellationToken || (CancellationToken = {}));
// ../taler-util/lib/contract-terms.js
var logger4 = new Logger("contractTerms.ts");
var ContractTermsUtil;
(function(ContractTermsUtil2) {
function forgetAllImpl(anyJson, path, pred) {
const dup = JSON.parse(JSON.stringify(anyJson));
if (Array.isArray(dup)) {
for (let i4 = 0; i4 < dup.length; i4++) {
dup[i4] = forgetAllImpl(dup[i4], [...path, `${i4}`], pred);
}
} else if (typeof dup === "object" && dup != null) {
if (typeof dup.$forgettable === "object") {
for (const x6 of Object.keys(dup.$forgettable)) {
if (!pred([...path, x6])) {
continue;
}
if (!dup.$forgotten) {
dup.$forgotten = {};
}
if (!dup.$forgotten[x6]) {
const membValCanon = stringToBytes(canonicalJson(scrub(dup[x6])) + "\0");
const membSalt = stringToBytes(dup.$forgettable[x6] + "\0");
const h5 = kdf(64, membValCanon, membSalt, new Uint8Array([]));
dup.$forgotten[x6] = encodeCrock(h5);
}
delete dup[x6];
delete dup.$forgettable[x6];
}
if (Object.keys(dup.$forgettable).length === 0) {
delete dup.$forgettable;
}
}
for (const x6 of Object.keys(dup)) {
if (x6.startsWith("$")) {
continue;
}
dup[x6] = forgetAllImpl(dup[x6], [...path, x6], pred);
}
}
return dup;
}
ContractTermsUtil2.forgetAllImpl = forgetAllImpl;
function scrub(anyJson) {
return forgetAllImpl(anyJson, [], () => true);
}
ContractTermsUtil2.scrub = scrub;
function forgetAll(anyJson, pred) {
return forgetAllImpl(anyJson, [], pred);
}
ContractTermsUtil2.forgetAll = forgetAll;
function saltForgettable(anyJson) {
const dup = JSON.parse(JSON.stringify(anyJson));
if (Array.isArray(dup)) {
for (let i4 = 0; i4 < dup.length; i4++) {
dup[i4] = saltForgettable(dup[i4]);
}
} else if (typeof dup === "object" && dup !== null) {
if (typeof dup.$forgettable === "object") {
for (const k5 of Object.keys(dup.$forgettable)) {
if (dup.$forgettable[k5] === true) {
dup.$forgettable[k5] = encodeCrock(getRandomBytes(32));
}
}
}
for (const x6 of Object.keys(dup)) {
if (x6.startsWith("$")) {
continue;
}
dup[x6] = saltForgettable(dup[x6]);
}
}
return dup;
}
ContractTermsUtil2.saltForgettable = saltForgettable;
const nameRegex = /^[0-9A-Za-z_]+$/;
function validateForgettable(anyJson) {
var _a;
if (typeof anyJson === "string") {
return true;
}
if (typeof anyJson === "number") {
return Number.isInteger(anyJson) && anyJson >= Number.MIN_SAFE_INTEGER && anyJson <= Number.MAX_SAFE_INTEGER;
}
if (typeof anyJson === "boolean") {
return true;
}
if (anyJson === null) {
return true;
}
if (Array.isArray(anyJson)) {
return anyJson.every((x6) => validateForgettable(x6));
}
if (typeof anyJson === "object") {
for (const k5 of Object.keys(anyJson)) {
if (k5.match(nameRegex)) {
if (validateForgettable(anyJson[k5])) {
continue;
} else {
return false;
}
}
if (k5 === "$forgettable") {
const fga = anyJson.$forgettable;
if (!fga || typeof fga !== "object") {
return false;
}
for (const fk of Object.keys(fga)) {
if (!fk.match(nameRegex)) {
return false;
}
if (!(fk in anyJson)) {
return false;
}
const fv = anyJson.$forgettable[fk];
if (typeof fv !== "string") {
return false;
}
}
} else if (k5 === "$forgotten") {
const fgo = anyJson.$forgotten;
if (!fgo || typeof fgo !== "object") {
return false;
}
for (const fk of Object.keys(fgo)) {
if (!fk.match(nameRegex)) {
return false;
}
if (fk in anyJson) {
return false;
}
const fv = anyJson.$forgotten[fk];
if (typeof fv !== "string") {
return false;
}
try {
const decFv = decodeCrock(fv);
if (decFv.length != 64) {
return false;
}
} catch (e4) {
return false;
}
if (((_a = anyJson.$forgettable) == null ? void 0 : _a[k5]) !== void 0) {
return false;
}
}
} else {
return false;
}
}
return true;
}
return false;
}
ContractTermsUtil2.validateForgettable = validateForgettable;
function validateNothingForgotten(contractTerms) {
throw Error("not implemented yet");
}
ContractTermsUtil2.validateNothingForgotten = validateNothingForgotten;
function hashContractTerms(contractTerms) {
const cleaned = scrub(contractTerms);
const canon = canonicalJson(cleaned) + "\0";
const bytes = stringToBytes(canon);
return encodeCrock(hash2(bytes));
}
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");
// ../taler-util/lib/MerchantApiClient.js
var logger6 = new Logger("MerchantApiClient.ts");
// ../taler-util/lib/bank-api-client.js
var logger7 = new Logger("bank-api-client.ts");
var CreditDebitIndicator;
(function(CreditDebitIndicator2) {
CreditDebitIndicator2["Credit"] = "credit";
CreditDebitIndicator2["Debit"] = "debit";
})(CreditDebitIndicator || (CreditDebitIndicator = {}));
// ../taler-util/lib/index.browser.js
loadBrowserPrng();
// ../web-util/lib/index.browser.mjs
init_hooks_module();
init_hooks_module();
init_hooks_module();
init_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_preact_module();
init_hooks_module();
var __defProp2 = Object.defineProperty;
var __export2 = (target, all) => {
for (var name in all)
__defProp2(target, name, { get: all[name], enumerable: true });
};
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);
}
},
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(([k5, v3]) => {
backend.set(k5, 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);
}
}
}
}
});
return backend;
}
function buildStorageKey(name, codec) {
return {
id: name,
codec: codec != null ? codec : codecForString()
};
}
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(() => {
return storage.onUpdate(key.id, () => {
const newValue = storage.get(key.id);
setStoredValue(convert2(newValue));
});
}, [key.id]);
const setValue = (value) => {
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);
}
};
}
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 defaultValue = (getBrowserLang() || initial2 || "en").substring(0, 2);
return useLocalStorage(langPreferenceKey, defaultValue);
}
var storage2 = memoryMap();
var storage3 = memoryMap();
function base64encode(str) {
return base64EncArr(strToUTF8Arr(str));
}
function uint6ToB64(nUint6) {
return nUint6 < 26 ? nUint6 + 65 : nUint6 < 52 ? nUint6 + 71 : nUint6 < 62 ? nUint6 - 4 : nUint6 === 62 ? 43 : nUint6 === 63 ? 47 : 65;
}
function base64EncArr(aBytes) {
let nMod3 = 2;
let sB64Enc = "";
const nLen = aBytes.length;
let nUint24 = 0;
for (let nIdx = 0; nIdx < nLen; nIdx++) {
nMod3 = nIdx % 3;
nUint24 |= aBytes[nIdx] << (16 >>> nMod3 & 24);
if (nMod3 === 2 || aBytes.length - nIdx === 1) {
sB64Enc += String.fromCodePoint(
uint6ToB64(nUint24 >>> 18 & 63),
uint6ToB64(nUint24 >>> 12 & 63),
uint6ToB64(nUint24 >>> 6 & 63),
uint6ToB64(nUint24 & 63)
);
nUint24 = 0;
}
}
return sB64Enc.substring(0, sB64Enc.length - 2 + nMod3) + (nMod3 === 2 ? "" : nMod3 === 1 ? "=" : "==");
}
function strToUTF8Arr(sDOMStr) {
let nChr;
const nStrLen = sDOMStr.length;
let nArrLen = 0;
for (let nMapIdx = 0; nMapIdx < nStrLen; nMapIdx++) {
nChr = sDOMStr.codePointAt(nMapIdx);
if (nChr === void 0) {
throw Error(`No char at ${nMapIdx} on string with length: ${sDOMStr.length}`);
}
if (nChr >= 65536) {
nMapIdx++;
}
nArrLen += nChr < 128 ? 1 : nChr < 2048 ? 2 : nChr < 65536 ? 3 : nChr < 2097152 ? 4 : nChr < 67108864 ? 5 : 6;
}
const aBytes = new Uint8Array(nArrLen);
let nIdx = 0;
let nChrIdx = 0;
while (nIdx < nArrLen) {
nChr = sDOMStr.codePointAt(nChrIdx);
if (nChr === void 0) {
throw Error(`No char at ${nChrIdx} on string with length: ${sDOMStr.length}`);
}
if (nChr < 128) {
aBytes[nIdx++] = nChr;
} else if (nChr < 2048) {
aBytes[nIdx++] = 192 + (nChr >>> 6);
aBytes[nIdx++] = 128 + (nChr & 63);
} else if (nChr < 65536) {
aBytes[nIdx++] = 224 + (nChr >>> 12);
aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);
aBytes[nIdx++] = 128 + (nChr & 63);
} else if (nChr < 2097152) {
aBytes[nIdx++] = 240 + (nChr >>> 18);
aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);
aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);
aBytes[nIdx++] = 128 + (nChr & 63);
nChrIdx++;
} else if (nChr < 67108864) {
aBytes[nIdx++] = 248 + (nChr >>> 24);
aBytes[nIdx++] = 128 + (nChr >>> 18 & 63);
aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);
aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);
aBytes[nIdx++] = 128 + (nChr & 63);
nChrIdx++;
} else {
aBytes[nIdx++] = 252 + (nChr >>> 30);
aBytes[nIdx++] = 128 + (nChr >>> 24 & 63);
aBytes[nIdx++] = 128 + (nChr >>> 18 & 63);
aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);
aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);
aBytes[nIdx++] = 128 + (nChr & 63);
nChrIdx++;
}
nChrIdx++;
}
return aBytes;
}
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
ErrorType2[ErrorType2["CLIENT"] = 0] = "CLIENT";
ErrorType2[ErrorType2["SERVER"] = 1] = "SERVER";
ErrorType2[ErrorType2["UNREADABLE"] = 2] = "UNREADABLE";
ErrorType2[ErrorType2["TIMEOUT"] = 3] = "TIMEOUT";
ErrorType2[ErrorType2["UNEXPECTED"] = 4] = "UNEXPECTED";
return ErrorType2;
})(ErrorType || {});
function defaultRequestHandler(_0, _1) {
return __async(this, arguments, function* (baseUrl, endpoint, options = {}) {
var _a, _b, _c, _d, _e;
const requestHeaders = {};
if (options.token) {
requestHeaders.Authorization = `Bearer ${options.token}`;
} else if (options.basicAuth) {
requestHeaders.Authorization = `Basic ${base64encode(
`${options.basicAuth.username}:${options.basicAuth.password}`
)}`;
}
requestHeaders["Content-Type"] = options.contentType === "json" ? "application/json" : "text/plain";
if (options.talerAmlOfficerSignature) {
requestHeaders["Taler-AML-Officer-Signature"] = options.talerAmlOfficerSignature;
}
const requestMethod = (_a = options == null ? void 0 : options.method) != null ? _a : "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 validURL = validateURL(baseUrl, endpoint);
if (!validURL) {
const error2 = {
info: {
url: `${baseUrl}${endpoint}`,
payload: {},
hasToken: !!options.token,
status: 0,
options
},
type: 4,
exception: void 0,
loading: false,
message: `invalid URL: "${validURL}"`
};
throw new RequestError(error2);
}
Object.entries(requestParams).forEach(([key, value]) => {
validURL.searchParams.set(key, String(value));
});
let payload = void 0;
if (requestBody != null) {
if (typeof requestBody === "string") {
payload = requestBody;
} else if (requestBody instanceof ArrayBuffer) {
payload = requestBody;
} else if (ArrayBuffer.isView(requestBody)) {
payload = requestBody;
} else if (typeof requestBody === "object") {
payload = JSON.stringify(requestBody);
} else {
const error2 = {
info: {
url: validURL.href,
payload: {},
hasToken: !!options.token,
status: 0,
options
},
type: 4,
exception: void 0,
loading: false,
message: `unsupported request body type: "${typeof requestBody}"`
};
throw new RequestError(error2);
}
}
const controller = new AbortController();
const timeoutId = setTimeout(() => {
controller.abort("HTTP_REQUEST_TIMEOUT");
}, requestTimeout);
let response;
try {
response = yield fetch(validURL.href, {
headers: requestHeaders,
method: requestMethod,
credentials: "omit",
mode: requestPreventCors ? "no-cors" : "cors",
cache: requestPreventCache ? "no-cache" : "default",
body: payload,
signal: controller.signal
});
} catch (ex) {
const info = {
payload,
url: validURL.href,
hasToken: !!options.token,
status: 0,
options
};
if (ex instanceof Error) {
if (ex.message === "HTTP_REQUEST_TIMEOUT") {
const error22 = {
info,
type: 3,
message: "request timeout"
};
throw new RequestError(error22);
}
}
const error2 = {
info,
type: 4,
exception: ex,
loading: false,
message: ex instanceof Error ? ex.message : ""
};
throw new RequestError(error2);
}
if (timeoutId) {
clearTimeout(timeoutId);
}
const headerMap = new Headers();
response.headers.forEach((value, key) => {
headerMap.set(key, value);
});
if (response.ok) {
const result = yield buildRequestOk(
response,
validURL.href,
payload,
!!options.token,
options
);
return result;
} else {
const dataTxt = yield response.text();
const error2 = buildRequestFailed(
validURL.href,
dataTxt,
response.status,
payload,
options
);
throw new RequestError(error2);
}
});
}
var RequestError = class extends Error {
constructor(d5) {
super(d5.message);
this.info = d5;
this.cause = d5;
}
};
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 {
ok: true,
data,
info: {
payload,
url,
hasToken,
options,
status: response.status
}
};
});
}
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,
info,
message,
payload: data
};
return error2;
}
if (status && status >= 500 && status < 600) {
const message = data === void 0 ? `Server error (${status}) without data.` : errorHint;
const error2 = {
type: 1,
status,
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;
}
}
function validateURL(baseUrl, endpoint) {
try {
return new URL(`${baseUrl}${endpoint}`);
} catch (ex) {
return void 0;
}
}
var logger8 = new Logger("browserHttpLib");
var Context = B({
request: defaultRequestHandler
});
var useApiContext = () => q2(Context);
var supportedLang = {
es: "Espanol [es]",
en: "English [en]",
fr: "Francais [fr]",
de: "Deutsch [de]",
sv: "Svenska [sv]",
it: "Italiane [it]",
navigator: "Defined by navigator"
};
var initial = {
lang: "en",
supportedLang,
changeLanguage: () => {
},
i18n
};
var Context2 = B(initial);
var TranslationProvider = ({
initial: initial2,
children,
forceLang,
source
}) => {
const { value: lang, update: changeLanguage } = useLang(initial2);
h2(() => {
if (forceLang) {
changeLanguage(forceLang);
}
});
h2(() => {
setupI18n(lang, source);
}, [lang]);
if (forceLang) {
setupI18n(forceLang, source);
} else {
setupI18n(lang, source);
}
return h(Context2.Provider, {
value: { lang, changeLanguage, supportedLang, i18n },
children
});
};
var useTranslationContext = () => q2(Context2);
var utils_exports = {};
__export2(utils_exports, {
compose: () => compose,
saveVNodeForInspection: () => saveVNodeForInspection
});
function compose(hook, viewMap) {
function withHook(stateHook) {
function ComposedComponent() {
const state = stateHook();
if (typeof state === "function") {
const subComponent = withHook(state);
return h(subComponent, {});
}
const statusName = state.status;
const viewComponent = viewMap[statusName];
return h(viewComponent, state);
}
return ComposedComponent;
}
return (p4) => {
const h42 = withHook(() => hook(p4));
return h42();
};
}
function saveVNodeForInspection(obj) {
window["showVNodeInfo"] = function showVNodeInfo() {
inspect(obj);
};
return obj;
}
function inspect(obj) {
if (!obj)
return;
if (obj.__c && obj.__c.__H) {
const componentName = obj.__c.constructor.name;
const hookState = obj.__c.__H;
const stateList = hookState.__;
console.log("==============", componentName);
stateList.forEach((hook) => {
const { __: value, c: context, __h: factory, __H: args } = hook;
if (typeof context !== "undefined") {
const { __c: contextId } = context;
console.log("context:", contextId, hook);
} else if (typeof factory === "function") {
console.log("memo:", value, "deps:", args);
} else if (typeof value === "function") {
const effectName = value.name;
console.log("effect:", effectName, "deps:", args);
} else if (typeof value.current !== "undefined") {
const ref = value.current;
console.log("ref:", ref instanceof Element ? ref.outerHTML : ref);
} else if (value instanceof Array) {
console.log("state:", value[0]);
} else {
console.log(hook);
}
});
}
const children = obj.__k;
if (children instanceof Array) {
children.forEach((e4) => inspect(e4));
} else {
inspect(children);
}
}
// src/Application.tsx
init_preact_module();
init_hooks_module();
// ../../node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/esm/extends.js
function _extends() {
_extends = Object.assign ? Object.assign.bind() : function(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
// ../../node_modules/.pnpm/resolve-pathname@3.0.0/node_modules/resolve-pathname/esm/resolve-pathname.js
function isAbsolute(pathname) {
return pathname.charAt(0) === "/";
}
function spliceOne(list, index) {
for (var i4 = index, k5 = i4 + 1, n2 = list.length; k5 < n2; i4 += 1, k5 += 1) {
list[i4] = list[k5];
}
list.pop();
}
function resolvePathname(to, from) {
if (from === void 0)
from = "";
var toParts = to && to.split("/") || [];
var fromParts = from && from.split("/") || [];
var isToAbs = to && isAbsolute(to);
var isFromAbs = from && isAbsolute(from);
var mustEndAbs = isToAbs || isFromAbs;
if (to && isAbsolute(to)) {
fromParts = toParts;
} else if (toParts.length) {
fromParts.pop();
fromParts = fromParts.concat(toParts);
}
if (!fromParts.length)
return "/";
var hasTrailingSlash;
if (fromParts.length) {
var last = fromParts[fromParts.length - 1];
hasTrailingSlash = last === "." || last === ".." || last === "";
} else {
hasTrailingSlash = false;
}
var up = 0;
for (var i4 = fromParts.length; i4 >= 0; i4--) {
var part = fromParts[i4];
if (part === ".") {
spliceOne(fromParts, i4);
} else if (part === "..") {
spliceOne(fromParts, i4);
up++;
} else if (up) {
spliceOne(fromParts, i4);
up--;
}
}
if (!mustEndAbs)
for (; up--; up)
fromParts.unshift("..");
if (mustEndAbs && fromParts[0] !== "" && (!fromParts[0] || !isAbsolute(fromParts[0])))
fromParts.unshift("");
var result = fromParts.join("/");
if (hasTrailingSlash && result.substr(-1) !== "/")
result += "/";
return result;
}
var resolve_pathname_default = resolvePathname;
// ../../node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js
var isProduction = true;
var prefix = "Invariant failed";
function invariant2(condition, message) {
if (condition) {
return;
}
if (isProduction) {
throw new Error(prefix);
}
var provided = typeof message === "function" ? message() : message;
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
throw new Error(value);
}
// ../../node_modules/.pnpm/history@4.10.1/node_modules/history/esm/history.js
function addLeadingSlash(path) {
return path.charAt(0) === "/" ? path : "/" + path;
}
function stripLeadingSlash(path) {
return path.charAt(0) === "/" ? path.substr(1) : path;
}
function hasBasename(path, prefix2) {
return path.toLowerCase().indexOf(prefix2.toLowerCase()) === 0 && "/?#".indexOf(path.charAt(prefix2.length)) !== -1;
}
function stripBasename(path, prefix2) {
return hasBasename(path, prefix2) ? path.substr(prefix2.length) : path;
}
function stripTrailingSlash(path) {
return path.charAt(path.length - 1) === "/" ? path.slice(0, -1) : path;
}
function parsePath(path) {
var pathname = path || "/";
var search = "";
var hash3 = "";
var hashIndex = pathname.indexOf("#");
if (hashIndex !== -1) {
hash3 = pathname.substr(hashIndex);
pathname = pathname.substr(0, hashIndex);
}
var searchIndex = pathname.indexOf("?");
if (searchIndex !== -1) {
search = pathname.substr(searchIndex);
pathname = pathname.substr(0, searchIndex);
}
return {
pathname,
search: search === "?" ? "" : search,
hash: hash3 === "#" ? "" : hash3
};
}
function createPath(location2) {
var pathname = location2.pathname, search = location2.search, hash3 = location2.hash;
var path = pathname || "/";
if (search && search !== "?")
path += search.charAt(0) === "?" ? search : "?" + search;
if (hash3 && hash3 !== "#")
path += hash3.charAt(0) === "#" ? hash3 : "#" + hash3;
return path;
}
function createLocation(path, state, key, currentLocation) {
var location2;
if (typeof path === "string") {
location2 = parsePath(path);
location2.state = state;
} else {
location2 = _extends({}, path);
if (location2.pathname === void 0)
location2.pathname = "";
if (location2.search) {
if (location2.search.charAt(0) !== "?")
location2.search = "?" + location2.search;
} else {
location2.search = "";
}
if (location2.hash) {
if (location2.hash.charAt(0) !== "#")
location2.hash = "#" + location2.hash;
} else {
location2.hash = "";
}
if (state !== void 0 && location2.state === void 0)
location2.state = state;
}
try {
location2.pathname = decodeURI(location2.pathname);
} catch (e4) {
if (e4 instanceof URIError) {
throw new URIError('Pathname "' + location2.pathname + '" could not be decoded. This is likely caused by an invalid percent-encoding.');
} else {
throw e4;
}
}
if (key)
location2.key = key;
if (currentLocation) {
if (!location2.pathname) {
location2.pathname = currentLocation.pathname;
} else if (location2.pathname.charAt(0) !== "/") {
location2.pathname = resolve_pathname_default(location2.pathname, currentLocation.pathname);
}
} else {
if (!location2.pathname) {
location2.pathname = "/";
}
}
return location2;
}
function createTransitionManager() {
var prompt = null;
function setPrompt(nextPrompt) {
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)
prompt = null;
};
}
function confirmTransitionTo(location2, action, getUserConfirmation, callback) {
if (prompt != null) {
var result = typeof prompt === "function" ? prompt(location2, action) : prompt;
if (typeof result === "string") {
if (typeof getUserConfirmation === "function") {
getUserConfirmation(result, callback);
} else {
false ? tiny_warning_esm_default(false, "A history needs a getUserConfirmation function in order to use a prompt message") : void 0;
callback(true);
}
} else {
callback(result !== false);
}
} else {
callback(true);
}
}
var listeners = [];
function appendListener(fn2) {
var isActive = true;
function listener() {
if (isActive)
fn2.apply(void 0, arguments);
}
listeners.push(listener);
return function() {
isActive = false;
listeners = listeners.filter(function(item) {
return item !== listener;
});
};
}
function notifyListeners() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
listeners.forEach(function(listener) {
return listener.apply(void 0, args);
});
}
return {
setPrompt,
confirmTransitionTo,
appendListener,
notifyListeners
};
}
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
function getConfirmation(message, callback) {
callback(window.confirm(message));
}
function supportsGoWithoutReloadUsingHash() {
return window.navigator.userAgent.indexOf("Firefox") === -1;
}
var HashChangeEvent$1 = "hashchange";
var HashPathCoders = {
hashbang: {
encodePath: function encodePath(path) {
return path.charAt(0) === "!" ? path : "!/" + stripLeadingSlash(path);
},
decodePath: function decodePath(path) {
return path.charAt(0) === "!" ? path.substr(1) : path;
}
},
noslash: {
encodePath: stripLeadingSlash,
decodePath: addLeadingSlash
},
slash: {
encodePath: addLeadingSlash,
decodePath: addLeadingSlash
}
};
function stripHash(url) {
var hashIndex = url.indexOf("#");
return hashIndex === -1 ? url : url.slice(0, hashIndex);
}
function getHashPath() {
var href = window.location.href;
var hashIndex = href.indexOf("#");
return hashIndex === -1 ? "" : href.substring(hashIndex + 1);
}
function pushHashPath(path) {
window.location.hash = path;
}
function replaceHashPath(path) {
window.location.replace(stripHash(window.location.href) + "#" + path);
}
function createHashHistory(props) {
if (props === void 0) {
props = {};
}
!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;
var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : "";
var _HashPathCoders$hashT = HashPathCoders[hashType], encodePath2 = _HashPathCoders$hashT.encodePath, decodePath2 = _HashPathCoders$hashT.decodePath;
function getDOMLocation() {
var path2 = decodePath2(getHashPath());
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);
}
var transitionManager = createTransitionManager();
function setState(nextState) {
_extends(history2, nextState);
history2.length = globalHistory.length;
transitionManager.notifyListeners(history2.location, history2.action);
}
var forceNextPop = false;
var ignorePath = null;
function locationsAreEqual$$1(a5, b4) {
return a5.pathname === b4.pathname && a5.search === b4.search && a5.hash === b4.hash;
}
function handleHashChange() {
var path2 = getHashPath();
var encodedPath2 = encodePath2(path2);
if (path2 !== encodedPath2) {
replaceHashPath(encodedPath2);
} else {
var location2 = getDOMLocation();
var prevLocation = history2.location;
if (!forceNextPop && locationsAreEqual$$1(prevLocation, location2))
return;
if (ignorePath === createPath(location2))
return;
ignorePath = null;
handlePop(location2);
}
}
function handlePop(location2) {
if (forceNextPop) {
forceNextPop = false;
setState();
} else {
var action = "POP";
transitionManager.confirmTransitionTo(location2, action, getUserConfirmation, function(ok) {
if (ok) {
setState({
action,
location: location2
});
} else {
revertPop(location2);
}
});
}
}
function revertPop(fromLocation) {
var toLocation = history2.location;
var toIndex = allPaths.lastIndexOf(createPath(toLocation));
if (toIndex === -1)
toIndex = 0;
var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
if (fromIndex === -1)
fromIndex = 0;
var delta = toIndex - fromIndex;
if (delta) {
forceNextPop = true;
go(delta);
}
}
var path = getHashPath();
var encodedPath = encodePath2(path);
if (path !== encodedPath)
replaceHashPath(encodedPath);
var initialLocation = getDOMLocation();
var allPaths = [createPath(initialLocation)];
function createHref(location2) {
var baseTag = document.querySelector("base");
var href = "";
if (baseTag && baseTag.getAttribute("href")) {
href = stripHash(window.location.href);
}
return href + "#" + encodePath2(basename + createPath(location2));
}
function push(path2, state) {
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) {
if (!ok)
return;
var path3 = createPath(location2);
var encodedPath2 = encodePath2(basename + path3);
var hashChanged = getHashPath() !== encodedPath2;
if (hashChanged) {
ignorePath = path3;
pushHashPath(encodedPath2);
var prevIndex = allPaths.lastIndexOf(createPath(history2.location));
var nextPaths = allPaths.slice(0, prevIndex + 1);
nextPaths.push(path3);
allPaths = nextPaths;
setState({
action,
location: location2
});
} else {
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) {
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) {
if (!ok)
return;
var path3 = createPath(location2);
var encodedPath2 = encodePath2(basename + path3);
var hashChanged = getHashPath() !== encodedPath2;
if (hashChanged) {
ignorePath = path3;
replaceHashPath(encodedPath2);
}
var prevIndex = allPaths.indexOf(createPath(history2.location));
if (prevIndex !== -1)
allPaths[prevIndex] = path3;
setState({
action,
location: location2
});
});
}
function go(n2) {
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() {
go(-1);
}
function goForward() {
go(1);
}
var listenerCount = 0;
function checkDOMListeners(delta) {
listenerCount += delta;
if (listenerCount === 1 && delta === 1) {
window.addEventListener(HashChangeEvent$1, handleHashChange);
} else if (listenerCount === 0) {
window.removeEventListener(HashChangeEvent$1, handleHashChange);
}
}
var isBlocked = false;
function block(prompt) {
if (prompt === void 0) {
prompt = false;
}
var unblock = transitionManager.setPrompt(prompt);
if (!isBlocked) {
checkDOMListeners(1);
isBlocked = true;
}
return function() {
if (isBlocked) {
isBlocked = false;
checkDOMListeners(-1);
}
return unblock();
};
}
function listen(listener) {
var unlisten = transitionManager.appendListener(listener);
checkDOMListeners(1);
return function() {
checkDOMListeners(-1);
unlisten();
};
}
var history2 = {
length: globalHistory.length,
action: "POP",
location: initialLocation,
createHref,
push,
replace,
go,
goBack,
goForward,
block,
listen
};
return history2;
}
// src/ApplicationReadyRoutes.tsx
init_preact_module();
// ../../node_modules/.pnpm/preact-router@3.2.1_preact@10.11.3/node_modules/preact-router/dist/preact-router.es.js
init_preact_module();
var EMPTY$1 = {};
function assign(obj, props) {
for (var i4 in props) {
obj[i4] = props[i4];
}
return obj;
}
function exec(url, route2, opts) {
var reg = /(?:\?([^#]*))?(#.*)?$/, c4 = url.match(reg), matches = {}, ret;
if (c4 && c4[1]) {
var p4 = c4[1].split("&");
for (var i4 = 0; i4 < p4.length; i4++) {
var r3 = p4[i4].split("=");
matches[decodeURIComponent(r3[0])] = decodeURIComponent(r3.slice(1).join("="));
}
}
url = segmentize(url.replace(reg, ""));
route2 = segmentize(route2 || "");
var max = Math.max(url.length, route2.length);
for (var i$1 = 0; i$1 < max; i$1++) {
if (route2[i$1] && route2[i$1].charAt(0) === ":") {
var param = route2[i$1].replace(/(^:|[+*?]+$)/g, ""), flags = (route2[i$1].match(/[+*?]+$/) || EMPTY$1)[0] || "", plus = ~flags.indexOf("+"), star = ~flags.indexOf("*"), val = url[i$1] || "";
if (!val && !star && (flags.indexOf("?") < 0 || plus)) {
ret = false;
break;
}
matches[param] = decodeURIComponent(val);
if (plus || star) {
matches[param] = url.slice(i$1).map(decodeURIComponent).join("/");
break;
}
} else if (route2[i$1] !== url[i$1]) {
ret = false;
break;
}
}
if (opts.default !== true && ret === false) {
return false;
}
return matches;
}
function pathRankSort(a5, b4) {
return a5.rank < b4.rank ? 1 : a5.rank > b4.rank ? -1 : a5.index - b4.index;
}
function prepareVNodeForRanking(vnode, index) {
vnode.index = index;
vnode.rank = rankChild(vnode);
return vnode.props;
}
function segmentize(url) {
return url.replace(/(^\/+|\/+$)/g, "").split("/");
}
function rankSegment(segment) {
return segment.charAt(0) == ":" ? 1 + "*+?".indexOf(segment.charAt(segment.length - 1)) || 4 : 5;
}
function rank(path) {
return segmentize(path).map(rankSegment).join("");
}
function rankChild(vnode) {
return vnode.props.default ? 0 : rank(vnode.props.path);
}
var customHistory = null;
var ROUTERS = [];
var subscribers = [];
var EMPTY = {};
function setUrl(url, type) {
if (type === void 0)
type = "push";
if (customHistory && customHistory[type]) {
customHistory[type](url);
} else if (typeof history !== "undefined" && history[type + "State"]) {
history[type + "State"](null, null, url);
}
}
function getCurrentUrl() {
var url;
if (customHistory && customHistory.location) {
url = customHistory.location;
} else if (customHistory && customHistory.getCurrentLocation) {
url = customHistory.getCurrentLocation();
} else {
url = typeof location !== "undefined" ? location : EMPTY;
}
return "" + (url.pathname || "") + (url.search || "");
}
function route(url, replace) {
if (replace === void 0)
replace = false;
if (typeof url !== "string" && url.url) {
replace = url.replace;
url = url.url;
}
if (canRoute(url)) {
setUrl(url, replace ? "replace" : "push");
}
return routeTo(url);
}
function canRoute(url) {
for (var i4 = ROUTERS.length; i4--; ) {
if (ROUTERS[i4].canRoute(url)) {
return true;
}
}
return false;
}
function routeTo(url) {
var didRoute = false;
for (var i4 = 0; i4 < ROUTERS.length; i4++) {
if (ROUTERS[i4].routeTo(url) === true) {
didRoute = true;
}
}
for (var i$1 = subscribers.length; i$1--; ) {
subscribers[i$1](url);
}
return didRoute;
}
function routeFromLink(node) {
if (!node || !node.getAttribute) {
return;
}
var href = node.getAttribute("href"), target = node.getAttribute("target");
if (!href || !href.match(/^\//g) || target && !target.match(/^_?self$/i)) {
return;
}
return route(href);
}
function handleLinkClick(e4) {
if (e4.ctrlKey || e4.metaKey || e4.altKey || e4.shiftKey || e4.button !== 0) {
return;
}
routeFromLink(e4.currentTarget || e4.target || this);
return prevent(e4);
}
function prevent(e4) {
if (e4) {
if (e4.stopImmediatePropagation) {
e4.stopImmediatePropagation();
}
if (e4.stopPropagation) {
e4.stopPropagation();
}
e4.preventDefault();
}
return false;
}
function delegateLinkHandler(e4) {
if (e4.ctrlKey || e4.metaKey || e4.altKey || e4.shiftKey || e4.button !== 0) {
return;
}
var t4 = e4.target;
do {
if (String(t4.nodeName).toUpperCase() === "A" && t4.getAttribute("href")) {
if (t4.hasAttribute("native")) {
return;
}
if (routeFromLink(t4)) {
return prevent(e4);
}
}
} while (t4 = t4.parentNode);
}
var eventListenersInitialized = false;
function initEventListeners() {
if (eventListenersInitialized) {
return;
}
if (typeof addEventListener === "function") {
if (!customHistory) {
addEventListener("popstate", function() {
routeTo(getCurrentUrl());
});
}
addEventListener("click", delegateLinkHandler);
}
eventListenersInitialized = true;
}
var Router = function(Component$$1) {
function Router2(props) {
Component$$1.call(this, props);
if (props.history) {
customHistory = props.history;
}
this.state = {
url: props.url || getCurrentUrl()
};
initEventListeners();
}
if (Component$$1)
Router2.__proto__ = Component$$1;
Router2.prototype = Object.create(Component$$1 && Component$$1.prototype);
Router2.prototype.constructor = Router2;
Router2.prototype.shouldComponentUpdate = function shouldComponentUpdate(props) {
if (props.static !== true) {
return true;
}
return props.url !== this.props.url || props.onChange !== this.props.onChange;
};
Router2.prototype.canRoute = function canRoute2(url) {
var children = x2(this.props.children);
return this.getMatchingChildren(children, url, false).length > 0;
};
Router2.prototype.routeTo = function routeTo2(url) {
this.setState({ url });
var didRoute = this.canRoute(url);
if (!this.updating) {
this.forceUpdate();
}
return didRoute;
};
Router2.prototype.componentWillMount = function componentWillMount() {
ROUTERS.push(this);
this.updating = true;
};
Router2.prototype.componentDidMount = function componentDidMount() {
var this$1 = this;
if (customHistory) {
this.unlisten = customHistory.listen(function(location2) {
this$1.routeTo("" + (location2.pathname || "") + (location2.search || ""));
});
}
this.updating = false;
};
Router2.prototype.componentWillUnmount = function componentWillUnmount() {
if (typeof this.unlisten === "function") {
this.unlisten();
}
ROUTERS.splice(ROUTERS.indexOf(this), 1);
};
Router2.prototype.componentWillUpdate = function componentWillUpdate() {
this.updating = true;
};
Router2.prototype.componentDidUpdate = function componentDidUpdate() {
this.updating = false;
};
Router2.prototype.getMatchingChildren = function getMatchingChildren(children, url, invoke) {
return children.filter(prepareVNodeForRanking).sort(pathRankSort).map(function(vnode) {
var matches = exec(url, vnode.props.path, vnode.props);
if (matches) {
if (invoke !== false) {
var newProps = { url, matches };
assign(newProps, matches);
delete newProps.ref;
delete newProps.key;
return q(vnode, newProps);
}
return vnode;
}
}).filter(Boolean);
};
Router2.prototype.render = function render(ref, ref$1) {
var children = ref.children;
var onChange = ref.onChange;
var url = ref$1.url;
var active = this.getMatchingChildren(x2(children), url, true);
var current = active[0] || null;
var previous = this.previousUrl;
if (url !== previous) {
this.previousUrl = url;
if (typeof onChange === "function") {
onChange({
router: this,
url,
previous,
active,
current
});
}
}
return current;
};
return Router2;
}(d);
var Link = function(props) {
return h("a", assign({ onClick: handleLinkClick }, props));
};
var Route = function(props) {
return h(props.component, props);
};
Router.subscribers = subscribers;
Router.getCurrentUrl = getCurrentUrl;
Router.route = route;
Router.Router = Router;
Router.Route = Route;
Router.Link = Link;
Router.exec = exec;
// src/ApplicationReadyRoutes.tsx
init_hooks_module();
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/toInteger/index.js
function toInteger(dirtyNumber) {
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
return NaN;
}
var number2 = Number(dirtyNumber);
if (isNaN(number2)) {
return number2;
}
return number2 < 0 ? Math.ceil(number2) : Math.floor(number2);
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/requiredArgs/index.js
function requiredArgs(required, args) {
if (args.length < required) {
throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present");
}
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/toDate/index.js
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof4(obj2) {
return typeof obj2;
};
} else {
_typeof = function _typeof4(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof(obj);
}
function toDate(argument) {
requiredArgs(1, arguments);
var argStr = Object.prototype.toString.call(argument);
if (argument instanceof Date || _typeof(argument) === "object" && argStr === "[object Date]") {
return new Date(argument.getTime());
} else if (typeof argument === "number" || argStr === "[object Number]") {
return new Date(argument);
} else {
if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") {
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
console.warn(new Error().stack);
}
return /* @__PURE__ */ new Date(NaN);
}
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/addDays/index.js
function addDays(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var date2 = toDate(dirtyDate);
var amount = toInteger(dirtyAmount);
if (isNaN(amount)) {
return /* @__PURE__ */ new Date(NaN);
}
if (!amount) {
return date2;
}
date2.setDate(date2.getDate() + amount);
return date2;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/addMonths/index.js
function addMonths(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var date2 = toDate(dirtyDate);
var amount = toInteger(dirtyAmount);
if (isNaN(amount)) {
return /* @__PURE__ */ new Date(NaN);
}
if (!amount) {
return date2;
}
var dayOfMonth = date2.getDate();
var endOfDesiredMonth = new Date(date2.getTime());
endOfDesiredMonth.setMonth(date2.getMonth() + amount + 1, 0);
var daysInMonth = endOfDesiredMonth.getDate();
if (dayOfMonth >= daysInMonth) {
return endOfDesiredMonth;
} else {
date2.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
return date2;
}
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/add/index.js
function _typeof2(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof2 = function _typeof4(obj2) {
return typeof obj2;
};
} else {
_typeof2 = function _typeof4(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof2(obj);
}
function add2(dirtyDate, duration) {
requiredArgs(2, arguments);
if (!duration || _typeof2(duration) !== "object")
return /* @__PURE__ */ new Date(NaN);
var years = duration.years ? toInteger(duration.years) : 0;
var months = duration.months ? toInteger(duration.months) : 0;
var weeks = duration.weeks ? toInteger(duration.weeks) : 0;
var days = duration.days ? toInteger(duration.days) : 0;
var hours = duration.hours ? toInteger(duration.hours) : 0;
var minutes = duration.minutes ? toInteger(duration.minutes) : 0;
var seconds = duration.seconds ? toInteger(duration.seconds) : 0;
var date2 = toDate(dirtyDate);
var dateWithMonths = months || years ? addMonths(date2, months + years * 12) : date2;
var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
var minutesToAdd = minutes + hours * 60;
var secondsToAdd = seconds + minutesToAdd * 60;
var msToAdd = secondsToAdd * 1e3;
var finalDate = new Date(dateWithDays.getTime() + msToAdd);
return finalDate;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/addMilliseconds/index.js
function addMilliseconds(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var timestamp = toDate(dirtyDate).getTime();
var amount = toInteger(dirtyAmount);
return new Date(timestamp + amount);
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/defaultOptions/index.js
var defaultOptions = {};
function getDefaultOptions() {
return defaultOptions;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js
function getTimezoneOffsetInMilliseconds(date2) {
var utcDate = new Date(Date.UTC(date2.getFullYear(), date2.getMonth(), date2.getDate(), date2.getHours(), date2.getMinutes(), date2.getSeconds(), date2.getMilliseconds()));
utcDate.setUTCFullYear(date2.getFullYear());
return date2.getTime() - utcDate.getTime();
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/startOfDay/index.js
function startOfDay(dirtyDate) {
requiredArgs(1, arguments);
var date2 = toDate(dirtyDate);
date2.setHours(0, 0, 0, 0);
return date2;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInCalendarDays/index.js
var MILLISECONDS_IN_DAY = 864e5;
function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
requiredArgs(2, arguments);
var startOfDayLeft = startOfDay(dirtyDateLeft);
var startOfDayRight = startOfDay(dirtyDateRight);
var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);
var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight);
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/compareAsc/index.js
function compareAsc(dirtyDateLeft, dirtyDateRight) {
requiredArgs(2, arguments);
var dateLeft = toDate(dirtyDateLeft);
var dateRight = toDate(dirtyDateRight);
var diff = dateLeft.getTime() - dateRight.getTime();
if (diff < 0) {
return -1;
} else if (diff > 0) {
return 1;
} else {
return diff;
}
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/constants/index.js
var daysInYear = 365.2425;
var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
var millisecondsInMinute = 6e4;
var millisecondsInHour = 36e5;
var minTime = -maxTime;
var secondsInHour = 3600;
var secondsInDay = secondsInHour * 24;
var secondsInWeek = secondsInDay * 7;
var secondsInYear = secondsInDay * daysInYear;
var secondsInMonth = secondsInYear / 12;
var secondsInQuarter = secondsInMonth * 3;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isDate/index.js
function _typeof3(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof3 = function _typeof4(obj2) {
return typeof obj2;
};
} else {
_typeof3 = function _typeof4(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof3(obj);
}
function isDate(value) {
requiredArgs(1, arguments);
return value instanceof Date || _typeof3(value) === "object" && Object.prototype.toString.call(value) === "[object Date]";
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isValid/index.js
function isValid(dirtyDate) {
requiredArgs(1, arguments);
if (!isDate(dirtyDate) && typeof dirtyDate !== "number") {
return false;
}
var date2 = toDate(dirtyDate);
return !isNaN(Number(date2));
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInCalendarMonths/index.js
function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {
requiredArgs(2, arguments);
var dateLeft = toDate(dirtyDateLeft);
var dateRight = toDate(dirtyDateRight);
var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();
var monthDiff = dateLeft.getMonth() - dateRight.getMonth();
return yearDiff * 12 + monthDiff;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInCalendarYears/index.js
function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {
requiredArgs(2, arguments);
var dateLeft = toDate(dirtyDateLeft);
var dateRight = toDate(dirtyDateRight);
return dateLeft.getFullYear() - dateRight.getFullYear();
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInDays/index.js
function compareLocalAsc(dateLeft, dateRight) {
var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();
if (diff < 0) {
return -1;
} else if (diff > 0) {
return 1;
} else {
return diff;
}
}
function differenceInDays(dirtyDateLeft, dirtyDateRight) {
requiredArgs(2, arguments);
var dateLeft = toDate(dirtyDateLeft);
var dateRight = toDate(dirtyDateRight);
var sign = compareLocalAsc(dateLeft, dateRight);
var difference2 = Math.abs(differenceInCalendarDays(dateLeft, dateRight));
dateLeft.setDate(dateLeft.getDate() - sign * difference2);
var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign);
var result = sign * (difference2 - isLastDayNotFull);
return result === 0 ? 0 : result;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInMilliseconds/index.js
function differenceInMilliseconds(dateLeft, dateRight) {
requiredArgs(2, arguments);
return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/roundingMethods/index.js
var roundingMap = {
ceil: Math.ceil,
round: Math.round,
floor: Math.floor,
trunc: function trunc(value) {
return value < 0 ? Math.ceil(value) : Math.floor(value);
}
// Math.trunc is not supported by IE
};
var defaultRoundingMethod = "trunc";
function getRoundingMethod(method) {
return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInHours/index.js
function differenceInHours(dateLeft, dateRight, options) {
requiredArgs(2, arguments);
var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInMinutes/index.js
function differenceInMinutes(dateLeft, dateRight, options) {
requiredArgs(2, arguments);
var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;
return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/endOfDay/index.js
function endOfDay(dirtyDate) {
requiredArgs(1, arguments);
var date2 = toDate(dirtyDate);
date2.setHours(23, 59, 59, 999);
return date2;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/endOfMonth/index.js
function endOfMonth(dirtyDate) {
requiredArgs(1, arguments);
var date2 = toDate(dirtyDate);
var month = date2.getMonth();
date2.setFullYear(date2.getFullYear(), month + 1, 0);
date2.setHours(23, 59, 59, 999);
return date2;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isLastDayOfMonth/index.js
function isLastDayOfMonth(dirtyDate) {
requiredArgs(1, arguments);
var date2 = toDate(dirtyDate);
return endOfDay(date2).getTime() === endOfMonth(date2).getTime();
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInMonths/index.js
function differenceInMonths(dirtyDateLeft, dirtyDateRight) {
requiredArgs(2, arguments);
var dateLeft = toDate(dirtyDateLeft);
var dateRight = toDate(dirtyDateRight);
var sign = compareAsc(dateLeft, dateRight);
var difference2 = Math.abs(differenceInCalendarMonths(dateLeft, dateRight));
var result;
if (difference2 < 1) {
result = 0;
} else {
if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) {
dateLeft.setDate(30);
}
dateLeft.setMonth(dateLeft.getMonth() - sign * difference2);
var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign;
if (isLastDayOfMonth(toDate(dirtyDateLeft)) && difference2 === 1 && compareAsc(dirtyDateLeft, dateRight) === 1) {
isLastMonthNotFull = false;
}
result = sign * (difference2 - Number(isLastMonthNotFull));
}
return result === 0 ? 0 : result;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInSeconds/index.js
function differenceInSeconds(dateLeft, dateRight, options) {
requiredArgs(2, arguments);
var diff = differenceInMilliseconds(dateLeft, dateRight) / 1e3;
return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInYears/index.js
function differenceInYears(dirtyDateLeft, dirtyDateRight) {
requiredArgs(2, arguments);
var dateLeft = toDate(dirtyDateLeft);
var dateRight = toDate(dirtyDateRight);
var sign = compareAsc(dateLeft, dateRight);
var difference2 = Math.abs(differenceInCalendarYears(dateLeft, dateRight));
dateLeft.setFullYear(1584);
dateRight.setFullYear(1584);
var isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;
var result = sign * (difference2 - Number(isLastYearNotFull));
return result === 0 ? 0 : result;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/subMilliseconds/index.js
function subMilliseconds(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var amount = toInteger(dirtyAmount);
return addMilliseconds(dirtyDate, -amount);
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js
var MILLISECONDS_IN_DAY2 = 864e5;
function getUTCDayOfYear(dirtyDate) {
requiredArgs(1, arguments);
var date2 = toDate(dirtyDate);
var timestamp = date2.getTime();
date2.setUTCMonth(0, 1);
date2.setUTCHours(0, 0, 0, 0);
var startOfYearTimestamp = date2.getTime();
var difference2 = timestamp - startOfYearTimestamp;
return Math.floor(difference2 / MILLISECONDS_IN_DAY2) + 1;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js
function startOfUTCISOWeek(dirtyDate) {
requiredArgs(1, arguments);
var weekStartsOn = 1;
var date2 = toDate(dirtyDate);
var day = date2.getUTCDay();
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
date2.setUTCDate(date2.getUTCDate() - diff);
date2.setUTCHours(0, 0, 0, 0);
return date2;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js
function getUTCISOWeekYear(dirtyDate) {
requiredArgs(1, arguments);
var date2 = toDate(dirtyDate);
var year = date2.getUTCFullYear();
var fourthOfJanuaryOfNextYear = /* @__PURE__ */ new Date(0);
fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
var fourthOfJanuaryOfThisYear = /* @__PURE__ */ new Date(0);
fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
if (date2.getTime() >= startOfNextYear.getTime()) {
return year + 1;
} else if (date2.getTime() >= startOfThisYear.getTime()) {
return year;
} else {
return year - 1;
}
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js
function startOfUTCISOWeekYear(dirtyDate) {
requiredArgs(1, arguments);
var year = getUTCISOWeekYear(dirtyDate);
var fourthOfJanuary = /* @__PURE__ */ new Date(0);
fourthOfJanuary.setUTCFullYear(year, 0, 4);
fourthOfJanuary.setUTCHours(0, 0, 0, 0);
var date2 = startOfUTCISOWeek(fourthOfJanuary);
return date2;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js
var MILLISECONDS_IN_WEEK = 6048e5;
function getUTCISOWeek(dirtyDate) {
requiredArgs(1, arguments);
var date2 = toDate(dirtyDate);
var diff = startOfUTCISOWeek(date2).getTime() - startOfUTCISOWeekYear(date2).getTime();
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js
function startOfUTCWeek(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs(1, arguments);
var defaultOptions2 = getDefaultOptions();
var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
}
var date2 = toDate(dirtyDate);
var day = date2.getUTCDay();
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
date2.setUTCDate(date2.getUTCDate() - diff);
date2.setUTCHours(0, 0, 0, 0);
return date2;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js
function getUTCWeekYear(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs(1, arguments);
var date2 = toDate(dirtyDate);
var year = date2.getUTCFullYear();
var defaultOptions2 = getDefaultOptions();
var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
}
var firstWeekOfNextYear = /* @__PURE__ */ new Date(0);
firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
var firstWeekOfThisYear = /* @__PURE__ */ new Date(0);
firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
if (date2.getTime() >= startOfNextYear.getTime()) {
return year + 1;
} else if (date2.getTime() >= startOfThisYear.getTime()) {
return year;
} else {
return year - 1;
}
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js
function startOfUTCWeekYear(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs(1, arguments);
var defaultOptions2 = getDefaultOptions();
var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
var year = getUTCWeekYear(dirtyDate, options);
var firstWeek = /* @__PURE__ */ new Date(0);
firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
firstWeek.setUTCHours(0, 0, 0, 0);
var date2 = startOfUTCWeek(firstWeek, options);
return date2;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCWeek/index.js
var MILLISECONDS_IN_WEEK2 = 6048e5;
function getUTCWeek(dirtyDate, options) {
requiredArgs(1, arguments);
var date2 = toDate(dirtyDate);
var diff = startOfUTCWeek(date2, options).getTime() - startOfUTCWeekYear(date2, options).getTime();
return Math.round(diff / MILLISECONDS_IN_WEEK2) + 1;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/addLeadingZeros/index.js
function addLeadingZeros(number2, targetLength) {
var sign = number2 < 0 ? "-" : "";
var output = Math.abs(number2).toString();
while (output.length < targetLength) {
output = "0" + output;
}
return sign + output;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/lightFormatters/index.js
var formatters = {
// Year
y: function y3(date2, token) {
var signedYear = date2.getUTCFullYear();
var year = signedYear > 0 ? signedYear : 1 - signedYear;
return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
},
// Month
M: function M3(date2, token) {
var month = date2.getUTCMonth();
return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
},
// Day of the month
d: function d3(date2, token) {
return addLeadingZeros(date2.getUTCDate(), token.length);
},
// AM or PM
a: function a3(date2, token) {
var dayPeriodEnumValue = date2.getUTCHours() / 12 >= 1 ? "pm" : "am";
switch (token) {
case "a":
case "aa":
return dayPeriodEnumValue.toUpperCase();
case "aaa":
return dayPeriodEnumValue;
case "aaaaa":
return dayPeriodEnumValue[0];
case "aaaa":
default:
return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
}
},
// Hour [1-12]
h: function h3(date2, token) {
return addLeadingZeros(date2.getUTCHours() % 12 || 12, token.length);
},
// Hour [0-23]
H: function H2(date2, token) {
return addLeadingZeros(date2.getUTCHours(), token.length);
},
// Minute
m: function m3(date2, token) {
return addLeadingZeros(date2.getUTCMinutes(), token.length);
},
// Second
s: function s3(date2, token) {
return addLeadingZeros(date2.getUTCSeconds(), token.length);
},
// Fraction of second
S: function S3(date2, token) {
var numberOfDigits = token.length;
var milliseconds = date2.getUTCMilliseconds();
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
return addLeadingZeros(fractionalSeconds, token.length);
}
};
var lightFormatters_default = formatters;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/formatters/index.js
var dayPeriodEnum = {
am: "am",
pm: "pm",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
};
var formatters2 = {
// Era
G: function G(date2, token, localize2) {
var era = date2.getUTCFullYear() > 0 ? 1 : 0;
switch (token) {
case "G":
case "GG":
case "GGG":
return localize2.era(era, {
width: "abbreviated"
});
case "GGGGG":
return localize2.era(era, {
width: "narrow"
});
case "GGGG":
default:
return localize2.era(era, {
width: "wide"
});
}
},
// Year
y: function y4(date2, token, localize2) {
if (token === "yo") {
var signedYear = date2.getUTCFullYear();
var year = signedYear > 0 ? signedYear : 1 - signedYear;
return localize2.ordinalNumber(year, {
unit: "year"
});
}
return lightFormatters_default.y(date2, token);
},
// Local week-numbering year
Y: function Y2(date2, token, localize2, options) {
var signedWeekYear = getUTCWeekYear(date2, options);
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
if (token === "YY") {
var twoDigitYear = weekYear % 100;
return addLeadingZeros(twoDigitYear, 2);
}
if (token === "Yo") {
return localize2.ordinalNumber(weekYear, {
unit: "year"
});
}
return addLeadingZeros(weekYear, token.length);
},
// ISO week-numbering year
R: function R(date2, token) {
var isoWeekYear = getUTCISOWeekYear(date2);
return addLeadingZeros(isoWeekYear, token.length);
},
// Extended year. This is a single number designating the year of this calendar system.
// The main difference between `y` and `u` localizers are B.C. years:
// | Year | `y` | `u` |
// |------|-----|-----|
// | AC 1 | 1 | 1 |
// | BC 1 | 1 | 0 |
// | BC 2 | 2 | -1 |
// Also `yy` always returns the last two digits of a year,
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
u: function u3(date2, token) {
var year = date2.getUTCFullYear();
return addLeadingZeros(year, token.length);
},
// Quarter
Q: function Q(date2, token, localize2) {
var quarter = Math.ceil((date2.getUTCMonth() + 1) / 3);
switch (token) {
case "Q":
return String(quarter);
case "QQ":
return addLeadingZeros(quarter, 2);
case "Qo":
return localize2.ordinalNumber(quarter, {
unit: "quarter"
});
case "QQQ":
return localize2.quarter(quarter, {
width: "abbreviated",
context: "formatting"
});
case "QQQQQ":
return localize2.quarter(quarter, {
width: "narrow",
context: "formatting"
});
case "QQQQ":
default:
return localize2.quarter(quarter, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone quarter
q: function q3(date2, token, localize2) {
var quarter = Math.ceil((date2.getUTCMonth() + 1) / 3);
switch (token) {
case "q":
return String(quarter);
case "qq":
return addLeadingZeros(quarter, 2);
case "qo":
return localize2.ordinalNumber(quarter, {
unit: "quarter"
});
case "qqq":
return localize2.quarter(quarter, {
width: "abbreviated",
context: "standalone"
});
case "qqqqq":
return localize2.quarter(quarter, {
width: "narrow",
context: "standalone"
});
case "qqqq":
default:
return localize2.quarter(quarter, {
width: "wide",
context: "standalone"
});
}
},
// Month
M: function M4(date2, token, localize2) {
var month = date2.getUTCMonth();
switch (token) {
case "M":
case "MM":
return lightFormatters_default.M(date2, token);
case "Mo":
return localize2.ordinalNumber(month + 1, {
unit: "month"
});
case "MMM":
return localize2.month(month, {
width: "abbreviated",
context: "formatting"
});
case "MMMMM":
return localize2.month(month, {
width: "narrow",
context: "formatting"
});
case "MMMM":
default:
return localize2.month(month, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone month
L: function L3(date2, token, localize2) {
var month = date2.getUTCMonth();
switch (token) {
case "L":
return String(month + 1);
case "LL":
return addLeadingZeros(month + 1, 2);
case "Lo":
return localize2.ordinalNumber(month + 1, {
unit: "month"
});
case "LLL":
return localize2.month(month, {
width: "abbreviated",
context: "standalone"
});
case "LLLLL":
return localize2.month(month, {
width: "narrow",
context: "standalone"
});
case "LLLL":
default:
return localize2.month(month, {
width: "wide",
context: "standalone"
});
}
},
// Local week of year
w: function w3(date2, token, localize2, options) {
var week = getUTCWeek(date2, options);
if (token === "wo") {
return localize2.ordinalNumber(week, {
unit: "week"
});
}
return addLeadingZeros(week, token.length);
},
// ISO week of year
I: function I3(date2, token, localize2) {
var isoWeek = getUTCISOWeek(date2);
if (token === "Io") {
return localize2.ordinalNumber(isoWeek, {
unit: "week"
});
}
return addLeadingZeros(isoWeek, token.length);
},
// Day of the month
d: function d4(date2, token, localize2) {
if (token === "do") {
return localize2.ordinalNumber(date2.getUTCDate(), {
unit: "date"
});
}
return lightFormatters_default.d(date2, token);
},
// Day of year
D: function D3(date2, token, localize2) {
var dayOfYear = getUTCDayOfYear(date2);
if (token === "Do") {
return localize2.ordinalNumber(dayOfYear, {
unit: "dayOfYear"
});
}
return addLeadingZeros(dayOfYear, token.length);
},
// Day of week
E: function E(date2, token, localize2) {
var dayOfWeek = date2.getUTCDay();
switch (token) {
case "E":
case "EE":
case "EEE":
return localize2.day(dayOfWeek, {
width: "abbreviated",
context: "formatting"
});
case "EEEEE":
return localize2.day(dayOfWeek, {
width: "narrow",
context: "formatting"
});
case "EEEEEE":
return localize2.day(dayOfWeek, {
width: "short",
context: "formatting"
});
case "EEEE":
default:
return localize2.day(dayOfWeek, {
width: "wide",
context: "formatting"
});
}
},
// Local day of week
e: function e3(date2, token, localize2, options) {
var dayOfWeek = date2.getUTCDay();
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
switch (token) {
case "e":
return String(localDayOfWeek);
case "ee":
return addLeadingZeros(localDayOfWeek, 2);
case "eo":
return localize2.ordinalNumber(localDayOfWeek, {
unit: "day"
});
case "eee":
return localize2.day(dayOfWeek, {
width: "abbreviated",
context: "formatting"
});
case "eeeee":
return localize2.day(dayOfWeek, {
width: "narrow",
context: "formatting"
});
case "eeeeee":
return localize2.day(dayOfWeek, {
width: "short",
context: "formatting"
});
case "eeee":
default:
return localize2.day(dayOfWeek, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone local day of week
c: function c3(date2, token, localize2, options) {
var dayOfWeek = date2.getUTCDay();
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
switch (token) {
case "c":
return String(localDayOfWeek);
case "cc":
return addLeadingZeros(localDayOfWeek, token.length);
case "co":
return localize2.ordinalNumber(localDayOfWeek, {
unit: "day"
});
case "ccc":
return localize2.day(dayOfWeek, {
width: "abbreviated",
context: "standalone"
});
case "ccccc":
return localize2.day(dayOfWeek, {
width: "narrow",
context: "standalone"
});
case "cccccc":
return localize2.day(dayOfWeek, {
width: "short",
context: "standalone"
});
case "cccc":
default:
return localize2.day(dayOfWeek, {
width: "wide",
context: "standalone"
});
}
},
// ISO day of week
i: function i3(date2, token, localize2) {
var dayOfWeek = date2.getUTCDay();
var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
switch (token) {
case "i":
return String(isoDayOfWeek);
case "ii":
return addLeadingZeros(isoDayOfWeek, token.length);
case "io":
return localize2.ordinalNumber(isoDayOfWeek, {
unit: "day"
});
case "iii":
return localize2.day(dayOfWeek, {
width: "abbreviated",
context: "formatting"
});
case "iiiii":
return localize2.day(dayOfWeek, {
width: "narrow",
context: "formatting"
});
case "iiiiii":
return localize2.day(dayOfWeek, {
width: "short",
context: "formatting"
});
case "iiii":
default:
return localize2.day(dayOfWeek, {
width: "wide",
context: "formatting"
});
}
},
// AM or PM
a: function a4(date2, token, localize2) {
var hours = date2.getUTCHours();
var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
switch (token) {
case "a":
case "aa":
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting"
});
case "aaa":
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting"
}).toLowerCase();
case "aaaaa":
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "narrow",
context: "formatting"
});
case "aaaa":
default:
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "wide",
context: "formatting"
});
}
},
// AM, PM, midnight, noon
b: function b3(date2, token, localize2) {
var hours = date2.getUTCHours();
var dayPeriodEnumValue;
if (hours === 12) {
dayPeriodEnumValue = dayPeriodEnum.noon;
} else if (hours === 0) {
dayPeriodEnumValue = dayPeriodEnum.midnight;
} else {
dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
}
switch (token) {
case "b":
case "bb":
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting"
});
case "bbb":
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting"
}).toLowerCase();
case "bbbbb":
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "narrow",
context: "formatting"
});
case "bbbb":
default:
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "wide",
context: "formatting"
});
}
},
// in the morning, in the afternoon, in the evening, at night
B: function B3(date2, token, localize2) {
var hours = date2.getUTCHours();
var dayPeriodEnumValue;
if (hours >= 17) {
dayPeriodEnumValue = dayPeriodEnum.evening;
} else if (hours >= 12) {
dayPeriodEnumValue = dayPeriodEnum.afternoon;
} else if (hours >= 4) {
dayPeriodEnumValue = dayPeriodEnum.morning;
} else {
dayPeriodEnumValue = dayPeriodEnum.night;
}
switch (token) {
case "B":
case "BB":
case "BBB":
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "abbreviated",
context: "formatting"
});
case "BBBBB":
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "narrow",
context: "formatting"
});
case "BBBB":
default:
return localize2.dayPeriod(dayPeriodEnumValue, {
width: "wide",
context: "formatting"
});
}
},
// Hour [1-12]
h: function h4(date2, token, localize2) {
if (token === "ho") {
var hours = date2.getUTCHours() % 12;
if (hours === 0)
hours = 12;
return localize2.ordinalNumber(hours, {
unit: "hour"
});
}
return lightFormatters_default.h(date2, token);
},
// Hour [0-23]
H: function H3(date2, token, localize2) {
if (token === "Ho") {
return localize2.ordinalNumber(date2.getUTCHours(), {
unit: "hour"
});
}
return lightFormatters_default.H(date2, token);
},
// Hour [0-11]
K: function K3(date2, token, localize2) {
var hours = date2.getUTCHours() % 12;
if (token === "Ko") {
return localize2.ordinalNumber(hours, {
unit: "hour"
});
}
return addLeadingZeros(hours, token.length);
},
// Hour [1-24]
k: function k3(date2, token, localize2) {
var hours = date2.getUTCHours();
if (hours === 0)
hours = 24;
if (token === "ko") {
return localize2.ordinalNumber(hours, {
unit: "hour"
});
}
return addLeadingZeros(hours, token.length);
},
// Minute
m: function m4(date2, token, localize2) {
if (token === "mo") {
return localize2.ordinalNumber(date2.getUTCMinutes(), {
unit: "minute"
});
}
return lightFormatters_default.m(date2, token);
},
// Second
s: function s4(date2, token, localize2) {
if (token === "so") {
return localize2.ordinalNumber(date2.getUTCSeconds(), {
unit: "second"
});
}
return lightFormatters_default.s(date2, token);
},
// Fraction of second
S: function S4(date2, token) {
return lightFormatters_default.S(date2, token);
},
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
X: function X2(date2, token, _localize, options) {
var originalDate = options._originalDate || date2;
var timezoneOffset = originalDate.getTimezoneOffset();
if (timezoneOffset === 0) {
return "Z";
}
switch (token) {
case "X":
return formatTimezoneWithOptionalMinutes(timezoneOffset);
case "XXXX":
case "XX":
return formatTimezone(timezoneOffset);
case "XXXXX":
case "XXX":
default:
return formatTimezone(timezoneOffset, ":");
}
},
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
x: function x4(date2, token, _localize, options) {
var originalDate = options._originalDate || date2;
var timezoneOffset = originalDate.getTimezoneOffset();
switch (token) {
case "x":
return formatTimezoneWithOptionalMinutes(timezoneOffset);
case "xxxx":
case "xx":
return formatTimezone(timezoneOffset);
case "xxxxx":
case "xxx":
default:
return formatTimezone(timezoneOffset, ":");
}
},
// Timezone (GMT)
O: function O2(date2, token, _localize, options) {
var originalDate = options._originalDate || date2;
var timezoneOffset = originalDate.getTimezoneOffset();
switch (token) {
case "O":
case "OO":
case "OOO":
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
case "OOOO":
default:
return "GMT" + formatTimezone(timezoneOffset, ":");
}
},
// Timezone (specific non-location)
z: function z3(date2, token, _localize, options) {
var originalDate = options._originalDate || date2;
var timezoneOffset = originalDate.getTimezoneOffset();
switch (token) {
case "z":
case "zz":
case "zzz":
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
case "zzzz":
default:
return "GMT" + formatTimezone(timezoneOffset, ":");
}
},
// Seconds timestamp
t: function t3(date2, token, _localize, options) {
var originalDate = options._originalDate || date2;
var timestamp = Math.floor(originalDate.getTime() / 1e3);
return addLeadingZeros(timestamp, token.length);
},
// Milliseconds timestamp
T: function T3(date2, token, _localize, options) {
var originalDate = options._originalDate || date2;
var timestamp = originalDate.getTime();
return addLeadingZeros(timestamp, token.length);
}
};
function formatTimezoneShort(offset, dirtyDelimiter) {
var sign = offset > 0 ? "-" : "+";
var absOffset = Math.abs(offset);
var hours = Math.floor(absOffset / 60);
var minutes = absOffset % 60;
if (minutes === 0) {
return sign + String(hours);
}
var delimiter2 = dirtyDelimiter || "";
return sign + String(hours) + delimiter2 + addLeadingZeros(minutes, 2);
}
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
if (offset % 60 === 0) {
var sign = offset > 0 ? "-" : "+";
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
}
return formatTimezone(offset, dirtyDelimiter);
}
function formatTimezone(offset, dirtyDelimiter) {
var delimiter2 = dirtyDelimiter || "";
var sign = offset > 0 ? "-" : "+";
var absOffset = Math.abs(offset);
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
var minutes = addLeadingZeros(absOffset % 60, 2);
return sign + hours + delimiter2 + minutes;
}
var formatters_default = formatters2;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/longFormatters/index.js
var dateLongFormatter = function dateLongFormatter2(pattern, formatLong2) {
switch (pattern) {
case "P":
return formatLong2.date({
width: "short"
});
case "PP":
return formatLong2.date({
width: "medium"
});
case "PPP":
return formatLong2.date({
width: "long"
});
case "PPPP":
default:
return formatLong2.date({
width: "full"
});
}
};
var timeLongFormatter = function timeLongFormatter2(pattern, formatLong2) {
switch (pattern) {
case "p":
return formatLong2.time({
width: "short"
});
case "pp":
return formatLong2.time({
width: "medium"
});
case "ppp":
return formatLong2.time({
width: "long"
});
case "pppp":
default:
return formatLong2.time({
width: "full"
});
}
};
var dateTimeLongFormatter = function dateTimeLongFormatter2(pattern, formatLong2) {
var matchResult = pattern.match(/(P+)(p+)?/) || [];
var datePattern = matchResult[1];
var timePattern = matchResult[2];
if (!timePattern) {
return dateLongFormatter(pattern, formatLong2);
}
var dateTimeFormat;
switch (datePattern) {
case "P":
dateTimeFormat = formatLong2.dateTime({
width: "short"
});
break;
case "PP":
dateTimeFormat = formatLong2.dateTime({
width: "medium"
});
break;
case "PPP":
dateTimeFormat = formatLong2.dateTime({
width: "long"
});
break;
case "PPPP":
default:
dateTimeFormat = formatLong2.dateTime({
width: "full"
});
break;
}
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
};
var longFormatters = {
p: timeLongFormatter,
P: dateTimeLongFormatter
};
var longFormatters_default = longFormatters;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/protectedTokens/index.js
var protectedDayOfYearTokens = ["D", "DD"];
var protectedWeekYearTokens = ["YY", "YYYY"];
function isProtectedDayOfYearToken(token) {
return protectedDayOfYearTokens.indexOf(token) !== -1;
}
function isProtectedWeekYearToken(token) {
return protectedWeekYearTokens.indexOf(token) !== -1;
}
function throwProtectedError(token, format2, input) {
if (token === "YYYY") {
throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
} else if (token === "YY") {
throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
} else if (token === "D") {
throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
} else if (token === "DD") {
throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
}
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js
var formatDistanceLocale = {
lessThanXSeconds: {
one: "less than a second",
other: "less than {{count}} seconds"
},
xSeconds: {
one: "1 second",
other: "{{count}} seconds"
},
halfAMinute: "half a minute",
lessThanXMinutes: {
one: "less than a minute",
other: "less than {{count}} minutes"
},
xMinutes: {
one: "1 minute",
other: "{{count}} minutes"
},
aboutXHours: {
one: "about 1 hour",
other: "about {{count}} hours"
},
xHours: {
one: "1 hour",
other: "{{count}} hours"
},
xDays: {
one: "1 day",
other: "{{count}} days"
},
aboutXWeeks: {
one: "about 1 week",
other: "about {{count}} weeks"
},
xWeeks: {
one: "1 week",
other: "{{count}} weeks"
},
aboutXMonths: {
one: "about 1 month",
other: "about {{count}} months"
},
xMonths: {
one: "1 month",
other: "{{count}} months"
},
aboutXYears: {
one: "about 1 year",
other: "about {{count}} years"
},
xYears: {
one: "1 year",
other: "{{count}} years"
},
overXYears: {
one: "over 1 year",
other: "over {{count}} years"
},
almostXYears: {
one: "almost 1 year",
other: "almost {{count}} years"
}
};
var formatDistance = function formatDistance2(token, count, options) {
var result;
var tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === "string") {
result = tokenValue;
} else if (count === 1) {
result = tokenValue.one;
} else {
result = tokenValue.other.replace("{{count}}", count.toString());
}
if (options !== null && options !== void 0 && options.addSuffix) {
if (options.comparison && options.comparison > 0) {
return "in " + result;
} else {
return result + " ago";
}
}
return result;
};
var formatDistance_default = formatDistance;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js
function buildFormatLongFn(args) {
return function() {
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
var width = options.width ? String(options.width) : args.defaultWidth;
var format2 = args.formats[width] || args.formats[args.defaultWidth];
return format2;
};
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js
var dateFormats = {
full: "EEEE, MMMM do, y",
long: "MMMM do, y",
medium: "MMM d, y",
short: "MM/dd/yyyy"
};
var timeFormats = {
full: "h:mm:ss a zzzz",
long: "h:mm:ss a z",
medium: "h:mm:ss a",
short: "h:mm a"
};
var dateTimeFormats = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: "{{date}}, {{time}}",
short: "{{date}}, {{time}}"
};
var formatLong = {
date: buildFormatLongFn({
formats: dateFormats,
defaultWidth: "full"
}),
time: buildFormatLongFn({
formats: timeFormats,
defaultWidth: "full"
}),
dateTime: buildFormatLongFn({
formats: dateTimeFormats,
defaultWidth: "full"
})
};
var formatLong_default = formatLong;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js
var formatRelativeLocale = {
lastWeek: "'last' eeee 'at' p",
yesterday: "'yesterday at' p",
today: "'today at' p",
tomorrow: "'tomorrow at' p",
nextWeek: "eeee 'at' p",
other: "P"
};
var formatRelative = function formatRelative2(token, _date, _baseDate, _options) {
return formatRelativeLocale[token];
};
var formatRelative_default = formatRelative;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js
function buildLocalizeFn(args) {
return function(dirtyIndex, options) {
var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
var valuesArray;
if (context === "formatting" && args.formattingValues) {
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
} else {
var _defaultWidth = args.defaultWidth;
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
valuesArray = args.values[_width] || args.values[_defaultWidth];
}
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
return valuesArray[index];
};
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js
var eraValues = {
narrow: ["B", "A"],
abbreviated: ["BC", "AD"],
wide: ["Before Christ", "Anno Domini"]
};
var quarterValues = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
};
var monthValues = {
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
};
var dayValues = {
narrow: ["S", "M", "T", "W", "T", "F", "S"],
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
};
var dayPeriodValues = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
}
};
var formattingDayPeriodValues = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
}
};
var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) {
var number2 = Number(dirtyNumber);
var rem100 = number2 % 100;
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number2 + "st";
case 2:
return number2 + "nd";
case 3:
return number2 + "rd";
}
}
return number2 + "th";
};
var localize = {
ordinalNumber,
era: buildLocalizeFn({
values: eraValues,
defaultWidth: "wide"
}),
quarter: buildLocalizeFn({
values: quarterValues,
defaultWidth: "wide",
argumentCallback: function argumentCallback(quarter) {
return quarter - 1;
}
}),
month: buildLocalizeFn({
values: monthValues,
defaultWidth: "wide"
}),
day: buildLocalizeFn({
values: dayValues,
defaultWidth: "wide"
}),
dayPeriod: buildLocalizeFn({
values: dayPeriodValues,
defaultWidth: "wide",
formattingValues: formattingDayPeriodValues,
defaultFormattingWidth: "wide"
})
};
var localize_default = localize;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js
function buildMatchFn(args) {
return function(string2) {
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var width = options.width;
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
var matchResult = string2.match(matchPattern);
if (!matchResult) {
return null;
}
var matchedString = matchResult[0];
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) {
return pattern.test(matchedString);
}) : findKey(parsePatterns, function(pattern) {
return pattern.test(matchedString);
});
var value;
value = args.valueCallback ? args.valueCallback(key) : key;
value = options.valueCallback ? options.valueCallback(value) : value;
var rest = string2.slice(matchedString.length);
return {
value,
rest
};
};
}
function findKey(object2, predicate) {
for (var key in object2) {
if (object2.hasOwnProperty(key) && predicate(object2[key])) {
return key;
}
}
return void 0;
}
function findIndex(array2, predicate) {
for (var key = 0; key < array2.length; key++) {
if (predicate(array2[key])) {
return key;
}
}
return void 0;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js
function buildMatchPatternFn(args) {
return function(string2) {
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var matchResult = string2.match(args.matchPattern);
if (!matchResult)
return null;
var matchedString = matchResult[0];
var parseResult = string2.match(args.parsePattern);
if (!parseResult)
return null;
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
value = options.valueCallback ? options.valueCallback(value) : value;
var rest = string2.slice(matchedString.length);
return {
value,
rest
};
};
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
var parseOrdinalNumberPattern = /\d+/i;
var matchEraPatterns = {
narrow: /^(b|a)/i,
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
wide: /^(before christ|before common era|anno domini|common era)/i
};
var parseEraPatterns = {
any: [/^b/i, /^(a|c)/i]
};
var matchQuarterPatterns = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](th|st|nd|rd)? quarter/i
};
var parseQuarterPatterns = {
any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns = {
narrow: /^[jfmasond]/i,
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
};
var parseMonthPatterns = {
narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
};
var matchDayPatterns = {
narrow: /^[smtwf]/i,
short: /^(su|mo|tu|we|th|fr|sa)/i,
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
};
var parseDayPatterns = {
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
};
var matchDayPeriodPatterns = {
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
};
var parseDayPeriodPatterns = {
any: {
am: /^a/i,
pm: /^p/i,
midnight: /^mi/i,
noon: /^no/i,
morning: /morning/i,
afternoon: /afternoon/i,
evening: /evening/i,
night: /night/i
}
};
var match = {
ordinalNumber: buildMatchPatternFn({
matchPattern: matchOrdinalNumberPattern,
parsePattern: parseOrdinalNumberPattern,
valueCallback: function valueCallback(value) {
return parseInt(value, 10);
}
}),
era: buildMatchFn({
matchPatterns: matchEraPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseEraPatterns,
defaultParseWidth: "any"
}),
quarter: buildMatchFn({
matchPatterns: matchQuarterPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseQuarterPatterns,
defaultParseWidth: "any",
valueCallback: function valueCallback2(index) {
return index + 1;
}
}),
month: buildMatchFn({
matchPatterns: matchMonthPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseMonthPatterns,
defaultParseWidth: "any"
}),
day: buildMatchFn({
matchPatterns: matchDayPatterns,
defaultMatchWidth: "wide",
parsePatterns: parseDayPatterns,
defaultParseWidth: "any"
}),
dayPeriod: buildMatchFn({
matchPatterns: matchDayPeriodPatterns,
defaultMatchWidth: "any",
parsePatterns: parseDayPeriodPatterns,
defaultParseWidth: "any"
})
};
var match_default = match;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/index.js
var locale = {
code: "en-US",
formatDistance: formatDistance_default,
formatLong: formatLong_default,
formatRelative: formatRelative_default,
localize: localize_default,
match: match_default,
options: {
weekStartsOn: 0,
firstWeekContainsDate: 1
}
};
var en_US_default = locale;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/defaultLocale/index.js
var defaultLocale_default = en_US_default;
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/format/index.js
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
var escapedStringRegExp = /^'([^]*?)'?$/;
var doubleQuoteRegExp = /''/g;
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
function format(dirtyDate, dirtyFormatStr, options) {
var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
requiredArgs(2, arguments);
var formatStr = String(dirtyFormatStr);
var defaultOptions2 = getDefaultOptions();
var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions2.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default;
var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions2.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
}
var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions2.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions2.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
}
if (!locale2.localize) {
throw new RangeError("locale must contain localize property");
}
if (!locale2.formatLong) {
throw new RangeError("locale must contain formatLong property");
}
var originalDate = toDate(dirtyDate);
if (!isValid(originalDate)) {
throw new RangeError("Invalid time value");
}
var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
var utcDate = subMilliseconds(originalDate, timezoneOffset);
var formatterOptions = {
firstWeekContainsDate,
weekStartsOn,
locale: locale2,
_originalDate: originalDate
};
var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
var firstCharacter = substring[0];
if (firstCharacter === "p" || firstCharacter === "P") {
var longFormatter = longFormatters_default[firstCharacter];
return longFormatter(substring, locale2.formatLong);
}
return substring;
}).join("").match(formattingTokensRegExp).map(function(substring) {
if (substring === "''") {
return "'";
}
var firstCharacter = substring[0];
if (firstCharacter === "'") {
return cleanEscapedString(substring);
}
var formatter = formatters_default[firstCharacter];
if (formatter) {
if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
}
if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
}
return formatter(utcDate, substring, locale2.localize, formatterOptions);
}
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
}
return substring;
}).join("");
return result;
}
function cleanEscapedString(input) {
var matched = input.match(escapedStringRegExp);
if (!matched) {
return input;
}
return matched[1].replace(doubleQuoteRegExp, "'");
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/assign/index.js
function assign2(target, object2) {
if (target == null) {
throw new TypeError("assign requires that input parameter not be null or undefined");
}
for (var property in object2) {
if (Object.prototype.hasOwnProperty.call(object2, property)) {
;
target[property] = object2[property];
}
}
return target;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/cloneObject/index.js
function cloneObject(object2) {
return assign2({}, object2);
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/formatDistance/index.js
var MINUTES_IN_DAY = 1440;
var MINUTES_IN_ALMOST_TWO_DAYS = 2520;
var MINUTES_IN_MONTH = 43200;
var MINUTES_IN_TWO_MONTHS = 86400;
function formatDistance3(dirtyDate, dirtyBaseDate, options) {
var _ref, _options$locale;
requiredArgs(2, arguments);
var defaultOptions2 = getDefaultOptions();
var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions2.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default;
if (!locale2.formatDistance) {
throw new RangeError("locale must contain formatDistance property");
}
var comparison = compareAsc(dirtyDate, dirtyBaseDate);
if (isNaN(comparison)) {
throw new RangeError("Invalid time value");
}
var localizeOptions = assign2(cloneObject(options), {
addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix),
comparison
});
var dateLeft;
var dateRight;
if (comparison > 0) {
dateLeft = toDate(dirtyBaseDate);
dateRight = toDate(dirtyDate);
} else {
dateLeft = toDate(dirtyDate);
dateRight = toDate(dirtyBaseDate);
}
var seconds = differenceInSeconds(dateRight, dateLeft);
var offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1e3;
var minutes = Math.round((seconds - offsetInSeconds) / 60);
var months;
if (minutes < 2) {
if (options !== null && options !== void 0 && options.includeSeconds) {
if (seconds < 5) {
return locale2.formatDistance("lessThanXSeconds", 5, localizeOptions);
} else if (seconds < 10) {
return locale2.formatDistance("lessThanXSeconds", 10, localizeOptions);
} else if (seconds < 20) {
return locale2.formatDistance("lessThanXSeconds", 20, localizeOptions);
} else if (seconds < 40) {
return locale2.formatDistance("halfAMinute", 0, localizeOptions);
} else if (seconds < 60) {
return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions);
} else {
return locale2.formatDistance("xMinutes", 1, localizeOptions);
}
} else {
if (minutes === 0) {
return locale2.formatDistance("lessThanXMinutes", 1, localizeOptions);
} else {
return locale2.formatDistance("xMinutes", minutes, localizeOptions);
}
}
} else if (minutes < 45) {
return locale2.formatDistance("xMinutes", minutes, localizeOptions);
} else if (minutes < 90) {
return locale2.formatDistance("aboutXHours", 1, localizeOptions);
} else if (minutes < MINUTES_IN_DAY) {
var hours = Math.round(minutes / 60);
return locale2.formatDistance("aboutXHours", hours, localizeOptions);
} else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {
return locale2.formatDistance("xDays", 1, localizeOptions);
} else if (minutes < MINUTES_IN_MONTH) {
var days = Math.round(minutes / MINUTES_IN_DAY);
return locale2.formatDistance("xDays", days, localizeOptions);
} else if (minutes < MINUTES_IN_TWO_MONTHS) {
months = Math.round(minutes / MINUTES_IN_MONTH);
return locale2.formatDistance("aboutXMonths", months, localizeOptions);
}
months = differenceInMonths(dateRight, dateLeft);
if (months < 12) {
var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);
return locale2.formatDistance("xMonths", nearestMonth, localizeOptions);
} else {
var monthsSinceStartOfYear = months % 12;
var years = Math.floor(months / 12);
if (monthsSinceStartOfYear < 3) {
return locale2.formatDistance("aboutXYears", years, localizeOptions);
} else if (monthsSinceStartOfYear < 9) {
return locale2.formatDistance("overXYears", years, localizeOptions);
} else {
return locale2.formatDistance("almostXYears", years + 1, localizeOptions);
}
}
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/formatDuration/index.js
var defaultFormat = ["years", "months", "weeks", "days", "hours", "minutes", "seconds"];
function formatDuration(duration, options) {
var _ref, _options$locale, _options$format, _options$zero, _options$delimiter;
if (arguments.length < 1) {
throw new TypeError("1 argument required, but only ".concat(arguments.length, " present"));
}
var defaultOptions2 = getDefaultOptions();
var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions2.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default;
var format2 = (_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : defaultFormat;
var zero = (_options$zero = options === null || options === void 0 ? void 0 : options.zero) !== null && _options$zero !== void 0 ? _options$zero : false;
var delimiter2 = (_options$delimiter = options === null || options === void 0 ? void 0 : options.delimiter) !== null && _options$delimiter !== void 0 ? _options$delimiter : " ";
if (!locale2.formatDistance) {
return "";
}
var result = format2.reduce(function(acc, unit) {
var token = "x".concat(unit.replace(/(^.)/, function(m5) {
return m5.toUpperCase();
}));
var value = duration[unit];
if (typeof value === "number" && (zero || duration[unit])) {
return acc.concat(locale2.formatDistance(token, value));
}
return acc;
}, []).join(delimiter2);
return result;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/intervalToDuration/index.js
function intervalToDuration(interval) {
requiredArgs(1, arguments);
var start = toDate(interval.start);
var end = toDate(interval.end);
if (isNaN(start.getTime()))
throw new RangeError("Start Date is invalid");
if (isNaN(end.getTime()))
throw new RangeError("End Date is invalid");
var duration = {};
duration.years = Math.abs(differenceInYears(end, start));
var sign = compareAsc(end, start);
var remainingMonths = add2(start, {
years: sign * duration.years
});
duration.months = Math.abs(differenceInMonths(end, remainingMonths));
var remainingDays = add2(remainingMonths, {
months: sign * duration.months
});
duration.days = Math.abs(differenceInDays(end, remainingDays));
var remainingHours = add2(remainingDays, {
days: sign * duration.days
});
duration.hours = Math.abs(differenceInHours(end, remainingHours));
var remainingMinutes = add2(remainingHours, {
hours: sign * duration.hours
});
duration.minutes = Math.abs(differenceInMinutes(end, remainingMinutes));
var remainingSeconds = add2(remainingMinutes, {
minutes: sign * duration.minutes
});
duration.seconds = Math.abs(differenceInSeconds(end, remainingSeconds));
return duration;
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isAfter/index.js
function isAfter(dirtyDate, dirtyDateToCompare) {
requiredArgs(2, arguments);
var date2 = toDate(dirtyDate);
var dateToCompare = toDate(dirtyDateToCompare);
return date2.getTime() > dateToCompare.getTime();
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isBefore/index.js
function isBefore(dirtyDate, dirtyDateToCompare) {
requiredArgs(2, arguments);
var date2 = toDate(dirtyDate);
var dateToCompare = toDate(dirtyDateToCompare);
return date2.getTime() < dateToCompare.getTime();
}
// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isFuture/index.js
function isFuture(dirtyDate) {
requiredArgs(1, arguments);
return toDate(dirtyDate).getTime() > Date.now();
}
// src/InstanceRoutes.tsx
init_preact_module();
init_hooks_module();
// src/components/exception/loading.tsx
init_preact_module();
function Loading() {
return /* @__PURE__ */ h(
"div",
{
class: "columns is-centered is-vcentered",
style: {
height: "calc(100% - 3rem)",
position: "absolute",
width: "100%"
}
},
/* @__PURE__ */ h(Spinner, null)
);
}
function Spinner() {
return /* @__PURE__ */ h("div", { class: "lds-ring" }, /* @__PURE__ */ h("div", null), /* @__PURE__ */ h("div", null), /* @__PURE__ */ h("div", null), /* @__PURE__ */ h("div", null));
}
// src/components/menu/index.tsx
init_preact_module();
init_hooks_module();
// src/AdminRoutes.tsx
init_preact_module();
// src/paths/admin/create/index.tsx
init_preact_module();
init_hooks_module();
// src/context/backend.ts
init_preact_module();
init_hooks_module();
// src/hooks/index.ts
init_hooks_module();
// src/hooks/backend.ts
init_hooks_module();
// ../../node_modules/.pnpm/swr@2.2.2_react@18.2.0/node_modules/swr/core/dist/index.mjs
init_compat_module();
var import_shim = __toESM(require_shim(), 1);
// ../../node_modules/.pnpm/swr@2.2.2_react@18.2.0/node_modules/swr/_internal/dist/index.mjs
init_compat_module();
var noop = () => {
};
var UNDEFINED = (
/*#__NOINLINE__*/
noop()
);
var OBJECT = Object;
var isUndefined = (v3) => v3 === UNDEFINED;
var isFunction = (v3) => typeof v3 == "function";
var mergeObjects = (a5, b4) => __spreadValues(__spreadValues({}, a5), b4);
var isPromiseLike = (x6) => isFunction(x6.then);
var table = /* @__PURE__ */ new WeakMap();
var counter = 0;
var stableHash = (arg) => {
const type = typeof arg;
const constructor = arg && arg.constructor;
const isDate3 = constructor == Date;
let result;
let index;
if (OBJECT(arg) === arg && !isDate3 && constructor != RegExp) {
result = table.get(arg);
if (result)
return result;
result = ++counter + "~";
table.set(arg, result);
if (constructor == Array) {
result = "@";
for (index = 0; index < arg.length; index++) {
result += stableHash(arg[index]) + ",";
}
table.set(arg, result);
}
if (constructor == OBJECT) {
result = "#";
const keys = OBJECT.keys(arg).sort();
while (!isUndefined(index = keys.pop())) {
if (!isUndefined(arg[index])) {
result += index + ":" + stableHash(arg[index]) + ",";
}
}
table.set(arg, result);
}
} else {
result = isDate3 ? arg.toJSON() : type == "symbol" ? arg.toString() : type == "string" ? JSON.stringify(arg) : "" + arg;
}
return result;
};
var SWRGlobalState = /* @__PURE__ */ new WeakMap();
var EMPTY_CACHE = {};
var INITIAL_CACHE = {};
var STR_UNDEFINED = "undefined";
var isWindowDefined = typeof window != STR_UNDEFINED;
var isDocumentDefined = typeof document != STR_UNDEFINED;
var hasRequestAnimationFrame = () => isWindowDefined && typeof window["requestAnimationFrame"] != STR_UNDEFINED;
var createCacheHelper = (cache2, key) => {
const state = SWRGlobalState.get(cache2);
return [
// Getter
() => !isUndefined(key) && cache2.get(key) || EMPTY_CACHE,
// Setter
(info) => {
if (!isUndefined(key)) {
const prev = cache2.get(key);
if (!(key in INITIAL_CACHE)) {
INITIAL_CACHE[key] = prev;
}
state[5](key, mergeObjects(prev, info), prev || EMPTY_CACHE);
}
},
// Subscriber
state[6],
// Get server cache snapshot
() => {
if (!isUndefined(key)) {
if (key in INITIAL_CACHE)
return INITIAL_CACHE[key];
}
return !isUndefined(key) && cache2.get(key) || EMPTY_CACHE;
}
];
};
var online = true;
var isOnline = () => online;
var [onWindowEvent, offWindowEvent] = isWindowDefined && window.addEventListener ? [
window.addEventListener.bind(window),
window.removeEventListener.bind(window)
] : [
noop,
noop
];
var isVisible = () => {
const visibilityState = isDocumentDefined && document.visibilityState;
return isUndefined(visibilityState) || visibilityState !== "hidden";
};
var initFocus = (callback) => {
if (isDocumentDefined) {
document.addEventListener("visibilitychange", callback);
}
onWindowEvent("focus", callback);
return () => {
if (isDocumentDefined) {
document.removeEventListener("visibilitychange", callback);
}
offWindowEvent("focus", callback);
};
};
var initReconnect = (callback) => {
const onOnline = () => {
online = true;
callback();
};
const onOffline = () => {
online = false;
};
onWindowEvent("online", onOnline);
onWindowEvent("offline", onOffline);
return () => {
offWindowEvent("online", onOnline);
offWindowEvent("offline", onOffline);
};
};
var preset = {
isOnline,
isVisible
};
var defaultConfigOptions = {
initFocus,
initReconnect
};
var IS_REACT_LEGACY = !bn.useId;
var IS_SERVER = !isWindowDefined || "Deno" in window;
var rAF = (f3) => hasRequestAnimationFrame() ? window["requestAnimationFrame"](f3) : setTimeout(f3, 1);
var useIsomorphicLayoutEffect = IS_SERVER ? h2 : s2;
var navigatorConnection = typeof navigator !== "undefined" && navigator.connection;
var slowConnection = !IS_SERVER && navigatorConnection && ([
"slow-2g",
"2g"
].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData);
var serialize = (key) => {
if (isFunction(key)) {
try {
key = key();
} catch (err) {
key = "";
}
}
const args = key;
key = typeof key == "string" ? key : (Array.isArray(key) ? key.length : key) ? stableHash(key) : "";
return [
key,
args
];
};
var __timestamp = 0;
var getTimestamp = () => ++__timestamp;
var FOCUS_EVENT = 0;
var RECONNECT_EVENT = 1;
var MUTATE_EVENT = 2;
var ERROR_REVALIDATE_EVENT = 3;
var events = {
__proto__: null,
ERROR_REVALIDATE_EVENT,
FOCUS_EVENT,
MUTATE_EVENT,
RECONNECT_EVENT
};
function internalMutate(...args) {
return __async(this, null, function* () {
const [cache2, _key, _data, _opts] = args;
const options = mergeObjects({
populateCache: true,
throwOnError: true
}, typeof _opts === "boolean" ? {
revalidate: _opts
} : _opts || {});
let populateCache = options.populateCache;
const rollbackOnErrorOption = options.rollbackOnError;
let optimisticData = options.optimisticData;
const revalidate = options.revalidate !== false;
const rollbackOnError = (error2) => {
return typeof rollbackOnErrorOption === "function" ? rollbackOnErrorOption(error2) : rollbackOnErrorOption !== false;
};
const throwOnError = options.throwOnError;
if (isFunction(_key)) {
const keyFilter = _key;
const matchedKeys = [];
const it = cache2.keys();
for (const key of it) {
if (
// Skip the special useSWRInfinite and useSWRSubscription keys.
!/^\$(inf|sub)\$/.test(key) && keyFilter(cache2.get(key)._k)
) {
matchedKeys.push(key);
}
}
return Promise.all(matchedKeys.map(mutateByKey));
}
return mutateByKey(_key);
function mutateByKey(_k) {
return __async(this, null, function* () {
const [key] = serialize(_k);
if (!key)
return;
const [get, set2] = createCacheHelper(cache2, key);
const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2);
const startRevalidate = () => {
const revalidators = EVENT_REVALIDATORS[key];
if (revalidate) {
delete FETCH[key];
delete PRELOAD[key];
if (revalidators && revalidators[0]) {
return revalidators[0](MUTATE_EVENT).then(() => get().data);
}
}
return get().data;
};
if (args.length < 3) {
return startRevalidate();
}
let data = _data;
let error2;
const beforeMutationTs = getTimestamp();
MUTATION[key] = [
beforeMutationTs,
0
];
const hasOptimisticData = !isUndefined(optimisticData);
const state = get();
const displayedData = state.data;
const currentData = state._c;
const committedData = isUndefined(currentData) ? displayedData : currentData;
if (hasOptimisticData) {
optimisticData = isFunction(optimisticData) ? optimisticData(committedData, displayedData) : optimisticData;
set2({
data: optimisticData,
_c: committedData
});
}
if (isFunction(data)) {
try {
data = data(committedData);
} catch (err) {
error2 = err;
}
}
if (data && isPromiseLike(data)) {
data = yield data.catch((err) => {
error2 = err;
});
if (beforeMutationTs !== MUTATION[key][0]) {
if (error2)
throw error2;
return data;
} else if (error2 && hasOptimisticData && rollbackOnError(error2)) {
populateCache = true;
set2({
data: committedData,
_c: UNDEFINED
});
}
}
if (populateCache) {
if (!error2) {
if (isFunction(populateCache)) {
const populateCachedData = populateCache(data, committedData);
set2({
data: populateCachedData,
error: UNDEFINED,
_c: UNDEFINED
});
} else {
set2({
data,
error: UNDEFINED,
_c: UNDEFINED
});
}
}
}
MUTATION[key][1] = getTimestamp();
Promise.resolve(startRevalidate()).then(() => {
set2({
_c: UNDEFINED
});
});
if (error2) {
if (throwOnError)
throw error2;
return;
}
return data;
});
}
});
}
var revalidateAllKeys = (revalidators, type) => {
for (const key in revalidators) {
if (revalidators[key][0])
revalidators[key][0](type);
}
};
var initCache = (provider, options) => {
if (!SWRGlobalState.has(provider)) {
const opts = mergeObjects(defaultConfigOptions, options);
const EVENT_REVALIDATORS = {};
const mutate2 = internalMutate.bind(UNDEFINED, provider);
let unmount = noop;
const subscriptions = {};
const subscribe = (key, callback) => {
const subs = subscriptions[key] || [];
subscriptions[key] = subs;
subs.push(callback);
return () => subs.splice(subs.indexOf(callback), 1);
};
const setter = (key, value, prev) => {
provider.set(key, value);
const subs = subscriptions[key];
if (subs) {
for (const fn2 of subs) {
fn2(value, prev);
}
}
};
const initProvider = () => {
if (!SWRGlobalState.has(provider)) {
SWRGlobalState.set(provider, [
EVENT_REVALIDATORS,
{},
{},
{},
mutate2,
setter,
subscribe
]);
if (!IS_SERVER) {
const releaseFocus = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT)));
const releaseReconnect = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT)));
unmount = () => {
releaseFocus && releaseFocus();
releaseReconnect && releaseReconnect();
SWRGlobalState.delete(provider);
};
}
}
};
initProvider();
return [
provider,
mutate2,
initProvider,
unmount
];
}
return [
provider,
SWRGlobalState.get(provider)[4]
];
};
var onErrorRetry = (_3, __, config, revalidate, opts) => {
const maxRetryCount = config.errorRetryCount;
const currentRetryCount = opts.retryCount;
const timeout = ~~((Math.random() + 0.5) * (1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;
if (!isUndefined(maxRetryCount) && currentRetryCount > maxRetryCount) {
return;
}
setTimeout(revalidate, timeout, opts);
};
var compare = (currentData, newData) => stableHash(currentData) == stableHash(newData);
var [cache, mutate] = initCache(/* @__PURE__ */ new Map());
var defaultConfig = mergeObjects(
{
// events
onLoadingSlow: noop,
onSuccess: noop,
onError: noop,
onErrorRetry,
onDiscarded: noop,
// switches
revalidateOnFocus: true,
revalidateOnReconnect: true,
revalidateIfStale: true,
shouldRetryOnError: true,
// timeouts
errorRetryInterval: slowConnection ? 1e4 : 5e3,
focusThrottleInterval: 5 * 1e3,
dedupingInterval: 2 * 1e3,
loadingTimeout: slowConnection ? 5e3 : 3e3,
// providers
compare,
isPaused: () => false,
cache,
mutate,
fallback: {}
},
// use web preset by default
preset
);
var mergeConfigs = (a5, b4) => {
const v3 = mergeObjects(a5, b4);
if (b4) {
const { use: u1, fallback: f1 } = a5;
const { use: u22, fallback: f22 } = b4;
if (u1 && u22) {
v3.use = u1.concat(u22);
}
if (f1 && f22) {
v3.fallback = mergeObjects(f1, f22);
}
}
return v3;
};
var SWRConfigContext = B({});
var SWRConfig = (props) => {
const { value } = props;
const parentConfig = q2(SWRConfigContext);
const isFunctionalConfig = isFunction(value);
const config = F(() => isFunctionalConfig ? value(parentConfig) : value, [
isFunctionalConfig,
parentConfig,
value
]);
const extendedConfig = F(() => isFunctionalConfig ? config : mergeConfigs(parentConfig, config), [
isFunctionalConfig,
parentConfig,
config
]);
const provider = config && config.provider;
const cacheContextRef = _2(UNDEFINED);
if (provider && !cacheContextRef.current) {
cacheContextRef.current = initCache(provider(extendedConfig.cache || cache), config);
}
const cacheContext = cacheContextRef.current;
if (cacheContext) {
extendedConfig.cache = cacheContext[0];
extendedConfig.mutate = cacheContext[1];
}
useIsomorphicLayoutEffect(() => {
if (cacheContext) {
cacheContext[2] && cacheContext[2]();
return cacheContext[3];
}
}, []);
return h(SWRConfigContext.Provider, mergeObjects(props, {
value: extendedConfig
}));
};
var INFINITE_PREFIX = "$inf$";
var enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;
var use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];
var setupDevTools = () => {
if (enableDevtools) {
window.__SWR_DEVTOOLS_REACT__ = bn;
}
};
var normalize = (args) => {
return isFunction(args[1]) ? [
args[0],
args[1],
args[2] || {}
] : [
args[0],
null,
(args[1] === null ? args[2] : args[1]) || {}
];
};
var useSWRConfig = () => {
return mergeObjects(defaultConfig, q2(SWRConfigContext));
};
var middleware = (useSWRNext) => (key_, fetcher_, config) => {
const fetcher = fetcher_ && ((...args) => {
const [key] = serialize(key_);
const [, , , PRELOAD] = SWRGlobalState.get(cache);
if (key.startsWith(INFINITE_PREFIX)) {
return fetcher_(...args);
}
const req = PRELOAD[key];
if (isUndefined(req))
return fetcher_(...args);
delete PRELOAD[key];
return req;
});
return useSWRNext(key_, fetcher, config);
};
var BUILT_IN_MIDDLEWARE = use.concat(middleware);
var withArgs = (hook) => {
return function useSWRArgs(...args) {
const fallbackConfig = useSWRConfig();
const [key, fn2, _config] = normalize(args);
const config = mergeConfigs(fallbackConfig, _config);
let next = hook;
const { use: use3 } = config;
const middleware2 = (use3 || []).concat(BUILT_IN_MIDDLEWARE);
for (let i4 = middleware2.length; i4--; ) {
next = middleware2[i4](next);
}
return next(key, fn2 || config.fetcher || null, config);
};
};
var subscribeCallback = (key, callbacks, callback) => {
const keyedRevalidators = callbacks[key] || (callbacks[key] = []);
keyedRevalidators.push(callback);
return () => {
const index = keyedRevalidators.indexOf(callback);
if (index >= 0) {
keyedRevalidators[index] = keyedRevalidators[keyedRevalidators.length - 1];
keyedRevalidators.pop();
}
};
};
setupDevTools();
// ../../node_modules/.pnpm/swr@2.2.2_react@18.2.0/node_modules/swr/core/dist/index.mjs
var use2 = bn.use || ((promise) => {
if (promise.status === "pending") {
throw promise;
} else if (promise.status === "fulfilled") {
return promise.value;
} else if (promise.status === "rejected") {
throw promise.reason;
} else {
promise.status = "pending";
promise.then((v3) => {
promise.status = "fulfilled";
promise.value = v3;
}, (e4) => {
promise.status = "rejected";
promise.reason = e4;
});
throw promise;
}
});
var WITH_DEDUPE = {
dedupe: true
};
var useSWRHandler = (_key, fetcher, config) => {
const { cache: cache2, compare: compare2, suspense, fallbackData, revalidateOnMount, revalidateIfStale, refreshInterval, refreshWhenHidden, refreshWhenOffline, keepPreviousData } = config;
const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2);
const [key, fnArg] = serialize(_key);
const initialMountedRef = _2(false);
const unmountedRef = _2(false);
const keyRef = _2(key);
const fetcherRef = _2(fetcher);
const configRef = _2(config);
const getConfig = () => configRef.current;
const isActive = () => getConfig().isVisible() && getConfig().isOnline();
const [getCache, setCache, subscribeCache, getInitialCache] = createCacheHelper(cache2, key);
const stateDependencies = _2({}).current;
const fallback = isUndefined(fallbackData) ? config.fallback[key] : fallbackData;
const isEqual = (prev, current) => {
for (const _3 in stateDependencies) {
const t4 = _3;
if (t4 === "data") {
if (!compare2(prev[t4], current[t4])) {
if (!isUndefined(prev[t4])) {
return false;
}
if (!compare2(returnedData, current[t4])) {
return false;
}
}
} else {
if (current[t4] !== prev[t4]) {
return false;
}
}
}
return true;
};
const getSnapshot = F(() => {
const shouldStartRequest = (() => {
if (!key)
return false;
if (!fetcher)
return false;
if (!isUndefined(revalidateOnMount))
return revalidateOnMount;
if (getConfig().isPaused())
return false;
if (suspense)
return false;
if (!isUndefined(revalidateIfStale))
return revalidateIfStale;
return true;
})();
const getSelectedCache = (state) => {
const snapshot = mergeObjects(state);
delete snapshot._k;
if (!shouldStartRequest) {
return snapshot;
}
return __spreadValues({
isValidating: true,
isLoading: true
}, snapshot);
};
const cachedData2 = getCache();
const initialData = getInitialCache();
const clientSnapshot = getSelectedCache(cachedData2);
const serverSnapshot = cachedData2 === initialData ? clientSnapshot : getSelectedCache(initialData);
let memorizedSnapshot = clientSnapshot;
return [
() => {
const newSnapshot = getSelectedCache(getCache());
const compareResult = isEqual(newSnapshot, memorizedSnapshot);
if (compareResult) {
memorizedSnapshot.data = newSnapshot.data;
memorizedSnapshot.isLoading = newSnapshot.isLoading;
memorizedSnapshot.isValidating = newSnapshot.isValidating;
memorizedSnapshot.error = newSnapshot.error;
return memorizedSnapshot;
} else {
memorizedSnapshot = newSnapshot;
return newSnapshot;
}
},
() => serverSnapshot
];
}, [
cache2,
key
]);
const cached = (0, import_shim.useSyncExternalStore)(T2(
(callback) => subscribeCache(key, (current, prev) => {
if (!isEqual(prev, current))
callback();
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[
cache2,
key
]
), getSnapshot[0], getSnapshot[1]);
const isInitialMount = !initialMountedRef.current;
const hasRevalidator = EVENT_REVALIDATORS[key] && EVENT_REVALIDATORS[key].length > 0;
const cachedData = cached.data;
const data = isUndefined(cachedData) ? fallback : cachedData;
const error2 = cached.error;
const laggyDataRef = _2(data);
const returnedData = keepPreviousData ? isUndefined(cachedData) ? laggyDataRef.current : cachedData : data;
const shouldDoInitialRevalidation = (() => {
if (hasRevalidator && !isUndefined(error2))
return false;
if (isInitialMount && !isUndefined(revalidateOnMount))
return revalidateOnMount;
if (getConfig().isPaused())
return false;
if (suspense)
return isUndefined(data) ? false : revalidateIfStale;
return isUndefined(data) || revalidateIfStale;
})();
const defaultValidatingState = !!(key && fetcher && isInitialMount && shouldDoInitialRevalidation);
const isValidating = isUndefined(cached.isValidating) ? defaultValidatingState : cached.isValidating;
const isLoading = isUndefined(cached.isLoading) ? defaultValidatingState : cached.isLoading;
const revalidate = T2(
(revalidateOpts) => __async(void 0, null, function* () {
const currentFetcher = fetcherRef.current;
if (!key || !currentFetcher || unmountedRef.current || getConfig().isPaused()) {
return false;
}
let newData;
let startAt;
let loading = true;
const opts = revalidateOpts || {};
const shouldStartNewRequest = !FETCH[key] || !opts.dedupe;
const callbackSafeguard = () => {
if (IS_REACT_LEGACY) {
return !unmountedRef.current && key === keyRef.current && initialMountedRef.current;
}
return key === keyRef.current;
};
const finalState = {
isValidating: false,
isLoading: false
};
const finishRequestAndUpdateState = () => {
setCache(finalState);
};
const cleanupState = () => {
const requestInfo = FETCH[key];
if (requestInfo && requestInfo[1] === startAt) {
delete FETCH[key];
}
};
const initialState = {
isValidating: true
};
if (isUndefined(getCache().data)) {
initialState.isLoading = true;
}
try {
if (shouldStartNewRequest) {
setCache(initialState);
if (config.loadingTimeout && isUndefined(getCache().data)) {
setTimeout(() => {
if (loading && callbackSafeguard()) {
getConfig().onLoadingSlow(key, config);
}
}, config.loadingTimeout);
}
FETCH[key] = [
currentFetcher(fnArg),
getTimestamp()
];
}
[newData, startAt] = FETCH[key];
newData = yield newData;
if (shouldStartNewRequest) {
setTimeout(cleanupState, config.dedupingInterval);
}
if (!FETCH[key] || FETCH[key][1] !== startAt) {
if (shouldStartNewRequest) {
if (callbackSafeguard()) {
getConfig().onDiscarded(key);
}
}
return false;
}
finalState.error = UNDEFINED;
const mutationInfo = MUTATION[key];
if (!isUndefined(mutationInfo) && // case 1
(startAt <= mutationInfo[0] || // case 2
startAt <= mutationInfo[1] || // case 3
mutationInfo[1] === 0)) {
finishRequestAndUpdateState();
if (shouldStartNewRequest) {
if (callbackSafeguard()) {
getConfig().onDiscarded(key);
}
}
return false;
}
const cacheData = getCache().data;
finalState.data = compare2(cacheData, newData) ? cacheData : newData;
if (shouldStartNewRequest) {
if (callbackSafeguard()) {
getConfig().onSuccess(newData, key, config);
}
}
} catch (err) {
cleanupState();
const currentConfig = getConfig();
const { shouldRetryOnError } = currentConfig;
if (!currentConfig.isPaused()) {
finalState.error = err;
if (shouldStartNewRequest && callbackSafeguard()) {
currentConfig.onError(err, key, currentConfig);
if (shouldRetryOnError === true || isFunction(shouldRetryOnError) && shouldRetryOnError(err)) {
if (isActive()) {
currentConfig.onErrorRetry(err, key, currentConfig, (_opts) => {
const revalidators = EVENT_REVALIDATORS[key];
if (revalidators && revalidators[0]) {
revalidators[0](events.ERROR_REVALIDATE_EVENT, _opts);
}
}, {
retryCount: (opts.retryCount || 0) + 1,
dedupe: true
});
}
}
}
}
}
loading = false;
finishRequestAndUpdateState();
return true;
}),
// `setState` is immutable, and `eventsCallback`, `fnArg`, and
// `keyValidating` are depending on `key`, so we can exclude them from
// the deps array.
//
// FIXME:
// `fn` and `config` might be changed during the lifecycle,
// but they might be changed every render like this.
// `useSWR('key', () => fetch('/api/'), { suspense: true })`
// So we omit the values from the deps array
// even though it might cause unexpected behaviors.
// eslint-disable-next-line react-hooks/exhaustive-deps
[
key,
cache2
]
);
const boundMutate = T2(
// Use callback to make sure `keyRef.current` returns latest result every time
(...args) => {
return internalMutate(cache2, keyRef.current, ...args);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[]
);
useIsomorphicLayoutEffect(() => {
fetcherRef.current = fetcher;
configRef.current = config;
if (!isUndefined(cachedData)) {
laggyDataRef.current = cachedData;
}
});
useIsomorphicLayoutEffect(() => {
if (!key)
return;
const softRevalidate = revalidate.bind(UNDEFINED, WITH_DEDUPE);
let nextFocusRevalidatedAt = 0;
const onRevalidate = (type, opts = {}) => {
if (type == events.FOCUS_EVENT) {
const now2 = Date.now();
if (getConfig().revalidateOnFocus && now2 > nextFocusRevalidatedAt && isActive()) {
nextFocusRevalidatedAt = now2 + getConfig().focusThrottleInterval;
softRevalidate();
}
} else if (type == events.RECONNECT_EVENT) {
if (getConfig().revalidateOnReconnect && isActive()) {
softRevalidate();
}
} else if (type == events.MUTATE_EVENT) {
return revalidate();
} else if (type == events.ERROR_REVALIDATE_EVENT) {
return revalidate(opts);
}
return;
};
const unsubEvents = subscribeCallback(key, EVENT_REVALIDATORS, onRevalidate);
unmountedRef.current = false;
keyRef.current = key;
initialMountedRef.current = true;
setCache({
_k: fnArg
});
if (shouldDoInitialRevalidation) {
if (isUndefined(data) || IS_SERVER) {
softRevalidate();
} else {
rAF(softRevalidate);
}
}
return () => {
unmountedRef.current = true;
unsubEvents();
};
}, [
key
]);
useIsomorphicLayoutEffect(() => {
let timer;
function next() {
const interval = isFunction(refreshInterval) ? refreshInterval(getCache().data) : refreshInterval;
if (interval && timer !== -1) {
timer = setTimeout(execute, interval);
}
}
function execute() {
if (!getCache().error && (refreshWhenHidden || getConfig().isVisible()) && (refreshWhenOffline || getConfig().isOnline())) {
revalidate(WITH_DEDUPE).then(next);
} else {
next();
}
}
next();
return () => {
if (timer) {
clearTimeout(timer);
timer = -1;
}
};
}, [
refreshInterval,
refreshWhenHidden,
refreshWhenOffline,
key
]);
x3(returnedData);
if (suspense && isUndefined(data) && key) {
if (!IS_REACT_LEGACY && IS_SERVER) {
throw new Error("Fallback data is required when using suspense in SSR.");
}
fetcherRef.current = fetcher;
configRef.current = config;
unmountedRef.current = false;
const req = PRELOAD[key];
if (!isUndefined(req)) {
const promise = boundMutate(req);
use2(promise);
}
if (isUndefined(error2)) {
const promise = revalidate(WITH_DEDUPE);
if (!isUndefined(returnedData)) {
promise.status = "fulfilled";
promise.value = true;
}
use2(promise);
} else {
throw error2;
}
}
return {
mutate: boundMutate,
get data() {
stateDependencies.data = true;
return returnedData;
},
get error() {
stateDependencies.error = true;
return error2;
},
get isValidating() {
stateDependencies.isValidating = true;
return isValidating;
},
get isLoading() {
stateDependencies.isLoading = true;
return isLoading;
}
};
};
var SWRConfig2 = OBJECT.defineProperty(SWRConfig, "defaultValue", {
value: defaultConfig
});
var useSWR = withArgs(useSWRHandler);
// src/context/instance.ts
init_preact_module();
init_hooks_module();
var Context3 = B({});
var InstanceContextProvider = Context3.Provider;
var useInstanceContext = () => q2(Context3);
// src/hooks/backend.ts
function useMatchMutate() {
const { cache: cache2, mutate: mutate2 } = useSWRConfig();
if (!(cache2 instanceof Map)) {
throw new Error(
"matchMutate requires the cache provider to be a Map instance"
);
}
return function matchRegexMutate(re) {
return mutate2((key) => {
if (!key || !re)
return true;
if (typeof key === "string" && re.test(key))
return true;
if (typeof key === "object" && re.test(key[0]))
return true;
return false;
}, void 0, {
revalidate: true
});
};
}
function useBackendInstancesTestForAdmin() {
const { request } = useBackendBaseRequest();
const [result, setResult] = p3({ loading: true });
h2(() => {
request(`/management/instances`).then((data) => setResult(data)).catch(
(error2) => setResult(error2.cause)
);
}, [request]);
return result;
}
var CHECK_CONFIG_INTERVAL_OK = 5 * 60 * 1e3;
var CHECK_CONFIG_INTERVAL_FAIL = 2 * 1e3;
function useBackendConfig() {
const { request } = useBackendBaseRequest();
const [result, setResult] = p3({ data: { loading: true }, timer: 0 });
h2(() => {
if (result.timer) {
clearTimeout(result.timer);
}
function tryConfig() {
request(`/config`).then((data) => {
const timer = setTimeout(() => {
tryConfig();
}, CHECK_CONFIG_INTERVAL_OK);
setResult({ data, timer });
}).catch((error2) => {
const timer = setTimeout(() => {
tryConfig();
}, CHECK_CONFIG_INTERVAL_FAIL);
const data = error2.cause;
setResult({ data, timer });
});
}
tryConfig();
}, [request]);
return result.data;
}
function useCredentialsChecker() {
const { request } = useApiContext();
function requestNewLoginToken(baseUrl, token) {
return __async(this, null, function* () {
const data = {
scope: "write",
duration: {
d_us: "forever"
},
refreshable: true
};
try {
const response = yield request(baseUrl, `/private/token`, {
method: "POST",
token,
data
});
return { valid: true, token: response.data.token, expiration: response.data.expiration };
} catch (error2) {
if (error2 instanceof RequestError) {
return { valid: false, cause: error2.cause };
}
return {
valid: false,
cause: {
type: ErrorType.UNEXPECTED,
loading: false,
info: {
hasToken: true,
status: 0,
options: {},
url: `/private/token`,
payload: {}
},
exception: error2,
message: error2 instanceof Error ? error2.message : "unpexepected error"
}
};
}
});
}
;
function refreshLoginToken(baseUrl, token) {
return __async(this, null, function* () {
if (AbsoluteTime.isExpired(AbsoluteTime.fromProtocolTimestamp(token.expiration))) {
return {
valid: false,
cause: {
type: ErrorType.CLIENT,
status: HttpStatusCode.Unauthorized,
message: "login token expired, login again.",
info: {
hasToken: true,
status: 401,
options: {},
url: `/private/token`,
payload: {}
},
payload: {}
}
};
}
return requestNewLoginToken(baseUrl, token.token);
});
}
return { requestNewLoginToken, refreshLoginToken };
}
function useBackendBaseRequest() {
const { url: backend, token: loginToken } = useBackendContext();
const { request: requestHandler } = useApiContext();
const token = loginToken == null ? void 0 : loginToken.token;
const request = T2(
function requestImpl(endpoint, options = {}) {
return requestHandler(backend, endpoint, __spreadProps(__spreadValues({}, options), { token })).then((res) => {
return res;
}).catch((err) => {
throw err;
});
},
[backend, token]
);
return { request };
}
function useBackendInstanceRequest() {
const { url: rootBackendUrl, token: rootToken } = useBackendContext();
const { token: instanceToken, id, admin } = useInstanceContext();
const { request: requestHandler } = useApiContext();
const { baseUrl, token: loginToken } = !admin ? { baseUrl: rootBackendUrl, token: rootToken } : { baseUrl: `${rootBackendUrl}/instances/${id}`, token: instanceToken };
const token = loginToken == null ? void 0 : loginToken.token;
const request = T2(
function requestImpl(endpoint, options = {}) {
return requestHandler(baseUrl, endpoint, __spreadValues({ token }, options));
},
[baseUrl, token]
);
const multiFetcher = T2(
function multiFetcherImpl(args) {
const [endpoints] = args;
return Promise.all(
endpoints.map(
(endpoint) => requestHandler(baseUrl, endpoint, { token })
)
);
},
[baseUrl, token]
);
const fetcher = T2(
function fetcherImpl(endpoint) {
return requestHandler(baseUrl, endpoint, { token });
},
[baseUrl, token]
);
const orderFetcher = T2(
function orderFetcherImpl(args) {
const [endpoint, paid, refunded, wired, searchDate, delta] = args;
const date_s = delta && delta < 0 && searchDate ? searchDate.getTime() / 1e3 + 1 : searchDate !== void 0 ? searchDate.getTime() / 1e3 : void 0;
const params = {};
if (paid !== void 0)
params.paid = paid;
if (delta !== void 0)
params.delta = delta;
if (refunded !== void 0)
params.refunded = refunded;
if (wired !== void 0)
params.wired = wired;
if (date_s !== void 0)
params.date_s = date_s;
return requestHandler(baseUrl, endpoint, { params, token });
},
[baseUrl, token]
);
const reserveDetailFetcher = T2(
function reserveDetailFetcherImpl(endpoint) {
return requestHandler(baseUrl, endpoint, {
params: {
rewards: "yes"
},
token
});
},
[baseUrl, token]
);
const rewardsDetailFetcher = T2(
function rewardsDetailFetcherImpl(endpoint) {
return requestHandler(baseUrl, endpoint, {
params: {
pickups: "yes"
},
token
});
},
[baseUrl, token]
);
const transferFetcher = T2(
function transferFetcherImpl(args) {
const [endpoint, payto_uri, verified, position, delta] = args;
const params = {};
if (payto_uri !== void 0)
params.payto_uri = payto_uri;
if (verified !== void 0)
params.verified = verified;
if (delta !== void 0) {
params.limit = delta;
}
if (position !== void 0)
params.offset = position;
return requestHandler(baseUrl, endpoint, { params, token });
},
[baseUrl, token]
);
const templateFetcher = T2(
function templateFetcherImpl(args) {
const [endpoint, position, delta] = args;
const params = {};
if (delta !== void 0) {
params.limit = delta;
}
if (position !== void 0)
params.offset = position;
return requestHandler(baseUrl, endpoint, { params, token });
},
[baseUrl, token]
);
const webhookFetcher = T2(
function webhookFetcherImpl(args) {
const [endpoint, position, delta] = args;
const params = {};
if (delta !== void 0) {
params.limit = delta;
}
if (position !== void 0)
params.offset = position;
return requestHandler(baseUrl, endpoint, { params, token });
},
[baseUrl, token]
);
return {
request,
fetcher,
multiFetcher,
orderFetcher,
reserveDetailFetcher,
rewardsDetailFetcher,
transferFetcher,
templateFetcher,
webhookFetcher
};
}
// src/hooks/index.ts
var calculateRootPath = () => {
const rootPath = typeof window !== void 0 ? window.location.origin + window.location.pathname : "/";
return rootPath;
};
var loginTokenCodec = buildCodecForObject().property("token", codecForString()).property("expiration", codecForTimestamp).build("loginToken");
var TOKENS_KEY = buildStorageKey("backend-token", codecForMap(loginTokenCodec));
function useBackendURL(url) {
const [value, setter] = useSimpleLocalStorage(
"backend-url",
url || calculateRootPath()
);
const checkedSetter = (v3) => {
return setter((p4) => (v3 instanceof Function ? v3(p4 != null ? p4 : "") : v3).replace(/\/$/, ""));
};
return [value, checkedSetter];
}
function useBackendDefaultToken() {
const { update: setToken, value: tokenMap, reset } = useLocalStorage(TOKENS_KEY, {});
const tokenOfDefaultInstance = tokenMap["default"];
const clearCache = useMatchMutate();
h2(() => {
clearCache();
}, [tokenOfDefaultInstance]);
function updateToken(value) {
if (value === void 0) {
reset();
} else {
const res = __spreadProps(__spreadValues({}, tokenMap), { "default": value });
setToken(res);
}
}
return [tokenMap["default"], updateToken];
}
function useBackendInstanceToken(id) {
const { update: setToken, value: tokenMap, reset } = useLocalStorage(TOKENS_KEY, {});
const [defaultToken, defaultSetToken] = useBackendDefaultToken();
if (id === "default") {
return [defaultToken, defaultSetToken];
}
function updateToken(value) {
if (value === void 0) {
reset();
} else {
const res = __spreadProps(__spreadValues({}, tokenMap), { [id]: value });
setToken(res);
}
}
return [tokenMap[id], updateToken];
}
function useSimpleLocalStorage(key, initialValue) {
const [storedValue, setStoredValue] = p3(
() => {
return typeof window !== "undefined" ? window.localStorage.getItem(key) || initialValue : initialValue;
}
);
const setValue = (value) => {
setStoredValue((p4) => {
const toStore = value instanceof Function ? value(p4) : value;
if (typeof window !== "undefined") {
if (!toStore) {
window.localStorage.removeItem(key);
} else {
window.localStorage.setItem(key, toStore);
}
}
return toStore;
});
};
return [storedValue, setValue];
}
// src/context/backend.ts
var BackendContext = B({
url: "",
token: void 0,
updateToken: () => null,
changeBackend: () => null
});
function useBackendContextState(defaultUrl) {
const [url, changeBackend] = useBackendURL(defaultUrl);
const [token, updateToken] = useBackendDefaultToken();
return {
url,
token,
updateToken,
changeBackend
};
}
var BackendContextProvider = ({
children,
defaultUrl
}) => {
const value = useBackendContextState(defaultUrl);
return h(BackendContext.Provider, { value, children });
};
var useBackendContext = () => q2(BackendContext);
// src/hooks/instance.ts
var useSWR2 = useSWR;
function useAdminAPI() {
const { request } = useBackendBaseRequest();
const mutateAll = useMatchMutate();
const createInstance = (instance) => __async(this, null, function* () {
yield request(`/management/instances`, {
method: "POST",
data: instance
});
mutateAll(/\/management\/instances/);
});
const deleteInstance = (id) => __async(this, null, function* () {
yield request(`/management/instances/${id}`, {
method: "DELETE"
});
mutateAll(/\/management\/instances/);
});
const purgeInstance = (id) => __async(this, null, function* () {
yield request(`/management/instances/${id}`, {
method: "DELETE",
params: {
purge: "YES"
}
});
mutateAll(/\/management\/instances/);
});
return { createInstance, deleteInstance, purgeInstance };
}
function useManagementAPI(instanceId) {
const mutateAll = useMatchMutate();
const { url: backendURL } = useBackendContext();
const { updateToken } = useBackendContext();
const { request } = useBackendBaseRequest();
const { requestNewLoginToken } = useCredentialsChecker();
const updateInstance = (instance) => __async(this, null, function* () {
yield request(`/management/instances/${instanceId}`, {
method: "PATCH",
data: instance
});
mutateAll(/\/management\/instances/);
});
const deleteInstance = () => __async(this, null, function* () {
yield request(`/management/instances/${instanceId}`, {
method: "DELETE"
});
mutateAll(/\/management\/instances/);
});
const clearAccessToken = (currentToken) => __async(this, null, function* () {
yield request(`/management/instances/${instanceId}/auth`, {
method: "POST",
token: currentToken,
data: { method: "external" }
});
mutateAll(/\/management\/instances/);
});
const setNewAccessToken = (currentToken, newToken) => __async(this, null, function* () {
yield request(`/management/instances/${instanceId}/auth`, {
method: "POST",
token: currentToken,
data: { method: "token", token: newToken }
});
const resp = yield requestNewLoginToken(backendURL, newToken);
if (resp.valid) {
const { token, expiration } = resp;
updateToken({ token, expiration });
} else {
updateToken(void 0);
}
mutateAll(/\/management\/instances/);
});
return { updateInstance, deleteInstance, setNewAccessToken, clearAccessToken };
}
function useInstanceAPI() {
const { mutate: mutate2 } = useSWRConfig();
const { url: backendURL, updateToken } = useBackendContext();
const {
token: adminToken
} = useBackendContext();
const { request } = useBackendInstanceRequest();
const { requestNewLoginToken } = useCredentialsChecker();
const updateInstance = (instance) => __async(this, null, function* () {
yield request(`/private/`, {
method: "PATCH",
data: instance
});
if (adminToken)
mutate2(["/private/instances", adminToken, backendURL], null);
mutate2([`/private/`], null);
});
const deleteInstance = () => __async(this, null, function* () {
yield request(`/private/`, {
method: "DELETE"
// token: adminToken,
});
if (adminToken)
mutate2(["/private/instances", adminToken, backendURL], null);
mutate2([`/private/`], null);
});
const clearAccessToken = (currentToken) => __async(this, null, function* () {
yield request(`/private/auth`, {
method: "POST",
token: currentToken,
data: { method: "external" }
});
mutate2([`/private/`], null);
});
const setNewAccessToken = (currentToken, newToken) => __async(this, null, function* () {
yield request(`/private/auth`, {
method: "POST",
token: currentToken,
data: { method: "token", token: newToken }
});
const resp = yield requestNewLoginToken(backendURL, newToken);
if (resp.valid) {
const { token, expiration } = resp;
updateToken({ token, expiration });
} else {
updateToken(void 0);
}
mutate2([`/private/`], null);
});
return { updateInstance, deleteInstance, setNewAccessToken, clearAccessToken };
}
function useInstanceDetails() {
const { fetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR2([`/private/`], fetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false,
revalidateIfStale: false,
errorRetryCount: 0,
errorRetryInterval: 1,
shouldRetryOnError: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data)
return data;
if (error2)
return error2.cause;
return { loading: true };
}
function useInstanceKYCDetails() {
var _a;
const { fetcher } = useBackendInstanceRequest();
const { data, error: error2 } = useSWR2([`/private/kyc`], fetcher, {
refreshInterval: 60 * 1e3,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateIfStale: false,
revalidateOnMount: false,
revalidateOnReconnect: false,
refreshWhenOffline: false,
errorRetryCount: 0,
errorRetryInterval: 1,
shouldRetryOnError: false
});
if (data) {
if (((_a = data.info) == null ? void 0 : _a.status) === 202)
return { ok: true, data: { type: "redirect", status: data.data } };
return { ok: true, data: { type: "ok" } };
}
if (error2)
return error2.cause;
return { loading: true };
}
function useManagedInstanceDetails(instanceId) {
const { request } = useBackendBaseRequest();
const { data, error: error2, isValidating } = useSWR2([`/management/instances/${instanceId}`], request, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false,
errorRetryCount: 0,
errorRetryInterval: 1,
shouldRetryOnError: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data)
return data;
if (error2)
return error2.cause;
return { loading: true };
}
function useBackendInstances() {
const { request } = useBackendBaseRequest();
const { data, error: error2, isValidating } = useSWR2(["/management/instances"], request);
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data)
return data;
if (error2)
return error2.cause;
return { loading: true };
}
// src/paths/admin/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
// src/components/exception/AsyncButton.tsx
init_preact_module();
// src/components/modal/index.tsx
init_preact_module();
init_hooks_module();
// src/utils/constants.ts
var PAYTO_REGEX = /^payto:\/\/[a-zA-Z][a-zA-Z0-9-.]+(\/[a-zA-Z0-9\-\.\~\(\)@_%:!$&'*+,;=]*)*\??((amount|receiver-name|sender-name|instruction|message)=[a-zA-Z0-9\-\.\~\(\)@_%:!$'*+,;=]*&?)*$/;
var PAYTO_WIRE_METHOD_LOOKUP = /payto:\/\/([a-zA-Z][a-zA-Z0-9-.]+)\/.*/;
var AMOUNT_REGEX = /^[a-zA-Z][a-zA-Z]*:[0-9][0-9,]*\.?[0-9,]*$/;
var INSTANCE_ID_LOOKUP = /\/instances\/([^/]*)\/?$/;
var CROCKFORD_BASE32_REGEX = /^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]+[*~$=U]*$/;
var URL_REGEX = /^((https?:)(\/\/\/?)([\w]*(?::[\w]*)?@)?([\d\w\.-]+)(?::(\d+))?)\/$/;
var PAGE_SIZE = 20;
var MAX_RESULT_SIZE = PAGE_SIZE * 2 - 1;
var DEFAULT_REQUEST_TIMEOUT = 10;
var MAX_IMAGE_SIZE = 1024 * 1024;
var INSTANCE_ID_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9_.@-]+$/;
var COUNTRY_TABLE = {
AE: "U.A.E.",
AF: "Afghanistan",
AL: "Albania",
AM: "Armenia",
AN: "Netherlands Antilles",
AR: "Argentina",
AT: "Austria",
AU: "Australia",
AZ: "Azerbaijan",
BA: "Bosnia and Herzegovina",
BD: "Bangladesh",
BE: "Belgium",
BG: "Bulgaria",
BH: "Bahrain",
BN: "Brunei Darussalam",
BO: "Bolivia",
BR: "Brazil",
BT: "Bhutan",
BY: "Belarus",
BZ: "Belize",
CA: "Canada",
CG: "Congo",
CH: "Switzerland",
CI: "Cote d'Ivoire",
CL: "Chile",
CM: "Cameroon",
CN: "People's Republic of China",
CO: "Colombia",
CR: "Costa Rica",
CS: "Serbia and Montenegro",
CZ: "Czech Republic",
DE: "Germany",
DK: "Denmark",
DO: "Dominican Republic",
DZ: "Algeria",
EC: "Ecuador",
EE: "Estonia",
EG: "Egypt",
ER: "Eritrea",
ES: "Spain",
ET: "Ethiopia",
FI: "Finland",
FO: "Faroe Islands",
FR: "France",
GB: "United Kingdom",
GD: "Caribbean",
GE: "Georgia",
GL: "Greenland",
GR: "Greece",
GT: "Guatemala",
HK: "Hong Kong",
// HK: "Hong Kong S.A.R.",
HN: "Honduras",
HR: "Croatia",
HT: "Haiti",
HU: "Hungary",
ID: "Indonesia",
IE: "Ireland",
IL: "Israel",
IN: "India",
IQ: "Iraq",
IR: "Iran",
IS: "Iceland",
IT: "Italy",
JM: "Jamaica",
JO: "Jordan",
JP: "Japan",
KE: "Kenya",
KG: "Kyrgyzstan",
KH: "Cambodia",
KR: "South Korea",
KW: "Kuwait",
KZ: "Kazakhstan",
LA: "Laos",
LB: "Lebanon",
LI: "Liechtenstein",
LK: "Sri Lanka",
LT: "Lithuania",
LU: "Luxembourg",
LV: "Latvia",
LY: "Libya",
MA: "Morocco",
MC: "Principality of Monaco",
MD: "Moldava",
// MD: "Moldova",
ME: "Montenegro",
MK: "Former Yugoslav Republic of Macedonia",
ML: "Mali",
MM: "Myanmar",
MN: "Mongolia",
MO: "Macau S.A.R.",
MT: "Malta",
MV: "Maldives",
MX: "Mexico",
MY: "Malaysia",
NG: "Nigeria",
NI: "Nicaragua",
NL: "Netherlands",
NO: "Norway",
NP: "Nepal",
NZ: "New Zealand",
OM: "Oman",
PA: "Panama",
PE: "Peru",
PH: "Philippines",
PK: "Islamic Republic of Pakistan",
PL: "Poland",
PR: "Puerto Rico",
PT: "Portugal",
PY: "Paraguay",
QA: "Qatar",
RE: "Reunion",
RO: "Romania",
RS: "Serbia",
RU: "Russia",
RW: "Rwanda",
SA: "Saudi Arabia",
SE: "Sweden",
SG: "Singapore",
SI: "Slovenia",
SK: "Slovak",
SN: "Senegal",
SO: "Somalia",
SR: "Suriname",
SV: "El Salvador",
SY: "Syria",
TH: "Thailand",
TJ: "Tajikistan",
TM: "Turkmenistan",
TN: "Tunisia",
TR: "Turkey",
TT: "Trinidad and Tobago",
TW: "Taiwan",
TZ: "Tanzania",
UA: "Ukraine",
US: "United States",
UY: "Uruguay",
VA: "Vatican",
VE: "Venezuela",
VN: "Viet Nam",
YE: "Yemen",
ZA: "South Africa",
ZW: "Zimbabwe"
};
// src/components/form/FormProvider.tsx
init_preact_module();
init_hooks_module();
var noUpdater = () => (s5) => s5;
function FormProvider({
object: object2 = {},
errors: errors2 = {},
name = "",
valueHandler,
children
}) {
const initialObject = F(() => object2, []);
const value = F(
() => ({
errors: errors2,
object: object2,
initialObject,
valueHandler: valueHandler ? valueHandler : noUpdater,
name,
toStr: {},
fromStr: {}
}),
[errors2, object2, valueHandler]
);
return /* @__PURE__ */ h(FormContext.Provider, { value }, /* @__PURE__ */ h(
"form",
{
class: "field",
onSubmit: (e4) => {
e4.preventDefault();
}
},
children
));
}
var FormContext = B(null);
function useFormContext() {
return q2(FormContext);
}
// src/components/form/Input.tsx
init_preact_module();
// src/components/form/useField.tsx
init_hooks_module();
function useField(name) {
const { errors: errors2, object: object2, initialObject, toStr, fromStr, valueHandler } = useFormContext();
const [isDirty, setDirty] = p3(false);
const updateField = (field) => (value2) => {
setDirty(true);
return valueHandler((prev) => {
return setValueDeeper(prev, String(field).split("."), value2);
});
};
const defaultToString4 = (f3) => String(!f3 ? "" : f3);
const defaultFromString4 = (v3) => v3;
const value = readField(object2, String(name));
const initial2 = readField(initialObject, String(name));
const hasError = readField(errors2, String(name));
return {
error: isDirty ? hasError : void 0,
required: !isDirty && hasError,
value,
initial: initial2,
onChange: updateField(name),
toStr: toStr[name] ? toStr[name] : defaultToString4,
fromStr: fromStr[name] ? fromStr[name] : defaultFromString4
};
}
var readField = (object2, name) => {
return name.split(".").reduce((prev, current) => prev && prev[current], object2);
};
var setValueDeeper = (object2, names2, value) => {
if (names2.length === 0)
return value;
const [head, ...rest] = names2;
return __spreadProps(__spreadValues({}, object2), { [head]: setValueDeeper(object2[head] || {}, rest, value) });
};
// src/components/form/Input.tsx
var defaultToString = (f3) => f3 || "";
var defaultFromString = (v3) => v3;
var TextInput = (_a) => {
var _b = _a, { inputType, error: error2 } = _b, rest = __objRest(_b, ["inputType", "error"]);
return inputType === "multiline" ? /* @__PURE__ */ h(
"textarea",
__spreadProps(__spreadValues({}, rest), {
class: error2 ? "textarea is-danger" : "textarea",
rows: "3"
})
) : /* @__PURE__ */ h(
"input",
__spreadProps(__spreadValues({}, rest), {
class: error2 ? "input is-danger" : "input",
type: inputType
})
);
};
function Input({
name,
readonly,
placeholder,
tooltip,
label,
expand,
help,
children,
inputType,
inputExtra,
side,
fromStr = defaultFromString,
toStr = defaultToString
}) {
const { error: error2, value, onChange, required } = useField(name);
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 has-icons-right" : "control has-icons-right"
},
/* @__PURE__ */ h(
TextInput,
__spreadProps(__spreadValues({
error: error2
}, inputExtra), {
inputType,
placeholder,
readonly,
disabled: readonly,
name: String(name),
value: toStr(value),
onChange: (e4) => onChange(fromStr(e4.currentTarget.value))
})
),
help,
children,
required && /* @__PURE__ */ h("span", { class: "icon has-text-danger is-right" }, /* @__PURE__ */ h("i", { class: "mdi mdi-alert" }))
), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2)), side));
}
// src/components/modal/index.tsx
function ConfirmModal({
active,
description,
onCancel,
onConfirm,
children,
danger,
disabled,
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(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 ",
disabled,
onClick: onConfirm
},
/* @__PURE__ */ h(i18n2.Translate, null, label)
)) : /* @__PURE__ */ h("button", { class: "button ", onClick: onCancel }, /* @__PURE__ */ h(i18n2.Translate, null, "Close"))))), /* @__PURE__ */ h(
"button",
{
class: "modal-close is-large ",
"aria-label": "close",
onClick: onCancel
}
));
}
function ContinueModal({
active,
description,
onCancel,
onConfirm,
children,
disabled
}) {
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" }, /* @__PURE__ */ h("header", { class: "modal-card-head has-background-success" }, !description ? null : /* @__PURE__ */ h("p", { class: "modal-card-title" }, 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%" } }, /* @__PURE__ */ h(
"button",
{
class: "button is-success ",
disabled,
onClick: onConfirm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Continue")
)))), /* @__PURE__ */ h(
"button",
{
class: "modal-close is-large ",
"aria-label": "close",
onClick: onCancel
}
));
}
function SimpleModal({ onCancel, children }) {
return /* @__PURE__ */ h("div", { class: "modal is-active" }, /* @__PURE__ */ h("div", { class: "modal-background ", onClick: onCancel }), /* @__PURE__ */ h("div", { class: "modal-card" }, /* @__PURE__ */ h("section", { class: "modal-card-body is-main-section" }, children)), /* @__PURE__ */ h(
"button",
{
class: "modal-close is-large ",
"aria-label": "close",
onClick: onCancel
}
));
}
function DeleteModal({
element,
onCancel,
onConfirm
}) {
return /* @__PURE__ */ h(
ConfirmModal,
{
label: `Delete instance`,
description: `Delete the instance "${element.name}"`,
danger: true,
active: true,
onCancel,
onConfirm: () => onConfirm(element.id)
},
/* @__PURE__ */ h("p", null, "If you delete the instance named ", /* @__PURE__ */ h("b", null, '"', element.name, '"'), " (ID:", " ", /* @__PURE__ */ h("b", null, element.id), "), the merchant will no longer be able to process orders or refunds"),
/* @__PURE__ */ h("p", null, "This action deletes the instance private key, but preserves all transaction data. You can still access that data after deleting the instance."),
/* @__PURE__ */ h("p", { class: "warning" }, "Deleting an instance ", /* @__PURE__ */ h("b", null, "cannot be undone"), ".")
);
}
function PurgeModal({
element,
onCancel,
onConfirm
}) {
return /* @__PURE__ */ h(
ConfirmModal,
{
label: `Purge the instance`,
description: `Purge the instance "${element.name}"`,
danger: true,
active: true,
onCancel,
onConfirm: () => onConfirm(element.id)
},
/* @__PURE__ */ h("p", null, "If you purge the instance named ", /* @__PURE__ */ h("b", null, '"', element.name, '"'), " (ID:", " ", /* @__PURE__ */ h("b", null, element.id), "), you will also delete all it's transaction data."),
/* @__PURE__ */ h("p", null, "The instance will disappear from your list, and you will no longer be able to access it's data."),
/* @__PURE__ */ h("p", { class: "warning" }, "Purging an instance ", /* @__PURE__ */ h("b", null, "cannot be undone"), ".")
);
}
function LoadingModal({ onCancel }) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "modal is-active" }, /* @__PURE__ */ h("div", { class: "modal-background ", onClick: onCancel }), /* @__PURE__ */ h("div", { class: "modal-card" }, /* @__PURE__ */ h("header", { class: "modal-card-head" }, /* @__PURE__ */ h("p", { class: "modal-card-title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Operation in progress..."))), /* @__PURE__ */ h("section", { class: "modal-card-body" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h(Spinner, null), /* @__PURE__ */ h("div", { class: "column" })), /* @__PURE__ */ h("p", null, i18n2.str`The operation will be automatically canceled after ${DEFAULT_REQUEST_TIMEOUT} seconds`)), /* @__PURE__ */ h("footer", { class: "modal-card-foot" }, /* @__PURE__ */ h("div", { class: "buttons is-right", style: { width: "100%" } }, /* @__PURE__ */ h("button", { class: "button ", onClick: onCancel }, /* @__PURE__ */ h(i18n2.Translate, null, "Cancel"))))), /* @__PURE__ */ h(
"button",
{
class: "modal-close is-large ",
"aria-label": "close",
onClick: onCancel
}
));
}
// src/hooks/async.ts
init_hooks_module();
function useAsync(fn2, { slowTolerance: tooLong } = { slowTolerance: 1e3 }) {
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 (!fn2)
return;
setLoading(true);
const handler = setTimeout(() => {
setSlow(true);
}, tooLong);
try {
const result = yield fn2(...args);
setData(result);
} catch (error3) {
setError(error3);
}
setLoading(false);
setSlow(false);
clearTimeout(handler);
});
function cancel() {
setLoading(false);
setSlow(false);
}
return {
request,
cancel,
data,
isSlow,
isLoading,
error: error2
};
}
// src/components/exception/AsyncButton.tsx
function AsyncButton(_a) {
var _b = _a, { onClick, disabled, children } = _b, rest = __objRest(_b, ["onClick", "disabled", "children"]);
const { isSlow, isLoading, request, cancel } = useAsync(onClick);
const { i18n: i18n2 } = useTranslationContext();
if (isSlow) {
return /* @__PURE__ */ h(LoadingModal, { onCancel: cancel });
}
if (isLoading) {
return /* @__PURE__ */ h("button", { class: "button" }, /* @__PURE__ */ h(i18n2.Translate, null, "Loading..."));
}
return /* @__PURE__ */ h("span", __spreadValues({}, rest), /* @__PURE__ */ h("button", { class: "button is-success", onClick: request, disabled }, children));
}
// src/components/instance/DefaultInstanceFormFields.tsx
init_preact_module();
// src/components/form/InputDuration.tsx
init_preact_module();
init_hooks_module();
// src/components/picker/DurationPicker.tsx
init_preact_module();
init_hooks_module();
function DurationPicker({
days,
hours,
minutes,
seconds,
onChange,
value
}) {
const ss = 1e3 * 1e3;
const ms = ss * 60;
const hs = ms * 60;
const ds = hs * 24;
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "rdp-picker" }, days && /* @__PURE__ */ h(
DurationColumn,
{
unit: i18n2.str`days`,
max: 99,
value: Math.floor(value / ds),
onDecrease: value >= ds ? () => onChange(value - ds) : void 0,
onIncrease: value < 99 * ds ? () => onChange(value + ds) : void 0,
onChange: (diff) => onChange(value + diff * ds)
}
), hours && /* @__PURE__ */ h(
DurationColumn,
{
unit: i18n2.str`hours`,
max: 23,
min: 1,
value: Math.floor(value / hs) % 24,
onDecrease: value >= hs ? () => onChange(value - hs) : void 0,
onIncrease: value < 99 * ds ? () => onChange(value + hs) : void 0,
onChange: (diff) => onChange(value + diff * hs)
}
), minutes && /* @__PURE__ */ h(
DurationColumn,
{
unit: i18n2.str`minutes`,
max: 59,
min: 1,
value: Math.floor(value / ms) % 60,
onDecrease: value >= ms ? () => onChange(value - ms) : void 0,
onIncrease: value < 99 * ds ? () => onChange(value + ms) : void 0,
onChange: (diff) => onChange(value + diff * ms)
}
), seconds && /* @__PURE__ */ h(
DurationColumn,
{
unit: i18n2.str`seconds`,
max: 59,
value: Math.floor(value / ss) % 60,
onDecrease: value >= ss ? () => onChange(value - ss) : void 0,
onIncrease: value < 99 * ds ? () => onChange(value + ss) : void 0,
onChange: (diff) => onChange(value + diff * ss)
}
));
}
function InputNumber({
initial: initial2,
onChange
}) {
const [value, handler] = p3({
v: toTwoDigitString(initial2)
});
return /* @__PURE__ */ h(
"input",
{
value: value.v,
onBlur: (e4) => onChange(parseInt(value.v, 10)),
onInput: (e4) => {
e4.preventDefault();
const n2 = Number.parseInt(e4.currentTarget.value, 10);
if (isNaN(n2))
return handler({ v: toTwoDigitString(initial2) });
return handler({ v: toTwoDigitString(n2) });
},
style: {
width: 50,
border: "none",
fontSize: "inherit",
background: "inherit"
}
}
);
}
function DurationColumn({
unit,
min = 0,
max,
value,
onIncrease,
onDecrease,
onChange
}) {
const cellHeight = 35;
return /* @__PURE__ */ h("div", { class: "rdp-column-container" }, /* @__PURE__ */ h("div", { class: "rdp-masked-div" }, /* @__PURE__ */ h("hr", { class: "rdp-reticule", style: { top: cellHeight * 2 - 1 } }), /* @__PURE__ */ h("hr", { class: "rdp-reticule", style: { top: cellHeight * 3 - 1 } }), /* @__PURE__ */ h("div", { class: "rdp-column", style: { top: 0 } }, /* @__PURE__ */ h("div", { class: "rdp-cell", key: value - 2 }, onDecrease && /* @__PURE__ */ h(
"button",
{
style: { width: "100%", textAlign: "center", margin: 5 },
onClick: onDecrease
},
/* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-chevron-up" }))
)), /* @__PURE__ */ h("div", { class: "rdp-cell", key: value - 1 }, value > min ? toTwoDigitString(value - 1) : ""), /* @__PURE__ */ h("div", { class: "rdp-cell rdp-center", key: value }, onChange ? /* @__PURE__ */ h(
InputNumber,
{
initial: value,
onChange: (n2) => onChange(n2 - value)
}
) : toTwoDigitString(value), /* @__PURE__ */ h("div", null, unit)), /* @__PURE__ */ h("div", { class: "rdp-cell", key: value + 1 }, value < max ? toTwoDigitString(value + 1) : ""), /* @__PURE__ */ h("div", { class: "rdp-cell", key: value + 2 }, onIncrease && /* @__PURE__ */ h(
"button",
{
style: { width: "100%", textAlign: "center", margin: 5 },
onClick: onIncrease
},
/* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-chevron-down" }))
)))));
}
function toTwoDigitString(n2) {
if (n2 < 10) {
return `0${n2}`;
}
return `${n2}`;
}
// src/components/form/InputDuration.tsx
function InputDuration({
name,
expand,
placeholder,
tooltip,
label,
help,
readonly,
withForever
}) {
const [opened, setOpened] = p3(false);
const { i18n: i18n2 } = useTranslationContext();
const { error: error2, required, value, onChange } = useField(name);
let strValue = "";
if (!value) {
strValue = "";
} else if (value.d_us === "forever") {
strValue = i18n2.str`forever`;
} else {
strValue = formatDuration(
intervalToDuration({ start: 0, end: value.d_us / 1e3 }),
{
locale: {
formatDistance: (name2, value2) => {
switch (name2) {
case "xMonths":
return i18n2.str`${value2}M`;
case "xYears":
return i18n2.str`${value2}Y`;
case "xDays":
return i18n2.str`${value2}d`;
case "xHours":
return i18n2.str`${value2}h`;
case "xMinutes":
return i18n2.str`${value2}min`;
case "xSeconds":
return i18n2.str`${value2}sec`;
}
},
localize: {
day: () => "s",
month: () => "m",
ordinalNumber: () => "th",
dayPeriod: () => "p",
quarter: () => "w",
era: () => "e"
}
}
}
);
}
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", "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("div", { class: "field has-addons" }, /* @__PURE__ */ h("p", { class: expand ? "control is-expanded " : "control " }, /* @__PURE__ */ h(
"input",
{
class: "input",
type: "text",
readonly: true,
value: strValue,
placeholder,
onClick: () => {
if (!readonly)
setOpened(true);
}
}
), required && /* @__PURE__ */ h("span", { class: "icon has-text-danger is-right" }, /* @__PURE__ */ h("i", { class: "mdi mdi-alert" })), help), /* @__PURE__ */ h(
"div",
{
class: "control",
onClick: () => {
if (!readonly)
setOpened(true);
}
},
/* @__PURE__ */ h("a", { class: "button is-static" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-clock" })))
)), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2)), withForever && /* @__PURE__ */ h("span", { "data-tooltip": i18n2.str`change value to never` }, /* @__PURE__ */ h(
"button",
{
class: "button is-info mr-3",
onClick: () => onChange({ d_us: "forever" })
},
/* @__PURE__ */ h(i18n2.Translate, null, "forever")
)), !readonly && /* @__PURE__ */ h("span", { "data-tooltip": i18n2.str`change value to empty` }, /* @__PURE__ */ h(
"button",
{
class: "button is-info ",
onClick: () => onChange(void 0)
},
/* @__PURE__ */ h(i18n2.Translate, null, "clear")
))), opened && /* @__PURE__ */ h(SimpleModal, { onCancel: () => setOpened(false) }, /* @__PURE__ */ h(
DurationPicker,
{
days: true,
hours: true,
minutes: true,
value: !value || value.d_us === "forever" ? 0 : value.d_us,
onChange: (v3) => {
onChange({ d_us: v3 });
}
}
)));
}
// src/components/form/InputGroup.tsx
init_preact_module();
init_hooks_module();
// src/components/form/useGroupField.tsx
function useGroupField(name) {
const f3 = useFormContext();
if (!f3)
return {};
return {
hasError: readField2(f3.errors, String(name))
};
}
var readField2 = (object2, name) => {
return name.split(".").reduce((prev, current) => prev && prev[current], object2);
};
// src/components/form/InputGroup.tsx
function InputGroup({
name,
label,
children,
tooltip,
alternative,
fixed,
initialActive
}) {
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",
{
class: "card-header-icon",
"aria-label": "more options",
onClick: () => setActive(!active)
},
/* @__PURE__ */ h("span", { class: "icon" }, active ? /* @__PURE__ */ h("i", { class: "mdi mdi-arrow-up" }) : /* @__PURE__ */ h("i", { class: "mdi mdi-arrow-down" }))
)), active ? /* @__PURE__ */ h("div", { class: "card-content" }, children) : alternative ? /* @__PURE__ */ h("div", { class: "card-content" }, alternative) : void 0);
}
// src/components/form/InputImage.tsx
init_preact_module();
init_hooks_module();
function InputImage({
name,
readonly,
placeholder,
tooltip,
label,
help,
children,
expand
}) {
const { error: error2, value, onChange } = useField(name);
const image = _2(null);
const { i18n: i18n2 } = useTranslationContext();
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",
{
src: value,
style: { width: 200, height: 200 },
onClick: () => {
var _a;
return (_a = image.current) == null ? void 0 : _a.click();
}
}
), /* @__PURE__ */ h(
"input",
{
ref: image,
style: { display: "none" },
type: "file",
name: String(name),
placeholder,
readonly,
onChange: (e4) => {
const f3 = e4.currentTarget.files;
if (!f3 || f3.length != 1) {
return onChange(void 0);
}
if (f3[0].size > MAX_IMAGE_SIZE) {
setSizeError(true);
return onChange(void 0);
}
setSizeError(false);
return f3[0].arrayBuffer().then((b4) => {
const b64 = window.btoa(
new Uint8Array(b4).reduce(
(data, byte) => data + String.fromCharCode(byte),
""
)
);
return onChange(`data:${f3[0].type};base64,${b64}`);
});
}
}
), help, children), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2), sizeError && /* @__PURE__ */ h("p", { class: "help is-danger" }, /* @__PURE__ */ h(i18n2.Translate, null, "Image should be smaller than 1 MB")), !value && /* @__PURE__ */ h("button", { class: "button", onClick: () => {
var _a;
return (_a = image.current) == null ? void 0 : _a.click();
} }, /* @__PURE__ */ h(i18n2.Translate, null, "Add")), value && /* @__PURE__ */ h("button", { class: "button", onClick: () => onChange(void 0) }, /* @__PURE__ */ h(i18n2.Translate, null, "Remove")))));
}
// src/components/form/InputLocation.tsx
init_preact_module();
function InputLocation({ name }) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(Input, { name: `${name}.country`, label: i18n2.str`Country` }), /* @__PURE__ */ h(
Input,
{
name: `${name}.address_lines`,
inputType: "multiline",
label: i18n2.str`Address`,
toStr: (v3) => !v3 ? "" : v3.join("\n"),
fromStr: (v3) => v3.split("\n")
}
), /* @__PURE__ */ h(
Input,
{
name: `${name}.building_number`,
label: i18n2.str`Building number`
}
), /* @__PURE__ */ h(Input, { name: `${name}.building_name`, label: i18n2.str`Building name` }), /* @__PURE__ */ h(Input, { name: `${name}.street`, label: i18n2.str`Street` }), /* @__PURE__ */ h(Input, { name: `${name}.post_code`, label: i18n2.str`Post code` }), /* @__PURE__ */ h(Input, { name: `${name}.town_location`, label: i18n2.str`Town location` }), /* @__PURE__ */ h(Input, { name: `${name}.town`, label: i18n2.str`Town` }), /* @__PURE__ */ h(Input, { name: `${name}.district`, label: i18n2.str`District` }), /* @__PURE__ */ h(
Input,
{
name: `${name}.country_subdivision`,
label: i18n2.str`Country subdivision`
}
));
}
// src/components/form/InputSelector.tsx
init_preact_module();
var defaultToString2 = (f3) => f3 || "";
var defaultFromString2 = (v3) => v3;
function InputSelector({
name,
readonly,
expand,
placeholder,
tooltip,
label,
help,
values,
fromStr = defaultFromString2,
toStr = defaultToString2
}) {
const { error: error2, value, onChange, required } = useField(name);
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 has-icons-right" }, /* @__PURE__ */ h("p", { class: expand ? "control is-expanded select" : "control select " }, /* @__PURE__ */ h(
"select",
{
class: error2 ? "select is-danger" : "select",
name: String(name),
disabled: readonly,
readonly,
onChange: (e4) => {
onChange(fromStr(e4.currentTarget.value));
}
},
placeholder && /* @__PURE__ */ h("option", null, placeholder),
values.map((v3, i4) => {
return /* @__PURE__ */ h("option", { key: i4, value: v3, selected: value === v3 }, toStr(v3));
})
), help), required && /* @__PURE__ */ h("span", { class: "icon has-text-danger is-right", style: { height: "2.5em" } }, /* @__PURE__ */ h("i", { class: "mdi mdi-alert" })), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2))));
}
// src/components/form/InputToggle.tsx
init_preact_module();
var defaultToBoolean = (f3) => f3 || "";
var defaultFromBoolean = (v3) => v3;
function InputToggle({
name,
readonly,
placeholder,
tooltip,
label,
help,
threeState,
expand,
fromBoolean = defaultFromBoolean,
toBoolean = defaultToBoolean
}) {
const { error: error2, value, onChange } = useField(name);
const onCheckboxClick = () => {
const c4 = toBoolean(value);
if (c4 === false && threeState)
return onChange(void 0);
return onChange(fromBoolean(!c4));
};
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" }, /* @__PURE__ */ h("label", { class: "toggle", style: { marginLeft: 4, marginTop: 0 } }, /* @__PURE__ */ h(
"input",
{
type: "checkbox",
class: toBoolean(value) === void 0 ? "is-indeterminate" : "toggle-checkbox",
checked: toBoolean(value),
placeholder,
readonly,
name: String(name),
disabled: readonly,
onChange: onCheckboxClick
}
), /* @__PURE__ */ h("div", { class: "toggle-switch" })), help), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2))));
}
// src/components/form/InputWithAddon.tsx
init_preact_module();
var defaultToString3 = (f3) => f3 || "";
var defaultFromString3 = (v3) => v3;
function InputWithAddon({
name,
readonly,
addonBefore,
children,
expand,
label,
placeholder,
help,
tooltip,
inputType,
inputExtra,
side,
addonAfter,
toStr = defaultToString3,
fromStr = defaultFromString3
}) {
const { error: error2, value, onChange, required } = useField(name);
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("div", { class: "field has-addons" }, addonBefore && /* @__PURE__ */ h("div", { class: "control" }, /* @__PURE__ */ h("a", { class: "button is-static" }, addonBefore)), /* @__PURE__ */ h(
"p",
{
class: `control${expand ? " is-expanded" : ""}${required ? " has-icons-right" : ""}`
},
/* @__PURE__ */ h(
"input",
__spreadProps(__spreadValues({}, inputExtra || {}), {
class: error2 ? "input is-danger" : "input",
type: inputType,
placeholder,
readonly,
disabled: readonly,
name: String(name),
value: toStr(value),
onChange: (e4) => onChange(fromStr(e4.currentTarget.value))
})
),
required && /* @__PURE__ */ h("span", { class: "icon has-text-danger is-right" }, /* @__PURE__ */ h("i", { class: "mdi mdi-alert" })),
children
), addonAfter && /* @__PURE__ */ h("div", { class: "control" }, /* @__PURE__ */ h("a", { class: "button is-static" }, addonAfter))), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2), /* @__PURE__ */ h("span", { class: "has-text-grey" }, help)), side));
}
// src/components/instance/DefaultInstanceFormFields.tsx
function DefaultInstanceFormFields({
readonlyId,
showId
}) {
const { i18n: i18n2 } = useTranslationContext();
const { url: backendURL } = useBackendContext();
return /* @__PURE__ */ h(p2, null, showId && /* @__PURE__ */ h(
InputWithAddon,
{
name: "id",
addonBefore: `${backendURL}/instances/`,
readonly: readonlyId,
label: i18n2.str`Identifier`,
tooltip: i18n2.str`Name of the instance in URLs. The 'default' instance is special in that it is used to administer other instances.`
}
), /* @__PURE__ */ h(
Input,
{
name: "name",
label: i18n2.str`Business name`,
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",
label: i18n2.str`Email`,
tooltip: i18n2.str`Contact email`
}
), /* @__PURE__ */ h(
Input,
{
name: "website",
label: i18n2.str`Website URL`,
tooltip: i18n2.str`URL.`
}
), /* @__PURE__ */ h(
InputImage,
{
name: "logo",
label: i18n2.str`Logo`,
tooltip: i18n2.str`Logo image.`
}
), /* @__PURE__ */ h(
InputToggle,
{
name: "use_stefan",
label: i18n2.str`Pay transaction fee`,
tooltip: i18n2.str`Assume the cost of the transaction of let the user pay for it.`
}
), /* @__PURE__ */ h(
InputGroup,
{
name: "address",
label: i18n2.str`Address`,
tooltip: i18n2.str`Physical location of the merchant.`
},
/* @__PURE__ */ h(InputLocation, { name: "address" })
), /* @__PURE__ */ h(
InputGroup,
{
name: "jurisdiction",
label: i18n2.str`Jurisdiction`,
tooltip: i18n2.str`Jurisdiction for legal disputes with the merchant.`
},
/* @__PURE__ */ h(InputLocation, { name: "jurisdiction" })
), /* @__PURE__ */ h(
InputDuration,
{
name: "default_pay_delay",
label: i18n2.str`Default payment delay`,
withForever: true,
tooltip: i18n2.str`Time customers have to pay an order before the offer expires by default.`
}
), /* @__PURE__ */ h(
InputDuration,
{
name: "default_wire_transfer_delay",
label: i18n2.str`Default wire transfer delay`,
tooltip: i18n2.str`Maximum time an exchange is allowed to delay wiring funds to the merchant, enabling it to aggregate smaller payments into larger wire transfers and reducing wire fees.`,
withForever: true
}
));
}
// src/utils/table.ts
function undefinedIfEmpty(obj) {
if (obj === void 0)
return void 0;
return Object.values(obj).some((v3) => v3 !== void 0) ? obj : void 0;
}
// src/paths/admin/create/CreatePage.tsx
function with_defaults(id) {
return {
id,
// accounts: [],
user_type: "business",
use_stefan: false,
default_pay_delay: { d_us: 2 * 1e3 * 60 * 60 * 1e3 },
// two hours
default_wire_transfer_delay: { d_us: 1e3 * 2 * 60 * 60 * 24 * 1e3 }
// two days
};
}
function CreatePage({ onCreate, onBack, forceId }) {
var _a, _b, _c, _d;
const [value, valueHandler] = p3(with_defaults(forceId));
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,
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
// ? i18n.str`required`
// : undefinedIfEmpty(
// value.accounts.map((p) => {
// return !PAYTO_REGEX.test(p.payto_uri)
// ? i18n.str`is not valid`
// : undefined;
// }),
// ),
default_pay_delay: !value.default_pay_delay ? i18n2.str`required` : void 0,
default_wire_transfer_delay: !value.default_wire_transfer_delay ? i18n2.str`required` : void 0,
address: undefinedIfEmpty({
address_lines: ((_a = value.address) == null ? void 0 : _a.address_lines) && ((_b = value.address) == null ? void 0 : _b.address_lines.length) > 7 ? i18n2.str`max 7 lines` : void 0
}),
jurisdiction: undefinedIfEmpty({
address_lines: ((_c = value.address) == null ? void 0 : _c.address_lines) && ((_d = value.address) == null ? void 0 : _d.address_lines.length) > 7 ? i18n2.str`max 7 lines` : void 0
})
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submit = () => {
value.auth = { method: "external" };
if (!value.address)
value.address = {};
if (!value.jurisdiction)
value.jurisdiction = {};
return onCreate(value);
};
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,
{
errors: errors2,
object: value,
valueHandler
},
/* @__PURE__ */ h(DefaultInstanceFormFields, { readonlyId: !!forceId, showId: true })
), /* @__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,
{
onClick: submit,
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields and choose authorization method` : "confirm operation"
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/admin/create/InstanceCreatedSuccessfully.tsx
init_preact_module();
// src/components/notifications/CreatedSuccessfully.tsx
init_preact_module();
function CreatedSuccessfully({
children,
onConfirm,
onCreateAnother
}) {
return /* @__PURE__ */ h("div", { class: "columns is-fullwidth is-vcentered mt-3" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h("div", { class: "card" }, /* @__PURE__ */ h("header", { class: "card-header has-background-success" }, /* @__PURE__ */ h("p", { class: "card-header-title has-text-white-ter" }, "Success.")), /* @__PURE__ */ h("div", { class: "card-content" }, children)), /* @__PURE__ */ h("div", { class: "buttons is-right" }, onCreateAnother && /* @__PURE__ */ h("button", { class: "button is-info", onClick: onCreateAnother }, "Create another"), /* @__PURE__ */ h("button", { class: "button is-info", onClick: onConfirm }, "Continue"))), /* @__PURE__ */ h("div", { class: "column" }));
}
// src/paths/admin/create/InstanceCreatedSuccessfully.tsx
function InstanceCreatedSuccessfully({
entity,
onConfirm
}) {
return /* @__PURE__ */ h(CreatedSuccessfully, { onConfirm }, /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "ID")), /* @__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.id }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Business Name")), /* @__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.name }))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "Access token")), /* @__PURE__ */ h("div", { class: "field-body is-flex-grow-3" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control" }, entity.auth.method === "external" && "external", entity.auth.method === "token" && /* @__PURE__ */ h("input", { class: "input", readonly: true, value: entity.auth.token }))))));
}
// src/paths/admin/create/index.tsx
function Create({ onBack, onConfirm, forceId }) {
const { createInstance } = useAdminAPI();
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
CreatePage,
{
onBack,
forceId,
onCreate: (d5) => {
return createInstance(d5).then(() => {
setCreatedOk(d5);
}).catch((error2) => {
setNotif({
message: i18n2.str`Failed to create instance`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/admin/list/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/admin/list/View.tsx
init_preact_module();
init_hooks_module();
// src/paths/admin/list/TableActive.tsx
init_preact_module();
init_hooks_module();
function CardTable({
instances,
onCreate,
onUpdate,
onPurge,
setInstanceName,
onDelete,
selected
}) {
const [actionQueue, actionQueueHandler] = p3([]);
const [rowSelection, rowSelectionHandler] = p3([]);
h2(() => {
if (actionQueue.length > 0 && !selected && actionQueue[0].type == "DELETE") {
onDelete(actionQueue[0].element);
actionQueueHandler(actionQueue.slice(1));
}
}, [actionQueue, selected, onDelete]);
h2(() => {
if (actionQueue.length > 0 && !selected && actionQueue[0].type == "UPDATE") {
onUpdate(actionQueue[0].element.id);
actionQueueHandler(actionQueue.slice(1));
}
}, [actionQueue, selected, onUpdate]);
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-desktop-mac" })), /* @__PURE__ */ h(i18n2.Translate, null, "Instances")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h(
"button",
{
class: rowSelection.length > 0 ? "button is-danger" : "is-hidden",
type: "button",
onClick: () => actionQueueHandler(
buildActions(instances, rowSelection, "DELETE")
)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Delete")
)), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`add new instance`
},
/* @__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" }, instances.length > 0 ? /* @__PURE__ */ h(
Table,
{
instances,
onPurge,
onUpdate,
setInstanceName,
onDelete,
rowSelection,
rowSelectionHandler
}
) : /* @__PURE__ */ h(EmptyTable, null)))));
}
function toggleSelected(id) {
return (prev) => prev.indexOf(id) == -1 ? [...prev, id] : prev.filter((e4) => e4 != id);
}
function Table({
rowSelection,
rowSelectionHandler,
setInstanceName,
instances,
onUpdate,
onDelete,
onPurge
}) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", { class: "is-checkbox-cell" }, /* @__PURE__ */ h("label", { class: "b-checkbox checkbox" }, /* @__PURE__ */ h(
"input",
{
type: "checkbox",
checked: rowSelection.length === instances.length,
onClick: () => rowSelectionHandler(
rowSelection.length === instances.length ? [] : instances.map((i4) => i4.id)
)
}
), /* @__PURE__ */ h("span", { class: "check" }))), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "ID")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Name")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
return /* @__PURE__ */ h("tr", { key: i4.id }, /* @__PURE__ */ h("td", { class: "is-checkbox-cell" }, /* @__PURE__ */ h("label", { class: "b-checkbox checkbox" }, /* @__PURE__ */ h(
"input",
{
type: "checkbox",
checked: rowSelection.indexOf(i4.id) != -1,
onClick: () => rowSelectionHandler(toggleSelected(i4.id))
}
), /* @__PURE__ */ h("span", { class: "check" }))), /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(
"a",
{
href: `#/orders?instance=${i4.id}`,
onClick: (e4) => {
setInstanceName(i4.id);
}
},
i4.id
)), /* @__PURE__ */ h("td", null, i4.name), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-small is-success jb-modal",
type: "button",
onClick: () => onUpdate(i4.id)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Edit")
), !i4.deleted && /* @__PURE__ */ h(
"button",
{
class: "button is-small is-danger jb-modal is-outlined",
type: "button",
onClick: () => onDelete(i4)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Delete")
), i4.deleted && /* @__PURE__ */ h(
"button",
{
class: "button is-small is-danger jb-modal",
type: "button",
onClick: () => onPurge(i4)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Purge")
))));
}))));
}
function EmptyTable() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "There is no instances yet, add more pressing the + sign")));
}
function notEmpty(value) {
return value !== null && value !== void 0;
}
function buildActions(instances, selected, action) {
return selected.map((id) => instances.find((i4) => i4.id === id)).filter(notEmpty).map((id) => ({ element: id, type: action }));
}
// src/paths/admin/list/View.tsx
function View({
instances,
onCreate,
onDelete,
onPurge,
onUpdate,
setInstanceName,
selected
}) {
const [show, setShow] = p3("active");
const showIsActive = show === "active" ? "is-active" : "";
const showIsDeleted = show === "deleted" ? "is-active" : "";
const showAll = show === null ? "is-active" : "";
const { i18n: i18n2 } = useTranslationContext();
const showingInstances = showIsDeleted ? instances.filter((i4) => i4.deleted) : showIsActive ? instances.filter((i4) => !i4.deleted) : instances;
return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column is-two-thirds" }, /* @__PURE__ */ h("div", { class: "tabs", style: { overflow: "inherit" } }, /* @__PURE__ */ h("ul", null, /* @__PURE__ */ h("li", { class: showIsActive }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`Only show active instances`
},
/* @__PURE__ */ h("a", { onClick: () => setShow("active") }, /* @__PURE__ */ h(i18n2.Translate, null, "Active"))
)), /* @__PURE__ */ h("li", { class: showIsDeleted }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`Only show deleted instances`
},
/* @__PURE__ */ h("a", { onClick: () => setShow("deleted") }, /* @__PURE__ */ h(i18n2.Translate, null, "Deleted"))
)), /* @__PURE__ */ h("li", { class: showAll }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`Show all instances`
},
/* @__PURE__ */ h("a", { onClick: () => setShow(null) }, /* @__PURE__ */ h(i18n2.Translate, null, "All"))
)))))), /* @__PURE__ */ h(
CardTable,
{
instances: showingInstances,
onDelete,
onPurge,
setInstanceName,
onUpdate,
selected,
onCreate
}
));
}
// src/paths/admin/list/index.tsx
function Instances({
onUnauthorized,
onLoadError,
onNotFound,
onCreate,
onUpdate,
setInstanceName
}) {
const result = useBackendInstances();
const [deleting, setDeleting] = p3(null);
const [purging, setPurging] = p3(null);
const { deleteInstance, purgeInstance } = useAdminAPI();
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
View,
{
instances: result.data.instances,
onDelete: setDeleting,
onCreate,
onPurge: setPurging,
onUpdate,
setInstanceName,
selected: !!deleting
}
), deleting && /* @__PURE__ */ h(
DeleteModal,
{
element: deleting,
onCancel: () => setDeleting(null),
onConfirm: () => __async(this, null, function* () {
try {
yield deleteInstance(deleting.id);
setNotif({
message: i18n2.str`Instance "${deleting.name}" (ID: ${deleting.id}) has been deleted`,
type: "SUCCESS"
});
} catch (error2) {
setNotif({
message: i18n2.str`Failed to delete instance`,
type: "ERROR",
description: error2 instanceof Error ? error2.message : void 0
});
}
setDeleting(null);
})
}
), purging && /* @__PURE__ */ h(
PurgeModal,
{
element: purging,
onCancel: () => setPurging(null),
onConfirm: () => __async(this, null, function* () {
try {
yield purgeInstance(purging.id);
setNotif({
message: i18n2.str`Instance '${purging.name}' (ID: ${purging.id}) has been disabled`,
type: "SUCCESS"
});
} catch (error2) {
setNotif({
message: i18n2.str`Failed to purge instance`,
type: "ERROR",
description: error2 instanceof Error ? error2.message : void 0
});
}
setPurging(null);
})
}
));
}
// src/components/menu/NavigationBar.tsx
init_preact_module();
// src/assets/logo-2021.svg
var logo_2021_default = "./logo-2021-VSZSJ4QZ.svg";
// src/components/menu/NavigationBar.tsx
function NavigationBar({ onMobileMenu, title }) {
return /* @__PURE__ */ h(
"nav",
{
class: "navbar is-fixed-top",
role: "navigation",
"aria-label": "main navigation"
},
/* @__PURE__ */ h("div", { class: "navbar-brand" }, /* @__PURE__ */ h("span", { class: "navbar-item", style: { fontSize: 24, fontWeight: 900 } }, title), /* @__PURE__ */ h(
"a",
{
role: "button",
class: "navbar-burger",
"aria-label": "menu",
"aria-expanded": "false",
onClick: (e4) => {
onMobileMenu();
e4.stopPropagation();
}
},
/* @__PURE__ */ h("span", { "aria-hidden": "true" }),
/* @__PURE__ */ h("span", { "aria-hidden": "true" }),
/* @__PURE__ */ h("span", { "aria-hidden": "true" })
)),
/* @__PURE__ */ h("div", { class: "navbar-menu " }, /* @__PURE__ */ h(
"a",
{
class: "navbar-start is-justify-content-center is-flex-grow-1",
href: "https://taler.net"
},
/* @__PURE__ */ h("img", { src: logo_2021_default, style: { height: 35, margin: 10 } })
), /* @__PURE__ */ h("div", { class: "navbar-end" }, /* @__PURE__ */ h("div", { class: "navbar-item", style: { paddingTop: 4, paddingBottom: 4 } })))
);
}
// src/components/menu/SideBar.tsx
init_preact_module();
// src/context/config.ts
init_preact_module();
init_hooks_module();
var Context4 = B(null);
var ConfigContextProvider = Context4.Provider;
var useConfigContext = () => q2(Context4);
// src/components/menu/LangSelector.tsx
init_preact_module();
init_hooks_module();
// src/assets/icons/languageicon.svg
var languageicon_default = "./languageicon-LWKRUH5D.svg";
// src/i18n/strings.ts
var strings = {};
strings["de"] = {
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages",
"plural_forms": "nplurals=2; plural=(n != 1);",
"lang": ""
},
"Cancel": [
""
],
"%1$s": [
""
],
"Close": [
""
],
"Continue": [
""
],
"Clear": [
""
],
"Confirm": [
""
],
"is not the same as the current access token": [
""
],
"cannot be empty": [
""
],
"cannot be the same as the old token": [
""
],
"is not the same": [
""
],
"You are updating the access token from instance with id %1$s": [
""
],
"Old access token": [
""
],
"access token currently in use": [
""
],
"New access token": [
""
],
"next access token to be used": [
""
],
"Repeat access token": [
""
],
"confirm the same access token": [
""
],
"Clearing the access token will mean public access to the instance": [
""
],
"cannot be the same as the old access token": [
""
],
"You are setting the access token for the new instance": [
""
],
"With external authorization method no check will be done by the merchant backend": [
""
],
"Set external authorization": [
""
],
"Set access token": [
""
],
"Operation in progress...": [
""
],
"The operation will be automatically canceled after %1$s seconds": [
""
],
"Instances": [
""
],
"Delete": [
""
],
"add new instance": [
""
],
"ID": [
""
],
"Name": [
""
],
"Edit": [
""
],
"Purge": [
""
],
"There is no instances yet, add more pressing the + sign": [
""
],
"Only show active instances": [
""
],
"Active": [
""
],
"Only show deleted instances": [
""
],
"Deleted": [
""
],
"Show all instances": [
""
],
"All": [
""
],
'Instance "%1$s" (ID: %2$s) has been deleted': [
""
],
"Failed to delete instance": [
""
],
"Instance '%1$s' (ID: %2$s) has been disabled": [
""
],
"Failed to purge instance": [
""
],
"Pending KYC verification": [
""
],
"Timed out": [
""
],
"Exchange": [
""
],
"Target account": [
""
],
"KYC URL": [
""
],
"Code": [
""
],
"Http Status": [
""
],
"No pending kyc verification!": [
""
],
"change value to unknown date": [
""
],
"change value to empty": [
""
],
"clear": [
""
],
"change value to never": [
""
],
"never": [
""
],
"Country": [
""
],
"Address": [
""
],
"Building number": [
""
],
"Building name": [
""
],
"Street": [
""
],
"Post code": [
""
],
"Town location": [
""
],
"Town": [
""
],
"District": [
""
],
"Country subdivision": [
""
],
"Product id": [
""
],
"Description": [
""
],
"Product": [
""
],
"search products by it's description or id": [
""
],
"no products found with that description": [
""
],
"You must enter a valid product identifier.": [
""
],
"Quantity must be greater than 0!": [
""
],
"This quantity exceeds remaining stock. Currently, only %1$s units remain unreserved in stock.": [
""
],
"Quantity": [
""
],
"how many products will be added": [
""
],
"Add from inventory": [
""
],
"Image should be smaller than 1 MB": [
""
],
"Add": [
""
],
"Remove": [
""
],
"No taxes configured for this product.": [
""
],
"Amount": [
""
],
"Taxes can be in currencies that differ from the main currency used by the merchant.": [
""
],
"Enter currency and value separated with a colon, e.g. "USD:2.3".": [
""
],
"Legal name of the tax, e.g. VAT or import duties.": [
""
],
"add tax to the tax list": [
""
],
"describe and add a product that is not in the inventory list": [
""
],
"Add custom product": [
""
],
"Complete information of the product": [
""
],
"Image": [
""
],
"photo of the product": [
""
],
"full product description": [
""
],
"Unit": [
""
],
"name of the product unit": [
""
],
"Price": [
""
],
"amount in the current currency": [
""
],
"Taxes": [
""
],
"image": [
""
],
"description": [
""
],
"quantity": [
""
],
"unit price": [
""
],
"total price": [
""
],
"required": [
""
],
"not valid": [
""
],
"must be greater than 0": [
""
],
"not a valid json": [
""
],
"should be in the future": [
""
],
"refund deadline cannot be before pay deadline": [
""
],
"wire transfer deadline cannot be before refund deadline": [
""
],
"wire transfer deadline cannot be before pay deadline": [
""
],
"should have a refund deadline": [
""
],
"auto refund cannot be after refund deadline": [
""
],
"Manage products in order": [
""
],
"Manage list of products in the order.": [
""
],
"Remove this product from the order.": [
""
],
"Total price": [
""
],
"total product price added up": [
""
],
"Amount to be paid by the customer": [
""
],
"Order price": [
""
],
"final order price": [
""
],
"Summary": [
""
],
"Title of the order to be shown to the customer": [
""
],
"Shipping and Fulfillment": [
""
],
"Delivery date": [
""
],
"Deadline for physical delivery assured by the merchant.": [
""
],
"Location": [
""
],
"address where the products will be delivered": [
""
],
"Fulfillment URL": [
""
],
"URL to which the user will be redirected after successful payment.": [
""
],
"Taler payment options": [
""
],
"Override default Taler payment settings for this order": [
""
],
"Payment deadline": [
""
],
"Deadline for the customer to pay for the offer before it expires. Inventory products will be reserved until this deadline.": [
""
],
"Refund deadline": [
""
],
"Time until which the order can be refunded by the merchant.": [
""
],
"Wire transfer deadline": [
""
],
"Deadline for the exchange to make the wire transfer.": [
""
],
"Auto-refund deadline": [
""
],
"Time until which the wallet will automatically check for refunds without user interaction.": [
""
],
"Maximum deposit fee": [
""
],
"Maximum deposit fees the merchant is willing to cover for this order. Higher deposit fees must be covered in full by the consumer.": [
""
],
"Maximum wire fee": [
""
],
"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.": [
""
],
"Wire fee amortization": [
""
],
"Factor by which wire fees exceeding the above threshold are divided to determine the share of excess wire fees to be paid explicitly by the consumer.": [
""
],
"Create token": [
""
],
"Uncheck this option if the merchant backend generated an order ID with enough entropy to prevent adversarial claims.": [
""
],
"Minimum age required": [
""
],
"Any value greater than 0 will limit the coins able be used to pay this contract. If empty the age restriction will be defined by the products": [
""
],
"Min age defined by the producs is %1$s": [
""
],
"Additional information": [
""
],
"Custom information to be included in the contract for this order.": [
""
],
"You must enter a value in JavaScript Object Notation (JSON).": [
""
],
"days": [
""
],
"hours": [
""
],
"minutes": [
""
],
"seconds": [
""
],
"forever": [
""
],
"%1$sM": [
""
],
"%1$sY": [
""
],
"%1$sd": [
""
],
"%1$sh": [
""
],
"%1$smin": [
""
],
"%1$ssec": [
""
],
"Orders": [
""
],
"create order": [
""
],
"load newer orders": [
""
],
"Date": [
""
],
"Refund": [
""
],
"copy url": [
""
],
"load older orders": [
""
],
"No orders have been found matching your query!": [
""
],
"duplicated": [
""
],
"invalid format": [
""
],
"this value exceed the refundable amount": [
""
],
"date": [
""
],
"amount": [
""
],
"reason": [
""
],
"amount to be refunded": [
""
],
"Max refundable:": [
""
],
"Reason": [
""
],
"Choose one...": [
""
],
"requested by the customer": [
""
],
"other": [
""
],
"why this order is being refunded": [
""
],
"more information to give context": [
""
],
"Contract Terms": [
""
],
"human-readable description of the whole purchase": [
""
],
"total price for the transaction": [
""
],
"URL for this purchase": [
""
],
"Max fee": [
""
],
"maximum total deposit fee accepted by the merchant for this contract": [
""
],
"Max wire fee": [
""
],
"maximum wire fee accepted by the merchant": [
""
],
"over how many customer transactions does the merchant expect to amortize wire fees on average": [
""
],
"Created at": [
""
],
"time when this contract was generated": [
""
],
"after this deadline has passed no refunds will be accepted": [
""
],
"after this deadline, the merchant won't accept payments for the contract": [
""
],
"transfer deadline for the exchange": [
""
],
"time indicating when the order should be delivered": [
""
],
"where the order will be delivered": [
""
],
"Auto-refund delay": [
""
],
"how long the wallet should try to get an automatic refund for the purchase": [
""
],
"Extra info": [
""
],
"extra data that is only interpreted by the merchant frontend": [
""
],
"Order": [
""
],
"claimed": [
""
],
"claimed at": [
""
],
"Timeline": [
""
],
"Payment details": [
""
],
"Order status": [
""
],
"Product list": [
""
],
"paid": [
""
],
"wired": [
""
],
"refunded": [
""
],
"refund order": [
""
],
"not refundable": [
""
],
"refund": [
""
],
"Refunded amount": [
""
],
"Refund taken": [
""
],
"Status URL": [
""
],
"Refund URI": [
""
],
"unpaid": [
""
],
"pay at": [
""
],
"created at": [
""
],
"Order status URL": [
""
],
"Payment URI": [
""
],
"Unknown order status. This is an error, please contact the administrator.": [
""
],
"Back": [
""
],
"refund created successfully": [
""
],
"could not create the refund": [
""
],
"select date to show nearby orders": [
""
],
"order id": [
""
],
"jump to order with the given order ID": [
""
],
"remove all filters": [
""
],
"only show paid orders": [
""
],
"Paid": [
""
],
"only show orders with refunds": [
""
],
"Refunded": [
""
],
"only show orders where customers paid, but wire payments from payment provider are still pending": [
""
],
"Not wired": [
""
],
"clear date filter": [
""
],
"date (YYYY/MM/DD)": [
""
],
"Enter an order id": [
""
],
"order not found": [
""
],
"could not get the order to refund": [
""
],
"Loading...": [
""
],
"click here to configure the stock of the product, leave it as is and the backend will not control stock": [
""
],
"Manage stock": [
""
],
"this product has been configured without stock control": [
""
],
"Infinite": [
""
],
"lost cannot be greater than current and incoming (max %1$s)": [
""
],
"Incoming": [
""
],
"Lost": [
""
],
"Current": [
""
],
"remove stock control for this product": [
""
],
"without stock": [
""
],
"Next restock": [
""
],
"Delivery address": [
""
],
"product identification to use in URLs (for internal use only)": [
""
],
"illustration of the product for customers": [
""
],
"product description for customers": [
""
],
"Age restricted": [
""
],
"is this product restricted for customer below certain age?": [
""
],
"unit describing quantity of product sold (e.g. 2 kilograms, 5 liters, 3 items, 5 meters) for customers": [
""
],
"sale price for customers, including taxes, for above units of the product": [
""
],
"Stock": [
""
],
"product inventory for products with finite supply (for internal use only)": [
""
],
"taxes included in the product price, exposed to customers": [
""
],
"Need to complete marked fields": [
""
],
"could not create product": [
""
],
"Products": [
""
],
"add product to inventory": [
""
],
"Sell": [
""
],
"Profit": [
""
],
"Sold": [
""
],
"free": [
""
],
"go to product update page": [
""
],
"Update": [
""
],
"remove this product from the database": [
""
],
"update the product with new price": [
""
],
"update product with new price": [
""
],
"add more elements to the inventory": [
""
],
"report elements lost in the inventory": [
""
],
"new price for the product": [
""
],
"the are value with errors": [
""
],
"update product with new stock and price": [
""
],
"There is no products yet, add more pressing the + sign": [
""
],
"product updated successfully": [
""
],
"could not update the product": [
""
],
"product delete successfully": [
""
],
"could not delete the product": [
""
],
"Product id:": [
""
],
"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.": [
""
],
"If your system supports RFC 8905, you can do this by opening this URI:": [
""
],
"it should be greater than 0": [
""
],
"must be a valid URL": [
""
],
"Initial balance": [
""
],
"balance prior to deposit": [
""
],
"Exchange URL": [
""
],
"URL of exchange": [
""
],
"Next": [
""
],
"Wire method": [
""
],
"method to use for wire transfer": [
""
],
"Select one wire method": [
""
],
"could not create reserve": [
""
],
"Valid until": [
""
],
"Created balance": [
""
],
"Exchange balance": [
""
],
"Picked up": [
""
],
"Committed": [
""
],
"Account address": [
""
],
"Subject": [
""
],
"Tips": [
""
],
"No tips has been authorized from this reserve": [
""
],
"Authorized": [
""
],
"Expiration": [
""
],
"amount of tip": [
""
],
"Justification": [
""
],
"reason for the tip": [
""
],
"URL after tip": [
""
],
"URL to visit after tip payment": [
""
],
"Reserves not yet funded": [
""
],
"Reserves ready": [
""
],
"add new reserve": [
""
],
"Expires at": [
""
],
"Initial": [
""
],
"delete selected reserve from the database": [
""
],
"authorize new tip from selected reserve": [
""
],
"There is no ready reserves yet, add more pressing the + sign or fund them": [
""
],
"Expected Balance": [
""
],
"could not create the tip": [
""
],
"should not be empty": [
""
],
"should be greater that 0": [
""
],
"can't be empty": [
""
],
"to short": [
""
],
"just letters and numbers from 2 to 7": [
""
],
"size of the key should be 32": [
""
],
"Identifier": [
""
],
"Name of the template in URLs.": [
""
],
"Describe what this template stands for": [
""
],
"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": [
""
],
"Is this contract restricted to some age?": [
""
],
"Payment timeout": [
""
],
"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": [
""
],
"Amount is required": [
""
],
"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": [
""
],
"add new templates": [
""
],
"load more templates before the first one": [
""
],
"load newer templates": [
""
],
"delete selected templates from the database": [
""
],
"use template to create new order": [
""
],
"create qr code for the template": [
""
],
"load more templates after the last one": [
""
],
"load older templates": [
""
],
"There is no templates yet, add more pressing the + sign": [
""
],
"template delete successfully": [
""
],
"could not delete the template": [
""
],
"could not update template": [
""
],
"should be one of '%1$s'": [
""
],
"Webhook ID to use": [
""
],
"Event": [
""
],
"The event of the webhook: why the webhook is used": [
""
],
"Method": [
""
],
"Method used by the webhook": [
""
],
"URL": [
""
],
"URL of the webhook where the customer will be redirected": [
""
],
"Header": [
""
],
"Header template of the webhook": [
""
],
"Body": [
""
],
"Body template by the webhook": [
""
],
"Webhooks": [
""
],
"add new webhooks": [
""
],
"load more webhooks before the first one": [
""
],
"load newer webhooks": [
""
],
"Event type": [
""
],
"delete selected webhook from the database": [
""
],
"load more webhooks after the last one": [
""
],
"load older webhooks": [
""
],
"There is no webhooks yet, add more pressing the + sign": [
""
],
"webhook delete successfully": [
""
],
"could not delete the webhook": [
""
],
"check the id, does not look valid": [
""
],
"should have 52 characters, current %1$s": [
""
],
"URL doesn't have the right format": [
""
],
"Credited bank account": [
""
],
"Select one account": [
""
],
"Bank account of the merchant where the payment was received": [
""
],
"Wire transfer ID": [
""
],
"unique identifier of the wire transfer used by the exchange, must be 52 characters long": [
""
],
"Base URL of the exchange that made the transfer, should have been in the wire transfer subject": [
""
],
"Amount credited": [
""
],
"Actual amount that was wired to the merchant's bank account": [
""
],
"could not inform transfer": [
""
],
"Transfers": [
""
],
"add new transfer": [
""
],
"load more transfers before the first one": [
""
],
"load newer transfers": [
""
],
"Credit": [
""
],
"Confirmed": [
""
],
"Verified": [
""
],
"Executed at": [
""
],
"yes": [
""
],
"no": [
""
],
"unknown": [
""
],
"delete selected transfer from the database": [
""
],
"load more transfer after the last one": [
""
],
"load older transfers": [
""
],
"There is no transfer yet, add more pressing the + sign": [
""
],
"filter by account address": [
""
],
"only show wire transfers confirmed by the merchant": [
""
],
"only show wire transfers claimed by the exchange": [
""
],
"Unverified": [
""
],
"is not valid": [
""
],
"is not a number": [
""
],
"must be 1 or greater": [
""
],
"max 7 lines": [
""
],
"change authorization configuration": [
""
],
"Need to complete marked fields and choose authorization method": [
""
],
"This is not a valid bitcoin address.": [
""
],
"This is not a valid Ethereum address.": [
""
],
"IBAN numbers usually have more that 4 digits": [
""
],
"IBAN numbers usually have less that 34 digits": [
""
],
"IBAN country code not found": [
""
],
"IBAN number is not valid, checksum is wrong": [
""
],
"Target type": [
""
],
"Method to use for wire transfer": [
""
],
"Routing": [
""
],
"Routing number.": [
""
],
"Account": [
""
],
"Account number.": [
""
],
"Business Identifier Code.": [
""
],
"Bank Account Number.": [
""
],
"Unified Payment Interface.": [
""
],
"Bitcoin protocol.": [
""
],
"Ethereum protocol.": [
""
],
"Interledger protocol.": [
""
],
"Host": [
""
],
"Bank host.": [
""
],
"Bank account.": [
""
],
"Bank account owner's name.": [
""
],
"No accounts yet.": [
""
],
"Name of the instance in URLs. The 'default' instance is special in that it is used to administer other instances.": [
""
],
"Business name": [
""
],
"Legal name of the business represented by this instance.": [
""
],
"Email": [
""
],
"Contact email": [
""
],
"Website URL": [
""
],
"URL.": [
""
],
"Logo": [
""
],
"Logo image.": [
""
],
"Bank account": [
""
],
"URI specifying bank account for crediting revenue.": [
""
],
"Default max deposit fee": [
""
],
"Maximum deposit fees this merchant is willing to pay per order by default.": [
""
],
"Default max wire fee": [
""
],
"Maximum wire fees this merchant is willing to pay per wire transfer by default.": [
""
],
"Default wire fee amortization": [
""
],
"Number of orders excess wire transfer fees will be divided by to compute per order surcharge.": [
""
],
"Physical location of the merchant.": [
""
],
"Jurisdiction": [
""
],
"Jurisdiction for legal disputes with the merchant.": [
""
],
"Default payment delay": [
""
],
"Time customers have to pay an order before the offer expires by default.": [
""
],
"Default wire transfer delay": [
""
],
"Maximum time an exchange is allowed to delay wiring funds to the merchant, enabling it to aggregate smaller payments into larger wire transfers and reducing wire fees.": [
""
],
"Instance id": [
""
],
"Change the authorization method use for this instance.": [
""
],
"Manage access token": [
""
],
"Failed to create instance": [
""
],
"Login required": [
""
],
"Please enter your access token.": [
""
],
"Access Token": [
""
],
"The request to the backend take too long and was cancelled": [
""
],
'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": [
""
],
"The access token provided is invalid.": [
""
],
"No 'default' instance configured yet.": [
""
],
"Create a 'default' instance to begin using the merchant backoffice.": [
""
],
"The access token provided is invalid": [
""
],
"Hide for today": [
""
],
"Instance": [
""
],
"Settings": [
""
],
"Connection": [
""
],
"New": [
""
],
"List": [
""
],
"Log out": [
""
],
"Check your token is valid": [
""
],
"Couldn't access the server.": [
""
],
"Could not infer instance id from url %1$s": [
""
],
"Server not found": [
""
],
"Server response with an error code": [
""
],
"Got message %1$s from %2$s": [
""
],
"Response from server is unreadable, http status: %1$s": [
""
],
"Unexpected Error": [
""
],
"The value %1$s is invalid for a payment url": [
""
],
"add element to the list": [
""
],
"add": [
""
],
"Deleting": [
""
],
"Changing": [
""
],
"Order ID": [
""
],
"Payment URL": [
""
]
}
}
};
strings["en"] = {
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages",
"plural_forms": "nplurals=2; plural=(n != 1);",
"lang": ""
},
"Cancel": [
""
],
"%1$s": [
""
],
"Close": [
""
],
"Continue": [
""
],
"Clear": [
""
],
"Confirm": [
""
],
"is not the same as the current access token": [
""
],
"cannot be empty": [
""
],
"cannot be the same as the old token": [
""
],
"is not the same": [
""
],
"You are updating the access token from instance with id %1$s": [
""
],
"Old access token": [
""
],
"access token currently in use": [
""
],
"New access token": [
""
],
"next access token to be used": [
""
],
"Repeat access token": [
""
],
"confirm the same access token": [
""
],
"Clearing the access token will mean public access to the instance": [
""
],
"cannot be the same as the old access token": [
""
],
"You are setting the access token for the new instance": [
""
],
"With external authorization method no check will be done by the merchant backend": [
""
],
"Set external authorization": [
""
],
"Set access token": [
""
],
"Operation in progress...": [
""
],
"The operation will be automatically canceled after %1$s seconds": [
""
],
"Instances": [
""
],
"Delete": [
""
],
"add new instance": [
""
],
"ID": [
""
],
"Name": [
""
],
"Edit": [
""
],
"Purge": [
""
],
"There is no instances yet, add more pressing the + sign": [
""
],
"Only show active instances": [
""
],
"Active": [
""
],
"Only show deleted instances": [
""
],
"Deleted": [
""
],
"Show all instances": [
""
],
"All": [
""
],
'Instance "%1$s" (ID: %2$s) has been deleted': [
""
],
"Failed to delete instance": [
""
],
"Instance '%1$s' (ID: %2$s) has been disabled": [
""
],
"Failed to purge instance": [
""
],
"Pending KYC verification": [
""
],
"Timed out": [
""
],
"Exchange": [
""
],
"Target account": [
""
],
"KYC URL": [
""
],
"Code": [
""
],
"Http Status": [
""
],
"No pending kyc verification!": [
""
],
"change value to unknown date": [
""
],
"change value to empty": [
""
],
"clear": [
""
],
"change value to never": [
""
],
"never": [
""
],
"Country": [
""
],
"Address": [
""
],
"Building number": [
""
],
"Building name": [
""
],
"Street": [
""
],
"Post code": [
""
],
"Town location": [
""
],
"Town": [
""
],
"District": [
""
],
"Country subdivision": [
""
],
"Product id": [
""
],
"Description": [
""
],
"Product": [
""
],
"search products by it's description or id": [
""
],
"no products found with that description": [
""
],
"You must enter a valid product identifier.": [
""
],
"Quantity must be greater than 0!": [
""
],
"This quantity exceeds remaining stock. Currently, only %1$s units remain unreserved in stock.": [
""
],
"Quantity": [
""
],
"how many products will be added": [
""
],
"Add from inventory": [
""
],
"Image should be smaller than 1 MB": [
""
],
"Add": [
""
],
"Remove": [
""
],
"No taxes configured for this product.": [
""
],
"Amount": [
""
],
"Taxes can be in currencies that differ from the main currency used by the merchant.": [
""
],
"Enter currency and value separated with a colon, e.g. "USD:2.3".": [
""
],
"Legal name of the tax, e.g. VAT or import duties.": [
""
],
"add tax to the tax list": [
""
],
"describe and add a product that is not in the inventory list": [
""
],
"Add custom product": [
""
],
"Complete information of the product": [
""
],
"Image": [
""
],
"photo of the product": [
""
],
"full product description": [
""
],
"Unit": [
""
],
"name of the product unit": [
""
],
"Price": [
""
],
"amount in the current currency": [
""
],
"Taxes": [
""
],
"image": [
""
],
"description": [
""
],
"quantity": [
""
],
"unit price": [
""
],
"total price": [
""
],
"required": [
""
],
"not valid": [
""
],
"must be greater than 0": [
""
],
"not a valid json": [
""
],
"should be in the future": [
""
],
"refund deadline cannot be before pay deadline": [
""
],
"wire transfer deadline cannot be before refund deadline": [
""
],
"wire transfer deadline cannot be before pay deadline": [
""
],
"should have a refund deadline": [
""
],
"auto refund cannot be after refund deadline": [
""
],
"Manage products in order": [
""
],
"Manage list of products in the order.": [
""
],
"Remove this product from the order.": [
""
],
"Total price": [
""
],
"total product price added up": [
""
],
"Amount to be paid by the customer": [
""
],
"Order price": [
""
],
"final order price": [
""
],
"Summary": [
""
],
"Title of the order to be shown to the customer": [
""
],
"Shipping and Fulfillment": [
""
],
"Delivery date": [
""
],
"Deadline for physical delivery assured by the merchant.": [
""
],
"Location": [
""
],
"address where the products will be delivered": [
""
],
"Fulfillment URL": [
""
],
"URL to which the user will be redirected after successful payment.": [
""
],
"Taler payment options": [
""
],
"Override default Taler payment settings for this order": [
""
],
"Payment deadline": [
""
],
"Deadline for the customer to pay for the offer before it expires. Inventory products will be reserved until this deadline.": [
""
],
"Refund deadline": [
""
],
"Time until which the order can be refunded by the merchant.": [
""
],
"Wire transfer deadline": [
""
],
"Deadline for the exchange to make the wire transfer.": [
""
],
"Auto-refund deadline": [
""
],
"Time until which the wallet will automatically check for refunds without user interaction.": [
""
],
"Maximum deposit fee": [
""
],
"Maximum deposit fees the merchant is willing to cover for this order. Higher deposit fees must be covered in full by the consumer.": [
""
],
"Maximum wire fee": [
""
],
"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.": [
""
],
"Wire fee amortization": [
""
],
"Factor by which wire fees exceeding the above threshold are divided to determine the share of excess wire fees to be paid explicitly by the consumer.": [
""
],
"Create token": [
""
],
"Uncheck this option if the merchant backend generated an order ID with enough entropy to prevent adversarial claims.": [
""
],
"Minimum age required": [
""
],
"Any value greater than 0 will limit the coins able be used to pay this contract. If empty the age restriction will be defined by the products": [
""
],
"Min age defined by the producs is %1$s": [
""
],
"Additional information": [
""
],
"Custom information to be included in the contract for this order.": [
""
],
"You must enter a value in JavaScript Object Notation (JSON).": [
""
],
"days": [
""
],
"hours": [
""
],
"minutes": [
""
],
"seconds": [
""
],
"forever": [
""
],
"%1$sM": [
""
],
"%1$sY": [
""
],
"%1$sd": [
""
],
"%1$sh": [
""
],
"%1$smin": [
""
],
"%1$ssec": [
""
],
"Orders": [
""
],
"create order": [
""
],
"load newer orders": [
""
],
"Date": [
""
],
"Refund": [
""
],
"copy url": [
""
],
"load older orders": [
""
],
"No orders have been found matching your query!": [
""
],
"duplicated": [
""
],
"invalid format": [
""
],
"this value exceed the refundable amount": [
""
],
"date": [
""
],
"amount": [
""
],
"reason": [
""
],
"amount to be refunded": [
""
],
"Max refundable:": [
""
],
"Reason": [
""
],
"Choose one...": [
""
],
"requested by the customer": [
""
],
"other": [
""
],
"why this order is being refunded": [
""
],
"more information to give context": [
""
],
"Contract Terms": [
""
],
"human-readable description of the whole purchase": [
""
],
"total price for the transaction": [
""
],
"URL for this purchase": [
""
],
"Max fee": [
""
],
"maximum total deposit fee accepted by the merchant for this contract": [
""
],
"Max wire fee": [
""
],
"maximum wire fee accepted by the merchant": [
""
],
"over how many customer transactions does the merchant expect to amortize wire fees on average": [
""
],
"Created at": [
""
],
"time when this contract was generated": [
""
],
"after this deadline has passed no refunds will be accepted": [
""
],
"after this deadline, the merchant won't accept payments for the contract": [
""
],
"transfer deadline for the exchange": [
""
],
"time indicating when the order should be delivered": [
""
],
"where the order will be delivered": [
""
],
"Auto-refund delay": [
""
],
"how long the wallet should try to get an automatic refund for the purchase": [
""
],
"Extra info": [
""
],
"extra data that is only interpreted by the merchant frontend": [
""
],
"Order": [
""
],
"claimed": [
""
],
"claimed at": [
""
],
"Timeline": [
""
],
"Payment details": [
""
],
"Order status": [
""
],
"Product list": [
""
],
"paid": [
""
],
"wired": [
""
],
"refunded": [
""
],
"refund order": [
""
],
"not refundable": [
""
],
"refund": [
""
],
"Refunded amount": [
""
],
"Refund taken": [
""
],
"Status URL": [
""
],
"Refund URI": [
""
],
"unpaid": [
""
],
"pay at": [
""
],
"created at": [
""
],
"Order status URL": [
""
],
"Payment URI": [
""
],
"Unknown order status. This is an error, please contact the administrator.": [
""
],
"Back": [
""
],
"refund created successfully": [
""
],
"could not create the refund": [
""
],
"select date to show nearby orders": [
""
],
"order id": [
""
],
"jump to order with the given order ID": [
""
],
"remove all filters": [
""
],
"only show paid orders": [
""
],
"Paid": [
""
],
"only show orders with refunds": [
""
],
"Refunded": [
""
],
"only show orders where customers paid, but wire payments from payment provider are still pending": [
""
],
"Not wired": [
""
],
"clear date filter": [
""
],
"date (YYYY/MM/DD)": [
""
],
"Enter an order id": [
""
],
"order not found": [
""
],
"could not get the order to refund": [
""
],
"Loading...": [
""
],
"click here to configure the stock of the product, leave it as is and the backend will not control stock": [
""
],
"Manage stock": [
""
],
"this product has been configured without stock control": [
""
],
"Infinite": [
""
],
"lost cannot be greater than current and incoming (max %1$s)": [
""
],
"Incoming": [
""
],
"Lost": [
""
],
"Current": [
""
],
"remove stock control for this product": [
""
],
"without stock": [
""
],
"Next restock": [
""
],
"Delivery address": [
""
],
"product identification to use in URLs (for internal use only)": [
""
],
"illustration of the product for customers": [
""
],
"product description for customers": [
""
],
"Age restricted": [
""
],
"is this product restricted for customer below certain age?": [
""
],
"unit describing quantity of product sold (e.g. 2 kilograms, 5 liters, 3 items, 5 meters) for customers": [
""
],
"sale price for customers, including taxes, for above units of the product": [
""
],
"Stock": [
""
],
"product inventory for products with finite supply (for internal use only)": [
""
],
"taxes included in the product price, exposed to customers": [
""
],
"Need to complete marked fields": [
""
],
"could not create product": [
""
],
"Products": [
""
],
"add product to inventory": [
""
],
"Sell": [
""
],
"Profit": [
""
],
"Sold": [
""
],
"free": [
""
],
"go to product update page": [
""
],
"Update": [
""
],
"remove this product from the database": [
""
],
"update the product with new price": [
""
],
"update product with new price": [
""
],
"add more elements to the inventory": [
""
],
"report elements lost in the inventory": [
""
],
"new price for the product": [
""
],
"the are value with errors": [
""
],
"update product with new stock and price": [
""
],
"There is no products yet, add more pressing the + sign": [
""
],
"product updated successfully": [
""
],
"could not update the product": [
""
],
"product delete successfully": [
""
],
"could not delete the product": [
""
],
"Product id:": [
""
],
"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.": [
""
],
"If your system supports RFC 8905, you can do this by opening this URI:": [
""
],
"it should be greater than 0": [
""
],
"must be a valid URL": [
""
],
"Initial balance": [
""
],
"balance prior to deposit": [
""
],
"Exchange URL": [
""
],
"URL of exchange": [
""
],
"Next": [
""
],
"Wire method": [
""
],
"method to use for wire transfer": [
""
],
"Select one wire method": [
""
],
"could not create reserve": [
""
],
"Valid until": [
""
],
"Created balance": [
""
],
"Exchange balance": [
""
],
"Picked up": [
""
],
"Committed": [
""
],
"Account address": [
""
],
"Subject": [
""
],
"Tips": [
""
],
"No tips has been authorized from this reserve": [
""
],
"Authorized": [
""
],
"Expiration": [
""
],
"amount of tip": [
""
],
"Justification": [
""
],
"reason for the tip": [
""
],
"URL after tip": [
""
],
"URL to visit after tip payment": [
""
],
"Reserves not yet funded": [
""
],
"Reserves ready": [
""
],
"add new reserve": [
""
],
"Expires at": [
""
],
"Initial": [
""
],
"delete selected reserve from the database": [
""
],
"authorize new tip from selected reserve": [
""
],
"There is no ready reserves yet, add more pressing the + sign or fund them": [
""
],
"Expected Balance": [
""
],
"could not create the tip": [
""
],
"should not be empty": [
""
],
"should be greater that 0": [
""
],
"can't be empty": [
""
],
"to short": [
""
],
"just letters and numbers from 2 to 7": [
""
],
"size of the key should be 32": [
""
],
"Identifier": [
""
],
"Name of the template in URLs.": [
""
],
"Describe what this template stands for": [
""
],
"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": [
""
],
"Is this contract restricted to some age?": [
""
],
"Payment timeout": [
""
],
"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": [
""
],
"Amount is required": [
""
],
"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": [
""
],
"add new templates": [
""
],
"load more templates before the first one": [
""
],
"load newer templates": [
""
],
"delete selected templates from the database": [
""
],
"use template to create new order": [
""
],
"create qr code for the template": [
""
],
"load more templates after the last one": [
""
],
"load older templates": [
""
],
"There is no templates yet, add more pressing the + sign": [
""
],
"template delete successfully": [
""
],
"could not delete the template": [
""
],
"could not update template": [
""
],
"should be one of '%1$s'": [
""
],
"Webhook ID to use": [
""
],
"Event": [
""
],
"The event of the webhook: why the webhook is used": [
""
],
"Method": [
""
],
"Method used by the webhook": [
""
],
"URL": [
""
],
"URL of the webhook where the customer will be redirected": [
""
],
"Header": [
""
],
"Header template of the webhook": [
""
],
"Body": [
""
],
"Body template by the webhook": [
""
],
"Webhooks": [
""
],
"add new webhooks": [
""
],
"load more webhooks before the first one": [
""
],
"load newer webhooks": [
""
],
"Event type": [
""
],
"delete selected webhook from the database": [
""
],
"load more webhooks after the last one": [
""
],
"load older webhooks": [
""
],
"There is no webhooks yet, add more pressing the + sign": [
""
],
"webhook delete successfully": [
""
],
"could not delete the webhook": [
""
],
"check the id, does not look valid": [
""
],
"should have 52 characters, current %1$s": [
""
],
"URL doesn't have the right format": [
""
],
"Credited bank account": [
""
],
"Select one account": [
""
],
"Bank account of the merchant where the payment was received": [
""
],
"Wire transfer ID": [
""
],
"unique identifier of the wire transfer used by the exchange, must be 52 characters long": [
""
],
"Base URL of the exchange that made the transfer, should have been in the wire transfer subject": [
""
],
"Amount credited": [
""
],
"Actual amount that was wired to the merchant's bank account": [
""
],
"could not inform transfer": [
""
],
"Transfers": [
""
],
"add new transfer": [
""
],
"load more transfers before the first one": [
""
],
"load newer transfers": [
""
],
"Credit": [
""
],
"Confirmed": [
""
],
"Verified": [
""
],
"Executed at": [
""
],
"yes": [
""
],
"no": [
""
],
"unknown": [
""
],
"delete selected transfer from the database": [
""
],
"load more transfer after the last one": [
""
],
"load older transfers": [
""
],
"There is no transfer yet, add more pressing the + sign": [
""
],
"filter by account address": [
""
],
"only show wire transfers confirmed by the merchant": [
""
],
"only show wire transfers claimed by the exchange": [
""
],
"Unverified": [
""
],
"is not valid": [
""
],
"is not a number": [
""
],
"must be 1 or greater": [
""
],
"max 7 lines": [
""
],
"change authorization configuration": [
""
],
"Need to complete marked fields and choose authorization method": [
""
],
"This is not a valid bitcoin address.": [
""
],
"This is not a valid Ethereum address.": [
""
],
"IBAN numbers usually have more that 4 digits": [
""
],
"IBAN numbers usually have less that 34 digits": [
""
],
"IBAN country code not found": [
""
],
"IBAN number is not valid, checksum is wrong": [
""
],
"Target type": [
""
],
"Method to use for wire transfer": [
""
],
"Routing": [
""
],
"Routing number.": [
""
],
"Account": [
""
],
"Account number.": [
""
],
"Business Identifier Code.": [
""
],
"Bank Account Number.": [
""
],
"Unified Payment Interface.": [
""
],
"Bitcoin protocol.": [
""
],
"Ethereum protocol.": [
""
],
"Interledger protocol.": [
""
],
"Host": [
""
],
"Bank host.": [
""
],
"Bank account.": [
""
],
"Bank account owner's name.": [
""
],
"No accounts yet.": [
""
],
"Name of the instance in URLs. The 'default' instance is special in that it is used to administer other instances.": [
""
],
"Business name": [
""
],
"Legal name of the business represented by this instance.": [
""
],
"Email": [
""
],
"Contact email": [
""
],
"Website URL": [
""
],
"URL.": [
""
],
"Logo": [
""
],
"Logo image.": [
""
],
"Bank account": [
""
],
"URI specifying bank account for crediting revenue.": [
""
],
"Default max deposit fee": [
""
],
"Maximum deposit fees this merchant is willing to pay per order by default.": [
""
],
"Default max wire fee": [
""
],
"Maximum wire fees this merchant is willing to pay per wire transfer by default.": [
""
],
"Default wire fee amortization": [
""
],
"Number of orders excess wire transfer fees will be divided by to compute per order surcharge.": [
""
],
"Physical location of the merchant.": [
""
],
"Jurisdiction": [
""
],
"Jurisdiction for legal disputes with the merchant.": [
""
],
"Default payment delay": [
""
],
"Time customers have to pay an order before the offer expires by default.": [
""
],
"Default wire transfer delay": [
""
],
"Maximum time an exchange is allowed to delay wiring funds to the merchant, enabling it to aggregate smaller payments into larger wire transfers and reducing wire fees.": [
""
],
"Instance id": [
""
],
"Change the authorization method use for this instance.": [
""
],
"Manage access token": [
""
],
"Failed to create instance": [
""
],
"Login required": [
""
],
"Please enter your access token.": [
""
],
"Access Token": [
""
],
"The request to the backend take too long and was cancelled": [
""
],
'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": [
""
],
"The access token provided is invalid.": [
""
],
"No 'default' instance configured yet.": [
""
],
"Create a 'default' instance to begin using the merchant backoffice.": [
""
],
"The access token provided is invalid": [
""
],
"Hide for today": [
""
],
"Instance": [
""
],
"Settings": [
""
],
"Connection": [
""
],
"New": [
""
],
"List": [
""
],
"Log out": [
""
],
"Check your token is valid": [
""
],
"Couldn't access the server.": [
""
],
"Could not infer instance id from url %1$s": [
""
],
"Server not found": [
""
],
"Server response with an error code": [
""
],
"Got message %1$s from %2$s": [
""
],
"Response from server is unreadable, http status: %1$s": [
""
],
"Unexpected Error": [
""
],
"The value %1$s is invalid for a payment url": [
""
],
"add element to the list": [
""
],
"add": [
""
],
"Deleting": [
""
],
"Changing": [
""
],
"Order ID": [
""
],
"Payment URL": [
""
]
}
}
};
strings["es"] = {
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages",
"plural_forms": "nplurals=2; plural=n != 1;",
"lang": "es"
},
"Cancel": [
"Cancelar"
],
"%1$s": [
"%1$s"
],
"Close": [
""
],
"Continue": [
"Continuar"
],
"Clear": [
"Limpiar"
],
"Confirm": [
"Confirmar"
],
"is not the same as the current access token": [
"no es el mismo que el token de acceso actual"
],
"cannot be empty": [
"no puede ser vac\xEDo"
],
"cannot be the same as the old token": [
"no puede ser igual al viejo token"
],
"is not the same": [
"no son iguales"
],
"You are updating the access token from instance with 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 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 acceso significa acceso p\xFAblico a la instancia"
],
"cannot be the same as the old access token": [
"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": [
"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"
],
"Delete": [
"Eliminar"
],
"add new instance": [
"agregar nueva instancia"
],
"ID": [
"ID"
],
"Name": [
"Nombre"
],
"Edit": [
"Editar"
],
"Purge": [
"Purgar"
],
"There is no instances yet, add more pressing the + sign": [
"Todav\xEDa no hay instancias, agregue m\xE1s presionando el signo +"
],
"Only show active instances": [
"Solo mostrar instancias activas"
],
"Active": [
"Activo"
],
"Only show deleted instances": [
"Mostrar solo instancias eliminadas"
],
"Deleted": [
"Eliminado"
],
"Show all instances": [
"Mostrar todas las instancias"
],
"All": [
"Todo"
],
'Instance "%1$s" (ID: %2$s) has been deleted': [
"La instancia '%1$s' (ID: %2$s) fue eliminada"
],
"Failed to delete instance": [
"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": [
"Fallo al purgar la instancia"
],
"Pending KYC verification": [
"Verificaci\xF3n KYC pendiente"
],
"Timed out": [
"Expirado"
],
"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": [
"cambiar valor a vac\xEDo"
],
"clear": [
"limpiar"
],
"change value to never": [
"cambiar valor a nunca"
],
"never": [
"nunca"
],
"Country": [
"Pa\xEDs"
],
"Address": [
"Direcci\xF3n"
],
"Building number": [
"N\xFAmero de edificio"
],
"Building name": [
"Nombre de edificio"
],
"Street": [
"Calle"
],
"Post code": [
"C\xF3digo postal"
],
"Town location": [
"Ubicaci\xF3n de ciudad"
],
"Town": [
"Ciudad"
],
"District": [
"Distrito"
],
"Country subdivision": [
"Subdivisi\xF3n de pa\xEDs"
],
"Product id": [
"Id de producto"
],
"Description": [
"Descripcion"
],
"Product": [
"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 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!": [
"\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"
],
"Add": [
"Agregar"
],
"Remove": [
"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".": [
"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": [
"Complete informaci\xF3n del producto"
],
"Image": [
"Imagen"
],
"photo of the product": [
"foto del producto"
],
"full product description": [
"descripci\xF3n completa del producto"
],
"Unit": [
"Unidad"
],
"name of the product unit": [
"nombre de la unidad del producto"
],
"Price": [
"Precio"
],
"amount in the current currency": [
"monto de la divisa actual"
],
"Taxes": [
"Impuestos"
],
"image": [
"imagen"
],
"description": [
"descripci\xF3n"
],
"quantity": [
"cantidad"
],
"unit price": [
"precio unitario"
],
"total price": [
"precio total"
],
"required": [
"requerido"
],
"not valid": [
"no es un json v\xE1lido"
],
"must be greater than 0": [
"debe ser mayor que 0"
],
"not a valid json": [
"no es un json v\xE1lido"
],
"should be in the future": [
"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": [
"deber\xEDa tener un plazo de reembolso"
],
"auto refund cannot be after refund deadline": [
"reembolso autom\xE1tico no puede ser despu\xE9s qu el plazo de reembolso"
],
"Manage products in order": [
"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": [
"Monto a ser pagado por el cliente"
],
"Order price": [
"Precio de la orden"
],
"final order price": [
"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 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 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": [
"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": [
"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": [
"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.": [
""
],
"Wire fee amortization": [
"Amortizaci\xF3n de comisi\xF3n de transferencia"
],
"Factor by which wire fees exceeding the above threshold are divided to determine the share of excess wire fees to be paid explicitly by the consumer.": [
""
],
"Create token": [
"Administrar token"
],
"Uncheck this option if the merchant backend generated an order ID with enough entropy to prevent adversarial claims.": [
""
],
"Minimum age required": [
"Login necesario"
],
"Any value greater than 0 will limit the coins able be used to pay this contract. If empty the age restriction will be defined by the products": [
""
],
"Min age defined by the producs is %1$s": [
""
],
"Additional information": [
"Informaci\xF3n extra"
],
"Custom information to be included in the contract for this order.": [
""
],
"You must enter a value in JavaScript Object Notation (JSON).": [
""
],
"days": [
"d\xEDas"
],
"hours": [
"horas"
],
"minutes": [
"minutos"
],
"seconds": [
"segundos"
],
"forever": [
"nunca"
],
"%1$sM": [
""
],
"%1$sY": [
""
],
"%1$sd": [
""
],
"%1$sh": [
""
],
"%1$smin": [
""
],
"%1$ssec": [
""
],
"Orders": [
"\xD3rdenes"
],
"create order": [
"creado"
],
"load newer orders": [
"cargar nuevas ordenes"
],
"Date": [
"Fecha"
],
"Refund": [
"Devoluci\xF3n"
],
"copy url": [
"copiar url"
],
"load older orders": [
"cargar viejas ordenes"
],
"No orders have been found matching your query!": [
"\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"
],
"amount": [
"monto"
],
"reason": [
"raz\xF3n"
],
"amount to be refunded": [
"monto a ser reembolsado"
],
"Max refundable:": [
"M\xE1ximo reembolzable:"
],
"Reason": [
"Raz\xF3n"
],
"Choose one...": [
"Elija uno..."
],
"requested by the customer": [
"pedido por el consumidor"
],
"other": [
"otro"
],
"why this order is being refunded": [
"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"
],
"maximum total deposit fee accepted by the merchant for this contract": [
""
],
"Max wire fee": [
"Impuesto de transferencia m\xE1ximo"
],
"maximum wire fee accepted by the merchant": [
""
],
"over how many customer transactions does the merchant expect to amortize wire fees on average": [
""
],
"Created at": [
"Creado en"
],
"time when this contract was generated": [
""
],
"after this deadline has passed no refunds will be accepted": [
""
],
"after this deadline, the merchant won't accept payments for the contract": [
""
],
"transfer deadline for the exchange": [
""
],
"time indicating when the order should be delivered": [
""
],
"where the order will be delivered": [
""
],
"Auto-refund delay": [
"Plazo de reembolso autom\xE1tico"
],
"how long the wallet should try to get an automatic refund for the purchase": [
""
],
"Extra info": [
"Informaci\xF3n extra"
],
"extra data that is only interpreted by the merchant frontend": [
""
],
"Order": [
"Orden"
],
"claimed": [
"reclamado"
],
"claimed at": [
"reclamado"
],
"Timeline": [
"Cronolog\xEDa"
],
"Payment details": [
"Detalles de pago"
],
"Order status": [
"Estado de orden"
],
"Product list": [
"Lista de producto"
],
"paid": [
"pagados"
],
"wired": [
"transferido"
],
"refunded": [
"reembolzado"
],
"refund order": [
"reembolzado"
],
"not refundable": [
"M\xE1ximo reembolzable:"
],
"refund": [
"reembolzar"
],
"Refunded amount": [
"Monto reembolzado"
],
"Refund taken": [
"Reembolzado"
],
"Status URL": [
"URL de estado de orden"
],
"Refund URI": [
"Devoluci\xF3n"
],
"unpaid": [
"impago"
],
"pay at": [
"pagar en"
],
"created at": [
"creado"
],
"Order status URL": [
"URL de estado de orden"
],
"Payment URI": [
"URI de pago"
],
"Unknown order status. This is an error, please contact the administrator.": [
"Estado de orden desconocido. Esto es un error, por favor contacte a su administrador."
],
"Back": [
""
],
"refund created successfully": [
"reembolzo creado satisfactoriamente"
],
"could not create the refund": [
"No se pudo create el reembolso"
],
"select date to show nearby orders": [
""
],
"order id": [
"ir a id de orden"
],
"jump to order with the given order ID": [
""
],
"remove all filters": [
""
],
"only show paid orders": [
""
],
"Paid": [
"Pagado"
],
"only show orders with refunds": [
"No se pudo create el reembolso"
],
"Refunded": [
"Reembolzado"
],
"only show orders where customers paid, but wire payments from payment provider are still pending": [
""
],
"Not wired": [
"No transferido"
],
"clear date filter": [
""
],
"date (YYYY/MM/DD)": [
""
],
"Enter an order id": [
"ir a id de orden"
],
"order not found": [
"Servidor no encontrado"
],
"could not get the order to refund": [
"No se pudo create el reembolso"
],
"Loading...": [
"Cargando..."
],
"click here to configure the stock of the product, leave it as is and the backend will not control stock": [
""
],
"Manage stock": [
"Administrar stock"
],
"this product has been configured without stock control": [
""
],
"Infinite": [
"Inifinito"
],
"lost cannot be greater than current and incoming (max %1$s)": [
"la p\xE9rdida no puede ser mayor al stock actual + entrante (max %1$s )"
],
"Incoming": [
"Ingresando"
],
"Lost": [
"Perdido"
],
"Current": [
"Actual"
],
"remove stock control for this product": [
""
],
"without stock": [
"sin stock"
],
"Next restock": [
"Pr\xF3ximo reabastecimiento"
],
"Delivery address": [
"Direcci\xF3n de entrega"
],
"product identification to use in URLs (for internal use only)": [
""
],
"illustration of the product for customers": [
""
],
"product description for customers": [
""
],
"Age restricted": [
""
],
"is this product restricted for customer below certain age?": [
""
],
"unit describing quantity of product sold (e.g. 2 kilograms, 5 liters, 3 items, 5 meters) for customers": [
""
],
"sale price for customers, including taxes, for above units of the product": [
""
],
"Stock": [
"Existencias"
],
"product inventory for products with finite supply (for internal use only)": [
""
],
"taxes included in the product price, exposed to customers": [
""
],
"Need to complete marked fields": [
""
],
"could not create product": [
"no se pudo crear el producto"
],
"Products": [
"Productos"
],
"add product to inventory": [
""
],
"Sell": [
"Venta"
],
"Profit": [
"Ganancia"
],
"Sold": [
"Vendido"
],
"free": [
"Gratis"
],
"go to product update page": [
"producto actualizado correctamente"
],
"Update": [
"Actualizar"
],
"remove this product from the database": [
""
],
"update the product with new price": [
""
],
"update product with new price": [
""
],
"add more elements to the inventory": [
""
],
"report elements lost in the inventory": [
""
],
"new price for the product": [
"no se pudo actualizar el producto"
],
"the are value with errors": [
""
],
"update product with new stock and price": [
""
],
"There is no products yet, add more pressing the + sign": [
"No hay propinas todav\xEDa, agregar mas presionando el signo +"
],
"product updated successfully": [
"producto actualizado correctamente"
],
"could not update the product": [
"no se pudo actualizar el producto"
],
"product delete successfully": [
"producto fue eliminado correctamente"
],
"could not delete the product": [
"no se pudo eliminar el producto"
],
"Product id:": [
"Id de producto"
],
"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.": [
""
],
"If your system supports RFC 8905, you can do this by opening this URI:": [
""
],
"it should be greater than 0": [
"Debe ser mayor a 0"
],
"must be a valid URL": [
""
],
"Initial balance": [
"Instancia"
],
"balance prior to deposit": [
""
],
"Exchange URL": [
"URL del Exchange"
],
"URL of exchange": [
""
],
"Next": [
"Siguiente"
],
"Wire method": [
""
],
"method to use for wire transfer": [
"no se pudo informar la transferencia"
],
"Select one wire method": [
""
],
"could not create reserve": [
"No se pudo create el reembolso"
],
"Valid until": [
"V\xE1lido hasta"
],
"Created balance": [
"creado"
],
"Exchange balance": [
"Monto inicial"
],
"Picked up": [
""
],
"Committed": [
"Monto confirmado"
],
"Account address": [
"Direcci\xF3n de cuenta"
],
"Subject": [
"Asunto"
],
"Tips": [
"Propinas"
],
"No tips has been authorized from this reserve": [
""
],
"Authorized": [
"Token de autorizaci\xF3n"
],
"Expiration": [
"Informaci\xF3n extra"
],
"amount of tip": [
"monto"
],
"Justification": [
"Jurisdicci\xF3n"
],
"reason for the tip": [
""
],
"URL after tip": [
""
],
"URL to visit after tip payment": [
""
],
"Reserves not yet funded": [
"Servidor no encontrado"
],
"Reserves ready": [
""
],
"add new reserve": [
"cargar nuevas transferencias"
],
"Expires at": [
""
],
"Initial": [
""
],
"delete selected reserve from the database": [
""
],
"authorize new tip from selected reserve": [
""
],
"There is no ready reserves yet, add more pressing the + sign or fund them": [
"No hay transferencias todav\xEDa, agregar mas presionando el signo +"
],
"Expected Balance": [
"Ejecutado en"
],
"could not create the tip": [
"No se pudo create el reembolso"
],
"should not be empty": [
"no puede ser vac\xEDo"
],
"should be greater that 0": [
"Debe ser mayor a 0"
],
"can't be empty": [
"no puede ser vac\xEDo"
],
"to short": [
""
],
"just letters and numbers from 2 to 7": [
""
],
"size of the key should be 32": [
""
],
"Identifier": [
""
],
"Name of the template in URLs.": [
""
],
"Describe what this template stands for": [
""
],
"Fixed summary": [
"Estado de orden"
],
"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?": [
""
],
"Payment timeout": [
"Opciones de pago"
],
"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"
],
"Amount is required": [
"Login necesario"
],
"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": [
""
],
"add new templates": [
""
],
"load more templates before the first one": [
""
],
"load newer templates": [
"cargar nuevas transferencias"
],
"delete selected templates from the database": [
""
],
"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": [
""
],
"load older templates": [
"cargar viejas transferencias"
],
"There is no templates yet, add more pressing the + sign": [
"No hay propinas todav\xEDa, agregar mas presionando el signo +"
],
"template delete successfully": [
"producto fue eliminado correctamente"
],
"could not delete the template": [
"no se pudo eliminar el producto"
],
"could not update template": [
"no se pudo actualizar el producto"
],
"should be one of '%1$s'": [
"deber\xEDan ser iguales"
],
"Webhook ID to use": [
""
],
"Event": [
""
],
"The event of the webhook: why the webhook is used": [
""
],
"Method": [
""
],
"Method used by the webhook": [
""
],
"URL": [
"URL"
],
"URL of the webhook where the customer will be redirected": [
""
],
"Header": [
""
],
"Header template of the webhook": [
""
],
"Body": [
""
],
"Body template by the webhook": [
""
],
"Webhooks": [
""
],
"add new webhooks": [
""
],
"load more webhooks before the first one": [
""
],
"load newer webhooks": [
"cargar nuevas ordenes"
],
"Event type": [
""
],
"delete selected webhook from the database": [
""
],
"load more webhooks after the last one": [
""
],
"load older webhooks": [
"cargar viejas ordenes"
],
"There is no webhooks yet, add more pressing the + sign": [
"No hay propinas todav\xEDa, agregar mas presionando el signo +"
],
"webhook delete successfully": [
"producto fue eliminado correctamente"
],
"could not delete the webhook": [
"no se pudo eliminar el producto"
],
"check the id, does not look valid": [
"verificar el id, no parece v\xE1lido"
],
"should have 52 characters, current %1$s": [
"deber\xEDa tener 52 caracteres, actualmente %1$s"
],
"URL doesn't have the right format": [
"La URL no tiene el formato correcto"
],
"Credited bank account": [
""
],
"Select one account": [
""
],
"Bank account of the merchant where the payment was received": [
""
],
"Wire transfer ID": [
"Id de transferencia"
],
"unique identifier of the wire transfer used by the exchange, must be 52 characters long": [
""
],
"Base URL of the exchange that made the transfer, should have been in the wire transfer subject": [
""
],
"Amount credited": [
""
],
"Actual amount that was wired to the merchant's bank account": [
""
],
"could not inform transfer": [
"no se pudo informar la transferencia"
],
"Transfers": [
"Transferencias"
],
"add new transfer": [
"cargar nuevas transferencias"
],
"load more transfers before the first one": [
""
],
"load newer transfers": [
"cargar nuevas transferencias"
],
"Credit": [
"Cr\xE9dito"
],
"Confirmed": [
"Confirmado"
],
"Verified": [
"Verificado"
],
"Executed at": [
"Ejecutado en"
],
"yes": [
"si"
],
"no": [
"no"
],
"unknown": [
"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"
],
"There is no transfer yet, add more pressing the + sign": [
"No hay transferencias todav\xEDa, agregar mas presionando el signo +"
],
"filter by account address": [
"Direcci\xF3n de cuenta"
],
"only show wire transfers confirmed by the merchant": [
""
],
"only show wire transfers claimed by the exchange": [
""
],
"Unverified": [
"Verificado"
],
"is not valid": [
""
],
"is not a number": [
"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": [
"M\xE9todo a usar para la transferencia"
],
"Routing": [
"Enrutamiento"
],
"Routing number.": [
"N\xFAmero de enrutamiento."
],
"Account": [
"Cuenta"
],
"Account number.": [
"Direcci\xF3n de cuenta"
],
"Business Identifier Code.": [
""
],
"Bank Account Number.": [
""
],
"Unified Payment Interface.": [
"Interfaz de pago unificado."
],
"Bitcoin protocol.": [
""
],
"Ethereum protocol.": [
""
],
"Interledger protocol.": [
""
],
"Host": [
""
],
"Bank host.": [
""
],
"Bank account.": [
""
],
"Bank account owner's name.": [
""
],
"No accounts yet.": [
""
],
"Name of the instance in URLs. The 'default' instance is special in that it is used to administer other instances.": [
""
],
"Business name": [
"Nombre de edificio"
],
"Legal name of the business represented by this instance.": [
""
],
"Email": [
""
],
"Contact email": [
""
],
"Website URL": [
"URL de sitio web"
],
"URL.": [
""
],
"Logo": [
""
],
"Logo image.": [
""
],
"Bank account": [
"Cuenta bancaria"
],
"URI specifying bank account for crediting revenue.": [
""
],
"Default max deposit fee": [
"Impuesto m\xE1ximo de deposito por omisi\xF3n"
],
"Maximum deposit fees this merchant is willing to pay per order by default.": [
""
],
"Default max wire fee": [
"Impuesto m\xE1ximo de transferencia por omisi\xF3n"
],
"Maximum wire fees this merchant is willing to pay per wire transfer by default.": [
""
],
"Default wire fee amortization": [
"Amortizaci\xF3n de impuesto de transferencia por omisi\xF3n"
],
"Number of orders excess wire transfer fees will be divided by to compute per order surcharge.": [
""
],
"Physical location of the merchant.": [
""
],
"Jurisdiction": [
"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"
],
"Time customers have to pay an order before the offer expires by default.": [
""
],
"Default wire transfer delay": [
"Retrazo de transferencia por omisi\xF3n"
],
"Maximum time an exchange is allowed to delay wiring funds to the merchant, enabling it to aggregate smaller payments into larger wire transfers and reducing wire fees.": [
""
],
"Instance id": [
"ID de instancia"
],
"Change the authorization method use for this instance.": [
"Limpiar el token de autorizaci\xF3n significa acceso p\xFAblico a la instancia"
],
"Manage access token": [
"Administrar token de acceso"
],
"Failed to create instance": [
"Fallo al crear la instancia"
],
"Login required": [
"Login necesario"
],
"Please enter your access token.": [
""
],
"Access Token": [
"Acceso denegado"
],
"The request to the backend take too long and was cancelled": [
""
],
'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"
],
"The access token provided is invalid.": [
""
],
"No 'default' instance configured yet.": [
"Sin instancia default"
],
"Create a 'default' instance to begin using the merchant backoffice.": [
""
],
"The access token provided is invalid": [
""
],
"Hide for today": [
""
],
"Instance": [
"Instancia"
],
"Settings": [
"Configuraci\xF3n"
],
"Connection": [
"Conexi\xF3n"
],
"New": [
"Nuevo"
],
"List": [
"Lista"
],
"Log out": [
"Salir"
],
"Check your token is valid": [
"Verifica que el token sea valido"
],
"Couldn't access the server.": [
"No se pudo acceder al servidor."
],
"Could not infer instance id from url %1$s": [
"No se pudo inferir el id de la instancia con la url %1$s"
],
"Server not found": [
"Servidor no encontrado"
],
"Server response with an error code": [
""
],
"Got message %1$s from %2$s": [
"Recibimos el mensaje %1$s desde %2$s"
],
"Response from server is unreadable, http status: %1$s": [
""
],
"Unexpected Error": [
"Error inesperado"
],
"The value %1$s is invalid for a payment url": [
"El valor %1$s es invalido para una URL de pago"
],
"add element to the list": [
"agregar elemento a la lista"
],
"add": [
"Agregar"
],
"Deleting": [
"Borrando"
],
"Changing": [
"Cambiando"
],
"Order ID": [
"ID de pedido"
],
"Payment URL": [
"URL de pago"
]
}
}
};
strings["fr"] = {
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages",
"plural_forms": "nplurals=2; plural=(n != 1);",
"lang": ""
},
"Cancel": [
""
],
"%1$s": [
""
],
"Close": [
""
],
"Continue": [
""
],
"Clear": [
""
],
"Confirm": [
""
],
"is not the same as the current access token": [
""
],
"cannot be empty": [
""
],
"cannot be the same as the old token": [
""
],
"is not the same": [
""
],
"You are updating the access token from instance with id %1$s": [
""
],
"Old access token": [
""
],
"access token currently in use": [
""
],
"New access token": [
""
],
"next access token to be used": [
""
],
"Repeat access token": [
""
],
"confirm the same access token": [
""
],
"Clearing the access token will mean public access to the instance": [
""
],
"cannot be the same as the old access token": [
""
],
"You are setting the access token for the new instance": [
""
],
"With external authorization method no check will be done by the merchant backend": [
""
],
"Set external authorization": [
""
],
"Set access token": [
""
],
"Operation in progress...": [
""
],
"The operation will be automatically canceled after %1$s seconds": [
""
],
"Instances": [
""
],
"Delete": [
""
],
"add new instance": [
""
],
"ID": [
""
],
"Name": [
""
],
"Edit": [
""
],
"Purge": [
""
],
"There is no instances yet, add more pressing the + sign": [
""
],
"Only show active instances": [
""
],
"Active": [
""
],
"Only show deleted instances": [
""
],
"Deleted": [
""
],
"Show all instances": [
""
],
"All": [
""
],
'Instance "%1$s" (ID: %2$s) has been deleted': [
""
],
"Failed to delete instance": [
""
],
"Instance '%1$s' (ID: %2$s) has been disabled": [
""
],
"Failed to purge instance": [
""
],
"Pending KYC verification": [
""
],
"Timed out": [
""
],
"Exchange": [
""
],
"Target account": [
""
],
"KYC URL": [
""
],
"Code": [
""
],
"Http Status": [
""
],
"No pending kyc verification!": [
""
],
"change value to unknown date": [
""
],
"change value to empty": [
""
],
"clear": [
""
],
"change value to never": [
""
],
"never": [
""
],
"Country": [
""
],
"Address": [
""
],
"Building number": [
""
],
"Building name": [
""
],
"Street": [
""
],
"Post code": [
""
],
"Town location": [
""
],
"Town": [
""
],
"District": [
""
],
"Country subdivision": [
""
],
"Product id": [
""
],
"Description": [
""
],
"Product": [
""
],
"search products by it's description or id": [
""
],
"no products found with that description": [
""
],
"You must enter a valid product identifier.": [
""
],
"Quantity must be greater than 0!": [
""
],
"This quantity exceeds remaining stock. Currently, only %1$s units remain unreserved in stock.": [
""
],
"Quantity": [
""
],
"how many products will be added": [
""
],
"Add from inventory": [
""
],
"Image should be smaller than 1 MB": [
""
],
"Add": [
""
],
"Remove": [
""
],
"No taxes configured for this product.": [
""
],
"Amount": [
""
],
"Taxes can be in currencies that differ from the main currency used by the merchant.": [
""
],
"Enter currency and value separated with a colon, e.g. "USD:2.3".": [
""
],
"Legal name of the tax, e.g. VAT or import duties.": [
""
],
"add tax to the tax list": [
""
],
"describe and add a product that is not in the inventory list": [
""
],
"Add custom product": [
""
],
"Complete information of the product": [
""
],
"Image": [
""
],
"photo of the product": [
""
],
"full product description": [
""
],
"Unit": [
""
],
"name of the product unit": [
""
],
"Price": [
""
],
"amount in the current currency": [
""
],
"Taxes": [
""
],
"image": [
""
],
"description": [
""
],
"quantity": [
""
],
"unit price": [
""
],
"total price": [
""
],
"required": [
""
],
"not valid": [
""
],
"must be greater than 0": [
""
],
"not a valid json": [
""
],
"should be in the future": [
""
],
"refund deadline cannot be before pay deadline": [
""
],
"wire transfer deadline cannot be before refund deadline": [
""
],
"wire transfer deadline cannot be before pay deadline": [
""
],
"should have a refund deadline": [
""
],
"auto refund cannot be after refund deadline": [
""
],
"Manage products in order": [
""
],
"Manage list of products in the order.": [
""
],
"Remove this product from the order.": [
""
],
"Total price": [
""
],
"total product price added up": [
""
],
"Amount to be paid by the customer": [
""
],
"Order price": [
""
],
"final order price": [
""
],
"Summary": [
""
],
"Title of the order to be shown to the customer": [
""
],
"Shipping and Fulfillment": [
""
],
"Delivery date": [
""
],
"Deadline for physical delivery assured by the merchant.": [
""
],
"Location": [
""
],
"address where the products will be delivered": [
""
],
"Fulfillment URL": [
""
],
"URL to which the user will be redirected after successful payment.": [
""
],
"Taler payment options": [
""
],
"Override default Taler payment settings for this order": [
""
],
"Payment deadline": [
""
],
"Deadline for the customer to pay for the offer before it expires. Inventory products will be reserved until this deadline.": [
""
],
"Refund deadline": [
""
],
"Time until which the order can be refunded by the merchant.": [
""
],
"Wire transfer deadline": [
""
],
"Deadline for the exchange to make the wire transfer.": [
""
],
"Auto-refund deadline": [
""
],
"Time until which the wallet will automatically check for refunds without user interaction.": [
""
],
"Maximum deposit fee": [
""
],
"Maximum deposit fees the merchant is willing to cover for this order. Higher deposit fees must be covered in full by the consumer.": [
""
],
"Maximum wire fee": [
""
],
"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.": [
""
],
"Wire fee amortization": [
""
],
"Factor by which wire fees exceeding the above threshold are divided to determine the share of excess wire fees to be paid explicitly by the consumer.": [
""
],
"Create token": [
""
],
"Uncheck this option if the merchant backend generated an order ID with enough entropy to prevent adversarial claims.": [
""
],
"Minimum age required": [
""
],
"Any value greater than 0 will limit the coins able be used to pay this contract. If empty the age restriction will be defined by the products": [
""
],
"Min age defined by the producs is %1$s": [
""
],
"Additional information": [
""
],
"Custom information to be included in the contract for this order.": [
""
],
"You must enter a value in JavaScript Object Notation (JSON).": [
""
],
"days": [
""
],
"hours": [
""
],
"minutes": [
""
],
"seconds": [
""
],
"forever": [
""
],
"%1$sM": [
""
],
"%1$sY": [
""
],
"%1$sd": [
""
],
"%1$sh": [
""
],
"%1$smin": [
""
],
"%1$ssec": [
""
],
"Orders": [
""
],
"create order": [
""
],
"load newer orders": [
""
],
"Date": [
""
],
"Refund": [
""
],
"copy url": [
""
],
"load older orders": [
""
],
"No orders have been found matching your query!": [
""
],
"duplicated": [
""
],
"invalid format": [
""
],
"this value exceed the refundable amount": [
""
],
"date": [
""
],
"amount": [
""
],
"reason": [
""
],
"amount to be refunded": [
""
],
"Max refundable:": [
""
],
"Reason": [
""
],
"Choose one...": [
""
],
"requested by the customer": [
""
],
"other": [
""
],
"why this order is being refunded": [
""
],
"more information to give context": [
""
],
"Contract Terms": [
""
],
"human-readable description of the whole purchase": [
""
],
"total price for the transaction": [
""
],
"URL for this purchase": [
""
],
"Max fee": [
""
],
"maximum total deposit fee accepted by the merchant for this contract": [
""
],
"Max wire fee": [
""
],
"maximum wire fee accepted by the merchant": [
""
],
"over how many customer transactions does the merchant expect to amortize wire fees on average": [
""
],
"Created at": [
""
],
"time when this contract was generated": [
""
],
"after this deadline has passed no refunds will be accepted": [
""
],
"after this deadline, the merchant won't accept payments for the contract": [
""
],
"transfer deadline for the exchange": [
""
],
"time indicating when the order should be delivered": [
""
],
"where the order will be delivered": [
""
],
"Auto-refund delay": [
""
],
"how long the wallet should try to get an automatic refund for the purchase": [
""
],
"Extra info": [
""
],
"extra data that is only interpreted by the merchant frontend": [
""
],
"Order": [
""
],
"claimed": [
""
],
"claimed at": [
""
],
"Timeline": [
""
],
"Payment details": [
""
],
"Order status": [
""
],
"Product list": [
""
],
"paid": [
""
],
"wired": [
""
],
"refunded": [
""
],
"refund order": [
""
],
"not refundable": [
""
],
"refund": [
""
],
"Refunded amount": [
""
],
"Refund taken": [
""
],
"Status URL": [
""
],
"Refund URI": [
""
],
"unpaid": [
""
],
"pay at": [
""
],
"created at": [
""
],
"Order status URL": [
""
],
"Payment URI": [
""
],
"Unknown order status. This is an error, please contact the administrator.": [
""
],
"Back": [
""
],
"refund created successfully": [
""
],
"could not create the refund": [
""
],
"select date to show nearby orders": [
""
],
"order id": [
""
],
"jump to order with the given order ID": [
""
],
"remove all filters": [
""
],
"only show paid orders": [
""
],
"Paid": [
""
],
"only show orders with refunds": [
""
],
"Refunded": [
""
],
"only show orders where customers paid, but wire payments from payment provider are still pending": [
""
],
"Not wired": [
""
],
"clear date filter": [
""
],
"date (YYYY/MM/DD)": [
""
],
"Enter an order id": [
""
],
"order not found": [
""
],
"could not get the order to refund": [
""
],
"Loading...": [
""
],
"click here to configure the stock of the product, leave it as is and the backend will not control stock": [
""
],
"Manage stock": [
""
],
"this product has been configured without stock control": [
""
],
"Infinite": [
""
],
"lost cannot be greater than current and incoming (max %1$s)": [
""
],
"Incoming": [
""
],
"Lost": [
""
],
"Current": [
""
],
"remove stock control for this product": [
""
],
"without stock": [
""
],
"Next restock": [
""
],
"Delivery address": [
""
],
"product identification to use in URLs (for internal use only)": [
""
],
"illustration of the product for customers": [
""
],
"product description for customers": [
""
],
"Age restricted": [
""
],
"is this product restricted for customer below certain age?": [
""
],
"unit describing quantity of product sold (e.g. 2 kilograms, 5 liters, 3 items, 5 meters) for customers": [
""
],
"sale price for customers, including taxes, for above units of the product": [
""
],
"Stock": [
""
],
"product inventory for products with finite supply (for internal use only)": [
""
],
"taxes included in the product price, exposed to customers": [
""
],
"Need to complete marked fields": [
""
],
"could not create product": [
""
],
"Products": [
""
],
"add product to inventory": [
""
],
"Sell": [
""
],
"Profit": [
""
],
"Sold": [
""
],
"free": [
""
],
"go to product update page": [
""
],
"Update": [
""
],
"remove this product from the database": [
""
],
"update the product with new price": [
""
],
"update product with new price": [
""
],
"add more elements to the inventory": [
""
],
"report elements lost in the inventory": [
""
],
"new price for the product": [
""
],
"the are value with errors": [
""
],
"update product with new stock and price": [
""
],
"There is no products yet, add more pressing the + sign": [
""
],
"product updated successfully": [
""
],
"could not update the product": [
""
],
"product delete successfully": [
""
],
"could not delete the product": [
""
],
"Product id:": [
""
],
"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.": [
""
],
"If your system supports RFC 8905, you can do this by opening this URI:": [
""
],
"it should be greater than 0": [
""
],
"must be a valid URL": [
""
],
"Initial balance": [
""
],
"balance prior to deposit": [
""
],
"Exchange URL": [
""
],
"URL of exchange": [
""
],
"Next": [
""
],
"Wire method": [
""
],
"method to use for wire transfer": [
""
],
"Select one wire method": [
""
],
"could not create reserve": [
""
],
"Valid until": [
""
],
"Created balance": [
""
],
"Exchange balance": [
""
],
"Picked up": [
""
],
"Committed": [
""
],
"Account address": [
""
],
"Subject": [
""
],
"Tips": [
""
],
"No tips has been authorized from this reserve": [
""
],
"Authorized": [
""
],
"Expiration": [
""
],
"amount of tip": [
""
],
"Justification": [
""
],
"reason for the tip": [
""
],
"URL after tip": [
""
],
"URL to visit after tip payment": [
""
],
"Reserves not yet funded": [
""
],
"Reserves ready": [
""
],
"add new reserve": [
""
],
"Expires at": [
""
],
"Initial": [
""
],
"delete selected reserve from the database": [
""
],
"authorize new tip from selected reserve": [
""
],
"There is no ready reserves yet, add more pressing the + sign or fund them": [
""
],
"Expected Balance": [
""
],
"could not create the tip": [
""
],
"should not be empty": [
""
],
"should be greater that 0": [
""
],
"can't be empty": [
""
],
"to short": [
""
],
"just letters and numbers from 2 to 7": [
""
],
"size of the key should be 32": [
""
],
"Identifier": [
""
],
"Name of the template in URLs.": [
""
],
"Describe what this template stands for": [
""
],
"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": [
""
],
"Is this contract restricted to some age?": [
""
],
"Payment timeout": [
""
],
"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": [
""
],
"Amount is required": [
""
],
"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": [
""
],
"add new templates": [
""
],
"load more templates before the first one": [
""
],
"load newer templates": [
""
],
"delete selected templates from the database": [
""
],
"use template to create new order": [
""
],
"create qr code for the template": [
""
],
"load more templates after the last one": [
""
],
"load older templates": [
""
],
"There is no templates yet, add more pressing the + sign": [
""
],
"template delete successfully": [
""
],
"could not delete the template": [
""
],
"could not update template": [
""
],
"should be one of '%1$s'": [
""
],
"Webhook ID to use": [
""
],
"Event": [
""
],
"The event of the webhook: why the webhook is used": [
""
],
"Method": [
""
],
"Method used by the webhook": [
""
],
"URL": [
""
],
"URL of the webhook where the customer will be redirected": [
""
],
"Header": [
""
],
"Header template of the webhook": [
""
],
"Body": [
""
],
"Body template by the webhook": [
""
],
"Webhooks": [
""
],
"add new webhooks": [
""
],
"load more webhooks before the first one": [
""
],
"load newer webhooks": [
""
],
"Event type": [
""
],
"delete selected webhook from the database": [
""
],
"load more webhooks after the last one": [
""
],
"load older webhooks": [
""
],
"There is no webhooks yet, add more pressing the + sign": [
""
],
"webhook delete successfully": [
""
],
"could not delete the webhook": [
""
],
"check the id, does not look valid": [
""
],
"should have 52 characters, current %1$s": [
""
],
"URL doesn't have the right format": [
""
],
"Credited bank account": [
""
],
"Select one account": [
""
],
"Bank account of the merchant where the payment was received": [
""
],
"Wire transfer ID": [
""
],
"unique identifier of the wire transfer used by the exchange, must be 52 characters long": [
""
],
"Base URL of the exchange that made the transfer, should have been in the wire transfer subject": [
""
],
"Amount credited": [
""
],
"Actual amount that was wired to the merchant's bank account": [
""
],
"could not inform transfer": [
""
],
"Transfers": [
""
],
"add new transfer": [
""
],
"load more transfers before the first one": [
""
],
"load newer transfers": [
""
],
"Credit": [
""
],
"Confirmed": [
""
],
"Verified": [
""
],
"Executed at": [
""
],
"yes": [
""
],
"no": [
""
],
"unknown": [
""
],
"delete selected transfer from the database": [
""
],
"load more transfer after the last one": [
""
],
"load older transfers": [
""
],
"There is no transfer yet, add more pressing the + sign": [
""
],
"filter by account address": [
""
],
"only show wire transfers confirmed by the merchant": [
""
],
"only show wire transfers claimed by the exchange": [
""
],
"Unverified": [
""
],
"is not valid": [
""
],
"is not a number": [
""
],
"must be 1 or greater": [
""
],
"max 7 lines": [
""
],
"change authorization configuration": [
""
],
"Need to complete marked fields and choose authorization method": [
""
],
"This is not a valid bitcoin address.": [
""
],
"This is not a valid Ethereum address.": [
""
],
"IBAN numbers usually have more that 4 digits": [
""
],
"IBAN numbers usually have less that 34 digits": [
""
],
"IBAN country code not found": [
""
],
"IBAN number is not valid, checksum is wrong": [
""
],
"Target type": [
""
],
"Method to use for wire transfer": [
""
],
"Routing": [
""
],
"Routing number.": [
""
],
"Account": [
""
],
"Account number.": [
""
],
"Business Identifier Code.": [
""
],
"Bank Account Number.": [
""
],
"Unified Payment Interface.": [
""
],
"Bitcoin protocol.": [
""
],
"Ethereum protocol.": [
""
],
"Interledger protocol.": [
""
],
"Host": [
""
],
"Bank host.": [
""
],
"Bank account.": [
""
],
"Bank account owner's name.": [
""
],
"No accounts yet.": [
""
],
"Name of the instance in URLs. The 'default' instance is special in that it is used to administer other instances.": [
""
],
"Business name": [
""
],
"Legal name of the business represented by this instance.": [
""
],
"Email": [
""
],
"Contact email": [
""
],
"Website URL": [
""
],
"URL.": [
""
],
"Logo": [
""
],
"Logo image.": [
""
],
"Bank account": [
""
],
"URI specifying bank account for crediting revenue.": [
""
],
"Default max deposit fee": [
""
],
"Maximum deposit fees this merchant is willing to pay per order by default.": [
""
],
"Default max wire fee": [
""
],
"Maximum wire fees this merchant is willing to pay per wire transfer by default.": [
""
],
"Default wire fee amortization": [
""
],
"Number of orders excess wire transfer fees will be divided by to compute per order surcharge.": [
""
],
"Physical location of the merchant.": [
""
],
"Jurisdiction": [
""
],
"Jurisdiction for legal disputes with the merchant.": [
""
],
"Default payment delay": [
""
],
"Time customers have to pay an order before the offer expires by default.": [
""
],
"Default wire transfer delay": [
""
],
"Maximum time an exchange is allowed to delay wiring funds to the merchant, enabling it to aggregate smaller payments into larger wire transfers and reducing wire fees.": [
""
],
"Instance id": [
""
],
"Change the authorization method use for this instance.": [
""
],
"Manage access token": [
""
],
"Failed to create instance": [
""
],
"Login required": [
""
],
"Please enter your access token.": [
""
],
"Access Token": [
""
],
"The request to the backend take too long and was cancelled": [
""
],
'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": [
""
],
"The access token provided is invalid.": [
""
],
"No 'default' instance configured yet.": [
""
],
"Create a 'default' instance to begin using the merchant backoffice.": [
""
],
"The access token provided is invalid": [
""
],
"Hide for today": [
""
],
"Instance": [
""
],
"Settings": [
""
],
"Connection": [
""
],
"New": [
""
],
"List": [
""
],
"Log out": [
""
],
"Check your token is valid": [
""
],
"Couldn't access the server.": [
""
],
"Could not infer instance id from url %1$s": [
""
],
"Server not found": [
""
],
"Server response with an error code": [
""
],
"Got message %1$s from %2$s": [
""
],
"Response from server is unreadable, http status: %1$s": [
""
],
"Unexpected Error": [
""
],
"The value %1$s is invalid for a payment url": [
""
],
"add element to the list": [
""
],
"add": [
""
],
"Deleting": [
""
],
"Changing": [
""
],
"Order ID": [
""
],
"Payment URL": [
""
]
}
}
};
strings["it"] = {
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages",
"plural_forms": "nplurals=2; plural=(n != 1);",
"lang": ""
},
"Cancel": [
""
],
"%1$s": [
""
],
"Close": [
""
],
"Continue": [
""
],
"Clear": [
""
],
"Confirm": [
""
],
"is not the same as the current access token": [
""
],
"cannot be empty": [
""
],
"cannot be the same as the old token": [
""
],
"is not the same": [
""
],
"You are updating the access token from instance with id %1$s": [
""
],
"Old access token": [
""
],
"access token currently in use": [
""
],
"New access token": [
""
],
"next access token to be used": [
""
],
"Repeat access token": [
""
],
"confirm the same access token": [
""
],
"Clearing the access token will mean public access to the instance": [
""
],
"cannot be the same as the old access token": [
""
],
"You are setting the access token for the new instance": [
""
],
"With external authorization method no check will be done by the merchant backend": [
""
],
"Set external authorization": [
""
],
"Set access token": [
""
],
"Operation in progress...": [
""
],
"The operation will be automatically canceled after %1$s seconds": [
""
],
"Instances": [
""
],
"Delete": [
""
],
"add new instance": [
""
],
"ID": [
""
],
"Name": [
""
],
"Edit": [
""
],
"Purge": [
""
],
"There is no instances yet, add more pressing the + sign": [
""
],
"Only show active instances": [
""
],
"Active": [
""
],
"Only show deleted instances": [
""
],
"Deleted": [
""
],
"Show all instances": [
""
],
"All": [
""
],
'Instance "%1$s" (ID: %2$s) has been deleted': [
""
],
"Failed to delete instance": [
""
],
"Instance '%1$s' (ID: %2$s) has been disabled": [
""
],
"Failed to purge instance": [
""
],
"Pending KYC verification": [
""
],
"Timed out": [
""
],
"Exchange": [
""
],
"Target account": [
""
],
"KYC URL": [
""
],
"Code": [
""
],
"Http Status": [
""
],
"No pending kyc verification!": [
""
],
"change value to unknown date": [
""
],
"change value to empty": [
""
],
"clear": [
""
],
"change value to never": [
""
],
"never": [
""
],
"Country": [
""
],
"Address": [
""
],
"Building number": [
""
],
"Building name": [
""
],
"Street": [
""
],
"Post code": [
""
],
"Town location": [
""
],
"Town": [
""
],
"District": [
""
],
"Country subdivision": [
""
],
"Product id": [
""
],
"Description": [
""
],
"Product": [
""
],
"search products by it's description or id": [
""
],
"no products found with that description": [
""
],
"You must enter a valid product identifier.": [
""
],
"Quantity must be greater than 0!": [
""
],
"This quantity exceeds remaining stock. Currently, only %1$s units remain unreserved in stock.": [
""
],
"Quantity": [
""
],
"how many products will be added": [
""
],
"Add from inventory": [
""
],
"Image should be smaller than 1 MB": [
""
],
"Add": [
""
],
"Remove": [
""
],
"No taxes configured for this product.": [
""
],
"Amount": [
""
],
"Taxes can be in currencies that differ from the main currency used by the merchant.": [
""
],
"Enter currency and value separated with a colon, e.g. "USD:2.3".": [
""
],
"Legal name of the tax, e.g. VAT or import duties.": [
""
],
"add tax to the tax list": [
""
],
"describe and add a product that is not in the inventory list": [
""
],
"Add custom product": [
""
],
"Complete information of the product": [
""
],
"Image": [
""
],
"photo of the product": [
""
],
"full product description": [
""
],
"Unit": [
""
],
"name of the product unit": [
""
],
"Price": [
""
],
"amount in the current currency": [
""
],
"Taxes": [
""
],
"image": [
""
],
"description": [
""
],
"quantity": [
""
],
"unit price": [
""
],
"total price": [
""
],
"required": [
""
],
"not valid": [
""
],
"must be greater than 0": [
""
],
"not a valid json": [
""
],
"should be in the future": [
""
],
"refund deadline cannot be before pay deadline": [
""
],
"wire transfer deadline cannot be before refund deadline": [
""
],
"wire transfer deadline cannot be before pay deadline": [
""
],
"should have a refund deadline": [
""
],
"auto refund cannot be after refund deadline": [
""
],
"Manage products in order": [
""
],
"Manage list of products in the order.": [
""
],
"Remove this product from the order.": [
""
],
"Total price": [
""
],
"total product price added up": [
""
],
"Amount to be paid by the customer": [
""
],
"Order price": [
""
],
"final order price": [
""
],
"Summary": [
""
],
"Title of the order to be shown to the customer": [
""
],
"Shipping and Fulfillment": [
""
],
"Delivery date": [
""
],
"Deadline for physical delivery assured by the merchant.": [
""
],
"Location": [
""
],
"address where the products will be delivered": [
""
],
"Fulfillment URL": [
""
],
"URL to which the user will be redirected after successful payment.": [
""
],
"Taler payment options": [
""
],
"Override default Taler payment settings for this order": [
""
],
"Payment deadline": [
""
],
"Deadline for the customer to pay for the offer before it expires. Inventory products will be reserved until this deadline.": [
""
],
"Refund deadline": [
""
],
"Time until which the order can be refunded by the merchant.": [
""
],
"Wire transfer deadline": [
""
],
"Deadline for the exchange to make the wire transfer.": [
""
],
"Auto-refund deadline": [
""
],
"Time until which the wallet will automatically check for refunds without user interaction.": [
""
],
"Maximum deposit fee": [
""
],
"Maximum deposit fees the merchant is willing to cover for this order. Higher deposit fees must be covered in full by the consumer.": [
""
],
"Maximum wire fee": [
""
],
"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.": [
""
],
"Wire fee amortization": [
""
],
"Factor by which wire fees exceeding the above threshold are divided to determine the share of excess wire fees to be paid explicitly by the consumer.": [
""
],
"Create token": [
""
],
"Uncheck this option if the merchant backend generated an order ID with enough entropy to prevent adversarial claims.": [
""
],
"Minimum age required": [
""
],
"Any value greater than 0 will limit the coins able be used to pay this contract. If empty the age restriction will be defined by the products": [
""
],
"Min age defined by the producs is %1$s": [
""
],
"Additional information": [
""
],
"Custom information to be included in the contract for this order.": [
""
],
"You must enter a value in JavaScript Object Notation (JSON).": [
""
],
"days": [
""
],
"hours": [
""
],
"minutes": [
""
],
"seconds": [
""
],
"forever": [
""
],
"%1$sM": [
""
],
"%1$sY": [
""
],
"%1$sd": [
""
],
"%1$sh": [
""
],
"%1$smin": [
""
],
"%1$ssec": [
""
],
"Orders": [
""
],
"create order": [
""
],
"load newer orders": [
""
],
"Date": [
""
],
"Refund": [
""
],
"copy url": [
""
],
"load older orders": [
""
],
"No orders have been found matching your query!": [
""
],
"duplicated": [
""
],
"invalid format": [
""
],
"this value exceed the refundable amount": [
""
],
"date": [
""
],
"amount": [
""
],
"reason": [
""
],
"amount to be refunded": [
""
],
"Max refundable:": [
""
],
"Reason": [
""
],
"Choose one...": [
""
],
"requested by the customer": [
""
],
"other": [
""
],
"why this order is being refunded": [
""
],
"more information to give context": [
""
],
"Contract Terms": [
""
],
"human-readable description of the whole purchase": [
""
],
"total price for the transaction": [
""
],
"URL for this purchase": [
""
],
"Max fee": [
""
],
"maximum total deposit fee accepted by the merchant for this contract": [
""
],
"Max wire fee": [
""
],
"maximum wire fee accepted by the merchant": [
""
],
"over how many customer transactions does the merchant expect to amortize wire fees on average": [
""
],
"Created at": [
""
],
"time when this contract was generated": [
""
],
"after this deadline has passed no refunds will be accepted": [
""
],
"after this deadline, the merchant won't accept payments for the contract": [
""
],
"transfer deadline for the exchange": [
""
],
"time indicating when the order should be delivered": [
""
],
"where the order will be delivered": [
""
],
"Auto-refund delay": [
""
],
"how long the wallet should try to get an automatic refund for the purchase": [
""
],
"Extra info": [
""
],
"extra data that is only interpreted by the merchant frontend": [
""
],
"Order": [
""
],
"claimed": [
""
],
"claimed at": [
""
],
"Timeline": [
""
],
"Payment details": [
""
],
"Order status": [
""
],
"Product list": [
""
],
"paid": [
""
],
"wired": [
""
],
"refunded": [
""
],
"refund order": [
""
],
"not refundable": [
""
],
"refund": [
""
],
"Refunded amount": [
""
],
"Refund taken": [
""
],
"Status URL": [
""
],
"Refund URI": [
""
],
"unpaid": [
""
],
"pay at": [
""
],
"created at": [
""
],
"Order status URL": [
""
],
"Payment URI": [
""
],
"Unknown order status. This is an error, please contact the administrator.": [
""
],
"Back": [
""
],
"refund created successfully": [
""
],
"could not create the refund": [
""
],
"select date to show nearby orders": [
""
],
"order id": [
""
],
"jump to order with the given order ID": [
""
],
"remove all filters": [
""
],
"only show paid orders": [
""
],
"Paid": [
""
],
"only show orders with refunds": [
""
],
"Refunded": [
""
],
"only show orders where customers paid, but wire payments from payment provider are still pending": [
""
],
"Not wired": [
""
],
"clear date filter": [
""
],
"date (YYYY/MM/DD)": [
""
],
"Enter an order id": [
""
],
"order not found": [
""
],
"could not get the order to refund": [
""
],
"Loading...": [
""
],
"click here to configure the stock of the product, leave it as is and the backend will not control stock": [
""
],
"Manage stock": [
""
],
"this product has been configured without stock control": [
""
],
"Infinite": [
""
],
"lost cannot be greater than current and incoming (max %1$s)": [
""
],
"Incoming": [
""
],
"Lost": [
""
],
"Current": [
""
],
"remove stock control for this product": [
""
],
"without stock": [
""
],
"Next restock": [
""
],
"Delivery address": [
""
],
"product identification to use in URLs (for internal use only)": [
""
],
"illustration of the product for customers": [
""
],
"product description for customers": [
""
],
"Age restricted": [
""
],
"is this product restricted for customer below certain age?": [
""
],
"unit describing quantity of product sold (e.g. 2 kilograms, 5 liters, 3 items, 5 meters) for customers": [
""
],
"sale price for customers, including taxes, for above units of the product": [
""
],
"Stock": [
""
],
"product inventory for products with finite supply (for internal use only)": [
""
],
"taxes included in the product price, exposed to customers": [
""
],
"Need to complete marked fields": [
""
],
"could not create product": [
""
],
"Products": [
""
],
"add product to inventory": [
""
],
"Sell": [
""
],
"Profit": [
""
],
"Sold": [
""
],
"free": [
""
],
"go to product update page": [
""
],
"Update": [
""
],
"remove this product from the database": [
""
],
"update the product with new price": [
""
],
"update product with new price": [
""
],
"add more elements to the inventory": [
""
],
"report elements lost in the inventory": [
""
],
"new price for the product": [
""
],
"the are value with errors": [
""
],
"update product with new stock and price": [
""
],
"There is no products yet, add more pressing the + sign": [
""
],
"product updated successfully": [
""
],
"could not update the product": [
""
],
"product delete successfully": [
""
],
"could not delete the product": [
""
],
"Product id:": [
""
],
"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.": [
""
],
"If your system supports RFC 8905, you can do this by opening this URI:": [
""
],
"it should be greater than 0": [
""
],
"must be a valid URL": [
""
],
"Initial balance": [
""
],
"balance prior to deposit": [
""
],
"Exchange URL": [
""
],
"URL of exchange": [
""
],
"Next": [
""
],
"Wire method": [
""
],
"method to use for wire transfer": [
""
],
"Select one wire method": [
""
],
"could not create reserve": [
""
],
"Valid until": [
""
],
"Created balance": [
""
],
"Exchange balance": [
""
],
"Picked up": [
""
],
"Committed": [
""
],
"Account address": [
""
],
"Subject": [
""
],
"Tips": [
""
],
"No tips has been authorized from this reserve": [
""
],
"Authorized": [
""
],
"Expiration": [
""
],
"amount of tip": [
""
],
"Justification": [
""
],
"reason for the tip": [
""
],
"URL after tip": [
""
],
"URL to visit after tip payment": [
""
],
"Reserves not yet funded": [
""
],
"Reserves ready": [
""
],
"add new reserve": [
""
],
"Expires at": [
""
],
"Initial": [
""
],
"delete selected reserve from the database": [
""
],
"authorize new tip from selected reserve": [
""
],
"There is no ready reserves yet, add more pressing the + sign or fund them": [
""
],
"Expected Balance": [
""
],
"could not create the tip": [
""
],
"should not be empty": [
""
],
"should be greater that 0": [
""
],
"can't be empty": [
""
],
"to short": [
""
],
"just letters and numbers from 2 to 7": [
""
],
"size of the key should be 32": [
""
],
"Identifier": [
""
],
"Name of the template in URLs.": [
""
],
"Describe what this template stands for": [
""
],
"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": [
""
],
"Is this contract restricted to some age?": [
""
],
"Payment timeout": [
""
],
"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": [
""
],
"Amount is required": [
""
],
"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": [
""
],
"add new templates": [
""
],
"load more templates before the first one": [
""
],
"load newer templates": [
""
],
"delete selected templates from the database": [
""
],
"use template to create new order": [
""
],
"create qr code for the template": [
""
],
"load more templates after the last one": [
""
],
"load older templates": [
""
],
"There is no templates yet, add more pressing the + sign": [
""
],
"template delete successfully": [
""
],
"could not delete the template": [
""
],
"could not update template": [
""
],
"should be one of '%1$s'": [
""
],
"Webhook ID to use": [
""
],
"Event": [
""
],
"The event of the webhook: why the webhook is used": [
""
],
"Method": [
""
],
"Method used by the webhook": [
""
],
"URL": [
""
],
"URL of the webhook where the customer will be redirected": [
""
],
"Header": [
""
],
"Header template of the webhook": [
""
],
"Body": [
""
],
"Body template by the webhook": [
""
],
"Webhooks": [
""
],
"add new webhooks": [
""
],
"load more webhooks before the first one": [
""
],
"load newer webhooks": [
""
],
"Event type": [
""
],
"delete selected webhook from the database": [
""
],
"load more webhooks after the last one": [
""
],
"load older webhooks": [
""
],
"There is no webhooks yet, add more pressing the + sign": [
""
],
"webhook delete successfully": [
""
],
"could not delete the webhook": [
""
],
"check the id, does not look valid": [
""
],
"should have 52 characters, current %1$s": [
""
],
"URL doesn't have the right format": [
""
],
"Credited bank account": [
""
],
"Select one account": [
""
],
"Bank account of the merchant where the payment was received": [
""
],
"Wire transfer ID": [
""
],
"unique identifier of the wire transfer used by the exchange, must be 52 characters long": [
""
],
"Base URL of the exchange that made the transfer, should have been in the wire transfer subject": [
""
],
"Amount credited": [
""
],
"Actual amount that was wired to the merchant's bank account": [
""
],
"could not inform transfer": [
""
],
"Transfers": [
""
],
"add new transfer": [
""
],
"load more transfers before the first one": [
""
],
"load newer transfers": [
""
],
"Credit": [
""
],
"Confirmed": [
""
],
"Verified": [
""
],
"Executed at": [
""
],
"yes": [
""
],
"no": [
""
],
"unknown": [
""
],
"delete selected transfer from the database": [
""
],
"load more transfer after the last one": [
""
],
"load older transfers": [
""
],
"There is no transfer yet, add more pressing the + sign": [
""
],
"filter by account address": [
""
],
"only show wire transfers confirmed by the merchant": [
""
],
"only show wire transfers claimed by the exchange": [
""
],
"Unverified": [
""
],
"is not valid": [
""
],
"is not a number": [
""
],
"must be 1 or greater": [
""
],
"max 7 lines": [
""
],
"change authorization configuration": [
""
],
"Need to complete marked fields and choose authorization method": [
""
],
"This is not a valid bitcoin address.": [
""
],
"This is not a valid Ethereum address.": [
""
],
"IBAN numbers usually have more that 4 digits": [
""
],
"IBAN numbers usually have less that 34 digits": [
""
],
"IBAN country code not found": [
""
],
"IBAN number is not valid, checksum is wrong": [
""
],
"Target type": [
""
],
"Method to use for wire transfer": [
""
],
"Routing": [
""
],
"Routing number.": [
""
],
"Account": [
""
],
"Account number.": [
""
],
"Business Identifier Code.": [
""
],
"Bank Account Number.": [
""
],
"Unified Payment Interface.": [
""
],
"Bitcoin protocol.": [
""
],
"Ethereum protocol.": [
""
],
"Interledger protocol.": [
""
],
"Host": [
""
],
"Bank host.": [
""
],
"Bank account.": [
""
],
"Bank account owner's name.": [
""
],
"No accounts yet.": [
""
],
"Name of the instance in URLs. The 'default' instance is special in that it is used to administer other instances.": [
""
],
"Business name": [
""
],
"Legal name of the business represented by this instance.": [
""
],
"Email": [
""
],
"Contact email": [
""
],
"Website URL": [
""
],
"URL.": [
""
],
"Logo": [
""
],
"Logo image.": [
""
],
"Bank account": [
""
],
"URI specifying bank account for crediting revenue.": [
""
],
"Default max deposit fee": [
""
],
"Maximum deposit fees this merchant is willing to pay per order by default.": [
""
],
"Default max wire fee": [
""
],
"Maximum wire fees this merchant is willing to pay per wire transfer by default.": [
""
],
"Default wire fee amortization": [
""
],
"Number of orders excess wire transfer fees will be divided by to compute per order surcharge.": [
""
],
"Physical location of the merchant.": [
""
],
"Jurisdiction": [
""
],
"Jurisdiction for legal disputes with the merchant.": [
""
],
"Default payment delay": [
""
],
"Time customers have to pay an order before the offer expires by default.": [
""
],
"Default wire transfer delay": [
""
],
"Maximum time an exchange is allowed to delay wiring funds to the merchant, enabling it to aggregate smaller payments into larger wire transfers and reducing wire fees.": [
""
],
"Instance id": [
""
],
"Change the authorization method use for this instance.": [
""
],
"Manage access token": [
""
],
"Failed to create instance": [
""
],
"Login required": [
""
],
"Please enter your access token.": [
""
],
"Access Token": [
""
],
"The request to the backend take too long and was cancelled": [
""
],
'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": [
""
],
"The access token provided is invalid.": [
""
],
"No 'default' instance configured yet.": [
""
],
"Create a 'default' instance to begin using the merchant backoffice.": [
""
],
"The access token provided is invalid": [
""
],
"Hide for today": [
""
],
"Instance": [
""
],
"Settings": [
""
],
"Connection": [
""
],
"New": [
""
],
"List": [
""
],
"Log out": [
""
],
"Check your token is valid": [
""
],
"Couldn't access the server.": [
""
],
"Could not infer instance id from url %1$s": [
""
],
"Server not found": [
""
],
"Server response with an error code": [
""
],
"Got message %1$s from %2$s": [
""
],
"Response from server is unreadable, http status: %1$s": [
""
],
"Unexpected Error": [
""
],
"The value %1$s is invalid for a payment url": [
""
],
"add element to the list": [
""
],
"add": [
""
],
"Deleting": [
""
],
"Changing": [
""
],
"Order ID": [
""
],
"Payment URL": [
""
]
}
}
};
strings["sv"] = {
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages",
"plural_forms": "nplurals=2; plural=(n != 1);",
"lang": ""
},
"Cancel": [
""
],
"%1$s": [
""
],
"Close": [
""
],
"Continue": [
""
],
"Clear": [
""
],
"Confirm": [
""
],
"is not the same as the current access token": [
""
],
"cannot be empty": [
""
],
"cannot be the same as the old token": [
""
],
"is not the same": [
""
],
"You are updating the access token from instance with id %1$s": [
""
],
"Old access token": [
""
],
"access token currently in use": [
""
],
"New access token": [
""
],
"next access token to be used": [
""
],
"Repeat access token": [
""
],
"confirm the same access token": [
""
],
"Clearing the access token will mean public access to the instance": [
""
],
"cannot be the same as the old access token": [
""
],
"You are setting the access token for the new instance": [
""
],
"With external authorization method no check will be done by the merchant backend": [
""
],
"Set external authorization": [
""
],
"Set access token": [
""
],
"Operation in progress...": [
""
],
"The operation will be automatically canceled after %1$s seconds": [
""
],
"Instances": [
""
],
"Delete": [
""
],
"add new instance": [
""
],
"ID": [
""
],
"Name": [
""
],
"Edit": [
""
],
"Purge": [
""
],
"There is no instances yet, add more pressing the + sign": [
""
],
"Only show active instances": [
""
],
"Active": [
""
],
"Only show deleted instances": [
""
],
"Deleted": [
""
],
"Show all instances": [
""
],
"All": [
""
],
'Instance "%1$s" (ID: %2$s) has been deleted': [
""
],
"Failed to delete instance": [
""
],
"Instance '%1$s' (ID: %2$s) has been disabled": [
""
],
"Failed to purge instance": [
""
],
"Pending KYC verification": [
""
],
"Timed out": [
""
],
"Exchange": [
""
],
"Target account": [
""
],
"KYC URL": [
""
],
"Code": [
""
],
"Http Status": [
""
],
"No pending kyc verification!": [
""
],
"change value to unknown date": [
""
],
"change value to empty": [
""
],
"clear": [
""
],
"change value to never": [
""
],
"never": [
""
],
"Country": [
""
],
"Address": [
""
],
"Building number": [
""
],
"Building name": [
""
],
"Street": [
""
],
"Post code": [
""
],
"Town location": [
""
],
"Town": [
""
],
"District": [
""
],
"Country subdivision": [
""
],
"Product id": [
""
],
"Description": [
""
],
"Product": [
""
],
"search products by it's description or id": [
""
],
"no products found with that description": [
""
],
"You must enter a valid product identifier.": [
""
],
"Quantity must be greater than 0!": [
""
],
"This quantity exceeds remaining stock. Currently, only %1$s units remain unreserved in stock.": [
""
],
"Quantity": [
""
],
"how many products will be added": [
""
],
"Add from inventory": [
""
],
"Image should be smaller than 1 MB": [
""
],
"Add": [
""
],
"Remove": [
""
],
"No taxes configured for this product.": [
""
],
"Amount": [
""
],
"Taxes can be in currencies that differ from the main currency used by the merchant.": [
""
],
"Enter currency and value separated with a colon, e.g. "USD:2.3".": [
""
],
"Legal name of the tax, e.g. VAT or import duties.": [
""
],
"add tax to the tax list": [
""
],
"describe and add a product that is not in the inventory list": [
""
],
"Add custom product": [
""
],
"Complete information of the product": [
""
],
"Image": [
""
],
"photo of the product": [
""
],
"full product description": [
""
],
"Unit": [
""
],
"name of the product unit": [
""
],
"Price": [
""
],
"amount in the current currency": [
""
],
"Taxes": [
""
],
"image": [
""
],
"description": [
""
],
"quantity": [
""
],
"unit price": [
""
],
"total price": [
""
],
"required": [
""
],
"not valid": [
""
],
"must be greater than 0": [
""
],
"not a valid json": [
""
],
"should be in the future": [
""
],
"refund deadline cannot be before pay deadline": [
""
],
"wire transfer deadline cannot be before refund deadline": [
""
],
"wire transfer deadline cannot be before pay deadline": [
""
],
"should have a refund deadline": [
""
],
"auto refund cannot be after refund deadline": [
""
],
"Manage products in order": [
""
],
"Manage list of products in the order.": [
""
],
"Remove this product from the order.": [
""
],
"Total price": [
""
],
"total product price added up": [
""
],
"Amount to be paid by the customer": [
""
],
"Order price": [
""
],
"final order price": [
""
],
"Summary": [
""
],
"Title of the order to be shown to the customer": [
""
],
"Shipping and Fulfillment": [
""
],
"Delivery date": [
""
],
"Deadline for physical delivery assured by the merchant.": [
""
],
"Location": [
""
],
"address where the products will be delivered": [
""
],
"Fulfillment URL": [
""
],
"URL to which the user will be redirected after successful payment.": [
""
],
"Taler payment options": [
""
],
"Override default Taler payment settings for this order": [
""
],
"Payment deadline": [
""
],
"Deadline for the customer to pay for the offer before it expires. Inventory products will be reserved until this deadline.": [
""
],
"Refund deadline": [
""
],
"Time until which the order can be refunded by the merchant.": [
""
],
"Wire transfer deadline": [
""
],
"Deadline for the exchange to make the wire transfer.": [
""
],
"Auto-refund deadline": [
""
],
"Time until which the wallet will automatically check for refunds without user interaction.": [
""
],
"Maximum deposit fee": [
""
],
"Maximum deposit fees the merchant is willing to cover for this order. Higher deposit fees must be covered in full by the consumer.": [
""
],
"Maximum wire fee": [
""
],
"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.": [
""
],
"Wire fee amortization": [
""
],
"Factor by which wire fees exceeding the above threshold are divided to determine the share of excess wire fees to be paid explicitly by the consumer.": [
""
],
"Create token": [
""
],
"Uncheck this option if the merchant backend generated an order ID with enough entropy to prevent adversarial claims.": [
""
],
"Minimum age required": [
""
],
"Any value greater than 0 will limit the coins able be used to pay this contract. If empty the age restriction will be defined by the products": [
""
],
"Min age defined by the producs is %1$s": [
""
],
"Additional information": [
""
],
"Custom information to be included in the contract for this order.": [
""
],
"You must enter a value in JavaScript Object Notation (JSON).": [
""
],
"days": [
""
],
"hours": [
""
],
"minutes": [
""
],
"seconds": [
""
],
"forever": [
""
],
"%1$sM": [
""
],
"%1$sY": [
""
],
"%1$sd": [
""
],
"%1$sh": [
""
],
"%1$smin": [
""
],
"%1$ssec": [
""
],
"Orders": [
""
],
"create order": [
""
],
"load newer orders": [
""
],
"Date": [
""
],
"Refund": [
""
],
"copy url": [
""
],
"load older orders": [
""
],
"No orders have been found matching your query!": [
""
],
"duplicated": [
""
],
"invalid format": [
""
],
"this value exceed the refundable amount": [
""
],
"date": [
""
],
"amount": [
""
],
"reason": [
""
],
"amount to be refunded": [
""
],
"Max refundable:": [
""
],
"Reason": [
""
],
"Choose one...": [
""
],
"requested by the customer": [
""
],
"other": [
""
],
"why this order is being refunded": [
""
],
"more information to give context": [
""
],
"Contract Terms": [
""
],
"human-readable description of the whole purchase": [
""
],
"total price for the transaction": [
""
],
"URL for this purchase": [
""
],
"Max fee": [
""
],
"maximum total deposit fee accepted by the merchant for this contract": [
""
],
"Max wire fee": [
""
],
"maximum wire fee accepted by the merchant": [
""
],
"over how many customer transactions does the merchant expect to amortize wire fees on average": [
""
],
"Created at": [
""
],
"time when this contract was generated": [
""
],
"after this deadline has passed no refunds will be accepted": [
""
],
"after this deadline, the merchant won't accept payments for the contract": [
""
],
"transfer deadline for the exchange": [
""
],
"time indicating when the order should be delivered": [
""
],
"where the order will be delivered": [
""
],
"Auto-refund delay": [
""
],
"how long the wallet should try to get an automatic refund for the purchase": [
""
],
"Extra info": [
""
],
"extra data that is only interpreted by the merchant frontend": [
""
],
"Order": [
""
],
"claimed": [
""
],
"claimed at": [
""
],
"Timeline": [
""
],
"Payment details": [
""
],
"Order status": [
""
],
"Product list": [
""
],
"paid": [
""
],
"wired": [
""
],
"refunded": [
""
],
"refund order": [
""
],
"not refundable": [
""
],
"refund": [
""
],
"Refunded amount": [
""
],
"Refund taken": [
""
],
"Status URL": [
""
],
"Refund URI": [
""
],
"unpaid": [
""
],
"pay at": [
""
],
"created at": [
""
],
"Order status URL": [
""
],
"Payment URI": [
""
],
"Unknown order status. This is an error, please contact the administrator.": [
""
],
"Back": [
""
],
"refund created successfully": [
""
],
"could not create the refund": [
""
],
"select date to show nearby orders": [
""
],
"order id": [
""
],
"jump to order with the given order ID": [
""
],
"remove all filters": [
""
],
"only show paid orders": [
""
],
"Paid": [
""
],
"only show orders with refunds": [
""
],
"Refunded": [
""
],
"only show orders where customers paid, but wire payments from payment provider are still pending": [
""
],
"Not wired": [
""
],
"clear date filter": [
""
],
"date (YYYY/MM/DD)": [
""
],
"Enter an order id": [
""
],
"order not found": [
""
],
"could not get the order to refund": [
""
],
"Loading...": [
""
],
"click here to configure the stock of the product, leave it as is and the backend will not control stock": [
""
],
"Manage stock": [
""
],
"this product has been configured without stock control": [
""
],
"Infinite": [
""
],
"lost cannot be greater than current and incoming (max %1$s)": [
""
],
"Incoming": [
""
],
"Lost": [
""
],
"Current": [
""
],
"remove stock control for this product": [
""
],
"without stock": [
""
],
"Next restock": [
""
],
"Delivery address": [
""
],
"product identification to use in URLs (for internal use only)": [
""
],
"illustration of the product for customers": [
""
],
"product description for customers": [
""
],
"Age restricted": [
""
],
"is this product restricted for customer below certain age?": [
""
],
"unit describing quantity of product sold (e.g. 2 kilograms, 5 liters, 3 items, 5 meters) for customers": [
""
],
"sale price for customers, including taxes, for above units of the product": [
""
],
"Stock": [
""
],
"product inventory for products with finite supply (for internal use only)": [
""
],
"taxes included in the product price, exposed to customers": [
""
],
"Need to complete marked fields": [
""
],
"could not create product": [
""
],
"Products": [
""
],
"add product to inventory": [
""
],
"Sell": [
""
],
"Profit": [
""
],
"Sold": [
""
],
"free": [
""
],
"go to product update page": [
""
],
"Update": [
""
],
"remove this product from the database": [
""
],
"update the product with new price": [
""
],
"update product with new price": [
""
],
"add more elements to the inventory": [
""
],
"report elements lost in the inventory": [
""
],
"new price for the product": [
""
],
"the are value with errors": [
""
],
"update product with new stock and price": [
""
],
"There is no products yet, add more pressing the + sign": [
""
],
"product updated successfully": [
""
],
"could not update the product": [
""
],
"product delete successfully": [
""
],
"could not delete the product": [
""
],
"Product id:": [
""
],
"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.": [
""
],
"If your system supports RFC 8905, you can do this by opening this URI:": [
""
],
"it should be greater than 0": [
""
],
"must be a valid URL": [
""
],
"Initial balance": [
""
],
"balance prior to deposit": [
""
],
"Exchange URL": [
""
],
"URL of exchange": [
""
],
"Next": [
""
],
"Wire method": [
""
],
"method to use for wire transfer": [
""
],
"Select one wire method": [
""
],
"could not create reserve": [
""
],
"Valid until": [
""
],
"Created balance": [
""
],
"Exchange balance": [
""
],
"Picked up": [
""
],
"Committed": [
""
],
"Account address": [
""
],
"Subject": [
""
],
"Tips": [
""
],
"No tips has been authorized from this reserve": [
""
],
"Authorized": [
""
],
"Expiration": [
""
],
"amount of tip": [
""
],
"Justification": [
""
],
"reason for the tip": [
""
],
"URL after tip": [
""
],
"URL to visit after tip payment": [
""
],
"Reserves not yet funded": [
""
],
"Reserves ready": [
""
],
"add new reserve": [
""
],
"Expires at": [
""
],
"Initial": [
""
],
"delete selected reserve from the database": [
""
],
"authorize new tip from selected reserve": [
""
],
"There is no ready reserves yet, add more pressing the + sign or fund them": [
""
],
"Expected Balance": [
""
],
"could not create the tip": [
""
],
"should not be empty": [
""
],
"should be greater that 0": [
""
],
"can't be empty": [
""
],
"to short": [
""
],
"just letters and numbers from 2 to 7": [
""
],
"size of the key should be 32": [
""
],
"Identifier": [
""
],
"Name of the template in URLs.": [
""
],
"Describe what this template stands for": [
""
],
"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": [
""
],
"Is this contract restricted to some age?": [
""
],
"Payment timeout": [
""
],
"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": [
""
],
"Amount is required": [
""
],
"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": [
""
],
"add new templates": [
""
],
"load more templates before the first one": [
""
],
"load newer templates": [
""
],
"delete selected templates from the database": [
""
],
"use template to create new order": [
""
],
"create qr code for the template": [
""
],
"load more templates after the last one": [
""
],
"load older templates": [
""
],
"There is no templates yet, add more pressing the + sign": [
""
],
"template delete successfully": [
""
],
"could not delete the template": [
""
],
"could not update template": [
""
],
"should be one of '%1$s'": [
""
],
"Webhook ID to use": [
""
],
"Event": [
""
],
"The event of the webhook: why the webhook is used": [
""
],
"Method": [
""
],
"Method used by the webhook": [
""
],
"URL": [
""
],
"URL of the webhook where the customer will be redirected": [
""
],
"Header": [
""
],
"Header template of the webhook": [
""
],
"Body": [
""
],
"Body template by the webhook": [
""
],
"Webhooks": [
""
],
"add new webhooks": [
""
],
"load more webhooks before the first one": [
""
],
"load newer webhooks": [
""
],
"Event type": [
""
],
"delete selected webhook from the database": [
""
],
"load more webhooks after the last one": [
""
],
"load older webhooks": [
""
],
"There is no webhooks yet, add more pressing the + sign": [
""
],
"webhook delete successfully": [
""
],
"could not delete the webhook": [
""
],
"check the id, does not look valid": [
""
],
"should have 52 characters, current %1$s": [
""
],
"URL doesn't have the right format": [
""
],
"Credited bank account": [
""
],
"Select one account": [
""
],
"Bank account of the merchant where the payment was received": [
""
],
"Wire transfer ID": [
""
],
"unique identifier of the wire transfer used by the exchange, must be 52 characters long": [
""
],
"Base URL of the exchange that made the transfer, should have been in the wire transfer subject": [
""
],
"Amount credited": [
""
],
"Actual amount that was wired to the merchant's bank account": [
""
],
"could not inform transfer": [
""
],
"Transfers": [
""
],
"add new transfer": [
""
],
"load more transfers before the first one": [
""
],
"load newer transfers": [
""
],
"Credit": [
""
],
"Confirmed": [
""
],
"Verified": [
""
],
"Executed at": [
""
],
"yes": [
""
],
"no": [
""
],
"unknown": [
""
],
"delete selected transfer from the database": [
""
],
"load more transfer after the last one": [
""
],
"load older transfers": [
""
],
"There is no transfer yet, add more pressing the + sign": [
""
],
"filter by account address": [
""
],
"only show wire transfers confirmed by the merchant": [
""
],
"only show wire transfers claimed by the exchange": [
""
],
"Unverified": [
""
],
"is not valid": [
""
],
"is not a number": [
""
],
"must be 1 or greater": [
""
],
"max 7 lines": [
""
],
"change authorization configuration": [
""
],
"Need to complete marked fields and choose authorization method": [
""
],
"This is not a valid bitcoin address.": [
""
],
"This is not a valid Ethereum address.": [
""
],
"IBAN numbers usually have more that 4 digits": [
""
],
"IBAN numbers usually have less that 34 digits": [
""
],
"IBAN country code not found": [
""
],
"IBAN number is not valid, checksum is wrong": [
""
],
"Target type": [
""
],
"Method to use for wire transfer": [
""
],
"Routing": [
""
],
"Routing number.": [
""
],
"Account": [
""
],
"Account number.": [
""
],
"Business Identifier Code.": [
""
],
"Bank Account Number.": [
""
],
"Unified Payment Interface.": [
""
],
"Bitcoin protocol.": [
""
],
"Ethereum protocol.": [
""
],
"Interledger protocol.": [
""
],
"Host": [
""
],
"Bank host.": [
""
],
"Bank account.": [
""
],
"Bank account owner's name.": [
""
],
"No accounts yet.": [
""
],
"Name of the instance in URLs. The 'default' instance is special in that it is used to administer other instances.": [
""
],
"Business name": [
""
],
"Legal name of the business represented by this instance.": [
""
],
"Email": [
""
],
"Contact email": [
""
],
"Website URL": [
""
],
"URL.": [
""
],
"Logo": [
""
],
"Logo image.": [
""
],
"Bank account": [
""
],
"URI specifying bank account for crediting revenue.": [
""
],
"Default max deposit fee": [
""
],
"Maximum deposit fees this merchant is willing to pay per order by default.": [
""
],
"Default max wire fee": [
""
],
"Maximum wire fees this merchant is willing to pay per wire transfer by default.": [
""
],
"Default wire fee amortization": [
""
],
"Number of orders excess wire transfer fees will be divided by to compute per order surcharge.": [
""
],
"Physical location of the merchant.": [
""
],
"Jurisdiction": [
""
],
"Jurisdiction for legal disputes with the merchant.": [
""
],
"Default payment delay": [
""
],
"Time customers have to pay an order before the offer expires by default.": [
""
],
"Default wire transfer delay": [
""
],
"Maximum time an exchange is allowed to delay wiring funds to the merchant, enabling it to aggregate smaller payments into larger wire transfers and reducing wire fees.": [
""
],
"Instance id": [
""
],
"Change the authorization method use for this instance.": [
""
],
"Manage access token": [
""
],
"Failed to create instance": [
""
],
"Login required": [
""
],
"Please enter your access token.": [
""
],
"Access Token": [
""
],
"The request to the backend take too long and was cancelled": [
""
],
'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": [
""
],
"The access token provided is invalid.": [
""
],
"No 'default' instance configured yet.": [
""
],
"Create a 'default' instance to begin using the merchant backoffice.": [
""
],
"The access token provided is invalid": [
""
],
"Hide for today": [
""
],
"Instance": [
""
],
"Settings": [
""
],
"Connection": [
""
],
"New": [
""
],
"List": [
""
],
"Log out": [
""
],
"Check your token is valid": [
""
],
"Couldn't access the server.": [
""
],
"Could not infer instance id from url %1$s": [
""
],
"Server not found": [
""
],
"Server response with an error code": [
""
],
"Got message %1$s from %2$s": [
""
],
"Response from server is unreadable, http status: %1$s": [
""
],
"Unexpected Error": [
""
],
"The value %1$s is invalid for a payment url": [
""
],
"add element to the list": [
""
],
"add": [
""
],
"Deleting": [
""
],
"Changing": [
""
],
"Order ID": [
""
],
"Payment URL": [
""
]
}
}
};
// src/components/menu/LangSelector.tsx
var names = {
es: "Espa\xF1ol [es]",
en: "English [en]",
fr: "Fran\xE7ais [fr]",
de: "Deutsch [de]",
sv: "Svenska [sv]",
it: "Italiano [it]"
};
function getLangName(s5) {
if (names[s5])
return names[s5];
return s5;
}
function LangSelector() {
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",
{
class: "button has-tooltip-left",
"data-tooltip": "change language selection",
"aria-haspopup": "true",
"aria-controls": "dropdown-menu",
onClick: () => setUpdatingLang(!updatingLang)
},
/* @__PURE__ */ h("div", { class: "icon is-small is-left" }, /* @__PURE__ */ h("img", { src: languageicon_default })),
/* @__PURE__ */ h("span", null, getLangName(lang)),
/* @__PURE__ */ h("div", { class: "icon is-right" }, /* @__PURE__ */ h("i", { class: "mdi mdi-chevron-down" }))
)), updatingLang && /* @__PURE__ */ h("div", { class: "dropdown-menu", id: "dropdown-menu", role: "menu" }, /* @__PURE__ */ h("div", { class: "dropdown-content" }, Object.keys(strings).filter((l3) => l3 !== lang).map((l3) => /* @__PURE__ */ h(
"a",
{
key: l3,
class: "dropdown-item",
value: l3,
onClick: () => {
changeLanguage(l3);
setUpdatingLang(false);
}
},
getLangName(l3)
)))));
}
// src/components/menu/SideBar.tsx
var VERSION = true ? "0.1.0" : void 0;
function Sidebar({
mobile,
instance,
onShowSettings,
onLogout,
admin,
mimic,
isPasswordOk
}) {
const config = useConfigContext();
const { url: backendURL } = useBackendContext();
const { i18n: i18n2 } = useTranslationContext();
const kycStatus = useInstanceKYCDetails();
const needKYC = kycStatus.ok && kycStatus.data.type === "redirect";
return /* @__PURE__ */ h("aside", { class: "aside is-placed-left is-expanded", style: { overflowY: "scroll" } }, mobile && /* @__PURE__ */ h(
"div",
{
class: "footer",
onClick: (e4) => {
return e4.stopImmediatePropagation();
}
},
/* @__PURE__ */ h(LangSelector, null)
), /* @__PURE__ */ h("div", { class: "aside-tools" }, /* @__PURE__ */ h("div", { class: "aside-tools-label" }, /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("b", null, "Taler"), " Backoffice"), /* @__PURE__ */ h(
"div",
{
class: "is-size-7 has-text-right",
style: { lineHeight: 0, marginTop: -10 }
},
VERSION,
" (",
config.version,
")"
))), /* @__PURE__ */ h("div", { class: "menu is-menu-main" }, isPasswordOk && instance ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("ul", { class: "menu-list" }, /* @__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-arrow-left-right" })), /* @__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")))), 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")))), /* @__PURE__ */ h("p", { class: "menu-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Configuration")), /* @__PURE__ */ h("ul", { class: "menu-list" }, /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/bank", 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, "Bank account")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/validators", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-lock" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Validators")))), /* @__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")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/server", 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, "Server")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/token", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-security" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Access token")))))) : 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(
"a",
{
class: "has-icon is-state-info is-hoverable",
onClick: () => onShowSettings()
},
/* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-newspaper" })),
/* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Interface"))
)), /* @__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(backendURL).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))), isPasswordOk && 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"))))), isPasswordOk && /* @__PURE__ */ h("li", null, /* @__PURE__ */ h(
"a",
{
class: "has-icon is-state-info is-hoverable",
onClick: () => onLogout()
},
/* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-logout default" })),
/* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Log out"))
)))));
}
// src/components/menu/index.tsx
function getInstanceTitle(path, id) {
switch (path) {
case "/server" /* server */:
return `${id}: Settings`;
case "/orders" /* order_list */:
return `${id}: Orders`;
case "/order/new" /* order_new */:
return `${id}: New order`;
case "/products" /* product_list */:
return `${id}: Products`;
case "/product/new" /* product_new */:
return `${id}: New product`;
case "/product/:pid/update" /* product_update */:
return `${id}: Update product`;
case "/reserves/new" /* reserves_new */:
return `${id}: New reserve`;
case "/reserves" /* reserves_list */:
return `${id}: Reserves`;
case "/transfers" /* transfers_list */:
return `${id}: Transfers`;
case "/transfer/new" /* transfers_new */:
return `${id}: New transfer`;
case "/webhooks" /* webhooks_list */:
return `${id}: Webhooks`;
case "/webhooks/new" /* webhooks_new */:
return `${id}: New webhook`;
case "/webhooks/:tid/update" /* webhooks_update */:
return `${id}: Update webhook`;
case "/validators" /* validators_list */:
return `${id}: Validators`;
case "/validators/new" /* validators_new */:
return `${id}: New validator`;
case "/validators/:vid/update" /* validators_update */:
return `${id}: Update validators`;
case "/templates/new" /* templates_new */:
return `${id}: New template`;
case "/templates/:tid/update" /* templates_update */:
return `${id}: Update template`;
case "/templates" /* templates_list */:
return `${id}: Templates`;
case "/templates/:tid/use" /* templates_use */:
return `${id}: Use template`;
case "/interface" /* settings */:
return `${id}: Interface`;
case "/interface" /* settings */:
return `${id}: Interface`;
default:
return "";
}
}
function getAdminTitle(path, instance) {
if (path === "/instance/new" /* new_instance */)
return `New instance`;
if (path === "/instances" /* list_instances */)
return `Instances`;
return getInstanceTitle(path, instance);
}
function WithTitle({
title,
children
}) {
h2(() => {
document.title = `Taler Backoffice: ${title}`;
}, [title]);
return /* @__PURE__ */ h(p2, null, children);
}
function Menu({
onLogout,
onShowSettings,
title,
instance,
path,
admin,
setInstanceName,
isPasswordOk
}) {
const [mobileOpen, setMobileOpen] = p3(false);
const titleWithSubtitle = title ? title : !admin ? getInstanceTitle(path, instance) : getAdminTitle(path, instance);
const adminInstance = instance === "default";
const mimic = admin && !adminInstance;
return /* @__PURE__ */ h(WithTitle, { title: titleWithSubtitle }, /* @__PURE__ */ h(
"div",
{
class: mobileOpen ? "has-aside-mobile-expanded" : "",
onClick: () => setMobileOpen(false)
},
/* @__PURE__ */ h(
NavigationBar,
{
onMobileMenu: () => setMobileOpen(!mobileOpen),
title: titleWithSubtitle
}
),
onLogout && /* @__PURE__ */ h(
Sidebar,
{
onShowSettings,
onLogout,
admin,
mimic,
instance,
mobile: mobileOpen,
isPasswordOk
}
),
mimic && /* @__PURE__ */ h("nav", { class: "level", style: {
zIndex: 100,
position: "fixed",
width: "50%",
marginLeft: "20%"
} }, /* @__PURE__ */ h("div", { class: "level-item has-text-centered has-background-warning" }, /* @__PURE__ */ h("p", { class: "is-size-5" }, "You are viewing the instance ", /* @__PURE__ */ h("b", null, '"', instance, '"'), ".", " ", /* @__PURE__ */ h(
"a",
{
href: "#/instances",
onClick: (e4) => {
setInstanceName("default");
}
},
"go back"
))))
));
}
function NotificationCard({
notification: n2
}) {
if (!n2)
return null;
return /* @__PURE__ */ h("div", { class: "notification" }, /* @__PURE__ */ h("div", { class: "columns is-vcentered" }, /* @__PURE__ */ h("div", { class: "column is-12" }, /* @__PURE__ */ h(
"article",
{
class: n2.type === "ERROR" ? "message is-danger" : n2.type === "WARN" ? "message is-warning" : "message is-info"
},
/* @__PURE__ */ h("div", { class: "message-header" }, /* @__PURE__ */ h("p", null, n2.message)),
n2.description && /* @__PURE__ */ h("div", { class: "message-body" }, /* @__PURE__ */ h("div", null, n2.description), n2.details && /* @__PURE__ */ h("pre", null, n2.details))
))));
}
function NotConnectedAppMenu({
title
}) {
const [mobileOpen, setMobileOpen] = p3(false);
h2(() => {
document.title = `Taler Backoffice: ${title}`;
}, [title]);
return /* @__PURE__ */ h(
"div",
{
class: mobileOpen ? "has-aside-mobile-expanded" : "",
onClick: () => setMobileOpen(false)
},
/* @__PURE__ */ h(
NavigationBar,
{
onMobileMenu: () => setMobileOpen(!mobileOpen),
title
}
)
);
}
function NotYetReadyAppMenu({
onLogout,
onShowSettings,
title,
isPasswordOk
}) {
const [mobileOpen, setMobileOpen] = p3(false);
h2(() => {
document.title = `Taler Backoffice: ${title}`;
}, [title]);
return /* @__PURE__ */ h(
"div",
{
class: mobileOpen ? "has-aside-mobile-expanded" : "",
onClick: () => setMobileOpen(false)
},
/* @__PURE__ */ h(
NavigationBar,
{
onMobileMenu: () => setMobileOpen(!mobileOpen),
title
}
),
onLogout && /* @__PURE__ */ h(Sidebar, { onShowSettings, onLogout, instance: "", mobile: mobileOpen, isPasswordOk })
);
}
// src/paths/instance/token/index.tsx
init_preact_module();
// src/paths/instance/token/DetailPage.tsx
init_preact_module();
init_hooks_module();
function DetailPage({ instanceId, hasToken, onBack, onNewToken, onClearToken }) {
const [form, setValue] = p3({
old_token: "",
new_token: "",
repeat_token: ""
});
const { i18n: i18n2 } = useTranslationContext();
const errors2 = {
old_token: hasToken && !form.old_token ? i18n2.str`you need your access token to perform the operation` : void 0,
new_token: !form.new_token ? i18n2.str`cannot be empty` : form.new_token === form.old_token ? i18n2.str`cannot be the same as the old token` : void 0,
repeat_token: form.new_token !== form.repeat_token ? i18n2.str`is not the same` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const instance = useInstanceContext();
const text = i18n2.str`You are updating the access token from instance with id ${instance.id}`;
function submitForm() {
return __async(this, null, function* () {
if (hasErrors)
return;
const ot = hasToken ? `secret-token:${form.old_token}` : void 0;
const nt = `secret-token:${form.new_token}`;
onNewToken(ot, nt);
});
}
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" }, "Instance id: ", /* @__PURE__ */ h("b", null, instanceId))))))), /* @__PURE__ */ h("hr", null), /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h(FormProvider, { errors: errors2, object: form, valueHandler: setValue }, /* @__PURE__ */ h(p2, null, hasToken && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "old_token",
label: i18n2.str`Current access token`,
tooltip: i18n2.str`access token currently in use`,
inputType: "password"
}
), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "Clearing the access token will mean public access to the instance.")), /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, /* @__PURE__ */ h(
"button",
{
class: "button",
onClick: () => {
if (hasToken) {
const ot = `secret-token:${form.old_token}`;
onClearToken(ot);
} else {
onClearToken(void 0);
}
}
},
/* @__PURE__ */ h(i18n2.Translate, null, "Clear token")
))), /* @__PURE__ */ h(
Input,
{
name: "new_token",
label: i18n2.str`New access token`,
tooltip: i18n2.str`next access token to be used`,
inputType: "password"
}
), /* @__PURE__ */ h(
Input,
{
name: "repeat_token",
label: i18n2.str`Repeat access token`,
tooltip: i18n2.str`confirm the same access token`,
inputType: "password"
}
))), /* @__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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm change")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/token/index.tsx
init_hooks_module();
function Token({
onLoadError,
onChange,
onUnauthorized,
onNotFound
}) {
const { i18n: i18n2 } = useTranslationContext();
const [notif, setNotif] = p3(void 0);
const { clearAccessToken, setNewAccessToken } = useInstanceAPI();
const { id } = useInstanceContext();
const result = useInstanceDetails();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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 hasToken = result.data.auth.method === "token";
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
DetailPage,
{
instanceId: id,
hasToken,
onClearToken: (currentToken) => __async(this, null, function* () {
try {
yield clearAccessToken(currentToken);
onChange();
} catch (error2) {
if (error2 instanceof Error) {
setNotif({
message: i18n2.str`Failed to clear token`,
type: "ERROR",
description: error2.message
});
}
}
}),
onNewToken: (currentToken, newToken) => __async(this, null, function* () {
try {
yield setNewAccessToken(currentToken, newToken);
onChange();
} catch (error2) {
if (error2 instanceof Error) {
setNotif({
message: i18n2.str`Failed to set new token`,
type: "ERROR",
description: error2.message
});
}
}
})
}
));
}
// src/paths/instance/kyc/list/index.tsx
init_preact_module();
// src/paths/instance/kyc/list/ListPage.tsx
init_preact_module();
function ListPage({ status }) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__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-clock" })), /* @__PURE__ */ h(i18n2.Translate, null, "Pending KYC verification")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" })), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h("div", { class: "b-table has-pagination" }, /* @__PURE__ */ h("div", { class: "table-wrapper has-mobile-cards" }, status.pending_kycs.length > 0 ? /* @__PURE__ */ h(PendingTable, { entries: status.pending_kycs }) : /* @__PURE__ */ h(EmptyTable2, null))))), status.timeout_kycs.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-clock" })), /* @__PURE__ */ h(i18n2.Translate, null, "Timed out")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" })), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h("div", { class: "b-table has-pagination" }, /* @__PURE__ */ h("div", { class: "table-wrapper has-mobile-cards" }, status.timeout_kycs.length > 0 ? /* @__PURE__ */ h(TimedOutTable, { entries: status.timeout_kycs }) : /* @__PURE__ */ h(EmptyTable2, null))))) : void 0);
}
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, "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 }) {
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, "Code")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Http Status")))), /* @__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.exchange_code), /* @__PURE__ */ h("td", null, e4.exchange_http_status));
}))));
}
function EmptyTable2() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-happy mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "No pending kyc verification!")));
}
// src/paths/instance/kyc/list/index.tsx
function ListKYC({
onUnauthorized,
onLoadError,
onNotFound
}) {
const result = useInstanceKYCDetails();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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");
}
return /* @__PURE__ */ h(ListPage, { status });
}
// src/paths/instance/orders/create/index.tsx
init_preact_module();
init_hooks_module();
// src/hooks/order.ts
init_hooks_module();
var useSWR3 = useSWR;
function useOrderAPI() {
const mutateAll = useMatchMutate();
const { request } = useBackendInstanceRequest();
const createOrder = (data) => __async(this, null, function* () {
const res = yield request(
`/private/orders`,
{
method: "POST",
data
}
);
yield mutateAll(/.*private\/orders.*/);
return res;
});
const refundOrder = (orderId, data) => __async(this, null, function* () {
mutateAll(/@"\/private\/orders"@/);
const res = request(
`/private/orders/${orderId}/refund`,
{
method: "POST",
data
}
);
yield mutateAll(/.*private\/orders.*/);
return res;
});
const forgetOrder = (orderId, data) => __async(this, null, function* () {
mutateAll(/@"\/private\/orders"@/);
const res = request(`/private/orders/${orderId}/forget`, {
method: "PATCH",
data
});
yield mutateAll(/.*private\/orders.*/);
return res;
});
const deleteOrder = (orderId) => __async(this, null, function* () {
mutateAll(/@"\/private\/orders"@/);
const res = request(`/private/orders/${orderId}`, {
method: "DELETE"
});
yield mutateAll(/.*private\/orders.*/);
return res;
});
const getPaymentURL = (orderId) => __async(this, null, function* () {
return request(
`/private/orders/${orderId}`,
{
method: "GET"
}
).then((res) => {
const url = res.data.order_status === "unpaid" ? res.data.taler_pay_uri : res.data.contract_terms.fulfillment_url;
const response = res;
response.data = url || "";
return response;
});
});
return { createOrder, forgetOrder, deleteOrder, refundOrder, getPaymentURL };
}
function useOrderDetails(oderId) {
const { fetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR3([`/private/orders/${oderId}`], fetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data)
return data;
if (error2)
return error2.cause;
return { loading: true };
}
function useInstanceOrders(args, updateFilter) {
const { orderFetcher } = useBackendInstanceRequest();
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 {
data: beforeData,
error: beforeError,
isValidating: loadingBefore
} = useSWR3(
[
`/private/orders`,
args == null ? void 0 : args.paid,
args == null ? void 0 : args.refunded,
args == null ? void 0 : args.wired,
args == null ? void 0 : args.date,
totalBefore
],
orderFetcher
);
const {
data: afterData,
error: afterError,
isValidating: loadingAfter
} = useSWR3(
[
`/private/orders`,
args == null ? void 0 : args.paid,
args == null ? void 0 : args.refunded,
args == null ? void 0 : args.wired,
args == null ? void 0 : args.date,
-totalAfter
],
orderFetcher
);
const [lastBefore, setLastBefore] = p3({ loading: true });
const [lastAfter, setLastAfter] = p3({ loading: true });
h2(() => {
if (afterData)
setLastAfter(afterData);
if (beforeData)
setLastBefore(beforeData);
}, [afterData, beforeData]);
if (beforeError)
return beforeError.cause;
if (afterError)
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 = {
isReachingEnd,
isReachingStart,
loadMore: () => {
if (!afterData || isReachingEnd)
return;
if (afterData.data.orders.length < MAX_RESULT_SIZE) {
setPageAfter(pageAfter + 1);
} else {
const from = afterData.data.orders[afterData.data.orders.length - 1].timestamp.t_s;
if (from && from !== "never" && updateFilter)
updateFilter(new Date(from * 1e3));
}
},
loadMorePrev: () => {
if (!beforeData || isReachingStart)
return;
if (beforeData.data.orders.length < MAX_RESULT_SIZE) {
setPageBefore(pageBefore + 1);
} else if (beforeData) {
const from = beforeData.data.orders[beforeData.data.orders.length - 1].timestamp.t_s;
if (from && from !== "never" && updateFilter)
updateFilter(new Date(from * 1e3));
}
}
};
const orders = !beforeData || !afterData ? [] : (beforeData || lastBefore).data.orders.slice().reverse().concat((afterData || lastAfter).data.orders);
if (loadingAfter || loadingBefore)
return { loading: true, data: { orders } };
if (beforeData && afterData) {
return __spreadValues({ ok: true, data: { orders } }, pagination);
}
return { loading: true };
}
// src/hooks/product.ts
var useSWR4 = useSWR;
function useProductAPI() {
const mutateAll = useMatchMutate();
const { mutate: mutate2 } = useSWRConfig();
const { request } = useBackendInstanceRequest();
const createProduct = (data) => __async(this, null, function* () {
const res = yield request(`/private/products`, {
method: "POST",
data
});
return yield mutateAll(/.*"\/private\/products.*/);
});
const updateProduct = (productId, data) => __async(this, null, function* () {
const r3 = yield request(`/private/products/${productId}`, {
method: "PATCH",
data
});
return yield mutateAll(/.*"\/private\/products.*/);
});
const deleteProduct = (productId) => __async(this, null, function* () {
yield request(`/private/products/${productId}`, {
method: "DELETE"
});
yield mutate2([`/private/products`]);
});
const lockProduct = (productId, data) => __async(this, null, function* () {
yield request(`/private/products/${productId}/lock`, {
method: "POST",
data
});
return yield mutateAll(/.*"\/private\/products.*/);
});
return { createProduct, updateProduct, deleteProduct, lockProduct };
}
function useInstanceProducts() {
const { fetcher, multiFetcher } = useBackendInstanceRequest();
const { data: list, error: listError } = useSWR4([`/private/products`], fetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
const paths = ((list == null ? void 0 : list.data.products) || []).map(
(p4) => `/private/products/${p4.product_id}`
);
const { data: products, error: productError } = useSWR4([paths], multiFetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
if (listError)
return listError.cause;
if (productError)
return productError.cause;
if (products) {
const dataWithId = products.map((d5) => {
var _a;
return __spreadProps(__spreadValues({}, d5.data), {
id: ((_a = d5.info) == null ? void 0 : _a.url.replace(/.*\/private\/products\//, "")) || ""
});
});
return { ok: true, data: dataWithId };
}
return { loading: true };
}
function useProductDetails(productId) {
const { fetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR4([`/private/products/${productId}`], fetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data)
return data;
if (error2)
return error2.cause;
return { loading: true };
}
// src/paths/instance/orders/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
// src/components/form/InputCurrency.tsx
init_preact_module();
function InputCurrency({
name,
readonly,
label,
placeholder,
help,
tooltip,
expand,
addonAfter,
children,
side
}) {
const config = useConfigContext();
return /* @__PURE__ */ h(
InputWithAddon,
{
name,
readonly,
addonBefore: config.currency,
side,
label,
placeholder,
help,
tooltip,
addonAfter,
inputType: "number",
expand,
toStr: (v3) => (v3 == null ? void 0 : v3.split(":")[1]) || "",
fromStr: (v3) => !v3 ? void 0 : `${config.currency}:${v3}`,
inputExtra: { min: 0 }
},
children
);
}
// src/components/form/InputDate.tsx
init_preact_module();
init_hooks_module();
// src/components/picker/DatePicker.tsx
init_preact_module();
var DatePicker = class extends d {
closeDatePicker() {
this.props.closeFunction && this.props.closeFunction();
}
/**
* Gets fired when a day gets clicked.
* @param {object} e The event thrown by the element clicked
*/
dayClicked(e4) {
const element = e4.target;
if (element.innerHTML === "")
return false;
const date2 = new Date(element.getAttribute("data-value"));
this.setState({ currentDate: date2 });
this.passDateToParent(date2);
}
/**
* returns days in month as array
* @param {number} month the month to display
* @param {number} year the year to display
*/
getDaysByMonth(month, year) {
const calendar = [];
const date2 = new Date(year, month, 1);
const firstDay = new Date(year, month, 1).getDay();
const lastDate = new Date(year, month + 1, 0).getDate();
let day = 0;
for (let i4 = 0; i4 < 42; i4++) {
if (i4 >= firstDay && day !== null)
day = day + 1;
if (day !== null && day > lastDate)
day = null;
calendar.push({
day: day === 0 || day === null ? null : day,
// null or number
date: day === 0 || day === null ? null : new Date(year, month, day),
// null or Date()
today: day === now.getDate() && month === now.getMonth() && year === now.getFullYear()
// boolean
});
}
return calendar;
}
/**
* Display previous month by updating state
*/
displayPrevMonth() {
if (this.state.displayedMonth <= 0) {
this.setState({
displayedMonth: 11,
displayedYear: this.state.displayedYear - 1
});
} else {
this.setState({
displayedMonth: this.state.displayedMonth - 1
});
}
}
/**
* Display next month by updating state
*/
displayNextMonth() {
if (this.state.displayedMonth >= 11) {
this.setState({
displayedMonth: 0,
displayedYear: this.state.displayedYear + 1
});
} else {
this.setState({
displayedMonth: this.state.displayedMonth + 1
});
}
}
/**
* Display the selected month (gets fired when clicking on the date string)
*/
displaySelectedMonth() {
if (this.state.selectYearMode) {
this.toggleYearSelector();
} else {
if (!this.state.currentDate)
return false;
this.setState({
displayedMonth: this.state.currentDate.getMonth(),
displayedYear: this.state.currentDate.getFullYear()
});
}
}
toggleYearSelector() {
this.setState({ selectYearMode: !this.state.selectYearMode });
}
changeDisplayedYear(e4) {
const element = e4.target;
this.toggleYearSelector();
this.setState({
displayedYear: parseInt(element.innerHTML, 10),
displayedMonth: 0
});
}
/**
* Pass the selected date to parent when 'OK' is clicked
*/
passSavedDateDateToParent() {
this.passDateToParent(this.state.currentDate);
}
passDateToParent(date2) {
if (typeof this.props.dateReceiver === "function")
this.props.dateReceiver(date2);
this.closeDatePicker();
}
componentDidUpdate() {
if (this.state.selectYearMode) {
document.getElementsByClassName("selected")[0].scrollIntoView();
}
}
constructor() {
super();
this.closeDatePicker = this.closeDatePicker.bind(this);
this.dayClicked = this.dayClicked.bind(this);
this.displayNextMonth = this.displayNextMonth.bind(this);
this.displayPrevMonth = this.displayPrevMonth.bind(this);
this.getDaysByMonth = this.getDaysByMonth.bind(this);
this.changeDisplayedYear = this.changeDisplayedYear.bind(this);
this.passDateToParent = this.passDateToParent.bind(this);
this.toggleYearSelector = this.toggleYearSelector.bind(this);
this.displaySelectedMonth = this.displaySelectedMonth.bind(this);
this.state = {
currentDate: now,
displayedMonth: now.getMonth(),
displayedYear: now.getFullYear(),
selectYearMode: false
};
}
render() {
const { currentDate, displayedMonth, displayedYear, selectYearMode } = this.state;
return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("div", { class: `datePicker ${this.props.opened && "datePicker--opened"}` }, /* @__PURE__ */ h("div", { class: "datePicker--titles" }, /* @__PURE__ */ h(
"h3",
{
style: {
color: selectYearMode ? "rgba(255,255,255,.87)" : "rgba(255,255,255,.57)"
},
onClick: this.toggleYearSelector
},
currentDate.getFullYear()
), /* @__PURE__ */ h(
"h2",
{
style: {
color: !selectYearMode ? "rgba(255,255,255,.87)" : "rgba(255,255,255,.57)"
},
onClick: this.displaySelectedMonth
},
dayArr[currentDate.getDay()],
",",
" ",
monthArrShort[currentDate.getMonth()],
" ",
currentDate.getDate()
)), !selectYearMode && /* @__PURE__ */ h("nav", null, /* @__PURE__ */ h("span", { onClick: this.displayPrevMonth, class: "icon" }, /* @__PURE__ */ h(
"i",
{
style: { transform: "rotate(180deg)" },
class: "mdi mdi-forward"
}
)), /* @__PURE__ */ h("h4", null, monthArrShortFull[displayedMonth], " ", displayedYear), /* @__PURE__ */ h("span", { onClick: this.displayNextMonth, class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-forward" }))), /* @__PURE__ */ h("div", { class: "datePicker--scroll" }, !selectYearMode && /* @__PURE__ */ h("div", { class: "datePicker--calendar" }, /* @__PURE__ */ h("div", { class: "datePicker--dayNames" }, ["S", "M", "T", "W", "T", "F", "S"].map((day, i4) => /* @__PURE__ */ h("span", { key: i4 }, day))), /* @__PURE__ */ h("div", { onClick: this.dayClicked, class: "datePicker--days" }, this.getDaysByMonth(
this.state.displayedMonth,
this.state.displayedYear
).map((day) => {
let selected = false;
if (currentDate && day.date)
selected = currentDate.toLocaleDateString() === day.date.toLocaleDateString();
return /* @__PURE__ */ h(
"span",
{
key: day.day,
class: (day.today ? "datePicker--today " : "") + (selected ? "datePicker--selected" : ""),
disabled: !day.date,
"data-value": day.date
},
day.day
);
}))), selectYearMode && /* @__PURE__ */ h("div", { class: "datePicker--selectYear" }, yearArr.map((year) => /* @__PURE__ */ h(
"span",
{
key: year,
class: year === displayedYear ? "selected" : "",
onClick: this.changeDisplayedYear
},
year
))))), /* @__PURE__ */ h(
"div",
{
class: "datePicker--background",
onClick: this.closeDatePicker,
style: {
display: this.props.opened ? "block" : "none"
}
}
));
}
};
var monthArrShortFull = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
var monthArrShort = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
];
var dayArr = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var now = /* @__PURE__ */ new Date();
var yearArr = [];
for (let i4 = 2010; i4 <= now.getFullYear() + 10; i4++) {
yearArr.push(i4);
}
// src/hooks/useSettings.ts
var defaultSettings = {
advanceOrderMode: false,
dateFormat: "ymd"
};
var codecForSettings = () => buildCodecForObject().property("advanceOrderMode", codecForBoolean()).property("dateFormat", codecForEither(
codecForConstString("ymd"),
codecForConstString("dmy"),
codecForConstString("mdy")
)).build("Settings");
var SETTINGS_KEY = buildStorageKey("merchant-settings", codecForSettings());
function useSettings() {
const { value, update } = useLocalStorage(SETTINGS_KEY, defaultSettings);
return [value, update];
}
function dateFormatForSettings(s5) {
switch (s5.dateFormat) {
case "ymd":
return "yyyy/MM/dd";
case "dmy":
return "dd/MM/yyyy";
case "mdy":
return "MM/dd/yyyy";
}
}
function datetimeFormatForSettings(s5) {
return dateFormatForSettings(s5) + " HH:mm:ss";
}
// src/components/form/InputDate.tsx
function InputDate({
name,
readonly,
label,
placeholder,
help,
tooltip,
expand,
withTimestampSupport,
side
}) {
const [opened, setOpened] = p3(false);
const { i18n: i18n2 } = useTranslationContext();
const [settings] = useSettings();
const { error: error2, required, value, onChange } = useField(name);
let strValue = "";
if (!value) {
strValue = withTimestampSupport ? "unknown" : "";
} else if (value instanceof Date) {
strValue = format(value, dateFormatForSettings(settings));
} else if (value.t_s) {
strValue = value.t_s === "never" ? withTimestampSupport ? "never" : "" : format(new Date(value.t_s * 1e3), dateFormatForSettings(settings));
}
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("div", { class: "field has-addons" }, /* @__PURE__ */ h(
"p",
{
class: expand ? "control is-expanded has-icons-right" : "control has-icons-right"
},
/* @__PURE__ */ h(
"input",
{
class: "input",
type: "text",
readonly: true,
value: strValue,
placeholder,
onClick: () => {
if (!readonly)
setOpened(true);
}
}
),
required && /* @__PURE__ */ h("span", { class: "icon has-text-danger is-right" }, /* @__PURE__ */ h("i", { class: "mdi mdi-alert" })),
help
), /* @__PURE__ */ h(
"div",
{
class: "control",
onClick: () => {
if (!readonly)
setOpened(true);
}
},
/* @__PURE__ */ h("a", { class: "button is-static" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-calendar" })))
)), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2)), !readonly && /* @__PURE__ */ h(
"span",
{
"data-tooltip": withTimestampSupport ? i18n2.str`change value to unknown date` : i18n2.str`change value to empty`
},
/* @__PURE__ */ h(
"button",
{
class: "button is-info mr-3",
onClick: () => onChange(void 0)
},
/* @__PURE__ */ h(i18n2.Translate, null, "clear")
)
), withTimestampSupport && /* @__PURE__ */ h("span", { "data-tooltip": i18n2.str`change value to never` }, /* @__PURE__ */ h(
"button",
{
class: "button is-info",
onClick: () => onChange({ t_s: "never" })
},
/* @__PURE__ */ h(i18n2.Translate, null, "never")
)), side), /* @__PURE__ */ h(
DatePicker,
{
opened,
closeFunction: () => setOpened(false),
dateReceiver: (d5) => {
if (withTimestampSupport) {
onChange({ t_s: d5.getTime() / 1e3 });
} else {
onChange(d5);
}
}
}
));
}
// src/components/form/InputNumber.tsx
init_preact_module();
function InputNumber2({
name,
readonly,
placeholder,
tooltip,
label,
help,
expand,
children,
side
}) {
return /* @__PURE__ */ h(
InputWithAddon,
{
name,
readonly,
fromStr: (v3) => !v3 ? void 0 : parseInt(v3, 10),
toStr: (v3) => `${v3}`,
inputType: "number",
expand,
label,
placeholder,
help,
tooltip,
inputExtra: { min: 0 },
children,
side
}
);
}
// src/components/product/InventoryProductForm.tsx
init_preact_module();
init_hooks_module();
// src/components/form/InputSearchOnList.tsx
init_preact_module();
init_hooks_module();
// src/assets/empty.png
var empty_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAAA3NCSVQICAjb4U/gAAAAEHRFWHRTb2Z0d2FyZQBTaHV0dGVyY4LQCQAACn1JREFUeNrtnVtz2sgWRmkhkMDBgME4tuOML6mZ//9v5kwGAZJwwDZCdyHr0ueBc6acxBMk0J1vPaZcEmmt2r1771aLLBWtBkDSMBgCALEAxAIQCwCIBSAWgFgAQCwAsQDEAgBiAYgFIBYAEAtALACxAIBYAGIBiAUAxAIQC0AsACAWgFgAYgEAsQDEAhALAIgFigWb4LUopWEQBGGIYS0jhJB6vU4IIYQURSzf99frta7rvueFYUjxlMo4eRFSr9f5Vqvb7XY6nQP1Ioecj0UpdRxHWa1WqxUeTJXgOO58NOp2uyzLZi0WpXTx7dvLy0uIua+iNJvNz7/9dnJykp1YnudJomgYBka/4vMjw1xdXZ0NBnFnxn0CXRgEwni82Www7pUnDENZlsMwHJ6fx3KL2eNOs9kMVh0Vy+XSNM14oS5uXrVWFF3XMdZHRRAEwnj8+vqalliu6z4+PmKgj5On5TItsVarFdaAR4uqqkEQpCKWgUnwuCfE6EErhlgbx3FdF+N7zDw/P0ecsmKUGxRFifJnHMd1TjuEoL1dJnzP0zRtpzSUUtd1W61WkmJFWXAOh8Or6+tEupggY2zbngiC7/u//jPP86KIFWcq3FW7Yhjm4uNHWFVSWq3Wp5ub3ZnWLvPiiUUppXTHroVGo7F3zxLkDiGk0+lEMSH5VeHOX4bHU2oYJjEfkGKDdBzFEACIBSAWgFgAQCwAscARU6x6JqU0DMNX191sNpZtu67re15IKUNInWU5jmu32zzP8xzH1Osom0GsSIRhqCjKy/Oz53nvdkMt01RWK0IIy7Jng8FoNEqwoAcqKFYQBLqmPT09RdlKTyn1PG+5WCir1flo1O/30UeCWO+LMptO93iTzPO8x/lcUZSHhwe4heT9Ozabzde//jrk/cSN4xx4BVApsSilvu8L47HjOAde6vX1dTadvrpuxMY7qLJYvu9PBMHzvKSytK9fvx7uKCi3WJTSxWJh23aypn57fETQOmqxNFVVUjigxjTN56cnPNQjFSsMw6fn55QuvlguY72wC6ojlm3bTqKT4HeTbBhqqornenRiUUqXi0Wqt1DWa2RaRyeW53lxzy2JC16sPUaxbMvK4C4qZsNjE8vZZFFqMstQiP+3XjvE2ifB8j0/gxv5vh9GPhcleyilqqr+588/RVH0fR9iJUCQyfOmlIZFzd8ppbZtS6IYBIGmquJsVsm4lcOqsGI3ivurNE0TxuN/ZDIMYzadVi9uZS1WZts+C7i/lFJqmqYkST+EKF3XZUkKCjx3l0Cser2ejVUF3Fyqadp0Mnk3+dM0rWJxK9PRJ4Q0m80MbtRsNgslFqXUMAz5p1j1FsMwZFmuTNzKevT5CEcrHc6HCKemZImu69PJZKc0mqpGOaEKYr1Du93OIPvp9XqFqixIohhx6WdZllSJfCtrsViW7Xa7qd7i5OSk0WgUZHwNw9hWFmKEN02bCELZ3cphVXg+GqUatPpnZ0VYEm4rC/uVqSzLKvs6MYcMl+f5drud1v+HYdKOiBGxbVuczfaWQ1XVSYS0DGJ99+w/Xl6mFFRuPn/O/VUwSul6vRYE4cCSumWa4mxW0lw+nzX5hw8fRhcXaeTsuaft246NLEmJNCt1XS9pzye3Ys9wOOycniZ4wWaz+fHyMvcB/aFjk0j6X8baaW5isSx7e3vb3uvrnT/Dcdzvf/zBcVy+sWpbLEg8wJSx55NneZphmNvb287BxcxWq3V7d5dNs+jX6bYwHqe0XUfTtHLVTnPuezQajbv7++H5cL8ODCGk1+8/fPnC83y+scowjLksp5oMWZZVop5P/mdpEEKurq4Hg+FclmNth+c47tPNTbvdzr0tmFmKramq73l39/e5h+cSiLV1i+f5+4cHwzDWimLb9i/eDWw0Gu12u9vt9vr93AuhlFJd16N3bJKJW5L06eam4G4V6PSf7Sc3Op3O9gQs0zAsy/I8LwhDhpCtT51Op/H/nQtFKK/nUg5QVdV13YcvX4rsVrGOldq6QgjhOI7juMFwWNiByz5WvcVxnILHLRy1uCcHdmwSiVuTyaSwtVOItU+sUlX18I5NAvlWgXs+ECu2VaZpSqJYkNfLtnuaC1iDgFixH+S0YBOQWci4BbFixKqUOjaJLE7lgv0wiBUjWU6vY5NIKBWK1POBWJFilaZpcsodm0Ry+bjboCFWzhONOJuFZWjS6bpekP3yEGt3rMqrCrpn3CrGfnmItTtWlW7juaqqucetKohlmuYq6TOYt/vWxVLFqh/iVr41iNKLZdv2RBBkSdJ1PdnLJrVvPcdwm2PJrdximaY5nU63YzcRhJckTvkuTscmkbg1yylulVgs27ank4n3ZufWfD5fK8ohJ2MVrWOTQNzSNDGPGkRZxdrGqp/HS5IkRVH2vmwBOzaHY+h69nGrlGJtt6x47+0ypZTKkrSOf9R7kTs2ibglSVKWpxyWTyzDMHZ+NkwSxbjrRF3Xi9yxSWROzPJjMCX7MOn2WNidUZ1SOpflWq02GAx27mDOdy9oVSlTxLIsSxiPo3/i8HE+j/IlgZJWQSFWknlVrMdPKRVns9Vq9W+5RRk7NmWhHFOhZVnjv//eL/ecyzJDSP/s7N2lZVWPWYdYkSoLoijuvaKhlG4LOcPz87f/qKrqvPA7YTAVpoXjOBNB8A5ezszn87c9n23HBnnVkYplmmaC5cqJIGzzrf/tBUWsOs6pcNuxSTaoyJLk+/7TcgmrjlQswzBS6nAtvn3DUz/SqdBxHEkU/cj1KoCIFS1WlfZEV1DQiBWxYwMQseKtASeV2F4HChSxtrEKViFiJcm2uwyrIFbCM6CIWAWxEp8BkVdBrORnQGwugFjJx6rpZILKAsRKkm3HBlZVmBzKDbZti+jYIGIlnldhBkTEShhK6dPTE6yCWKnIhUGHWABALACxAMQCAGIBiAUgFgAQC0AsALEAgFgAYgGIBQDEAhALVJKsd5AOz8+7vR7GPZ+HzbLVFIsQ0ul08IAxFQIAsQDEAhALAIgFIBaAWADkKlYQBhTvo5aZBA/UiCoWIaS+q27re77jOHg8JYVSulwud5vAMEmKVavV2u32zl8mS5JpGDhLrXRK+b6/XCxeXl52/nHEvlCMlk739NR48wGtd3EcZzwe41FVGI7jEo5Y3V5v5/eVQcWt4vlGo5GwWCzL7pwNQbW5vLyMGFzirQp7/T4G92jhef709DSVckO/3+d5HkN8nAwGg+i5UDyx6vX6zefPDIOy6tFxcnJyNhhE//vYirRarYuLCwz0sU2Ct3d3sQJKbLEIIaOLi+vrawz3kcAwzO3dXdxtzXtuTT4bDGittlws8CH4ys+An25uItauvgtAS0Xb+66bzWY6mbiuiwdQyUB1PhpdXFzsV7w8SKxarRaGoWkY6/Va13V0cqoBx3H9fr/b63Ect3dJ/FCx/iEIAtM0bdt2XTcMgxp2OZQKQgjLsnyr1el0EqkoJSYWAAetCgGAWABiAYgFAMQCEAtALAAgFoBYAGIBALEAxAIQCwCIBSAWgFgAQCwAsQDEAgBiAYgFIBYAEAtALACxAIBYAGIBiAUAxALp8l9rz86ZOS4ZWgAAAABJRU5ErkJggg==";
// src/components/form/InputSearchOnList.tsx
function InputSearchOnList({
selected,
onChange,
label,
list,
withImage
}) {
const [nameForm, setNameForm] = p3({
name: ""
});
const errors2 = {
name: void 0
};
const { i18n: i18n2 } = useTranslationContext();
if (selected) {
return /* @__PURE__ */ h("article", { class: "media" }, withImage && /* @__PURE__ */ h("figure", { class: "media-left" }, /* @__PURE__ */ h("p", { class: "image is-128x128" }, /* @__PURE__ */ h("img", { src: selected.image ? selected.image : empty_default }))), /* @__PURE__ */ h("div", { class: "media-content" }, /* @__PURE__ */ h("div", { class: "content" }, /* @__PURE__ */ h("p", { class: "media-meta" }, /* @__PURE__ */ h(i18n2.Translate, null, "ID"), ": ", /* @__PURE__ */ h("b", null, selected.id)), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "Description"), ":", " ", selected.description), /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, /* @__PURE__ */ h(
"button",
{
class: "button is-info",
onClick: () => onChange(void 0)
},
"clear"
)))));
}
return /* @__PURE__ */ h(
FormProvider,
{
errors: errors2,
object: nameForm,
valueHandler: setNameForm
},
/* @__PURE__ */ h(
InputWithAddon,
{
name: "name",
label,
tooltip: i18n2.str`enter description or id`,
addonAfter: /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-magnify" }))
},
/* @__PURE__ */ h("div", null, /* @__PURE__ */ h(
DropdownList,
{
name: nameForm.name,
list,
onSelect: (p4) => {
setNameForm({ name: "" });
onChange(p4);
},
withImage: !!withImage
}
))
)
);
}
function DropdownList({ name, onSelect, list, withImage }) {
const { i18n: i18n2 } = useTranslationContext();
if (!name) {
return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("br", null));
}
const filtered = list.filter(
(p4) => p4.id.includes(name) || p4.description.includes(name)
);
return /* @__PURE__ */ h("div", { class: "dropdown is-active" }, /* @__PURE__ */ h(
"div",
{
class: "dropdown-menu",
id: "dropdown-menu",
role: "menu",
style: { minWidth: "20rem" }
},
/* @__PURE__ */ h("div", { class: "dropdown-content" }, !filtered.length ? /* @__PURE__ */ h("div", { class: "dropdown-item" }, /* @__PURE__ */ h(i18n2.Translate, null, "no match found with that description or id")) : filtered.map((p4) => /* @__PURE__ */ h(
"div",
{
key: p4.id,
class: "dropdown-item",
onClick: () => onSelect(p4),
style: { cursor: "pointer" }
},
/* @__PURE__ */ h("article", { class: "media" }, withImage && /* @__PURE__ */ h("div", { class: "media-left" }, /* @__PURE__ */ h("div", { class: "image", style: { minWidth: 64 } }, /* @__PURE__ */ h(
"img",
{
src: p4.image ? p4.image : empty_default,
style: { width: 64, height: 64 }
}
))), /* @__PURE__ */ h("div", { class: "media-content" }, /* @__PURE__ */ h("div", { class: "content" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("strong", null, p4.id), " ", p4.extra !== void 0 ? /* @__PURE__ */ h("small", null, p4.extra) : void 0, /* @__PURE__ */ h("br", null), p4.description))))
)))
));
}
// src/components/product/InventoryProductForm.tsx
function InventoryProductForm({
currentProducts,
onAddProduct,
inventory
}) {
const initialState = { quantity: 1 };
const [state, setState] = p3(initialState);
const [errors2, setErrors] = p3({});
const { i18n: i18n2 } = useTranslationContext();
const productWithInfiniteStock = state.product && state.product.total_stock === -1;
const submit = () => {
if (!state.product) {
setErrors({
product: i18n2.str`You must enter a valid product identifier.`
});
return;
}
if (productWithInfiniteStock) {
onAddProduct(state.product, 1);
} else {
if (!state.quantity || state.quantity <= 0) {
setErrors({ quantity: i18n2.str`Quantity must be greater than 0!` });
return;
}
const currentStock = state.product.total_stock - state.product.total_lost - state.product.total_sold;
const p4 = currentProducts[state.product.id];
if (p4) {
if (state.quantity + p4.quantity > currentStock) {
const left = currentStock - p4.quantity;
setErrors({
quantity: i18n2.str`This quantity exceeds remaining stock. Currently, only ${left} units remain unreserved in stock.`
});
return;
}
onAddProduct(state.product, state.quantity + p4.quantity);
} else {
if (state.quantity > currentStock) {
const left = currentStock;
setErrors({
quantity: i18n2.str`This quantity exceeds remaining stock. Currently, only ${left} units remain unreserved in stock.`
});
return;
}
onAddProduct(state.product, state.quantity);
}
}
setState(initialState);
};
return /* @__PURE__ */ h(FormProvider, { errors: errors2, object: state, valueHandler: setState }, /* @__PURE__ */ h(
InputSearchOnList,
{
label: i18n2.str`Search product`,
selected: state.product,
onChange: (p4) => setState((v3) => __spreadProps(__spreadValues({}, v3), { product: p4 })),
list: inventory,
withImage: true
}
), state.product && /* @__PURE__ */ h("div", { class: "columns mt-5" }, /* @__PURE__ */ h("div", { class: "column is-two-thirds" }, !productWithInfiniteStock && /* @__PURE__ */ h(
InputNumber2,
{
name: "quantity",
label: i18n2.str`Quantity`,
tooltip: i18n2.str`how many products will be added`
}
)), /* @__PURE__ */ h("div", { class: "column" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h("button", { class: "button is-success", onClick: submit }, /* @__PURE__ */ h(i18n2.Translate, null, "Add from inventory"))))));
}
// src/components/product/NonInventoryProductForm.tsx
init_preact_module();
init_hooks_module();
// ../../node_modules/.pnpm/nanoclone@0.2.1/node_modules/nanoclone/src/index.js
var map2;
try {
map2 = Map;
} catch (_3) {
}
var set;
try {
set = Set;
} catch (_3) {
}
function baseClone(src, circulars, clones) {
if (!src || typeof src !== "object" || typeof src === "function") {
return src;
}
if (src.nodeType && "cloneNode" in src) {
return src.cloneNode(true);
}
if (src instanceof Date) {
return new Date(src.getTime());
}
if (src instanceof RegExp) {
return new RegExp(src);
}
if (Array.isArray(src)) {
return src.map(clone);
}
if (map2 && src instanceof map2) {
return new Map(Array.from(src.entries()));
}
if (set && src instanceof set) {
return new Set(Array.from(src.values()));
}
if (src instanceof Object) {
circulars.push(src);
var obj = Object.create(src);
clones.push(obj);
for (var key in src) {
var idx = circulars.findIndex(function(i4) {
return i4 === src[key];
});
obj[key] = idx > -1 ? clones[idx] : baseClone(src[key], circulars, clones);
}
return obj;
}
return src;
}
function clone(src) {
return baseClone(src, [], []);
}
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/printValue.js
var toString = Object.prototype.toString;
var errorToString = Error.prototype.toString;
var regExpToString = RegExp.prototype.toString;
var symbolToString = typeof Symbol !== "undefined" ? Symbol.prototype.toString : () => "";
var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
function printNumber(val) {
if (val != +val)
return "NaN";
const isNegativeZero = val === 0 && 1 / val < 0;
return isNegativeZero ? "-0" : "" + val;
}
function printSimpleValue(val, quoteStrings = false) {
if (val == null || val === true || val === false)
return "" + val;
const typeOf = typeof val;
if (typeOf === "number")
return printNumber(val);
if (typeOf === "string")
return quoteStrings ? `"${val}"` : val;
if (typeOf === "function")
return "[Function " + (val.name || "anonymous") + "]";
if (typeOf === "symbol")
return symbolToString.call(val).replace(SYMBOL_REGEXP, "Symbol($1)");
const tag = toString.call(val).slice(8, -1);
if (tag === "Date")
return isNaN(val.getTime()) ? "" + val : val.toISOString(val);
if (tag === "Error" || val instanceof Error)
return "[" + errorToString.call(val) + "]";
if (tag === "RegExp")
return regExpToString.call(val);
return null;
}
function printValue(value, quoteStrings) {
let result = printSimpleValue(value, quoteStrings);
if (result !== null)
return result;
return JSON.stringify(value, function(key, value2) {
let result2 = printSimpleValue(this[key], quoteStrings);
if (result2 !== null)
return result2;
return value2;
}, 2);
}
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/locale.js
var mixed = {
default: "${path} is invalid",
required: "${path} is a required field",
oneOf: "${path} must be one of the following values: ${values}",
notOneOf: "${path} must not be one of the following values: ${values}",
notType: ({
path,
type,
value,
originalValue
}) => {
let isCast = originalValue != null && originalValue !== value;
let msg = `${path} must be a \`${type}\` type, but the final value was: \`${printValue(value, true)}\`` + (isCast ? ` (cast from the value \`${printValue(originalValue, true)}\`).` : ".");
if (value === null) {
msg += `
If "null" is intended as an empty value be sure to mark the schema as \`.nullable()\``;
}
return msg;
},
defined: "${path} must be defined"
};
var string = {
length: "${path} must be exactly ${length} characters",
min: "${path} must be at least ${min} characters",
max: "${path} must be at most ${max} characters",
matches: '${path} must match the following: "${regex}"',
email: "${path} must be a valid email",
url: "${path} must be a valid URL",
uuid: "${path} must be a valid UUID",
trim: "${path} must be a trimmed string",
lowercase: "${path} must be a lowercase string",
uppercase: "${path} must be a upper case string"
};
var number = {
min: "${path} must be greater than or equal to ${min}",
max: "${path} must be less than or equal to ${max}",
lessThan: "${path} must be less than ${less}",
moreThan: "${path} must be greater than ${more}",
positive: "${path} must be a positive number",
negative: "${path} must be a negative number",
integer: "${path} must be an integer"
};
var date = {
min: "${path} field must be later than ${min}",
max: "${path} field must be at earlier than ${max}"
};
var boolean = {
isValue: "${path} field must be ${value}"
};
var object = {
noUnknown: "${path} field has unspecified keys: ${unknown}"
};
var array = {
min: "${path} field must have at least ${min} items",
max: "${path} field must have less than or equal to ${max} items",
length: "${path} must have ${length} items"
};
var locale_default = Object.assign(/* @__PURE__ */ Object.create(null), {
mixed,
string,
number,
date,
object,
array,
boolean
});
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/Condition.js
var import_has = __toESM(require_has());
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/isSchema.js
var isSchema = (obj) => obj && obj.__isYupSchema__;
var isSchema_default = isSchema;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/Condition.js
var Condition = class {
constructor(refs, options) {
this.fn = void 0;
this.refs = refs;
this.refs = refs;
if (typeof options === "function") {
this.fn = options;
return;
}
if (!(0, import_has.default)(options, "is"))
throw new TypeError("`is:` is required for `when()` conditions");
if (!options.then && !options.otherwise)
throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
let {
is,
then,
otherwise
} = options;
let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
this.fn = function(...args) {
let options2 = args.pop();
let schema = args.pop();
let branch = check(...args) ? then : otherwise;
if (!branch)
return void 0;
if (typeof branch === "function")
return branch(schema);
return schema.concat(branch.resolve(options2));
};
}
resolve(base2, options) {
let values = this.refs.map((ref) => ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context));
let schema = this.fn.apply(base2, values.concat(base2, options));
if (schema === void 0 || schema === base2)
return base2;
if (!isSchema_default(schema))
throw new TypeError("conditions must return a schema object");
return schema.resolve(options);
}
};
var Condition_default = Condition;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/toArray.js
function toArray(value) {
return value == null ? [] : [].concat(value);
}
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/ValidationError.js
function _extends2() {
_extends2 = Object.assign || function(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends2.apply(this, arguments);
}
var strReg = /\$\{\s*(\w+)\s*\}/g;
var ValidationError = class extends Error {
static formatError(message, params) {
const path = params.label || params.path || "this";
if (path !== params.path)
params = _extends2({}, params, {
path
});
if (typeof message === "string")
return message.replace(strReg, (_3, key) => printValue(params[key]));
if (typeof message === "function")
return message(params);
return message;
}
static isError(err) {
return err && err.name === "ValidationError";
}
constructor(errorOrErrors, value, field, type) {
super();
this.value = void 0;
this.path = void 0;
this.type = void 0;
this.errors = void 0;
this.params = void 0;
this.inner = void 0;
this.name = "ValidationError";
this.value = value;
this.path = field;
this.type = type;
this.errors = [];
this.inner = [];
toArray(errorOrErrors).forEach((err) => {
if (ValidationError.isError(err)) {
this.errors.push(...err.errors);
this.inner = this.inner.concat(err.inner.length ? err.inner : err);
} else {
this.errors.push(err);
}
});
this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
if (Error.captureStackTrace)
Error.captureStackTrace(this, ValidationError);
}
};
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/runTests.js
var once = (cb) => {
let fired = false;
return (...args) => {
if (fired)
return;
fired = true;
cb(...args);
};
};
function runTests(options, cb) {
let {
endEarly,
tests,
args,
value,
errors: errors2,
sort,
path
} = options;
let callback = once(cb);
let count = tests.length;
const nestedErrors = [];
errors2 = errors2 ? errors2 : [];
if (!count)
return errors2.length ? callback(new ValidationError(errors2, value, path)) : callback(null, value);
for (let i4 = 0; i4 < tests.length; i4++) {
const test = tests[i4];
test(args, function finishTestRun(err) {
if (err) {
if (!ValidationError.isError(err)) {
return callback(err, value);
}
if (endEarly) {
err.value = value;
return callback(err, value);
}
nestedErrors.push(err);
}
if (--count <= 0) {
if (nestedErrors.length) {
if (sort)
nestedErrors.sort(sort);
if (errors2.length)
nestedErrors.push(...errors2);
errors2 = nestedErrors;
}
if (errors2.length) {
callback(new ValidationError(errors2, value, path), value);
return;
}
callback(null, value);
}
});
}
}
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/createValidation.js
var import_mapValues = __toESM(require_mapValues());
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/Reference.js
var import_property_expr = __toESM(require_property_expr());
var prefixes = {
context: "$",
value: "."
};
var Reference = class {
constructor(key, options = {}) {
this.key = void 0;
this.isContext = void 0;
this.isValue = void 0;
this.isSibling = void 0;
this.path = void 0;
this.getter = void 0;
this.map = void 0;
if (typeof key !== "string")
throw new TypeError("ref must be a string, got: " + key);
this.key = key.trim();
if (key === "")
throw new TypeError("ref must be a non-empty string");
this.isContext = this.key[0] === prefixes.context;
this.isValue = this.key[0] === prefixes.value;
this.isSibling = !this.isContext && !this.isValue;
let prefix2 = this.isContext ? prefixes.context : this.isValue ? prefixes.value : "";
this.path = this.key.slice(prefix2.length);
this.getter = this.path && (0, import_property_expr.getter)(this.path, true);
this.map = options.map;
}
getValue(value, parent, context) {
let result = this.isContext ? context : this.isValue ? value : parent;
if (this.getter)
result = this.getter(result || {});
if (this.map)
result = this.map(result);
return result;
}
/**
*
* @param {*} value
* @param {Object} options
* @param {Object=} options.context
* @param {Object=} options.parent
*/
cast(value, options) {
return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
}
resolve() {
return this;
}
describe() {
return {
type: "ref",
key: this.key
};
}
toString() {
return `Ref(${this.key})`;
}
static isRef(value) {
return value && value.__isYupRef;
}
};
Reference.prototype.__isYupRef = true;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/createValidation.js
function _extends3() {
_extends3 = Object.assign || function(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends3.apply(this, arguments);
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null)
return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i4;
for (i4 = 0; i4 < sourceKeys.length; i4++) {
key = sourceKeys[i4];
if (excluded.indexOf(key) >= 0)
continue;
target[key] = source[key];
}
return target;
}
function createValidation(config) {
function validate(_ref, cb) {
let {
value,
path = "",
label,
options,
originalValue,
sync
} = _ref, rest = _objectWithoutPropertiesLoose(_ref, ["value", "path", "label", "options", "originalValue", "sync"]);
const {
name,
test,
params,
message
} = config;
let {
parent,
context
} = options;
function resolve(item) {
return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
}
function createError(overrides = {}) {
const nextParams = (0, import_mapValues.default)(_extends3({
value,
originalValue,
label,
path: overrides.path || path
}, params, overrides.params), resolve);
const error2 = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name);
error2.params = nextParams;
return error2;
}
let ctx = _extends3({
path,
parent,
type: name,
createError,
resolve,
options,
originalValue
}, rest);
if (!sync) {
try {
Promise.resolve(test.call(ctx, value, ctx)).then((validOrError) => {
if (ValidationError.isError(validOrError))
cb(validOrError);
else if (!validOrError)
cb(createError());
else
cb(null, validOrError);
}).catch(cb);
} catch (err) {
cb(err);
}
return;
}
let result;
try {
var _ref2;
result = test.call(ctx, value, ctx);
if (typeof ((_ref2 = result) == null ? void 0 : _ref2.then) === "function") {
throw new Error(`Validation test of type: "${ctx.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
}
} catch (err) {
cb(err);
return;
}
if (ValidationError.isError(result))
cb(result);
else if (!result)
cb(createError());
else
cb(null, result);
}
validate.OPTIONS = config;
return validate;
}
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/reach.js
var import_property_expr2 = __toESM(require_property_expr());
var trim = (part) => part.substr(0, part.length - 1).substr(1);
function getIn(schema, path, value, context = value) {
let parent, lastPart, lastPartDebug;
if (!path)
return {
parent,
parentPath: path,
schema
};
(0, import_property_expr2.forEach)(path, (_part, isBracket, isArray) => {
let part = isBracket ? trim(_part) : _part;
schema = schema.resolve({
context,
parent,
value
});
if (schema.innerType) {
let idx = isArray ? parseInt(part, 10) : 0;
if (value && idx >= value.length) {
throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path}. because there is no value at that index. `);
}
parent = value;
value = value && value[idx];
schema = schema.innerType;
}
if (!isArray) {
if (!schema.fields || !schema.fields[part])
throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a type: "${schema._type}")`);
parent = value;
value = value && value[part];
schema = schema.fields[part];
}
lastPart = part;
lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
});
return {
schema,
parent,
parentPath: lastPart
};
}
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/ReferenceSet.js
var ReferenceSet = class {
constructor() {
this.list = void 0;
this.refs = void 0;
this.list = /* @__PURE__ */ new Set();
this.refs = /* @__PURE__ */ new Map();
}
get size() {
return this.list.size + this.refs.size;
}
describe() {
const description = [];
for (const item of this.list)
description.push(item);
for (const [, ref] of this.refs)
description.push(ref.describe());
return description;
}
toArray() {
return Array.from(this.list).concat(Array.from(this.refs.values()));
}
resolveAll(resolve) {
return this.toArray().reduce((acc, e4) => acc.concat(Reference.isRef(e4) ? resolve(e4) : e4), []);
}
add(value) {
Reference.isRef(value) ? this.refs.set(value.key, value) : this.list.add(value);
}
delete(value) {
Reference.isRef(value) ? this.refs.delete(value.key) : this.list.delete(value);
}
clone() {
const next = new ReferenceSet();
next.list = new Set(this.list);
next.refs = new Map(this.refs);
return next;
}
merge(newItems, removeItems) {
const next = this.clone();
newItems.list.forEach((value) => next.add(value));
newItems.refs.forEach((value) => next.add(value));
removeItems.list.forEach((value) => next.delete(value));
removeItems.refs.forEach((value) => next.delete(value));
return next;
}
};
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/schema.js
function _extends4() {
_extends4 = Object.assign || function(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends4.apply(this, arguments);
}
var BaseSchema = class {
constructor(options) {
this.deps = [];
this.tests = void 0;
this.transforms = void 0;
this.conditions = [];
this._mutate = void 0;
this._typeError = void 0;
this._whitelist = new ReferenceSet();
this._blacklist = new ReferenceSet();
this.exclusiveTests = /* @__PURE__ */ Object.create(null);
this.spec = void 0;
this.tests = [];
this.transforms = [];
this.withMutation(() => {
this.typeError(mixed.notType);
});
this.type = (options == null ? void 0 : options.type) || "mixed";
this.spec = _extends4({
strip: false,
strict: false,
abortEarly: true,
recursive: true,
nullable: false,
presence: "optional"
}, options == null ? void 0 : options.spec);
}
// TODO: remove
get _type() {
return this.type;
}
_typeCheck(_value) {
return true;
}
clone(spec) {
if (this._mutate) {
if (spec)
Object.assign(this.spec, spec);
return this;
}
const next = Object.create(Object.getPrototypeOf(this));
next.type = this.type;
next._typeError = this._typeError;
next._whitelistError = this._whitelistError;
next._blacklistError = this._blacklistError;
next._whitelist = this._whitelist.clone();
next._blacklist = this._blacklist.clone();
next.exclusiveTests = _extends4({}, this.exclusiveTests);
next.deps = [...this.deps];
next.conditions = [...this.conditions];
next.tests = [...this.tests];
next.transforms = [...this.transforms];
next.spec = clone(_extends4({}, this.spec, spec));
return next;
}
label(label) {
let next = this.clone();
next.spec.label = label;
return next;
}
meta(...args) {
if (args.length === 0)
return this.spec.meta;
let next = this.clone();
next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);
return next;
}
// withContext(): BaseSchema<
// TCast,
// TContext,
// TOutput
// > {
// return this as any;
// }
withMutation(fn2) {
let before = this._mutate;
this._mutate = true;
let result = fn2(this);
this._mutate = before;
return result;
}
concat(schema) {
if (!schema || schema === this)
return this;
if (schema.type !== this.type && this.type !== "mixed")
throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema.type}`);
let base2 = this;
let combined = schema.clone();
const mergedSpec = _extends4({}, base2.spec, combined.spec);
combined.spec = mergedSpec;
combined._typeError || (combined._typeError = base2._typeError);
combined._whitelistError || (combined._whitelistError = base2._whitelistError);
combined._blacklistError || (combined._blacklistError = base2._blacklistError);
combined._whitelist = base2._whitelist.merge(schema._whitelist, schema._blacklist);
combined._blacklist = base2._blacklist.merge(schema._blacklist, schema._whitelist);
combined.tests = base2.tests;
combined.exclusiveTests = base2.exclusiveTests;
combined.withMutation((next) => {
schema.tests.forEach((fn2) => {
next.test(fn2.OPTIONS);
});
});
combined.transforms = [...base2.transforms, ...combined.transforms];
return combined;
}
isType(v3) {
if (this.spec.nullable && v3 === null)
return true;
return this._typeCheck(v3);
}
resolve(options) {
let schema = this;
if (schema.conditions.length) {
let conditions = schema.conditions;
schema = schema.clone();
schema.conditions = [];
schema = conditions.reduce((schema2, condition) => condition.resolve(schema2, options), schema);
schema = schema.resolve(options);
}
return schema;
}
/**
*
* @param {*} value
* @param {Object} options
* @param {*=} options.parent
* @param {*=} options.context
*/
cast(value, options = {}) {
let resolvedSchema = this.resolve(_extends4({
value
}, options));
let result = resolvedSchema._cast(value, options);
if (value !== void 0 && options.assert !== false && resolvedSchema.isType(result) !== true) {
let formattedValue = printValue(value);
let formattedResult = printValue(result);
throw new TypeError(`The value of ${options.path || "field"} could not be cast to a value that satisfies the schema type: "${resolvedSchema._type}".
attempted value: ${formattedValue}
` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ""));
}
return result;
}
_cast(rawValue, _options) {
let value = rawValue === void 0 ? rawValue : this.transforms.reduce((value2, fn2) => fn2.call(this, value2, rawValue, this), rawValue);
if (value === void 0) {
value = this.getDefault();
}
return value;
}
_validate(_value, options = {}, cb) {
let {
sync,
path,
from = [],
originalValue = _value,
strict = this.spec.strict,
abortEarly = this.spec.abortEarly
} = options;
let value = _value;
if (!strict) {
value = this._cast(value, _extends4({
assert: false
}, options));
}
let args = {
value,
path,
options,
originalValue,
schema: this,
label: this.spec.label,
sync,
from
};
let initialTests = [];
if (this._typeError)
initialTests.push(this._typeError);
let finalTests = [];
if (this._whitelistError)
finalTests.push(this._whitelistError);
if (this._blacklistError)
finalTests.push(this._blacklistError);
runTests({
args,
value,
path,
sync,
tests: initialTests,
endEarly: abortEarly
}, (err) => {
if (err)
return void cb(err, value);
runTests({
tests: this.tests.concat(finalTests),
args,
path,
sync,
value,
endEarly: abortEarly
}, cb);
});
}
validate(value, options, maybeCb) {
let schema = this.resolve(_extends4({}, options, {
value
}));
return typeof maybeCb === "function" ? schema._validate(value, options, maybeCb) : new Promise((resolve, reject) => schema._validate(value, options, (err, value2) => {
if (err)
reject(err);
else
resolve(value2);
}));
}
validateSync(value, options) {
let schema = this.resolve(_extends4({}, options, {
value
}));
let result;
schema._validate(value, _extends4({}, options, {
sync: true
}), (err, value2) => {
if (err)
throw err;
result = value2;
});
return result;
}
isValid(value, options) {
return this.validate(value, options).then(() => true, (err) => {
if (ValidationError.isError(err))
return false;
throw err;
});
}
isValidSync(value, options) {
try {
this.validateSync(value, options);
return true;
} catch (err) {
if (ValidationError.isError(err))
return false;
throw err;
}
}
_getDefault() {
let defaultValue = this.spec.default;
if (defaultValue == null) {
return defaultValue;
}
return typeof defaultValue === "function" ? defaultValue.call(this) : clone(defaultValue);
}
getDefault(options) {
let schema = this.resolve(options || {});
return schema._getDefault();
}
default(def) {
if (arguments.length === 0) {
return this._getDefault();
}
let next = this.clone({
default: def
});
return next;
}
strict(isStrict = true) {
let next = this.clone();
next.spec.strict = isStrict;
return next;
}
_isPresent(value) {
return value != null;
}
defined(message = mixed.defined) {
return this.test({
message,
name: "defined",
exclusive: true,
test(value) {
return value !== void 0;
}
});
}
required(message = mixed.required) {
return this.clone({
presence: "required"
}).withMutation((s5) => s5.test({
message,
name: "required",
exclusive: true,
test(value) {
return this.schema._isPresent(value);
}
}));
}
notRequired() {
let next = this.clone({
presence: "optional"
});
next.tests = next.tests.filter((test) => test.OPTIONS.name !== "required");
return next;
}
nullable(isNullable = true) {
let next = this.clone({
nullable: isNullable !== false
});
return next;
}
transform(fn2) {
let next = this.clone();
next.transforms.push(fn2);
return next;
}
/**
* Adds a test function to the schema's queue of tests.
* tests can be exclusive or non-exclusive.
*
* - exclusive tests, will replace any existing tests of the same name.
* - non-exclusive: can be stacked
*
* If a non-exclusive test is added to a schema with an exclusive test of the same name
* the exclusive test is removed and further tests of the same name will be stacked.
*
* If an exclusive test is added to a schema with non-exclusive tests of the same name
* the previous tests are removed and further tests of the same name will replace each other.
*/
test(...args) {
let opts;
if (args.length === 1) {
if (typeof args[0] === "function") {
opts = {
test: args[0]
};
} else {
opts = args[0];
}
} else if (args.length === 2) {
opts = {
name: args[0],
test: args[1]
};
} else {
opts = {
name: args[0],
message: args[1],
test: args[2]
};
}
if (opts.message === void 0)
opts.message = mixed.default;
if (typeof opts.test !== "function")
throw new TypeError("`test` is a required parameters");
let next = this.clone();
let validate = createValidation(opts);
let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;
if (opts.exclusive) {
if (!opts.name)
throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
}
if (opts.name)
next.exclusiveTests[opts.name] = !!opts.exclusive;
next.tests = next.tests.filter((fn2) => {
if (fn2.OPTIONS.name === opts.name) {
if (isExclusive)
return false;
if (fn2.OPTIONS.test === validate.OPTIONS.test)
return false;
}
return true;
});
next.tests.push(validate);
return next;
}
when(keys, options) {
if (!Array.isArray(keys) && typeof keys !== "string") {
options = keys;
keys = ".";
}
let next = this.clone();
let deps = toArray(keys).map((key) => new Reference(key));
deps.forEach((dep) => {
if (dep.isSibling)
next.deps.push(dep.key);
});
next.conditions.push(new Condition_default(deps, options));
return next;
}
typeError(message) {
let next = this.clone();
next._typeError = createValidation({
message,
name: "typeError",
test(value) {
if (value !== void 0 && !this.schema.isType(value))
return this.createError({
params: {
type: this.schema._type
}
});
return true;
}
});
return next;
}
oneOf(enums, message = mixed.oneOf) {
let next = this.clone();
enums.forEach((val) => {
next._whitelist.add(val);
next._blacklist.delete(val);
});
next._whitelistError = createValidation({
message,
name: "oneOf",
test(value) {
if (value === void 0)
return true;
let valids = this.schema._whitelist;
let resolved = valids.resolveAll(this.resolve);
return resolved.includes(value) ? true : this.createError({
params: {
values: valids.toArray().join(", "),
resolved
}
});
}
});
return next;
}
notOneOf(enums, message = mixed.notOneOf) {
let next = this.clone();
enums.forEach((val) => {
next._blacklist.add(val);
next._whitelist.delete(val);
});
next._blacklistError = createValidation({
message,
name: "notOneOf",
test(value) {
let invalids = this.schema._blacklist;
let resolved = invalids.resolveAll(this.resolve);
if (resolved.includes(value))
return this.createError({
params: {
values: invalids.toArray().join(", "),
resolved
}
});
return true;
}
});
return next;
}
strip(strip = true) {
let next = this.clone();
next.spec.strip = strip;
return next;
}
describe() {
const next = this.clone();
const {
label,
meta
} = next.spec;
const description = {
meta,
label,
type: next.type,
oneOf: next._whitelist.describe(),
notOneOf: next._blacklist.describe(),
tests: next.tests.map((fn2) => ({
name: fn2.OPTIONS.name,
params: fn2.OPTIONS.params
})).filter((n2, idx, list) => list.findIndex((c4) => c4.name === n2.name) === idx)
};
return description;
}
};
BaseSchema.prototype.__isYupSchema__ = true;
for (const method of ["validate", "validateSync"])
BaseSchema.prototype[`${method}At`] = function(path, value, options = {}) {
const {
parent,
parentPath,
schema
} = getIn(this, path, value, options.context);
return schema[method](parent && parent[parentPath], _extends4({}, options, {
parent,
path
}));
};
for (const alias of ["equals", "is"])
BaseSchema.prototype[alias] = BaseSchema.prototype.oneOf;
for (const alias of ["not", "nope"])
BaseSchema.prototype[alias] = BaseSchema.prototype.notOneOf;
BaseSchema.prototype.optional = BaseSchema.prototype.notRequired;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/mixed.js
var Mixed = BaseSchema;
function create() {
return new Mixed();
}
create.prototype = Mixed.prototype;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/isAbsent.js
var isAbsent = (value) => value == null;
var isAbsent_default = isAbsent;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/boolean.js
function create2() {
return new BooleanSchema();
}
var BooleanSchema = class extends BaseSchema {
constructor() {
super({
type: "boolean"
});
this.withMutation(() => {
this.transform(function(value) {
if (!this.isType(value)) {
if (/^(true|1)$/i.test(String(value)))
return true;
if (/^(false|0)$/i.test(String(value)))
return false;
}
return value;
});
});
}
_typeCheck(v3) {
if (v3 instanceof Boolean)
v3 = v3.valueOf();
return typeof v3 === "boolean";
}
isTrue(message = boolean.isValue) {
return this.test({
message,
name: "is-value",
exclusive: true,
params: {
value: "true"
},
test(value) {
return isAbsent_default(value) || value === true;
}
});
}
isFalse(message = boolean.isValue) {
return this.test({
message,
name: "is-value",
exclusive: true,
params: {
value: "false"
},
test(value) {
return isAbsent_default(value) || value === false;
}
});
}
};
create2.prototype = BooleanSchema.prototype;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/string.js
var rEmail = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
var rUrl = /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;
var rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
var isTrimmed = (value) => isAbsent_default(value) || value === value.trim();
var objStringTag = {}.toString();
function create3() {
return new StringSchema();
}
var StringSchema = class extends BaseSchema {
constructor() {
super({
type: "string"
});
this.withMutation(() => {
this.transform(function(value) {
if (this.isType(value))
return value;
if (Array.isArray(value))
return value;
const strValue = value != null && value.toString ? value.toString() : value;
if (strValue === objStringTag)
return value;
return strValue;
});
});
}
_typeCheck(value) {
if (value instanceof String)
value = value.valueOf();
return typeof value === "string";
}
_isPresent(value) {
return super._isPresent(value) && !!value.length;
}
length(length, message = string.length) {
return this.test({
message,
name: "length",
exclusive: true,
params: {
length
},
test(value) {
return isAbsent_default(value) || value.length === this.resolve(length);
}
});
}
min(min, message = string.min) {
return this.test({
message,
name: "min",
exclusive: true,
params: {
min
},
test(value) {
return isAbsent_default(value) || value.length >= this.resolve(min);
}
});
}
max(max, message = string.max) {
return this.test({
name: "max",
exclusive: true,
message,
params: {
max
},
test(value) {
return isAbsent_default(value) || value.length <= this.resolve(max);
}
});
}
matches(regex, options) {
let excludeEmptyString = false;
let message;
let name;
if (options) {
if (typeof options === "object") {
({
excludeEmptyString = false,
message,
name
} = options);
} else {
message = options;
}
}
return this.test({
name: name || "matches",
message: message || string.matches,
params: {
regex
},
test: (value) => isAbsent_default(value) || value === "" && excludeEmptyString || value.search(regex) !== -1
});
}
email(message = string.email) {
return this.matches(rEmail, {
name: "email",
message,
excludeEmptyString: true
});
}
url(message = string.url) {
return this.matches(rUrl, {
name: "url",
message,
excludeEmptyString: true
});
}
uuid(message = string.uuid) {
return this.matches(rUUID, {
name: "uuid",
message,
excludeEmptyString: false
});
}
//-- transforms --
ensure() {
return this.default("").transform((val) => val === null ? "" : val);
}
trim(message = string.trim) {
return this.transform((val) => val != null ? val.trim() : val).test({
message,
name: "trim",
test: isTrimmed
});
}
lowercase(message = string.lowercase) {
return this.transform((value) => !isAbsent_default(value) ? value.toLowerCase() : value).test({
message,
name: "string_case",
exclusive: true,
test: (value) => isAbsent_default(value) || value === value.toLowerCase()
});
}
uppercase(message = string.uppercase) {
return this.transform((value) => !isAbsent_default(value) ? value.toUpperCase() : value).test({
message,
name: "string_case",
exclusive: true,
test: (value) => isAbsent_default(value) || value === value.toUpperCase()
});
}
};
create3.prototype = StringSchema.prototype;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/number.js
var isNaN2 = (value) => value != +value;
function create4() {
return new NumberSchema();
}
var NumberSchema = class extends BaseSchema {
constructor() {
super({
type: "number"
});
this.withMutation(() => {
this.transform(function(value) {
let parsed = value;
if (typeof parsed === "string") {
parsed = parsed.replace(/\s/g, "");
if (parsed === "")
return NaN;
parsed = +parsed;
}
if (this.isType(parsed))
return parsed;
return parseFloat(parsed);
});
});
}
_typeCheck(value) {
if (value instanceof Number)
value = value.valueOf();
return typeof value === "number" && !isNaN2(value);
}
min(min, message = number.min) {
return this.test({
message,
name: "min",
exclusive: true,
params: {
min
},
test(value) {
return isAbsent_default(value) || value >= this.resolve(min);
}
});
}
max(max, message = number.max) {
return this.test({
message,
name: "max",
exclusive: true,
params: {
max
},
test(value) {
return isAbsent_default(value) || value <= this.resolve(max);
}
});
}
lessThan(less, message = number.lessThan) {
return this.test({
message,
name: "max",
exclusive: true,
params: {
less
},
test(value) {
return isAbsent_default(value) || value < this.resolve(less);
}
});
}
moreThan(more, message = number.moreThan) {
return this.test({
message,
name: "min",
exclusive: true,
params: {
more
},
test(value) {
return isAbsent_default(value) || value > this.resolve(more);
}
});
}
positive(msg = number.positive) {
return this.moreThan(0, msg);
}
negative(msg = number.negative) {
return this.lessThan(0, msg);
}
integer(message = number.integer) {
return this.test({
name: "integer",
message,
test: (val) => isAbsent_default(val) || Number.isInteger(val)
});
}
truncate() {
return this.transform((value) => !isAbsent_default(value) ? value | 0 : value);
}
round(method) {
var _method;
let avail = ["ceil", "floor", "round", "trunc"];
method = ((_method = method) == null ? void 0 : _method.toLowerCase()) || "round";
if (method === "trunc")
return this.truncate();
if (avail.indexOf(method.toLowerCase()) === -1)
throw new TypeError("Only valid options for round() are: " + avail.join(", "));
return this.transform((value) => !isAbsent_default(value) ? Math[method](value) : value);
}
};
create4.prototype = NumberSchema.prototype;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/isodate.js
var isoReg = /^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;
function parseIsoDate(date2) {
var numericKeys = [1, 4, 5, 6, 7, 10, 11], minutesOffset = 0, timestamp, struct;
if (struct = isoReg.exec(date2)) {
for (var i4 = 0, k5; k5 = numericKeys[i4]; ++i4)
struct[k5] = +struct[k5] || 0;
struct[2] = (+struct[2] || 1) - 1;
struct[3] = +struct[3] || 1;
struct[7] = struct[7] ? String(struct[7]).substr(0, 3) : 0;
if ((struct[8] === void 0 || struct[8] === "") && (struct[9] === void 0 || struct[9] === ""))
timestamp = +new Date(struct[1], struct[2], struct[3], struct[4], struct[5], struct[6], struct[7]);
else {
if (struct[8] !== "Z" && struct[9] !== void 0) {
minutesOffset = struct[10] * 60 + struct[11];
if (struct[9] === "+")
minutesOffset = 0 - minutesOffset;
}
timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]);
}
} else
timestamp = Date.parse ? Date.parse(date2) : NaN;
return timestamp;
}
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/date.js
var invalidDate = /* @__PURE__ */ new Date("");
var isDate2 = (obj) => Object.prototype.toString.call(obj) === "[object Date]";
function create5() {
return new DateSchema();
}
var DateSchema = class extends BaseSchema {
constructor() {
super({
type: "date"
});
this.withMutation(() => {
this.transform(function(value) {
if (this.isType(value))
return value;
value = parseIsoDate(value);
return !isNaN(value) ? new Date(value) : invalidDate;
});
});
}
_typeCheck(v3) {
return isDate2(v3) && !isNaN(v3.getTime());
}
prepareParam(ref, name) {
let param;
if (!Reference.isRef(ref)) {
let cast = this.cast(ref);
if (!this._typeCheck(cast))
throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
param = cast;
} else {
param = ref;
}
return param;
}
min(min, message = date.min) {
let limit = this.prepareParam(min, "min");
return this.test({
message,
name: "min",
exclusive: true,
params: {
min
},
test(value) {
return isAbsent_default(value) || value >= this.resolve(limit);
}
});
}
max(max, message = date.max) {
let limit = this.prepareParam(max, "max");
return this.test({
message,
name: "max",
exclusive: true,
params: {
max
},
test(value) {
return isAbsent_default(value) || value <= this.resolve(limit);
}
});
}
};
DateSchema.INVALID_DATE = invalidDate;
create5.prototype = DateSchema.prototype;
create5.INVALID_DATE = invalidDate;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/object.js
var import_has3 = __toESM(require_has());
var import_snakeCase = __toESM(require_snakeCase());
var import_camelCase = __toESM(require_camelCase());
var import_mapKeys = __toESM(require_mapKeys());
var import_mapValues2 = __toESM(require_mapValues());
var import_property_expr4 = __toESM(require_property_expr());
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/sortFields.js
var import_has2 = __toESM(require_has());
var import_toposort = __toESM(require_toposort());
var import_property_expr3 = __toESM(require_property_expr());
function sortFields(fields, excludedEdges = []) {
let edges = [];
let nodes = /* @__PURE__ */ new Set();
let excludes = new Set(excludedEdges.map(([a5, b4]) => `${a5}-${b4}`));
function addNode(depPath, key) {
let node = (0, import_property_expr3.split)(depPath)[0];
nodes.add(node);
if (!excludes.has(`${key}-${node}`))
edges.push([key, node]);
}
for (const key in fields)
if ((0, import_has2.default)(fields, key)) {
let value = fields[key];
nodes.add(key);
if (Reference.isRef(value) && value.isSibling)
addNode(value.path, key);
else if (isSchema_default(value) && "deps" in value)
value.deps.forEach((path) => addNode(path, key));
}
return import_toposort.default.array(Array.from(nodes), edges).reverse();
}
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/sortByKeyOrder.js
function findIndex2(arr, err) {
let idx = Infinity;
arr.some((key, ii) => {
var _err$path;
if (((_err$path = err.path) == null ? void 0 : _err$path.indexOf(key)) !== -1) {
idx = ii;
return true;
}
});
return idx;
}
function sortByKeyOrder(keys) {
return (a5, b4) => {
return findIndex2(keys, a5) - findIndex2(keys, b4);
};
}
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/object.js
function _extends5() {
_extends5 = Object.assign || function(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends5.apply(this, arguments);
}
var isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
function unknown(ctx, value) {
let known = Object.keys(ctx.fields);
return Object.keys(value).filter((key) => known.indexOf(key) === -1);
}
var defaultSort = sortByKeyOrder([]);
var ObjectSchema = class extends BaseSchema {
constructor(spec) {
super({
type: "object"
});
this.fields = /* @__PURE__ */ Object.create(null);
this._sortErrors = defaultSort;
this._nodes = [];
this._excludedEdges = [];
this.withMutation(() => {
this.transform(function coerce(value) {
if (typeof value === "string") {
try {
value = JSON.parse(value);
} catch (err) {
value = null;
}
}
if (this.isType(value))
return value;
return null;
});
if (spec) {
this.shape(spec);
}
});
}
_typeCheck(value) {
return isObject(value) || typeof value === "function";
}
_cast(_value, options = {}) {
var _options$stripUnknown;
let value = super._cast(_value, options);
if (value === void 0)
return this.getDefault();
if (!this._typeCheck(value))
return value;
let fields = this.fields;
let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;
let props = this._nodes.concat(Object.keys(value).filter((v3) => this._nodes.indexOf(v3) === -1));
let intermediateValue = {};
let innerOptions = _extends5({}, options, {
parent: intermediateValue,
__validating: options.__validating || false
});
let isChanged = false;
for (const prop of props) {
let field = fields[prop];
let exists = (0, import_has3.default)(value, prop);
if (field) {
let fieldValue;
let inputValue = value[prop];
innerOptions.path = (options.path ? `${options.path}.` : "") + prop;
field = field.resolve({
value: inputValue,
context: options.context,
parent: intermediateValue
});
let fieldSpec = "spec" in field ? field.spec : void 0;
let strict = fieldSpec == null ? void 0 : fieldSpec.strict;
if (fieldSpec == null ? void 0 : fieldSpec.strip) {
isChanged = isChanged || prop in value;
continue;
}
fieldValue = !options.__validating || !strict ? (
// TODO: use _cast, this is double resolving
field.cast(value[prop], innerOptions)
) : value[prop];
if (fieldValue !== void 0) {
intermediateValue[prop] = fieldValue;
}
} else if (exists && !strip) {
intermediateValue[prop] = value[prop];
}
if (intermediateValue[prop] !== value[prop]) {
isChanged = true;
}
}
return isChanged ? intermediateValue : value;
}
_validate(_value, opts = {}, callback) {
let errors2 = [];
let {
sync,
from = [],
originalValue = _value,
abortEarly = this.spec.abortEarly,
recursive = this.spec.recursive
} = opts;
from = [{
schema: this,
value: originalValue
}, ...from];
opts.__validating = true;
opts.originalValue = originalValue;
opts.from = from;
super._validate(_value, opts, (err, value) => {
if (err) {
if (!ValidationError.isError(err) || abortEarly) {
return void callback(err, value);
}
errors2.push(err);
}
if (!recursive || !isObject(value)) {
callback(errors2[0] || null, value);
return;
}
originalValue = originalValue || value;
let tests = this._nodes.map((key) => (_3, cb) => {
let path = key.indexOf(".") === -1 ? (opts.path ? `${opts.path}.` : "") + key : `${opts.path || ""}["${key}"]`;
let field = this.fields[key];
if (field && "validate" in field) {
field.validate(value[key], _extends5({}, opts, {
// @ts-ignore
path,
from,
// inner fields are always strict:
// 1. this isn't strict so the casting will also have cast inner values
// 2. this is strict in which case the nested values weren't cast either
strict: true,
parent: value,
originalValue: originalValue[key]
}), cb);
return;
}
cb(null);
});
runTests({
sync,
tests,
value,
errors: errors2,
endEarly: abortEarly,
sort: this._sortErrors,
path: opts.path
}, callback);
});
}
clone(spec) {
const next = super.clone(spec);
next.fields = _extends5({}, this.fields);
next._nodes = this._nodes;
next._excludedEdges = this._excludedEdges;
next._sortErrors = this._sortErrors;
return next;
}
concat(schema) {
let next = super.concat(schema);
let nextFields = next.fields;
for (let [field, schemaOrRef] of Object.entries(this.fields)) {
const target = nextFields[field];
if (target === void 0) {
nextFields[field] = schemaOrRef;
} else if (target instanceof BaseSchema && schemaOrRef instanceof BaseSchema) {
nextFields[field] = schemaOrRef.concat(target);
}
}
return next.withMutation(() => next.shape(nextFields, this._excludedEdges));
}
getDefaultFromShape() {
let dft = {};
this._nodes.forEach((key) => {
const field = this.fields[key];
dft[key] = "default" in field ? field.getDefault() : void 0;
});
return dft;
}
_getDefault() {
if ("default" in this.spec) {
return super._getDefault();
}
if (!this._nodes.length) {
return void 0;
}
return this.getDefaultFromShape();
}
shape(additions, excludes = []) {
let next = this.clone();
let fields = Object.assign(next.fields, additions);
next.fields = fields;
next._sortErrors = sortByKeyOrder(Object.keys(fields));
if (excludes.length) {
if (!Array.isArray(excludes[0]))
excludes = [excludes];
next._excludedEdges = [...next._excludedEdges, ...excludes];
}
next._nodes = sortFields(fields, next._excludedEdges);
return next;
}
pick(keys) {
const picked = {};
for (const key of keys) {
if (this.fields[key])
picked[key] = this.fields[key];
}
return this.clone().withMutation((next) => {
next.fields = {};
return next.shape(picked);
});
}
omit(keys) {
const next = this.clone();
const fields = next.fields;
next.fields = {};
for (const key of keys) {
delete fields[key];
}
return next.withMutation(() => next.shape(fields));
}
from(from, to, alias) {
let fromGetter = (0, import_property_expr4.getter)(from, true);
return this.transform((obj) => {
if (obj == null)
return obj;
let newObj = obj;
if ((0, import_has3.default)(obj, from)) {
newObj = _extends5({}, obj);
if (!alias)
delete newObj[from];
newObj[to] = fromGetter(obj);
}
return newObj;
});
}
noUnknown(noAllow = true, message = object.noUnknown) {
if (typeof noAllow === "string") {
message = noAllow;
noAllow = true;
}
let next = this.test({
name: "noUnknown",
exclusive: true,
message,
test(value) {
if (value == null)
return true;
const unknownKeys = unknown(this.schema, value);
return !noAllow || unknownKeys.length === 0 || this.createError({
params: {
unknown: unknownKeys.join(", ")
}
});
}
});
next.spec.noUnknown = noAllow;
return next;
}
unknown(allow = true, message = object.noUnknown) {
return this.noUnknown(!allow, message);
}
transformKeys(fn2) {
return this.transform((obj) => obj && (0, import_mapKeys.default)(obj, (_3, key) => fn2(key)));
}
camelCase() {
return this.transformKeys(import_camelCase.default);
}
snakeCase() {
return this.transformKeys(import_snakeCase.default);
}
constantCase() {
return this.transformKeys((key) => (0, import_snakeCase.default)(key).toUpperCase());
}
describe() {
let base2 = super.describe();
base2.fields = (0, import_mapValues2.default)(this.fields, (value) => value.describe());
return base2;
}
};
function create6(spec) {
return new ObjectSchema(spec);
}
create6.prototype = ObjectSchema.prototype;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/array.js
function _extends6() {
_extends6 = Object.assign || function(target) {
for (var i4 = 1; i4 < arguments.length; i4++) {
var source = arguments[i4];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends6.apply(this, arguments);
}
function create7(type) {
return new ArraySchema(type);
}
var ArraySchema = class extends BaseSchema {
constructor(type) {
super({
type: "array"
});
this.innerType = void 0;
this.innerType = type;
this.withMutation(() => {
this.transform(function(values) {
if (typeof values === "string")
try {
values = JSON.parse(values);
} catch (err) {
values = null;
}
return this.isType(values) ? values : null;
});
});
}
_typeCheck(v3) {
return Array.isArray(v3);
}
get _subType() {
return this.innerType;
}
_cast(_value, _opts) {
const value = super._cast(_value, _opts);
if (!this._typeCheck(value) || !this.innerType)
return value;
let isChanged = false;
const castArray = value.map((v3, idx) => {
const castElement = this.innerType.cast(v3, _extends6({}, _opts, {
path: `${_opts.path || ""}[${idx}]`
}));
if (castElement !== v3) {
isChanged = true;
}
return castElement;
});
return isChanged ? castArray : value;
}
_validate(_value, options = {}, callback) {
var _options$abortEarly, _options$recursive;
let errors2 = [];
let sync = options.sync;
let path = options.path;
let innerType = this.innerType;
let endEarly = (_options$abortEarly = options.abortEarly) != null ? _options$abortEarly : this.spec.abortEarly;
let recursive = (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive;
let originalValue = options.originalValue != null ? options.originalValue : _value;
super._validate(_value, options, (err, value) => {
if (err) {
if (!ValidationError.isError(err) || endEarly) {
return void callback(err, value);
}
errors2.push(err);
}
if (!recursive || !innerType || !this._typeCheck(value)) {
callback(errors2[0] || null, value);
return;
}
originalValue = originalValue || value;
let tests = new Array(value.length);
for (let idx = 0; idx < value.length; idx++) {
let item = value[idx];
let path2 = `${options.path || ""}[${idx}]`;
let innerOptions = _extends6({}, options, {
path: path2,
strict: true,
parent: value,
index: idx,
originalValue: originalValue[idx]
});
tests[idx] = (_3, cb) => innerType.validate(item, innerOptions, cb);
}
runTests({
sync,
path,
value,
errors: errors2,
endEarly,
tests
}, callback);
});
}
clone(spec) {
const next = super.clone(spec);
next.innerType = this.innerType;
return next;
}
concat(schema) {
let next = super.concat(schema);
next.innerType = this.innerType;
if (schema.innerType)
next.innerType = next.innerType ? (
// @ts-expect-error Lazy doesn't have concat()
next.innerType.concat(schema.innerType)
) : schema.innerType;
return next;
}
of(schema) {
let next = this.clone();
if (!isSchema_default(schema))
throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema));
next.innerType = schema;
return next;
}
length(length, message = array.length) {
return this.test({
message,
name: "length",
exclusive: true,
params: {
length
},
test(value) {
return isAbsent_default(value) || value.length === this.resolve(length);
}
});
}
min(min, message) {
message = message || array.min;
return this.test({
message,
name: "min",
exclusive: true,
params: {
min
},
// FIXME(ts): Array
test(value) {
return isAbsent_default(value) || value.length >= this.resolve(min);
}
});
}
max(max, message) {
message = message || array.max;
return this.test({
message,
name: "max",
exclusive: true,
params: {
max
},
test(value) {
return isAbsent_default(value) || value.length <= this.resolve(max);
}
});
}
ensure() {
return this.default(() => []).transform((val, original) => {
if (this._typeCheck(val))
return val;
return original == null ? [] : [].concat(original);
});
}
compact(rejector) {
let reject = !rejector ? (v3) => !!v3 : (v3, i4, a5) => !rejector(v3, i4, a5);
return this.transform((values) => values != null ? values.filter(reject) : values);
}
describe() {
let base2 = super.describe();
if (this.innerType)
base2.innerType = this.innerType.describe();
return base2;
}
nullable(isNullable = true) {
return super.nullable(isNullable);
}
defined() {
return super.defined();
}
required(msg) {
return super.required(msg);
}
};
create7.prototype = ArraySchema.prototype;
// ../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/setLocale.js
function setLocale(custom) {
Object.keys(custom).forEach((type) => {
Object.keys(custom[type]).forEach((method) => {
locale_default[type][method] = custom[type][method];
});
});
}
// src/hooks/listener.ts
init_hooks_module();
function useListener(action) {
const [state, setState] = p3({});
const subscriber = (listener) => {
if (listener) {
setState({
toBeRan: () => {
const whatWeGetFromTheListener = listener();
return action(whatWeGetFromTheListener);
}
});
} else {
setState({
toBeRan: void 0
});
}
};
const activator = state.toBeRan ? () => __async(this, null, function* () {
if (state.toBeRan) {
return state.toBeRan();
}
return Promise.reject();
}) : void 0;
return [activator, subscriber];
}
// src/schemas/index.ts
setLocale({
mixed: {
default: "field_invalid"
},
number: {
min: ({ min }) => ({ key: "field_too_short", values: { min } }),
max: ({ max }) => ({ key: "field_too_big", values: { max } })
}
});
function listOfPayToUrisAreValid(values) {
return !!values && values.every((v3) => v3 && PAYTO_REGEX.test(v3));
}
function currencyWithAmountIsValid(value) {
return !!value && AMOUNT_REGEX.test(value);
}
function currencyGreaterThan0(value) {
if (value) {
try {
const [, amount] = value.split(":");
const intAmount = parseInt(amount, 10);
return intAmount > 0;
} catch (e4) {
return false;
}
}
return true;
}
var InstanceSchema = create6().shape({
id: create3().required().meta({ type: "url" }),
name: create3().required(),
auth: create6().shape({
method: create3().matches(/^(external|token)$/),
token: create3().optional().nullable()
}),
payto_uris: create7().of(create3()).min(1).meta({ type: "array" }).test("payto", "{path} is not valid", listOfPayToUrisAreValid),
default_max_deposit_fee: create3().required().test("amount", "the amount is not valid", currencyWithAmountIsValid).meta({ type: "amount" }),
default_max_wire_fee: create3().required().test("amount", "{path} is not valid", currencyWithAmountIsValid).meta({ type: "amount" }),
default_wire_fee_amortization: create4().required(),
address: create6().shape({
country: create3().optional(),
address_lines: create7().of(create3()).max(7).optional(),
building_number: create3().optional(),
building_name: create3().optional(),
street: create3().optional(),
post_code: create3().optional(),
town_location: create3().optional(),
town: create3(),
district: create3().optional(),
country_subdivision: create3().optional()
}).meta({ type: "group" }),
jurisdiction: create6().shape({
country: create3().optional(),
address_lines: create7().of(create3()).max(7).optional(),
building_number: create3().optional(),
building_name: create3().optional(),
street: create3().optional(),
post_code: create3().optional(),
town_location: create3().optional(),
town: create3(),
district: create3().optional(),
country_subdivision: create3().optional()
}).meta({ type: "group" }),
// default_pay_delay: yup.object()
// .shape({ d_us: yup.number() })
// .required()
// .meta({ type: 'duration' }),
// .transform(numberToDuration),
default_wire_transfer_delay: create6().shape({ d_us: create4() }).required().meta({ type: "duration" })
// .transform(numberToDuration),
});
var InstanceUpdateSchema = InstanceSchema.clone().omit(["id"]);
var InstanceCreateSchema = InstanceSchema.clone();
var AuthorizeRewardSchema = create6().shape({
justification: create3().required(),
amount: create3().required().test("amount", "the amount is not valid", currencyWithAmountIsValid).test("amount_positive", "the amount is not valid", currencyGreaterThan0),
next_url: create3().required()
});
var OrderCreateSchema = create6().shape({
pricing: create6().required().shape({
summary: create3().ensure().required(),
order_price: create3().ensure().required().test("amount", "the amount is not valid", currencyWithAmountIsValid).test(
"amount_positive",
"the amount should be greater than 0",
currencyGreaterThan0
)
}),
// extra: yup.object().test("extra", "is not a JSON format", stringIsValidJSON),
payments: create6().required().shape({
refund_deadline: create5().test(
"future",
"should be in the future",
(d5) => d5 ? isFuture(d5) : true
),
pay_deadline: create5().test(
"future",
"should be in the future",
(d5) => d5 ? isFuture(d5) : true
),
auto_refund_deadline: create5().test(
"future",
"should be in the future",
(d5) => d5 ? isFuture(d5) : true
),
delivery_date: create5().test(
"future",
"should be in the future",
(d5) => d5 ? isFuture(d5) : true
)
}).test("payment", "dates", (d5) => {
if (d5.pay_deadline && d5.refund_deadline && isAfter(d5.refund_deadline, d5.pay_deadline)) {
return new ValidationError(
"pay deadline should be greater than refund",
"asd",
"payments.pay_deadline"
);
}
return true;
})
});
var ProductCreateSchema = create6().shape({
product_id: create3().ensure().required(),
description: create3().required(),
unit: create3().ensure().required(),
price: create3().required().test("amount", "the amount is not valid", currencyWithAmountIsValid),
stock: create6({}).optional(),
minimum_age: create4().optional().min(0)
});
var ProductUpdateSchema = create6().shape({
description: create3().required(),
price: create3().required().test("amount", "the amount is not valid", currencyWithAmountIsValid),
stock: create6({}).optional(),
minimum_age: create4().optional().min(0)
});
var TaxSchema = create6().shape({
name: create3().required().ensure(),
tax: create3().required().test("amount", "the amount is not valid", currencyWithAmountIsValid)
});
var NonInventoryProductSchema = create6().shape({
quantity: create4().required().positive(),
description: create3().required(),
unit: create3().ensure().required(),
price: create3().required().test("amount", "the amount is not valid", currencyWithAmountIsValid)
});
// src/components/form/InputTaxes.tsx
init_preact_module();
init_hooks_module();
function InputTaxes({
name,
readonly,
label
}) {
const { value: taxes, onChange } = useField(name);
const [value, valueHandler] = p3({});
let errors2 = {};
try {
TaxSchema.validateSync(value, { abortEarly: false });
} catch (err) {
if (err instanceof ValidationError) {
const yupErrors = err.inner;
errors2 = yupErrors.reduce(
(prev, cur) => !cur.path ? prev : __spreadProps(__spreadValues({}, prev), { [cur.path]: cur.message }),
{}
);
}
}
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submit = T2(() => {
onChange([value, ...taxes]);
valueHandler({});
}, [value]);
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(
InputGroup,
{
name: "tax",
label,
alternative: taxes.length > 0 && /* @__PURE__ */ h("p", null, "This product has ", taxes.length, " applicable taxes configured.")
},
/* @__PURE__ */ h(
FormProvider,
{
name: "tax",
errors: errors2,
object: value,
valueHandler
},
/* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }), /* @__PURE__ */ h("div", { class: "field-body", style: { display: "block" } }, taxes.map((v3, i4) => /* @__PURE__ */ h(
"div",
{
key: i4,
class: "tags has-addons mt-3 mb-0 mr-3",
style: { flexWrap: "nowrap" }
},
/* @__PURE__ */ h(
"span",
{
class: "tag is-medium is-info mb-0",
style: { maxWidth: "90%" }
},
/* @__PURE__ */ h("b", null, v3.tax),
": ",
v3.name
),
/* @__PURE__ */ h(
"a",
{
class: "tag is-medium is-danger is-delete mb-0",
onClick: () => {
onChange(taxes.filter((f3) => f3 !== v3));
valueHandler(v3);
}
}
)
)), !taxes.length && i18n2.str`No taxes configured for this product.`)),
/* @__PURE__ */ h(
Input,
{
name: "tax",
label: i18n2.str`Amount`,
tooltip: i18n2.str`Taxes can be in currencies that differ from the main currency used by the merchant.`
},
/* @__PURE__ */ h(i18n2.Translate, null, 'Enter currency and value separated with a colon, e.g. "USD:2.3".')
),
/* @__PURE__ */ h(
Input,
{
name: "name",
label: i18n2.str`Description`,
tooltip: i18n2.str`Legal name of the tax, e.g. VAT or import duties.`
}
),
/* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, /* @__PURE__ */ h(
"button",
{
class: "button is-info",
"data-tooltip": i18n2.str`add tax to the tax list`,
disabled: hasErrors,
onClick: submit
},
/* @__PURE__ */ h(i18n2.Translate, null, "Add")
))
)
);
}
// src/components/product/NonInventoryProductForm.tsx
function NonInventoryProductFrom({
productToEdit,
onAddProduct
}) {
const [showCreateProduct, setShowCreateProduct] = p3(false);
const isEditing = !!productToEdit;
h2(() => {
setShowCreateProduct(isEditing);
}, [isEditing]);
const [submitForm, addFormSubmitter] = useListener((result) => {
if (result) {
setShowCreateProduct(false);
return onAddProduct({
quantity: result.quantity || 0,
taxes: result.taxes || [],
description: result.description || "",
image: result.image || "",
price: result.price || "",
unit: result.unit || ""
});
}
return Promise.resolve();
});
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "buttons" }, /* @__PURE__ */ h(
"button",
{
class: "button is-success",
"data-tooltip": i18n2.str`describe and add a product that is not in the inventory list`,
onClick: () => setShowCreateProduct(true)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Add custom product")
)), showCreateProduct && /* @__PURE__ */ h("div", { class: "modal is-active" }, /* @__PURE__ */ h(
"div",
{
class: "modal-background ",
onClick: () => setShowCreateProduct(false)
}
), /* @__PURE__ */ h("div", { class: "modal-card" }, /* @__PURE__ */ h("header", { class: "modal-card-head" }, /* @__PURE__ */ h("p", { class: "modal-card-title" }, i18n2.str`Complete information of the product`), /* @__PURE__ */ h(
"button",
{
class: "delete ",
"aria-label": "close",
onClick: () => setShowCreateProduct(false)
}
)), /* @__PURE__ */ h("section", { class: "modal-card-body" }, /* @__PURE__ */ h(
ProductForm,
{
initial: productToEdit,
onSubscribe: addFormSubmitter
}
)), /* @__PURE__ */ h("footer", { class: "modal-card-foot" }, /* @__PURE__ */ h("div", { class: "buttons is-right", style: { width: "100%" } }, /* @__PURE__ */ h(
"button",
{
class: "button ",
onClick: () => setShowCreateProduct(false)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Cancel")
), /* @__PURE__ */ h(
"button",
{
class: "button is-info ",
disabled: !submitForm,
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
)))), /* @__PURE__ */ h(
"button",
{
class: "modal-close is-large ",
"aria-label": "close",
onClick: () => setShowCreateProduct(false)
}
)));
}
function ProductForm({ onSubscribe, initial: initial2 }) {
const [value, valueHandler] = p3(__spreadValues({
taxes: []
}, initial2));
let errors2 = {};
try {
NonInventoryProductSchema.validateSync(value, { abortEarly: false });
} catch (err) {
if (err instanceof ValidationError) {
const yupErrors = err.inner;
errors2 = yupErrors.reduce(
(prev, cur) => !cur.path ? prev : __spreadProps(__spreadValues({}, prev), { [cur.path]: cur.message }),
{}
);
}
}
const submit = T2(() => {
return value;
}, [value]);
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
h2(() => {
onSubscribe(hasErrors ? void 0 : submit);
}, [submit, hasErrors]);
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h(
FormProvider,
{
name: "product",
errors: errors2,
object: value,
valueHandler
},
/* @__PURE__ */ h(
InputImage,
{
name: "image",
label: i18n2.str`Image`,
tooltip: i18n2.str`photo of the product`
}
),
/* @__PURE__ */ h(
Input,
{
name: "description",
inputType: "multiline",
label: i18n2.str`Description`,
tooltip: i18n2.str`full product description`
}
),
/* @__PURE__ */ h(
Input,
{
name: "unit",
label: i18n2.str`Unit`,
tooltip: i18n2.str`name of the product unit`
}
),
/* @__PURE__ */ h(
InputCurrency,
{
name: "price",
label: i18n2.str`Price`,
tooltip: i18n2.str`amount in the current currency`
}
),
/* @__PURE__ */ h(
InputNumber2,
{
name: "quantity",
label: i18n2.str`Quantity`,
tooltip: i18n2.str`how many products will be added`
}
),
/* @__PURE__ */ h(InputTaxes, { name: "taxes", label: i18n2.str`Taxes` })
));
}
// src/components/product/ProductList.tsx
init_preact_module();
function ProductList({ list, actions = [] }) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "image")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "description")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "quantity")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "unit price")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "total price")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, list.map((entry, index) => {
const unitPrice = !entry.price ? "0" : entry.price;
const totalPrice = !entry.price ? "0" : Amounts.stringify(
Amounts.mult(
Amounts.parseOrThrow(entry.price),
entry.quantity
).amount
);
return /* @__PURE__ */ h("tr", { key: index }, /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(
"img",
{
style: { height: 32, width: 32 },
src: entry.image ? entry.image : empty_default
}
)), /* @__PURE__ */ h("td", null, entry.description), /* @__PURE__ */ h("td", null, entry.quantity === 0 ? "--" : `${entry.quantity} ${entry.unit}`), /* @__PURE__ */ h("td", null, unitPrice), /* @__PURE__ */ h("td", null, totalPrice), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, actions.map((a5, i4) => {
return /* @__PURE__ */ h("div", { key: i4, class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-small is-danger has-tooltip-left",
"data-tooltip": a5.tooltip,
type: "button",
onClick: () => a5.handler(entry, index)
},
a5.name
));
})));
}))));
}
// src/utils/amount.ts
function mergeRefunds(prev, cur) {
let tail;
if (prev.length === 0 || //empty list
cur.timestamp.t_s === "never" || //current does not have timestamp
(tail = prev[prev.length - 1]).timestamp.t_s === "never" || // last does not have timestamp
cur.reason !== tail.reason || //different reason
cur.pending !== tail.pending || //different pending state
Math.abs(cur.timestamp.t_s - tail.timestamp.t_s) > 1e3 * 60) {
prev.push(cur);
return prev;
}
const a5 = Amounts.parseOrThrow(tail.amount);
const b4 = Amounts.parseOrThrow(cur.amount);
const r3 = Amounts.add(a5, b4).amount;
prev[prev.length - 1] = __spreadProps(__spreadValues({}, tail), {
amount: Amounts.stringify(r3)
});
return prev;
}
function rate(a5, b4) {
const af = toFloat(a5);
const bf = toFloat(b4);
if (bf === 0)
return 0;
return af / bf;
}
function toFloat(amount) {
return amount.value + amount.fraction / amountFractionalBase;
}
// src/paths/instance/orders/create/CreatePage.tsx
function with_defaults2(config, currency) {
const defaultPayDeadline = !config.default_pay_delay || config.default_pay_delay.d_us === "forever" ? void 0 : add2(/* @__PURE__ */ new Date(), {
seconds: config.default_pay_delay.d_us / (1e3 * 1e3)
});
const defaultWireDeadline = !config.default_wire_transfer_delay || config.default_wire_transfer_delay.d_us === "forever" ? void 0 : add2(/* @__PURE__ */ new Date(), {
seconds: config.default_wire_transfer_delay.d_us / (1e3 * 1e3)
});
return {
inventoryProducts: {},
products: [],
pricing: {},
payments: {
max_fee: void 0,
pay_deadline: defaultPayDeadline,
refund_deadline: defaultPayDeadline,
createToken: true,
wire_transfer_deadline: defaultWireDeadline
},
shipping: {},
extra: {}
};
}
function CreatePage2({
onCreate,
onBack,
instanceConfig,
instanceInventory
}) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
const config = useConfigContext();
const instance_default = with_defaults2(instanceConfig, config.currency);
const [value, valueHandler] = p3(instance_default);
const zero = Amounts.zeroOfCurrency(config.currency);
const [settings] = useSettings();
const inventoryList = Object.values(value.inventoryProducts || {});
const productList = Object.values(value.products || {});
const { i18n: i18n2 } = useTranslationContext();
const parsedPrice = !((_a = value.pricing) == null ? void 0 : _a.order_price) ? void 0 : Amounts.parse(value.pricing.order_price);
const errors2 = {
pricing: undefinedIfEmpty({
summary: !((_b = value.pricing) == null ? void 0 : _b.summary) ? i18n2.str`required` : void 0,
order_price: !((_c = value.pricing) == null ? void 0 : _c.order_price) ? i18n2.str`required` : !parsedPrice ? i18n2.str`not valid` : Amounts.isZero(parsedPrice) ? i18n2.str`must be greater than 0` : void 0
}),
// extra:
// value.extra && !stringIsValidJSON(value.extra)
// ? i18n.str`not a valid json`
// : undefined,
payments: undefinedIfEmpty({
refund_deadline: !((_d = value.payments) == null ? void 0 : _d.refund_deadline) ? void 0 : !isFuture(value.payments.refund_deadline) ? i18n2.str`should be in the future` : value.payments.pay_deadline && isBefore(value.payments.refund_deadline, value.payments.pay_deadline) ? i18n2.str`refund deadline cannot be before pay deadline` : value.payments.wire_transfer_deadline && isBefore(
value.payments.wire_transfer_deadline,
value.payments.refund_deadline
) ? i18n2.str`wire transfer deadline cannot be before refund deadline` : void 0,
pay_deadline: !((_e = value.payments) == null ? void 0 : _e.pay_deadline) ? void 0 : !isFuture(value.payments.pay_deadline) ? i18n2.str`should be in the future` : value.payments.wire_transfer_deadline && isBefore(
value.payments.wire_transfer_deadline,
value.payments.pay_deadline
) ? i18n2.str`wire transfer deadline cannot be before pay deadline` : void 0,
auto_refund_deadline: !((_f = value.payments) == null ? void 0 : _f.auto_refund_deadline) ? void 0 : !isFuture(value.payments.auto_refund_deadline) ? i18n2.str`should be in the future` : !((_g = value.payments) == null ? void 0 : _g.refund_deadline) ? i18n2.str`should have a refund deadline` : !isAfter(
value.payments.refund_deadline,
value.payments.auto_refund_deadline
) ? i18n2.str`auto refund cannot be after refund deadline` : void 0
}),
shipping: undefinedIfEmpty({
delivery_date: !((_h = value.shipping) == null ? void 0 : _h.delivery_date) ? void 0 : !isFuture(value.shipping.delivery_date) ? i18n2.str`should be in the future` : void 0
})
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submit = () => {
const order = OrderCreateSchema.cast(value);
if (!value.payments)
return;
if (!value.shipping)
return;
const request = {
order: {
amount: order.pricing.order_price,
summary: order.pricing.summary,
products: productList,
extra: JSON.stringify(value.extra),
pay_deadline: value.payments.pay_deadline ? {
t_s: Math.floor(value.payments.pay_deadline.getTime() / 1e3)
} : void 0,
wire_transfer_deadline: value.payments.wire_transfer_deadline ? {
t_s: Math.floor(
value.payments.wire_transfer_deadline.getTime() / 1e3
)
} : void 0,
refund_deadline: value.payments.refund_deadline ? {
t_s: Math.floor(value.payments.refund_deadline.getTime() / 1e3)
} : void 0,
auto_refund: value.payments.auto_refund_deadline ? {
d_us: Math.floor(
value.payments.auto_refund_deadline.getTime() * 1e3
)
} : void 0,
max_fee: value.payments.max_fee,
delivery_date: value.shipping.delivery_date ? { t_s: value.shipping.delivery_date.getTime() / 1e3 } : void 0,
delivery_location: value.shipping.delivery_location,
fulfillment_url: value.shipping.fullfilment_url,
minimum_age: value.payments.minimum_age
},
inventory_products: inventoryList.map((p4) => ({
product_id: p4.product.id,
quantity: p4.quantity
})),
create_token: value.payments.createToken
};
onCreate(request);
};
const addProductToTheInventoryList = (product, quantity) => {
valueHandler((v3) => {
const inventoryProducts = __spreadValues({}, v3.inventoryProducts);
inventoryProducts[product.id] = { product, quantity };
return __spreadProps(__spreadValues({}, v3), { inventoryProducts });
});
};
const removeProductFromTheInventoryList = (id) => {
valueHandler((v3) => {
const inventoryProducts = __spreadValues({}, v3.inventoryProducts);
delete inventoryProducts[id];
return __spreadProps(__spreadValues({}, v3), { inventoryProducts });
});
};
const addNewProduct = (product) => __async(this, null, function* () {
return valueHandler((v3) => {
const products = v3.products ? [...v3.products, product] : [];
return __spreadProps(__spreadValues({}, v3), { products });
});
});
const removeFromNewProduct = (index) => {
valueHandler((v3) => {
const products = v3.products ? [...v3.products] : [];
products.splice(index, 1);
return __spreadProps(__spreadValues({}, v3), { products });
});
};
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;
}, zero);
const totalPriceProducts = productList.reduce((prev, cur) => {
if (!cur.price)
return zero;
const p4 = Amounts.parseOrThrow(cur.price);
return Amounts.add(prev, Amounts.mult(p4, cur.quantity).amount).amount;
}, zero);
const hasProducts = inventoryList.length > 0 || productList.length > 0;
const totalPrice = Amounts.add(totalPriceInventory, totalPriceProducts);
const totalAsString = Amounts.stringify(totalPrice.amount);
const allProducts = productList.concat(inventoryList.map(asProduct));
const [newField, setNewField] = p3("");
h2(() => {
valueHandler((v3) => {
return __spreadProps(__spreadValues({}, v3), {
pricing: __spreadProps(__spreadValues({}, v3.pricing), {
products_price: hasProducts ? totalAsString : void 0,
order_price: hasProducts ? totalAsString : void 0
})
});
});
}, [hasProducts, totalAsString]);
const discountOrRise = rate(
parsedPrice != null ? parsedPrice : Amounts.zeroOfCurrency(config.currency),
totalPrice.amount
);
const minAgeByProducts = allProducts.reduce(
(cur, prev) => !prev.minimum_age || cur > prev.minimum_age ? cur : prev.minimum_age,
0
);
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(
InputGroup,
{
name: "inventory_products",
label: i18n2.str`Manage products in order`,
alternative: allProducts.length > 0 && /* @__PURE__ */ h("p", null, allProducts.length, " products with a total price of", " ", totalAsString, "."),
tooltip: i18n2.str`Manage list of products in the order.`
},
/* @__PURE__ */ h(
InventoryProductForm,
{
currentProducts: value.inventoryProducts || {},
onAddProduct: addProductToTheInventoryList,
inventory: instanceInventory
}
),
settings.advanceOrderMode && /* @__PURE__ */ h(
NonInventoryProductFrom,
{
productToEdit: editingProduct,
onAddProduct: (p4) => {
setEditingProduct(void 0);
return addNewProduct(p4);
}
}
),
allProducts.length > 0 && /* @__PURE__ */ h(
ProductList,
{
list: allProducts,
actions: [
{
name: i18n2.str`Remove`,
tooltip: i18n2.str`Remove this product from the order.`,
handler: (e4, index) => {
if (e4.product_id) {
removeProductFromTheInventoryList(e4.product_id);
} else {
removeFromNewProduct(index);
setEditingProduct(e4);
}
}
}
]
}
)
), /* @__PURE__ */ h(
FormProvider,
{
errors: errors2,
object: value,
valueHandler
},
hasProducts ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
InputCurrency,
{
name: "pricing.products_price",
label: i18n2.str`Total price`,
readonly: true,
tooltip: i18n2.str`total product price added up`
}
), /* @__PURE__ */ h(
InputCurrency,
{
name: "pricing.order_price",
label: i18n2.str`Total price`,
addonAfter: discountOrRise > 0 && (discountOrRise < 1 ? `discount of %${Math.round(
(1 - discountOrRise) * 100
)}` : `rise of %${Math.round((discountOrRise - 1) * 100)}`),
tooltip: i18n2.str`Amount to be paid by the customer`
}
)) : /* @__PURE__ */ h(
InputCurrency,
{
name: "pricing.order_price",
label: i18n2.str`Order price`,
tooltip: i18n2.str`final order price`
}
),
/* @__PURE__ */ h(
Input,
{
name: "pricing.summary",
inputType: "multiline",
label: i18n2.str`Summary`,
tooltip: i18n2.str`Title of the order to be shown to the customer`
}
),
settings.advanceOrderMode && /* @__PURE__ */ h(
InputGroup,
{
name: "shipping",
label: i18n2.str`Shipping and Fulfillment`,
initialActive: true
},
/* @__PURE__ */ h(
InputDate,
{
name: "shipping.delivery_date",
label: i18n2.str`Delivery date`,
tooltip: i18n2.str`Deadline for physical delivery assured by the merchant.`
}
),
((_i = value.shipping) == null ? void 0 : _i.delivery_date) && /* @__PURE__ */ h(
InputGroup,
{
name: "shipping.delivery_location",
label: i18n2.str`Location`,
tooltip: i18n2.str`address where the products will be delivered`
},
/* @__PURE__ */ h(InputLocation, { name: "shipping.delivery_location" })
),
/* @__PURE__ */ h(
Input,
{
name: "shipping.fullfilment_url",
label: i18n2.str`Fulfillment URL`,
tooltip: i18n2.str`URL to which the user will be redirected after successful payment.`
}
)
),
settings.advanceOrderMode && /* @__PURE__ */ h(
InputGroup,
{
name: "payments",
label: i18n2.str`Taler payment options`,
tooltip: i18n2.str`Override default Taler payment settings for this order`
},
/* @__PURE__ */ h(
InputDate,
{
name: "payments.pay_deadline",
label: i18n2.str`Payment deadline`,
tooltip: i18n2.str`Deadline for the customer to pay for the offer before it expires. Inventory products will be reserved until this deadline.`,
side: /* @__PURE__ */ h("span", null, /* @__PURE__ */ h("button", { class: "button", onClick: () => {
var _a2, _b2;
valueHandler(__spreadProps(__spreadValues({}, value), {
payments: __spreadProps(__spreadValues({}, (_a2 = value.payments) != null ? _a2 : {}), {
pay_deadline: (_b2 = instance_default.payments) == null ? void 0 : _b2.pay_deadline
})
}));
} }, /* @__PURE__ */ h(i18n2.Translate, null, "default")))
}
),
/* @__PURE__ */ h(
InputDate,
{
name: "payments.refund_deadline",
label: i18n2.str`Refund deadline`,
tooltip: i18n2.str`Time until which the order can be refunded by the merchant.`,
side: /* @__PURE__ */ h("span", null, /* @__PURE__ */ h("button", { class: "button", onClick: () => {
var _a2, _b2;
valueHandler(__spreadProps(__spreadValues({}, value), {
payments: __spreadProps(__spreadValues({}, (_a2 = value.payments) != null ? _a2 : {}), {
refund_deadline: (_b2 = instance_default.payments) == null ? void 0 : _b2.refund_deadline
})
}));
} }, /* @__PURE__ */ h(i18n2.Translate, null, "default")))
}
),
/* @__PURE__ */ h(
InputDate,
{
name: "payments.wire_transfer_deadline",
label: i18n2.str`Wire transfer deadline`,
tooltip: i18n2.str`Deadline for the exchange to make the wire transfer.`,
side: /* @__PURE__ */ h("span", null, /* @__PURE__ */ h("button", { class: "button", onClick: () => {
var _a2, _b2;
valueHandler(__spreadProps(__spreadValues({}, value), {
payments: __spreadProps(__spreadValues({}, (_a2 = value.payments) != null ? _a2 : {}), {
wire_transfer_deadline: (_b2 = instance_default.payments) == null ? void 0 : _b2.wire_transfer_deadline
})
}));
} }, /* @__PURE__ */ h(i18n2.Translate, null, "default")))
}
),
/* @__PURE__ */ h(
InputDate,
{
name: "payments.auto_refund_deadline",
label: i18n2.str`Auto-refund deadline`,
tooltip: i18n2.str`Time until which the wallet will automatically check for refunds without user interaction.`
}
),
/* @__PURE__ */ h(
InputCurrency,
{
name: "payments.max_fee",
label: i18n2.str`Maximum fee`,
tooltip: i18n2.str`Maximum fees the merchant is willing to cover for this order. Higher deposit fees must be covered in full by the consumer.`
}
),
/* @__PURE__ */ h(
InputToggle,
{
name: "payments.createToken",
label: i18n2.str`Create token`,
tooltip: i18n2.str`If the order ID is easy to guess the token will prevent user to steal orders from others.`
}
),
/* @__PURE__ */ h(
InputNumber2,
{
name: "payments.minimum_age",
label: i18n2.str`Minimum age required`,
tooltip: i18n2.str`Any value greater than 0 will limit the coins able be used to pay this contract. If empty the age restriction will be defined by the products`,
help: minAgeByProducts > 0 ? i18n2.str`Min age defined by the producs is ${minAgeByProducts}` : i18n2.str`No product with age restriction in this order`
}
)
),
settings.advanceOrderMode && /* @__PURE__ */ h(
InputGroup,
{
name: "extra",
label: i18n2.str`Additional information`,
tooltip: i18n2.str`Custom information to be included in the contract for this order.`
},
Object.keys((_j = value.extra) != null ? _j : {}).map((key) => {
return /* @__PURE__ */ h(
Input,
{
name: `extra.${key}`,
inputType: "multiline",
label: key,
tooltip: i18n2.str`You must enter a value in JavaScript Object Notation (JSON).`,
side: /* @__PURE__ */ h("button", { class: "button", onClick: (e4) => {
if (value.extra && value.extra[key] !== void 0) {
console.log(value.extra);
delete value.extra[key];
}
valueHandler(__spreadValues({}, value));
} }, "remove")
}
);
}),
/* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Custom field name"), /* @__PURE__ */ h("span", { class: "icon has-tooltip-right", "data-tooltip": "new extra field" }, /* @__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: "control" }, /* @__PURE__ */ h("input", { class: "input ", value: newField, onChange: (e4) => setNewField(e4.currentTarget.value) })))), /* @__PURE__ */ h("button", { class: "button", onClick: (e4) => {
var _a2;
setNewField("");
valueHandler(__spreadProps(__spreadValues({}, value), {
extra: __spreadProps(__spreadValues({}, (_a2 = value.extra) != null ? _a2 : {}), {
[newField]: ""
})
}));
} }, "add"))
)
), /* @__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(
"button",
{
class: "button is-success",
onClick: submit,
disabled: hasErrors
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
function asProduct(p4) {
return {
product_id: p4.product.id,
image: p4.product.image,
price: p4.product.price,
unit: p4.product.unit,
quantity: p4.quantity,
description: p4.product.description,
taxes: p4.product.taxes,
minimum_age: p4.product.minimum_age
};
}
// src/paths/instance/orders/create/index.tsx
function OrderCreate({
onConfirm,
onBack,
onLoadError,
onNotFound,
onUnauthorized
}) {
const { createOrder } = useOrderAPI();
const [notif, setNotif] = p3(void 0);
const detailsResult = useInstanceDetails();
const inventoryResult = useInstanceProducts();
if (detailsResult.loading)
return /* @__PURE__ */ h(Loading, null);
if (inventoryResult.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
CreatePage2,
{
onBack,
onCreate: (request) => {
createOrder(request).then((r3) => {
return onConfirm(r3.data.order_id);
}).catch((error2) => {
setNotif({
message: "could not create order",
type: "ERROR",
description: error2.message
});
});
},
instanceConfig: detailsResult.data,
instanceInventory: inventoryResult.data
}
));
}
// src/paths/instance/orders/details/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/orders/details/DetailPage.tsx
init_preact_module();
init_hooks_module();
// src/components/form/TextField.tsx
init_preact_module();
function TextField({
name,
tooltip,
label,
expand,
help,
children,
side
}) {
const { error: error2 } = useField(name);
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 has-icons-right" : "control has-icons-right"
},
children,
help
), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2)), side));
}
// src/paths/instance/orders/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable2({
orders,
onCreate,
onRefund,
onCopyURL,
onSelect,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
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,
{
instances: orders,
onSelect,
onRefund,
onCopyURL: (o3) => onCopyURL(o3.id),
rowSelection,
rowSelectionHandler,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}
) : /* @__PURE__ */ h(EmptyTable3, null)))));
}
function Table2({
instances,
onSelect,
onRefund,
onCopyURL,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
const { i18n: i18n2 } = useTranslationContext();
const [settings] = useSettings();
return /* @__PURE__ */ h("div", { class: "table-container" }, onLoadMoreBefore && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
disabled: !hasMoreBefore,
onClick: onLoadMoreBefore
},
/* @__PURE__ */ h(i18n2.Translate, null, "load newer orders")
), /* @__PURE__ */ h("table", { class: "table is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", { style: { minWidth: 100 } }, /* @__PURE__ */ h(i18n2.Translate, null, "Date")), /* @__PURE__ */ h("th", { style: { minWidth: 100 } }, /* @__PURE__ */ h(i18n2.Translate, null, "Amount")), /* @__PURE__ */ h("th", { style: { minWidth: 400 } }, /* @__PURE__ */ h(i18n2.Translate, null, "Summary")), /* @__PURE__ */ h("th", { style: { minWidth: 50 } }))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
return /* @__PURE__ */ h("tr", { key: i4.id }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.timestamp.t_s === "never" ? "never" : format(
new Date(i4.timestamp.t_s * 1e3),
datetimeFormatForSettings(settings)
)
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.amount
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.summary
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, i4.refundable && /* @__PURE__ */ h(
"button",
{
class: "button is-small is-danger jb-modal",
type: "button",
onClick: () => onRefund(i4)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Refund")
), !i4.paid && /* @__PURE__ */ h(
"button",
{
class: "button is-small is-info jb-modal",
type: "button",
onClick: () => onCopyURL(i4)
},
/* @__PURE__ */ h(i18n2.Translate, null, "copy url")
))));
}))), onLoadMoreAfter && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
disabled: !hasMoreAfter,
onClick: onLoadMoreAfter
},
/* @__PURE__ */ h(i18n2.Translate, null, "load older orders")
));
}
function EmptyTable3() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "No orders have been found matching your query!")));
}
function RefundModal({
order,
onCancel,
onConfirm
}) {
const [form, setValue] = p3({});
const [settings] = useSettings();
const { i18n: i18n2 } = useTranslationContext();
const refunds = (order.order_status === "paid" ? order.refund_details : []).reduce(mergeRefunds, []);
const config = useConfigContext();
const totalRefunded = refunds.map((r3) => r3.amount).reduce(
(p4, c4) => Amounts.add(p4, Amounts.parseOrThrow(c4)).amount,
Amounts.zeroOfCurrency(config.currency)
);
const orderPrice = order.order_status === "paid" ? Amounts.parseOrThrow(order.contract_terms.amount) : void 0;
const totalRefundable = !orderPrice ? Amounts.zeroOfCurrency(totalRefunded.currency) : refunds.length ? Amounts.sub(orderPrice, totalRefunded).amount : orderPrice;
const isRefundable = Amounts.isNonZero(totalRefundable);
const duplicatedText = i18n2.str`duplicated`;
const errors2 = {
mainReason: !form.mainReason ? i18n2.str`required` : void 0,
description: !form.description && form.mainReason !== duplicatedText ? i18n2.str`required` : void 0,
refund: !form.refund ? i18n2.str`required` : !Amounts.parse(form.refund) ? i18n2.str`invalid format` : Amounts.cmp(totalRefundable, Amounts.parse(form.refund)) === -1 ? i18n2.str`this value exceed the refundable amount` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const validateAndConfirm = () => {
try {
if (!form.refund)
return;
onConfirm({
refund: Amounts.stringify(
Amounts.add(Amounts.parse(form.refund), totalRefunded).amount
),
reason: form.description === void 0 ? form.mainReason || "" : `${form.mainReason}: ${form.description}`
});
} catch (err) {
console.log(err);
}
};
return /* @__PURE__ */ h(
ConfirmModal,
{
description: "refund",
danger: true,
active: true,
disabled: !isRefundable || hasErrors,
onCancel,
onConfirm: validateAndConfirm
},
refunds.length > 0 && /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column is-12" }, /* @__PURE__ */ h(
InputGroup,
{
name: "asd",
label: `${Amounts.stringify(totalRefunded)} was already refunded`
},
/* @__PURE__ */ h("table", { class: "table is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "date")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "amount")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "reason")))), /* @__PURE__ */ h("tbody", null, refunds.map((r3) => {
return /* @__PURE__ */ h("tr", { key: r3.timestamp.t_s }, /* @__PURE__ */ h("td", null, r3.timestamp.t_s === "never" ? "never" : format(
new Date(r3.timestamp.t_s * 1e3),
datetimeFormatForSettings(settings)
)), /* @__PURE__ */ h("td", null, r3.amount), /* @__PURE__ */ h("td", null, r3.reason));
})))
))),
isRefundable && /* @__PURE__ */ h(
FormProvider,
{
errors: errors2,
object: form,
valueHandler: (d5) => setValue(d5)
},
/* @__PURE__ */ h(
InputCurrency,
{
name: "refund",
label: i18n2.str`Refund`,
tooltip: i18n2.str`amount to be refunded`
},
/* @__PURE__ */ h(i18n2.Translate, null, "Max refundable:"),
" ",
Amounts.stringify(totalRefundable)
),
/* @__PURE__ */ h(
InputSelector,
{
name: "mainReason",
label: i18n2.str`Reason`,
values: [
i18n2.str`Choose one...`,
duplicatedText,
i18n2.str`requested by the customer`,
i18n2.str`other`
],
tooltip: i18n2.str`why this order is being refunded`
}
),
form.mainReason && form.mainReason !== duplicatedText ? /* @__PURE__ */ h(
Input,
{
label: i18n2.str`Description`,
name: "description",
tooltip: i18n2.str`more information to give context`
}
) : void 0
)
);
}
// src/paths/instance/orders/details/Timeline.tsx
init_preact_module();
init_hooks_module();
function Timeline({ events: e4 }) {
const events2 = [...e4];
events2.push({
when: /* @__PURE__ */ new Date(),
description: "now",
type: "now"
});
events2.sort((a5, b4) => a5.when.getTime() - b4.when.getTime());
const [settings] = useSettings();
const [state, setState] = p3(events2);
h2(() => {
const handle = setTimeout(() => {
const eventsWithoutNow = state.filter((e5) => e5.type !== "now");
eventsWithoutNow.push({
when: /* @__PURE__ */ new Date(),
description: "now",
type: "now"
});
setState(eventsWithoutNow);
}, 1e3);
return () => {
clearTimeout(handle);
};
});
return /* @__PURE__ */ h("div", { class: "timeline" }, events2.map((e5, i4) => {
return /* @__PURE__ */ h("div", { key: i4, class: "timeline-item" }, (() => {
switch (e5.type) {
case "deadline":
return /* @__PURE__ */ h("div", { class: "timeline-marker is-icon " }, /* @__PURE__ */ h("i", { class: "mdi mdi-flag" }));
case "delivery":
return /* @__PURE__ */ h("div", { class: "timeline-marker is-icon " }, /* @__PURE__ */ h("i", { class: "mdi mdi-delivery" }));
case "start":
return /* @__PURE__ */ h("div", { class: "timeline-marker is-icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-flag " }));
case "wired":
return /* @__PURE__ */ h("div", { class: "timeline-marker is-icon is-success" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash" }));
case "wired-range":
return /* @__PURE__ */ h("div", { class: "timeline-marker is-icon is-success" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash" }));
case "refund":
return /* @__PURE__ */ h("div", { class: "timeline-marker is-icon is-danger" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash" }));
case "refund-taken":
return /* @__PURE__ */ h("div", { class: "timeline-marker is-icon is-success" }, /* @__PURE__ */ h("i", { class: "mdi mdi-cash" }));
case "now":
return /* @__PURE__ */ h("div", { class: "timeline-marker is-icon is-info" }, /* @__PURE__ */ h("i", { class: "mdi mdi-clock" }));
}
})(), /* @__PURE__ */ h("div", { class: "timeline-content" }, e5.description !== "now" && /* @__PURE__ */ h("p", { class: "heading" }, format(e5.when, datetimeFormatForSettings(settings))), /* @__PURE__ */ h("p", null, e5.description)));
}));
}
// src/paths/instance/orders/details/DetailPage.tsx
function ContractTerms({ value }) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(InputGroup, { name: "contract_terms", label: i18n2.str`Contract Terms` }, /* @__PURE__ */ h(FormProvider, { object: value, valueHandler: null }, /* @__PURE__ */ h(
Input,
{
readonly: true,
name: "summary",
label: i18n2.str`Summary`,
tooltip: i18n2.str`human-readable description of the whole purchase`
}
), /* @__PURE__ */ h(
InputCurrency,
{
readonly: true,
name: "amount",
label: i18n2.str`Amount`,
tooltip: i18n2.str`total price for the transaction`
}
), value.fulfillment_url && /* @__PURE__ */ h(
Input,
{
readonly: true,
name: "fulfillment_url",
label: i18n2.str`Fulfillment URL`,
tooltip: i18n2.str`URL for this purchase`
}
), /* @__PURE__ */ h(
Input,
{
readonly: true,
name: "max_fee",
label: i18n2.str`Max fee`,
tooltip: i18n2.str`maximum total deposit fee accepted by the merchant for this contract`
}
), /* @__PURE__ */ h(
InputDate,
{
readonly: true,
name: "timestamp",
label: i18n2.str`Created at`,
tooltip: i18n2.str`time when this contract was generated`
}
), /* @__PURE__ */ h(
InputDate,
{
readonly: true,
name: "refund_deadline",
label: i18n2.str`Refund deadline`,
tooltip: i18n2.str`after this deadline has passed no refunds will be accepted`
}
), /* @__PURE__ */ h(
InputDate,
{
readonly: true,
name: "pay_deadline",
label: i18n2.str`Payment deadline`,
tooltip: i18n2.str`after this deadline, the merchant won't accept payments for the contract`
}
), /* @__PURE__ */ h(
InputDate,
{
readonly: true,
name: "wire_transfer_deadline",
label: i18n2.str`Wire transfer deadline`,
tooltip: i18n2.str`transfer deadline for the exchange`
}
), /* @__PURE__ */ h(
InputDate,
{
readonly: true,
name: "delivery_date",
label: i18n2.str`Delivery date`,
tooltip: i18n2.str`time indicating when the order should be delivered`
}
), value.delivery_date && /* @__PURE__ */ h(
InputGroup,
{
name: "delivery_location",
label: i18n2.str`Location`,
tooltip: i18n2.str`where the order will be delivered`
},
/* @__PURE__ */ h(InputLocation, { name: "payments.delivery_location" })
), /* @__PURE__ */ h(
InputDuration,
{
readonly: true,
name: "auto_refund",
label: i18n2.str`Auto-refund delay`,
tooltip: i18n2.str`how long the wallet should try to get an automatic refund for the purchase`
}
), /* @__PURE__ */ h(
Input,
{
readonly: true,
name: "extra",
label: i18n2.str`Extra info`,
tooltip: i18n2.str`extra data that is only interpreted by the merchant frontend`
}
)));
}
function ClaimedPage({
id,
order
}) {
var _a;
const events2 = [];
if (order.contract_terms.timestamp.t_s !== "never") {
events2.push({
when: new Date(order.contract_terms.timestamp.t_s * 1e3),
description: "order created",
type: "start"
});
}
if (order.contract_terms.pay_deadline.t_s !== "never") {
events2.push({
when: new Date(order.contract_terms.pay_deadline.t_s * 1e3),
description: "pay deadline",
type: "deadline"
});
}
if (order.contract_terms.refund_deadline.t_s !== "never") {
events2.push({
when: new Date(order.contract_terms.refund_deadline.t_s * 1e3),
description: "refund deadline",
type: "deadline"
});
}
if (order.contract_terms.wire_transfer_deadline.t_s !== "never") {
events2.push({
when: new Date(order.contract_terms.wire_transfer_deadline.t_s * 1e3),
description: "wire deadline",
type: "deadline"
});
}
if (order.contract_terms.delivery_date && order.contract_terms.delivery_date.t_s !== "never") {
events2.push({
when: new Date(((_a = order.contract_terms.delivery_date) == null ? void 0 : _a.t_s) * 1e3),
description: "delivery",
type: "delivery"
});
}
const [value, valueHandler] = p3(order);
const { i18n: i18n2 } = useTranslationContext();
const [settings] = useSettings();
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",
{
class: "content",
style: {
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis"
}
},
/* @__PURE__ */ h("p", null, /* @__PURE__ */ h("b", null, /* @__PURE__ */ h(i18n2.Translate, null, "claimed at"), ":"), " ", format(
new Date(order.contract_terms.timestamp.t_s * 1e3),
datetimeFormatForSettings(settings)
))
)))))), /* @__PURE__ */ h("section", { class: "section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column is-4" }, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Timeline")), /* @__PURE__ */ h(Timeline, { events: events2 })), /* @__PURE__ */ h("div", { class: "column is-8" }, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Payment details")), /* @__PURE__ */ h(
FormProvider,
{
object: value,
valueHandler
},
/* @__PURE__ */ h(
Input,
{
name: "contract_terms.summary",
readonly: true,
inputType: "multiline",
label: i18n2.str`Summary`
}
),
/* @__PURE__ */ h(
InputCurrency,
{
name: "contract_terms.amount",
readonly: true,
label: i18n2.str`Amount`
}
),
/* @__PURE__ */ h(
Input,
{
name: "order_status",
readonly: true,
label: i18n2.str`Order status`
}
)
)))), order.contract_terms.products.length ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Product list")), /* @__PURE__ */ h(ProductList, { 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,
order,
onRefund
}) {
var _a;
const events2 = [];
if (order.contract_terms.timestamp.t_s !== "never") {
events2.push({
when: new Date(order.contract_terms.timestamp.t_s * 1e3),
description: "order created",
type: "start"
});
}
if (order.contract_terms.pay_deadline.t_s !== "never") {
events2.push({
when: new Date(order.contract_terms.pay_deadline.t_s * 1e3),
description: "pay deadline",
type: "deadline"
});
}
if (order.contract_terms.refund_deadline.t_s !== "never") {
events2.push({
when: new Date(order.contract_terms.refund_deadline.t_s * 1e3),
description: "refund deadline",
type: "deadline"
});
}
if (order.contract_terms.wire_transfer_deadline.t_s !== "never") {
events2.push({
when: new Date(order.contract_terms.wire_transfer_deadline.t_s * 1e3),
description: "wire deadline",
type: "deadline"
});
}
if (order.contract_terms.delivery_date && order.contract_terms.delivery_date.t_s !== "never") {
if (order.contract_terms.delivery_date)
events2.push({
when: new Date(((_a = order.contract_terms.delivery_date) == null ? void 0 : _a.t_s) * 1e3),
description: "delivery",
type: "delivery"
});
}
order.refund_details.reduce(mergeRefunds, []).forEach((e4) => {
if (e4.timestamp.t_s !== "never") {
events2.push({
when: new Date(e4.timestamp.t_s * 1e3),
description: `refund: ${e4.amount}: ${e4.reason}`,
type: e4.pending ? "refund" : "refund-taken"
});
}
});
if (order.wire_details && order.wire_details.length) {
if (order.wire_details.length > 1) {
let last = null;
let first = null;
let total = null;
order.wire_details.forEach((w5) => {
if (last === null || last.execution_time.t_s < w5.execution_time.t_s) {
last = w5;
}
if (first === null || first.execution_time.t_s > w5.execution_time.t_s) {
first = w5;
}
total = total === null ? Amounts.parseOrThrow(w5.amount) : Amounts.add(total, Amounts.parseOrThrow(w5.amount)).amount;
});
const last_time = last.execution_time.t_s;
if (last_time !== "never") {
events2.push({
when: new Date(last_time * 1e3),
description: `wired ${Amounts.stringify(total)}`,
type: "wired-range"
});
}
const first_time = first.execution_time.t_s;
if (first_time !== "never") {
events2.push({
when: new Date(first_time * 1e3),
description: `wire transfer started...`,
type: "wired-range"
});
}
} else {
order.wire_details.forEach((e4) => {
if (e4.execution_time.t_s !== "never") {
events2.push({
when: new Date(e4.execution_time.t_s * 1e3),
description: `wired ${e4.amount}`,
type: "wired"
});
}
});
}
}
const now2 = /* @__PURE__ */ new Date();
const nextEvent = events2.find((e4) => {
return e4.when.getTime() > now2.getTime();
});
const [value, valueHandler] = p3(order);
const { url: backendURL } = useBackendContext();
const refundurl = stringifyRefundUri({
merchantBaseUrl: backendURL,
orderId: order.contract_terms.order_id
});
const refundable = (/* @__PURE__ */ new Date()).getTime() < order.contract_terms.refund_deadline.t_s * 1e3;
const { i18n: i18n2 } = useTranslationContext();
const amount = Amounts.parseOrThrow(order.contract_terms.amount);
const refund_taken = order.refund_details.reduce((prev, cur) => {
if (cur.pending)
return prev;
return Amounts.add(prev, Amounts.parseOrThrow(cur.amount)).amount;
}, Amounts.zeroOfCurrency(amount.currency));
value.refund_taken = Amounts.stringify(refund_taken);
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-success ml-4" }, /* @__PURE__ */ h(i18n2.Translate, null, "paid")), order.wired ? /* @__PURE__ */ h("div", { class: "tag is-success ml-4" }, /* @__PURE__ */ h(i18n2.Translate, null, "wired")) : null, order.refunded ? /* @__PURE__ */ h("div", { class: "tag is-danger ml-4" }, /* @__PURE__ */ h(i18n2.Translate, null, "refunded")) : null))), /* @__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-right" }, /* @__PURE__ */ h("div", { class: "level-item" }, /* @__PURE__ */ h("h1", { class: "title" }, /* @__PURE__ */ h("div", { class: "buttons" }, /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-left",
"data-tooltip": refundable ? i18n2.str`refund order` : i18n2.str`not refundable`
},
/* @__PURE__ */ h(
"button",
{
class: "button is-danger",
disabled: !refundable,
onClick: () => onRefund(id)
},
/* @__PURE__ */ h(i18n2.Translate, null, "refund")
)
)))))), /* @__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",
{
class: "content",
style: {
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis"
}
},
/* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "Next event in "), " ", formatDistance3(
nextEvent.when,
/* @__PURE__ */ new Date()
// "yyyy/MM/dd HH:mm:ss",
))
)))))), /* @__PURE__ */ h("section", { class: "section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column is-4" }, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Timeline")), /* @__PURE__ */ h(Timeline, { events: events2 })), /* @__PURE__ */ h("div", { class: "column is-8" }, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Payment details")), /* @__PURE__ */ h(
FormProvider,
{
object: value,
valueHandler
},
order.refunded && /* @__PURE__ */ h(
InputCurrency,
{
name: "refund_amount",
readonly: true,
label: i18n2.str`Refunded amount`
}
),
order.refunded && /* @__PURE__ */ h(
InputCurrency,
{
name: "refund_taken",
readonly: true,
label: i18n2.str`Refund taken`
}
),
/* @__PURE__ */ h(
Input,
{
name: "order_status",
readonly: true,
label: i18n2.str`Order status`
}
),
/* @__PURE__ */ h(
TextField,
{
name: "order_status_url",
label: i18n2.str`Status URL`
},
/* @__PURE__ */ h(
"a",
{
target: "_blank",
rel: "noreferrer",
href: order.order_status_url
},
order.order_status_url
)
),
order.refunded && /* @__PURE__ */ h(
TextField,
{
name: "order_status_url",
label: i18n2.str`Refund URI`
},
/* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: refundurl }, refundurl)
)
)))), order.contract_terms.products.length ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", { class: "title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Product list")), /* @__PURE__ */ h(ProductList, { 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] = p3(order);
const { i18n: i18n2 } = useTranslationContext();
const [settings] = useSettings();
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",
{
class: "content",
style: {
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis"
}
},
/* @__PURE__ */ h("p", null, /* @__PURE__ */ h("b", null, /* @__PURE__ */ h(i18n2.Translate, null, "pay at"), ":"), " ", /* @__PURE__ */ h(
"a",
{
href: order.order_status_url,
rel: "nofollow",
target: "new"
},
order.order_status_url
)),
/* @__PURE__ */ h("p", null, /* @__PURE__ */ h("b", null, /* @__PURE__ */ h(i18n2.Translate, null, "created at"), ":"), " ", order.creation_time.t_s === "never" ? "never" : format(
new Date(order.creation_time.t_s * 1e3),
datetimeFormatForSettings(settings)
))
)))))), /* @__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, { object: value, valueHandler }, /* @__PURE__ */ h(
Input,
{
readonly: true,
name: "summary",
label: i18n2.str`Summary`,
tooltip: i18n2.str`human-readable description of the whole purchase`
}
), /* @__PURE__ */ h(
InputCurrency,
{
readonly: true,
name: "total_amount",
label: i18n2.str`Amount`,
tooltip: i18n2.str`total price for the transaction`
}
), /* @__PURE__ */ h(
Input,
{
name: "order_status",
readonly: true,
label: i18n2.str`Order status`
}
), /* @__PURE__ */ h(
Input,
{
name: "order_status_url",
readonly: true,
label: i18n2.str`Order status URL`
}
), /* @__PURE__ */ h(
TextField,
{
name: "taler_pay_uri",
label: i18n2.str`Payment URI`
},
/* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: value.taler_pay_uri }, value.taler_pay_uri)
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
function DetailPage2({ id, selected, onRefund, onBack }) {
const [showRefund, setShowRefund] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const DetailByStatus = function() {
switch (selected.order_status) {
case "claimed":
return /* @__PURE__ */ h(ClaimedPage, { id, order: selected });
case "paid":
return /* @__PURE__ */ h(PaidPage, { id, order: selected, onRefund: setShowRefund });
case "unpaid":
return /* @__PURE__ */ h(UnpaidPage, { id, order: selected });
default:
return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h(i18n2.Translate, null, "Unknown order status. This is an error, please contact the administrator."));
}
};
return /* @__PURE__ */ h(p2, null, DetailByStatus(), showRefund && /* @__PURE__ */ h(
RefundModal,
{
order: selected,
onCancel: () => setShowRefund(void 0),
onConfirm: (value) => {
onRefund(showRefund, value);
setShowRefund(void 0);
}
}
), /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__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" })));
}
// src/paths/instance/orders/details/index.tsx
function Update({
oid,
onBack,
onLoadError,
onNotFound,
onUnauthorized
}) {
const { refundOrder } = useOrderAPI();
const result = useOrderDetails(oid);
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
DetailPage2,
{
onBack,
id: oid,
onRefund: (id, value) => refundOrder(id, value).then(
() => setNotif({
message: i18n2.str`refund created successfully`,
type: "SUCCESS"
})
).catch(
(error2) => setNotif({
message: i18n2.str`could not create the refund`,
type: "ERROR",
description: error2.message
})
),
selected: result.data
}
));
}
// src/paths/instance/orders/list/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/orders/list/ListPage.tsx
init_preact_module();
init_hooks_module();
function ListPage2({
orders,
errorOrderId,
isAllActive,
onSelectOrder,
onRefundOrder,
onSearchOrderById,
jumpToDate,
onCopyURL,
onShowAll,
onShowPaid,
onShowNotPaid,
onShowRefunded,
onShowNotWired,
onShowWired,
onSelectDate,
isPaidActive,
isRefundedActive,
isNotWiredActive,
onCreate,
isNotPaidActive,
isWiredActive
}) {
const { i18n: i18n2 } = useTranslationContext();
const dateTooltip = i18n2.str`select date to show nearby orders`;
const [pickDate, setPickDate] = p3(false);
const [orderId, setOrderId] = p3("");
const [settings] = useSettings();
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",
{
class: errorOrderId ? "input is-danger" : "input",
type: "text",
value: orderId,
onChange: (e4) => setOrderId(e4.currentTarget.value),
placeholder: i18n2.str`order id`
}
), errorOrderId && /* @__PURE__ */ h("p", { class: "help is-danger" }, errorOrderId)), /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-bottom",
"data-tooltip": i18n2.str`jump to order with the given order ID`
},
/* @__PURE__ */ h(
"button",
{
class: "button",
onClick: (e4) => onSearchOrderById(orderId)
},
/* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-arrow-right" }))
)
))))), /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column is-two-thirds" }, /* @__PURE__ */ h("div", { class: "tabs", style: { overflow: "inherit" } }, /* @__PURE__ */ h("ul", null, /* @__PURE__ */ h("li", { class: isNotPaidActive }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`only show paid orders`
},
/* @__PURE__ */ h("a", { onClick: onShowNotPaid }, /* @__PURE__ */ h(i18n2.Translate, null, "New"))
)), /* @__PURE__ */ h("li", { class: isPaidActive }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`only show paid orders`
},
/* @__PURE__ */ h("a", { onClick: onShowPaid }, /* @__PURE__ */ h(i18n2.Translate, null, "Paid"))
)), /* @__PURE__ */ h("li", { class: isRefundedActive }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`only show orders with refunds`
},
/* @__PURE__ */ h("a", { onClick: onShowRefunded }, /* @__PURE__ */ h(i18n2.Translate, null, "Refunded"))
)), /* @__PURE__ */ h("li", { class: isNotWiredActive }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`only show orders where customers paid, but wire payments from payment provider are still pending`
},
/* @__PURE__ */ h("a", { onClick: onShowNotWired }, /* @__PURE__ */ h(i18n2.Translate, null, "Not wired"))
)), /* @__PURE__ */ h("li", { class: isWiredActive }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`only show orders where customers paid, but wire payments from payment provider are still pending`
},
/* @__PURE__ */ h("a", { onClick: onShowWired }, /* @__PURE__ */ h(i18n2.Translate, null, "Completed"))
)), /* @__PURE__ */ h("li", { class: isAllActive }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`remove all filters`
},
/* @__PURE__ */ h("a", { onClick: onShowAll }, /* @__PURE__ */ h(i18n2.Translate, null, "All"))
))))), /* @__PURE__ */ h("div", { class: "column " }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h("div", { class: "field has-addons" }, jumpToDate && /* @__PURE__ */ h("div", { class: "control" }, /* @__PURE__ */ h("a", { class: "button is-fullwidth", onClick: () => onSelectDate(void 0) }, /* @__PURE__ */ h(
"span",
{
class: "icon",
"data-tooltip": i18n2.str`clear date filter`
},
/* @__PURE__ */ h("i", { class: "mdi mdi-close" })
))), /* @__PURE__ */ h("div", { class: "control" }, /* @__PURE__ */ h("span", { class: "has-tooltip-top", "data-tooltip": dateTooltip }, /* @__PURE__ */ h(
"input",
{
class: "input",
type: "text",
readonly: true,
value: !jumpToDate ? "" : format(jumpToDate, dateFormatForSettings(settings)),
placeholder: i18n2.str`date (${dateFormatForSettings(settings)})`,
onClick: () => {
setPickDate(true);
}
}
))), /* @__PURE__ */ h("div", { class: "control" }, /* @__PURE__ */ h("span", { class: "has-tooltip-left", "data-tooltip": dateTooltip }, /* @__PURE__ */ h(
"a",
{
class: "button is-fullwidth",
onClick: () => {
setPickDate(true);
}
},
/* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-calendar" }))
))))))), /* @__PURE__ */ h(
DatePicker,
{
opened: pickDate,
closeFunction: () => setPickDate(false),
dateReceiver: onSelectDate
}
), /* @__PURE__ */ h(
CardTable2,
{
orders,
onCreate,
onCopyURL,
onSelect: onSelectOrder,
onRefund: onRefundOrder
}
));
}
// src/paths/instance/orders/list/index.tsx
function OrderList({
onUnauthorized,
onLoadError,
onCreate,
onSelect,
onNotFound
}) {
const [filter, setFilter] = p3({ paid: "no" });
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] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const [errorOrderId, setErrorOrderId] = p3(
void 0
);
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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 isNotPaidActive = filter.paid === "no" ? "is-active" : "";
const isPaidActive = filter.paid === "yes" && filter.wired === void 0 ? "is-active" : "";
const isRefundedActive = filter.refunded === "yes" ? "is-active" : "";
const isNotWiredActive = filter.wired === "no" && filter.paid === "yes" ? "is-active" : "";
const isWiredActive = filter.wired === "yes" ? "is-active" : "";
const isAllActive = filter.paid === void 0 && filter.refunded === void 0 && filter.wired === void 0 ? "is-active" : "";
function testIfOrderExistAndSelect(orderId) {
return __async(this, null, function* () {
if (!orderId) {
setErrorOrderId(i18n2.str`Enter an order id`);
return;
}
try {
yield getPaymentURL(orderId);
onSelect(orderId);
setErrorOrderId(void 0);
} catch (e4) {
setErrorOrderId(i18n2.str`order not found`);
}
});
}
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 })),
onLoadMoreBefore: result.loadMorePrev,
hasMoreBefore: !result.isReachingStart,
onLoadMoreAfter: result.loadMore,
hasMoreAfter: !result.isReachingEnd,
onSelectOrder: (order) => onSelect(order.id),
onRefundOrder: (value) => setOrderToBeRefunded(value),
errorOrderId,
isAllActive,
isNotWiredActive,
isWiredActive,
isPaidActive,
isNotPaidActive,
isRefundedActive,
jumpToDate: filter.date,
onCopyURL: (id) => getPaymentURL(id).then((resp) => copyToClipboard(resp.data)),
onCreate,
onSearchOrderById: testIfOrderExistAndSelect,
onSelectDate: setNewDate,
onShowAll: () => setFilter({}),
onShowNotPaid: () => setFilter({ paid: "no" }),
onShowPaid: () => setFilter({ paid: "yes" }),
onShowRefunded: () => setFilter({ refunded: "yes" }),
onShowNotWired: () => setFilter({ wired: "no", paid: "yes" }),
onShowWired: () => setFilter({ wired: "yes" })
}
), orderToBeRefunded && /* @__PURE__ */ h(
RefundModalForTable,
{
id: orderToBeRefunded.order_id,
onCancel: () => setOrderToBeRefunded(void 0),
onConfirm: (value) => refundOrder(orderToBeRefunded.order_id, value).then(
() => setNotif({
message: i18n2.str`refund created successfully`,
type: "SUCCESS"
})
).catch(
(error2) => setNotif({
message: i18n2.str`could not create the refund`,
type: "ERROR",
description: error2.message
})
).then(() => setOrderToBeRefunded(void 0)),
onLoadError: (error2) => {
setNotif({
message: i18n2.str`could not create the refund`,
type: "ERROR",
description: error2.message
});
setOrderToBeRefunded(void 0);
return /* @__PURE__ */ h("div", null);
},
onUnauthorized,
onNotFound: () => {
setNotif({
message: i18n2.str`could not get the order to refund`,
type: "ERROR"
// description: error.message
});
setOrderToBeRefunded(void 0);
return /* @__PURE__ */ h("div", null);
}
}
));
}
function RefundModalForTable({
id,
onUnauthorized,
onLoadError,
onNotFound,
onConfirm,
onCancel
}) {
const result = useOrderDetails(id);
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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,
{
order: result.data,
onCancel,
onConfirm
}
);
}
function copyToClipboard(text) {
return __async(this, null, function* () {
return navigator.clipboard.writeText(text);
});
}
// src/paths/instance/products/create/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/products/create/CreatePage.tsx
init_preact_module();
// src/components/product/ProductForm.tsx
init_preact_module();
init_hooks_module();
// src/components/form/InputStock.tsx
init_preact_module();
init_hooks_module();
function InputStock({
name,
tooltip,
label,
alreadyExist
}) {
const { error: error2, value, onChange } = useField(name);
const [errors2, setErrors] = p3({});
const [formValue, valueHandler] = p3(value);
const [addedStock, setAddedStock] = p3({
incoming: 0,
lost: 0
});
const { i18n: i18n2 } = useTranslationContext();
s2(() => {
if (!formValue) {
onChange(void 0);
} else {
onChange(__spreadProps(__spreadValues({}, formValue), {
current: ((formValue == null ? void 0 : formValue.current) || 0) + addedStock.incoming,
lost: ((formValue == null ? void 0 : formValue.lost) || 0) + addedStock.lost
}));
}
}, [formValue, addedStock]);
if (!formValue) {
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",
"data-tooltip": i18n2.str`click here to configure the stock of the product, leave it as is and the backend will not control stock`,
onClick: () => {
valueHandler({
current: 0,
lost: 0,
sold: 0
});
}
},
/* @__PURE__ */ h("span", null, /* @__PURE__ */ h(i18n2.Translate, null, "Manage stock"))
) : /* @__PURE__ */ h(
"button",
{
class: "button",
"data-tooltip": i18n2.str`this product has been configured without stock control`,
disabled: true
},
/* @__PURE__ */ h("span", null, /* @__PURE__ */ h(i18n2.Translate, null, "Infinite"))
)))));
}
const currentStock = (formValue.current || 0) - (formValue.lost || 0) - (formValue.sold || 0);
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(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",
errors: errors2,
object: formValue,
valueHandler
},
alreadyExist ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
FormProvider,
{
name: "added",
errors: stockAddedErrors,
object: addedStock,
valueHandler: setAddedStock
},
/* @__PURE__ */ h(InputNumber2, { name: "incoming", label: i18n2.str`Incoming` }),
/* @__PURE__ */ h(InputNumber2, { name: "lost", label: i18n2.str`Lost` })
)) : /* @__PURE__ */ h(
InputNumber2,
{
name: "current",
label: i18n2.str`Current`,
side: /* @__PURE__ */ h(
"button",
{
class: "button is-danger",
"data-tooltip": i18n2.str`remove stock control for this product`,
onClick: () => {
valueHandler(void 0);
}
},
/* @__PURE__ */ h("span", null, /* @__PURE__ */ h(i18n2.Translate, null, "without stock"))
)
}
),
/* @__PURE__ */ h(
InputDate,
{
name: "nextRestock",
label: i18n2.str`Next restock`,
withTimestampSupport: true
}
),
/* @__PURE__ */ h(
InputGroup,
{
name: "address",
label: i18n2.str`Delivery address`
},
/* @__PURE__ */ h(InputLocation, { name: "address" })
)
))));
}
// src/components/product/ProductForm.tsx
function ProductForm2({ onSubscribe, initial: initial2, alreadyExist }) {
const [value, valueHandler] = p3(__spreadProps(__spreadValues({
address: {},
description_i18n: {},
taxes: [],
next_restock: { t_s: "never" },
price: ":0"
}, initial2), {
stock: !initial2 || initial2.total_stock === -1 ? void 0 : {
current: initial2.total_stock || 0,
lost: initial2.total_lost || 0,
sold: initial2.total_sold || 0,
address: initial2.address,
nextRestock: initial2.next_restock
}
}));
let errors2 = {};
try {
(alreadyExist ? ProductUpdateSchema : ProductCreateSchema).validateSync(value, {
abortEarly: false
});
} catch (err) {
if (err instanceof ValidationError) {
const yupErrors = err.inner;
errors2 = yupErrors.reduce(
(prev, cur) => !cur.path ? prev : __spreadProps(__spreadValues({}, prev), { [cur.path]: cur.message }),
{}
);
}
}
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submit = T2(() => {
const stock = value.stock;
if (!stock) {
value.total_stock = -1;
} else {
value.total_stock = stock.current;
value.total_lost = stock.lost;
value.next_restock = stock.nextRestock instanceof Date ? { t_s: stock.nextRestock.getTime() / 1e3 } : stock.nextRestock;
value.address = stock.address;
}
delete value.stock;
if (typeof value.minimum_age !== "undefined" && value.minimum_age < 1) {
delete value.minimum_age;
}
return value;
}, [value]);
h2(() => {
onSubscribe(hasErrors ? void 0 : submit);
}, [submit, hasErrors]);
const { url: backendURL } = useBackendContext();
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h(
FormProvider,
{
name: "product",
errors: errors2,
object: value,
valueHandler
},
alreadyExist ? void 0 : /* @__PURE__ */ h(
InputWithAddon,
{
name: "product_id",
addonBefore: `${backendURL}/product/`,
label: i18n2.str`ID`,
tooltip: i18n2.str`product identification to use in URLs (for internal use only)`
}
),
/* @__PURE__ */ h(
InputImage,
{
name: "image",
label: i18n2.str`Image`,
tooltip: i18n2.str`illustration of the product for customers`
}
),
/* @__PURE__ */ h(
Input,
{
name: "description",
inputType: "multiline",
label: i18n2.str`Description`,
tooltip: i18n2.str`product description for customers`
}
),
/* @__PURE__ */ h(
InputNumber2,
{
name: "minimum_age",
label: i18n2.str`Age restricted`,
tooltip: i18n2.str`is this product restricted for customer below certain age?`,
help: i18n2.str`can be overridden by the order configuration`
}
),
/* @__PURE__ */ h(
Input,
{
name: "unit",
label: i18n2.str`Unit name`,
tooltip: i18n2.str`unit describing quantity of product sold (e.g. 2 kilograms, 5 liters, 3 items, 5 meters) for customers`,
help: i18n2.str`exajmple: kg, items or liters`
}
),
/* @__PURE__ */ h(
InputCurrency,
{
name: "price",
label: i18n2.str`Price per unit`,
tooltip: i18n2.str`sale price for customers, including taxes, for above units of the product`
}
),
/* @__PURE__ */ h(
InputStock,
{
name: "stock",
label: i18n2.str`Stock`,
alreadyExist,
tooltip: i18n2.str`product inventory for products with finite supply (for internal use only)`
}
),
/* @__PURE__ */ h(
InputTaxes,
{
name: "taxes",
label: i18n2.str`Taxes`,
tooltip: i18n2.str`taxes included in the product price, exposed to customers`
}
)
));
}
// src/paths/instance/products/create/CreatePage.tsx
function CreatePage3({ onCreate, onBack }) {
const [submitForm, addFormSubmitter] = useListener(
(result) => {
if (result)
return onCreate(result);
return Promise.reject();
}
);
const { i18n: i18n2 } = useTranslationContext();
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(ProductForm2, { onSubscribe: addFormSubmitter }), /* @__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,
{
onClick: submitForm,
"data-tooltip": !submitForm ? i18n2.str`Need to complete marked fields` : "confirm operation",
disabled: !submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/products/create/index.tsx
function CreateProduct({ onConfirm, onBack }) {
const { createProduct } = useProductAPI();
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
CreatePage3,
{
onBack,
onCreate: (request) => {
return createProduct(request).then(() => onConfirm()).catch((error2) => {
setNotif({
message: i18n2.str`could not create product`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/products/list/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/products/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable3({
instances,
onCreate,
onSelect,
onUpdate,
onDelete
}) {
const [rowSelection, rowSelectionHandler] = p3(
void 0
);
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-shopping" })), /* @__PURE__ */ h(i18n2.Translate, null, "Products")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`add product to inventory`
},
/* @__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" }, instances.length > 0 ? /* @__PURE__ */ h(
Table3,
{
instances,
onSelect,
onDelete,
onUpdate,
rowSelection,
rowSelectionHandler
}
) : /* @__PURE__ */ h(EmptyTable4, null)))));
}
function Table3({
rowSelection,
rowSelectionHandler,
instances,
onSelect,
onUpdate,
onDelete
}) {
const { i18n: i18n2 } = useTranslationContext();
const [settings] = useSettings();
return /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Image")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Description")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Price per unit")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Taxes")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Profit")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Stock")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Sold")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
const restStockInfo = !i4.next_restock ? "" : i4.next_restock.t_s === "never" ? "never" : `restock at ${format(
new Date(i4.next_restock.t_s * 1e3),
dateFormatForSettings(settings)
)}`;
let stockInfo = "";
if (i4.total_stock < 0) {
stockInfo = "infinite";
} else {
const totalStock = i4.total_stock - i4.total_lost - i4.total_sold;
stockInfo = /* @__PURE__ */ h("label", { title: restStockInfo }, totalStock, " ", i4.unit);
}
const isFree = Amounts.isZero(Amounts.parseOrThrow(i4.price));
return /* @__PURE__ */ h(p2, { key: i4.id }, /* @__PURE__ */ h("tr", { key: "info" }, /* @__PURE__ */ h(
"td",
{
onClick: () => rowSelection !== i4.id && rowSelectionHandler(i4.id),
style: { cursor: "pointer" }
},
/* @__PURE__ */ h(
"img",
{
src: i4.image ? i4.image : empty_default,
style: {
border: "solid black 1px",
width: 100,
height: 100
}
}
)
), /* @__PURE__ */ h(
"td",
{
onClick: () => rowSelection !== i4.id && rowSelectionHandler(i4.id),
style: { cursor: "pointer" }
},
i4.description
), /* @__PURE__ */ h(
"td",
{
onClick: () => rowSelection !== i4.id && rowSelectionHandler(i4.id),
style: { cursor: "pointer" }
},
isFree ? i18n2.str`free` : `${i4.price} / ${i4.unit}`
), /* @__PURE__ */ h(
"td",
{
onClick: () => rowSelection !== i4.id && rowSelectionHandler(i4.id),
style: { cursor: "pointer" }
},
sum(i4.taxes)
), /* @__PURE__ */ h(
"td",
{
onClick: () => rowSelection !== i4.id && rowSelectionHandler(i4.id),
style: { cursor: "pointer" }
},
difference(i4.price, sum(i4.taxes))
), /* @__PURE__ */ h(
"td",
{
onClick: () => rowSelection !== i4.id && rowSelectionHandler(i4.id),
style: { cursor: "pointer" }
},
stockInfo
), /* @__PURE__ */ h(
"td",
{
onClick: () => rowSelection !== i4.id && rowSelectionHandler(i4.id),
style: { cursor: "pointer" }
},
i4.total_sold,
" ",
i4.unit
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-bottom",
"data-tooltip": i18n2.str`go to product update page`
},
/* @__PURE__ */ h(
"button",
{
class: "button is-small is-success ",
type: "button",
onClick: () => onSelect(i4)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Update")
)
), /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`remove this product from the database`
},
/* @__PURE__ */ h(
"button",
{
class: "button is-small is-danger",
type: "button",
onClick: () => onDelete(i4)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Delete")
)
)))), rowSelection === i4.id && /* @__PURE__ */ h("tr", { key: "form" }, /* @__PURE__ */ h("td", { colSpan: 10 }, /* @__PURE__ */ h(
FastProductUpdateForm,
{
product: i4,
onUpdate: (prod) => onUpdate(i4.id, prod).then(
(r3) => rowSelectionHandler(void 0)
),
onCancel: () => rowSelectionHandler(void 0)
}
))));
}))));
}
function FastProductWithInfiniteStockUpdateForm({
product,
onUpdate,
onCancel
}) {
const [value, valueHandler] = p3({ price: product.price });
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
FormProvider,
{
name: "added",
object: value,
valueHandler
},
/* @__PURE__ */ h(
InputCurrency,
{
name: "price",
label: i18n2.str`Price`,
tooltip: i18n2.str`update the product with new price`
}
)
), /* @__PURE__ */ h("div", { class: "buttons is-expanded" }, /* @__PURE__ */ h("div", { class: "buttons mt-5" }, /* @__PURE__ */ h("button", { class: "button ", onClick: onCancel }, /* @__PURE__ */ h(i18n2.Translate, null, "Clone"))), /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, /* @__PURE__ */ h("button", { class: "button", onClick: onCancel }, /* @__PURE__ */ h(i18n2.Translate, null, "Cancel")), /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`update product with new price`
},
/* @__PURE__ */ h(
"button",
{
class: "button is-info",
onClick: () => onUpdate(__spreadProps(__spreadValues({}, product), {
price: value.price
}))
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm update")
)
))));
}
function FastProductWithManagedStockUpdateForm({
product,
onUpdate,
onCancel
}) {
const [value, valueHandler] = p3({
incoming: 0,
lost: 0,
price: product.price
});
const currentStock = product.total_stock - product.total_sold - product.total_lost;
const errors2 = {
lost: currentStock + value.incoming < value.lost ? `lost cannot be greater that current + incoming (max ${currentStock + value.incoming})` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
FormProvider,
{
name: "added",
errors: errors2,
object: value,
valueHandler
},
/* @__PURE__ */ h(
InputNumber2,
{
name: "incoming",
label: i18n2.str`Incoming`,
tooltip: i18n2.str`add more elements to the inventory`
}
),
/* @__PURE__ */ h(
InputNumber2,
{
name: "lost",
label: i18n2.str`Lost`,
tooltip: i18n2.str`report elements lost in the inventory`
}
),
/* @__PURE__ */ h(
InputCurrency,
{
name: "price",
label: i18n2.str`Price`,
tooltip: i18n2.str`new price for the product`
}
)
), /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, /* @__PURE__ */ h("button", { class: "button", onClick: onCancel }, /* @__PURE__ */ h(i18n2.Translate, null, "Cancel")), /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-left",
"data-tooltip": hasErrors ? i18n2.str`the are value with errors` : i18n2.str`update product with new stock and price`
},
/* @__PURE__ */ h(
"button",
{
class: "button is-info",
disabled: hasErrors,
onClick: () => onUpdate(__spreadProps(__spreadValues({}, product), {
total_stock: product.total_stock + value.incoming,
total_lost: product.total_lost + value.lost,
price: value.price
}))
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
)
)));
}
function FastProductUpdateForm(props) {
return props.product.total_stock === -1 ? /* @__PURE__ */ h(FastProductWithInfiniteStockUpdateForm, __spreadValues({}, props)) : /* @__PURE__ */ h(FastProductWithManagedStockUpdateForm, __spreadValues({}, props));
}
function EmptyTable4() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "There is no products yet, add more pressing the + sign")));
}
function difference(price, tax) {
if (!tax)
return price;
const ps = price.split(":");
const p4 = parseInt(ps[1], 10);
ps[1] = `${p4 - tax}`;
return ps.join(":");
}
function sum(taxes) {
return taxes.reduce((p4, c4) => p4 + parseInt(c4.tax.split(":")[1], 10), 0);
}
// src/paths/instance/products/list/index.tsx
function ProductList2({
onUnauthorized,
onLoadError,
onCreate,
onSelect,
onNotFound
}) {
const result = useInstanceProducts();
const { deleteProduct, updateProduct } = useProductAPI();
const [deleting, setDeleting] = p3(null);
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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,
{
instances: result.data,
onCreate,
onUpdate: (id, prod) => updateProduct(id, prod).then(
() => setNotif({
message: i18n2.str`product updated successfully`,
type: "SUCCESS"
})
).catch(
(error2) => setNotif({
message: i18n2.str`could not update the product`,
type: "ERROR",
description: error2.message
})
),
onSelect: (product) => onSelect(product.id),
onDelete: (prod) => setDeleting(prod)
}
), deleting && /* @__PURE__ */ h(
ConfirmModal,
{
label: `Delete product`,
description: `Delete the product "${deleting.description}"`,
danger: true,
active: true,
onCancel: () => setDeleting(null),
onConfirm: () => __async(this, null, function* () {
try {
yield deleteProduct(deleting.id);
setNotif({
message: i18n2.str`Product "${deleting.description}" (ID: ${deleting.id}) has been deleted`,
type: "SUCCESS"
});
} catch (error2) {
setNotif({
message: i18n2.str`Failed to delete product`,
type: "ERROR",
description: error2 instanceof Error ? error2.message : void 0
});
}
setDeleting(null);
})
},
/* @__PURE__ */ h("p", null, "If you delete the product named ", /* @__PURE__ */ h("b", null, '"', deleting.description, '"'), " (ID:", " ", /* @__PURE__ */ h("b", null, deleting.id), "), the stock and related information will be lost"),
/* @__PURE__ */ h("p", { class: "warning" }, "Deleting an product ", /* @__PURE__ */ h("b", null, "cannot be undone"), ".")
));
}
// src/paths/instance/products/update/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/products/update/UpdatePage.tsx
init_preact_module();
function UpdatePage({ product, onUpdate, onBack }) {
const [submitForm, addFormSubmitter] = useListener(
(result) => {
if (result)
return onUpdate(result);
return Promise.resolve();
}
);
const { i18n: i18n2 } = useTranslationContext();
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, "Product id:"), /* @__PURE__ */ h("b", null, product.product_id))))))), /* @__PURE__ */ h("hr", null), /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h(
ProductForm2,
{
initial: product,
onSubscribe: addFormSubmitter,
alreadyExist: true
}
), /* @__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,
{
onClick: submitForm,
"data-tooltip": !submitForm ? i18n2.str`Need to complete marked fields` : "confirm operation",
disabled: !submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/products/update/index.tsx
function UpdateProduct({
pid,
onConfirm,
onBack,
onUnauthorized,
onNotFound,
onLoadError
}) {
const { updateProduct } = useProductAPI();
const result = useProductDetails(pid);
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
UpdatePage,
{
product: __spreadProps(__spreadValues({}, result.data), { product_id: pid }),
onBack,
onUpdate: (data) => {
return updateProduct(pid, data).then(onConfirm).catch((error2) => {
setNotif({
message: i18n2.str`could not create product`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/accounts/create/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/accounts/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
// src/components/form/InputPaytoForm.tsx
init_preact_module();
init_hooks_module();
function isEthereumAddress(address) {
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) {
return false;
} else if (/^(0x|0X)?[0-9a-f]{40}$/.test(address) || /^(0x|0X)?[0-9A-F]{40}$/.test(address)) {
return true;
}
return checkAddressChecksum(address);
}
function checkAddressChecksum(address) {
return true;
}
function validateBitcoin(addr, i18n2) {
try {
const valid = /^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/.test(addr);
if (valid)
return void 0;
} catch (e4) {
console.log(e4);
}
return i18n2.str`This is not a valid bitcoin address.`;
}
function validateEthereum(addr, i18n2) {
try {
const valid = isEthereumAddress(addr);
if (valid)
return void 0;
} catch (e4) {
console.log(e4);
}
return i18n2.str`This is not a valid Ethereum address.`;
}
function validateIBAN(iban, i18n2) {
if (iban.length < 4)
return i18n2.str`IBAN numbers usually have more that 4 digits`;
if (iban.length > 34)
return i18n2.str`IBAN numbers usually have less that 34 digits`;
const A_code = "A".charCodeAt(0);
const Z_code = "Z".charCodeAt(0);
const IBAN = iban.toUpperCase();
const code = IBAN.substr(0, 2);
const found = code in COUNTRY_TABLE;
if (!found)
return i18n2.str`IBAN country code not found`;
const step2 = IBAN.substr(4) + iban.substr(0, 4);
const step3 = Array.from(step2).map((letter) => {
const code2 = letter.charCodeAt(0);
if (code2 < A_code || code2 > Z_code)
return letter;
return `${letter.charCodeAt(0) - "A".charCodeAt(0) + 10}`;
}).join("");
function calculate_iban_checksum(str) {
const numberStr = str.substr(0, 5);
const rest = str.substr(5);
const number2 = parseInt(numberStr, 10);
const result = number2 % 97;
if (rest.length > 0) {
return calculate_iban_checksum(`${result}${rest}`);
}
return result;
}
const checksum = calculate_iban_checksum(step3);
if (checksum !== 1)
return i18n2.str`IBAN number is not valid, checksum is wrong`;
return void 0;
}
var targets = [
"Choose one...",
"iban",
"x-taler-bank",
"bitcoin",
"ethereum"
];
var noTargetValue = targets[0];
var defaultTarget = {
target: noTargetValue,
params: {}
};
function InputPaytoForm({
name,
readonly,
label,
tooltip
}) {
var _a, _b, _c;
const { value: initialValueStr, onChange } = useField(name);
const initialPayto = parsePaytoUri(initialValueStr != null ? initialValueStr : "");
const paths = !initialPayto ? [] : initialPayto.targetPath.split("/");
const initialPath1 = paths.length >= 1 ? paths[0] : void 0;
const initialPath2 = paths.length >= 2 ? paths[1] : void 0;
const initial2 = initialPayto === void 0 ? defaultTarget : {
target: initialPayto.targetType,
params: initialPayto.params,
path1: initialPath1,
path2: initialPath2
};
const [value, setValue] = p3(initial2);
const { i18n: i18n2 } = useTranslationContext();
const errors2 = {
target: value.target === noTargetValue ? 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,
params: undefinedIfEmpty({
"receiver-name": !((_a = value.params) == null ? void 0 : _a["receiver-name"]) ? i18n2.str`required` : void 0
})
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const str = hasErrors || !value.target ? void 0 : stringifyPaytoUri({
targetType: value.target,
targetPath: value.path2 ? `${value.path1}/${value.path2}` : (_b = value.path1) != null ? _b : "",
params: (_c = value.params) != null ? _c : {},
isKnown: false
});
h2(() => {
onChange(str);
}, [str]);
return /* @__PURE__ */ h(InputGroup, { name: "payto", label, fixed: true, tooltip }, /* @__PURE__ */ h(
FormProvider,
{
name: "tax",
errors: errors2,
object: value,
valueHandler: setValue
},
/* @__PURE__ */ h(
InputSelector,
{
name: "target",
label: i18n2.str`Account type`,
tooltip: i18n2.str`Method to use for wire transfer`,
values: targets,
toStr: (v3) => v3 === noTargetValue ? i18n2.str`Choose one...` : v3
}
),
value.target === "ach" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "path1",
label: i18n2.str`Routing`,
tooltip: i18n2.str`Routing number.`
}
), /* @__PURE__ */ h(
Input,
{
name: "path2",
label: i18n2.str`Account`,
tooltip: i18n2.str`Account number.`
}
)),
value.target === "bic" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "path1",
label: i18n2.str`Code`,
tooltip: i18n2.str`Business Identifier Code.`
}
)),
value.target === "iban" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "path1",
label: i18n2.str`Account`,
tooltip: i18n2.str`Bank Account Number.`,
inputExtra: { style: { textTransform: "uppercase" } }
}
)),
value.target === "upi" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "path1",
label: i18n2.str`Account`,
tooltip: i18n2.str`Unified Payment Interface.`
}
)),
value.target === "bitcoin" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "path1",
label: i18n2.str`Address`,
tooltip: i18n2.str`Bitcoin protocol.`
}
)),
value.target === "ethereum" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "path1",
label: i18n2.str`Address`,
tooltip: i18n2.str`Ethereum protocol.`
}
)),
value.target === "ilp" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "path1",
label: i18n2.str`Address`,
tooltip: i18n2.str`Interledger protocol.`
}
)),
value.target === "void" && /* @__PURE__ */ h(p2, null),
value.target === "x-taler-bank" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "path1",
label: i18n2.str`Host`,
tooltip: i18n2.str`Bank host.`
}
), /* @__PURE__ */ h(
Input,
{
name: "path2",
label: i18n2.str`Account`,
tooltip: i18n2.str`Bank account.`
}
)),
value.target !== noTargetValue && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "params.receiver-name",
label: i18n2.str`Name`,
tooltip: i18n2.str`Bank account owner's name.`
}
))
));
}
// src/paths/instance/accounts/create/CreatePage.tsx
var accountAuthType = ["none", "basic"];
function isValidURL(s5) {
try {
const u4 = new URL(s5);
return true;
} catch (e4) {
return false;
}
}
function CreatePage4({ onCreate, onBack }) {
var _a;
const { i18n: i18n2 } = useTranslationContext();
const [state, setState] = p3({});
const errors2 = {
payto_uri: !state.payto_uri ? i18n2.str`required` : void 0,
credit_facade_credentials: !state.credit_facade_credentials ? void 0 : undefinedIfEmpty({
username: state.credit_facade_credentials.type === "basic" && !state.credit_facade_credentials.username ? i18n2.str`required` : void 0,
password: state.credit_facade_credentials.type === "basic" && !state.credit_facade_credentials.password ? i18n2.str`required` : void 0
}),
credit_facade_url: !state.credit_facade_url ? void 0 : !isValidURL(state.credit_facade_url) ? i18n2.str`not valid url` : void 0,
repeatPassword: !state.credit_facade_credentials ? void 0 : state.credit_facade_credentials.type === "basic" && (!state.credit_facade_credentials.password || state.credit_facade_credentials.password !== state.repeatPassword) ? i18n2.str`is not the same` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
delete state.repeatPassword;
return onCreate(state);
};
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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
InputPaytoForm,
{
name: "payto_uri",
label: i18n2.str`Account`
}
),
/* @__PURE__ */ h(
Input,
{
name: "credit_facade_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: "credit_facade_credentials.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";
}
}
),
((_a = state.credit_facade_credentials) == null ? void 0 : _a.type) === "basic" ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
Input,
{
name: "credit_facade_credentials.username",
label: i18n2.str`Username`,
tooltip: i18n2.str`Username to access the account information.`
}
), /* @__PURE__ */ h(
Input,
{
name: "credit_facade_credentials.password",
inputType: "password",
label: i18n2.str`Password`,
tooltip: i18n2.str`Password to access the account information.`
}
), /* @__PURE__ */ h(
Input,
{
name: "repeatPassword",
inputType: "password",
label: i18n2.str`Repeat password`
}
)) : 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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/hooks/bank.ts
init_hooks_module();
var useSWR5 = useSWR;
function useBankAccountAPI() {
const mutateAll = useMatchMutate();
const { request } = useBackendInstanceRequest();
const createBankAccount = (data) => __async(this, null, function* () {
const res = yield request(`/private/accounts`, {
method: "POST",
data
});
yield mutateAll(/.*private\/accounts.*/);
return res;
});
const updateBankAccount = (h_wire, data) => __async(this, null, function* () {
const res = yield request(`/private/accounts/${h_wire}`, {
method: "PATCH",
data
});
yield mutateAll(/.*private\/accounts.*/);
return res;
});
const deleteBankAccount = (h_wire) => __async(this, null, function* () {
const res = yield request(`/private/accounts/${h_wire}`, {
method: "DELETE"
});
yield mutateAll(/.*private\/accounts.*/);
return res;
});
return {
createBankAccount,
updateBankAccount,
deleteBankAccount
};
}
function useInstanceBankAccounts(args, updatePosition) {
const { fetcher } = useBackendInstanceRequest();
const [pageAfter, setPageAfter] = p3(1);
const totalAfter = pageAfter * PAGE_SIZE;
const {
data: afterData,
error: afterError,
isValidating: loadingAfter
} = useSWR5([`/private/accounts`], fetcher);
const [lastAfter, setLastAfter] = p3({ loading: true });
h2(() => {
if (afterData)
setLastAfter(afterData);
}, [
afterData
/*, beforeData*/
]);
if (afterError)
return afterError.cause;
const isReachingEnd = afterData && afterData.data.accounts.length < totalAfter;
const isReachingStart = false;
const pagination = {
isReachingEnd,
isReachingStart,
loadMore: () => {
if (!afterData || isReachingEnd)
return;
if (afterData.data.accounts.length < MAX_RESULT_SIZE) {
setPageAfter(pageAfter + 1);
} else {
const from = `${afterData.data.accounts[afterData.data.accounts.length - 1].h_wire}`;
if (from && updatePosition)
updatePosition(from);
}
},
loadMorePrev: () => {
}
};
const accounts = !afterData ? [] : (afterData || lastAfter).data.accounts;
if (loadingAfter)
return { loading: true, data: { accounts } };
if (
/*beforeData &&*/
afterData
) {
return __spreadValues({ ok: true, data: { accounts } }, pagination);
}
return { loading: true };
}
function useBankAccountDetails(h_wire) {
const { fetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR5([`/private/accounts/${h_wire}`], fetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data) {
return data;
}
if (error2)
return error2.cause;
return { loading: true };
}
// src/paths/instance/accounts/create/index.tsx
function CreateValidator({ onConfirm, onBack }) {
const { createBankAccount } = useBankAccountAPI();
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
CreatePage4,
{
onBack,
onCreate: (request) => {
return createBankAccount(request).then((d5) => {
onConfirm();
}).catch((error2) => {
setNotif({
message: i18n2.str`could not create device`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/accounts/list/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/accounts/list/ListPage.tsx
init_preact_module();
// src/paths/instance/accounts/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable4({
accounts,
onCreate,
onDelete,
onSelect,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
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, "Bank accounts")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`add new accounts`
},
/* @__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" }, accounts.length > 0 ? /* @__PURE__ */ h(
Table4,
{
accounts,
onDelete,
onSelect,
rowSelection,
rowSelectionHandler,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}
) : /* @__PURE__ */ h(EmptyTable5, null)))));
}
function Table4({
accounts,
onLoadMoreAfter,
onDelete,
onSelect,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
const { i18n: i18n2 } = useTranslationContext();
const emptyList = { "bitcoin": [], "x-taler-bank": [], "iban": [], "unknown": [] };
const accountsByType = accounts.reduce((prev, acc) => {
const parsed = parsePaytoUri(acc.payto_uri);
if (!parsed)
return prev;
if (parsed.targetType !== "bitcoin" && parsed.targetType !== "x-taler-bank" && parsed.targetType !== "iban") {
prev["unknown"].push({ parsed, acc });
} else {
prev[parsed.targetType].push({ parsed, acc });
}
return prev;
}, emptyList);
const bitcoinAccounts = accountsByType["bitcoin"];
const talerbankAccounts = accountsByType["x-taler-bank"];
const ibanAccounts = accountsByType["iban"];
const unkownAccounts = accountsByType["unknown"];
return /* @__PURE__ */ h(p2, null, bitcoinAccounts.length > 0 && /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Bitcoin type accounts")), /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Address")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Sewgit 1")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Sewgit 2")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, bitcoinAccounts.map(({ parsed, acc }, idx) => {
const ac = parsed;
return /* @__PURE__ */ h("tr", { key: idx }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
ac.targetPath
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
ac.segwitAddrs[0]
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
ac.segwitAddrs[1]
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-danger is-small has-tooltip-left",
"data-tooltip": i18n2.str`delete selected accounts from the database`,
onClick: () => onDelete(acc)
},
"Delete"
))));
})))), talerbankAccounts.length > 0 && /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Taler type accounts")), /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Host")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Account name")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, talerbankAccounts.map(({ parsed, acc }, idx) => {
const ac = parsed;
return /* @__PURE__ */ h("tr", { key: idx }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
ac.host
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
ac.account
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-danger is-small has-tooltip-left",
"data-tooltip": i18n2.str`delete selected accounts from the database`,
onClick: () => onDelete(acc)
},
"Delete"
))));
})))), ibanAccounts.length > 0 && /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h(i18n2.Translate, null, "IBAN type accounts")), /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Account name")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "IBAN")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "BIC")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, ibanAccounts.map(({ parsed, acc }, idx) => {
var _a;
const ac = parsed;
return /* @__PURE__ */ h("tr", { key: idx }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
ac.params["receiver-name"]
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
ac.iban
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
(_a = ac.bic) != null ? _a : ""
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-danger is-small has-tooltip-left",
"data-tooltip": i18n2.str`delete selected accounts from the database`,
onClick: () => onDelete(acc)
},
"Delete"
))));
})))), unkownAccounts.length > 0 && /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h(i18n2.Translate, null, "Other type accounts")), /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Type")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Path")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, unkownAccounts.map(({ parsed, acc }, idx) => {
const ac = parsed;
return /* @__PURE__ */ h("tr", { key: idx }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
ac.targetType
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(acc),
style: { cursor: "pointer" }
},
ac.targetPath
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-danger is-small has-tooltip-left",
"data-tooltip": i18n2.str`delete selected accounts from the database`,
onClick: () => onDelete(acc)
},
"Delete"
))));
})))));
}
function EmptyTable5() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "There is no accounts yet, add more pressing the + sign")));
}
// src/paths/instance/accounts/list/ListPage.tsx
function ListPage3({
devices,
onCreate,
onDelete,
onSelect,
onLoadMoreBefore,
onLoadMoreAfter
}) {
const form = { payto_uri: "" };
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(
CardTable4,
{
accounts: devices.map((o3) => __spreadProps(__spreadValues({}, o3), {
id: String(o3.h_wire)
})),
onCreate,
onDelete,
onSelect,
onLoadMoreBefore,
hasMoreBefore: !onLoadMoreBefore,
onLoadMoreAfter,
hasMoreAfter: !onLoadMoreAfter
}
));
}
// src/paths/instance/accounts/list/index.tsx
function ListValidators({
onUnauthorized,
onLoadError,
onCreate,
onSelect,
onNotFound
}) {
const [position, setPosition] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const [notif, setNotif] = p3(void 0);
const { deleteBankAccount } = useBankAccountAPI();
const result = useInstanceBankAccounts({ position }, (id) => setPosition(id));
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
ListPage3,
{
devices: result.data.accounts,
onLoadMoreBefore: result.isReachingStart ? result.loadMorePrev : void 0,
onLoadMoreAfter: result.isReachingEnd ? result.loadMore : void 0,
onCreate,
onSelect: (e4) => {
onSelect(e4.h_wire);
},
onDelete: (e4) => deleteBankAccount(e4.h_wire).then(
() => setNotif({
message: i18n2.str`bank account delete successfully`,
type: "SUCCESS"
})
).catch(
(error2) => setNotif({
message: i18n2.str`could not delete the bank account`,
type: "ERROR",
description: error2.message
})
)
}
));
}
// src/paths/instance/accounts/update/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/accounts/update/UpdatePage.tsx
init_preact_module();
init_hooks_module();
function UpdatePage2({ account, onUpdate, onBack }) {
const { i18n: i18n2 } = useTranslationContext();
const [state, setState] = p3(account);
const errors2 = {};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
return onUpdate(state);
};
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" }, "Account: ", /* @__PURE__ */ h("b", null, account.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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
Input,
{
name: "credit_facade_url",
label: i18n2.str`Description`,
tooltip: i18n2.str`dddd`
}
)
), /* @__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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
)))))));
}
// src/paths/instance/accounts/update/index.tsx
function UpdateValidator({
bid,
onConfirm,
onBack,
onUnauthorized,
onNotFound,
onLoadError
}) {
const { updateBankAccount } = useBankAccountAPI();
const result = useBankAccountDetails(bid);
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
UpdatePage2,
{
account: __spreadProps(__spreadValues({}, result.data), { id: bid }),
onBack,
onUpdate: (data) => {
return updateBankAccount(bid, data).then(onConfirm).catch((error2) => {
setNotif({
message: i18n2.str`could not update account`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/reserves/create/index.tsx
init_preact_module();
init_hooks_module();
// src/hooks/reserves.ts
var useSWR6 = useSWR;
function useReservesAPI() {
const mutateAll = useMatchMutate();
const { mutate: mutate2 } = useSWRConfig();
const { request } = useBackendInstanceRequest();
const createReserve = (data) => __async(this, null, function* () {
const res = yield request(
`/private/reserves`,
{
method: "POST",
data
}
);
yield mutateAll(/.*private\/reserves.*/);
return res;
});
const authorizeRewardReserve = (pub, data) => __async(this, null, function* () {
const res = yield request(
`/private/reserves/${pub}/authorize-reward`,
{
method: "POST",
data
}
);
yield mutate2([`/private/reserves/${pub}`]);
return res;
});
const authorizeReward = (data) => __async(this, null, function* () {
const res = yield request(
`/private/rewards`,
{
method: "POST",
data
}
);
yield mutateAll(/.*private\/reserves\/.*/);
return res;
});
const deleteReserve = (pub) => __async(this, null, function* () {
const res = yield request(`/private/reserves/${pub}`, {
method: "DELETE"
});
yield mutateAll(/.*private\/reserves.*/);
return res;
});
return { createReserve, authorizeReward, authorizeRewardReserve, deleteReserve };
}
function useInstanceReserves() {
const { fetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR6([`/private/reserves`], fetcher);
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data)
return data;
if (error2)
return error2.cause;
return { loading: true };
}
function useReserveDetails(reserveId) {
const { reserveDetailFetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR6([`/private/reserves/${reserveId}`], reserveDetailFetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data)
return data;
if (error2)
return error2.cause;
return { loading: true };
}
function useRewardDetails(rewardId) {
const { rewardsDetailFetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR6([`/private/rewards/${rewardId}`], rewardsDetailFetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data)
return data;
if (error2)
return error2.cause;
return { loading: true };
}
// src/paths/instance/reserves/create/CreatedSuccessfully.tsx
init_preact_module();
// src/components/exception/QR.tsx
init_preact_module();
init_hooks_module();
var import_qrcode_generator = __toESM(require_qrcode(), 1);
function QR({ text }) {
const divRef = _2(null);
h2(() => {
const qr = (0, import_qrcode_generator.default)(0, "L");
qr.addData(text);
qr.make();
if (divRef.current) {
divRef.current.innerHTML = qr.createSvgTag({
scalable: true
});
}
});
return /* @__PURE__ */ h(
"div",
{
style: {
width: "100%",
display: "flex",
flexDirection: "column",
alignItems: "center"
}
},
/* @__PURE__ */ h(
"div",
{
style: { width: "50%", minWidth: 200, maxWidth: 300 },
ref: divRef
}
)
);
}
// src/paths/instance/reserves/create/CreatedSuccessfully.tsx
function isNotUndefined(x6) {
return !!x6;
}
function CreatedSuccessfully2({
entity,
onConfirm,
onCreateAnother
}) {
var _a;
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",
{
readonly: true,
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" }, "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(
ShowAccountsOfReserveAsQRWithLink,
{
accounts: (_a = entity.response.accounts) != null ? _a : [],
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
init_preact_module();
init_hooks_module();
function ViewStep({
step,
setCurrentStep,
reserve,
onBack,
submitForm,
setReserve
}) {
const { i18n: i18n2 } = useTranslationContext();
const [wireMethods, setWireMethods] = p3([]);
const [exchangeQueryError, setExchangeQueryError] = p3(void 0);
h2(() => {
setExchangeQueryError(void 0);
}, [reserve.exchange_url]);
switch (step) {
case 0 /* EXCHANGE */: {
const errors2 = {
initial_balance: !reserve.initial_balance ? "cannot be empty" : !(parseInt(reserve.initial_balance.split(":")[1], 10) > 0) ? i18n2.str`it should be greater than 0` : void 0,
exchange_url: !reserve.exchange_url ? i18n2.str`cannot be empty` : !URL_REGEX.test(reserve.exchange_url) ? i18n2.str`must be a valid URL` : !exchangeQueryError ? void 0 : exchangeQueryError
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
FormProvider,
{
object: reserve,
errors: errors2,
valueHandler: setReserve
},
/* @__PURE__ */ h(
InputCurrency,
{
name: "initial_balance",
label: i18n2.str`Initial balance`,
tooltip: i18n2.str`balance prior to deposit`
}
),
/* @__PURE__ */ h(
Input,
{
name: "exchange_url",
label: i18n2.str`Exchange URL`,
tooltip: i18n2.str`URL of exchange`
}
)
), /* @__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,
{
class: "has-tooltip-left",
onClick: () => {
return fetch(`${reserve.exchange_url}wire`).then((r3) => r3.json()).then((r3) => {
const wireMethods2 = r3.accounts.map((a5) => {
const match2 = PAYTO_WIRE_METHOD_LOOKUP.exec(a5.payto_uri);
return match2 && match2[1] || "";
});
setWireMethods(wireMethods2);
setCurrentStep(1 /* WIRE_METHOD */);
return;
}).catch((r3) => {
setExchangeQueryError(r3.message);
});
},
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
disabled: hasErrors
},
/* @__PURE__ */ h(i18n2.Translate, null, "Next")
)));
}
case 1 /* WIRE_METHOD */: {
const errors2 = {
wire_method: !reserve.wire_method ? i18n2.str`cannot be empty` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
FormProvider,
{
object: reserve,
errors: errors2,
valueHandler: setReserve
},
/* @__PURE__ */ h(
InputCurrency,
{
name: "initial_balance",
label: i18n2.str`Initial balance`,
tooltip: i18n2.str`balance prior to deposit`,
readonly: true
}
),
/* @__PURE__ */ h(
Input,
{
name: "exchange_url",
label: i18n2.str`Exchange URL`,
tooltip: i18n2.str`URL of exchange`,
readonly: true
}
),
/* @__PURE__ */ h(
InputSelector,
{
name: "wire_method",
label: i18n2.str`Wire method`,
tooltip: i18n2.str`method to use for wire transfer`,
values: wireMethods,
placeholder: i18n2.str`Select one wire method`
}
)
), /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, onBack && /* @__PURE__ */ h(
"button",
{
class: "button",
onClick: () => setCurrentStep(0 /* EXCHANGE */)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Back")
), /* @__PURE__ */ h(
AsyncButton,
{
onClick: submitForm,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
disabled: hasErrors
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
)));
}
}
}
function CreatePage5({ onCreate, onBack }) {
const [reserve, setReserve] = p3({});
const submitForm = () => {
return onCreate(reserve);
};
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",
{
class: currentStep === 1 /* WIRE_METHOD */ ? "is-active" : ""
},
/* @__PURE__ */ h("a", { style: { cursor: "initial" } }, /* @__PURE__ */ h("span", null, "Step 2: Select wire method"))
))), /* @__PURE__ */ h(
ViewStep,
{
step: currentStep,
reserve,
setCurrentStep,
setReserve,
submitForm,
onBack
}
)), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/reserves/create/index.tsx
function CreateReserve({ onBack, onConfirm }) {
const { createReserve } = useReservesAPI();
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const [createdOk, setCreatedOk] = p3(void 0);
if (createdOk) {
return /* @__PURE__ */ h(CreatedSuccessfully2, { entity: createdOk, onConfirm });
}
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
CreatePage5,
{
onBack,
onCreate: (request) => {
return createReserve(request).then((r3) => setCreatedOk({ request, response: r3.data })).catch((error2) => {
setNotif({
message: i18n2.str`could not create reserve`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/reserves/details/index.tsx
init_preact_module();
// src/paths/instance/reserves/details/DetailPage.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/reserves/details/RewardInfo.tsx
init_preact_module();
function RewardInfo({ id: merchantRewardId, amount, entity }) {
const { url: backendURL } = useBackendContext();
const [settings] = useSettings();
const rewardURL = stringifyRewardUri({ merchantBaseUrl: backendURL, merchantRewardId });
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: rewardURL }, rewardURL))))), /* @__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",
readonly: true,
value: !entity.expiration || entity.expiration.t_s === "never" ? "never" : format(
entity.expiration.t_s * 1e3,
datetimeFormatForSettings(settings)
)
}
))))));
}
// src/paths/instance/reserves/details/DetailPage.tsx
function DetailPage3({ id, selected, onBack }) {
const { i18n: i18n2 } = useTranslationContext();
const didExchangeAckTransfer = Amounts.isNonZero(
Amounts.parseOrThrow(selected.exchange_initial_amount)
);
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,
{
name: "creation_time",
label: i18n2.str`Created at`,
readonly: true
}
), /* @__PURE__ */ h(
InputDate,
{
name: "expiration_time",
label: i18n2.str`Valid until`,
readonly: true
}
), /* @__PURE__ */ h(
InputCurrency,
{
name: "merchant_initial_amount",
label: i18n2.str`Created balance`,
readonly: true
}
), /* @__PURE__ */ h(
TextField,
{
name: "exchange_url",
label: i18n2.str`Exchange URL`,
readonly: true
},
/* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: selected.exchange_url }, selected.exchange_url)
), didExchangeAckTransfer && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
InputCurrency,
{
name: "exchange_initial_amount",
label: i18n2.str`Exchange balance`,
readonly: true
}
), /* @__PURE__ */ h(
InputCurrency,
{
name: "pickup_amount",
label: i18n2.str`Picked up`,
readonly: true
}
), /* @__PURE__ */ h(
InputCurrency,
{
name: "committed_amount",
label: i18n2.str`Committed`,
readonly: true
}
)), /* @__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, "Rewards"))), /* @__PURE__ */ h("div", { class: "card-content" }, /* @__PURE__ */ h("div", { class: "b-table has-pagination" }, /* @__PURE__ */ h("div", { class: "table-wrapper has-mobile-cards" }, selected.rewards && selected.rewards.length > 0 ? /* @__PURE__ */ h(Table5, { rewards: selected.rewards }) : /* @__PURE__ */ h(EmptyTable6, null)))))) : selected.accounts ? /* @__PURE__ */ h(
ShowAccountsOfReserveAsQRWithLink,
{
accounts: selected.accounts,
amount: selected.merchant_initial_amount,
message: id
}
) : 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 EmptyTable6() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "No reward has been authorized from this reserve")));
}
function Table5({ rewards }) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Authorized")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Picked up")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Reason")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Expiration")))), /* @__PURE__ */ h("tbody", null, rewards.map((t4, i4) => {
return /* @__PURE__ */ h(RewardRow, { id: t4.reward_id, key: i4, entry: t4 });
}))));
}
function RewardRow({
id,
entry
}) {
const [selected, setSelected] = p3(false);
const result = useRewardDetails(id);
const [settings] = useSettings();
if (result.loading) {
return /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", null, "..."), /* @__PURE__ */ h("td", null, "..."), /* @__PURE__ */ h("td", null, "..."), /* @__PURE__ */ h("td", null, "..."));
}
if (!result.ok) {
return /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", null, "..."), " ", /* @__PURE__ */ h("td", null, entry.total_amount), /* @__PURE__ */ h("td", null, entry.reason), /* @__PURE__ */ h("td", null, "..."), " ");
}
const info = result.data;
function onSelect() {
setSelected(true);
}
return /* @__PURE__ */ h(p2, null, selected && /* @__PURE__ */ h(
SimpleModal,
{
description: "reward",
active: true,
onCancel: () => setSelected(false)
},
/* @__PURE__ */ h(RewardInfo, { id, amount: info.total_authorized, entity: info })
), /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", { onClick: onSelect }, info.total_authorized), /* @__PURE__ */ h("td", { onClick: onSelect }, info.total_picked_up), /* @__PURE__ */ h("td", { onClick: onSelect }, info.reason), /* @__PURE__ */ h("td", { onClick: onSelect }, info.expiration.t_s === "never" ? "never" : format(info.expiration.t_s * 1e3, datetimeFormatForSettings(settings)))));
}
// src/paths/instance/reserves/details/index.tsx
function DetailReserve({
rid,
onUnauthorized,
onLoadError,
onNotFound,
onBack,
onDelete
}) {
const result = useReserveDetails(rid);
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(DetailPage3, { selected: result.data, onBack, id: rid }));
}
// src/paths/instance/reserves/list/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/reserves/list/AutorizeRewardModal.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/reserves/list/CreatedSuccessfully.tsx
init_preact_module();
function CreatedSuccessfully3({
request,
entity,
onConfirm,
onCreateAnother
}) {
const [settings] = useSettings();
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.reward_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",
readonly: true,
value: !entity.reward_expiration || entity.reward_expiration.t_s === "never" ? "never" : format(
entity.reward_expiration.t_s * 1e3,
datetimeFormatForSettings(settings)
)
}
))))));
}
// src/paths/instance/reserves/list/AutorizeRewardModal.tsx
function AuthorizeRewardModal({
onCancel,
onConfirm,
rewardAuthorized
}) {
const [form, setValue] = p3({});
const { i18n: i18n2 } = useTranslationContext();
let errors2 = {};
try {
AuthorizeRewardSchema.validateSync(form, { abortEarly: false });
} catch (err) {
if (err instanceof ValidationError) {
const yupErrors = err.inner;
errors2 = yupErrors.reduce(
(prev, cur) => !cur.path ? prev : __spreadProps(__spreadValues({}, prev), { [cur.path]: cur.message }),
{}
);
}
}
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const validateAndConfirm = () => {
onConfirm(form);
};
if (rewardAuthorized) {
return /* @__PURE__ */ h(ContinueModal, { description: "reward", active: true, onConfirm: onCancel }, /* @__PURE__ */ h(
CreatedSuccessfully3,
{
entity: rewardAuthorized.response,
request: rewardAuthorized.request,
onConfirm: onCancel
}
));
}
return /* @__PURE__ */ h(
ConfirmModal,
{
description: "New reward",
active: true,
onCancel,
disabled: hasErrors,
onConfirm: validateAndConfirm
},
/* @__PURE__ */ h(
FormProvider,
{
errors: errors2,
object: form,
valueHandler: setValue
},
/* @__PURE__ */ h(
InputCurrency,
{
name: "amount",
label: i18n2.str`Amount`,
tooltip: i18n2.str`amount of reward`
}
),
/* @__PURE__ */ h(
Input,
{
name: "justification",
label: i18n2.str`Justification`,
inputType: "multiline",
tooltip: i18n2.str`reason for the reward`
}
),
/* @__PURE__ */ h(
Input,
{
name: "next_url",
label: i18n2.str`URL after reward`,
tooltip: i18n2.str`URL to visit after reward payment`
}
)
)
);
}
// src/paths/instance/reserves/list/Table.tsx
init_preact_module();
function CardTable5({
instances,
onCreate,
onSelect,
onNewReward,
onDelete
}) {
const [withoutFunds, withFunds] = instances.reduce((prev, current) => {
const amount = current.exchange_initial_amount;
if (amount.endsWith(":0")) {
prev[0] = prev[0].concat(current);
} else {
prev[1] = prev[1].concat(current);
}
return prev;
}, new Array([], []));
const { i18n: i18n2 } = useTranslationContext();
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,
onNewReward,
onSelect,
onDelete
}
))))), /* @__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 ready")), /* @__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`add new reserve`
},
/* @__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" }, withFunds.length > 0 ? /* @__PURE__ */ h(
Table6,
{
instances: withFunds,
onNewReward,
onSelect,
onDelete
}
) : /* @__PURE__ */ h(EmptyTable7, null))))));
}
function Table6({ instances, onNewReward, onSelect, onDelete }) {
const { i18n: i18n2 } = useTranslationContext();
const [settings] = useSettings();
return /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Created at")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Expires at")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Initial")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Picked up")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Committed")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
return /* @__PURE__ */ h("tr", { key: i4.id }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.creation_time.t_s === "never" ? "never" : format(i4.creation_time.t_s * 1e3, datetimeFormatForSettings(settings))
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.expiration_time.t_s === "never" ? "never" : format(
i4.expiration_time.t_s * 1e3,
datetimeFormatForSettings(settings)
)
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.exchange_initial_amount
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.pickup_amount
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.committed_amount
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-small is-danger has-tooltip-left",
"data-tooltip": i18n2.str`delete selected reserve from the database`,
type: "button",
onClick: () => onDelete(i4)
},
"Delete"
), /* @__PURE__ */ h(
"button",
{
class: "button is-small is-info has-tooltip-left",
"data-tooltip": i18n2.str`authorize new reward from selected reserve`,
type: "button",
onClick: () => onNewReward(i4)
},
"New Reward"
))));
}))));
}
function EmptyTable7() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "There is no ready reserves yet, add more pressing the + sign or fund them")));
}
function TableWithoutFund({
instances,
onSelect,
onDelete
}) {
const { i18n: i18n2 } = useTranslationContext();
const [settings] = useSettings();
return /* @__PURE__ */ h("div", { class: "table-container" }, /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Created at")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Expires at")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Expected Balance")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
return /* @__PURE__ */ h("tr", { key: i4.id }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.creation_time.t_s === "never" ? "never" : format(i4.creation_time.t_s * 1e3, datetimeFormatForSettings(settings))
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.expiration_time.t_s === "never" ? "never" : format(
i4.expiration_time.t_s * 1e3,
datetimeFormatForSettings(settings)
)
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.merchant_initial_amount
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-small is-danger jb-modal has-tooltip-left",
type: "button",
"data-tooltip": i18n2.str`delete selected reserve from the database`,
onClick: () => onDelete(i4)
},
"Delete"
))));
}))));
}
// src/paths/instance/reserves/list/index.tsx
function ListRewards({
onUnauthorized,
onLoadError,
onNotFound,
onSelect,
onCreate
}) {
const result = useInstanceReserves();
const { deleteReserve, authorizeRewardReserve } = useReservesAPI();
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const [reserveForReward, setReserveForReward] = p3(
void 0
);
const [deleting, setDeleting] = p3(null);
const [rewardAuthorized, setRewardAuthorized] = p3(void 0);
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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 }), reserveForReward && /* @__PURE__ */ h(
AuthorizeRewardModal,
{
onCancel: () => {
setReserveForReward(void 0);
setRewardAuthorized(void 0);
},
rewardAuthorized,
onConfirm: (request) => __async(this, null, function* () {
try {
const response = yield authorizeRewardReserve(
reserveForReward,
request
);
setRewardAuthorized({
request,
response: response.data
});
} catch (error2) {
setNotif({
message: i18n2.str`could not create the reward`,
type: "ERROR",
description: error2 instanceof Error ? error2.message : void 0
});
setReserveForReward(void 0);
}
})
}
), /* @__PURE__ */ h(
CardTable5,
{
instances: result.data.reserves.filter((r3) => r3.active).map((o3) => __spreadProps(__spreadValues({}, o3), { id: o3.reserve_pub })),
onCreate,
onDelete: (reserve) => {
setDeleting(reserve);
},
onSelect: (reserve) => onSelect(reserve.id),
onNewReward: (reserve) => setReserveForReward(reserve.id)
}
), deleting && /* @__PURE__ */ h(
ConfirmModal,
{
label: `Delete reserve`,
description: `Delete the reserve`,
danger: true,
active: true,
onCancel: () => setDeleting(null),
onConfirm: () => __async(this, null, function* () {
try {
yield deleteReserve(deleting.reserve_pub);
setNotif({
message: i18n2.str`Reserve for "${deleting.merchant_initial_amount}" (ID: ${deleting.reserve_pub}) has been deleted`,
type: "SUCCESS"
});
} catch (error2) {
setNotif({
message: i18n2.str`Failed to delete reserve`,
type: "ERROR",
description: error2 instanceof Error ? error2.message : void 0
});
}
setDeleting(null);
})
},
/* @__PURE__ */ h("p", null, "If you delete the reserve for ", /* @__PURE__ */ h("b", null, '"', deleting.merchant_initial_amount, '"'), " you won't be able to create more rewards. ", /* @__PURE__ */ h("br", null), "Reserve ID: ", /* @__PURE__ */ h("b", null, deleting.reserve_pub)),
/* @__PURE__ */ h("p", { class: "warning" }, "Deleting an template ", /* @__PURE__ */ h("b", null, "cannot be undone"), ".")
));
}
// src/paths/instance/templates/create/index.tsx
init_preact_module();
init_hooks_module();
// src/hooks/templates.ts
init_hooks_module();
var useSWR7 = useSWR;
function useTemplateAPI() {
const mutateAll = useMatchMutate();
const { request } = useBackendInstanceRequest();
const createTemplate = (data) => __async(this, null, function* () {
const res = yield request(`/private/templates`, {
method: "POST",
data
});
yield mutateAll(/.*private\/templates.*/);
return res;
});
const updateTemplate = (templateId, data) => __async(this, null, function* () {
const res = yield request(`/private/templates/${templateId}`, {
method: "PATCH",
data
});
yield mutateAll(/.*private\/templates.*/);
return res;
});
const deleteTemplate = (templateId) => __async(this, null, function* () {
const res = yield request(`/private/templates/${templateId}`, {
method: "DELETE"
});
yield mutateAll(/.*private\/templates.*/);
return res;
});
const createOrderFromTemplate = (templateId, data) => __async(this, null, function* () {
const res = yield request(
`/templates/${templateId}`,
{
method: "POST",
data
}
);
yield mutateAll(/.*private\/templates.*/);
return res;
});
return {
createTemplate,
updateTemplate,
deleteTemplate,
createOrderFromTemplate
};
}
function useInstanceTemplates(args, updatePosition) {
const { templateFetcher } = useBackendInstanceRequest();
const [pageAfter, setPageAfter] = p3(1);
const totalAfter = pageAfter * PAGE_SIZE;
const {
data: afterData,
error: afterError,
isValidating: loadingAfter
} = useSWR7([`/private/templates`, args == null ? void 0 : args.position, -totalAfter], templateFetcher);
const [lastAfter, setLastAfter] = p3({ loading: true });
h2(() => {
if (afterData)
setLastAfter(afterData);
}, [
afterData
/*, beforeData*/
]);
if (afterError)
return afterError.cause;
const isReachingEnd = afterData && afterData.data.templates.length < totalAfter;
const isReachingStart = false;
const pagination = {
isReachingEnd,
isReachingStart,
loadMore: () => {
if (!afterData || isReachingEnd)
return;
if (afterData.data.templates.length < MAX_RESULT_SIZE) {
setPageAfter(pageAfter + 1);
} else {
const from = `${afterData.data.templates[afterData.data.templates.length - 1].template_id}`;
if (from && updatePosition)
updatePosition(from);
}
},
loadMorePrev: () => {
}
};
const templates = !afterData ? [] : (afterData || lastAfter).data.templates;
if (loadingAfter)
return { loading: true, data: { templates } };
if (
/*beforeData &&*/
afterData
) {
return __spreadValues({ ok: true, data: { templates } }, pagination);
}
return { loading: true };
}
function useTemplateDetails(templateId) {
const { templateFetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR7([`/private/templates/${templateId}`], templateFetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data) {
return data;
}
if (error2)
return error2.cause;
return { loading: true };
}
// src/paths/instance/templates/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
// src/hooks/otp.ts
init_hooks_module();
var useSWR8 = useSWR;
function useOtpDeviceAPI() {
const mutateAll = useMatchMutate();
const { request } = useBackendInstanceRequest();
const createOtpDevice = (data) => __async(this, null, function* () {
const res = yield request(`/private/otp-devices`, {
method: "POST",
data
});
yield mutateAll(/.*private\/otp-devices.*/);
return res;
});
const updateOtpDevice = (deviceId, data) => __async(this, null, function* () {
const res = yield request(`/private/otp-devices/${deviceId}`, {
method: "PATCH",
data
});
yield mutateAll(/.*private\/otp-devices.*/);
return res;
});
const deleteOtpDevice = (deviceId) => __async(this, null, function* () {
const res = yield request(`/private/otp-devices/${deviceId}`, {
method: "DELETE"
});
yield mutateAll(/.*private\/otp-devices.*/);
return res;
});
return {
createOtpDevice,
updateOtpDevice,
deleteOtpDevice
};
}
function useInstanceOtpDevices(args, updatePosition) {
const { fetcher } = useBackendInstanceRequest();
const [pageAfter, setPageAfter] = p3(1);
const totalAfter = pageAfter * PAGE_SIZE;
const {
data: afterData,
error: afterError,
isValidating: loadingAfter
} = useSWR8([`/private/otp-devices`], fetcher);
const [lastAfter, setLastAfter] = p3({ loading: true });
h2(() => {
if (afterData)
setLastAfter(afterData);
}, [
afterData
/*, beforeData*/
]);
if (afterError)
return afterError.cause;
const isReachingEnd = afterData && afterData.data.otp_devices.length < totalAfter;
const isReachingStart = false;
const pagination = {
isReachingEnd,
isReachingStart,
loadMore: () => {
if (!afterData || isReachingEnd)
return;
if (afterData.data.otp_devices.length < MAX_RESULT_SIZE) {
setPageAfter(pageAfter + 1);
} else {
const from = `${afterData.data.otp_devices[afterData.data.otp_devices.length - 1].otp_device_id}`;
if (from && updatePosition)
updatePosition(from);
}
},
loadMorePrev: () => {
}
};
const otp_devices = !afterData ? [] : (afterData || lastAfter).data.otp_devices;
if (loadingAfter)
return { loading: true, data: { otp_devices } };
if (
/*beforeData &&*/
afterData
) {
return __spreadValues({ ok: true, data: { otp_devices } }, pagination);
}
return { loading: true };
}
function useOtpDeviceDetails(deviceId) {
const { fetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR8([`/private/otp-devices/${deviceId}`], fetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data) {
return data;
}
if (error2)
return error2.cause;
return { loading: true };
}
// src/paths/instance/templates/create/CreatePage.tsx
function CreatePage6({ onCreate, onBack }) {
var _a, _b, _c, _d;
const { i18n: i18n2 } = useTranslationContext();
const { url: backendURL } = useBackendContext();
const devices = useInstanceOtpDevices();
const [state, setState] = p3({
template_contract: {
minimum_age: 0,
pay_duration: {
d_us: 1e3 * 1e3 * 60 * 30
//30 min
}
}
});
const parsedPrice = !((_a = state.template_contract) == null ? void 0 : _a.amount) ? void 0 : Amounts.parse((_b = state.template_contract) == null ? void 0 : _b.amount);
const errors2 = {
template_id: !state.template_id ? i18n2.str`should not be empty` : !/[a-zA-Z0-9]*/.test(state.template_id) ? i18n2.str`no valid. only characters and numbers` : void 0,
template_description: !state.template_description ? i18n2.str`should not be empty` : void 0,
template_contract: !state.template_contract ? void 0 : undefinedIfEmpty({
amount: !((_c = state.template_contract) == null ? void 0 : _c.amount) ? void 0 : !parsedPrice ? i18n2.str`not valid` : Amounts.isZero(parsedPrice) ? i18n2.str`must be greater than 0` : void 0,
minimum_age: state.template_contract.minimum_age < 0 ? i18n2.str`should be greater that 0` : void 0,
pay_duration: !state.template_contract.pay_duration ? i18n2.str`can't be empty` : state.template_contract.pay_duration.d_us === "forever" ? void 0 : state.template_contract.pay_duration.d_us < 1e3 * 1e3 ? i18n2.str`to short` : void 0
})
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
return onCreate(state);
};
const deviceList = !devices.ok ? [] : devices.data.otp_devices;
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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
InputWithAddon,
{
name: "template_id",
help: `${backendURL}/templates/${(_d = state.template_id) != null ? _d : ""}`,
label: i18n2.str`Identifier`,
tooltip: i18n2.str`Name of the template in URLs.`
}
),
/* @__PURE__ */ h(
Input,
{
name: "template_description",
label: i18n2.str`Description`,
help: "",
tooltip: i18n2.str`Describe what this template stands for`
}
),
/* @__PURE__ */ h(
Input,
{
name: "template_contract.summary",
inputType: "multiline",
label: i18n2.str`Fixed summary`,
tooltip: i18n2.str`If specified, this template will create order with the same summary`
}
),
/* @__PURE__ */ h(
InputCurrency,
{
name: "template_contract.amount",
label: i18n2.str`Fixed price`,
tooltip: i18n2.str`If specified, this template will create order with the same price`
}
),
/* @__PURE__ */ h(
InputNumber2,
{
name: "template_contract.minimum_age",
label: i18n2.str`Minimum age`,
help: "",
tooltip: i18n2.str`Is this contract restricted to some age?`
}
),
/* @__PURE__ */ h(
InputDuration,
{
name: "template_contract.pay_duration",
label: i18n2.str`Payment timeout`,
help: "",
tooltip: i18n2.str`How much time has the customer to complete the payment once the order was created.`
}
),
/* @__PURE__ */ h(
Input,
{
name: "otp_id",
label: i18n2.str`OTP device`,
readonly: true,
tooltip: i18n2.str`Use to verify transaction in offline mode.`
}
),
/* @__PURE__ */ h(
InputSearchOnList,
{
label: i18n2.str`Search device`,
onChange: (p4) => setState((v3) => __spreadProps(__spreadValues({}, v3), { otp_id: p4 == null ? void 0 : p4.id })),
list: deviceList.map((e4) => ({
description: e4.device_description,
id: e4.otp_device_id
}))
}
)
), /* @__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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/templates/create/index.tsx
function CreateTransfer({ onConfirm, onBack }) {
const { createTemplate } = useTemplateAPI();
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
CreatePage6,
{
onBack,
onCreate: (request) => {
return createTemplate(request).then(() => onConfirm()).catch((error2) => {
setNotif({
message: i18n2.str`could not inform template`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/templates/use/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/templates/use/UsePage.tsx
init_preact_module();
init_hooks_module();
function UsePage({ id, template, onCreateOrder, onBack }) {
const { i18n: i18n2 } = useTranslationContext();
const [state, setState] = p3({
amount: template.template_contract.amount,
summary: template.template_contract.summary
});
const errors2 = {
amount: !template.template_contract.amount && !state.amount ? i18n2.str`Amount is required` : void 0,
summary: !template.template_contract.summary && !state.summary ? i18n2.str`Order summary is required` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
if (template.template_contract.amount) {
delete state.amount;
}
if (template.template_contract.summary) {
delete state.summary;
}
return onCreateOrder(state);
};
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, "New order for template"), ":", " ", /* @__PURE__ */ h("b", null, id)))))))), /* @__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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
InputCurrency,
{
name: "amount",
label: i18n2.str`Amount`,
readonly: !!template.template_contract.amount,
tooltip: i18n2.str`Amount of the order`
}
),
/* @__PURE__ */ h(
Input,
{
name: "summary",
inputType: "multiline",
label: i18n2.str`Order summary`,
readonly: !!template.template_contract.summary,
tooltip: i18n2.str`Title of the order to be shown to the customer`
}
)
), /* @__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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/templates/use/index.tsx
function TemplateUsePage({
tid,
onOrderCreated,
onBack,
onLoadError,
onNotFound,
onUnauthorized
}) {
const { createOrderFromTemplate } = useTemplateAPI();
const result = useTemplateDetails(tid);
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
UsePage,
{
template: result.data,
id: tid,
onBack,
onCreateOrder: (request) => {
return createOrderFromTemplate(tid, request).then((res) => onOrderCreated(res.data.order_id)).catch((error2) => {
setNotif({
message: i18n2.str`could not create order from template`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/templates/qr/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/templates/qr/QrPage.tsx
init_preact_module();
init_hooks_module();
function QrPage({ contract, id: templateId, onBack }) {
var _a;
const { i18n: i18n2 } = useTranslationContext();
const { url: backendURL } = useBackendContext();
const { id: instanceId } = useInstanceContext();
const config = useConfigContext();
const [state, setState] = p3({
amount: contract.amount,
summary: contract.summary
});
const errors2 = {};
const fixedAmount = !!contract.amount;
const fixedSummary = !!contract.summary;
const templateParams = {};
if (!fixedAmount) {
if (state.amount) {
templateParams.amount = state.amount;
} else {
templateParams.amount = config.currency;
}
}
if (!fixedSummary) {
templateParams.summary = (_a = state.summary) != null ? _a : "";
}
const merchantBaseUrl = new URL(backendURL).href;
const payTemplateUri = stringifyPayTemplateUri({
merchantBaseUrl,
templateId,
templateParams
});
const issuer = encodeURIComponent(
`${new URL(backendURL).host}/${instanceId}`
);
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("p", { class: "is-size-5 mt-5 mb-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "Here you can specify a default value for fields that are not fixed. Default values can be edited by the customer before the payment.")), /* @__PURE__ */ h("p", null), /* @__PURE__ */ h(
FormProvider,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
InputCurrency,
{
name: "amount",
label: fixedAmount ? i18n2.str`Fixed amount` : i18n2.str`Default amount`,
readonly: fixedAmount,
tooltip: i18n2.str`Amount of the order`
}
),
/* @__PURE__ */ h(
Input,
{
name: "summary",
inputType: "multiline",
readonly: fixedSummary,
label: fixedSummary ? i18n2.str`Fixed summary` : i18n2.str`Default summary`,
tooltip: i18n2.str`Title of the order to be shown to the customer`
}
)
), /* @__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(
"button",
{
class: "button is-info",
onClick: () => saveAsPDF(templateId)
},
/* @__PURE__ */ h(i18n2.Translate, null, "Print")
))), /* @__PURE__ */ h("div", { class: "column" }))), /* @__PURE__ */ h("section", { id: "printThis" }, /* @__PURE__ */ h(QR, { text: payTemplateUri }), /* @__PURE__ */ h("pre", { style: { textAlign: "center" } }, /* @__PURE__ */ h("a", { href: payTemplateUri }, payTemplateUri))));
}
function saveAsPDF(name) {
const printWindow = window.open("", "", "height=400,width=800");
if (!printWindow)
return;
const divContents = document.getElementById("printThis");
if (!divContents)
return;
printWindow.document.write(
`Order template for ${name} ");
printWindow.document.close();
printWindow.document.body.appendChild(divContents.cloneNode(true));
printWindow.addEventListener("load", () => {
printWindow.print();
printWindow.close();
});
}
// src/paths/instance/templates/qr/index.tsx
function TemplateQrPage({
tid,
onBack,
onLoadError,
onNotFound,
onUnauthorized
}) {
const result = useTemplateDetails(tid);
const [notif, setNotif] = p3(void 0);
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(QrPage, { contract: result.data.template_contract, id: tid, onBack }));
}
// src/paths/instance/templates/list/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/templates/list/ListPage.tsx
init_preact_module();
// src/paths/instance/templates/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable6({
templates,
onCreate,
onDelete,
onSelect,
onQR,
onNewOrder,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
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",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`add new templates`
},
/* @__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" }, templates.length > 0 ? /* @__PURE__ */ h(
Table7,
{
instances: templates,
onDelete,
onSelect,
onNewOrder,
onQR,
rowSelection,
rowSelectionHandler,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}
) : /* @__PURE__ */ h(EmptyTable8, null)))));
}
function Table7({
instances,
onLoadMoreAfter,
onDelete,
onNewOrder,
onQR,
onSelect,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "table-container" }, onLoadMoreBefore && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
"data-tooltip": i18n2.str`load more templates before the first one`,
disabled: !hasMoreBefore,
onClick: onLoadMoreBefore
},
/* @__PURE__ */ h(i18n2.Translate, null, "load newer templates")
), /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "ID")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Description")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
return /* @__PURE__ */ h("tr", { key: i4.template_id }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.template_id
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.template_description
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-danger is-small has-tooltip-left",
"data-tooltip": i18n2.str`delete selected templates from the database`,
onClick: () => onDelete(i4)
},
"Delete"
), /* @__PURE__ */ h(
"button",
{
class: "button is-info is-small has-tooltip-left",
"data-tooltip": i18n2.str`use template to create new order`,
onClick: () => onNewOrder(i4)
},
"New order"
), /* @__PURE__ */ h(
"button",
{
class: "button is-info is-small has-tooltip-left",
"data-tooltip": i18n2.str`create qr code for the template`,
onClick: () => onQR(i4)
},
"QR"
))));
}))), onLoadMoreAfter && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
"data-tooltip": i18n2.str`load more templates after the last one`,
disabled: !hasMoreAfter,
onClick: onLoadMoreAfter
},
/* @__PURE__ */ h(i18n2.Translate, null, "load older templates")
));
}
function EmptyTable8() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "There is no templates yet, add more pressing the + sign")));
}
// src/paths/instance/templates/list/ListPage.tsx
function ListPage4({
templates,
onCreate,
onDelete,
onSelect,
onNewOrder,
onQR,
onLoadMoreBefore,
onLoadMoreAfter
}) {
const form = { payto_uri: "" };
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(
CardTable6,
{
templates: templates.map((o3) => __spreadProps(__spreadValues({}, o3), {
id: String(o3.template_id)
})),
onQR,
onCreate,
onDelete,
onSelect,
onNewOrder,
onLoadMoreBefore,
hasMoreBefore: !onLoadMoreBefore,
onLoadMoreAfter,
hasMoreAfter: !onLoadMoreAfter
}
));
}
// src/paths/instance/templates/list/index.tsx
function ListTemplates({
onUnauthorized,
onLoadError,
onCreate,
onQR,
onSelect,
onNewOrder,
onNotFound
}) {
const [position, setPosition] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const [notif, setNotif] = p3(void 0);
const { deleteTemplate } = useTemplateAPI();
const result = useInstanceTemplates({ position }, (id) => setPosition(id));
const [deleting, setDeleting] = p3(null);
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
ListPage4,
{
templates: result.data.templates,
onLoadMoreBefore: result.isReachingStart ? result.loadMorePrev : void 0,
onLoadMoreAfter: result.isReachingEnd ? result.loadMore : void 0,
onCreate,
onSelect: (e4) => {
onSelect(e4.template_id);
},
onNewOrder: (e4) => {
onNewOrder(e4.template_id);
},
onQR: (e4) => {
onQR(e4.template_id);
},
onDelete: (e4) => {
setDeleting(e4);
}
}
), deleting && /* @__PURE__ */ h(
ConfirmModal,
{
label: `Delete template`,
description: `Delete the template "${deleting.template_description}"`,
danger: true,
active: true,
onCancel: () => setDeleting(null),
onConfirm: () => __async(this, null, function* () {
try {
yield deleteTemplate(deleting.template_id);
setNotif({
message: i18n2.str`Template "${deleting.template_description}" (ID: ${deleting.template_id}) has been deleted`,
type: "SUCCESS"
});
} catch (error2) {
setNotif({
message: i18n2.str`Failed to delete template`,
type: "ERROR",
description: error2 instanceof Error ? error2.message : void 0
});
}
setDeleting(null);
})
},
/* @__PURE__ */ h("p", null, "If you delete the template ", /* @__PURE__ */ h("b", null, '"', deleting.template_description, '"'), " (ID:", " ", /* @__PURE__ */ h("b", null, deleting.template_id), ") you may loose information"),
/* @__PURE__ */ h("p", { class: "warning" }, "Deleting an template ", /* @__PURE__ */ h("b", null, "cannot be undone"), ".")
));
}
// src/paths/instance/templates/update/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/templates/update/UpdatePage.tsx
init_preact_module();
init_hooks_module();
function UpdatePage3({ template, onUpdate, onBack }) {
var _a, _b, _c;
const { i18n: i18n2 } = useTranslationContext();
const { url: backendURL } = useBackendContext();
const [state, setState] = p3(template);
const parsedPrice = !((_a = state.template_contract) == null ? void 0 : _a.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,
template_contract: !state.template_contract ? void 0 : undefinedIfEmpty({
amount: !((_c = state.template_contract) == null ? void 0 : _c.amount) ? void 0 : !parsedPrice ? i18n2.str`not valid` : Amounts.isZero(parsedPrice) ? i18n2.str`must be greater than 0` : void 0,
minimum_age: state.template_contract.minimum_age < 0 ? i18n2.str`should be greater that 0` : void 0,
pay_duration: !state.template_contract.pay_duration ? i18n2.str`can't be empty` : state.template_contract.pay_duration.d_us === "forever" ? void 0 : state.template_contract.pay_duration.d_us < 1e3 * 1e3 ? i18n2.str`to short` : void 0
})
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
return onUpdate(state);
};
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" }, backendURL, "/templates/", 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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
InputWithAddon,
{
name: "id",
addonBefore: `templates/`,
readonly: true,
label: i18n2.str`Identifier`,
tooltip: i18n2.str`Name of the template in URLs.`
}
),
/* @__PURE__ */ h(
Input,
{
name: "template_description",
label: i18n2.str`Description`,
help: "",
tooltip: i18n2.str`Describe what this template stands for`
}
),
/* @__PURE__ */ h(
Input,
{
name: "template_contract.summary",
inputType: "multiline",
label: i18n2.str`Fixed summary`,
tooltip: i18n2.str`If specified, this template will create order with the same summary`
}
),
/* @__PURE__ */ h(
InputCurrency,
{
name: "template_contract.amount",
label: i18n2.str`Fixed price`,
tooltip: i18n2.str`If specified, this template will create order with the same price`
}
),
/* @__PURE__ */ h(
InputNumber2,
{
name: "template_contract.minimum_age",
label: i18n2.str`Minimum age`,
help: "",
tooltip: i18n2.str`Is this contract restricted to some age?`
}
),
/* @__PURE__ */ h(
InputDuration,
{
name: "template_contract.pay_duration",
label: i18n2.str`Payment timeout`,
help: "",
tooltip: i18n2.str`How much time has the customer to complete the payment once the order was created.`
}
)
), /* @__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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
)))))));
}
// src/paths/instance/templates/update/index.tsx
function UpdateTemplate({
tid,
onConfirm,
onBack,
onUnauthorized,
onNotFound,
onLoadError
}) {
const { updateTemplate } = useTemplateAPI();
const result = useTemplateDetails(tid);
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
UpdatePage3,
{
template: __spreadProps(__spreadValues({}, result.data), { id: tid }),
onBack,
onUpdate: (data) => {
return updateTemplate(tid, data).then(onConfirm).catch((error2) => {
setNotif({
message: i18n2.str`could not update template`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/webhooks/create/index.tsx
init_preact_module();
init_hooks_module();
// src/hooks/webhooks.ts
init_hooks_module();
var useSWR9 = useSWR;
function useWebhookAPI() {
const mutateAll = useMatchMutate();
const { request } = useBackendInstanceRequest();
const createWebhook = (data) => __async(this, null, function* () {
const res = yield request(`/private/webhooks`, {
method: "POST",
data
});
yield mutateAll(/.*private\/webhooks.*/);
return res;
});
const updateWebhook = (webhookId, data) => __async(this, null, function* () {
const res = yield request(`/private/webhooks/${webhookId}`, {
method: "PATCH",
data
});
yield mutateAll(/.*private\/webhooks.*/);
return res;
});
const deleteWebhook = (webhookId) => __async(this, null, function* () {
const res = yield request(`/private/webhooks/${webhookId}`, {
method: "DELETE"
});
yield mutateAll(/.*private\/webhooks.*/);
return res;
});
return { createWebhook, updateWebhook, deleteWebhook };
}
function useInstanceWebhooks(args, updatePosition) {
const { webhookFetcher } = useBackendInstanceRequest();
const [pageAfter, setPageAfter] = p3(1);
const totalAfter = pageAfter * PAGE_SIZE;
const {
data: afterData,
error: afterError,
isValidating: loadingAfter
} = useSWR9([`/private/webhooks`, args == null ? void 0 : args.position, -totalAfter], webhookFetcher);
const [lastAfter, setLastAfter] = p3({ loading: true });
h2(() => {
if (afterData)
setLastAfter(afterData);
}, [afterData]);
if (afterError)
return afterError.cause;
const isReachingEnd = afterData && afterData.data.webhooks.length < totalAfter;
const isReachingStart = false;
const pagination = {
isReachingEnd,
isReachingStart,
loadMore: () => {
if (!afterData || isReachingEnd)
return;
if (afterData.data.webhooks.length < MAX_RESULT_SIZE) {
setPageAfter(pageAfter + 1);
} else {
const from = `${afterData.data.webhooks[afterData.data.webhooks.length - 1].webhook_id}`;
if (from && updatePosition)
updatePosition(from);
}
},
loadMorePrev: () => {
return;
}
};
const webhooks = !afterData ? [] : (afterData || lastAfter).data.webhooks;
if (loadingAfter)
return { loading: true, data: { webhooks } };
if (afterData) {
return __spreadValues({ ok: true, data: { webhooks } }, pagination);
}
return { loading: true };
}
function useWebhookDetails(webhookId) {
const { webhookFetcher } = useBackendInstanceRequest();
const { data, error: error2, isValidating } = useSWR9([`/private/webhooks/${webhookId}`], webhookFetcher, {
refreshInterval: 0,
refreshWhenHidden: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenOffline: false
});
if (isValidating)
return { loading: true, data: data == null ? void 0 : data.data };
if (data)
return data;
if (error2)
return error2.cause;
return { loading: true };
}
// src/paths/instance/webhooks/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
var validMethod = ["GET", "POST", "PUT", "PATCH", "HEAD"];
function CreatePage7({ onCreate, onBack }) {
const { i18n: i18n2 } = useTranslationContext();
const [state, setState] = p3({});
const errors2 = {
webhook_id: !state.webhook_id ? i18n2.str`required` : void 0,
event_type: !state.event_type ? i18n2.str`required` : state.event_type !== "pay" && state.event_type !== "refund" ? i18n2.str`it should be "pay" or "refund"` : void 0,
http_method: !state.http_method ? i18n2.str`required` : !validMethod.includes(state.http_method) ? i18n2.str`should be one of '${validMethod.join(", ")}'` : void 0,
url: !state.url ? i18n2.str`required` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
return onCreate(state);
};
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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
Input,
{
name: "webhook_id",
label: i18n2.str`ID`,
tooltip: i18n2.str`Webhook ID to use`
}
),
/* @__PURE__ */ h(
InputSelector,
{
name: "event_type",
label: i18n2.str`Event`,
values: [
i18n2.str`Choose one...`,
i18n2.str`pay`,
i18n2.str`refund`
],
tooltip: i18n2.str`The event of the webhook: why the webhook is used`
}
),
/* @__PURE__ */ h(
InputSelector,
{
name: "http_method",
label: i18n2.str`Method`,
values: [
i18n2.str`Choose one...`,
i18n2.str`GET`,
i18n2.str`POST`,
i18n2.str`PUT`,
i18n2.str`PATCH`,
i18n2.str`HEAD`
],
tooltip: i18n2.str`Method used by the webhook`
}
),
/* @__PURE__ */ h(
Input,
{
name: "url",
label: i18n2.str`URL`,
tooltip: i18n2.str`URL of the webhook where the customer will be redirected`
}
),
/* @__PURE__ */ h(
Input,
{
name: "header_template",
label: i18n2.str`Header`,
inputType: "multiline",
tooltip: i18n2.str`Header template of the webhook`
}
),
/* @__PURE__ */ h(
Input,
{
name: "body_template",
inputType: "multiline",
label: i18n2.str`Body`,
tooltip: i18n2.str`Body template by the webhook`
}
)
), /* @__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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/webhooks/create/index.tsx
function CreateWebhook({ onConfirm, onBack }) {
const { createWebhook } = useWebhookAPI();
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
CreatePage7,
{
onBack,
onCreate: (request) => {
return createWebhook(request).then(() => onConfirm()).catch((error2) => {
setNotif({
message: i18n2.str`could not inform template`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/webhooks/list/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/webhooks/list/ListPage.tsx
init_preact_module();
// src/paths/instance/webhooks/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable7({
webhooks,
onCreate,
onDelete,
onSelect,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
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",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`add new webhooks`
},
/* @__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" }, webhooks.length > 0 ? /* @__PURE__ */ h(
Table8,
{
instances: webhooks,
onDelete,
onSelect,
rowSelection,
rowSelectionHandler,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}
) : /* @__PURE__ */ h(EmptyTable9, null)))));
}
function Table8({
instances,
onLoadMoreAfter,
onDelete,
onSelect,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "table-container" }, onLoadMoreBefore && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
"data-tooltip": i18n2.str`load more webhooks before the first one`,
disabled: !hasMoreBefore,
onClick: onLoadMoreBefore
},
/* @__PURE__ */ h(i18n2.Translate, null, "load newer webhooks")
), /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "ID")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Event type")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
return /* @__PURE__ */ h("tr", { key: i4.webhook_id }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.webhook_id
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.event_type
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-danger is-small has-tooltip-left",
"data-tooltip": i18n2.str`delete selected webhook from the database`,
onClick: () => onDelete(i4)
},
"Delete"
))));
}))), onLoadMoreAfter && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
"data-tooltip": i18n2.str`load more webhooks after the last one`,
disabled: !hasMoreAfter,
onClick: onLoadMoreAfter
},
/* @__PURE__ */ h(i18n2.Translate, null, "load older webhooks")
));
}
function EmptyTable9() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "There is no webhooks yet, add more pressing the + sign")));
}
// src/paths/instance/webhooks/list/ListPage.tsx
function ListPage5({
webhooks,
onCreate,
onDelete,
onSelect,
onLoadMoreBefore,
onLoadMoreAfter
}) {
const form = { payto_uri: "" };
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(
CardTable7,
{
webhooks: webhooks.map((o3) => __spreadProps(__spreadValues({}, o3), {
id: String(o3.webhook_id)
})),
onCreate,
onDelete,
onSelect,
onLoadMoreBefore,
hasMoreBefore: !onLoadMoreBefore,
onLoadMoreAfter,
hasMoreAfter: !onLoadMoreAfter
}
));
}
// src/paths/instance/webhooks/list/index.tsx
function ListWebhooks({
onUnauthorized,
onLoadError,
onCreate,
onSelect,
onNotFound
}) {
const [position, setPosition] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const [notif, setNotif] = p3(void 0);
const { deleteWebhook } = useWebhookAPI();
const result = useInstanceWebhooks({ position }, (id) => setPosition(id));
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
ListPage5,
{
webhooks: result.data.webhooks,
onLoadMoreBefore: result.isReachingStart ? result.loadMorePrev : void 0,
onLoadMoreAfter: result.isReachingEnd ? result.loadMore : void 0,
onCreate,
onSelect: (e4) => {
onSelect(e4.webhook_id);
},
onDelete: (e4) => deleteWebhook(e4.webhook_id).then(
() => setNotif({
message: i18n2.str`webhook delete successfully`,
type: "SUCCESS"
})
).catch(
(error2) => setNotif({
message: i18n2.str`could not delete the webhook`,
type: "ERROR",
description: error2.message
})
)
}
));
}
// src/paths/instance/webhooks/update/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/webhooks/update/UpdatePage.tsx
init_preact_module();
init_hooks_module();
var validMethod2 = ["GET", "POST", "PUT", "PATCH", "HEAD"];
function UpdatePage4({ webhook, onUpdate, onBack }) {
const { i18n: i18n2 } = useTranslationContext();
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,
url: !state.url ? i18n2.str`required` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
return onUpdate(state);
};
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" }, "Webhook: ", /* @__PURE__ */ h("b", null, webhook.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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
Input,
{
name: "event_type",
label: i18n2.str`Event`,
tooltip: i18n2.str`The event of the webhook: why the webhook is used`
}
),
/* @__PURE__ */ h(
Input,
{
name: "http_method",
label: i18n2.str`Method`,
tooltip: i18n2.str`Method used by the webhook`
}
),
/* @__PURE__ */ h(
Input,
{
name: "url",
label: i18n2.str`URL`,
tooltip: i18n2.str`URL of the webhook where the customer will be redirected`
}
),
/* @__PURE__ */ h(
Input,
{
name: "header_template",
label: i18n2.str`Header`,
inputType: "multiline",
tooltip: i18n2.str`Header template of the webhook`
}
),
/* @__PURE__ */ h(
Input,
{
name: "body_template",
inputType: "multiline",
label: i18n2.str`Body`,
tooltip: i18n2.str`Body template by the webhook`
}
)
), /* @__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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
)))))));
}
// src/paths/instance/webhooks/update/index.tsx
function UpdateWebhook({
tid,
onConfirm,
onBack,
onUnauthorized,
onNotFound,
onLoadError
}) {
const { updateWebhook } = useWebhookAPI();
const result = useWebhookDetails(tid);
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
UpdatePage4,
{
webhook: __spreadProps(__spreadValues({}, result.data), { id: tid }),
onBack,
onUpdate: (data) => {
return updateWebhook(tid, data).then(onConfirm).catch((error2) => {
setNotif({
message: i18n2.str`could not update template`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/validators/create/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/validators/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
// src/utils/crypto.ts
var encTable2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
function encodeBase32(data) {
const dataBytes = new Uint8Array(data);
let sb = "";
const size = data.byteLength;
let bitBuf = 0;
let numBits = 0;
let pos = 0;
while (pos < size || numBits > 0) {
if (pos < size && numBits < 5) {
const d5 = dataBytes[pos++];
bitBuf = bitBuf << 8 | d5;
numBits += 8;
}
if (numBits < 5) {
bitBuf = bitBuf << 5 - numBits;
numBits = 5;
}
const v3 = bitBuf >>> numBits - 5 & 31;
sb += encTable2[v3];
numBits -= 5;
}
return sb;
}
function isBase32RFC3548Charset(s5) {
for (let idx = 0; idx < s5.length; idx++) {
const c4 = s5.charAt(idx);
if (encTable2.indexOf(c4) === -1)
return false;
}
return true;
}
function randomBase32Key() {
var buf = new Uint8Array(20);
window.crypto.getRandomValues(buf);
return encodeBase32(buf);
}
// src/paths/instance/validators/create/CreatePage.tsx
var algorithms = [0, 1, 2];
var algorithmsNames = ["off", "30s 8d TOTP-SHA1", "30s 8d eTOTP-SHA1"];
function CreatePage8({ onCreate, onBack }) {
const { i18n: i18n2 } = useTranslationContext();
const backend = useBackendContext();
const [state, setState] = p3({});
const [showKey, setShowKey] = p3(false);
const errors2 = {
otp_device_id: !state.otp_device_id ? i18n2.str`required` : !/[a-zA-Z0-9]*/.test(state.otp_device_id) ? i18n2.str`no valid. only characters and numbers` : void 0,
otp_algorithm: !state.otp_algorithm ? i18n2.str`required` : void 0,
otp_key: !state.otp_key ? i18n2.str`required` : !isBase32RFC3548Charset(state.otp_key) ? i18n2.str`just letters and numbers from 2 to 7` : state.otp_key.length !== 32 ? i18n2.str`size of the key should be 32` : void 0,
otp_description: !state.otp_description ? i18n2.str`required` : !/[a-zA-Z0-9]*/.test(state.otp_description) ? i18n2.str`no valid. only characters and numbers` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
return onCreate(state);
};
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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
Input,
{
name: "otp_device_id",
label: i18n2.str`ID`,
tooltip: i18n2.str`Internal id on the system`
}
),
/* @__PURE__ */ h(
Input,
{
name: "otp_description",
label: i18n2.str`Descripiton`,
tooltip: i18n2.str`Useful to identify the device physically`
}
),
/* @__PURE__ */ h(
InputSelector,
{
name: "otp_algorithm",
label: i18n2.str`Verification algorithm`,
tooltip: i18n2.str`Algorithm to use to verify transaction in offline mode`,
values: algorithms,
toStr: (v3) => algorithmsNames[v3],
fromStr: (v3) => Number(v3)
}
),
state.otp_algorithm && state.otp_algorithm > 0 ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
InputWithAddon,
{
name: "otp_key",
label: i18n2.str`Device key`,
inputType: showKey ? "text" : "password",
help: "Be sure to be very hard to guess or use the random generator",
tooltip: i18n2.str`Your device need to have exactly the same value`,
fromStr: (v3) => v3.toUpperCase(),
addonAfter: /* @__PURE__ */ h("span", { class: "icon" }, showKey ? /* @__PURE__ */ h("i", { class: "mdi mdi-eye" }) : /* @__PURE__ */ h("i", { class: "mdi mdi-eye-off" })),
side: /* @__PURE__ */ h("span", { style: { display: "flex" } }, /* @__PURE__ */ h(
"button",
{
"data-tooltip": i18n2.str`generate random secret key`,
class: "button is-info mr-3",
onClick: (e4) => {
setState((s5) => __spreadProps(__spreadValues({}, s5), { otp_key: randomBase32Key() }));
}
},
/* @__PURE__ */ h(i18n2.Translate, null, "random")
), /* @__PURE__ */ h(
"button",
{
"data-tooltip": showKey ? i18n2.str`show secret key` : i18n2.str`hide secret key`,
class: "button is-info mr-3",
onClick: (e4) => {
setShowKey(!showKey);
}
},
showKey ? /* @__PURE__ */ h(i18n2.Translate, null, "hide") : /* @__PURE__ */ h(i18n2.Translate, null, "show")
))
}
)) : 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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/validators/create/CreatedSuccessfully.tsx
init_preact_module();
function CreatedSuccessfully4({
entity,
onConfirm
}) {
const { i18n: i18n2 } = useTranslationContext();
const { url: backendURL } = useBackendContext();
const { id: instanceId } = useInstanceContext();
const issuer = new URL(backendURL).hostname;
const qrText = `otpauth://totp/${instanceId}/${entity.otp_device_id}?issuer=${issuer}&algorithm=SHA1&digits=8&period=30&secret=${entity.otp_key}`;
const qrTextSafe = `otpauth://totp/${instanceId}/${entity.otp_device_id}?issuer=${issuer}&algorithm=SHA1&digits=8&period=30&secret=${entity.otp_key.substring(0, 6)}...`;
return /* @__PURE__ */ h(CreatedSuccessfully, { onConfirm }, /* @__PURE__ */ h("p", { class: "is-size-5" }, /* @__PURE__ */ h(i18n2.Translate, null, "You can scan the next QR code with your device or safe the key before continue.")), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, "ID")), /* @__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.otp_device_id
}
))))), /* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Description"))), /* @__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.otp_description
}
))))), /* @__PURE__ */ h(
QR,
{
text: qrText
}
), /* @__PURE__ */ h(
"div",
{
style: {
color: "grey",
fontSize: "small",
width: 200,
textAlign: "center",
margin: "auto",
wordBreak: "break-all"
}
},
qrTextSafe
));
}
// src/paths/instance/validators/create/index.tsx
function CreateValidator2({ onConfirm, onBack }) {
const { createOtpDevice } = useOtpDeviceAPI();
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const [created, setCreated] = p3(null);
if (created) {
return /* @__PURE__ */ h(CreatedSuccessfully4, { entity: created, onConfirm });
}
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
CreatePage8,
{
onBack,
onCreate: (request) => {
return createOtpDevice(request).then((d5) => {
setCreated(request);
}).catch((error2) => {
setNotif({
message: i18n2.str`could not create device`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/validators/list/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/validators/list/ListPage.tsx
init_preact_module();
// src/paths/instance/validators/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable8({
devices,
onCreate,
onDelete,
onSelect,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
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, "OTP Devices")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`add new devices`
},
/* @__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" }, devices.length > 0 ? /* @__PURE__ */ h(
Table9,
{
instances: devices,
onDelete,
onSelect,
rowSelection,
rowSelectionHandler,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}
) : /* @__PURE__ */ h(EmptyTable10, null)))));
}
function Table9({
instances,
onLoadMoreAfter,
onDelete,
onSelect,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "table-container" }, onLoadMoreBefore && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
"data-tooltip": i18n2.str`load more devices before the first one`,
disabled: !hasMoreBefore,
onClick: onLoadMoreBefore
},
/* @__PURE__ */ h(i18n2.Translate, null, "load newer devices")
), /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "ID")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Description")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
return /* @__PURE__ */ h("tr", { key: i4.otp_device_id }, /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.otp_device_id
), /* @__PURE__ */ h(
"td",
{
onClick: () => onSelect(i4),
style: { cursor: "pointer" }
},
i4.otp_device_id
), /* @__PURE__ */ h("td", { class: "is-actions-cell right-sticky" }, /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
"button",
{
class: "button is-danger is-small has-tooltip-left",
"data-tooltip": i18n2.str`delete selected devices from the database`,
onClick: () => onDelete(i4)
},
"Delete"
))));
}))), onLoadMoreAfter && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
"data-tooltip": i18n2.str`load more devices after the last one`,
disabled: !hasMoreAfter,
onClick: onLoadMoreAfter
},
/* @__PURE__ */ h(i18n2.Translate, null, "load older devices")
));
}
function EmptyTable10() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "There is no devices yet, add more pressing the + sign")));
}
// src/paths/instance/validators/list/ListPage.tsx
function ListPage6({
devices,
onCreate,
onDelete,
onSelect,
onLoadMoreBefore,
onLoadMoreAfter
}) {
const form = { payto_uri: "" };
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(
CardTable8,
{
devices: devices.map((o3) => __spreadProps(__spreadValues({}, o3), {
id: String(o3.otp_device_id)
})),
onCreate,
onDelete,
onSelect,
onLoadMoreBefore,
hasMoreBefore: !onLoadMoreBefore,
onLoadMoreAfter,
hasMoreAfter: !onLoadMoreAfter
}
));
}
// src/paths/instance/validators/list/index.tsx
function ListValidators2({
onUnauthorized,
onLoadError,
onCreate,
onSelect,
onNotFound
}) {
const [position, setPosition] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const [notif, setNotif] = p3(void 0);
const { deleteOtpDevice } = useOtpDeviceAPI();
const result = useInstanceOtpDevices({ position }, (id) => setPosition(id));
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
ListPage6,
{
devices: result.data.otp_devices,
onLoadMoreBefore: result.isReachingStart ? result.loadMorePrev : void 0,
onLoadMoreAfter: result.isReachingEnd ? result.loadMore : void 0,
onCreate,
onSelect: (e4) => {
onSelect(e4.otp_device_id);
},
onDelete: (e4) => deleteOtpDevice(e4.otp_device_id).then(
() => setNotif({
message: i18n2.str`validator delete successfully`,
type: "SUCCESS"
})
).catch(
(error2) => setNotif({
message: i18n2.str`could not delete the validator`,
type: "ERROR",
description: error2.message
})
)
}
));
}
// src/paths/instance/validators/update/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/validators/update/UpdatePage.tsx
init_preact_module();
init_hooks_module();
var algorithms2 = [0, 1, 2];
var algorithmsNames2 = ["off", "30s 8d TOTP-SHA1", "30s 8d eTOTP-SHA1"];
function UpdatePage5({ device, onUpdate, onBack }) {
const { i18n: i18n2 } = useTranslationContext();
const [state, setState] = p3(device);
const [showKey, setShowKey] = p3(false);
const errors2 = {};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
return onUpdate(state);
};
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" }, "Device: ", /* @__PURE__ */ h("b", null, device.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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
Input,
{
name: "otp_description",
label: i18n2.str`Description`,
tooltip: i18n2.str`dddd`
}
),
/* @__PURE__ */ h(
InputSelector,
{
name: "otp_algorithm",
label: i18n2.str`Verification algorithm`,
tooltip: i18n2.str`Algorithm to use to verify transaction in offline mode`,
values: algorithms2,
toStr: (v3) => algorithmsNames2[v3],
fromStr: (v3) => Number(v3)
}
),
state.otp_algorithm && state.otp_algorithm > 0 ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
InputWithAddon,
{
name: "otp_key",
label: i18n2.str`Device key`,
readonly: state.otp_key === void 0,
inputType: showKey ? "text" : "password",
help: state.otp_key === void 0 ? "Not modified" : "Be sure to be very hard to guess or use the random generator",
tooltip: i18n2.str`Your device need to have exactly the same value`,
fromStr: (v3) => v3.toUpperCase(),
addonAfter: /* @__PURE__ */ h("span", { class: "icon" }, showKey ? /* @__PURE__ */ h("i", { class: "mdi mdi-eye" }) : /* @__PURE__ */ h("i", { class: "mdi mdi-eye-off" })),
side: state.otp_key === void 0 ? /* @__PURE__ */ h(
"button",
{
onClick: (e4) => {
setState((s5) => __spreadProps(__spreadValues({}, s5), { otp_key: "" }));
},
class: "button"
},
"change key"
) : /* @__PURE__ */ h("span", { style: { display: "flex" } }, /* @__PURE__ */ h(
"button",
{
"data-tooltip": i18n2.str`generate random secret key`,
class: "button is-info mr-3",
onClick: (e4) => {
setState((s5) => __spreadProps(__spreadValues({}, s5), { otp_key: randomBase32Key() }));
}
},
/* @__PURE__ */ h(i18n2.Translate, null, "random")
), /* @__PURE__ */ h(
"button",
{
"data-tooltip": showKey ? i18n2.str`show secret key` : i18n2.str`hide secret key`,
class: "button is-info mr-3",
onClick: (e4) => {
setShowKey(!showKey);
}
},
showKey ? /* @__PURE__ */ h(i18n2.Translate, null, "hide") : /* @__PURE__ */ h(i18n2.Translate, null, "show")
))
}
)) : 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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
)))))));
}
// src/paths/instance/validators/update/index.tsx
function UpdateValidator2({
vid,
onConfirm,
onBack,
onUnauthorized,
onNotFound,
onLoadError
}) {
const { updateOtpDevice } = useOtpDeviceAPI();
const result = useOtpDeviceDetails(vid);
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
UpdatePage5,
{
device: {
id: vid,
otp_algorithm: result.data.otp_algorithm,
otp_description: result.data.device_description,
otp_key: void 0,
otp_ctr: result.data.otp_ctr
},
onBack,
onUpdate: (data) => {
return updateOtpDevice(vid, data).then(onConfirm).catch((error2) => {
setNotif({
message: i18n2.str`could not update template`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/transfers/create/index.tsx
init_preact_module();
init_hooks_module();
// src/hooks/transfer.ts
init_hooks_module();
var useSWR10 = useSWR;
function useTransferAPI() {
const mutateAll = useMatchMutate();
const { request } = useBackendInstanceRequest();
const informTransfer = (data) => __async(this, null, function* () {
const res = yield request(`/private/transfers`, {
method: "POST",
data
});
yield mutateAll(/.*private\/transfers.*/);
return res;
});
return { informTransfer };
}
function useInstanceTransfers(args, updatePosition) {
const { transferFetcher } = useBackendInstanceRequest();
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 {
data: beforeData,
error: beforeError,
isValidating: loadingBefore
} = useSWR10(
[
`/private/transfers`,
args == null ? void 0 : args.payto_uri,
args == null ? void 0 : args.verified,
args == null ? void 0 : args.position,
totalBefore
],
transferFetcher
);
const {
data: afterData,
error: afterError,
isValidating: loadingAfter
} = useSWR10(
[
`/private/transfers`,
args == null ? void 0 : args.payto_uri,
args == null ? void 0 : args.verified,
args == null ? void 0 : args.position,
-totalAfter
],
transferFetcher
);
const [lastBefore, setLastBefore] = p3({ loading: true });
const [lastAfter, setLastAfter] = p3({ loading: true });
h2(() => {
if (afterData)
setLastAfter(afterData);
if (beforeData)
setLastBefore(beforeData);
}, [afterData, beforeData]);
if (beforeError)
return beforeError.cause;
if (afterError)
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 = {
isReachingEnd,
isReachingStart,
loadMore: () => {
if (!afterData || isReachingEnd)
return;
if (afterData.data.transfers.length < MAX_RESULT_SIZE) {
setPageAfter(pageAfter + 1);
} else {
const from = `${afterData.data.transfers[afterData.data.transfers.length - 1].transfer_serial_id}`;
if (from && updatePosition)
updatePosition(from);
}
},
loadMorePrev: () => {
if (!beforeData || isReachingStart)
return;
if (beforeData.data.transfers.length < MAX_RESULT_SIZE) {
setPageBefore(pageBefore + 1);
} else if (beforeData) {
const from = `${beforeData.data.transfers[beforeData.data.transfers.length - 1].transfer_serial_id}`;
if (from && updatePosition)
updatePosition(from);
}
}
};
const transfers = !beforeData || !afterData ? [] : (beforeData || lastBefore).data.transfers.slice().reverse().concat((afterData || lastAfter).data.transfers);
if (loadingAfter || loadingBefore)
return { loading: true, data: { transfers } };
if (beforeData && afterData) {
return __spreadValues({ ok: true, data: { transfers } }, pagination);
}
return { loading: true };
}
// src/paths/instance/transfers/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
function CreatePage9({ accounts, onCreate, onBack }) {
const { i18n: i18n2 } = useTranslationContext();
const { currency } = useConfigContext();
const [state, setState] = p3({
wtid: "",
// payto_uri: ,
// exchange_url: 'http://exchange.taler:8081/',
credit_amount: ``
});
const errors2 = {
wtid: !state.wtid ? i18n2.str`cannot be empty` : !CROCKFORD_BASE32_REGEX.test(state.wtid) ? i18n2.str`check the id, does not look valid` : state.wtid.length !== 52 ? i18n2.str`should have 52 characters, current ${state.wtid.length}` : void 0,
payto_uri: !state.payto_uri ? i18n2.str`cannot be empty` : void 0,
credit_amount: !state.credit_amount ? i18n2.str`cannot be empty` : void 0,
exchange_url: !state.exchange_url ? i18n2.str`cannot be empty` : !URL_REGEX.test(state.exchange_url) ? i18n2.str`URL doesn't have the right format` : void 0
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submitForm = () => {
if (hasErrors)
return Promise.reject();
return onCreate(state);
};
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,
{
object: state,
valueHandler: setState,
errors: errors2
},
/* @__PURE__ */ h(
InputSelector,
{
name: "payto_uri",
label: i18n2.str`Credited bank account`,
values: accounts,
placeholder: i18n2.str`Select one account`,
tooltip: i18n2.str`Bank account of the merchant where the payment was received`
}
),
/* @__PURE__ */ h(
Input,
{
name: "wtid",
label: i18n2.str`Wire transfer ID`,
help: "",
tooltip: i18n2.str`unique identifier of the wire transfer used by the exchange, must be 52 characters long`
}
),
/* @__PURE__ */ h(
Input,
{
name: "exchange_url",
label: i18n2.str`Exchange URL`,
tooltip: i18n2.str`Base URL of the exchange that made the transfer, should have been in the wire transfer subject`,
help: "http://exchange.taler:8081/"
}
),
/* @__PURE__ */ h(
InputCurrency,
{
name: "credit_amount",
label: i18n2.str`Amount credited`,
tooltip: i18n2.str`Actual amount that was wired to the merchant's bank account`
}
)
), /* @__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,
{
disabled: hasErrors,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
onClick: submitForm
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/transfers/create/index.tsx
function CreateTransfer2({ onConfirm, onBack }) {
const { informTransfer } = useTransferAPI();
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
const instance = useInstanceBankAccounts();
const accounts = !instance.ok ? [] : instance.data.accounts.map((a5) => a5.payto_uri);
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
CreatePage9,
{
onBack,
accounts,
onCreate: (request) => {
return informTransfer(request).then(() => onConfirm()).catch((error2) => {
setNotif({
message: i18n2.str`could not inform transfer`,
type: "ERROR",
description: error2.message
});
});
}
}
));
}
// src/paths/instance/transfers/list/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/transfers/list/ListPage.tsx
init_preact_module();
// src/paths/instance/transfers/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable9({
transfers,
onCreate,
onDelete,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
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-arrow-left-right" })), /* @__PURE__ */ h(i18n2.Translate, null, "Transfers")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h(
"span",
{
class: "has-tooltip-left",
"data-tooltip": i18n2.str`add new transfer`
},
/* @__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" }, transfers.length > 0 ? /* @__PURE__ */ h(
Table10,
{
instances: transfers,
onDelete,
rowSelection,
rowSelectionHandler,
onLoadMoreAfter,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}
) : /* @__PURE__ */ h(EmptyTable11, null)))));
}
function Table10({
instances,
onLoadMoreAfter,
onDelete,
onLoadMoreBefore,
hasMoreAfter,
hasMoreBefore
}) {
const { i18n: i18n2 } = useTranslationContext();
const [settings] = useSettings();
return /* @__PURE__ */ h("div", { class: "table-container" }, onLoadMoreBefore && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
"data-tooltip": i18n2.str`load more transfers before the first one`,
disabled: !hasMoreBefore,
onClick: onLoadMoreBefore
},
/* @__PURE__ */ h(i18n2.Translate, null, "load newer transfers")
), /* @__PURE__ */ h("table", { class: "table is-fullwidth is-striped is-hoverable is-fullwidth" }, /* @__PURE__ */ h("thead", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "ID")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Credit")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Address")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Exchange URL")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Confirmed")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Verified")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Executed at")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
return /* @__PURE__ */ h("tr", { key: i4.id }, /* @__PURE__ */ h("td", null, i4.id), /* @__PURE__ */ h("td", null, i4.credit_amount), /* @__PURE__ */ h("td", null, i4.payto_uri), /* @__PURE__ */ h("td", null, i4.exchange_url), /* @__PURE__ */ h("td", null, i4.confirmed ? i18n2.str`yes` : i18n2.str`no`), /* @__PURE__ */ h("td", null, i4.verified ? i18n2.str`yes` : i18n2.str`no`), /* @__PURE__ */ h("td", null, i4.execution_time ? i4.execution_time.t_s == "never" ? i18n2.str`never` : format(
i4.execution_time.t_s * 1e3,
datetimeFormatForSettings(settings)
) : i18n2.str`unknown`), /* @__PURE__ */ h("td", null, i4.verified === void 0 ? /* @__PURE__ */ h(
"button",
{
class: "button is-danger is-small has-tooltip-left",
"data-tooltip": i18n2.str`delete selected transfer from the database`,
onClick: () => onDelete(i4)
},
"Delete"
) : void 0));
}))), onLoadMoreAfter && /* @__PURE__ */ h(
"button",
{
class: "button is-fullwidth",
"data-tooltip": i18n2.str`load more transfer after the last one`,
disabled: !hasMoreAfter,
onClick: onLoadMoreAfter
},
/* @__PURE__ */ h(i18n2.Translate, null, "load older transfers")
));
}
function EmptyTable11() {
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("div", { class: "content has-text-grey has-text-centered" }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h("span", { class: "icon is-large" }, /* @__PURE__ */ h("i", { class: "mdi mdi-emoticon-sad mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "There is no transfer yet, add more pressing the + sign")));
}
// src/paths/instance/transfers/list/ListPage.tsx
function ListPage7({
payTo,
onChangePayTo,
transfers,
onCreate,
onDelete,
accounts,
onLoadMoreBefore,
onLoadMoreAfter,
isAllTransfers,
isNonVerifiedTransfers,
isVerifiedTransfers,
onShowAll,
onShowUnverified,
onShowVerified
}) {
const form = { payto_uri: payTo };
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-10" }, /* @__PURE__ */ h(
FormProvider,
{
object: form,
valueHandler: (updater) => onChangePayTo(updater(form).payto_uri)
},
/* @__PURE__ */ h(
InputSelector,
{
name: "payto_uri",
label: i18n2.str`Address`,
values: accounts,
placeholder: i18n2.str`Select one account`,
tooltip: i18n2.str`filter by account address`
}
)
)), /* @__PURE__ */ h("div", { class: "column" })), /* @__PURE__ */ h("div", { class: "tabs" }, /* @__PURE__ */ h("ul", null, /* @__PURE__ */ h("li", { class: isAllTransfers ? "is-active" : "" }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`remove all filters`
},
/* @__PURE__ */ h("a", { onClick: onShowAll }, /* @__PURE__ */ h(i18n2.Translate, null, "All"))
)), /* @__PURE__ */ h("li", { class: isVerifiedTransfers ? "is-active" : "" }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`only show wire transfers confirmed by the merchant`
},
/* @__PURE__ */ h("a", { onClick: onShowVerified }, /* @__PURE__ */ h(i18n2.Translate, null, "Verified"))
)), /* @__PURE__ */ h("li", { class: isNonVerifiedTransfers ? "is-active" : "" }, /* @__PURE__ */ h(
"div",
{
class: "has-tooltip-right",
"data-tooltip": i18n2.str`only show wire transfers claimed by the exchange`
},
/* @__PURE__ */ h("a", { onClick: onShowUnverified }, /* @__PURE__ */ h(i18n2.Translate, null, "Unverified"))
)))), /* @__PURE__ */ h(
CardTable9,
{
transfers: transfers.map((o3) => __spreadProps(__spreadValues({}, o3), {
id: String(o3.transfer_serial_id)
})),
accounts,
onCreate,
onDelete,
onLoadMoreBefore,
hasMoreBefore: !onLoadMoreBefore,
onLoadMoreAfter,
hasMoreAfter: !onLoadMoreAfter
}
));
}
// src/paths/instance/transfers/list/index.tsx
function ListTransfer({
onUnauthorized,
onLoadError,
onCreate,
onNotFound
}) {
const [form, setForm] = p3({ payto_uri: "" });
const setFilter = (s5) => setForm(__spreadProps(__spreadValues({}, form), { verified: s5 }));
const [position, setPosition] = p3(void 0);
const instance = useInstanceBankAccounts();
const accounts = !instance.ok ? [] : instance.data.accounts.map((a5) => a5.payto_uri);
const isVerifiedTransfers = form.verified === "yes";
const isNonVerifiedTransfers = form.verified === "no";
const isAllTransfers = form.verified === void 0;
const result = useInstanceTransfers(
{
position,
payto_uri: form.payto_uri === "" ? void 0 : form.payto_uri,
verified: form.verified
},
(id) => setPosition(id)
);
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(
ListPage7,
{
accounts,
transfers: result.data.transfers,
onLoadMoreBefore: result.isReachingStart ? result.loadMorePrev : void 0,
onLoadMoreAfter: result.isReachingEnd ? result.loadMore : void 0,
onCreate,
onDelete: () => {
null;
},
onShowAll: () => setFilter(void 0),
onShowUnverified: () => setFilter("no"),
onShowVerified: () => setFilter("yes"),
isAllTransfers,
isVerifiedTransfers,
isNonVerifiedTransfers,
payTo: form.payto_uri,
onChangePayTo: (p4) => setForm((v3) => __spreadProps(__spreadValues({}, v3), { payto_uri: p4 }))
}
);
}
// src/paths/instance/update/index.tsx
init_preact_module();
init_hooks_module();
// src/paths/instance/update/UpdatePage.tsx
init_preact_module();
init_hooks_module();
function convert(from) {
const rest = __objRest(from, []);
const defaults = {
use_stefan: false,
default_pay_delay: { d_us: 2 * 1e3 * 1e3 * 60 * 60 },
//two hours
default_wire_transfer_delay: { d_us: 2 * 1e3 * 1e3 * 60 * 60 * 2 }
//two hours
};
return __spreadValues(__spreadValues({}, defaults), rest);
}
function UpdatePage6({
onUpdate,
onChangeAuth,
selected,
onBack
}) {
var _a, _b, _c, _d;
const { id } = useInstanceContext();
const [value, valueHandler] = p3(convert(selected));
const { i18n: i18n2 } = useTranslationContext();
const errors2 = {
name: !value.name ? i18n2.str`required` : 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,
default_pay_delay: !value.default_pay_delay ? i18n2.str`required` : void 0,
default_wire_transfer_delay: !value.default_wire_transfer_delay ? i18n2.str`required` : void 0,
address: undefinedIfEmpty({
address_lines: ((_a = value.address) == null ? void 0 : _a.address_lines) && ((_b = value.address) == null ? void 0 : _b.address_lines.length) > 7 ? i18n2.str`max 7 lines` : void 0
}),
jurisdiction: undefinedIfEmpty({
address_lines: ((_c = value.address) == null ? void 0 : _c.address_lines) && ((_d = value.address) == null ? void 0 : _d.address_lines.length) > 7 ? i18n2.str`max 7 lines` : void 0
})
};
const hasErrors = Object.keys(errors2).some(
(k5) => errors2[k5] !== void 0
);
const submit = () => __async(this, null, function* () {
yield onUpdate(value);
});
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("hr", null), /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, /* @__PURE__ */ h(
FormProvider,
{
errors: errors2,
object: value,
valueHandler
},
/* @__PURE__ */ h(DefaultInstanceFormFields, { showId: false })
), /* @__PURE__ */ h("div", { class: "buttons is-right mt-4" }, /* @__PURE__ */ h(
"button",
{
class: "button",
onClick: onBack,
"data-tooltip": "cancel operation"
},
/* @__PURE__ */ h(i18n2.Translate, null, "Cancel")
), /* @__PURE__ */ h(
AsyncButton,
{
onClick: submit,
"data-tooltip": hasErrors ? i18n2.str`Need to complete marked fields` : "confirm operation",
disabled: hasErrors
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
))), /* @__PURE__ */ h("div", { class: "column" }))));
}
// src/paths/instance/update/index.tsx
function Update2(props) {
const { updateInstance, clearToken, setNewToken } = useInstanceAPI();
const result = useInstanceDetails();
return CommonUpdate(props, result, updateInstance, clearToken, setNewToken);
}
function AdminUpdate(props) {
const { updateInstance, clearToken, setNewToken } = useManagementAPI(
props.instanceId
);
const result = useManagedInstanceDetails(props.instanceId);
return CommonUpdate(props, result, updateInstance, clearToken, setNewToken);
}
function CommonUpdate({
onBack,
onConfirm,
onLoadError,
onNotFound,
onUpdateError,
onUnauthorized
}, result, updateInstance, clearToken, setNewToken) {
const [notif, setNotif] = p3(void 0);
const { i18n: i18n2 } = useTranslationContext();
if (result.loading)
return /* @__PURE__ */ h(Loading, null);
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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
UpdatePage6,
{
onBack,
isLoading: false,
selected: result.data,
onUpdate: (d5) => {
return updateInstance(d5).then(onConfirm).catch(
(error2) => setNotif({
message: i18n2.str`Failed to create instance`,
type: "ERROR",
description: error2.message
})
);
},
onChangeAuth: (d5) => {
const apiCall = d5.method === "external" ? clearToken() : setNewToken(d5.token);
return apiCall.then(onConfirm).catch(onUpdateError);
}
}
));
}
// src/paths/login/index.tsx
init_preact_module();
init_hooks_module();
function normalizeToken(r3) {
return `secret-token:${r3}`;
}
function cleanUp(s5) {
let result = s5;
if (result.indexOf("webui/") !== -1) {
result = result.substring(0, result.indexOf("webui/"));
}
return result;
}
function LoginPage({ onConfirm }) {
const { url: backendURL, changeBackend } = useBackendContext();
const { admin, id } = useInstanceContext();
const { requestNewLoginToken } = useCredentialsChecker();
const [token, setToken] = p3("");
const { i18n: i18n2 } = useTranslationContext();
const doLogin = T2(function doLoginImpl() {
return __async(this, null, function* () {
const secretToken = normalizeToken(token);
const baseUrl = id === void 0 ? backendURL : `${backendURL}/instances/${id}`;
const result = yield requestNewLoginToken(baseUrl, secretToken);
if (result.valid) {
const { token: token2, expiration } = result;
onConfirm({ token: token2, expiration });
} else {
onConfirm(void 0);
}
});
}, [backendURL, id, token]);
function changeServer() {
return __async(this, null, function* () {
changeBackend("");
});
}
console.log(admin, id);
if (admin && id !== "default") {
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",
{
class: "modal-card-head",
style: { border: "1px solid", borderBottom: 0 }
},
/* @__PURE__ */ h("p", { class: "modal-card-title" }, i18n2.str`Login required`)
), /* @__PURE__ */ h(
"section",
{
class: "modal-card-body",
style: { border: "1px solid", borderTop: 0, borderBottom: 0 }
},
/* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "Need the access token for the instance.")),
/* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Access Token"))), /* @__PURE__ */ h("div", { class: "field-body" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control is-expanded" }, /* @__PURE__ */ h(
"input",
{
class: "input",
type: "password",
placeholder: "current access token",
name: "token",
onKeyPress: (e4) => e4.keyCode === 13 ? doLogin() : null,
value: token,
onInput: (e4) => setToken(e4 == null ? void 0 : e4.currentTarget.value)
}
)))))
), /* @__PURE__ */ h(
"footer",
{
class: "modal-card-foot ",
style: {
justifyContent: "flex-end",
border: "1px solid",
borderTop: 0
}
},
/* @__PURE__ */ h(
AsyncButton2,
{
onClick: doLogin
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
)
))));
}
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",
{
class: "modal-card-head",
style: { border: "1px solid", borderBottom: 0 }
},
/* @__PURE__ */ h("p", { class: "modal-card-title" }, i18n2.str`Login required`)
), /* @__PURE__ */ h(
"section",
{
class: "modal-card-body",
style: { border: "1px solid", borderTop: 0, borderBottom: 0 }
},
/* @__PURE__ */ h(i18n2.Translate, null, "Please enter your access token."),
/* @__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" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control is-expanded" }, /* @__PURE__ */ h(
"input",
{
class: "input",
type: "text",
placeholder: "set new url",
name: "id",
value: backendURL,
disabled: true,
readOnly: true
}
))))),
/* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Access Token"))), /* @__PURE__ */ h("div", { class: "field-body" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control is-expanded" }, /* @__PURE__ */ h(
"input",
{
class: "input",
type: "password",
placeholder: "current access token",
name: "token",
onKeyPress: (e4) => e4.keyCode === 13 ? doLogin() : null,
value: token,
onInput: (e4) => setToken(e4 == null ? void 0 : e4.currentTarget.value)
}
)))))
), /* @__PURE__ */ h(
"footer",
{
class: "modal-card-foot ",
style: {
justifyContent: "space-between",
border: "1px solid",
borderTop: 0
}
},
/* @__PURE__ */ h(
AsyncButton2,
{
onClick: changeServer
},
/* @__PURE__ */ h(i18n2.Translate, null, "Change server")
),
/* @__PURE__ */ h(
AsyncButton2,
{
type: "is-info",
onClick: doLogin
},
/* @__PURE__ */ h(i18n2.Translate, null, "Confirm")
)
))));
}
function AsyncButton2({ onClick, disabled, type = "", children }) {
const [running, setRunning] = p3(false);
return /* @__PURE__ */ h("button", { class: "button " + type, disabled: disabled || running, onClick: () => {
setRunning(true);
onClick().then(() => {
setRunning(false);
}).catch(() => {
setRunning(false);
});
} }, children);
}
function ConnectionPage({ onConfirm }) {
const { url: backendURL } = useBackendContext();
const [url, setURL] = p3(cleanUp(backendURL));
const { i18n: i18n2 } = useTranslationContext();
function doConnect() {
return __async(this, null, function* () {
onConfirm(url);
});
}
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",
{
class: "modal-card-head",
style: { border: "1px solid", borderBottom: 0 }
},
/* @__PURE__ */ h("p", { class: "modal-card-title" }, i18n2.str`Connect to backend`)
), /* @__PURE__ */ h(
"section",
{
class: "modal-card-body",
style: { border: "1px solid", borderTop: 0, borderBottom: 0 }
},
/* @__PURE__ */ h(i18n2.Translate, null, "Location of the backend server"),
/* @__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" }, /* @__PURE__ */ h("div", { class: "field" }, /* @__PURE__ */ h("p", { class: "control is-expanded" }, /* @__PURE__ */ h(
"input",
{
class: "input",
type: "text",
placeholder: "set new url",
name: "id",
value: url != null ? url : "",
onKeyPress: (e4) => e4.keyCode === 13 ? doConnect() : null,
onInput: (e4) => setURL(e4 == null ? void 0 : e4.currentTarget.value)
}
)))))
), /* @__PURE__ */ h(
"footer",
{
class: "modal-card-foot ",
style: {
justifyContent: "flex-end",
border: "1px solid",
borderTop: 0
}
},
/* @__PURE__ */ h(
AsyncButton2,
{
disabled: backendURL === url,
onClick: doConnect
},
/* @__PURE__ */ h(i18n2.Translate, null, "Try again")
)
))));
}
// src/paths/notfound/index.tsx
init_preact_module();
function NotFoundPage() {
return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("p", null, "That page doesn't exist."), /* @__PURE__ */ h(Link, { href: "/" }, /* @__PURE__ */ h("h4", null, "Back to Home")));
}
// src/paths/settings/index.tsx
init_preact_module();
function getBrowserLang2() {
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;
}
function Settings({ onClose }) {
const { i18n: i18n2 } = useTranslationContext();
const borwserLang = getBrowserLang2();
const { update } = useLang();
const [value, updateValue] = useSettings();
const errors2 = {};
function valueHandler(s5) {
var _a, _b;
const next = s5(value);
const v3 = {
advanceOrderMode: (_a = next.advanceOrderMode) != null ? _a : false,
dateFormat: (_b = next.dateFormat) != null ? _b : "ymd"
};
updateValue(v3);
}
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", null, /* @__PURE__ */ h(
FormProvider,
{
name: "settings",
errors: errors2,
object: value,
valueHandler
},
/* @__PURE__ */ h("div", { class: "field is-horizontal" }, /* @__PURE__ */ h("div", { class: "field-label is-normal" }, /* @__PURE__ */ h("label", { class: "label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Language"), /* @__PURE__ */ h("span", { class: "icon has-tooltip-right", "data-tooltip": "Force language setting instance of taking the browser" }, /* @__PURE__ */ h("i", { class: "mdi mdi-information" })))), /* @__PURE__ */ h("div", { class: "field field-body has-addons is-flex-grow-3" }, /* @__PURE__ */ h(LangSelector, null), "\xA0", borwserLang !== void 0 && /* @__PURE__ */ h(
"button",
{
"data-tooltip": i18n2.str`generate random secret key`,
class: "button is-info mr-2",
onClick: (e4) => {
update(borwserLang.substring(0, 2));
}
},
/* @__PURE__ */ h(i18n2.Translate, null, "Set default")
))),
/* @__PURE__ */ h(
InputToggle,
{
label: i18n2.str`Advance order creation`,
tooltip: i18n2.str`Shows more options in the order creation form`,
name: "advanceOrderMode"
}
),
/* @__PURE__ */ h(
InputSelector,
{
name: "dateFormat",
label: i18n2.str`Date format`,
expand: true,
help: value.dateFormat === "dmy" ? "31/12/2001" : value.dateFormat === "mdy" ? "12/31/2001" : value.dateFormat === "ymd" ? "2001/12/31" : "",
toStr: (e4) => {
if (e4 === "ymd")
return "year month day";
if (e4 === "mdy")
return "month day year";
if (e4 === "dmy")
return "day month year";
return "choose one";
},
values: [
"ymd",
"mdy",
"dmy"
],
tooltip: i18n2.str`how the date is going to be displayed`
}
)
))), /* @__PURE__ */ h("div", { class: "column" }))), onClose && /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(
"button",
{
class: "button",
onClick: onClose
},
/* @__PURE__ */ h(i18n2.Translate, null, "Close")
)));
}
// src/InstanceRoutes.tsx
var noop2 = () => {
};
function InstanceRoutes({
id,
admin,
path,
// onUnauthorized,
onLoginPass,
setInstanceName
}) {
const [defaultToken, updateDefaultToken] = useBackendDefaultToken();
const [token, updateToken] = useBackendInstanceToken(id);
const { i18n: i18n2 } = useTranslationContext();
const [globalNotification, setGlobalNotification] = p3(void 0);
const changeToken = (token2) => {
if (admin) {
updateToken(token2);
} else {
updateDefaultToken(token2);
}
onLoginPass();
};
const value = F(
() => ({ id, token, admin, changeToken }),
[id, token, admin]
);
function ServerErrorRedirectTo(to) {
return function ServerErrorRedirectToImpl(error2) {
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 ${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 ${error2.info.url} is '${error2.message}'`,
details: error2.type === ErrorType.CLIENT || error2.type === ErrorType.SERVER ? error2.payload.detail : void 0,
type: "ERROR",
to
});
}
return /* @__PURE__ */ h(Redirect, { to });
};
}
const LoginPageAccessDenied = () => {
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
NotificationCard,
{
notification: {
message: i18n2.str`Access denied`,
description: i18n2.str`Redirecting to login page.`,
type: "ERROR"
}
}
), /* @__PURE__ */ h(LoginPage, { onConfirm: changeToken }));
};
function IfAdminCreateDefaultOr(Next) {
return function IfAdminCreateDefaultOrImpl(props) {
if (admin && id === "default") {
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
NotificationCard,
{
notification: {
message: i18n2.str`No 'default' instance configured yet.`,
description: i18n2.str`Create a 'default' instance to begin using the merchant backoffice.`,
type: "INFO"
}
}
), /* @__PURE__ */ h(
Create,
{
forceId: "default",
onConfirm: () => {
route("/instances" /* list_instances */);
}
}
));
}
if (props) {
return /* @__PURE__ */ h(Next, __spreadValues({}, props));
}
return /* @__PURE__ */ h(Next, null);
};
}
const clearTokenAndGoToRoot = () => {
route("/");
updateToken(void 0);
updateDefaultToken(void 0);
};
return /* @__PURE__ */ h(InstanceContextProvider, { value }, /* @__PURE__ */ h(
Menu,
{
instance: id,
admin,
onShowSettings: () => {
route("/interface" /* settings */);
},
path,
onLogout: clearTokenAndGoToRoot,
setInstanceName,
isPasswordOk: defaultToken !== void 0
}
), /* @__PURE__ */ h(KycBanner, null), /* @__PURE__ */ h(NotificationCard, { notification: globalNotification }), /* @__PURE__ */ h(
Router,
{
onChange: (e4) => {
const movingOutFromNotification = globalNotification && e4.url !== globalNotification.to;
if (movingOutFromNotification) {
setGlobalNotification(void 0);
}
}
},
/* @__PURE__ */ h(Route, { path: "/", component: Redirect, to: "/orders" /* order_list */ }),
admin && /* @__PURE__ */ h(
Route,
{
path: "/instances" /* list_instances */,
component: Instances,
onCreate: () => {
route("/instance/new" /* new_instance */);
},
onUpdate: (id2) => {
route(`/instance/${id2}/update`);
},
setInstanceName,
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/error" /* error */)
}
),
admin && /* @__PURE__ */ h(
Route,
{
path: "/instance/new" /* new_instance */,
component: Create,
onBack: () => route("/instances" /* list_instances */),
onConfirm: () => {
route("/instances" /* list_instances */);
}
}
),
admin && /* @__PURE__ */ h(
Route,
{
path: "/instance/:id/update" /* update_instance */,
component: AdminInstanceUpdatePage,
onBack: () => route("/instances" /* list_instances */),
onConfirm: () => {
route("/instances" /* list_instances */);
},
onUpdateError: ServerErrorRedirectTo("/instances" /* list_instances */),
onLoadError: ServerErrorRedirectTo("/instances" /* list_instances */),
onNotFound: NotFoundPage
}
),
/* @__PURE__ */ h(
Route,
{
path: "/server" /* server */,
component: Update2,
onBack: () => {
route(`/`);
},
onConfirm: () => {
route(`/`);
},
onUpdateError: noop2,
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/error" /* error */)
}
),
/* @__PURE__ */ h(
Route,
{
path: "/token" /* token */,
component: Token,
onChange: () => {
route(`/`);
},
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/error" /* error */)
}
),
/* @__PURE__ */ h(
Route,
{
path: "/products" /* product_list */,
component: ProductList2,
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/server" /* server */),
onCreate: () => {
route("/product/new" /* product_new */);
},
onSelect: (id2) => {
route("/product/:pid/update" /* product_update */.replace(":pid", id2));
},
onNotFound: IfAdminCreateDefaultOr(NotFoundPage)
}
),
/* @__PURE__ */ h(
Route,
{
path: "/product/:pid/update" /* product_update */,
component: UpdateProduct,
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/products" /* product_list */),
onConfirm: () => {
route("/products" /* product_list */);
},
onBack: () => {
route("/products" /* product_list */);
},
onNotFound: IfAdminCreateDefaultOr(NotFoundPage)
}
),
/* @__PURE__ */ h(
Route,
{
path: "/product/new" /* product_new */,
component: CreateProduct,
onConfirm: () => {
route("/products" /* product_list */);
},
onBack: () => {
route("/products" /* product_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/bank" /* bank_list */,
component: ListValidators,
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/server" /* server */),
onCreate: () => {
route("/bank/new" /* bank_new */);
},
onSelect: (id2) => {
route("/bank/:bid/update" /* bank_update */.replace(":bid", id2));
},
onNotFound: IfAdminCreateDefaultOr(NotFoundPage)
}
),
/* @__PURE__ */ h(
Route,
{
path: "/bank/:bid/update" /* bank_update */,
component: UpdateValidator,
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/products" /* product_list */),
onConfirm: () => {
route("/bank" /* bank_list */);
},
onBack: () => {
route("/bank" /* bank_list */);
},
onNotFound: IfAdminCreateDefaultOr(NotFoundPage)
}
),
/* @__PURE__ */ h(
Route,
{
path: "/bank/new" /* bank_new */,
component: CreateValidator,
onConfirm: () => {
route("/bank" /* bank_list */);
},
onBack: () => {
route("/bank" /* bank_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/orders" /* order_list */,
component: OrderList,
onCreate: () => {
route("/order/new" /* order_new */);
},
onSelect: (id2) => {
route("/order/:oid/details" /* order_details */.replace(":oid", id2));
},
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/server" /* server */),
onNotFound: IfAdminCreateDefaultOr(NotFoundPage)
}
),
/* @__PURE__ */ h(
Route,
{
path: "/order/:oid/details" /* order_details */,
component: Update,
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/orders" /* order_list */),
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onBack: () => {
route("/orders" /* order_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/order/new" /* order_new */,
component: OrderCreate,
onConfirm: (orderId) => {
route("/order/:oid/details" /* order_details */.replace(":oid", orderId));
},
onBack: () => {
route("/orders" /* order_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/transfers" /* transfers_list */,
component: ListTransfer,
onUnauthorized: LoginPageAccessDenied,
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onLoadError: ServerErrorRedirectTo("/server" /* server */),
onCreate: () => {
route("/transfer/new" /* transfers_new */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/transfer/new" /* transfers_new */,
component: CreateTransfer2,
onConfirm: () => {
route("/transfers" /* transfers_list */);
},
onBack: () => {
route("/transfers" /* transfers_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/webhooks" /* webhooks_list */,
component: ListWebhooks,
onUnauthorized: LoginPageAccessDenied,
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onLoadError: ServerErrorRedirectTo("/server" /* server */),
onCreate: () => {
route("/webhooks/new" /* webhooks_new */);
},
onSelect: (id2) => {
route("/webhooks/:tid/update" /* webhooks_update */.replace(":tid", id2));
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/webhooks/:tid/update" /* webhooks_update */,
component: UpdateWebhook,
onConfirm: () => {
route("/webhooks" /* webhooks_list */);
},
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/webhooks" /* webhooks_list */),
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onBack: () => {
route("/webhooks" /* webhooks_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/webhooks/new" /* webhooks_new */,
component: CreateWebhook,
onConfirm: () => {
route("/webhooks" /* webhooks_list */);
},
onBack: () => {
route("/webhooks" /* webhooks_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/validators" /* validators_list */,
component: ListValidators2,
onUnauthorized: LoginPageAccessDenied,
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onLoadError: ServerErrorRedirectTo("/server" /* server */),
onCreate: () => {
route("/validators/new" /* validators_new */);
},
onSelect: (id2) => {
route("/validators/:vid/update" /* validators_update */.replace(":vid", id2));
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/validators/:vid/update" /* validators_update */,
component: UpdateValidator2,
onConfirm: () => {
route("/validators" /* validators_list */);
},
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/validators" /* validators_list */),
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onBack: () => {
route("/validators" /* validators_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/validators/new" /* validators_new */,
component: CreateValidator2,
onConfirm: () => {
route("/validators" /* validators_list */);
},
onBack: () => {
route("/validators" /* validators_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/templates" /* templates_list */,
component: ListTemplates,
onUnauthorized: LoginPageAccessDenied,
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onLoadError: ServerErrorRedirectTo("/server" /* server */),
onCreate: () => {
route("/templates/new" /* templates_new */);
},
onNewOrder: (id2) => {
route("/templates/:tid/use" /* templates_use */.replace(":tid", id2));
},
onQR: (id2) => {
route("/templates/:tid/qr" /* templates_qr */.replace(":tid", id2));
},
onSelect: (id2) => {
route("/templates/:tid/update" /* templates_update */.replace(":tid", id2));
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/templates/:tid/update" /* templates_update */,
component: UpdateTemplate,
onConfirm: () => {
route("/templates" /* templates_list */);
},
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/templates" /* templates_list */),
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onBack: () => {
route("/templates" /* templates_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/templates/new" /* templates_new */,
component: CreateTransfer,
onConfirm: () => {
route("/templates" /* templates_list */);
},
onBack: () => {
route("/templates" /* templates_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/templates/:tid/use" /* templates_use */,
component: TemplateUsePage,
onOrderCreated: (id2) => {
route("/order/:oid/details" /* order_details */.replace(":oid", id2));
},
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/templates" /* templates_list */),
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onBack: () => {
route("/templates" /* templates_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/templates/:tid/qr" /* templates_qr */,
component: TemplateQrPage,
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/templates" /* templates_list */),
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onBack: () => {
route("/templates" /* templates_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/reserves" /* reserves_list */,
component: ListRewards,
onUnauthorized: LoginPageAccessDenied,
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onLoadError: ServerErrorRedirectTo("/server" /* server */),
onSelect: (id2) => {
route("/reserves/:rid/details" /* reserves_details */.replace(":rid", id2));
},
onCreate: () => {
route("/reserves/new" /* reserves_new */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/reserves/:rid/details" /* reserves_details */,
component: DetailReserve,
onUnauthorized: LoginPageAccessDenied,
onLoadError: ServerErrorRedirectTo("/reserves" /* reserves_list */),
onNotFound: IfAdminCreateDefaultOr(NotFoundPage),
onBack: () => {
route("/reserves" /* reserves_list */);
}
}
),
/* @__PURE__ */ h(
Route,
{
path: "/reserves/new" /* reserves_new */,
component: CreateReserve,
onConfirm: () => {
route("/reserves" /* reserves_list */);
},
onBack: () => {
route("/reserves" /* reserves_list */);
}
}
),
/* @__PURE__ */ h(Route, { path: "/kyc" /* kyc */, component: ListKYC }),
/* @__PURE__ */ h(Route, { path: "/interface" /* settings */, component: Settings }),
/* @__PURE__ */ h(Route, { path: "/loading", component: Loading }),
/* @__PURE__ */ h(Route, { default: true, component: NotFoundPage })
));
}
function Redirect({ to }) {
h2(() => {
route(to, true);
});
return null;
}
function AdminInstanceUpdatePage(_a) {
var _b = _a, {
id
} = _b, rest = __objRest(_b, [
"id"
]);
const [token, changeToken] = useBackendInstanceToken(id);
const updateLoginStatus = (token2) => {
changeToken(token2);
};
const value = F(
() => ({ id, token, admin: true, changeToken }),
[id, token]
);
const { i18n: i18n2 } = useTranslationContext();
return /* @__PURE__ */ h(InstanceContextProvider, { value }, /* @__PURE__ */ h(
AdminUpdate,
__spreadProps(__spreadValues({}, rest), {
instanceId: id,
onLoadError: (error2) => {
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 ${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 ${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(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginStatus }));
},
onUnauthorized: () => {
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
NotificationCard,
{
notification: {
message: i18n2.str`Access denied`,
description: i18n2.str`The access token provided is invalid`,
type: "ERROR"
}
}
), /* @__PURE__ */ h(LoginPage, { onConfirm: updateLoginStatus }));
}
})
));
}
function KycBanner() {
const kycStatus = useInstanceKYCDetails();
const { i18n: i18n2 } = useTranslationContext();
const [settings] = useSettings();
const today = format(/* @__PURE__ */ new Date(), dateFormatForSettings(settings));
const [lastHide, setLastHide] = useSimpleLocalStorage("kyc-last-hide");
const hasBeenHidden = today === lastHide;
const needsToBeShown = kycStatus.ok && kycStatus.data.type === "redirect";
if (hasBeenHidden || !needsToBeShown)
return /* @__PURE__ */ h(p2, null);
return /* @__PURE__ */ h(
NotificationCard,
{
notification: {
type: "WARN",
message: "KYC verification needed",
description: /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("p", null, "Some transfer are on hold until a KYC process is completed. Go to the KYC section in the left panel for more information"), /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h("button", { class: "button", onClick: () => setLastHide(today) }, /* @__PURE__ */ h(i18n2.Translate, null, "Hide for today"))))
}
}
);
}
// src/ApplicationReadyRoutes.tsx
function ApplicationReadyRoutes() {
const { i18n: i18n2 } = useTranslationContext();
const { url: backendURL, changeBackend } = useBackendContext();
const [unauthorized, setUnauthorized] = p3(false);
const {
updateToken
} = useBackendContext();
function updateLoginStatus(token) {
updateToken(token);
setUnauthorized(false);
}
const result = useBackendInstancesTestForAdmin();
const clearTokenAndGoToRoot = () => {
route("/");
};
const [showSettings, setShowSettings] = p3(false);
const unauthorizedAdmin = !result.loading && !result.ok && result.type === ErrorType.CLIENT && result.status === HttpStatusCode.Unauthorized;
if (showSettings) {
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { onShowSettings: () => setShowSettings(true), title: "UI Settings", onLogout: clearTokenAndGoToRoot, isPasswordOk: false }), /* @__PURE__ */ h(Settings, { onClose: () => setShowSettings(false) }));
}
if (result.loading) {
return /* @__PURE__ */ h(NotYetReadyAppMenu, { onShowSettings: () => setShowSettings(true), title: "Loading...", isPasswordOk: false });
}
let admin = result.ok || unauthorizedAdmin;
let instanceNameByBackendURL;
if (!admin) {
const path = new URL(backendURL).pathname;
const match2 = INSTANCE_ID_LOOKUP.exec(path);
if (!match2 || !match2[1]) {
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { onShowSettings: () => setShowSettings(true), title: "Error", onLogout: clearTokenAndGoToRoot, isPasswordOk: false }), /* @__PURE__ */ h(
NotificationCard,
{
notification: {
message: i18n2.str`Couldn't access the server.`,
description: i18n2.str`Could not infer instance id from url ${backendURL}`,
type: "ERROR"
}
}
), /* @__PURE__ */ h(ConnectionPage, { onConfirm: changeBackend }));
}
instanceNameByBackendURL = match2[1];
}
if (unauthorized || unauthorizedAdmin) {
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotYetReadyAppMenu, { onShowSettings: () => setShowSettings(true), title: "Login", onLogout: clearTokenAndGoToRoot, isPasswordOk: false }), /* @__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 history2 = createHashHistory();
return /* @__PURE__ */ h(Router, { history: history2 }, /* @__PURE__ */ h(
Route,
{
default: true,
component: DefaultMainRoute,
admin,
onUnauthorized: () => setUnauthorized(true),
onLoginPass: () => {
setUnauthorized(false);
},
instanceNameByBackendURL
}
));
}
function DefaultMainRoute({
instance,
admin,
onUnauthorized,
onLoginPass,
instanceNameByBackendURL,
url
//from preact-router
}) {
const [instanceName, setInstanceName] = p3(
instanceNameByBackendURL || instance || "default"
);
return /* @__PURE__ */ h(
InstanceRoutes,
{
admin,
path: url,
onUnauthorized,
onLoginPass,
id: instanceName,
setInstanceName
}
);
}
// src/Application.tsx
function Application() {
return /* @__PURE__ */ h(BackendContextProvider, null, /* @__PURE__ */ h(TranslationProvider, { source: strings }, /* @__PURE__ */ h(ApplicationStatusRoutes, null)));
}
function ApplicationStatusRoutes() {
var _a, _b, _c, _d;
const { url: backendURL, updateToken, changeBackend } = useBackendContext();
const result = useBackendConfig();
const { i18n: i18n2 } = useTranslationContext();
const { currency, version } = result.ok ? result.data : { currency: "unknown", version: "unknown" };
const ctx = F(() => ({ currency, version }), [currency, version]);
if (!backendURL) {
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotConnectedAppMenu, { title: "Welcome!" }), /* @__PURE__ */ h(ConnectionPage, { onConfirm: changeBackend }));
}
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(NotConnectedAppMenu, { title: "Login" }), /* @__PURE__ */ h(ConnectionPage, { onConfirm: changeBackend }));
}
if (result.type === ErrorType.CLIENT && result.status === HttpStatusCode.NotFound) {
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotConnectedAppMenu, { title: "Error" }), /* @__PURE__ */ h(
NotificationCard,
{
notification: {
message: i18n2.str`Server not found`,
type: "ERROR",
description: `Check your url`
}
}
), /* @__PURE__ */ h(ConnectionPage, { onConfirm: changeBackend }));
}
if (result.type === ErrorType.SERVER) {
/* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotConnectedAppMenu, { 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 ${(_a = result.info) == null ? void 0 : _a.url}`
}
}
), /* @__PURE__ */ h(ConnectionPage, { onConfirm: changeBackend }));
}
if (result.type === ErrorType.UNREADABLE) {
/* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotConnectedAppMenu, { 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(ConnectionPage, { onConfirm: changeBackend }));
}
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotConnectedAppMenu, { title: "Error" }), /* @__PURE__ */ h(
NotificationCard,
{
notification: {
message: i18n2.str`Unexpected Error`,
type: "ERROR",
description: i18n2.str`Got message "${result.message}" from ${(_c = result.info) == null ? void 0 : _c.url}`
}
}
), /* @__PURE__ */ h(ConnectionPage, { onConfirm: changeBackend }));
}
const SUPPORTED_VERSION = "5:0:1";
if (!((_d = LibtoolVersion.compare(
SUPPORTED_VERSION,
result.data.version
)) == null ? void 0 : _d.compatible)) {
return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotConnectedAppMenu, { title: "Error" }), /* @__PURE__ */ h(
NotificationCard,
{
notification: {
message: i18n2.str`Incompatible version`,
type: "ERROR",
description: i18n2.str`Merchant backend server version ${result.data.version} is not compatible with the supported version ${SUPPORTED_VERSION}`
}
}
), /* @__PURE__ */ h(ConnectionPage, { onConfirm: changeBackend }));
}
return /* @__PURE__ */ h("div", { class: "has-navbar-fixed-top" }, /* @__PURE__ */ h(ConfigContextProvider, { value: ctx }, /* @__PURE__ */ h(ApplicationReadyRoutes, null)));
}
// src/index.tsx
init_preact_module();
var app = document.getElementById("app");
P(/* @__PURE__ */ h(Application, null), app);
/*! Bundled license information:
jed/jed.js:
(**
* @preserve jed.js https://github.com/SlexAxton/Jed
*)
use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
(**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
*/
//# sourceMappingURL=index.js.map